diff --git a/sdk/fileshares/Azure.ResourceManager.Fileshares/Azure.ResourceManager.Fileshares.sln b/sdk/fileshares/Azure.ResourceManager.Fileshares/Azure.ResourceManager.Fileshares.sln new file mode 100644 index 000000000000..8c11de1fe878 --- /dev/null +++ b/sdk/fileshares/Azure.ResourceManager.Fileshares/Azure.ResourceManager.Fileshares.sln @@ -0,0 +1,56 @@ +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.29709.97 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.ResourceManager.Fileshares.Samples", "samples\Azure.ResourceManager.Fileshares.Samples.csproj", "{7A2DFF15-5746-49F4-BD0F-C6C35337088A}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Azure.ResourceManager.Fileshares", "src\Azure.ResourceManager.Fileshares.csproj", "{28FF4005-4467-4E36-92E7-DEA27DEB1519}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Azure.ResourceManager.Fileshares.Tests", "tests\Azure.ResourceManager.Fileshares.Tests.csproj", "{1F1CD1D4-9932-4B73-99D8-C252A67D4B46}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {B0C276D1-2930-4887-B29A-D1A33E7009A2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B0C276D1-2930-4887-B29A-D1A33E7009A2}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B0C276D1-2930-4887-B29A-D1A33E7009A2}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B0C276D1-2930-4887-B29A-D1A33E7009A2}.Release|Any CPU.Build.0 = Release|Any CPU + {8E9A77AC-792A-4432-8320-ACFD46730401}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8E9A77AC-792A-4432-8320-ACFD46730401}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8E9A77AC-792A-4432-8320-ACFD46730401}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8E9A77AC-792A-4432-8320-ACFD46730401}.Release|Any CPU.Build.0 = Release|Any CPU + {7A2DFF15-5746-49F4-BD0F-C6C35337088A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {7A2DFF15-5746-49F4-BD0F-C6C35337088A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7A2DFF15-5746-49F4-BD0F-C6C35337088A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {7A2DFF15-5746-49F4-BD0F-C6C35337088A}.Release|Any CPU.Build.0 = Release|Any CPU + {A4241C1F-A53D-474C-9E4E-075054407E74}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A4241C1F-A53D-474C-9E4E-075054407E74}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A4241C1F-A53D-474C-9E4E-075054407E74}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A4241C1F-A53D-474C-9E4E-075054407E74}.Release|Any CPU.Build.0 = Release|Any CPU + {FA8BD3F1-8616-47B6-974C-7576CDF4717E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {FA8BD3F1-8616-47B6-974C-7576CDF4717E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {FA8BD3F1-8616-47B6-974C-7576CDF4717E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {FA8BD3F1-8616-47B6-974C-7576CDF4717E}.Release|Any CPU.Build.0 = Release|Any CPU + {85677AD3-C214-42FA-AE6E-49B956CAC8DC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {85677AD3-C214-42FA-AE6E-49B956CAC8DC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {85677AD3-C214-42FA-AE6E-49B956CAC8DC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {85677AD3-C214-42FA-AE6E-49B956CAC8DC}.Release|Any CPU.Build.0 = Release|Any CPU + {28FF4005-4467-4E36-92E7-DEA27DEB1519}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {28FF4005-4467-4E36-92E7-DEA27DEB1519}.Debug|Any CPU.Build.0 = Debug|Any CPU + {28FF4005-4467-4E36-92E7-DEA27DEB1519}.Release|Any CPU.ActiveCfg = Release|Any CPU + {28FF4005-4467-4E36-92E7-DEA27DEB1519}.Release|Any CPU.Build.0 = Release|Any CPU + {1F1CD1D4-9932-4B73-99D8-C252A67D4B46}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1F1CD1D4-9932-4B73-99D8-C252A67D4B46}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1F1CD1D4-9932-4B73-99D8-C252A67D4B46}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1F1CD1D4-9932-4B73-99D8-C252A67D4B46}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {A97F4B90-2591-4689-B1F8-5F21FE6D6CAE} + EndGlobalSection +EndGlobal diff --git a/sdk/fileshares/Azure.ResourceManager.Fileshares/CHANGELOG.md b/sdk/fileshares/Azure.ResourceManager.Fileshares/CHANGELOG.md new file mode 100644 index 000000000000..8b33f0fedccc --- /dev/null +++ b/sdk/fileshares/Azure.ResourceManager.Fileshares/CHANGELOG.md @@ -0,0 +1,11 @@ +# Release History + +## 1.0.0-beta.1 (Unreleased) + +### Features Added + +### Breaking Changes + +### Bugs Fixed + +### Other Changes \ No newline at end of file diff --git a/sdk/fileshares/Azure.ResourceManager.Fileshares/Directory.Build.props b/sdk/fileshares/Azure.ResourceManager.Fileshares/Directory.Build.props new file mode 100644 index 000000000000..63bd836ad44b --- /dev/null +++ b/sdk/fileshares/Azure.ResourceManager.Fileshares/Directory.Build.props @@ -0,0 +1,6 @@ + + + + diff --git a/sdk/fileshares/Azure.ResourceManager.Fileshares/README.md b/sdk/fileshares/Azure.ResourceManager.Fileshares/README.md new file mode 100644 index 000000000000..172be5595afc --- /dev/null +++ b/sdk/fileshares/Azure.ResourceManager.Fileshares/README.md @@ -0,0 +1,80 @@ +# Microsoft Azure Fileshares management client library for .NET + +**[Describe the service briefly first.]** + +This library follows the [new Azure SDK guidelines](https://azure.github.io/azure-sdk/general_introduction.html), and provides many core capabilities: + + - Support MSAL.NET, Azure.Identity is out of box for supporting MSAL.NET. + - Support [OpenTelemetry](https://opentelemetry.io/) for distributed tracing. + - HTTP pipeline with custom policies. + - Better error-handling. + - Support uniform telemetry across all languages. + +## Getting started + +### Install the package + +Install the Microsoft Azure Fileshares management library for .NET with [NuGet](https://www.nuget.org/): + +```dotnetcli +dotnet add package Azure.ResourceManager.Fileshares --prerelease +``` + +### Prerequisites + +* You must have an [Microsoft Azure subscription](https://azure.microsoft.com/free/dotnet/). + +### Authenticate the Client + +To create an authenticated client and start interacting with Microsoft Azure resources, see the [quickstart guide here](https://github.com/Azure/azure-sdk-for-net/blob/main/doc/dev/mgmt_quickstart.md). + +## Key concepts + +Key concepts of the Microsoft Azure SDK for .NET can be found [here](https://azure.github.io/azure-sdk/dotnet_introduction.html) + +## Documentation + +Documentation is available to help you learn how to use this package: + +- [Quickstart](https://github.com/Azure/azure-sdk-for-net/blob/main/doc/dev/mgmt_quickstart.md). +- [API References](https://learn.microsoft.com/dotnet/api/?view=azure-dotnet). +- [Authentication](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/identity/Azure.Identity/README.md). + +## Examples + +Code samples for using the management library for .NET can be found in the following locations +- [.NET Management Library Code Samples](https://aka.ms/azuresdk-net-mgmt-samples) + +## Troubleshooting + +- File an issue via [GitHub Issues](https://github.com/Azure/azure-sdk-for-net/issues). +- Check [previous questions](https://stackoverflow.com/questions/tagged/azure+.net) or ask new ones on Stack Overflow using Azure and .NET tags. + +## Next steps + +For more information about Microsoft Azure SDK, see [this website](https://azure.github.io/azure-sdk/). + +## Contributing + +For details on contributing to this repository, see the [contributing +guide][cg]. + +This project welcomes contributions and suggestions. Most contributions +require you to agree to a Contributor License Agreement (CLA) declaring +that you have the right to, and actually do, grant us the rights to use +your contribution. For details, visit . + +When you submit a pull request, a CLA-bot will automatically determine +whether you need to provide a CLA and decorate the PR appropriately +(for example, label, comment). Follow the instructions provided by the +bot. You'll only need to do this action once across all repositories +using our CLA. + +This project has adopted the [Microsoft Open Source Code of Conduct][coc]. For +more information, see the [Code of Conduct FAQ][coc_faq] or contact + with any other questions or comments. + + +[cg]: https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/resourcemanager/Azure.ResourceManager/docs/CONTRIBUTING.md +[coc]: https://opensource.microsoft.com/codeofconduct/ +[coc_faq]: https://opensource.microsoft.com/codeofconduct/faq/ \ No newline at end of file diff --git a/sdk/fileshares/Azure.ResourceManager.Fileshares/api/Azure.ResourceManager.Fileshares.net8.0.cs b/sdk/fileshares/Azure.ResourceManager.Fileshares/api/Azure.ResourceManager.Fileshares.net8.0.cs new file mode 100644 index 000000000000..a39b79254e2d --- /dev/null +++ b/sdk/fileshares/Azure.ResourceManager.Fileshares/api/Azure.ResourceManager.Fileshares.net8.0.cs @@ -0,0 +1,498 @@ +namespace Azure.ResourceManager.Fileshares +{ + public partial class AzureResourceManagerFilesharesContext : System.ClientModel.Primitives.ModelReaderWriterContext + { + internal AzureResourceManagerFilesharesContext() { } + public static Azure.ResourceManager.Fileshares.AzureResourceManagerFilesharesContext Default { get { throw null; } } + protected override bool TryGetTypeBuilderCore(System.Type type, out System.ClientModel.Primitives.ModelReaderWriterTypeBuilder builder) { throw null; } + } + public partial class FileShareCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected FileShareCollection() { } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string resourceName, Azure.ResourceManager.Fileshares.FileShareData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(Azure.WaitUntil waitUntil, string resourceName, Azure.ResourceManager.Fileshares.FileShareData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Exists(string resourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string resourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string resourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetAll(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAllAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(string resourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.NullableResponse GetIfExists(string resourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string resourceName, 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 FileShareData : Azure.ResourceManager.Models.TrackedResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public FileShareData(Azure.Core.AzureLocation location) { } + public Azure.ResourceManager.Fileshares.Models.FileShareProperties Properties { get { throw null; } set { } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Fileshares.FileShareData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Fileshares.FileShareData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class FileShareResource : Azure.ResourceManager.ArmResource, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public static readonly Azure.Core.ResourceType ResourceType; + protected FileShareResource() { } + public virtual Azure.ResourceManager.Fileshares.FileShareData Data { get { throw null; } } + public virtual bool HasData { get { throw null; } } + public virtual Azure.Response AddTag(string key, string value, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> AddTagAsync(string key, string value, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.Core.ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string resourceName) { 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.Response GetFileShareSnapshot(string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetFileShareSnapshotAsync(string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Fileshares.FileShareSnapshotCollection GetFileShareSnapshots() { throw null; } + public virtual Azure.Response RemoveTag(string key, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> RemoveTagAsync(string key, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response SetTags(System.Collections.Generic.IDictionary tags, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> SetTagsAsync(System.Collections.Generic.IDictionary tags, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + Azure.ResourceManager.Fileshares.FileShareData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Fileshares.FileShareData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + public virtual Azure.ResourceManager.ArmOperation Update(Azure.WaitUntil waitUntil, Azure.ResourceManager.Fileshares.Models.FileSharePatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.Fileshares.Models.FileSharePatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public static partial class FilesharesExtensions + { + public static Azure.Response CheckNameAvailabilityFileShare(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, Azure.Core.AzureLocation location, Azure.ResourceManager.Fileshares.Models.CheckNameAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static System.Threading.Tasks.Task> CheckNameAvailabilityFileShareAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, Azure.Core.AzureLocation location, Azure.ResourceManager.Fileshares.Models.CheckNameAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.Response GetFileShare(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string resourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static System.Threading.Tasks.Task> GetFileShareAsync(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string resourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.ResourceManager.Fileshares.FileShareResource GetFileShareResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.ResourceManager.Fileshares.FileShareCollection GetFileShares(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource) { throw null; } + public static Azure.Pageable GetFileShares(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.AsyncPageable GetFileSharesAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.ResourceManager.Fileshares.FileShareSnapshotResource GetFileShareSnapshotResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.Pageable GetOperations(this Azure.ResourceManager.Resources.TenantResource tenantResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.AsyncPageable GetOperationsAsync(this Azure.ResourceManager.Resources.TenantResource tenantResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class FileShareSnapshotCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected FileShareSnapshotCollection() { } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string name, Azure.ResourceManager.Fileshares.FileShareSnapshotData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(Azure.WaitUntil waitUntil, string name, Azure.ResourceManager.Fileshares.FileShareSnapshotData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Exists(string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetAll(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAllAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.NullableResponse GetIfExists(string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string name, 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 FileShareSnapshotData : Azure.ResourceManager.Models.ResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public FileShareSnapshotData() { } + public Azure.ResourceManager.Fileshares.Models.FileShareSnapshotProperties Properties { get { throw null; } set { } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Fileshares.FileShareSnapshotData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Fileshares.FileShareSnapshotData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class FileShareSnapshotResource : Azure.ResourceManager.ArmResource, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public static readonly Azure.Core.ResourceType ResourceType; + protected FileShareSnapshotResource() { } + public virtual Azure.ResourceManager.Fileshares.FileShareSnapshotData Data { get { throw null; } } + public virtual bool HasData { get { throw null; } } + public static Azure.Core.ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string resourceName, string name) { 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; } + Azure.ResourceManager.Fileshares.FileShareSnapshotData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Fileshares.FileShareSnapshotData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + public virtual Azure.ResourceManager.ArmOperation Update(Azure.WaitUntil waitUntil, Azure.ResourceManager.Fileshares.Models.FileShareSnapshotPatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.Fileshares.Models.FileShareSnapshotPatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} +namespace Azure.ResourceManager.Fileshares.Mocking +{ + public partial class MockableFilesharesArmClient : Azure.ResourceManager.ArmResource + { + protected MockableFilesharesArmClient() { } + public virtual Azure.ResourceManager.Fileshares.FileShareResource GetFileShareResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Fileshares.FileShareSnapshotResource GetFileShareSnapshotResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableFilesharesResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableFilesharesResourceGroupResource() { } + public virtual Azure.Response GetFileShare(string resourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetFileShareAsync(string resourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Fileshares.FileShareCollection GetFileShares() { throw null; } + } + public partial class MockableFilesharesSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableFilesharesSubscriptionResource() { } + public virtual Azure.Response CheckNameAvailabilityFileShare(Azure.Core.AzureLocation location, Azure.ResourceManager.Fileshares.Models.CheckNameAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CheckNameAvailabilityFileShareAsync(Azure.Core.AzureLocation location, Azure.ResourceManager.Fileshares.Models.CheckNameAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetFileShares(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetFileSharesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class MockableFilesharesTenantResource : Azure.ResourceManager.ArmResource + { + protected MockableFilesharesTenantResource() { } + public virtual Azure.Pageable GetOperations(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetOperationsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} +namespace Azure.ResourceManager.Fileshares.Models +{ + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct ActionType : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public ActionType(string value) { throw null; } + public static Azure.ResourceManager.Fileshares.Models.ActionType Internal { get { throw null; } } + public bool Equals(Azure.ResourceManager.Fileshares.Models.ActionType 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.Fileshares.Models.ActionType left, Azure.ResourceManager.Fileshares.Models.ActionType right) { throw null; } + public static implicit operator Azure.ResourceManager.Fileshares.Models.ActionType (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.Fileshares.Models.ActionType left, Azure.ResourceManager.Fileshares.Models.ActionType right) { throw null; } + public override string ToString() { throw null; } + } + public static partial class ArmFilesharesModelFactory + { + public static Azure.ResourceManager.Fileshares.Models.CheckNameAvailabilityResult CheckNameAvailabilityResult(bool? nameAvailable = default(bool?), Azure.ResourceManager.Fileshares.Models.CheckNameAvailabilityReason? reason = default(Azure.ResourceManager.Fileshares.Models.CheckNameAvailabilityReason?), string message = null) { throw null; } + public static Azure.ResourceManager.Fileshares.FileShareData FileShareData(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.Fileshares.Models.FileShareProperties properties = null) { throw null; } + public static Azure.ResourceManager.Fileshares.Models.FileShareProperties FileShareProperties(string mountName = null, string hostName = null, Azure.ResourceManager.Fileshares.Models.MediaTier? mediaTier = default(Azure.ResourceManager.Fileshares.Models.MediaTier?), Azure.ResourceManager.Fileshares.Models.Redundancy? redundancy = default(Azure.ResourceManager.Fileshares.Models.Redundancy?), Azure.ResourceManager.Fileshares.Models.Protocol? protocol = default(Azure.ResourceManager.Fileshares.Models.Protocol?), int? provisionedStorageGiB = default(int?), System.DateTimeOffset? provisionedStorageNextAllowedDowngrade = default(System.DateTimeOffset?), int? provisionedIOPerSec = default(int?), System.DateTimeOffset? provisionedIOPerSecNextAllowedDowngrade = default(System.DateTimeOffset?), int? provisionedThroughputMiBPerSec = default(int?), System.DateTimeOffset? provisionedThroughputNextAllowedDowngrade = default(System.DateTimeOffset?), int? includedBurstIOPerSec = default(int?), long? maxBurstIOPerSecCredits = default(long?), Azure.ResourceManager.Fileshares.Models.ShareRootSquash? nfsProtocolRootSquash = default(Azure.ResourceManager.Fileshares.Models.ShareRootSquash?), System.Collections.Generic.IEnumerable publicAccessAllowedSubnets = null, Azure.ResourceManager.Fileshares.Models.FileShareProvisioningState? provisioningState = default(Azure.ResourceManager.Fileshares.Models.FileShareProvisioningState?), Azure.ResourceManager.Fileshares.Models.PublicNetworkAccess? publicNetworkAccess = default(Azure.ResourceManager.Fileshares.Models.PublicNetworkAccess?), System.Collections.Generic.IEnumerable privateEndpointConnections = null) { throw null; } + public static Azure.ResourceManager.Fileshares.FileShareSnapshotData FileShareSnapshotData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.ResourceManager.Fileshares.Models.FileShareSnapshotProperties properties = null) { throw null; } + public static Azure.ResourceManager.Fileshares.Models.FileShareSnapshotProperties FileShareSnapshotProperties(string snapshotTime = null, string initiatorId = null, System.Collections.Generic.IDictionary metadata = null, Azure.ResourceManager.Fileshares.Models.FileShareProvisioningState? provisioningState = default(Azure.ResourceManager.Fileshares.Models.FileShareProvisioningState?)) { throw null; } + public static Azure.ResourceManager.Fileshares.Models.FilesharesPrivateEndpointConnection FilesharesPrivateEndpointConnection(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.ResourceManager.Fileshares.Models.PrivateEndpointConnectionProperties properties = null) { throw null; } + public static Azure.ResourceManager.Fileshares.Models.FilesharesPrivateLinkServiceConnectionState FilesharesPrivateLinkServiceConnectionState(Azure.ResourceManager.Fileshares.Models.FilesharesPrivateEndpointServiceConnectionStatus? status = default(Azure.ResourceManager.Fileshares.Models.FilesharesPrivateEndpointServiceConnectionStatus?), string description = null, string actionsRequired = null) { throw null; } + public static Azure.ResourceManager.Fileshares.Models.Info Info(string name = null, bool? isDataAction = default(bool?), Azure.ResourceManager.Fileshares.Models.OperationDisplay display = null, Azure.ResourceManager.Fileshares.Models.Origin? origin = default(Azure.ResourceManager.Fileshares.Models.Origin?), Azure.ResourceManager.Fileshares.Models.ActionType? actionType = default(Azure.ResourceManager.Fileshares.Models.ActionType?)) { throw null; } + public static Azure.ResourceManager.Fileshares.Models.OperationDisplay OperationDisplay(string provider = null, string resource = null, string operation = null, string description = null) { throw null; } + public static Azure.ResourceManager.Fileshares.Models.PrivateEndpointConnectionProperties PrivateEndpointConnectionProperties(System.Collections.Generic.IEnumerable groupIds = null, Azure.Core.ResourceIdentifier privateEndpointId = null, Azure.ResourceManager.Fileshares.Models.FilesharesPrivateLinkServiceConnectionState privateLinkServiceConnectionState = null, Azure.ResourceManager.Fileshares.Models.FilesharesPrivateEndpointConnectionProvisioningState? provisioningState = default(Azure.ResourceManager.Fileshares.Models.FilesharesPrivateEndpointConnectionProvisioningState?)) { throw null; } + } + public partial class CheckNameAvailabilityContent : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public CheckNameAvailabilityContent() { } + public string Name { get { throw null; } set { } } + public string Type { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Fileshares.Models.CheckNameAvailabilityContent System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Fileshares.Models.CheckNameAvailabilityContent System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct CheckNameAvailabilityReason : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public CheckNameAvailabilityReason(string value) { throw null; } + public static Azure.ResourceManager.Fileshares.Models.CheckNameAvailabilityReason AlreadyExists { get { throw null; } } + public static Azure.ResourceManager.Fileshares.Models.CheckNameAvailabilityReason Invalid { get { throw null; } } + public bool Equals(Azure.ResourceManager.Fileshares.Models.CheckNameAvailabilityReason 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.Fileshares.Models.CheckNameAvailabilityReason left, Azure.ResourceManager.Fileshares.Models.CheckNameAvailabilityReason right) { throw null; } + public static implicit operator Azure.ResourceManager.Fileshares.Models.CheckNameAvailabilityReason (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.Fileshares.Models.CheckNameAvailabilityReason left, Azure.ResourceManager.Fileshares.Models.CheckNameAvailabilityReason right) { throw null; } + public override string ToString() { throw null; } + } + public partial class CheckNameAvailabilityResult : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal CheckNameAvailabilityResult() { } + public string Message { get { throw null; } } + public bool? NameAvailable { get { throw null; } } + public Azure.ResourceManager.Fileshares.Models.CheckNameAvailabilityReason? Reason { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Fileshares.Models.CheckNameAvailabilityResult System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Fileshares.Models.CheckNameAvailabilityResult System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class FileSharePatch : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public FileSharePatch() { } + public Azure.ResourceManager.Fileshares.Models.FileShareUpdateProperties Properties { get { throw null; } set { } } + public System.Collections.Generic.IDictionary Tags { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Fileshares.Models.FileSharePatch System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Fileshares.Models.FileSharePatch System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class FileShareProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public FileShareProperties() { } + public string HostName { get { throw null; } } + public int? IncludedBurstIOPerSec { get { throw null; } } + public long? MaxBurstIOPerSecCredits { get { throw null; } } + public Azure.ResourceManager.Fileshares.Models.MediaTier? MediaTier { get { throw null; } set { } } + public string MountName { get { throw null; } set { } } + public Azure.ResourceManager.Fileshares.Models.ShareRootSquash? NfsProtocolRootSquash { get { throw null; } set { } } + public System.Collections.Generic.IReadOnlyList PrivateEndpointConnections { get { throw null; } } + public Azure.ResourceManager.Fileshares.Models.Protocol? Protocol { get { throw null; } set { } } + public int? ProvisionedIOPerSec { get { throw null; } set { } } + public System.DateTimeOffset? ProvisionedIOPerSecNextAllowedDowngrade { get { throw null; } } + public int? ProvisionedStorageGiB { get { throw null; } set { } } + public System.DateTimeOffset? ProvisionedStorageNextAllowedDowngrade { get { throw null; } } + public int? ProvisionedThroughputMiBPerSec { get { throw null; } set { } } + public System.DateTimeOffset? ProvisionedThroughputNextAllowedDowngrade { get { throw null; } } + public Azure.ResourceManager.Fileshares.Models.FileShareProvisioningState? ProvisioningState { get { throw null; } } + public System.Collections.Generic.IList PublicAccessAllowedSubnets { get { throw null; } } + public Azure.ResourceManager.Fileshares.Models.PublicNetworkAccess? PublicNetworkAccess { get { throw null; } set { } } + public Azure.ResourceManager.Fileshares.Models.Redundancy? Redundancy { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Fileshares.Models.FileShareProperties System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Fileshares.Models.FileShareProperties System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct FileShareProvisioningState : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public FileShareProvisioningState(string value) { throw null; } + public static Azure.ResourceManager.Fileshares.Models.FileShareProvisioningState Accepted { get { throw null; } } + public static Azure.ResourceManager.Fileshares.Models.FileShareProvisioningState Canceled { get { throw null; } } + public static Azure.ResourceManager.Fileshares.Models.FileShareProvisioningState Deleting { get { throw null; } } + public static Azure.ResourceManager.Fileshares.Models.FileShareProvisioningState Failed { get { throw null; } } + public static Azure.ResourceManager.Fileshares.Models.FileShareProvisioningState Provisioning { get { throw null; } } + public static Azure.ResourceManager.Fileshares.Models.FileShareProvisioningState Succeeded { get { throw null; } } + public static Azure.ResourceManager.Fileshares.Models.FileShareProvisioningState Updating { get { throw null; } } + public bool Equals(Azure.ResourceManager.Fileshares.Models.FileShareProvisioningState 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.Fileshares.Models.FileShareProvisioningState left, Azure.ResourceManager.Fileshares.Models.FileShareProvisioningState right) { throw null; } + public static implicit operator Azure.ResourceManager.Fileshares.Models.FileShareProvisioningState (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.Fileshares.Models.FileShareProvisioningState left, Azure.ResourceManager.Fileshares.Models.FileShareProvisioningState right) { throw null; } + public override string ToString() { throw null; } + } + public partial class FileShareSnapshotPatch : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public FileShareSnapshotPatch() { } + public System.Collections.Generic.IDictionary FileShareSnapshotUpdateMetadata { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Fileshares.Models.FileShareSnapshotPatch System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Fileshares.Models.FileShareSnapshotPatch System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class FileShareSnapshotProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public FileShareSnapshotProperties() { } + public string InitiatorId { get { throw null; } } + public System.Collections.Generic.IDictionary Metadata { get { throw null; } } + public Azure.ResourceManager.Fileshares.Models.FileShareProvisioningState? ProvisioningState { get { throw null; } } + public string SnapshotTime { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Fileshares.Models.FileShareSnapshotProperties System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Fileshares.Models.FileShareSnapshotProperties System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class FilesharesPrivateEndpointConnection : Azure.ResourceManager.Models.ResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal FilesharesPrivateEndpointConnection() { } + public Azure.ResourceManager.Fileshares.Models.PrivateEndpointConnectionProperties Properties { get { throw null; } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Fileshares.Models.FilesharesPrivateEndpointConnection System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Fileshares.Models.FilesharesPrivateEndpointConnection System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct FilesharesPrivateEndpointConnectionProvisioningState : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public FilesharesPrivateEndpointConnectionProvisioningState(string value) { throw null; } + public static Azure.ResourceManager.Fileshares.Models.FilesharesPrivateEndpointConnectionProvisioningState Creating { get { throw null; } } + public static Azure.ResourceManager.Fileshares.Models.FilesharesPrivateEndpointConnectionProvisioningState Deleting { get { throw null; } } + public static Azure.ResourceManager.Fileshares.Models.FilesharesPrivateEndpointConnectionProvisioningState Failed { get { throw null; } } + public static Azure.ResourceManager.Fileshares.Models.FilesharesPrivateEndpointConnectionProvisioningState Succeeded { get { throw null; } } + public bool Equals(Azure.ResourceManager.Fileshares.Models.FilesharesPrivateEndpointConnectionProvisioningState 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.Fileshares.Models.FilesharesPrivateEndpointConnectionProvisioningState left, Azure.ResourceManager.Fileshares.Models.FilesharesPrivateEndpointConnectionProvisioningState right) { throw null; } + public static implicit operator Azure.ResourceManager.Fileshares.Models.FilesharesPrivateEndpointConnectionProvisioningState (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.Fileshares.Models.FilesharesPrivateEndpointConnectionProvisioningState left, Azure.ResourceManager.Fileshares.Models.FilesharesPrivateEndpointConnectionProvisioningState right) { throw null; } + public override string ToString() { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct FilesharesPrivateEndpointServiceConnectionStatus : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public FilesharesPrivateEndpointServiceConnectionStatus(string value) { throw null; } + public static Azure.ResourceManager.Fileshares.Models.FilesharesPrivateEndpointServiceConnectionStatus Approved { get { throw null; } } + public static Azure.ResourceManager.Fileshares.Models.FilesharesPrivateEndpointServiceConnectionStatus Pending { get { throw null; } } + public static Azure.ResourceManager.Fileshares.Models.FilesharesPrivateEndpointServiceConnectionStatus Rejected { get { throw null; } } + public bool Equals(Azure.ResourceManager.Fileshares.Models.FilesharesPrivateEndpointServiceConnectionStatus 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.Fileshares.Models.FilesharesPrivateEndpointServiceConnectionStatus left, Azure.ResourceManager.Fileshares.Models.FilesharesPrivateEndpointServiceConnectionStatus right) { throw null; } + public static implicit operator Azure.ResourceManager.Fileshares.Models.FilesharesPrivateEndpointServiceConnectionStatus (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.Fileshares.Models.FilesharesPrivateEndpointServiceConnectionStatus left, Azure.ResourceManager.Fileshares.Models.FilesharesPrivateEndpointServiceConnectionStatus right) { throw null; } + public override string ToString() { throw null; } + } + public partial class FilesharesPrivateLinkServiceConnectionState : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal FilesharesPrivateLinkServiceConnectionState() { } + public string ActionsRequired { get { throw null; } } + public string Description { get { throw null; } } + public Azure.ResourceManager.Fileshares.Models.FilesharesPrivateEndpointServiceConnectionStatus? Status { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Fileshares.Models.FilesharesPrivateLinkServiceConnectionState System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Fileshares.Models.FilesharesPrivateLinkServiceConnectionState System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class FileShareUpdateProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public FileShareUpdateProperties() { } + public Azure.ResourceManager.Fileshares.Models.ShareRootSquash? NfsProtocolRootSquash { get { throw null; } set { } } + public int? ProvisionedIOPerSec { get { throw null; } set { } } + public int? ProvisionedStorageGiB { get { throw null; } set { } } + public int? ProvisionedThroughputMiBPerSec { get { throw null; } set { } } + public System.Collections.Generic.IList PublicAccessAllowedSubnets { get { throw null; } } + public Azure.ResourceManager.Fileshares.Models.PublicNetworkAccess? PublicNetworkAccess { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Fileshares.Models.FileShareUpdateProperties System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Fileshares.Models.FileShareUpdateProperties System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class Info : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal Info() { } + public Azure.ResourceManager.Fileshares.Models.ActionType? ActionType { get { throw null; } } + public Azure.ResourceManager.Fileshares.Models.OperationDisplay Display { get { throw null; } } + public bool? IsDataAction { get { throw null; } } + public string Name { get { throw null; } } + public Azure.ResourceManager.Fileshares.Models.Origin? Origin { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Fileshares.Models.Info System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Fileshares.Models.Info System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public enum MediaTier + { + SSD = 0, + } + public partial class OperationDisplay : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal OperationDisplay() { } + public string Description { get { throw null; } } + public string Operation { get { throw null; } } + public string Provider { get { throw null; } } + public string Resource { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Fileshares.Models.OperationDisplay System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Fileshares.Models.OperationDisplay System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct Origin : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public Origin(string value) { throw null; } + public static Azure.ResourceManager.Fileshares.Models.Origin System { get { throw null; } } + public static Azure.ResourceManager.Fileshares.Models.Origin User { get { throw null; } } + public static Azure.ResourceManager.Fileshares.Models.Origin UserSystem { get { throw null; } } + public bool Equals(Azure.ResourceManager.Fileshares.Models.Origin 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.Fileshares.Models.Origin left, Azure.ResourceManager.Fileshares.Models.Origin right) { throw null; } + public static implicit operator Azure.ResourceManager.Fileshares.Models.Origin (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.Fileshares.Models.Origin left, Azure.ResourceManager.Fileshares.Models.Origin right) { throw null; } + public override string ToString() { throw null; } + } + public partial class PrivateEndpointConnectionProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal PrivateEndpointConnectionProperties() { } + public System.Collections.Generic.IReadOnlyList GroupIds { get { throw null; } } + public Azure.Core.ResourceIdentifier PrivateEndpointId { get { throw null; } } + public Azure.ResourceManager.Fileshares.Models.FilesharesPrivateLinkServiceConnectionState PrivateLinkServiceConnectionState { get { throw null; } } + public Azure.ResourceManager.Fileshares.Models.FilesharesPrivateEndpointConnectionProvisioningState? ProvisioningState { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Fileshares.Models.PrivateEndpointConnectionProperties System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Fileshares.Models.PrivateEndpointConnectionProperties System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public enum Protocol + { + NFS = 0, + } + [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.Fileshares.Models.PublicNetworkAccess Disabled { get { throw null; } } + public static Azure.ResourceManager.Fileshares.Models.PublicNetworkAccess Enabled { get { throw null; } } + public bool Equals(Azure.ResourceManager.Fileshares.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.Fileshares.Models.PublicNetworkAccess left, Azure.ResourceManager.Fileshares.Models.PublicNetworkAccess right) { throw null; } + public static implicit operator Azure.ResourceManager.Fileshares.Models.PublicNetworkAccess (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.Fileshares.Models.PublicNetworkAccess left, Azure.ResourceManager.Fileshares.Models.PublicNetworkAccess right) { throw null; } + public override string ToString() { throw null; } + } + public enum Redundancy + { + Local = 0, + Zone = 1, + } + public enum ShareRootSquash + { + NoRootSquash = 0, + RootSquash = 1, + AllSquash = 2, + } +} diff --git a/sdk/fileshares/Azure.ResourceManager.Fileshares/api/Azure.ResourceManager.Fileshares.netstandard2.0.cs b/sdk/fileshares/Azure.ResourceManager.Fileshares/api/Azure.ResourceManager.Fileshares.netstandard2.0.cs new file mode 100644 index 000000000000..a39b79254e2d --- /dev/null +++ b/sdk/fileshares/Azure.ResourceManager.Fileshares/api/Azure.ResourceManager.Fileshares.netstandard2.0.cs @@ -0,0 +1,498 @@ +namespace Azure.ResourceManager.Fileshares +{ + public partial class AzureResourceManagerFilesharesContext : System.ClientModel.Primitives.ModelReaderWriterContext + { + internal AzureResourceManagerFilesharesContext() { } + public static Azure.ResourceManager.Fileshares.AzureResourceManagerFilesharesContext Default { get { throw null; } } + protected override bool TryGetTypeBuilderCore(System.Type type, out System.ClientModel.Primitives.ModelReaderWriterTypeBuilder builder) { throw null; } + } + public partial class FileShareCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected FileShareCollection() { } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string resourceName, Azure.ResourceManager.Fileshares.FileShareData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(Azure.WaitUntil waitUntil, string resourceName, Azure.ResourceManager.Fileshares.FileShareData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Exists(string resourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string resourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string resourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetAll(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAllAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(string resourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.NullableResponse GetIfExists(string resourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string resourceName, 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 FileShareData : Azure.ResourceManager.Models.TrackedResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public FileShareData(Azure.Core.AzureLocation location) { } + public Azure.ResourceManager.Fileshares.Models.FileShareProperties Properties { get { throw null; } set { } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Fileshares.FileShareData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Fileshares.FileShareData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class FileShareResource : Azure.ResourceManager.ArmResource, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public static readonly Azure.Core.ResourceType ResourceType; + protected FileShareResource() { } + public virtual Azure.ResourceManager.Fileshares.FileShareData Data { get { throw null; } } + public virtual bool HasData { get { throw null; } } + public virtual Azure.Response AddTag(string key, string value, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> AddTagAsync(string key, string value, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.Core.ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string resourceName) { 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.Response GetFileShareSnapshot(string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetFileShareSnapshotAsync(string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Fileshares.FileShareSnapshotCollection GetFileShareSnapshots() { throw null; } + public virtual Azure.Response RemoveTag(string key, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> RemoveTagAsync(string key, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response SetTags(System.Collections.Generic.IDictionary tags, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> SetTagsAsync(System.Collections.Generic.IDictionary tags, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + Azure.ResourceManager.Fileshares.FileShareData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Fileshares.FileShareData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + public virtual Azure.ResourceManager.ArmOperation Update(Azure.WaitUntil waitUntil, Azure.ResourceManager.Fileshares.Models.FileSharePatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.Fileshares.Models.FileSharePatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public static partial class FilesharesExtensions + { + public static Azure.Response CheckNameAvailabilityFileShare(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, Azure.Core.AzureLocation location, Azure.ResourceManager.Fileshares.Models.CheckNameAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static System.Threading.Tasks.Task> CheckNameAvailabilityFileShareAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, Azure.Core.AzureLocation location, Azure.ResourceManager.Fileshares.Models.CheckNameAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.Response GetFileShare(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string resourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static System.Threading.Tasks.Task> GetFileShareAsync(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string resourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.ResourceManager.Fileshares.FileShareResource GetFileShareResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.ResourceManager.Fileshares.FileShareCollection GetFileShares(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource) { throw null; } + public static Azure.Pageable GetFileShares(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.AsyncPageable GetFileSharesAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.ResourceManager.Fileshares.FileShareSnapshotResource GetFileShareSnapshotResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.Pageable GetOperations(this Azure.ResourceManager.Resources.TenantResource tenantResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.AsyncPageable GetOperationsAsync(this Azure.ResourceManager.Resources.TenantResource tenantResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class FileShareSnapshotCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected FileShareSnapshotCollection() { } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string name, Azure.ResourceManager.Fileshares.FileShareSnapshotData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(Azure.WaitUntil waitUntil, string name, Azure.ResourceManager.Fileshares.FileShareSnapshotData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Exists(string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetAll(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAllAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.NullableResponse GetIfExists(string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string name, 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 FileShareSnapshotData : Azure.ResourceManager.Models.ResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public FileShareSnapshotData() { } + public Azure.ResourceManager.Fileshares.Models.FileShareSnapshotProperties Properties { get { throw null; } set { } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Fileshares.FileShareSnapshotData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Fileshares.FileShareSnapshotData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class FileShareSnapshotResource : Azure.ResourceManager.ArmResource, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public static readonly Azure.Core.ResourceType ResourceType; + protected FileShareSnapshotResource() { } + public virtual Azure.ResourceManager.Fileshares.FileShareSnapshotData Data { get { throw null; } } + public virtual bool HasData { get { throw null; } } + public static Azure.Core.ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string resourceName, string name) { 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; } + Azure.ResourceManager.Fileshares.FileShareSnapshotData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Fileshares.FileShareSnapshotData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + public virtual Azure.ResourceManager.ArmOperation Update(Azure.WaitUntil waitUntil, Azure.ResourceManager.Fileshares.Models.FileShareSnapshotPatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.Fileshares.Models.FileShareSnapshotPatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} +namespace Azure.ResourceManager.Fileshares.Mocking +{ + public partial class MockableFilesharesArmClient : Azure.ResourceManager.ArmResource + { + protected MockableFilesharesArmClient() { } + public virtual Azure.ResourceManager.Fileshares.FileShareResource GetFileShareResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Fileshares.FileShareSnapshotResource GetFileShareSnapshotResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableFilesharesResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableFilesharesResourceGroupResource() { } + public virtual Azure.Response GetFileShare(string resourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetFileShareAsync(string resourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Fileshares.FileShareCollection GetFileShares() { throw null; } + } + public partial class MockableFilesharesSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableFilesharesSubscriptionResource() { } + public virtual Azure.Response CheckNameAvailabilityFileShare(Azure.Core.AzureLocation location, Azure.ResourceManager.Fileshares.Models.CheckNameAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CheckNameAvailabilityFileShareAsync(Azure.Core.AzureLocation location, Azure.ResourceManager.Fileshares.Models.CheckNameAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetFileShares(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetFileSharesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class MockableFilesharesTenantResource : Azure.ResourceManager.ArmResource + { + protected MockableFilesharesTenantResource() { } + public virtual Azure.Pageable GetOperations(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetOperationsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} +namespace Azure.ResourceManager.Fileshares.Models +{ + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct ActionType : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public ActionType(string value) { throw null; } + public static Azure.ResourceManager.Fileshares.Models.ActionType Internal { get { throw null; } } + public bool Equals(Azure.ResourceManager.Fileshares.Models.ActionType 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.Fileshares.Models.ActionType left, Azure.ResourceManager.Fileshares.Models.ActionType right) { throw null; } + public static implicit operator Azure.ResourceManager.Fileshares.Models.ActionType (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.Fileshares.Models.ActionType left, Azure.ResourceManager.Fileshares.Models.ActionType right) { throw null; } + public override string ToString() { throw null; } + } + public static partial class ArmFilesharesModelFactory + { + public static Azure.ResourceManager.Fileshares.Models.CheckNameAvailabilityResult CheckNameAvailabilityResult(bool? nameAvailable = default(bool?), Azure.ResourceManager.Fileshares.Models.CheckNameAvailabilityReason? reason = default(Azure.ResourceManager.Fileshares.Models.CheckNameAvailabilityReason?), string message = null) { throw null; } + public static Azure.ResourceManager.Fileshares.FileShareData FileShareData(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.Fileshares.Models.FileShareProperties properties = null) { throw null; } + public static Azure.ResourceManager.Fileshares.Models.FileShareProperties FileShareProperties(string mountName = null, string hostName = null, Azure.ResourceManager.Fileshares.Models.MediaTier? mediaTier = default(Azure.ResourceManager.Fileshares.Models.MediaTier?), Azure.ResourceManager.Fileshares.Models.Redundancy? redundancy = default(Azure.ResourceManager.Fileshares.Models.Redundancy?), Azure.ResourceManager.Fileshares.Models.Protocol? protocol = default(Azure.ResourceManager.Fileshares.Models.Protocol?), int? provisionedStorageGiB = default(int?), System.DateTimeOffset? provisionedStorageNextAllowedDowngrade = default(System.DateTimeOffset?), int? provisionedIOPerSec = default(int?), System.DateTimeOffset? provisionedIOPerSecNextAllowedDowngrade = default(System.DateTimeOffset?), int? provisionedThroughputMiBPerSec = default(int?), System.DateTimeOffset? provisionedThroughputNextAllowedDowngrade = default(System.DateTimeOffset?), int? includedBurstIOPerSec = default(int?), long? maxBurstIOPerSecCredits = default(long?), Azure.ResourceManager.Fileshares.Models.ShareRootSquash? nfsProtocolRootSquash = default(Azure.ResourceManager.Fileshares.Models.ShareRootSquash?), System.Collections.Generic.IEnumerable publicAccessAllowedSubnets = null, Azure.ResourceManager.Fileshares.Models.FileShareProvisioningState? provisioningState = default(Azure.ResourceManager.Fileshares.Models.FileShareProvisioningState?), Azure.ResourceManager.Fileshares.Models.PublicNetworkAccess? publicNetworkAccess = default(Azure.ResourceManager.Fileshares.Models.PublicNetworkAccess?), System.Collections.Generic.IEnumerable privateEndpointConnections = null) { throw null; } + public static Azure.ResourceManager.Fileshares.FileShareSnapshotData FileShareSnapshotData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.ResourceManager.Fileshares.Models.FileShareSnapshotProperties properties = null) { throw null; } + public static Azure.ResourceManager.Fileshares.Models.FileShareSnapshotProperties FileShareSnapshotProperties(string snapshotTime = null, string initiatorId = null, System.Collections.Generic.IDictionary metadata = null, Azure.ResourceManager.Fileshares.Models.FileShareProvisioningState? provisioningState = default(Azure.ResourceManager.Fileshares.Models.FileShareProvisioningState?)) { throw null; } + public static Azure.ResourceManager.Fileshares.Models.FilesharesPrivateEndpointConnection FilesharesPrivateEndpointConnection(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.ResourceManager.Fileshares.Models.PrivateEndpointConnectionProperties properties = null) { throw null; } + public static Azure.ResourceManager.Fileshares.Models.FilesharesPrivateLinkServiceConnectionState FilesharesPrivateLinkServiceConnectionState(Azure.ResourceManager.Fileshares.Models.FilesharesPrivateEndpointServiceConnectionStatus? status = default(Azure.ResourceManager.Fileshares.Models.FilesharesPrivateEndpointServiceConnectionStatus?), string description = null, string actionsRequired = null) { throw null; } + public static Azure.ResourceManager.Fileshares.Models.Info Info(string name = null, bool? isDataAction = default(bool?), Azure.ResourceManager.Fileshares.Models.OperationDisplay display = null, Azure.ResourceManager.Fileshares.Models.Origin? origin = default(Azure.ResourceManager.Fileshares.Models.Origin?), Azure.ResourceManager.Fileshares.Models.ActionType? actionType = default(Azure.ResourceManager.Fileshares.Models.ActionType?)) { throw null; } + public static Azure.ResourceManager.Fileshares.Models.OperationDisplay OperationDisplay(string provider = null, string resource = null, string operation = null, string description = null) { throw null; } + public static Azure.ResourceManager.Fileshares.Models.PrivateEndpointConnectionProperties PrivateEndpointConnectionProperties(System.Collections.Generic.IEnumerable groupIds = null, Azure.Core.ResourceIdentifier privateEndpointId = null, Azure.ResourceManager.Fileshares.Models.FilesharesPrivateLinkServiceConnectionState privateLinkServiceConnectionState = null, Azure.ResourceManager.Fileshares.Models.FilesharesPrivateEndpointConnectionProvisioningState? provisioningState = default(Azure.ResourceManager.Fileshares.Models.FilesharesPrivateEndpointConnectionProvisioningState?)) { throw null; } + } + public partial class CheckNameAvailabilityContent : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public CheckNameAvailabilityContent() { } + public string Name { get { throw null; } set { } } + public string Type { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Fileshares.Models.CheckNameAvailabilityContent System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Fileshares.Models.CheckNameAvailabilityContent System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct CheckNameAvailabilityReason : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public CheckNameAvailabilityReason(string value) { throw null; } + public static Azure.ResourceManager.Fileshares.Models.CheckNameAvailabilityReason AlreadyExists { get { throw null; } } + public static Azure.ResourceManager.Fileshares.Models.CheckNameAvailabilityReason Invalid { get { throw null; } } + public bool Equals(Azure.ResourceManager.Fileshares.Models.CheckNameAvailabilityReason 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.Fileshares.Models.CheckNameAvailabilityReason left, Azure.ResourceManager.Fileshares.Models.CheckNameAvailabilityReason right) { throw null; } + public static implicit operator Azure.ResourceManager.Fileshares.Models.CheckNameAvailabilityReason (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.Fileshares.Models.CheckNameAvailabilityReason left, Azure.ResourceManager.Fileshares.Models.CheckNameAvailabilityReason right) { throw null; } + public override string ToString() { throw null; } + } + public partial class CheckNameAvailabilityResult : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal CheckNameAvailabilityResult() { } + public string Message { get { throw null; } } + public bool? NameAvailable { get { throw null; } } + public Azure.ResourceManager.Fileshares.Models.CheckNameAvailabilityReason? Reason { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Fileshares.Models.CheckNameAvailabilityResult System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Fileshares.Models.CheckNameAvailabilityResult System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class FileSharePatch : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public FileSharePatch() { } + public Azure.ResourceManager.Fileshares.Models.FileShareUpdateProperties Properties { get { throw null; } set { } } + public System.Collections.Generic.IDictionary Tags { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Fileshares.Models.FileSharePatch System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Fileshares.Models.FileSharePatch System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class FileShareProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public FileShareProperties() { } + public string HostName { get { throw null; } } + public int? IncludedBurstIOPerSec { get { throw null; } } + public long? MaxBurstIOPerSecCredits { get { throw null; } } + public Azure.ResourceManager.Fileshares.Models.MediaTier? MediaTier { get { throw null; } set { } } + public string MountName { get { throw null; } set { } } + public Azure.ResourceManager.Fileshares.Models.ShareRootSquash? NfsProtocolRootSquash { get { throw null; } set { } } + public System.Collections.Generic.IReadOnlyList PrivateEndpointConnections { get { throw null; } } + public Azure.ResourceManager.Fileshares.Models.Protocol? Protocol { get { throw null; } set { } } + public int? ProvisionedIOPerSec { get { throw null; } set { } } + public System.DateTimeOffset? ProvisionedIOPerSecNextAllowedDowngrade { get { throw null; } } + public int? ProvisionedStorageGiB { get { throw null; } set { } } + public System.DateTimeOffset? ProvisionedStorageNextAllowedDowngrade { get { throw null; } } + public int? ProvisionedThroughputMiBPerSec { get { throw null; } set { } } + public System.DateTimeOffset? ProvisionedThroughputNextAllowedDowngrade { get { throw null; } } + public Azure.ResourceManager.Fileshares.Models.FileShareProvisioningState? ProvisioningState { get { throw null; } } + public System.Collections.Generic.IList PublicAccessAllowedSubnets { get { throw null; } } + public Azure.ResourceManager.Fileshares.Models.PublicNetworkAccess? PublicNetworkAccess { get { throw null; } set { } } + public Azure.ResourceManager.Fileshares.Models.Redundancy? Redundancy { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Fileshares.Models.FileShareProperties System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Fileshares.Models.FileShareProperties System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct FileShareProvisioningState : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public FileShareProvisioningState(string value) { throw null; } + public static Azure.ResourceManager.Fileshares.Models.FileShareProvisioningState Accepted { get { throw null; } } + public static Azure.ResourceManager.Fileshares.Models.FileShareProvisioningState Canceled { get { throw null; } } + public static Azure.ResourceManager.Fileshares.Models.FileShareProvisioningState Deleting { get { throw null; } } + public static Azure.ResourceManager.Fileshares.Models.FileShareProvisioningState Failed { get { throw null; } } + public static Azure.ResourceManager.Fileshares.Models.FileShareProvisioningState Provisioning { get { throw null; } } + public static Azure.ResourceManager.Fileshares.Models.FileShareProvisioningState Succeeded { get { throw null; } } + public static Azure.ResourceManager.Fileshares.Models.FileShareProvisioningState Updating { get { throw null; } } + public bool Equals(Azure.ResourceManager.Fileshares.Models.FileShareProvisioningState 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.Fileshares.Models.FileShareProvisioningState left, Azure.ResourceManager.Fileshares.Models.FileShareProvisioningState right) { throw null; } + public static implicit operator Azure.ResourceManager.Fileshares.Models.FileShareProvisioningState (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.Fileshares.Models.FileShareProvisioningState left, Azure.ResourceManager.Fileshares.Models.FileShareProvisioningState right) { throw null; } + public override string ToString() { throw null; } + } + public partial class FileShareSnapshotPatch : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public FileShareSnapshotPatch() { } + public System.Collections.Generic.IDictionary FileShareSnapshotUpdateMetadata { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Fileshares.Models.FileShareSnapshotPatch System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Fileshares.Models.FileShareSnapshotPatch System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class FileShareSnapshotProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public FileShareSnapshotProperties() { } + public string InitiatorId { get { throw null; } } + public System.Collections.Generic.IDictionary Metadata { get { throw null; } } + public Azure.ResourceManager.Fileshares.Models.FileShareProvisioningState? ProvisioningState { get { throw null; } } + public string SnapshotTime { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Fileshares.Models.FileShareSnapshotProperties System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Fileshares.Models.FileShareSnapshotProperties System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class FilesharesPrivateEndpointConnection : Azure.ResourceManager.Models.ResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal FilesharesPrivateEndpointConnection() { } + public Azure.ResourceManager.Fileshares.Models.PrivateEndpointConnectionProperties Properties { get { throw null; } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Fileshares.Models.FilesharesPrivateEndpointConnection System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Fileshares.Models.FilesharesPrivateEndpointConnection System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct FilesharesPrivateEndpointConnectionProvisioningState : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public FilesharesPrivateEndpointConnectionProvisioningState(string value) { throw null; } + public static Azure.ResourceManager.Fileshares.Models.FilesharesPrivateEndpointConnectionProvisioningState Creating { get { throw null; } } + public static Azure.ResourceManager.Fileshares.Models.FilesharesPrivateEndpointConnectionProvisioningState Deleting { get { throw null; } } + public static Azure.ResourceManager.Fileshares.Models.FilesharesPrivateEndpointConnectionProvisioningState Failed { get { throw null; } } + public static Azure.ResourceManager.Fileshares.Models.FilesharesPrivateEndpointConnectionProvisioningState Succeeded { get { throw null; } } + public bool Equals(Azure.ResourceManager.Fileshares.Models.FilesharesPrivateEndpointConnectionProvisioningState 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.Fileshares.Models.FilesharesPrivateEndpointConnectionProvisioningState left, Azure.ResourceManager.Fileshares.Models.FilesharesPrivateEndpointConnectionProvisioningState right) { throw null; } + public static implicit operator Azure.ResourceManager.Fileshares.Models.FilesharesPrivateEndpointConnectionProvisioningState (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.Fileshares.Models.FilesharesPrivateEndpointConnectionProvisioningState left, Azure.ResourceManager.Fileshares.Models.FilesharesPrivateEndpointConnectionProvisioningState right) { throw null; } + public override string ToString() { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct FilesharesPrivateEndpointServiceConnectionStatus : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public FilesharesPrivateEndpointServiceConnectionStatus(string value) { throw null; } + public static Azure.ResourceManager.Fileshares.Models.FilesharesPrivateEndpointServiceConnectionStatus Approved { get { throw null; } } + public static Azure.ResourceManager.Fileshares.Models.FilesharesPrivateEndpointServiceConnectionStatus Pending { get { throw null; } } + public static Azure.ResourceManager.Fileshares.Models.FilesharesPrivateEndpointServiceConnectionStatus Rejected { get { throw null; } } + public bool Equals(Azure.ResourceManager.Fileshares.Models.FilesharesPrivateEndpointServiceConnectionStatus 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.Fileshares.Models.FilesharesPrivateEndpointServiceConnectionStatus left, Azure.ResourceManager.Fileshares.Models.FilesharesPrivateEndpointServiceConnectionStatus right) { throw null; } + public static implicit operator Azure.ResourceManager.Fileshares.Models.FilesharesPrivateEndpointServiceConnectionStatus (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.Fileshares.Models.FilesharesPrivateEndpointServiceConnectionStatus left, Azure.ResourceManager.Fileshares.Models.FilesharesPrivateEndpointServiceConnectionStatus right) { throw null; } + public override string ToString() { throw null; } + } + public partial class FilesharesPrivateLinkServiceConnectionState : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal FilesharesPrivateLinkServiceConnectionState() { } + public string ActionsRequired { get { throw null; } } + public string Description { get { throw null; } } + public Azure.ResourceManager.Fileshares.Models.FilesharesPrivateEndpointServiceConnectionStatus? Status { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Fileshares.Models.FilesharesPrivateLinkServiceConnectionState System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Fileshares.Models.FilesharesPrivateLinkServiceConnectionState System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class FileShareUpdateProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public FileShareUpdateProperties() { } + public Azure.ResourceManager.Fileshares.Models.ShareRootSquash? NfsProtocolRootSquash { get { throw null; } set { } } + public int? ProvisionedIOPerSec { get { throw null; } set { } } + public int? ProvisionedStorageGiB { get { throw null; } set { } } + public int? ProvisionedThroughputMiBPerSec { get { throw null; } set { } } + public System.Collections.Generic.IList PublicAccessAllowedSubnets { get { throw null; } } + public Azure.ResourceManager.Fileshares.Models.PublicNetworkAccess? PublicNetworkAccess { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Fileshares.Models.FileShareUpdateProperties System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Fileshares.Models.FileShareUpdateProperties System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class Info : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal Info() { } + public Azure.ResourceManager.Fileshares.Models.ActionType? ActionType { get { throw null; } } + public Azure.ResourceManager.Fileshares.Models.OperationDisplay Display { get { throw null; } } + public bool? IsDataAction { get { throw null; } } + public string Name { get { throw null; } } + public Azure.ResourceManager.Fileshares.Models.Origin? Origin { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Fileshares.Models.Info System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Fileshares.Models.Info System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public enum MediaTier + { + SSD = 0, + } + public partial class OperationDisplay : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal OperationDisplay() { } + public string Description { get { throw null; } } + public string Operation { get { throw null; } } + public string Provider { get { throw null; } } + public string Resource { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Fileshares.Models.OperationDisplay System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Fileshares.Models.OperationDisplay System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct Origin : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public Origin(string value) { throw null; } + public static Azure.ResourceManager.Fileshares.Models.Origin System { get { throw null; } } + public static Azure.ResourceManager.Fileshares.Models.Origin User { get { throw null; } } + public static Azure.ResourceManager.Fileshares.Models.Origin UserSystem { get { throw null; } } + public bool Equals(Azure.ResourceManager.Fileshares.Models.Origin 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.Fileshares.Models.Origin left, Azure.ResourceManager.Fileshares.Models.Origin right) { throw null; } + public static implicit operator Azure.ResourceManager.Fileshares.Models.Origin (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.Fileshares.Models.Origin left, Azure.ResourceManager.Fileshares.Models.Origin right) { throw null; } + public override string ToString() { throw null; } + } + public partial class PrivateEndpointConnectionProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal PrivateEndpointConnectionProperties() { } + public System.Collections.Generic.IReadOnlyList GroupIds { get { throw null; } } + public Azure.Core.ResourceIdentifier PrivateEndpointId { get { throw null; } } + public Azure.ResourceManager.Fileshares.Models.FilesharesPrivateLinkServiceConnectionState PrivateLinkServiceConnectionState { get { throw null; } } + public Azure.ResourceManager.Fileshares.Models.FilesharesPrivateEndpointConnectionProvisioningState? ProvisioningState { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Fileshares.Models.PrivateEndpointConnectionProperties System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Fileshares.Models.PrivateEndpointConnectionProperties System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public enum Protocol + { + NFS = 0, + } + [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.Fileshares.Models.PublicNetworkAccess Disabled { get { throw null; } } + public static Azure.ResourceManager.Fileshares.Models.PublicNetworkAccess Enabled { get { throw null; } } + public bool Equals(Azure.ResourceManager.Fileshares.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.Fileshares.Models.PublicNetworkAccess left, Azure.ResourceManager.Fileshares.Models.PublicNetworkAccess right) { throw null; } + public static implicit operator Azure.ResourceManager.Fileshares.Models.PublicNetworkAccess (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.Fileshares.Models.PublicNetworkAccess left, Azure.ResourceManager.Fileshares.Models.PublicNetworkAccess right) { throw null; } + public override string ToString() { throw null; } + } + public enum Redundancy + { + Local = 0, + Zone = 1, + } + public enum ShareRootSquash + { + NoRootSquash = 0, + RootSquash = 1, + AllSquash = 2, + } +} diff --git a/sdk/fileshares/Azure.ResourceManager.Fileshares/assets.json b/sdk/fileshares/Azure.ResourceManager.Fileshares/assets.json new file mode 100644 index 000000000000..2087ff434c9d --- /dev/null +++ b/sdk/fileshares/Azure.ResourceManager.Fileshares/assets.json @@ -0,0 +1,7 @@ + +{ + "AssetsRepo": "Azure/azure-sdk-assets", + "AssetsRepoPrefixPath": "net", + "TagPrefix": "net/fileshares/Azure.ResourceManager.Fileshares", + "Tag": "" +} diff --git a/sdk/fileshares/Azure.ResourceManager.Fileshares/samples/Azure.ResourceManager.Fileshares.Samples.csproj b/sdk/fileshares/Azure.ResourceManager.Fileshares/samples/Azure.ResourceManager.Fileshares.Samples.csproj new file mode 100644 index 000000000000..3477e05494ef --- /dev/null +++ b/sdk/fileshares/Azure.ResourceManager.Fileshares/samples/Azure.ResourceManager.Fileshares.Samples.csproj @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/sdk/fileshares/Azure.ResourceManager.Fileshares/samples/Generated/Samples/Sample_FileShareCollection.cs b/sdk/fileshares/Azure.ResourceManager.Fileshares/samples/Generated/Samples/Sample_FileShareCollection.cs new file mode 100644 index 000000000000..2516418601ed --- /dev/null +++ b/sdk/fileshares/Azure.ResourceManager.Fileshares/samples/Generated/Samples/Sample_FileShareCollection.cs @@ -0,0 +1,212 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager.Fileshares.Models; +using Azure.ResourceManager.Resources; +using NUnit.Framework; + +namespace Azure.ResourceManager.Fileshares.Samples +{ + public partial class Sample_FileShareCollection + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task CreateOrUpdate_FileSharesCreateOrUpdateMaximumSetGenGeneratedByMaximumSetRule() + { + // Generated from example definition: 2024-01-01-preview/FileShares_CreateOrUpdate_MaximumSet_Gen.json + // this example is just showing the usage of "FileShare_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "AD98EFD8-D1E9-4F38-A862-E066114E49EE"; + string resourceGroupName = "rgfileshares"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this FileShareResource + FileShareCollection collection = resourceGroupResource.GetFileShares(); + + // invoke the operation + string resourceName = "testfileshare"; + FileShareData data = new FileShareData(new AzureLocation("xrrekltkvmzdinob")) + { + Properties = new FileShareProperties + { + MountName = "kyujsrfk", + MediaTier = MediaTier.SSD, + Redundancy = Redundancy.Local, + Protocol = Protocol.NFS, + ProvisionedStorageGiB = 15, + ProvisionedIOPerSec = 29, + ProvisionedThroughputMiBPerSec = 25, + NfsProtocolRootSquash = ShareRootSquash.NoRootSquash, + PublicAccessAllowedSubnets = { "pvjhqlnqfiubvbfcggthlpy" }, + PublicNetworkAccess = PublicNetworkAccess.Enabled, + }, + Tags = +{ +["key1961"] = "p" +}, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, resourceName, data); + FileShareResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + FileShareData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Get_FileSharesGetMaximumSetGenGeneratedByMaximumSetRule() + { + // Generated from example definition: 2024-01-01-preview/FileShares_Get_MaximumSet_Gen.json + // this example is just showing the usage of "FileShare_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "AD98EFD8-D1E9-4F38-A862-E066114E49EE"; + string resourceGroupName = "rgfileshares"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this FileShareResource + FileShareCollection collection = resourceGroupResource.GetFileShares(); + + // invoke the operation + string resourceName = "testfileshare"; + FileShareResource result = await collection.GetAsync(resourceName); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + FileShareData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetAll_FileSharesListByParentMaximumSetGenGeneratedByMaximumSetRule() + { + // Generated from example definition: 2024-01-01-preview/FileShares_ListByParent_MaximumSet_Gen.json + // this example is just showing the usage of "FileShare_ListByParent" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "AD98EFD8-D1E9-4F38-A862-E066114E49EE"; + string resourceGroupName = "rgfileshares"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this FileShareResource + FileShareCollection collection = resourceGroupResource.GetFileShares(); + + // invoke the operation and iterate over the result + await foreach (FileShareResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + FileShareData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Exists_FileSharesGetMaximumSetGenGeneratedByMaximumSetRule() + { + // Generated from example definition: 2024-01-01-preview/FileShares_Get_MaximumSet_Gen.json + // this example is just showing the usage of "FileShare_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "AD98EFD8-D1E9-4F38-A862-E066114E49EE"; + string resourceGroupName = "rgfileshares"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this FileShareResource + FileShareCollection collection = resourceGroupResource.GetFileShares(); + + // invoke the operation + string resourceName = "testfileshare"; + bool result = await collection.ExistsAsync(resourceName); + + Console.WriteLine($"Succeeded: {result}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetIfExists_FileSharesGetMaximumSetGenGeneratedByMaximumSetRule() + { + // Generated from example definition: 2024-01-01-preview/FileShares_Get_MaximumSet_Gen.json + // this example is just showing the usage of "FileShare_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "AD98EFD8-D1E9-4F38-A862-E066114E49EE"; + string resourceGroupName = "rgfileshares"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this FileShareResource + FileShareCollection collection = resourceGroupResource.GetFileShares(); + + // invoke the operation + string resourceName = "testfileshare"; + NullableResponse response = await collection.GetIfExistsAsync(resourceName); + FileShareResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine("Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + FileShareData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + } +} diff --git a/sdk/fileshares/Azure.ResourceManager.Fileshares/samples/Generated/Samples/Sample_FileShareResource.cs b/sdk/fileshares/Azure.ResourceManager.Fileshares/samples/Generated/Samples/Sample_FileShareResource.cs new file mode 100644 index 000000000000..fb80d819304e --- /dev/null +++ b/sdk/fileshares/Azure.ResourceManager.Fileshares/samples/Generated/Samples/Sample_FileShareResource.cs @@ -0,0 +1,122 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager.Fileshares.Models; +using NUnit.Framework; + +namespace Azure.ResourceManager.Fileshares.Samples +{ + public partial class Sample_FileShareResource + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Get_FileSharesGetMaximumSetGenGeneratedByMaximumSetRule() + { + // Generated from example definition: 2024-01-01-preview/FileShares_Get_MaximumSet_Gen.json + // this example is just showing the usage of "FileShare_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this FileShareResource created on azure + // for more information of creating FileShareResource, please refer to the document of FileShareResource + string subscriptionId = "AD98EFD8-D1E9-4F38-A862-E066114E49EE"; + string resourceGroupName = "rgfileshares"; + string resourceName = "testfileshare"; + ResourceIdentifier fileShareResourceId = FileShareResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, resourceName); + FileShareResource fileShare = client.GetFileShareResource(fileShareResourceId); + + // invoke the operation + FileShareResource result = await fileShare.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + FileShareData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Delete_FileSharesDeleteMaximumSetGenGeneratedByMaximumSetRule() + { + // Generated from example definition: 2024-01-01-preview/FileShares_Delete_MaximumSet_Gen.json + // this example is just showing the usage of "FileShare_Delete" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this FileShareResource created on azure + // for more information of creating FileShareResource, please refer to the document of FileShareResource + string subscriptionId = "AD98EFD8-D1E9-4F38-A862-E066114E49EE"; + string resourceGroupName = "rgfileshares"; + string resourceName = "testfileshare"; + ResourceIdentifier fileShareResourceId = FileShareResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, resourceName); + FileShareResource fileShare = client.GetFileShareResource(fileShareResourceId); + + // invoke the operation + await fileShare.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Update_FileSharesUpdateMaximumSetGenGeneratedByMaximumSetRule() + { + // Generated from example definition: 2024-01-01-preview/FileShares_Update_MaximumSet_Gen.json + // this example is just showing the usage of "FileShare_Update" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this FileShareResource created on azure + // for more information of creating FileShareResource, please refer to the document of FileShareResource + string subscriptionId = "AD98EFD8-D1E9-4F38-A862-E066114E49EE"; + string resourceGroupName = "rgfileshares"; + string resourceName = "testfileshare"; + ResourceIdentifier fileShareResourceId = FileShareResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, resourceName); + FileShareResource fileShare = client.GetFileShareResource(fileShareResourceId); + + // invoke the operation + FileSharePatch patch = new FileSharePatch + { + Tags = +{ +["key9986"] = "aq" +}, + Properties = new FileShareUpdateProperties + { + ProvisionedStorageGiB = 20, + ProvisionedIOPerSec = 19, + ProvisionedThroughputMiBPerSec = 27, + NfsProtocolRootSquash = ShareRootSquash.NoRootSquash, + PublicAccessAllowedSubnets = { "pvjhqlnqfiubvbfcggthlpy" }, + PublicNetworkAccess = PublicNetworkAccess.Enabled, + }, + }; + ArmOperation lro = await fileShare.UpdateAsync(WaitUntil.Completed, patch); + FileShareResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + FileShareData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/fileshares/Azure.ResourceManager.Fileshares/samples/Generated/Samples/Sample_FileShareSnapshotCollection.cs b/sdk/fileshares/Azure.ResourceManager.Fileshares/samples/Generated/Samples/Sample_FileShareSnapshotCollection.cs new file mode 100644 index 000000000000..1a207c50e62b --- /dev/null +++ b/sdk/fileshares/Azure.ResourceManager.Fileshares/samples/Generated/Samples/Sample_FileShareSnapshotCollection.cs @@ -0,0 +1,206 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager.Fileshares.Models; +using NUnit.Framework; + +namespace Azure.ResourceManager.Fileshares.Samples +{ + public partial class Sample_FileShareSnapshotCollection + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task CreateOrUpdate_FileSharesCreateOrUpdateFileShareSnapshotMaximumSetGenGeneratedByMaximumSetRule() + { + // Generated from example definition: 2024-01-01-preview/FileShares_CreateOrUpdateFileShareSnapshot_MaximumSet_Gen.json + // this example is just showing the usage of "FileShareSnapshot_CreateOrUpdateFileShareSnapshot" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this FileShareResource created on azure + // for more information of creating FileShareResource, please refer to the document of FileShareResource + string subscriptionId = "AD98EFD8-D1E9-4F38-A862-E066114E49EE"; + string resourceGroupName = "rgfileshares"; + string resourceName = "testfileshare"; + ResourceIdentifier fileShareResourceId = FileShareResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, resourceName); + FileShareResource fileShare = client.GetFileShareResource(fileShareResourceId); + + // get the collection of this FileShareSnapshotResource + FileShareSnapshotCollection collection = fileShare.GetFileShareSnapshots(); + + // invoke the operation + string name = "testfilesharesnapshot"; + FileShareSnapshotData data = new FileShareSnapshotData + { + Properties = new FileShareSnapshotProperties + { + Metadata = +{ +["key5497"] = "xxznaauato" +}, + }, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, name, data); + FileShareSnapshotResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + FileShareSnapshotData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Get_FileSharesGetFileShareSnapshotMaximumSetGenGeneratedByMaximumSetRule() + { + // Generated from example definition: 2024-01-01-preview/FileShares_GetFileShareSnapshot_MaximumSet_Gen.json + // this example is just showing the usage of "FileShareSnapshot_GetFileShareSnapshot" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this FileShareResource created on azure + // for more information of creating FileShareResource, please refer to the document of FileShareResource + string subscriptionId = "AD98EFD8-D1E9-4F38-A862-E066114E49EE"; + string resourceGroupName = "rgfileshares"; + string resourceName = "testfileshare"; + ResourceIdentifier fileShareResourceId = FileShareResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, resourceName); + FileShareResource fileShare = client.GetFileShareResource(fileShareResourceId); + + // get the collection of this FileShareSnapshotResource + FileShareSnapshotCollection collection = fileShare.GetFileShareSnapshots(); + + // invoke the operation + string name = "testfilesharesnapshot"; + FileShareSnapshotResource result = await collection.GetAsync(name); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + FileShareSnapshotData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetAll_FileSharesListByFileShareMaximumSet() + { + // Generated from example definition: 2024-01-01-preview/FileShares_ListByFileShare_MaximumSet_Gen.json + // this example is just showing the usage of "FileShareSnapshot_ListByFileShare" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this FileShareResource created on azure + // for more information of creating FileShareResource, please refer to the document of FileShareResource + string subscriptionId = "09A2620A-99C9-4A63-A89E-AB06AA59A998"; + string resourceGroupName = "rgfileshares"; + string resourceName = "testfilesharesnapshot"; + ResourceIdentifier fileShareResourceId = FileShareResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, resourceName); + FileShareResource fileShare = client.GetFileShareResource(fileShareResourceId); + + // get the collection of this FileShareSnapshotResource + FileShareSnapshotCollection collection = fileShare.GetFileShareSnapshots(); + + // invoke the operation and iterate over the result + await foreach (FileShareSnapshotResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + FileShareSnapshotData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Exists_FileSharesGetFileShareSnapshotMaximumSetGenGeneratedByMaximumSetRule() + { + // Generated from example definition: 2024-01-01-preview/FileShares_GetFileShareSnapshot_MaximumSet_Gen.json + // this example is just showing the usage of "FileShareSnapshot_GetFileShareSnapshot" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this FileShareResource created on azure + // for more information of creating FileShareResource, please refer to the document of FileShareResource + string subscriptionId = "AD98EFD8-D1E9-4F38-A862-E066114E49EE"; + string resourceGroupName = "rgfileshares"; + string resourceName = "testfileshare"; + ResourceIdentifier fileShareResourceId = FileShareResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, resourceName); + FileShareResource fileShare = client.GetFileShareResource(fileShareResourceId); + + // get the collection of this FileShareSnapshotResource + FileShareSnapshotCollection collection = fileShare.GetFileShareSnapshots(); + + // invoke the operation + string name = "testfilesharesnapshot"; + bool result = await collection.ExistsAsync(name); + + Console.WriteLine($"Succeeded: {result}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetIfExists_FileSharesGetFileShareSnapshotMaximumSetGenGeneratedByMaximumSetRule() + { + // Generated from example definition: 2024-01-01-preview/FileShares_GetFileShareSnapshot_MaximumSet_Gen.json + // this example is just showing the usage of "FileShareSnapshot_GetFileShareSnapshot" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this FileShareResource created on azure + // for more information of creating FileShareResource, please refer to the document of FileShareResource + string subscriptionId = "AD98EFD8-D1E9-4F38-A862-E066114E49EE"; + string resourceGroupName = "rgfileshares"; + string resourceName = "testfileshare"; + ResourceIdentifier fileShareResourceId = FileShareResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, resourceName); + FileShareResource fileShare = client.GetFileShareResource(fileShareResourceId); + + // get the collection of this FileShareSnapshotResource + FileShareSnapshotCollection collection = fileShare.GetFileShareSnapshots(); + + // invoke the operation + string name = "testfilesharesnapshot"; + NullableResponse response = await collection.GetIfExistsAsync(name); + FileShareSnapshotResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine("Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + FileShareSnapshotData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + } +} diff --git a/sdk/fileshares/Azure.ResourceManager.Fileshares/samples/Generated/Samples/Sample_FileShareSnapshotResource.cs b/sdk/fileshares/Azure.ResourceManager.Fileshares/samples/Generated/Samples/Sample_FileShareSnapshotResource.cs new file mode 100644 index 000000000000..cb426d005302 --- /dev/null +++ b/sdk/fileshares/Azure.ResourceManager.Fileshares/samples/Generated/Samples/Sample_FileShareSnapshotResource.cs @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager.Fileshares.Models; +using NUnit.Framework; + +namespace Azure.ResourceManager.Fileshares.Samples +{ + public partial class Sample_FileShareSnapshotResource + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Get_FileSharesGetFileShareSnapshotMaximumSetGenGeneratedByMaximumSetRule() + { + // Generated from example definition: 2024-01-01-preview/FileShares_GetFileShareSnapshot_MaximumSet_Gen.json + // this example is just showing the usage of "FileShareSnapshot_GetFileShareSnapshot" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this FileShareSnapshotResource created on azure + // for more information of creating FileShareSnapshotResource, please refer to the document of FileShareSnapshotResource + string subscriptionId = "AD98EFD8-D1E9-4F38-A862-E066114E49EE"; + string resourceGroupName = "rgfileshares"; + string resourceName = "testfileshare"; + string name = "testfilesharesnapshot"; + ResourceIdentifier fileShareSnapshotResourceId = FileShareSnapshotResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, resourceName, name); + FileShareSnapshotResource fileShareSnapshot = client.GetFileShareSnapshotResource(fileShareSnapshotResourceId); + + // invoke the operation + FileShareSnapshotResource result = await fileShareSnapshot.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + FileShareSnapshotData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Delete_FileSharesDeleteFileShareSnapshotMaximumSetGenGeneratedByMaximumSetRule() + { + // Generated from example definition: 2024-01-01-preview/FileShares_DeleteFileShareSnapshot_MaximumSet_Gen.json + // this example is just showing the usage of "FileShareSnapshot_DeleteFileShareSnapshot" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this FileShareSnapshotResource created on azure + // for more information of creating FileShareSnapshotResource, please refer to the document of FileShareSnapshotResource + string subscriptionId = "AD98EFD8-D1E9-4F38-A862-E066114E49EE"; + string resourceGroupName = "rgfileshares"; + string resourceName = "testfileshare"; + string name = "testfilesharesnapshot"; + ResourceIdentifier fileShareSnapshotResourceId = FileShareSnapshotResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, resourceName, name); + FileShareSnapshotResource fileShareSnapshot = client.GetFileShareSnapshotResource(fileShareSnapshotResourceId); + + // invoke the operation + await fileShareSnapshot.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Update_FileSharesUpdateFileShareSnapshotMaximumSetGenGeneratedByMaximumSetRule() + { + // Generated from example definition: 2024-01-01-preview/FileShares_UpdateFileShareSnapshot_MaximumSet_Gen.json + // this example is just showing the usage of "FileShareSnapshot_UpdateFileShareSnapshot" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this FileShareSnapshotResource created on azure + // for more information of creating FileShareSnapshotResource, please refer to the document of FileShareSnapshotResource + string subscriptionId = "AD98EFD8-D1E9-4F38-A862-E066114E49EE"; + string resourceGroupName = "rgfileshares"; + string resourceName = "testfileshare"; + string name = "testfilesharesnapshot"; + ResourceIdentifier fileShareSnapshotResourceId = FileShareSnapshotResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, resourceName, name); + FileShareSnapshotResource fileShareSnapshot = client.GetFileShareSnapshotResource(fileShareSnapshotResourceId); + + // invoke the operation + FileShareSnapshotPatch patch = new FileShareSnapshotPatch + { + FileShareSnapshotUpdateMetadata = +{ +["key5497"] = "xxznaauato" +}, + }; + ArmOperation lro = await fileShareSnapshot.UpdateAsync(WaitUntil.Completed, patch); + FileShareSnapshotResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + FileShareSnapshotData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/fileshares/Azure.ResourceManager.Fileshares/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs b/sdk/fileshares/Azure.ResourceManager.Fileshares/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs new file mode 100644 index 000000000000..328a01958049 --- /dev/null +++ b/sdk/fileshares/Azure.ResourceManager.Fileshares/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs @@ -0,0 +1,107 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager.Fileshares.Models; +using Azure.ResourceManager.Resources; +using NUnit.Framework; + +namespace Azure.ResourceManager.Fileshares.Samples +{ + public partial class Sample_SubscriptionResourceExtensions + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetFileShares_FileSharesListBySubscriptionMaximumSetGenGeneratedByMaximumSetRule() + { + // Generated from example definition: 2024-01-01-preview/FileShares_ListBySubscription_MaximumSet_Gen.json + // this example is just showing the usage of "FileShare_ListBySubscription" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "AD98EFD8-D1E9-4F38-A862-E066114E49EE"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // invoke the operation and iterate over the result + await foreach (FileShareResource item in subscriptionResource.GetFileSharesAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + FileShareData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task CheckNameAvailabilityFileShare_FileSharesCheckNameAvailabilityMaximumSetGenGeneratedByMaximumSetRule() + { + // Generated from example definition: 2024-01-01-preview/FileShares_CheckNameAvailability_MaximumSet_Gen.json + // this example is just showing the usage of "FileShares_CheckNameAvailability" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "AD98EFD8-D1E9-4F38-A862-E066114E49EE"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // invoke the operation + AzureLocation location = new AzureLocation("westus"); + CheckNameAvailabilityContent content = new CheckNameAvailabilityContent + { + Name = "vmwdhkiwetidjwivkh", + Type = "akrkqjmn", + }; + CheckNameAvailabilityResult result = await subscriptionResource.CheckNameAvailabilityFileShareAsync(location, content); + + Console.WriteLine($"Succeeded: {result}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task CheckNameAvailabilityFileShare_FileSharesCheckNameAvailabilityMaximumSetGenGeneratedByMinimumSetRule() + { + // Generated from example definition: 2024-01-01-preview/FileShares_CheckNameAvailability_MinimumSet_Gen.json + // this example is just showing the usage of "FileShares_CheckNameAvailability" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "AD98EFD8-D1E9-4F38-A862-E066114E49EE"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // invoke the operation + AzureLocation location = new AzureLocation("westus"); + CheckNameAvailabilityContent content = new CheckNameAvailabilityContent(); + CheckNameAvailabilityResult result = await subscriptionResource.CheckNameAvailabilityFileShareAsync(location, content); + + Console.WriteLine($"Succeeded: {result}"); + } + } +} diff --git a/sdk/fileshares/Azure.ResourceManager.Fileshares/samples/Generated/Samples/Sample_TenantResourceExtensions.cs b/sdk/fileshares/Azure.ResourceManager.Fileshares/samples/Generated/Samples/Sample_TenantResourceExtensions.cs new file mode 100644 index 000000000000..7af4e65cd23c --- /dev/null +++ b/sdk/fileshares/Azure.ResourceManager.Fileshares/samples/Generated/Samples/Sample_TenantResourceExtensions.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager.Fileshares.Models; +using Azure.ResourceManager.Resources; +using NUnit.Framework; + +namespace Azure.ResourceManager.Fileshares.Samples +{ + public partial class Sample_TenantResourceExtensions + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetOperations_OperationsListMaximumSetGenGeneratedByMaximumSetRule() + { + // Generated from example definition: 2024-01-01-preview/Operations_List_MaximumSet_Gen.json + // this example is just showing the usage of "Operations_List" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + TenantResource tenantResource = client.GetTenants().GetAllAsync().GetAsyncEnumerator().Current; + + // invoke the operation and iterate over the result + await foreach (Info item in tenantResource.GetOperationsAsync()) + { + Console.WriteLine($"Succeeded: {item}"); + } + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetOperations_OperationsListMaximumSetGenGeneratedByMinimumSetRule() + { + // Generated from example definition: 2024-01-01-preview/Operations_List_MinimumSet_Gen.json + // this example is just showing the usage of "Operations_List" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + TenantResource tenantResource = client.GetTenants().GetAllAsync().GetAsyncEnumerator().Current; + + // invoke the operation and iterate over the result + await foreach (Info item in tenantResource.GetOperationsAsync()) + { + Console.WriteLine($"Succeeded: {item}"); + } + + Console.WriteLine("Succeeded"); + } + } +} diff --git a/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Azure.ResourceManager.Fileshares.csproj b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Azure.ResourceManager.Fileshares.csproj new file mode 100644 index 000000000000..b089ae6c2c69 --- /dev/null +++ b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Azure.ResourceManager.Fileshares.csproj @@ -0,0 +1,8 @@ + + + Azure Resource Manager client SDK for Azure resource provider Fileshares. + 1.0.0-beta.1 + azure;management;arm;resource manager;fileshares + Azure.ResourceManager.Fileshares + + diff --git a/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/ArmFilesharesModelFactory.cs b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/ArmFilesharesModelFactory.cs new file mode 100644 index 000000000000..b49220510879 --- /dev/null +++ b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/ArmFilesharesModelFactory.cs @@ -0,0 +1,201 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; +using Azure.Core; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.Fileshares.Models +{ + /// Model factory for models. + public static partial class ArmFilesharesModelFactory + { + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The tags. + /// The location. + /// The resource-specific properties for this resource. + /// A new instance for mocking. + public static FileShareData FileShareData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, FileShareProperties properties = null) + { + tags ??= new Dictionary(); + + return new FileShareData( + id, + name, + resourceType, + systemData, + tags, + location, + properties, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The name of the file share as seen by the end user when mounting the share, such as in a URI or UNC format in their operating system. + /// The host name of the file share. + /// The storage media tier of the file share. + /// The chosen redundancy level of the file share. + /// The file sharing protocol for this file share. + /// The provisioned storage size of the share in GiB (1 GiB is 1024^3 bytes or 1073741824 bytes). A component of the file share's bill is the provisioned storage, regardless of the amount of used storage. + /// A date/time value that specifies when the provisioned storage for the file share is permitted to be reduced. + /// The provisioned IO / sec of the share. + /// A date/time value that specifies when the provisioned IOPS for the file share is permitted to be reduced. + /// The provisioned throughput / sec of the share. + /// A date/time value that specifies when the provisioned throughput for the file share is permitted to be reduced. + /// Burst IOPS are extra buffer IOPS enabling you to consume more than your provisioned IOPS for a short period of time, depending on the burst credits available for your share. + /// Max burst IOPS credits shows the maximum number of burst credits the share can have at the current IOPS provisioning level. + /// Protocol settings specific NFS. + /// The set of properties for control public access. + /// The status of the last operation. + /// Gets or sets allow or disallow public network access to azure managed file share. + /// The list of associated private endpoint connections. + /// A new instance for mocking. + public static FileShareProperties FileShareProperties(string mountName = null, string hostName = null, MediaTier? mediaTier = null, Redundancy? redundancy = null, Protocol? protocol = null, int? provisionedStorageGiB = null, DateTimeOffset? provisionedStorageNextAllowedDowngrade = null, int? provisionedIOPerSec = null, DateTimeOffset? provisionedIOPerSecNextAllowedDowngrade = null, int? provisionedThroughputMiBPerSec = null, DateTimeOffset? provisionedThroughputNextAllowedDowngrade = null, int? includedBurstIOPerSec = null, long? maxBurstIOPerSecCredits = null, ShareRootSquash? nfsProtocolRootSquash = null, IEnumerable publicAccessAllowedSubnets = null, FileShareProvisioningState? provisioningState = null, PublicNetworkAccess? publicNetworkAccess = null, IEnumerable privateEndpointConnections = null) + { + publicAccessAllowedSubnets ??= new List(); + privateEndpointConnections ??= new List(); + + return new FileShareProperties( + mountName, + hostName, + mediaTier, + redundancy, + protocol, + provisionedStorageGiB, + provisionedStorageNextAllowedDowngrade, + provisionedIOPerSec, + provisionedIOPerSecNextAllowedDowngrade, + provisionedThroughputMiBPerSec, + provisionedThroughputNextAllowedDowngrade, + includedBurstIOPerSec, + maxBurstIOPerSecCredits, + nfsProtocolRootSquash != null ? new NfsProtocolProperties(nfsProtocolRootSquash, serializedAdditionalRawData: null) : null, + publicAccessAllowedSubnets != null ? new PublicAccessProperties(publicAccessAllowedSubnets?.ToList(), serializedAdditionalRawData: null) : null, + provisioningState, + publicNetworkAccess, + privateEndpointConnections?.ToList(), + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The private endpoint connection properties. + /// A new instance for mocking. + public static FilesharesPrivateEndpointConnection FilesharesPrivateEndpointConnection(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, PrivateEndpointConnectionProperties properties = null) + { + return new FilesharesPrivateEndpointConnection( + id, + name, + resourceType, + systemData, + properties, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The group ids for the private endpoint resource. + /// The private endpoint resource. + /// A collection of information about the state of the connection between service consumer and provider. + /// The provisioning state of the private endpoint connection resource. + /// A new instance for mocking. + public static PrivateEndpointConnectionProperties PrivateEndpointConnectionProperties(IEnumerable groupIds = null, ResourceIdentifier privateEndpointId = null, FilesharesPrivateLinkServiceConnectionState privateLinkServiceConnectionState = null, FilesharesPrivateEndpointConnectionProvisioningState? provisioningState = null) + { + groupIds ??= new List(); + + return new PrivateEndpointConnectionProperties(groupIds?.ToList(), privateEndpointId != null ? ResourceManagerModelFactory.SubResource(privateEndpointId) : null, privateLinkServiceConnectionState, provisioningState, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Indicates whether the connection has been Approved/Rejected/Removed by the owner of the service. + /// The reason for approval/rejection of the connection. + /// A message indicating if changes on the service provider require any updates on the consumer. + /// A new instance for mocking. + public static FilesharesPrivateLinkServiceConnectionState FilesharesPrivateLinkServiceConnectionState(FilesharesPrivateEndpointServiceConnectionStatus? status = null, string description = null, string actionsRequired = null) + { + return new FilesharesPrivateLinkServiceConnectionState(status, description, actionsRequired, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Indicates if the resource name is available. + /// The reason why the given name is not available. + /// Detailed reason why the given name is not available. + /// A new instance for mocking. + public static CheckNameAvailabilityResult CheckNameAvailabilityResult(bool? nameAvailable = null, CheckNameAvailabilityReason? reason = null, string message = null) + { + return new CheckNameAvailabilityResult(nameAvailable, reason, message, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The resource-specific properties for this resource. + /// A new instance for mocking. + public static FileShareSnapshotData FileShareSnapshotData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, FileShareSnapshotProperties properties = null) + { + return new FileShareSnapshotData( + id, + name, + resourceType, + systemData, + properties, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The FileShareSnapshot time in UTC in string representation. + /// The initiator of the FileShareSnapshot. + /// The metadata. + /// The status of the last operation. + /// A new instance for mocking. + public static FileShareSnapshotProperties FileShareSnapshotProperties(string snapshotTime = null, string initiatorId = null, IDictionary metadata = null, FileShareProvisioningState? provisioningState = null) + { + metadata ??= new Dictionary(); + + return new FileShareSnapshotProperties(snapshotTime, initiatorId, metadata, provisioningState, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The name of the operation, as per Resource-Based Access Control (RBAC). Examples: "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action". + /// Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for Azure Resource Manager/control-plane operations. + /// Localized display information for this particular operation. + /// The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value is "user,system". + /// Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + /// A new instance for mocking. + public static Info Info(string name = null, bool? isDataAction = null, OperationDisplay display = null, Origin? origin = null, ActionType? actionType = null) + { + return new Info( + name, + isDataAction, + display, + origin, + actionType, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or "Microsoft Compute". + /// The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or "Job Schedule Collections". + /// The concise, localized friendly name for the operation; suitable for dropdowns. E.g. "Create or Update Virtual Machine", "Restart Virtual Machine". + /// The short, localized friendly description of the operation; suitable for tool tips and detailed views. + /// A new instance for mocking. + public static OperationDisplay OperationDisplay(string provider = null, string resource = null, string operation = null, string description = null) + { + return new OperationDisplay(provider, resource, operation, description, serializedAdditionalRawData: null); + } + } +} diff --git a/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Extensions/FilesharesExtensions.cs b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Extensions/FilesharesExtensions.cs new file mode 100644 index 000000000000..21abda99d8a7 --- /dev/null +++ b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Extensions/FilesharesExtensions.cs @@ -0,0 +1,374 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.ResourceManager.Fileshares.Mocking; +using Azure.ResourceManager.Fileshares.Models; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.Fileshares +{ + /// A class to add extension methods to Azure.ResourceManager.Fileshares. + public static partial class FilesharesExtensions + { + private static MockableFilesharesArmClient GetMockableFilesharesArmClient(ArmClient client) + { + return client.GetCachedClient(client0 => new MockableFilesharesArmClient(client0)); + } + + private static MockableFilesharesResourceGroupResource GetMockableFilesharesResourceGroupResource(ArmResource resource) + { + return resource.GetCachedClient(client => new MockableFilesharesResourceGroupResource(client, resource.Id)); + } + + private static MockableFilesharesSubscriptionResource GetMockableFilesharesSubscriptionResource(ArmResource resource) + { + return resource.GetCachedClient(client => new MockableFilesharesSubscriptionResource(client, resource.Id)); + } + + private static MockableFilesharesTenantResource GetMockableFilesharesTenantResource(ArmResource resource) + { + return resource.GetCachedClient(client => new MockableFilesharesTenantResource(client, resource.Id)); + } + + /// + /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static FileShareResource GetFileShareResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableFilesharesArmClient(client).GetFileShareResource(id); + } + + /// + /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static FileShareSnapshotResource GetFileShareSnapshotResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableFilesharesArmClient(client).GetFileShareSnapshotResource(id); + } + + /// + /// Gets a collection of FileShareResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// is null. + /// An object representing collection of FileShareResources and their operations over a FileShareResource. + public static FileShareCollection GetFileShares(this ResourceGroupResource resourceGroupResource) + { + Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); + + return GetMockableFilesharesResourceGroupResource(resourceGroupResource).GetFileShares(); + } + + /// + /// Get a FileShare + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.FileShares/fileShares/{resourceName} + /// + /// + /// Operation Id + /// FileShare_Get + /// + /// + /// Default Api Version + /// 2024-01-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource name of the file share, as seen by the administrator through Azure Resource Manager. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static async Task> GetFileShareAsync(this ResourceGroupResource resourceGroupResource, string resourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); + + return await GetMockableFilesharesResourceGroupResource(resourceGroupResource).GetFileShareAsync(resourceName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get a FileShare + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.FileShares/fileShares/{resourceName} + /// + /// + /// Operation Id + /// FileShare_Get + /// + /// + /// Default Api Version + /// 2024-01-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource name of the file share, as seen by the administrator through Azure Resource Manager. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static Response GetFileShare(this ResourceGroupResource resourceGroupResource, string resourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); + + return GetMockableFilesharesResourceGroupResource(resourceGroupResource).GetFileShare(resourceName, cancellationToken); + } + + /// + /// List FileShare resources by subscription ID + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.FileShares/fileShares + /// + /// + /// Operation Id + /// FileShare_ListBySubscription + /// + /// + /// Default Api Version + /// 2024-01-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The cancellation token to use. + /// is null. + /// An async collection of that may take multiple service requests to iterate over. + public static AsyncPageable GetFileSharesAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); + + return GetMockableFilesharesSubscriptionResource(subscriptionResource).GetFileSharesAsync(cancellationToken); + } + + /// + /// List FileShare resources by subscription ID + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.FileShares/fileShares + /// + /// + /// Operation Id + /// FileShare_ListBySubscription + /// + /// + /// Default Api Version + /// 2024-01-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The cancellation token to use. + /// is null. + /// A collection of that may take multiple service requests to iterate over. + public static Pageable GetFileShares(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); + + return GetMockableFilesharesSubscriptionResource(subscriptionResource).GetFileShares(cancellationToken); + } + + /// + /// Implements local CheckNameAvailability operations + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.FileShares/locations/{location}/checkNameAvailability + /// + /// + /// Operation Id + /// FileShares_CheckNameAvailability + /// + /// + /// Default Api Version + /// 2024-01-01-preview + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The name of the Azure region. + /// The CheckAvailability request. + /// The cancellation token to use. + /// or is null. + public static async Task> CheckNameAvailabilityFileShareAsync(this SubscriptionResource subscriptionResource, AzureLocation location, CheckNameAvailabilityContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); + + return await GetMockableFilesharesSubscriptionResource(subscriptionResource).CheckNameAvailabilityFileShareAsync(location, content, cancellationToken).ConfigureAwait(false); + } + + /// + /// Implements local CheckNameAvailability operations + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.FileShares/locations/{location}/checkNameAvailability + /// + /// + /// Operation Id + /// FileShares_CheckNameAvailability + /// + /// + /// Default Api Version + /// 2024-01-01-preview + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The name of the Azure region. + /// The CheckAvailability request. + /// The cancellation token to use. + /// or is null. + public static Response CheckNameAvailabilityFileShare(this SubscriptionResource subscriptionResource, AzureLocation location, CheckNameAvailabilityContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); + + return GetMockableFilesharesSubscriptionResource(subscriptionResource).CheckNameAvailabilityFileShare(location, content, cancellationToken); + } + + /// + /// List the operations for the provider + /// + /// + /// Request Path + /// /providers/Microsoft.FileShares/operations + /// + /// + /// Operation Id + /// Operations_List + /// + /// + /// Default Api Version + /// 2024-01-01-preview + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The cancellation token to use. + /// is null. + /// An async collection of that may take multiple service requests to iterate over. + public static AsyncPageable GetOperationsAsync(this TenantResource tenantResource, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tenantResource, nameof(tenantResource)); + + return GetMockableFilesharesTenantResource(tenantResource).GetOperationsAsync(cancellationToken); + } + + /// + /// List the operations for the provider + /// + /// + /// Request Path + /// /providers/Microsoft.FileShares/operations + /// + /// + /// Operation Id + /// Operations_List + /// + /// + /// Default Api Version + /// 2024-01-01-preview + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The cancellation token to use. + /// is null. + /// A collection of that may take multiple service requests to iterate over. + public static Pageable GetOperations(this TenantResource tenantResource, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tenantResource, nameof(tenantResource)); + + return GetMockableFilesharesTenantResource(tenantResource).GetOperations(cancellationToken); + } + } +} diff --git a/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Extensions/MockableFilesharesArmClient.cs b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Extensions/MockableFilesharesArmClient.cs new file mode 100644 index 000000000000..4993e1e720b2 --- /dev/null +++ b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Extensions/MockableFilesharesArmClient.cs @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; + +namespace Azure.ResourceManager.Fileshares.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableFilesharesArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableFilesharesArmClient() + { + } + + /// 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 MockableFilesharesArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableFilesharesArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual FileShareResource GetFileShareResource(ResourceIdentifier id) + { + FileShareResource.ValidateResourceId(id); + return new FileShareResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual FileShareSnapshotResource GetFileShareSnapshotResource(ResourceIdentifier id) + { + FileShareSnapshotResource.ValidateResourceId(id); + return new FileShareSnapshotResource(Client, id); + } + } +} diff --git a/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Extensions/MockableFilesharesResourceGroupResource.cs b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Extensions/MockableFilesharesResourceGroupResource.cs new file mode 100644 index 000000000000..c226543d2a9f --- /dev/null +++ b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Extensions/MockableFilesharesResourceGroupResource.cs @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; + +namespace Azure.ResourceManager.Fileshares.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableFilesharesResourceGroupResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableFilesharesResourceGroupResource() + { + } + + /// 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 MockableFilesharesResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of FileShareResources in the ResourceGroupResource. + /// An object representing collection of FileShareResources and their operations over a FileShareResource. + public virtual FileShareCollection GetFileShares() + { + return GetCachedClient(client => new FileShareCollection(client, Id)); + } + + /// + /// Get a FileShare + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.FileShares/fileShares/{resourceName} + /// + /// + /// Operation Id + /// FileShare_Get + /// + /// + /// Default Api Version + /// 2024-01-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The resource name of the file share, as seen by the administrator through Azure Resource Manager. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetFileShareAsync(string resourceName, CancellationToken cancellationToken = default) + { + return await GetFileShares().GetAsync(resourceName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get a FileShare + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.FileShares/fileShares/{resourceName} + /// + /// + /// Operation Id + /// FileShare_Get + /// + /// + /// Default Api Version + /// 2024-01-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The resource name of the file share, as seen by the administrator through Azure Resource Manager. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetFileShare(string resourceName, CancellationToken cancellationToken = default) + { + return GetFileShares().Get(resourceName, cancellationToken); + } + } +} diff --git a/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Extensions/MockableFilesharesSubscriptionResource.cs b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Extensions/MockableFilesharesSubscriptionResource.cs new file mode 100644 index 000000000000..61423038d86e --- /dev/null +++ b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Extensions/MockableFilesharesSubscriptionResource.cs @@ -0,0 +1,187 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Fileshares.Models; + +namespace Azure.ResourceManager.Fileshares.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableFilesharesSubscriptionResource : ArmResource + { + private ClientDiagnostics _fileShareClientDiagnostics; + private FileSharesRestOperations _fileShareRestClient; + private ClientDiagnostics _fileSharesClientDiagnostics; + private FileSharesRestOperations _fileSharesRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableFilesharesSubscriptionResource() + { + } + + /// 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 MockableFilesharesSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics FileShareClientDiagnostics => _fileShareClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Fileshares", FileShareResource.ResourceType.Namespace, Diagnostics); + private FileSharesRestOperations FileShareRestClient => _fileShareRestClient ??= new FileSharesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(FileShareResource.ResourceType)); + private ClientDiagnostics FileSharesClientDiagnostics => _fileSharesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Fileshares", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private FileSharesRestOperations FileSharesRestClient => _fileSharesRestClient ??= new FileSharesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// List FileShare resources by subscription ID + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.FileShares/fileShares + /// + /// + /// Operation Id + /// FileShare_ListBySubscription + /// + /// + /// Default Api Version + /// 2024-01-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetFileSharesAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => FileShareRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => FileShareRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new FileShareResource(Client, FileShareData.DeserializeFileShareData(e)), FileShareClientDiagnostics, Pipeline, "MockableFilesharesSubscriptionResource.GetFileShares", "value", "nextLink", cancellationToken); + } + + /// + /// List FileShare resources by subscription ID + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.FileShares/fileShares + /// + /// + /// Operation Id + /// FileShare_ListBySubscription + /// + /// + /// Default Api Version + /// 2024-01-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetFileShares(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => FileShareRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => FileShareRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new FileShareResource(Client, FileShareData.DeserializeFileShareData(e)), FileShareClientDiagnostics, Pipeline, "MockableFilesharesSubscriptionResource.GetFileShares", "value", "nextLink", cancellationToken); + } + + /// + /// Implements local CheckNameAvailability operations + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.FileShares/locations/{location}/checkNameAvailability + /// + /// + /// Operation Id + /// FileShares_CheckNameAvailability + /// + /// + /// Default Api Version + /// 2024-01-01-preview + /// + /// + /// + /// The name of the Azure region. + /// The CheckAvailability request. + /// The cancellation token to use. + /// is null. + public virtual async Task> CheckNameAvailabilityFileShareAsync(AzureLocation location, CheckNameAvailabilityContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = FileSharesClientDiagnostics.CreateScope("MockableFilesharesSubscriptionResource.CheckNameAvailabilityFileShare"); + scope.Start(); + try + { + var response = await FileSharesRestClient.CheckNameAvailabilityAsync(Id.SubscriptionId, location, content, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Implements local CheckNameAvailability operations + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.FileShares/locations/{location}/checkNameAvailability + /// + /// + /// Operation Id + /// FileShares_CheckNameAvailability + /// + /// + /// Default Api Version + /// 2024-01-01-preview + /// + /// + /// + /// The name of the Azure region. + /// The CheckAvailability request. + /// The cancellation token to use. + /// is null. + public virtual Response CheckNameAvailabilityFileShare(AzureLocation location, CheckNameAvailabilityContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = FileSharesClientDiagnostics.CreateScope("MockableFilesharesSubscriptionResource.CheckNameAvailabilityFileShare"); + scope.Start(); + try + { + var response = FileSharesRestClient.CheckNameAvailability(Id.SubscriptionId, location, content, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Extensions/MockableFilesharesTenantResource.cs b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Extensions/MockableFilesharesTenantResource.cs new file mode 100644 index 000000000000..5f727127ce7f --- /dev/null +++ b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Extensions/MockableFilesharesTenantResource.cs @@ -0,0 +1,95 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Threading; +using Autorest.CSharp.Core; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Fileshares.Models; + +namespace Azure.ResourceManager.Fileshares.Mocking +{ + /// A class to add extension methods to TenantResource. + public partial class MockableFilesharesTenantResource : ArmResource + { + private ClientDiagnostics _operationsClientDiagnostics; + private OperationsRestOperations _operationsRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableFilesharesTenantResource() + { + } + + /// 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 MockableFilesharesTenantResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics OperationsClientDiagnostics => _operationsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Fileshares", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private OperationsRestOperations OperationsRestClient => _operationsRestClient ??= new OperationsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// List the operations for the provider + /// + /// + /// Request Path + /// /providers/Microsoft.FileShares/operations + /// + /// + /// Operation Id + /// Operations_List + /// + /// + /// Default Api Version + /// 2024-01-01-preview + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetOperationsAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => OperationsRestClient.CreateListRequest(); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => OperationsRestClient.CreateListNextPageRequest(nextLink); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => Info.DeserializeInfo(e), OperationsClientDiagnostics, Pipeline, "MockableFilesharesTenantResource.GetOperations", "value", "nextLink", cancellationToken); + } + + /// + /// List the operations for the provider + /// + /// + /// Request Path + /// /providers/Microsoft.FileShares/operations + /// + /// + /// Operation Id + /// Operations_List + /// + /// + /// Default Api Version + /// 2024-01-01-preview + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetOperations(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => OperationsRestClient.CreateListRequest(); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => OperationsRestClient.CreateListNextPageRequest(nextLink); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => Info.DeserializeInfo(e), OperationsClientDiagnostics, Pipeline, "MockableFilesharesTenantResource.GetOperations", "value", "nextLink", cancellationToken); + } + } +} diff --git a/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/FileShareCollection.cs b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/FileShareCollection.cs new file mode 100644 index 000000000000..1945b527268b --- /dev/null +++ b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/FileShareCollection.cs @@ -0,0 +1,494 @@ +// 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.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.Fileshares +{ + /// + /// 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 GetFileShares method from an instance of . + /// + public partial class FileShareCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _fileShareClientDiagnostics; + private readonly FileSharesRestOperations _fileShareRestClient; + + /// Initializes a new instance of the class for mocking. + protected FileShareCollection() + { + } + + /// 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 FileShareCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _fileShareClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Fileshares", FileShareResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(FileShareResource.ResourceType, out string fileShareApiVersion); + _fileShareRestClient = new FileSharesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, fileShareApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceGroupResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceGroupResource.ResourceType), nameof(id)); + } + + /// + /// Create or update a file share. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.FileShares/fileShares/{resourceName} + /// + /// + /// Operation Id + /// FileShare_CreateOrUpdate + /// + /// + /// Default Api Version + /// 2024-01-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 resource name of the file share, as seen by the administrator through Azure Resource Manager. + /// Resource create parameters. + /// 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 resourceName, FileShareData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _fileShareClientDiagnostics.CreateScope("FileShareCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _fileShareRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, resourceName, data, cancellationToken).ConfigureAwait(false); + var operation = new FilesharesArmOperation(new FileShareOperationSource(Client), _fileShareClientDiagnostics, Pipeline, _fileShareRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, resourceName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Create or update a file share. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.FileShares/fileShares/{resourceName} + /// + /// + /// Operation Id + /// FileShare_CreateOrUpdate + /// + /// + /// Default Api Version + /// 2024-01-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 resource name of the file share, as seen by the administrator through Azure Resource Manager. + /// Resource create parameters. + /// 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 resourceName, FileShareData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _fileShareClientDiagnostics.CreateScope("FileShareCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _fileShareRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, resourceName, data, cancellationToken); + var operation = new FilesharesArmOperation(new FileShareOperationSource(Client), _fileShareClientDiagnostics, Pipeline, _fileShareRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, resourceName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a FileShare + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.FileShares/fileShares/{resourceName} + /// + /// + /// Operation Id + /// FileShare_Get + /// + /// + /// Default Api Version + /// 2024-01-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The resource name of the file share, as seen by the administrator through Azure Resource Manager. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string resourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + + using var scope = _fileShareClientDiagnostics.CreateScope("FileShareCollection.Get"); + scope.Start(); + try + { + var response = await _fileShareRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, resourceName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new FileShareResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a FileShare + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.FileShares/fileShares/{resourceName} + /// + /// + /// Operation Id + /// FileShare_Get + /// + /// + /// Default Api Version + /// 2024-01-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The resource name of the file share, as seen by the administrator through Azure Resource Manager. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string resourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + + using var scope = _fileShareClientDiagnostics.CreateScope("FileShareCollection.Get"); + scope.Start(); + try + { + var response = _fileShareRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, resourceName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new FileShareResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// List FileShare resources by resource group + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.FileShares/fileShares + /// + /// + /// Operation Id + /// FileShare_ListByParent + /// + /// + /// Default Api Version + /// 2024-01-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _fileShareRestClient.CreateListByParentRequest(Id.SubscriptionId, Id.ResourceGroupName); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _fileShareRestClient.CreateListByParentNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new FileShareResource(Client, FileShareData.DeserializeFileShareData(e)), _fileShareClientDiagnostics, Pipeline, "FileShareCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// List FileShare resources by resource group + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.FileShares/fileShares + /// + /// + /// Operation Id + /// FileShare_ListByParent + /// + /// + /// Default Api Version + /// 2024-01-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _fileShareRestClient.CreateListByParentRequest(Id.SubscriptionId, Id.ResourceGroupName); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _fileShareRestClient.CreateListByParentNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new FileShareResource(Client, FileShareData.DeserializeFileShareData(e)), _fileShareClientDiagnostics, Pipeline, "FileShareCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.FileShares/fileShares/{resourceName} + /// + /// + /// Operation Id + /// FileShare_Get + /// + /// + /// Default Api Version + /// 2024-01-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The resource name of the file share, as seen by the administrator through Azure Resource Manager. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string resourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + + using var scope = _fileShareClientDiagnostics.CreateScope("FileShareCollection.Exists"); + scope.Start(); + try + { + var response = await _fileShareRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, resourceName, 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.FileShares/fileShares/{resourceName} + /// + /// + /// Operation Id + /// FileShare_Get + /// + /// + /// Default Api Version + /// 2024-01-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The resource name of the file share, as seen by the administrator through Azure Resource Manager. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string resourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + + using var scope = _fileShareClientDiagnostics.CreateScope("FileShareCollection.Exists"); + scope.Start(); + try + { + var response = _fileShareRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, resourceName, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.FileShares/fileShares/{resourceName} + /// + /// + /// Operation Id + /// FileShare_Get + /// + /// + /// Default Api Version + /// 2024-01-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The resource name of the file share, as seen by the administrator through Azure Resource Manager. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string resourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + + using var scope = _fileShareClientDiagnostics.CreateScope("FileShareCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _fileShareRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, resourceName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new FileShareResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.FileShares/fileShares/{resourceName} + /// + /// + /// Operation Id + /// FileShare_Get + /// + /// + /// Default Api Version + /// 2024-01-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The resource name of the file share, as seen by the administrator through Azure Resource Manager. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string resourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + + using var scope = _fileShareClientDiagnostics.CreateScope("FileShareCollection.GetIfExists"); + scope.Start(); + try + { + var response = _fileShareRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, resourceName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new FileShareResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/FileShareData.Serialization.cs b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/FileShareData.Serialization.cs new file mode 100644 index 000000000000..5e2d70b328bd --- /dev/null +++ b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/FileShareData.Serialization.cs @@ -0,0 +1,178 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Fileshares.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.Fileshares +{ + public partial class FileShareData : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(FileShareData)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); + } + } + + FileShareData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(FileShareData)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeFileShareData(document.RootElement, options); + } + + internal static FileShareData DeserializeFileShareData(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + FileShareProperties properties = default; + IDictionary tags = default; + AzureLocation location = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + SystemData systemData = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = FileShareProperties.DeserializeFileShareProperties(property.Value, options); + continue; + } + if (property.NameEquals("tags"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (property.NameEquals("location"u8)) + { + location = new AzureLocation(property.Value.GetString()); + continue; + } + 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 (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new FileShareData( + id, + name, + type, + systemData, + tags ?? new ChangeTrackingDictionary(), + location, + properties, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerFilesharesContext.Default); + default: + throw new FormatException($"The model {nameof(FileShareData)} does not support writing '{options.Format}' format."); + } + } + + FileShareData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeFileShareData(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(FileShareData)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/FileShareData.cs b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/FileShareData.cs new file mode 100644 index 000000000000..abc4427d573f --- /dev/null +++ b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/FileShareData.cs @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.Fileshares.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.Fileshares +{ + /// + /// A class representing the FileShare data model. + /// File share resource + /// + public partial class FileShareData : TrackedResourceData + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The location. + public FileShareData(AzureLocation location) : base(location) + { + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The tags. + /// The location. + /// The resource-specific properties for this resource. + /// Keeps track of any properties unknown to the library. + internal FileShareData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, FileShareProperties properties, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) + { + Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal FileShareData() + { + } + + /// The resource-specific properties for this resource. + public FileShareProperties Properties { get; set; } + } +} diff --git a/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/FileShareResource.Serialization.cs b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/FileShareResource.Serialization.cs new file mode 100644 index 000000000000..0c10bcc0db3c --- /dev/null +++ b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/FileShareResource.Serialization.cs @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Text.Json; + +namespace Azure.ResourceManager.Fileshares +{ + public partial class FileShareResource : IJsonModel + { + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); + + FileShareData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)Data).Create(ref reader, options); + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options, AzureResourceManagerFilesharesContext.Default); + + FileShareData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options, AzureResourceManagerFilesharesContext.Default); + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)Data).GetFormatFromOptions(options); + } +} diff --git a/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/FileShareResource.cs b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/FileShareResource.cs new file mode 100644 index 000000000000..edce7bf4aabc --- /dev/null +++ b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/FileShareResource.cs @@ -0,0 +1,776 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Fileshares.Models; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.Fileshares +{ + /// + /// A Class representing a FileShare 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 GetFileShareResource method. + /// Otherwise you can get one from its parent resource using the GetFileShare method. + /// + public partial class FileShareResource : ArmResource + { + /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The resourceName. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string resourceName) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.FileShares/fileShares/{resourceName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _fileShareClientDiagnostics; + private readonly FileSharesRestOperations _fileShareRestClient; + private readonly FileShareData _data; + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.FileShares/fileShares"; + + /// Initializes a new instance of the class for mocking. + protected FileShareResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal FileShareResource(ArmClient client, FileShareData 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 FileShareResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _fileShareClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Fileshares", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string fileShareApiVersion); + _fileShareRestClient = new FileSharesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, fileShareApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// 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 FileShareData 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)); + } + + /// Gets a collection of FileShareSnapshotResources in the FileShare. + /// An object representing collection of FileShareSnapshotResources and their operations over a FileShareSnapshotResource. + public virtual FileShareSnapshotCollection GetFileShareSnapshots() + { + return GetCachedClient(client => new FileShareSnapshotCollection(client, Id)); + } + + /// + /// Get a FileShareSnapshot + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.FileShares/fileShares/{resourceName}/fileShareSnapshots/{name} + /// + /// + /// Operation Id + /// FileShareSnapshot_GetFileShareSnapshot + /// + /// + /// Default Api Version + /// 2024-01-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the FileShareSnapshot. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetFileShareSnapshotAsync(string name, CancellationToken cancellationToken = default) + { + return await GetFileShareSnapshots().GetAsync(name, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get a FileShareSnapshot + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.FileShares/fileShares/{resourceName}/fileShareSnapshots/{name} + /// + /// + /// Operation Id + /// FileShareSnapshot_GetFileShareSnapshot + /// + /// + /// Default Api Version + /// 2024-01-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the FileShareSnapshot. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetFileShareSnapshot(string name, CancellationToken cancellationToken = default) + { + return GetFileShareSnapshots().Get(name, cancellationToken); + } + + /// + /// Get a FileShare + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.FileShares/fileShares/{resourceName} + /// + /// + /// Operation Id + /// FileShare_Get + /// + /// + /// Default Api Version + /// 2024-01-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _fileShareClientDiagnostics.CreateScope("FileShareResource.Get"); + scope.Start(); + try + { + var response = await _fileShareRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new FileShareResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a FileShare + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.FileShares/fileShares/{resourceName} + /// + /// + /// Operation Id + /// FileShare_Get + /// + /// + /// Default Api Version + /// 2024-01-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _fileShareClientDiagnostics.CreateScope("FileShareResource.Get"); + scope.Start(); + try + { + var response = _fileShareRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new FileShareResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete a FileShare + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.FileShares/fileShares/{resourceName} + /// + /// + /// Operation Id + /// FileShare_Delete + /// + /// + /// Default Api Version + /// 2024-01-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 = _fileShareClientDiagnostics.CreateScope("FileShareResource.Delete"); + scope.Start(); + try + { + var response = await _fileShareRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new FilesharesArmOperation(_fileShareClientDiagnostics, Pipeline, _fileShareRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, 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 FileShare + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.FileShares/fileShares/{resourceName} + /// + /// + /// Operation Id + /// FileShare_Delete + /// + /// + /// Default Api Version + /// 2024-01-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 = _fileShareClientDiagnostics.CreateScope("FileShareResource.Delete"); + scope.Start(); + try + { + var response = _fileShareRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + var operation = new FilesharesArmOperation(_fileShareClientDiagnostics, Pipeline, _fileShareRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Update a FileShare + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.FileShares/fileShares/{resourceName} + /// + /// + /// Operation Id + /// FileShare_Update + /// + /// + /// Default Api Version + /// 2024-01-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 resource properties to be updated. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, FileSharePatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(patch, nameof(patch)); + + using var scope = _fileShareClientDiagnostics.CreateScope("FileShareResource.Update"); + scope.Start(); + try + { + var response = await _fileShareRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch, cancellationToken).ConfigureAwait(false); + var operation = new FilesharesArmOperation(new FileShareOperationSource(Client), _fileShareClientDiagnostics, Pipeline, _fileShareRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Update a FileShare + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.FileShares/fileShares/{resourceName} + /// + /// + /// Operation Id + /// FileShare_Update + /// + /// + /// Default Api Version + /// 2024-01-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 resource properties to be updated. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, FileSharePatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(patch, nameof(patch)); + + using var scope = _fileShareClientDiagnostics.CreateScope("FileShareResource.Update"); + scope.Start(); + try + { + var response = _fileShareRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch, cancellationToken); + var operation = new FilesharesArmOperation(new FileShareOperationSource(Client), _fileShareClientDiagnostics, Pipeline, _fileShareRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Add a tag to the current resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.FileShares/fileShares/{resourceName} + /// + /// + /// Operation Id + /// FileShare_Get + /// + /// + /// Default Api Version + /// 2024-01-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The key for the tag. + /// The value for the tag. + /// The cancellation token to use. + /// or is null. + public virtual async Task> AddTagAsync(string key, string value, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + Argument.AssertNotNull(value, nameof(value)); + + using var scope = _fileShareClientDiagnostics.CreateScope("FileShareResource.AddTag"); + scope.Start(); + try + { + if (await CanUseTagResourceAsync(cancellationToken: cancellationToken).ConfigureAwait(false)) + { + var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); + originalTags.Value.Data.TagValues[key] = value; + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken).ConfigureAwait(false); + var originalResponse = await _fileShareRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new FileShareResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new FileSharePatch(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags[key] = value; + var result = await UpdateAsync(WaitUntil.Completed, patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Add a tag to the current resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.FileShares/fileShares/{resourceName} + /// + /// + /// Operation Id + /// FileShare_Get + /// + /// + /// Default Api Version + /// 2024-01-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The key for the tag. + /// The value for the tag. + /// The cancellation token to use. + /// or is null. + public virtual Response AddTag(string key, string value, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + Argument.AssertNotNull(value, nameof(value)); + + using var scope = _fileShareClientDiagnostics.CreateScope("FileShareResource.AddTag"); + scope.Start(); + try + { + if (CanUseTagResource(cancellationToken: cancellationToken)) + { + var originalTags = GetTagResource().Get(cancellationToken); + originalTags.Value.Data.TagValues[key] = value; + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken); + var originalResponse = _fileShareRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + return Response.FromValue(new FileShareResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new FileSharePatch(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags[key] = value; + var result = Update(WaitUntil.Completed, patch, cancellationToken: cancellationToken); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Replace the tags on the resource with the given set. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.FileShares/fileShares/{resourceName} + /// + /// + /// Operation Id + /// FileShare_Get + /// + /// + /// Default Api Version + /// 2024-01-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The set of tags to use as replacement. + /// The cancellation token to use. + /// is null. + public virtual async Task> SetTagsAsync(IDictionary tags, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tags, nameof(tags)); + + using var scope = _fileShareClientDiagnostics.CreateScope("FileShareResource.SetTags"); + scope.Start(); + try + { + if (await CanUseTagResourceAsync(cancellationToken: cancellationToken).ConfigureAwait(false)) + { + await GetTagResource().DeleteAsync(WaitUntil.Completed, cancellationToken: cancellationToken).ConfigureAwait(false); + var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); + originalTags.Value.Data.TagValues.ReplaceWith(tags); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken).ConfigureAwait(false); + var originalResponse = await _fileShareRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new FileShareResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new FileSharePatch(); + patch.Tags.ReplaceWith(tags); + var result = await UpdateAsync(WaitUntil.Completed, patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Replace the tags on the resource with the given set. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.FileShares/fileShares/{resourceName} + /// + /// + /// Operation Id + /// FileShare_Get + /// + /// + /// Default Api Version + /// 2024-01-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The set of tags to use as replacement. + /// The cancellation token to use. + /// is null. + public virtual Response SetTags(IDictionary tags, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tags, nameof(tags)); + + using var scope = _fileShareClientDiagnostics.CreateScope("FileShareResource.SetTags"); + scope.Start(); + try + { + if (CanUseTagResource(cancellationToken: cancellationToken)) + { + GetTagResource().Delete(WaitUntil.Completed, cancellationToken: cancellationToken); + var originalTags = GetTagResource().Get(cancellationToken); + originalTags.Value.Data.TagValues.ReplaceWith(tags); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken); + var originalResponse = _fileShareRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + return Response.FromValue(new FileShareResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new FileSharePatch(); + patch.Tags.ReplaceWith(tags); + var result = Update(WaitUntil.Completed, patch, cancellationToken: cancellationToken); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Removes a tag by key from the resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.FileShares/fileShares/{resourceName} + /// + /// + /// Operation Id + /// FileShare_Get + /// + /// + /// Default Api Version + /// 2024-01-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The key for the tag. + /// The cancellation token to use. + /// is null. + public virtual async Task> RemoveTagAsync(string key, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + + using var scope = _fileShareClientDiagnostics.CreateScope("FileShareResource.RemoveTag"); + scope.Start(); + try + { + if (await CanUseTagResourceAsync(cancellationToken: cancellationToken).ConfigureAwait(false)) + { + var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); + originalTags.Value.Data.TagValues.Remove(key); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken).ConfigureAwait(false); + var originalResponse = await _fileShareRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new FileShareResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new FileSharePatch(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags.Remove(key); + var result = await UpdateAsync(WaitUntil.Completed, patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Removes a tag by key from the resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.FileShares/fileShares/{resourceName} + /// + /// + /// Operation Id + /// FileShare_Get + /// + /// + /// Default Api Version + /// 2024-01-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The key for the tag. + /// The cancellation token to use. + /// is null. + public virtual Response RemoveTag(string key, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + + using var scope = _fileShareClientDiagnostics.CreateScope("FileShareResource.RemoveTag"); + scope.Start(); + try + { + if (CanUseTagResource(cancellationToken: cancellationToken)) + { + var originalTags = GetTagResource().Get(cancellationToken); + originalTags.Value.Data.TagValues.Remove(key); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken); + var originalResponse = _fileShareRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + return Response.FromValue(new FileShareResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new FileSharePatch(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags.Remove(key); + var result = Update(WaitUntil.Completed, patch, cancellationToken: cancellationToken); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/FileShareSnapshotCollection.cs b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/FileShareSnapshotCollection.cs new file mode 100644 index 000000000000..6661de1cbc3e --- /dev/null +++ b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/FileShareSnapshotCollection.cs @@ -0,0 +1,497 @@ +// 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.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.Fileshares +{ + /// + /// 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 GetFileShareSnapshots method from an instance of . + /// + public partial class FileShareSnapshotCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _fileShareSnapshotFileSharesClientDiagnostics; + private readonly FileSharesRestOperations _fileShareSnapshotFileSharesRestClient; + + /// Initializes a new instance of the class for mocking. + protected FileShareSnapshotCollection() + { + } + + /// 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 FileShareSnapshotCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _fileShareSnapshotFileSharesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Fileshares", FileShareSnapshotResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(FileShareSnapshotResource.ResourceType, out string fileShareSnapshotFileSharesApiVersion); + _fileShareSnapshotFileSharesRestClient = new FileSharesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, fileShareSnapshotFileSharesApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != FileShareResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, FileShareResource.ResourceType), nameof(id)); + } + + /// + /// Create a FileShareSnapshot. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.FileShares/fileShares/{resourceName}/fileShareSnapshots/{name} + /// + /// + /// Operation Id + /// FileShareSnapshot_CreateOrUpdateFileShareSnapshot + /// + /// + /// Default Api Version + /// 2024-01-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 FileShareSnapshot. + /// Resource create parameters. + /// 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 name, FileShareSnapshotData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _fileShareSnapshotFileSharesClientDiagnostics.CreateScope("FileShareSnapshotCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _fileShareSnapshotFileSharesRestClient.CreateOrUpdateFileShareSnapshotAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, data, cancellationToken).ConfigureAwait(false); + var uri = _fileShareSnapshotFileSharesRestClient.CreateCreateOrUpdateFileShareSnapshotRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, data); + var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + var operation = new FilesharesArmOperation(Response.FromValue(new FileShareSnapshotResource(Client, response), response.GetRawResponse()), rehydrationToken); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Create a FileShareSnapshot. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.FileShares/fileShares/{resourceName}/fileShareSnapshots/{name} + /// + /// + /// Operation Id + /// FileShareSnapshot_CreateOrUpdateFileShareSnapshot + /// + /// + /// Default Api Version + /// 2024-01-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 FileShareSnapshot. + /// Resource create parameters. + /// 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 name, FileShareSnapshotData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _fileShareSnapshotFileSharesClientDiagnostics.CreateScope("FileShareSnapshotCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _fileShareSnapshotFileSharesRestClient.CreateOrUpdateFileShareSnapshot(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, data, cancellationToken); + var uri = _fileShareSnapshotFileSharesRestClient.CreateCreateOrUpdateFileShareSnapshotRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, data); + var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + var operation = new FilesharesArmOperation(Response.FromValue(new FileShareSnapshotResource(Client, response), response.GetRawResponse()), rehydrationToken); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a FileShareSnapshot + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.FileShares/fileShares/{resourceName}/fileShareSnapshots/{name} + /// + /// + /// Operation Id + /// FileShareSnapshot_GetFileShareSnapshot + /// + /// + /// Default Api Version + /// 2024-01-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the FileShareSnapshot. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string name, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = _fileShareSnapshotFileSharesClientDiagnostics.CreateScope("FileShareSnapshotCollection.Get"); + scope.Start(); + try + { + var response = await _fileShareSnapshotFileSharesRestClient.GetFileShareSnapshotAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new FileShareSnapshotResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a FileShareSnapshot + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.FileShares/fileShares/{resourceName}/fileShareSnapshots/{name} + /// + /// + /// Operation Id + /// FileShareSnapshot_GetFileShareSnapshot + /// + /// + /// Default Api Version + /// 2024-01-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the FileShareSnapshot. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string name, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = _fileShareSnapshotFileSharesClientDiagnostics.CreateScope("FileShareSnapshotCollection.Get"); + scope.Start(); + try + { + var response = _fileShareSnapshotFileSharesRestClient.GetFileShareSnapshot(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new FileShareSnapshotResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// List FileShareSnapshot by FileShare. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.FileShares/fileShares/{resourceName}/fileShareSnapshots + /// + /// + /// Operation Id + /// FileShareSnapshot_ListByFileShare + /// + /// + /// Default Api Version + /// 2024-01-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _fileShareSnapshotFileSharesRestClient.CreateListByFileShareRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _fileShareSnapshotFileSharesRestClient.CreateListByFileShareNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new FileShareSnapshotResource(Client, FileShareSnapshotData.DeserializeFileShareSnapshotData(e)), _fileShareSnapshotFileSharesClientDiagnostics, Pipeline, "FileShareSnapshotCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// List FileShareSnapshot by FileShare. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.FileShares/fileShares/{resourceName}/fileShareSnapshots + /// + /// + /// Operation Id + /// FileShareSnapshot_ListByFileShare + /// + /// + /// Default Api Version + /// 2024-01-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _fileShareSnapshotFileSharesRestClient.CreateListByFileShareRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _fileShareSnapshotFileSharesRestClient.CreateListByFileShareNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new FileShareSnapshotResource(Client, FileShareSnapshotData.DeserializeFileShareSnapshotData(e)), _fileShareSnapshotFileSharesClientDiagnostics, Pipeline, "FileShareSnapshotCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.FileShares/fileShares/{resourceName}/fileShareSnapshots/{name} + /// + /// + /// Operation Id + /// FileShareSnapshot_GetFileShareSnapshot + /// + /// + /// Default Api Version + /// 2024-01-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the FileShareSnapshot. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string name, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = _fileShareSnapshotFileSharesClientDiagnostics.CreateScope("FileShareSnapshotCollection.Exists"); + scope.Start(); + try + { + var response = await _fileShareSnapshotFileSharesRestClient.GetFileShareSnapshotAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, 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.FileShares/fileShares/{resourceName}/fileShareSnapshots/{name} + /// + /// + /// Operation Id + /// FileShareSnapshot_GetFileShareSnapshot + /// + /// + /// Default Api Version + /// 2024-01-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the FileShareSnapshot. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string name, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = _fileShareSnapshotFileSharesClientDiagnostics.CreateScope("FileShareSnapshotCollection.Exists"); + scope.Start(); + try + { + var response = _fileShareSnapshotFileSharesRestClient.GetFileShareSnapshot(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.FileShares/fileShares/{resourceName}/fileShareSnapshots/{name} + /// + /// + /// Operation Id + /// FileShareSnapshot_GetFileShareSnapshot + /// + /// + /// Default Api Version + /// 2024-01-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the FileShareSnapshot. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string name, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = _fileShareSnapshotFileSharesClientDiagnostics.CreateScope("FileShareSnapshotCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _fileShareSnapshotFileSharesRestClient.GetFileShareSnapshotAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new FileShareSnapshotResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.FileShares/fileShares/{resourceName}/fileShareSnapshots/{name} + /// + /// + /// Operation Id + /// FileShareSnapshot_GetFileShareSnapshot + /// + /// + /// Default Api Version + /// 2024-01-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the FileShareSnapshot. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string name, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = _fileShareSnapshotFileSharesClientDiagnostics.CreateScope("FileShareSnapshotCollection.GetIfExists"); + scope.Start(); + try + { + var response = _fileShareSnapshotFileSharesRestClient.GetFileShareSnapshot(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new FileShareSnapshotResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/FileShareSnapshotData.Serialization.cs b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/FileShareSnapshotData.Serialization.cs new file mode 100644 index 000000000000..e1d3fb6693f4 --- /dev/null +++ b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/FileShareSnapshotData.Serialization.cs @@ -0,0 +1,155 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Fileshares.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.Fileshares +{ + public partial class FileShareSnapshotData : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(FileShareSnapshotData)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); + } + } + + FileShareSnapshotData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(FileShareSnapshotData)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeFileShareSnapshotData(document.RootElement, options); + } + + internal static FileShareSnapshotData DeserializeFileShareSnapshotData(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + FileShareSnapshotProperties properties = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + SystemData systemData = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = FileShareSnapshotProperties.DeserializeFileShareSnapshotProperties(property.Value, options); + continue; + } + 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 (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new FileShareSnapshotData( + id, + name, + type, + systemData, + properties, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerFilesharesContext.Default); + default: + throw new FormatException($"The model {nameof(FileShareSnapshotData)} does not support writing '{options.Format}' format."); + } + } + + FileShareSnapshotData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeFileShareSnapshotData(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(FileShareSnapshotData)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/FileShareSnapshotData.cs b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/FileShareSnapshotData.cs new file mode 100644 index 000000000000..21129f8560df --- /dev/null +++ b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/FileShareSnapshotData.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.Fileshares.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.Fileshares +{ + /// + /// A class representing the FileShareSnapshot data model. + /// FileShareSnapshot resource + /// + public partial class FileShareSnapshotData : ResourceData + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public FileShareSnapshotData() + { + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The resource-specific properties for this resource. + /// Keeps track of any properties unknown to the library. + internal FileShareSnapshotData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, FileShareSnapshotProperties properties, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + { + Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The resource-specific properties for this resource. + public FileShareSnapshotProperties Properties { get; set; } + } +} diff --git a/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/FileShareSnapshotResource.Serialization.cs b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/FileShareSnapshotResource.Serialization.cs new file mode 100644 index 000000000000..8b96392fc7e8 --- /dev/null +++ b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/FileShareSnapshotResource.Serialization.cs @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Text.Json; + +namespace Azure.ResourceManager.Fileshares +{ + public partial class FileShareSnapshotResource : IJsonModel + { + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); + + FileShareSnapshotData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)Data).Create(ref reader, options); + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options, AzureResourceManagerFilesharesContext.Default); + + FileShareSnapshotData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options, AzureResourceManagerFilesharesContext.Default); + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)Data).GetFormatFromOptions(options); + } +} diff --git a/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/FileShareSnapshotResource.cs b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/FileShareSnapshotResource.cs new file mode 100644 index 000000000000..a963b7fc4102 --- /dev/null +++ b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/FileShareSnapshotResource.cs @@ -0,0 +1,348 @@ +// 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.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Fileshares.Models; + +namespace Azure.ResourceManager.Fileshares +{ + /// + /// A Class representing a FileShareSnapshot 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 GetFileShareSnapshotResource method. + /// Otherwise you can get one from its parent resource using the GetFileShareSnapshot method. + /// + public partial class FileShareSnapshotResource : ArmResource + { + /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The resourceName. + /// The name. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string resourceName, string name) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.FileShares/fileShares/{resourceName}/fileShareSnapshots/{name}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _fileShareSnapshotFileSharesClientDiagnostics; + private readonly FileSharesRestOperations _fileShareSnapshotFileSharesRestClient; + private readonly FileShareSnapshotData _data; + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.FileShares/fileShares/fileShareSnapshots"; + + /// Initializes a new instance of the class for mocking. + protected FileShareSnapshotResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal FileShareSnapshotResource(ArmClient client, FileShareSnapshotData 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 FileShareSnapshotResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _fileShareSnapshotFileSharesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Fileshares", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string fileShareSnapshotFileSharesApiVersion); + _fileShareSnapshotFileSharesRestClient = new FileSharesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, fileShareSnapshotFileSharesApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// 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 FileShareSnapshotData 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 FileShareSnapshot + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.FileShares/fileShares/{resourceName}/fileShareSnapshots/{name} + /// + /// + /// Operation Id + /// FileShareSnapshot_GetFileShareSnapshot + /// + /// + /// Default Api Version + /// 2024-01-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _fileShareSnapshotFileSharesClientDiagnostics.CreateScope("FileShareSnapshotResource.Get"); + scope.Start(); + try + { + var response = await _fileShareSnapshotFileSharesRestClient.GetFileShareSnapshotAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new FileShareSnapshotResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a FileShareSnapshot + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.FileShares/fileShares/{resourceName}/fileShareSnapshots/{name} + /// + /// + /// Operation Id + /// FileShareSnapshot_GetFileShareSnapshot + /// + /// + /// Default Api Version + /// 2024-01-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _fileShareSnapshotFileSharesClientDiagnostics.CreateScope("FileShareSnapshotResource.Get"); + scope.Start(); + try + { + var response = _fileShareSnapshotFileSharesRestClient.GetFileShareSnapshot(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new FileShareSnapshotResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete a FileShareSnapshot. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.FileShares/fileShares/{resourceName}/fileShareSnapshots/{name} + /// + /// + /// Operation Id + /// FileShareSnapshot_DeleteFileShareSnapshot + /// + /// + /// Default Api Version + /// 2024-01-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 = _fileShareSnapshotFileSharesClientDiagnostics.CreateScope("FileShareSnapshotResource.Delete"); + scope.Start(); + try + { + var response = await _fileShareSnapshotFileSharesRestClient.DeleteFileShareSnapshotAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new FilesharesArmOperation(_fileShareSnapshotFileSharesClientDiagnostics, Pipeline, _fileShareSnapshotFileSharesRestClient.CreateDeleteFileShareSnapshotRequest(Id.SubscriptionId, Id.ResourceGroupName, 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 FileShareSnapshot. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.FileShares/fileShares/{resourceName}/fileShareSnapshots/{name} + /// + /// + /// Operation Id + /// FileShareSnapshot_DeleteFileShareSnapshot + /// + /// + /// Default Api Version + /// 2024-01-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 = _fileShareSnapshotFileSharesClientDiagnostics.CreateScope("FileShareSnapshotResource.Delete"); + scope.Start(); + try + { + var response = _fileShareSnapshotFileSharesRestClient.DeleteFileShareSnapshot(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + var operation = new FilesharesArmOperation(_fileShareSnapshotFileSharesClientDiagnostics, Pipeline, _fileShareSnapshotFileSharesRestClient.CreateDeleteFileShareSnapshotRequest(Id.SubscriptionId, Id.ResourceGroupName, 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; + } + } + + /// + /// Update a FileShareSnapshot. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.FileShares/fileShares/{resourceName}/fileShareSnapshots/{name} + /// + /// + /// Operation Id + /// FileShareSnapshot_UpdateFileShareSnapshot + /// + /// + /// Default Api Version + /// 2024-01-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 resource properties to be updated. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, FileShareSnapshotPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(patch, nameof(patch)); + + using var scope = _fileShareSnapshotFileSharesClientDiagnostics.CreateScope("FileShareSnapshotResource.Update"); + scope.Start(); + try + { + var response = await _fileShareSnapshotFileSharesRestClient.UpdateFileShareSnapshotAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, patch, cancellationToken).ConfigureAwait(false); + var operation = new FilesharesArmOperation(new FileShareSnapshotOperationSource(Client), _fileShareSnapshotFileSharesClientDiagnostics, Pipeline, _fileShareSnapshotFileSharesRestClient.CreateUpdateFileShareSnapshotRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, patch).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Update a FileShareSnapshot. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.FileShares/fileShares/{resourceName}/fileShareSnapshots/{name} + /// + /// + /// Operation Id + /// FileShareSnapshot_UpdateFileShareSnapshot + /// + /// + /// Default Api Version + /// 2024-01-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 resource properties to be updated. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, FileShareSnapshotPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(patch, nameof(patch)); + + using var scope = _fileShareSnapshotFileSharesClientDiagnostics.CreateScope("FileShareSnapshotResource.Update"); + scope.Start(); + try + { + var response = _fileShareSnapshotFileSharesRestClient.UpdateFileShareSnapshot(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, patch, cancellationToken); + var operation = new FilesharesArmOperation(new FileShareSnapshotOperationSource(Client), _fileShareSnapshotFileSharesClientDiagnostics, Pipeline, _fileShareSnapshotFileSharesRestClient.CreateUpdateFileShareSnapshotRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, patch).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Internal/Argument.cs b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Internal/Argument.cs new file mode 100644 index 000000000000..3522fc327abc --- /dev/null +++ b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Internal/Argument.cs @@ -0,0 +1,129 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; + +namespace Azure.ResourceManager.Fileshares +{ + internal static class Argument + { + public static void AssertNotNull(T value, string name) + { + if (value is null) + { + throw new ArgumentNullException(name); + } + } + + public static void AssertNotNull(T? value, string name) + where T : struct + { + if (!value.HasValue) + { + throw new ArgumentNullException(name); + } + } + + public static void AssertNotNullOrEmpty(IEnumerable value, string name) + { + if (value is null) + { + throw new ArgumentNullException(name); + } + if (value is ICollection collectionOfT && collectionOfT.Count == 0) + { + throw new ArgumentException("Value cannot be an empty collection.", name); + } + if (value is ICollection collection && collection.Count == 0) + { + throw new ArgumentException("Value cannot be an empty collection.", name); + } + using IEnumerator e = value.GetEnumerator(); + if (!e.MoveNext()) + { + throw new ArgumentException("Value cannot be an empty collection.", name); + } + } + + public static void AssertNotNullOrEmpty(string value, string name) + { + if (value is null) + { + throw new ArgumentNullException(name); + } + if (value.Length == 0) + { + throw new ArgumentException("Value cannot be an empty string.", name); + } + } + + public static void AssertNotNullOrWhiteSpace(string value, string name) + { + if (value is null) + { + throw new ArgumentNullException(name); + } + if (string.IsNullOrWhiteSpace(value)) + { + throw new ArgumentException("Value cannot be empty or contain only white-space characters.", name); + } + } + + public static void AssertNotDefault(ref T value, string name) + where T : struct, IEquatable + { + if (value.Equals(default)) + { + throw new ArgumentException("Value cannot be empty.", name); + } + } + + public static void AssertInRange(T value, T minimum, T maximum, string name) + where T : notnull, IComparable + { + if (minimum.CompareTo(value) > 0) + { + throw new ArgumentOutOfRangeException(name, "Value is less than the minimum allowed."); + } + if (maximum.CompareTo(value) < 0) + { + throw new ArgumentOutOfRangeException(name, "Value is greater than the maximum allowed."); + } + } + + public static void AssertEnumDefined(Type enumType, object value, string name) + { + if (!Enum.IsDefined(enumType, value)) + { + throw new ArgumentException($"Value not defined for {enumType.FullName}.", name); + } + } + + public static T CheckNotNull(T value, string name) + where T : class + { + AssertNotNull(value, name); + return value; + } + + public static string CheckNotNullOrEmpty(string value, string name) + { + AssertNotNullOrEmpty(value, name); + return value; + } + + public static void AssertNull(T value, string name, string message = null) + { + if (value != null) + { + throw new ArgumentException(message ?? "Value must be null.", name); + } + } + } +} diff --git a/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Internal/ChangeTrackingDictionary.cs b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Internal/ChangeTrackingDictionary.cs new file mode 100644 index 000000000000..3ee27bcce9e6 --- /dev/null +++ b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Internal/ChangeTrackingDictionary.cs @@ -0,0 +1,167 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; + +namespace Azure.ResourceManager.Fileshares +{ + internal class ChangeTrackingDictionary : IDictionary, IReadOnlyDictionary where TKey : notnull + { + private IDictionary _innerDictionary; + + public ChangeTrackingDictionary() + { + } + + public ChangeTrackingDictionary(IDictionary dictionary) + { + if (dictionary == null) + { + return; + } + _innerDictionary = new Dictionary(dictionary); + } + + public ChangeTrackingDictionary(IReadOnlyDictionary dictionary) + { + if (dictionary == null) + { + return; + } + _innerDictionary = new Dictionary(); + foreach (var pair in dictionary) + { + _innerDictionary.Add(pair); + } + } + + public bool IsUndefined => _innerDictionary == null; + + public int Count => IsUndefined ? 0 : EnsureDictionary().Count; + + public bool IsReadOnly => IsUndefined ? false : EnsureDictionary().IsReadOnly; + + public ICollection Keys => IsUndefined ? Array.Empty() : EnsureDictionary().Keys; + + public ICollection Values => IsUndefined ? Array.Empty() : EnsureDictionary().Values; + + public TValue this[TKey key] + { + get + { + if (IsUndefined) + { + throw new KeyNotFoundException(nameof(key)); + } + return EnsureDictionary()[key]; + } + set + { + EnsureDictionary()[key] = value; + } + } + + IEnumerable IReadOnlyDictionary.Keys => Keys; + + IEnumerable IReadOnlyDictionary.Values => Values; + + public IEnumerator> GetEnumerator() + { + if (IsUndefined) + { + IEnumerator> enumerateEmpty() + { + yield break; + } + return enumerateEmpty(); + } + return EnsureDictionary().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } + + public void Add(KeyValuePair item) + { + EnsureDictionary().Add(item); + } + + public void Clear() + { + EnsureDictionary().Clear(); + } + + public bool Contains(KeyValuePair item) + { + if (IsUndefined) + { + return false; + } + return EnsureDictionary().Contains(item); + } + + public void CopyTo(KeyValuePair[] array, int index) + { + if (IsUndefined) + { + return; + } + EnsureDictionary().CopyTo(array, index); + } + + public bool Remove(KeyValuePair item) + { + if (IsUndefined) + { + return false; + } + return EnsureDictionary().Remove(item); + } + + public void Add(TKey key, TValue value) + { + EnsureDictionary().Add(key, value); + } + + public bool ContainsKey(TKey key) + { + if (IsUndefined) + { + return false; + } + return EnsureDictionary().ContainsKey(key); + } + + public bool Remove(TKey key) + { + if (IsUndefined) + { + return false; + } + return EnsureDictionary().Remove(key); + } + + public bool TryGetValue(TKey key, out TValue value) + { + if (IsUndefined) + { + value = default; + return false; + } + return EnsureDictionary().TryGetValue(key, out value); + } + + public IDictionary EnsureDictionary() + { + return _innerDictionary ??= new Dictionary(); + } + } +} diff --git a/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Internal/ChangeTrackingList.cs b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Internal/ChangeTrackingList.cs new file mode 100644 index 000000000000..a85545516fb0 --- /dev/null +++ b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Internal/ChangeTrackingList.cs @@ -0,0 +1,153 @@ +// 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.Linq; + +namespace Azure.ResourceManager.Fileshares +{ + internal class ChangeTrackingList : IList, IReadOnlyList + { + private IList _innerList; + + public ChangeTrackingList() + { + } + + public ChangeTrackingList(IList innerList) + { + if (innerList != null) + { + _innerList = innerList; + } + } + + public ChangeTrackingList(IReadOnlyList innerList) + { + if (innerList != null) + { + _innerList = innerList.ToList(); + } + } + + public bool IsUndefined => _innerList == null; + + public int Count => IsUndefined ? 0 : EnsureList().Count; + + public bool IsReadOnly => IsUndefined ? false : EnsureList().IsReadOnly; + + public T this[int index] + { + get + { + if (IsUndefined) + { + throw new ArgumentOutOfRangeException(nameof(index)); + } + return EnsureList()[index]; + } + set + { + if (IsUndefined) + { + throw new ArgumentOutOfRangeException(nameof(index)); + } + EnsureList()[index] = value; + } + } + + public void Reset() + { + _innerList = null; + } + + public IEnumerator GetEnumerator() + { + if (IsUndefined) + { + IEnumerator enumerateEmpty() + { + yield break; + } + return enumerateEmpty(); + } + return EnsureList().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } + + public void Add(T item) + { + EnsureList().Add(item); + } + + public void Clear() + { + EnsureList().Clear(); + } + + public bool Contains(T item) + { + if (IsUndefined) + { + return false; + } + return EnsureList().Contains(item); + } + + public void CopyTo(T[] array, int arrayIndex) + { + if (IsUndefined) + { + return; + } + EnsureList().CopyTo(array, arrayIndex); + } + + public bool Remove(T item) + { + if (IsUndefined) + { + return false; + } + return EnsureList().Remove(item); + } + + public int IndexOf(T item) + { + if (IsUndefined) + { + return -1; + } + return EnsureList().IndexOf(item); + } + + public void Insert(int index, T item) + { + EnsureList().Insert(index, item); + } + + public void RemoveAt(int index) + { + if (IsUndefined) + { + throw new ArgumentOutOfRangeException(nameof(index)); + } + EnsureList().RemoveAt(index); + } + + public IList EnsureList() + { + return _innerList ??= new List(); + } + } +} diff --git a/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Internal/ModelSerializationExtensions.cs b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Internal/ModelSerializationExtensions.cs new file mode 100644 index 000000000000..09df33d4f5cb --- /dev/null +++ b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Internal/ModelSerializationExtensions.cs @@ -0,0 +1,407 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Diagnostics; +using System.Globalization; +using System.Text.Json; +using System.Xml; +using Azure.Core; + +namespace Azure.ResourceManager.Fileshares +{ + internal static class ModelSerializationExtensions + { + internal static readonly JsonDocumentOptions JsonDocumentOptions = new JsonDocumentOptions { MaxDepth = 256 }; + internal static readonly ModelReaderWriterOptions WireOptions = new ModelReaderWriterOptions("W"); + internal static readonly BinaryData SentinelValue = BinaryData.FromBytes("\"__EMPTY__\""u8.ToArray()); + + public static object GetObject(this JsonElement element) + { + switch (element.ValueKind) + { + case JsonValueKind.String: + return element.GetString(); + case JsonValueKind.Number: + if (element.TryGetInt32(out int intValue)) + { + return intValue; + } + if (element.TryGetInt64(out long longValue)) + { + return longValue; + } + return element.GetDouble(); + case JsonValueKind.True: + return true; + case JsonValueKind.False: + return false; + case JsonValueKind.Undefined: + case JsonValueKind.Null: + return null; + case JsonValueKind.Object: + var dictionary = new Dictionary(); + foreach (var jsonProperty in element.EnumerateObject()) + { + dictionary.Add(jsonProperty.Name, jsonProperty.Value.GetObject()); + } + return dictionary; + case JsonValueKind.Array: + var list = new List(); + foreach (var item in element.EnumerateArray()) + { + list.Add(item.GetObject()); + } + return list.ToArray(); + default: + throw new NotSupportedException($"Not supported value kind {element.ValueKind}"); + } + } + + public static byte[] GetBytesFromBase64(this JsonElement element, string format) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + + return format switch + { + "U" => TypeFormatters.FromBase64UrlString(element.GetRequiredString()), + "D" => element.GetBytesFromBase64(), + _ => throw new ArgumentException($"Format is not supported: '{format}'", nameof(format)) + }; + } + + public static DateTimeOffset GetDateTimeOffset(this JsonElement element, string format) => format switch + { + "U" when element.ValueKind == JsonValueKind.Number => DateTimeOffset.FromUnixTimeSeconds(element.GetInt64()), + _ => TypeFormatters.ParseDateTimeOffset(element.GetString(), format) + }; + + public static TimeSpan GetTimeSpan(this JsonElement element, string format) => TypeFormatters.ParseTimeSpan(element.GetString(), format); + + public static char GetChar(this JsonElement element) + { + if (element.ValueKind == JsonValueKind.String) + { + var text = element.GetString(); + if (text == null || text.Length != 1) + { + throw new NotSupportedException($"Cannot convert \"{text}\" to a char"); + } + return text[0]; + } + else + { + throw new NotSupportedException($"Cannot convert {element.ValueKind} to a char"); + } + } + + [Conditional("DEBUG")] + public static void ThrowNonNullablePropertyIsNull(this JsonProperty property) + { + throw new JsonException($"A property '{property.Name}' defined as non-nullable but received as null from the service. This exception only happens in DEBUG builds of the library and would be ignored in the release build"); + } + + public static string GetRequiredString(this JsonElement element) + { + var value = element.GetString(); + if (value == null) + { + throw new InvalidOperationException($"The requested operation requires an element of type 'String', but the target element has type '{element.ValueKind}'."); + } + return value; + } + + public static void WriteStringValue(this Utf8JsonWriter writer, DateTimeOffset value, string format) + { + writer.WriteStringValue(TypeFormatters.ToString(value, format)); + } + + public static void WriteStringValue(this Utf8JsonWriter writer, DateTime value, string format) + { + writer.WriteStringValue(TypeFormatters.ToString(value, format)); + } + + public static void WriteStringValue(this Utf8JsonWriter writer, TimeSpan value, string format) + { + writer.WriteStringValue(TypeFormatters.ToString(value, format)); + } + + public static void WriteStringValue(this Utf8JsonWriter writer, char value) + { + writer.WriteStringValue(value.ToString(CultureInfo.InvariantCulture)); + } + + public static void WriteBase64StringValue(this Utf8JsonWriter writer, byte[] value, string format) + { + if (value == null) + { + writer.WriteNullValue(); + return; + } + switch (format) + { + case "U": + writer.WriteStringValue(TypeFormatters.ToBase64UrlString(value)); + break; + case "D": + writer.WriteBase64StringValue(value); + break; + default: + throw new ArgumentException($"Format is not supported: '{format}'", nameof(format)); + } + } + + public static void WriteNumberValue(this Utf8JsonWriter writer, DateTimeOffset value, string format) + { + if (format != "U") + { + throw new ArgumentOutOfRangeException(nameof(format), "Only 'U' format is supported when writing a DateTimeOffset as a Number."); + } + writer.WriteNumberValue(value.ToUnixTimeSeconds()); + } + + public static void WriteObjectValue(this Utf8JsonWriter writer, T value, ModelReaderWriterOptions options = null) + { + switch (value) + { + case null: + writer.WriteNullValue(); + break; + case IJsonModel jsonModel: + jsonModel.Write(writer, options ?? WireOptions); + break; + case IUtf8JsonSerializable serializable: + serializable.Write(writer); + break; + case byte[] bytes: + writer.WriteBase64StringValue(bytes); + break; + case BinaryData bytes0: + writer.WriteBase64StringValue(bytes0); + break; + case JsonElement json: + json.WriteTo(writer); + break; + case int i: + writer.WriteNumberValue(i); + break; + case decimal d: + writer.WriteNumberValue(d); + break; + case double d0: + if (double.IsNaN(d0)) + { + writer.WriteStringValue("NaN"); + } + else + { + writer.WriteNumberValue(d0); + } + break; + case float f: + writer.WriteNumberValue(f); + break; + case long l: + writer.WriteNumberValue(l); + break; + case string s: + writer.WriteStringValue(s); + break; + case bool b: + writer.WriteBooleanValue(b); + break; + case Guid g: + writer.WriteStringValue(g); + break; + case DateTimeOffset dateTimeOffset: + writer.WriteStringValue(dateTimeOffset, "O"); + break; + case DateTime dateTime: + writer.WriteStringValue(dateTime, "O"); + break; + case IEnumerable> enumerable: + writer.WriteStartObject(); + foreach (var pair in enumerable) + { + writer.WritePropertyName(pair.Key); + writer.WriteObjectValue(pair.Value, options); + } + writer.WriteEndObject(); + break; + case IEnumerable objectEnumerable: + writer.WriteStartArray(); + foreach (var item in objectEnumerable) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + break; + case TimeSpan timeSpan: + writer.WriteStringValue(timeSpan, "P"); + break; + default: + throw new NotSupportedException($"Not supported type {value.GetType()}"); + } + } + + public static void WriteObjectValue(this Utf8JsonWriter writer, object value, ModelReaderWriterOptions options = null) + { + writer.WriteObjectValue(value, options); + } + + internal static bool IsSentinelValue(BinaryData value) + { + ReadOnlySpan sentinelSpan = SentinelValue.ToMemory().Span; + ReadOnlySpan valueSpan = value.ToMemory().Span; + return sentinelSpan.SequenceEqual(valueSpan); + } + + internal static class TypeFormatters + { + private const string RoundtripZFormat = "yyyy-MM-ddTHH:mm:ss.fffffffZ"; + public const string DefaultNumberFormat = "G"; + + public static string ToString(bool value) => value ? "true" : "false"; + + public static string ToString(DateTime value, string format) => value.Kind switch + { + DateTimeKind.Utc => ToString((DateTimeOffset)value, format), + _ => throw new NotSupportedException($"DateTime {value} has a Kind of {value.Kind}. Azure SDK requires it to be UTC. You can call DateTime.SpecifyKind to change Kind property value to DateTimeKind.Utc.") + }; + + public static string ToString(DateTimeOffset value, string format) => format switch + { + "D" => value.ToString("yyyy-MM-dd", CultureInfo.InvariantCulture), + "U" => value.ToUnixTimeSeconds().ToString(CultureInfo.InvariantCulture), + "O" => value.ToUniversalTime().ToString(RoundtripZFormat, CultureInfo.InvariantCulture), + "o" => value.ToUniversalTime().ToString(RoundtripZFormat, CultureInfo.InvariantCulture), + "R" => value.ToString("r", CultureInfo.InvariantCulture), + _ => value.ToString(format, CultureInfo.InvariantCulture) + }; + + public static string ToString(TimeSpan value, string format) => format switch + { + "P" => XmlConvert.ToString(value), + _ => value.ToString(format, CultureInfo.InvariantCulture) + }; + + public static string ToString(byte[] value, string format) => format switch + { + "U" => ToBase64UrlString(value), + "D" => Convert.ToBase64String(value), + _ => throw new ArgumentException($"Format is not supported: '{format}'", nameof(format)) + }; + + public static string ToBase64UrlString(byte[] value) + { + int numWholeOrPartialInputBlocks = checked(value.Length + 2) / 3; + int size = checked(numWholeOrPartialInputBlocks * 4); + char[] output = new char[size]; + + int numBase64Chars = Convert.ToBase64CharArray(value, 0, value.Length, output, 0); + + int i = 0; + for (; i < numBase64Chars; i++) + { + char ch = output[i]; + if (ch == '+') + { + output[i] = '-'; + } + else + { + if (ch == '/') + { + output[i] = '_'; + } + else + { + if (ch == '=') + { + break; + } + } + } + } + + return new string(output, 0, i); + } + + public static byte[] FromBase64UrlString(string value) + { + int paddingCharsToAdd = (value.Length % 4) switch + { + 0 => 0, + 2 => 2, + 3 => 1, + _ => throw new InvalidOperationException("Malformed input") + }; + char[] output = new char[(value.Length + paddingCharsToAdd)]; + int i = 0; + for (; i < value.Length; i++) + { + char ch = value[i]; + if (ch == '-') + { + output[i] = '+'; + } + else + { + if (ch == '_') + { + output[i] = '/'; + } + else + { + output[i] = ch; + } + } + } + + for (; i < output.Length; i++) + { + output[i] = '='; + } + + return Convert.FromBase64CharArray(output, 0, output.Length); + } + + public static DateTimeOffset ParseDateTimeOffset(string value, string format) => format switch + { + "U" => DateTimeOffset.FromUnixTimeSeconds(long.Parse(value, CultureInfo.InvariantCulture)), + _ => DateTimeOffset.Parse(value, CultureInfo.InvariantCulture, DateTimeStyles.AssumeUniversal) + }; + + public static TimeSpan ParseTimeSpan(string value, string format) => format switch + { + "P" => XmlConvert.ToTimeSpan(value), + _ => TimeSpan.ParseExact(value, format, CultureInfo.InvariantCulture) + }; + + public static string ConvertToString(object value, string format = null) => value switch + { + null => "null", + string s => s, + bool b => ToString(b), + int or float or double or long or decimal => ((IFormattable)value).ToString(DefaultNumberFormat, CultureInfo.InvariantCulture), + byte[] b0 when format != null => ToString(b0, format), + IEnumerable s0 => string.Join(",", s0), + DateTimeOffset dateTime when format != null => ToString(dateTime, format), + TimeSpan timeSpan when format != null => ToString(timeSpan, format), + TimeSpan timeSpan0 => XmlConvert.ToString(timeSpan0), + Guid guid => guid.ToString(), + BinaryData binaryData => ConvertToString(binaryData.ToArray(), format), + _ => value.ToString() + }; + } + } +} diff --git a/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Internal/Optional.cs b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Internal/Optional.cs new file mode 100644 index 000000000000..8b9703f693dd --- /dev/null +++ b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Internal/Optional.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; + +namespace Azure.ResourceManager.Fileshares +{ + internal static class Optional + { + public static bool IsCollectionDefined(IEnumerable collection) + { + return !(collection is ChangeTrackingList changeTrackingList && changeTrackingList.IsUndefined); + } + + public static bool IsCollectionDefined(IDictionary collection) + { + return !(collection is ChangeTrackingDictionary changeTrackingDictionary && changeTrackingDictionary.IsUndefined); + } + + public static bool IsCollectionDefined(IReadOnlyDictionary collection) + { + return !(collection is ChangeTrackingDictionary changeTrackingDictionary && changeTrackingDictionary.IsUndefined); + } + + public static bool IsDefined(T? value) + where T : struct + { + return value.HasValue; + } + + public static bool IsDefined(object value) + { + return value != null; + } + + public static bool IsDefined(JsonElement value) + { + return value.ValueKind != JsonValueKind.Undefined; + } + + public static bool IsDefined(string value) + { + return value != null; + } + } +} diff --git a/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Internal/Utf8JsonRequestContent.cs b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Internal/Utf8JsonRequestContent.cs new file mode 100644 index 000000000000..0fefb9688ade --- /dev/null +++ b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Internal/Utf8JsonRequestContent.cs @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.IO; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; + +namespace Azure.ResourceManager.Fileshares +{ + internal class Utf8JsonRequestContent : RequestContent + { + private readonly MemoryStream _stream; + private readonly RequestContent _content; + + public Utf8JsonRequestContent() + { + _stream = new MemoryStream(); + _content = Create(_stream); + JsonWriter = new Utf8JsonWriter(_stream); + } + + public Utf8JsonWriter JsonWriter { get; } + + public override async Task WriteToAsync(Stream stream, CancellationToken cancellationToken = default) + { + await JsonWriter.FlushAsync().ConfigureAwait(false); + await _content.WriteToAsync(stream, cancellationToken).ConfigureAwait(false); + } + + public override void WriteTo(Stream stream, CancellationToken cancellationToken = default) + { + JsonWriter.Flush(); + _content.WriteTo(stream, cancellationToken); + } + + public override bool TryComputeLength(out long length) + { + length = JsonWriter.BytesCommitted + JsonWriter.BytesPending; + return true; + } + + public override void Dispose() + { + JsonWriter.Dispose(); + _content.Dispose(); + _stream.Dispose(); + } + } +} diff --git a/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/LongRunningOperation/FileShareOperationSource.cs b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/LongRunningOperation/FileShareOperationSource.cs new file mode 100644 index 000000000000..77e92cc06253 --- /dev/null +++ b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/LongRunningOperation/FileShareOperationSource.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.ClientModel.Primitives; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; + +namespace Azure.ResourceManager.Fileshares +{ + internal class FileShareOperationSource : IOperationSource + { + private readonly ArmClient _client; + + internal FileShareOperationSource(ArmClient client) + { + _client = client; + } + + FileShareResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + var data = ModelReaderWriter.Read(response.Content, ModelReaderWriterOptions.Json, AzureResourceManagerFilesharesContext.Default); + return new FileShareResource(_client, data); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + var data = ModelReaderWriter.Read(response.Content, ModelReaderWriterOptions.Json, AzureResourceManagerFilesharesContext.Default); + return await Task.FromResult(new FileShareResource(_client, data)).ConfigureAwait(false); + } + } +} diff --git a/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/LongRunningOperation/FileShareSnapshotOperationSource.cs b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/LongRunningOperation/FileShareSnapshotOperationSource.cs new file mode 100644 index 000000000000..5906f6cf1599 --- /dev/null +++ b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/LongRunningOperation/FileShareSnapshotOperationSource.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.ClientModel.Primitives; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; + +namespace Azure.ResourceManager.Fileshares +{ + internal class FileShareSnapshotOperationSource : IOperationSource + { + private readonly ArmClient _client; + + internal FileShareSnapshotOperationSource(ArmClient client) + { + _client = client; + } + + FileShareSnapshotResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + var data = ModelReaderWriter.Read(response.Content, ModelReaderWriterOptions.Json, AzureResourceManagerFilesharesContext.Default); + return new FileShareSnapshotResource(_client, data); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + var data = ModelReaderWriter.Read(response.Content, ModelReaderWriterOptions.Json, AzureResourceManagerFilesharesContext.Default); + return await Task.FromResult(new FileShareSnapshotResource(_client, data)).ConfigureAwait(false); + } + } +} diff --git a/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/LongRunningOperation/FilesharesArmOperation.cs b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/LongRunningOperation/FilesharesArmOperation.cs new file mode 100644 index 000000000000..cd9c190d2e9b --- /dev/null +++ b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/LongRunningOperation/FilesharesArmOperation.cs @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.Fileshares +{ +#pragma warning disable SA1649 // File name should match first type name + internal class FilesharesArmOperation : ArmOperation +#pragma warning restore SA1649 // File name should match first type name + { + private readonly OperationInternal _operation; + private readonly RehydrationToken? _completeRehydrationToken; + private readonly NextLinkOperationImplementation _nextLinkOperation; + private readonly string _operationId; + + /// Initializes a new instance of FilesharesArmOperation for mocking. + protected FilesharesArmOperation() + { + } + + internal FilesharesArmOperation(Response response, RehydrationToken? rehydrationToken = null) + { + _operation = OperationInternal.Succeeded(response); + _completeRehydrationToken = rehydrationToken; + _operationId = GetOperationId(rehydrationToken); + } + + internal FilesharesArmOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response, OperationFinalStateVia finalStateVia, bool skipApiVersionOverride = false, string apiVersionOverrideValue = null) + { + var nextLinkOperation = NextLinkOperationImplementation.Create(pipeline, request.Method, request.Uri.ToUri(), response, finalStateVia, skipApiVersionOverride, apiVersionOverrideValue); + if (nextLinkOperation is NextLinkOperationImplementation nextLinkOperationValue) + { + _nextLinkOperation = nextLinkOperationValue; + _operationId = _nextLinkOperation.OperationId; + } + else + { + _completeRehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(request.Method, request.Uri.ToUri(), response, finalStateVia); + _operationId = GetOperationId(_completeRehydrationToken); + } + _operation = new OperationInternal(nextLinkOperation, clientDiagnostics, response, "FilesharesArmOperation", fallbackStrategy: new SequentialDelayStrategy()); + } + + private string GetOperationId(RehydrationToken? rehydrationToken) + { + if (rehydrationToken is null) + { + return null; + } + var lroDetails = ModelReaderWriter.Write(rehydrationToken, ModelReaderWriterOptions.Json, AzureResourceManagerFilesharesContext.Default).ToObjectFromJson>(); + return lroDetails["id"]; + } + /// + public override string Id => _operationId ?? NextLinkOperationImplementation.NotSet; + + /// + public override RehydrationToken? GetRehydrationToken() => _nextLinkOperation?.GetRehydrationToken() ?? _completeRehydrationToken; + + /// + public override bool HasCompleted => _operation.HasCompleted; + + /// + public override Response GetRawResponse() => _operation.RawResponse; + + /// + public override Response UpdateStatus(CancellationToken cancellationToken = default) => _operation.UpdateStatus(cancellationToken); + + /// + public override ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) => _operation.UpdateStatusAsync(cancellationToken); + + /// + public override Response WaitForCompletionResponse(CancellationToken cancellationToken = default) => _operation.WaitForCompletionResponse(cancellationToken); + + /// + public override Response WaitForCompletionResponse(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionResponse(pollingInterval, cancellationToken); + + /// + public override ValueTask WaitForCompletionResponseAsync(CancellationToken cancellationToken = default) => _operation.WaitForCompletionResponseAsync(cancellationToken); + + /// + public override ValueTask WaitForCompletionResponseAsync(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionResponseAsync(pollingInterval, cancellationToken); + } +} diff --git a/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/LongRunningOperation/FilesharesArmOperationOfT.cs b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/LongRunningOperation/FilesharesArmOperationOfT.cs new file mode 100644 index 000000000000..22a8214fbbae --- /dev/null +++ b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/LongRunningOperation/FilesharesArmOperationOfT.cs @@ -0,0 +1,100 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.Fileshares +{ +#pragma warning disable SA1649 // File name should match first type name + internal class FilesharesArmOperation : ArmOperation +#pragma warning restore SA1649 // File name should match first type name + { + private readonly OperationInternal _operation; + private readonly RehydrationToken? _completeRehydrationToken; + private readonly NextLinkOperationImplementation _nextLinkOperation; + private readonly string _operationId; + + /// Initializes a new instance of FilesharesArmOperation for mocking. + protected FilesharesArmOperation() + { + } + + internal FilesharesArmOperation(Response response, RehydrationToken? rehydrationToken = null) + { + _operation = OperationInternal.Succeeded(response.GetRawResponse(), response.Value); + _completeRehydrationToken = rehydrationToken; + _operationId = GetOperationId(rehydrationToken); + } + + internal FilesharesArmOperation(IOperationSource source, ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response, OperationFinalStateVia finalStateVia, bool skipApiVersionOverride = false, string apiVersionOverrideValue = null) + { + var nextLinkOperation = NextLinkOperationImplementation.Create(pipeline, request.Method, request.Uri.ToUri(), response, finalStateVia, skipApiVersionOverride, apiVersionOverrideValue); + if (nextLinkOperation is NextLinkOperationImplementation nextLinkOperationValue) + { + _nextLinkOperation = nextLinkOperationValue; + _operationId = _nextLinkOperation.OperationId; + } + else + { + _completeRehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(request.Method, request.Uri.ToUri(), response, finalStateVia); + _operationId = GetOperationId(_completeRehydrationToken); + } + _operation = new OperationInternal(NextLinkOperationImplementation.Create(source, nextLinkOperation), clientDiagnostics, response, "FilesharesArmOperation", fallbackStrategy: new SequentialDelayStrategy()); + } + + private string GetOperationId(RehydrationToken? rehydrationToken) + { + if (rehydrationToken is null) + { + return null; + } + var lroDetails = ModelReaderWriter.Write(rehydrationToken, ModelReaderWriterOptions.Json, AzureResourceManagerFilesharesContext.Default).ToObjectFromJson>(); + return lroDetails["id"]; + } + /// + public override string Id => _operationId ?? NextLinkOperationImplementation.NotSet; + + /// + public override RehydrationToken? GetRehydrationToken() => _nextLinkOperation?.GetRehydrationToken() ?? _completeRehydrationToken; + + /// + public override T Value => _operation.Value; + + /// + public override bool HasValue => _operation.HasValue; + + /// + public override bool HasCompleted => _operation.HasCompleted; + + /// + public override Response GetRawResponse() => _operation.RawResponse; + + /// + public override Response UpdateStatus(CancellationToken cancellationToken = default) => _operation.UpdateStatus(cancellationToken); + + /// + public override ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) => _operation.UpdateStatusAsync(cancellationToken); + + /// + public override Response WaitForCompletion(CancellationToken cancellationToken = default) => _operation.WaitForCompletion(cancellationToken); + + /// + public override Response WaitForCompletion(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletion(pollingInterval, cancellationToken); + + /// + public override ValueTask> WaitForCompletionAsync(CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(cancellationToken); + + /// + public override ValueTask> WaitForCompletionAsync(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(pollingInterval, cancellationToken); + } +} diff --git a/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Models/ActionType.cs b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Models/ActionType.cs new file mode 100644 index 000000000000..53bc6ce07f01 --- /dev/null +++ b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Models/ActionType.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.Fileshares.Models +{ + /// Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + public readonly partial struct ActionType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public ActionType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string InternalValue = "Internal"; + + /// Actions are for internal-only APIs. + public static ActionType Internal { get; } = new ActionType(InternalValue); + /// Determines if two values are the same. + public static bool operator ==(ActionType left, ActionType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ActionType left, ActionType right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator ActionType(string value) => new ActionType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ActionType other && Equals(other); + /// + public bool Equals(ActionType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Models/AzureResourceManagerFilesharesContext.cs b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Models/AzureResourceManagerFilesharesContext.cs new file mode 100644 index 000000000000..d45a28e45db3 --- /dev/null +++ b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Models/AzureResourceManagerFilesharesContext.cs @@ -0,0 +1,19 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.ClientModel.Primitives; + +namespace Azure.ResourceManager.Fileshares +{ + /// + /// Context class which will be filled in by the System.ClientModel.SourceGeneration. + /// For more information see 'https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/core/System.ClientModel/src/docs/ModelReaderWriterContext.md' + /// + public partial class AzureResourceManagerFilesharesContext : ModelReaderWriterContext + { + } +} diff --git a/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Models/CheckNameAvailabilityContent.Serialization.cs b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Models/CheckNameAvailabilityContent.Serialization.cs new file mode 100644 index 000000000000..bdcf21e8d0f0 --- /dev/null +++ b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Models/CheckNameAvailabilityContent.Serialization.cs @@ -0,0 +1,140 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Fileshares.Models +{ + public partial class CheckNameAvailabilityContent : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CheckNameAvailabilityContent)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (Optional.IsDefined(Type)) + { + writer.WritePropertyName("type"u8); + writer.WriteStringValue(Type); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + CheckNameAvailabilityContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CheckNameAvailabilityContent)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeCheckNameAvailabilityContent(document.RootElement, options); + } + + internal static CheckNameAvailabilityContent DeserializeCheckNameAvailabilityContent(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string name = default; + string type = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new CheckNameAvailabilityContent(name, type, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerFilesharesContext.Default); + default: + throw new FormatException($"The model {nameof(CheckNameAvailabilityContent)} does not support writing '{options.Format}' format."); + } + } + + CheckNameAvailabilityContent IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeCheckNameAvailabilityContent(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(CheckNameAvailabilityContent)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Models/CheckNameAvailabilityContent.cs b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Models/CheckNameAvailabilityContent.cs new file mode 100644 index 000000000000..cd8e53ea0f40 --- /dev/null +++ b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Models/CheckNameAvailabilityContent.cs @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.Fileshares.Models +{ + /// The check availability request body. + public partial class CheckNameAvailabilityContent + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public CheckNameAvailabilityContent() + { + } + + /// Initializes a new instance of . + /// The name of the resource for which availability needs to be checked. + /// The resource type. + /// Keeps track of any properties unknown to the library. + internal CheckNameAvailabilityContent(string name, string type, IDictionary serializedAdditionalRawData) + { + Name = name; + Type = type; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The name of the resource for which availability needs to be checked. + public string Name { get; set; } + /// The resource type. + public string Type { get; set; } + } +} diff --git a/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Models/CheckNameAvailabilityReason.cs b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Models/CheckNameAvailabilityReason.cs new file mode 100644 index 000000000000..b8464becd146 --- /dev/null +++ b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Models/CheckNameAvailabilityReason.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.Fileshares.Models +{ + /// Possible reasons for a name not being available. + public readonly partial struct CheckNameAvailabilityReason : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public CheckNameAvailabilityReason(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string InvalidValue = "Invalid"; + private const string AlreadyExistsValue = "AlreadyExists"; + + /// Name is invalid. + public static CheckNameAvailabilityReason Invalid { get; } = new CheckNameAvailabilityReason(InvalidValue); + /// Name already exists. + public static CheckNameAvailabilityReason AlreadyExists { get; } = new CheckNameAvailabilityReason(AlreadyExistsValue); + /// Determines if two values are the same. + public static bool operator ==(CheckNameAvailabilityReason left, CheckNameAvailabilityReason right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(CheckNameAvailabilityReason left, CheckNameAvailabilityReason right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator CheckNameAvailabilityReason(string value) => new CheckNameAvailabilityReason(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is CheckNameAvailabilityReason other && Equals(other); + /// + public bool Equals(CheckNameAvailabilityReason other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Models/CheckNameAvailabilityResult.Serialization.cs b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Models/CheckNameAvailabilityResult.Serialization.cs new file mode 100644 index 000000000000..b25c16047d22 --- /dev/null +++ b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Models/CheckNameAvailabilityResult.Serialization.cs @@ -0,0 +1,159 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Fileshares.Models +{ + public partial class CheckNameAvailabilityResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CheckNameAvailabilityResult)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(NameAvailable)) + { + writer.WritePropertyName("nameAvailable"u8); + writer.WriteBooleanValue(NameAvailable.Value); + } + if (Optional.IsDefined(Reason)) + { + writer.WritePropertyName("reason"u8); + writer.WriteStringValue(Reason.Value.ToString()); + } + if (Optional.IsDefined(Message)) + { + writer.WritePropertyName("message"u8); + writer.WriteStringValue(Message); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + CheckNameAvailabilityResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CheckNameAvailabilityResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeCheckNameAvailabilityResult(document.RootElement, options); + } + + internal static CheckNameAvailabilityResult DeserializeCheckNameAvailabilityResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + bool? nameAvailable = default; + CheckNameAvailabilityReason? reason = default; + string message = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("nameAvailable"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nameAvailable = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("reason"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + reason = new CheckNameAvailabilityReason(property.Value.GetString()); + continue; + } + if (property.NameEquals("message"u8)) + { + message = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new CheckNameAvailabilityResult(nameAvailable, reason, message, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerFilesharesContext.Default); + default: + throw new FormatException($"The model {nameof(CheckNameAvailabilityResult)} does not support writing '{options.Format}' format."); + } + } + + CheckNameAvailabilityResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeCheckNameAvailabilityResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(CheckNameAvailabilityResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Models/CheckNameAvailabilityResult.cs b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Models/CheckNameAvailabilityResult.cs new file mode 100644 index 000000000000..e7c288be26e9 --- /dev/null +++ b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Models/CheckNameAvailabilityResult.cs @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.Fileshares.Models +{ + /// The check availability result. + public partial class CheckNameAvailabilityResult + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + internal CheckNameAvailabilityResult() + { + } + + /// Initializes a new instance of . + /// Indicates if the resource name is available. + /// The reason why the given name is not available. + /// Detailed reason why the given name is not available. + /// Keeps track of any properties unknown to the library. + internal CheckNameAvailabilityResult(bool? nameAvailable, CheckNameAvailabilityReason? reason, string message, IDictionary serializedAdditionalRawData) + { + NameAvailable = nameAvailable; + Reason = reason; + Message = message; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Indicates if the resource name is available. + public bool? NameAvailable { get; } + /// The reason why the given name is not available. + public CheckNameAvailabilityReason? Reason { get; } + /// Detailed reason why the given name is not available. + public string Message { get; } + } +} diff --git a/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Models/FileShareListResult.Serialization.cs b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Models/FileShareListResult.Serialization.cs new file mode 100644 index 000000000000..5b52f0f08c2e --- /dev/null +++ b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Models/FileShareListResult.Serialization.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Fileshares.Models +{ + internal partial class FileShareListResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(FileShareListResult)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink.AbsoluteUri); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + FileShareListResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(FileShareListResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeFileShareListResult(document.RootElement, options); + } + + internal static FileShareListResult DeserializeFileShareListResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList value = default; + Uri nextLink = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(FileShareData.DeserializeFileShareData(item, options)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = new Uri(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new FileShareListResult(value, nextLink, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerFilesharesContext.Default); + default: + throw new FormatException($"The model {nameof(FileShareListResult)} does not support writing '{options.Format}' format."); + } + } + + FileShareListResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeFileShareListResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(FileShareListResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Models/FileShareListResult.cs b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Models/FileShareListResult.cs new file mode 100644 index 000000000000..1dd48bd056db --- /dev/null +++ b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Models/FileShareListResult.cs @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.ResourceManager.Fileshares.Models +{ + /// The response of a FileShare list operation. + internal partial class FileShareListResult + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The FileShare items on this page. + /// is null. + internal FileShareListResult(IEnumerable value) + { + Argument.AssertNotNull(value, nameof(value)); + + Value = value.ToList(); + } + + /// Initializes a new instance of . + /// The FileShare items on this page. + /// The link to the next page of items. + /// Keeps track of any properties unknown to the library. + internal FileShareListResult(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) + { + Value = value; + NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal FileShareListResult() + { + } + + /// The FileShare items on this page. + public IReadOnlyList Value { get; } + /// The link to the next page of items. + public Uri NextLink { get; } + } +} diff --git a/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Models/FileSharePatch.Serialization.cs b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Models/FileSharePatch.Serialization.cs new file mode 100644 index 000000000000..1c613cd56c6f --- /dev/null +++ b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Models/FileSharePatch.Serialization.cs @@ -0,0 +1,159 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Fileshares.Models +{ + public partial class FileSharePatch : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(FileSharePatch)} does not support writing '{format}' format."); + } + + if (Optional.IsCollectionDefined(Tags)) + { + writer.WritePropertyName("tags"u8); + writer.WriteStartObject(); + foreach (var item in Tags) + { + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + FileSharePatch IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(FileSharePatch)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeFileSharePatch(document.RootElement, options); + } + + internal static FileSharePatch DeserializeFileSharePatch(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IDictionary tags = default; + FileShareUpdateProperties properties = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("tags"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = FileShareUpdateProperties.DeserializeFileShareUpdateProperties(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new FileSharePatch(tags ?? new ChangeTrackingDictionary(), properties, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerFilesharesContext.Default); + default: + throw new FormatException($"The model {nameof(FileSharePatch)} does not support writing '{options.Format}' format."); + } + } + + FileSharePatch IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeFileSharePatch(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(FileSharePatch)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Models/FileSharePatch.cs b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Models/FileSharePatch.cs new file mode 100644 index 000000000000..bfd9841e0ff2 --- /dev/null +++ b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Models/FileSharePatch.cs @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.Fileshares.Models +{ + /// The type used for update operations of the FileShare. + public partial class FileSharePatch + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public FileSharePatch() + { + Tags = new ChangeTrackingDictionary(); + } + + /// Initializes a new instance of . + /// Resource tags. + /// The resource-specific properties for this resource. + /// Keeps track of any properties unknown to the library. + internal FileSharePatch(IDictionary tags, FileShareUpdateProperties properties, IDictionary serializedAdditionalRawData) + { + Tags = tags; + Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Resource tags. + public IDictionary Tags { get; } + /// The resource-specific properties for this resource. + public FileShareUpdateProperties Properties { get; set; } + } +} diff --git a/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Models/FileShareProperties.Serialization.cs b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Models/FileShareProperties.Serialization.cs new file mode 100644 index 000000000000..c0978fa83c42 --- /dev/null +++ b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Models/FileShareProperties.Serialization.cs @@ -0,0 +1,409 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Fileshares.Models +{ + public partial class FileShareProperties : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(FileShareProperties)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(MountName)) + { + writer.WritePropertyName("mountName"u8); + writer.WriteStringValue(MountName); + } + if (options.Format != "W" && Optional.IsDefined(HostName)) + { + writer.WritePropertyName("hostName"u8); + writer.WriteStringValue(HostName); + } + if (Optional.IsDefined(MediaTier)) + { + writer.WritePropertyName("mediaTier"u8); + writer.WriteStringValue(MediaTier.Value.ToSerialString()); + } + if (Optional.IsDefined(Redundancy)) + { + writer.WritePropertyName("redundancy"u8); + writer.WriteStringValue(Redundancy.Value.ToSerialString()); + } + if (Optional.IsDefined(Protocol)) + { + writer.WritePropertyName("protocol"u8); + writer.WriteStringValue(Protocol.Value.ToSerialString()); + } + if (Optional.IsDefined(ProvisionedStorageGiB)) + { + writer.WritePropertyName("provisionedStorageGiB"u8); + writer.WriteNumberValue(ProvisionedStorageGiB.Value); + } + if (options.Format != "W" && Optional.IsDefined(ProvisionedStorageNextAllowedDowngrade)) + { + writer.WritePropertyName("provisionedStorageNextAllowedDowngrade"u8); + writer.WriteStringValue(ProvisionedStorageNextAllowedDowngrade.Value, "O"); + } + if (Optional.IsDefined(ProvisionedIOPerSec)) + { + writer.WritePropertyName("provisionedIOPerSec"u8); + writer.WriteNumberValue(ProvisionedIOPerSec.Value); + } + if (options.Format != "W" && Optional.IsDefined(ProvisionedIOPerSecNextAllowedDowngrade)) + { + writer.WritePropertyName("provisionedIOPerSecNextAllowedDowngrade"u8); + writer.WriteStringValue(ProvisionedIOPerSecNextAllowedDowngrade.Value, "O"); + } + if (Optional.IsDefined(ProvisionedThroughputMiBPerSec)) + { + writer.WritePropertyName("provisionedThroughputMiBPerSec"u8); + writer.WriteNumberValue(ProvisionedThroughputMiBPerSec.Value); + } + if (options.Format != "W" && Optional.IsDefined(ProvisionedThroughputNextAllowedDowngrade)) + { + writer.WritePropertyName("provisionedThroughputNextAllowedDowngrade"u8); + writer.WriteStringValue(ProvisionedThroughputNextAllowedDowngrade.Value, "O"); + } + if (options.Format != "W" && Optional.IsDefined(IncludedBurstIOPerSec)) + { + writer.WritePropertyName("includedBurstIOPerSec"u8); + writer.WriteNumberValue(IncludedBurstIOPerSec.Value); + } + if (options.Format != "W" && Optional.IsDefined(MaxBurstIOPerSecCredits)) + { + writer.WritePropertyName("maxBurstIOPerSecCredits"u8); + writer.WriteNumberValue(MaxBurstIOPerSecCredits.Value); + } + if (Optional.IsDefined(NfsProtocolProperties)) + { + writer.WritePropertyName("nfsProtocolProperties"u8); + writer.WriteObjectValue(NfsProtocolProperties, options); + } + if (Optional.IsDefined(PublicAccessProperties)) + { + writer.WritePropertyName("publicAccessProperties"u8); + writer.WriteObjectValue(PublicAccessProperties, options); + } + if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState.Value.ToString()); + } + if (Optional.IsDefined(PublicNetworkAccess)) + { + writer.WritePropertyName("publicNetworkAccess"u8); + writer.WriteStringValue(PublicNetworkAccess.Value.ToString()); + } + if (options.Format != "W" && Optional.IsCollectionDefined(PrivateEndpointConnections)) + { + writer.WritePropertyName("privateEndpointConnections"u8); + writer.WriteStartArray(); + foreach (var item in PrivateEndpointConnections) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + FileShareProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(FileShareProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeFileShareProperties(document.RootElement, options); + } + + internal static FileShareProperties DeserializeFileShareProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string mountName = default; + string hostName = default; + MediaTier? mediaTier = default; + Redundancy? redundancy = default; + Protocol? protocol = default; + int? provisionedStorageGiB = default; + DateTimeOffset? provisionedStorageNextAllowedDowngrade = default; + int? provisionedIOPerSec = default; + DateTimeOffset? provisionedIOPerSecNextAllowedDowngrade = default; + int? provisionedThroughputMiBPerSec = default; + DateTimeOffset? provisionedThroughputNextAllowedDowngrade = default; + int? includedBurstIOPerSec = default; + long? maxBurstIOPerSecCredits = default; + NfsProtocolProperties nfsProtocolProperties = default; + PublicAccessProperties publicAccessProperties = default; + FileShareProvisioningState? provisioningState = default; + PublicNetworkAccess? publicNetworkAccess = default; + IReadOnlyList privateEndpointConnections = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("mountName"u8)) + { + mountName = property.Value.GetString(); + continue; + } + if (property.NameEquals("hostName"u8)) + { + hostName = property.Value.GetString(); + continue; + } + if (property.NameEquals("mediaTier"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + mediaTier = property.Value.GetString().ToMediaTier(); + continue; + } + if (property.NameEquals("redundancy"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + redundancy = property.Value.GetString().ToRedundancy(); + continue; + } + if (property.NameEquals("protocol"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + protocol = property.Value.GetString().ToProtocol(); + continue; + } + if (property.NameEquals("provisionedStorageGiB"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisionedStorageGiB = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("provisionedStorageNextAllowedDowngrade"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisionedStorageNextAllowedDowngrade = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("provisionedIOPerSec"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisionedIOPerSec = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("provisionedIOPerSecNextAllowedDowngrade"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisionedIOPerSecNextAllowedDowngrade = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("provisionedThroughputMiBPerSec"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisionedThroughputMiBPerSec = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("provisionedThroughputNextAllowedDowngrade"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisionedThroughputNextAllowedDowngrade = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("includedBurstIOPerSec"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + includedBurstIOPerSec = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("maxBurstIOPerSecCredits"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + maxBurstIOPerSecCredits = property.Value.GetInt64(); + continue; + } + if (property.NameEquals("nfsProtocolProperties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nfsProtocolProperties = NfsProtocolProperties.DeserializeNfsProtocolProperties(property.Value, options); + continue; + } + if (property.NameEquals("publicAccessProperties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + publicAccessProperties = PublicAccessProperties.DeserializePublicAccessProperties(property.Value, options); + continue; + } + if (property.NameEquals("provisioningState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new FileShareProvisioningState(property.Value.GetString()); + continue; + } + if (property.NameEquals("publicNetworkAccess"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + publicNetworkAccess = new PublicNetworkAccess(property.Value.GetString()); + continue; + } + if (property.NameEquals("privateEndpointConnections"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(FilesharesPrivateEndpointConnection.DeserializeFilesharesPrivateEndpointConnection(item, options)); + } + privateEndpointConnections = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new FileShareProperties( + mountName, + hostName, + mediaTier, + redundancy, + protocol, + provisionedStorageGiB, + provisionedStorageNextAllowedDowngrade, + provisionedIOPerSec, + provisionedIOPerSecNextAllowedDowngrade, + provisionedThroughputMiBPerSec, + provisionedThroughputNextAllowedDowngrade, + includedBurstIOPerSec, + maxBurstIOPerSecCredits, + nfsProtocolProperties, + publicAccessProperties, + provisioningState, + publicNetworkAccess, + privateEndpointConnections ?? new ChangeTrackingList(), + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerFilesharesContext.Default); + default: + throw new FormatException($"The model {nameof(FileShareProperties)} does not support writing '{options.Format}' format."); + } + } + + FileShareProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeFileShareProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(FileShareProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Models/FileShareProperties.cs b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Models/FileShareProperties.cs new file mode 100644 index 000000000000..204bf2a6f06f --- /dev/null +++ b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Models/FileShareProperties.cs @@ -0,0 +1,157 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.Fileshares.Models +{ + /// File share properties. + public partial class FileShareProperties + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public FileShareProperties() + { + PrivateEndpointConnections = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// The name of the file share as seen by the end user when mounting the share, such as in a URI or UNC format in their operating system. + /// The host name of the file share. + /// The storage media tier of the file share. + /// The chosen redundancy level of the file share. + /// The file sharing protocol for this file share. + /// The provisioned storage size of the share in GiB (1 GiB is 1024^3 bytes or 1073741824 bytes). A component of the file share's bill is the provisioned storage, regardless of the amount of used storage. + /// A date/time value that specifies when the provisioned storage for the file share is permitted to be reduced. + /// The provisioned IO / sec of the share. + /// A date/time value that specifies when the provisioned IOPS for the file share is permitted to be reduced. + /// The provisioned throughput / sec of the share. + /// A date/time value that specifies when the provisioned throughput for the file share is permitted to be reduced. + /// Burst IOPS are extra buffer IOPS enabling you to consume more than your provisioned IOPS for a short period of time, depending on the burst credits available for your share. + /// Max burst IOPS credits shows the maximum number of burst credits the share can have at the current IOPS provisioning level. + /// Protocol settings specific NFS. + /// The set of properties for control public access. + /// The status of the last operation. + /// Gets or sets allow or disallow public network access to azure managed file share. + /// The list of associated private endpoint connections. + /// Keeps track of any properties unknown to the library. + internal FileShareProperties(string mountName, string hostName, MediaTier? mediaTier, Redundancy? redundancy, Protocol? protocol, int? provisionedStorageGiB, DateTimeOffset? provisionedStorageNextAllowedDowngrade, int? provisionedIOPerSec, DateTimeOffset? provisionedIOPerSecNextAllowedDowngrade, int? provisionedThroughputMiBPerSec, DateTimeOffset? provisionedThroughputNextAllowedDowngrade, int? includedBurstIOPerSec, long? maxBurstIOPerSecCredits, NfsProtocolProperties nfsProtocolProperties, PublicAccessProperties publicAccessProperties, FileShareProvisioningState? provisioningState, PublicNetworkAccess? publicNetworkAccess, IReadOnlyList privateEndpointConnections, IDictionary serializedAdditionalRawData) + { + MountName = mountName; + HostName = hostName; + MediaTier = mediaTier; + Redundancy = redundancy; + Protocol = protocol; + ProvisionedStorageGiB = provisionedStorageGiB; + ProvisionedStorageNextAllowedDowngrade = provisionedStorageNextAllowedDowngrade; + ProvisionedIOPerSec = provisionedIOPerSec; + ProvisionedIOPerSecNextAllowedDowngrade = provisionedIOPerSecNextAllowedDowngrade; + ProvisionedThroughputMiBPerSec = provisionedThroughputMiBPerSec; + ProvisionedThroughputNextAllowedDowngrade = provisionedThroughputNextAllowedDowngrade; + IncludedBurstIOPerSec = includedBurstIOPerSec; + MaxBurstIOPerSecCredits = maxBurstIOPerSecCredits; + NfsProtocolProperties = nfsProtocolProperties; + PublicAccessProperties = publicAccessProperties; + ProvisioningState = provisioningState; + PublicNetworkAccess = publicNetworkAccess; + PrivateEndpointConnections = privateEndpointConnections; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The name of the file share as seen by the end user when mounting the share, such as in a URI or UNC format in their operating system. + public string MountName { get; set; } + /// The host name of the file share. + public string HostName { get; } + /// The storage media tier of the file share. + public MediaTier? MediaTier { get; set; } + /// The chosen redundancy level of the file share. + public Redundancy? Redundancy { get; set; } + /// The file sharing protocol for this file share. + public Protocol? Protocol { get; set; } + /// The provisioned storage size of the share in GiB (1 GiB is 1024^3 bytes or 1073741824 bytes). A component of the file share's bill is the provisioned storage, regardless of the amount of used storage. + public int? ProvisionedStorageGiB { get; set; } + /// A date/time value that specifies when the provisioned storage for the file share is permitted to be reduced. + public DateTimeOffset? ProvisionedStorageNextAllowedDowngrade { get; } + /// The provisioned IO / sec of the share. + public int? ProvisionedIOPerSec { get; set; } + /// A date/time value that specifies when the provisioned IOPS for the file share is permitted to be reduced. + public DateTimeOffset? ProvisionedIOPerSecNextAllowedDowngrade { get; } + /// The provisioned throughput / sec of the share. + public int? ProvisionedThroughputMiBPerSec { get; set; } + /// A date/time value that specifies when the provisioned throughput for the file share is permitted to be reduced. + public DateTimeOffset? ProvisionedThroughputNextAllowedDowngrade { get; } + /// Burst IOPS are extra buffer IOPS enabling you to consume more than your provisioned IOPS for a short period of time, depending on the burst credits available for your share. + public int? IncludedBurstIOPerSec { get; } + /// Max burst IOPS credits shows the maximum number of burst credits the share can have at the current IOPS provisioning level. + public long? MaxBurstIOPerSecCredits { get; } + /// Protocol settings specific NFS. + internal NfsProtocolProperties NfsProtocolProperties { get; set; } + /// Root squash defines how root users on clients are mapped to the NFS share. + public ShareRootSquash? NfsProtocolRootSquash + { + get => NfsProtocolProperties is null ? default : NfsProtocolProperties.RootSquash; + set + { + if (NfsProtocolProperties is null) + NfsProtocolProperties = new NfsProtocolProperties(); + NfsProtocolProperties.RootSquash = value; + } + } + + /// The set of properties for control public access. + internal PublicAccessProperties PublicAccessProperties { get; set; } + /// The allowed set of subnets when access is restricted. + public IList PublicAccessAllowedSubnets + { + get + { + if (PublicAccessProperties is null) + PublicAccessProperties = new PublicAccessProperties(); + return PublicAccessProperties.AllowedSubnets; + } + } + + /// The status of the last operation. + public FileShareProvisioningState? ProvisioningState { get; } + /// Gets or sets allow or disallow public network access to azure managed file share. + public PublicNetworkAccess? PublicNetworkAccess { get; set; } + /// The list of associated private endpoint connections. + public IReadOnlyList PrivateEndpointConnections { get; } + } +} diff --git a/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Models/FileShareProvisioningState.cs b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Models/FileShareProvisioningState.cs new file mode 100644 index 000000000000..4e2758563a2f --- /dev/null +++ b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Models/FileShareProvisioningState.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.Fileshares.Models +{ + /// The status of the last operation. + public readonly partial struct FileShareProvisioningState : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public FileShareProvisioningState(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string SucceededValue = "Succeeded"; + private const string FailedValue = "Failed"; + private const string CanceledValue = "Canceled"; + private const string ProvisioningValue = "Provisioning"; + private const string UpdatingValue = "Updating"; + private const string DeletingValue = "Deleting"; + private const string AcceptedValue = "Accepted"; + + /// Resource has been created. + public static FileShareProvisioningState Succeeded { get; } = new FileShareProvisioningState(SucceededValue); + /// Resource creation failed. + public static FileShareProvisioningState Failed { get; } = new FileShareProvisioningState(FailedValue); + /// Resource creation was canceled. + public static FileShareProvisioningState Canceled { get; } = new FileShareProvisioningState(CanceledValue); + /// The operation is provisioning. + public static FileShareProvisioningState Provisioning { get; } = new FileShareProvisioningState(ProvisioningValue); + /// The operation is updating. + public static FileShareProvisioningState Updating { get; } = new FileShareProvisioningState(UpdatingValue); + /// The operation is deleting. + public static FileShareProvisioningState Deleting { get; } = new FileShareProvisioningState(DeletingValue); + /// The operation is accepted. + public static FileShareProvisioningState Accepted { get; } = new FileShareProvisioningState(AcceptedValue); + /// Determines if two values are the same. + public static bool operator ==(FileShareProvisioningState left, FileShareProvisioningState right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(FileShareProvisioningState left, FileShareProvisioningState right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator FileShareProvisioningState(string value) => new FileShareProvisioningState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is FileShareProvisioningState other && Equals(other); + /// + public bool Equals(FileShareProvisioningState other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Models/FileShareSnapshotListResult.Serialization.cs b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Models/FileShareSnapshotListResult.Serialization.cs new file mode 100644 index 000000000000..f48c7da39514 --- /dev/null +++ b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Models/FileShareSnapshotListResult.Serialization.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Fileshares.Models +{ + internal partial class FileShareSnapshotListResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(FileShareSnapshotListResult)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink.AbsoluteUri); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + FileShareSnapshotListResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(FileShareSnapshotListResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeFileShareSnapshotListResult(document.RootElement, options); + } + + internal static FileShareSnapshotListResult DeserializeFileShareSnapshotListResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList value = default; + Uri nextLink = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(FileShareSnapshotData.DeserializeFileShareSnapshotData(item, options)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = new Uri(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new FileShareSnapshotListResult(value, nextLink, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerFilesharesContext.Default); + default: + throw new FormatException($"The model {nameof(FileShareSnapshotListResult)} does not support writing '{options.Format}' format."); + } + } + + FileShareSnapshotListResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeFileShareSnapshotListResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(FileShareSnapshotListResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Models/FileShareSnapshotListResult.cs b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Models/FileShareSnapshotListResult.cs new file mode 100644 index 000000000000..6ed63f71d5ab --- /dev/null +++ b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Models/FileShareSnapshotListResult.cs @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.ResourceManager.Fileshares.Models +{ + /// The response of a FileShareSnapshot list operation. + internal partial class FileShareSnapshotListResult + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The FileShareSnapshot items on this page. + /// is null. + internal FileShareSnapshotListResult(IEnumerable value) + { + Argument.AssertNotNull(value, nameof(value)); + + Value = value.ToList(); + } + + /// Initializes a new instance of . + /// The FileShareSnapshot items on this page. + /// The link to the next page of items. + /// Keeps track of any properties unknown to the library. + internal FileShareSnapshotListResult(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) + { + Value = value; + NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal FileShareSnapshotListResult() + { + } + + /// The FileShareSnapshot items on this page. + public IReadOnlyList Value { get; } + /// The link to the next page of items. + public Uri NextLink { get; } + } +} diff --git a/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Models/FileShareSnapshotPatch.Serialization.cs b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Models/FileShareSnapshotPatch.Serialization.cs new file mode 100644 index 000000000000..bfe010774205 --- /dev/null +++ b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Models/FileShareSnapshotPatch.Serialization.cs @@ -0,0 +1,133 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Fileshares.Models +{ + public partial class FileShareSnapshotPatch : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(FileShareSnapshotPatch)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + FileShareSnapshotPatch IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(FileShareSnapshotPatch)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeFileShareSnapshotPatch(document.RootElement, options); + } + + internal static FileShareSnapshotPatch DeserializeFileShareSnapshotPatch(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + FileShareSnapshotUpdateProperties properties = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = FileShareSnapshotUpdateProperties.DeserializeFileShareSnapshotUpdateProperties(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new FileShareSnapshotPatch(properties, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerFilesharesContext.Default); + default: + throw new FormatException($"The model {nameof(FileShareSnapshotPatch)} does not support writing '{options.Format}' format."); + } + } + + FileShareSnapshotPatch IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeFileShareSnapshotPatch(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(FileShareSnapshotPatch)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Models/FileShareSnapshotPatch.cs b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Models/FileShareSnapshotPatch.cs new file mode 100644 index 000000000000..e26a96a682fe --- /dev/null +++ b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Models/FileShareSnapshotPatch.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.Fileshares.Models +{ + /// The type used for update operations of the FileShareSnapshot. + public partial class FileShareSnapshotPatch + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public FileShareSnapshotPatch() + { + } + + /// Initializes a new instance of . + /// The resource-specific properties for this resource. + /// Keeps track of any properties unknown to the library. + internal FileShareSnapshotPatch(FileShareSnapshotUpdateProperties properties, IDictionary serializedAdditionalRawData) + { + Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The resource-specific properties for this resource. + internal FileShareSnapshotUpdateProperties Properties { get; set; } + /// The metadata. + public IDictionary FileShareSnapshotUpdateMetadata + { + get + { + if (Properties is null) + Properties = new FileShareSnapshotUpdateProperties(); + return Properties.Metadata; + } + } + } +} diff --git a/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Models/FileShareSnapshotProperties.Serialization.cs b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Models/FileShareSnapshotProperties.Serialization.cs new file mode 100644 index 000000000000..bc74e9754fcf --- /dev/null +++ b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Models/FileShareSnapshotProperties.Serialization.cs @@ -0,0 +1,181 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Fileshares.Models +{ + public partial class FileShareSnapshotProperties : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(FileShareSnapshotProperties)} does not support writing '{format}' format."); + } + + if (options.Format != "W" && Optional.IsDefined(SnapshotTime)) + { + writer.WritePropertyName("snapshotTime"u8); + writer.WriteStringValue(SnapshotTime); + } + if (options.Format != "W" && Optional.IsDefined(InitiatorId)) + { + writer.WritePropertyName("initiatorId"u8); + writer.WriteStringValue(InitiatorId); + } + if (Optional.IsCollectionDefined(Metadata)) + { + writer.WritePropertyName("metadata"u8); + writer.WriteStartObject(); + foreach (var item in Metadata) + { + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState.Value.ToString()); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + FileShareSnapshotProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(FileShareSnapshotProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeFileShareSnapshotProperties(document.RootElement, options); + } + + internal static FileShareSnapshotProperties DeserializeFileShareSnapshotProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string snapshotTime = default; + string initiatorId = default; + IDictionary metadata = default; + FileShareProvisioningState? provisioningState = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("snapshotTime"u8)) + { + snapshotTime = property.Value.GetString(); + continue; + } + if (property.NameEquals("initiatorId"u8)) + { + initiatorId = property.Value.GetString(); + continue; + } + if (property.NameEquals("metadata"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + metadata = dictionary; + continue; + } + if (property.NameEquals("provisioningState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new FileShareProvisioningState(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new FileShareSnapshotProperties(snapshotTime, initiatorId, metadata ?? new ChangeTrackingDictionary(), provisioningState, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerFilesharesContext.Default); + default: + throw new FormatException($"The model {nameof(FileShareSnapshotProperties)} does not support writing '{options.Format}' format."); + } + } + + FileShareSnapshotProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeFileShareSnapshotProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(FileShareSnapshotProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Models/FileShareSnapshotProperties.cs b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Models/FileShareSnapshotProperties.cs new file mode 100644 index 000000000000..edc8a841c38f --- /dev/null +++ b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Models/FileShareSnapshotProperties.cs @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.Fileshares.Models +{ + /// FileShareSnapshot properties. + public partial class FileShareSnapshotProperties + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public FileShareSnapshotProperties() + { + Metadata = new ChangeTrackingDictionary(); + } + + /// Initializes a new instance of . + /// The FileShareSnapshot time in UTC in string representation. + /// The initiator of the FileShareSnapshot. + /// The metadata. + /// The status of the last operation. + /// Keeps track of any properties unknown to the library. + internal FileShareSnapshotProperties(string snapshotTime, string initiatorId, IDictionary metadata, FileShareProvisioningState? provisioningState, IDictionary serializedAdditionalRawData) + { + SnapshotTime = snapshotTime; + InitiatorId = initiatorId; + Metadata = metadata; + ProvisioningState = provisioningState; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The FileShareSnapshot time in UTC in string representation. + public string SnapshotTime { get; } + /// The initiator of the FileShareSnapshot. + public string InitiatorId { get; } + /// The metadata. + public IDictionary Metadata { get; } + /// The status of the last operation. + public FileShareProvisioningState? ProvisioningState { get; } + } +} diff --git a/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Models/FileShareSnapshotUpdateProperties.Serialization.cs b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Models/FileShareSnapshotUpdateProperties.Serialization.cs new file mode 100644 index 000000000000..25fb6d320da1 --- /dev/null +++ b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Models/FileShareSnapshotUpdateProperties.Serialization.cs @@ -0,0 +1,144 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Fileshares.Models +{ + internal partial class FileShareSnapshotUpdateProperties : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(FileShareSnapshotUpdateProperties)} does not support writing '{format}' format."); + } + + if (Optional.IsCollectionDefined(Metadata)) + { + writer.WritePropertyName("metadata"u8); + writer.WriteStartObject(); + foreach (var item in Metadata) + { + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + FileShareSnapshotUpdateProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(FileShareSnapshotUpdateProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeFileShareSnapshotUpdateProperties(document.RootElement, options); + } + + internal static FileShareSnapshotUpdateProperties DeserializeFileShareSnapshotUpdateProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IDictionary metadata = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("metadata"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + metadata = dictionary; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new FileShareSnapshotUpdateProperties(metadata ?? new ChangeTrackingDictionary(), serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerFilesharesContext.Default); + default: + throw new FormatException($"The model {nameof(FileShareSnapshotUpdateProperties)} does not support writing '{options.Format}' format."); + } + } + + FileShareSnapshotUpdateProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeFileShareSnapshotUpdateProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(FileShareSnapshotUpdateProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Models/FileShareSnapshotUpdateProperties.cs b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Models/FileShareSnapshotUpdateProperties.cs new file mode 100644 index 000000000000..7bfe5910f38f --- /dev/null +++ b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Models/FileShareSnapshotUpdateProperties.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.Fileshares.Models +{ + /// The updatable properties of the FileShareSnapshot. + internal partial class FileShareSnapshotUpdateProperties + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public FileShareSnapshotUpdateProperties() + { + Metadata = new ChangeTrackingDictionary(); + } + + /// Initializes a new instance of . + /// The metadata. + /// Keeps track of any properties unknown to the library. + internal FileShareSnapshotUpdateProperties(IDictionary metadata, IDictionary serializedAdditionalRawData) + { + Metadata = metadata; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The metadata. + public IDictionary Metadata { get; } + } +} diff --git a/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Models/FileShareUpdateProperties.Serialization.cs b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Models/FileShareUpdateProperties.Serialization.cs new file mode 100644 index 000000000000..1225ac308dbd --- /dev/null +++ b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Models/FileShareUpdateProperties.Serialization.cs @@ -0,0 +1,215 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Fileshares.Models +{ + public partial class FileShareUpdateProperties : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(FileShareUpdateProperties)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(ProvisionedStorageGiB)) + { + writer.WritePropertyName("provisionedStorageGiB"u8); + writer.WriteNumberValue(ProvisionedStorageGiB.Value); + } + if (Optional.IsDefined(ProvisionedIOPerSec)) + { + writer.WritePropertyName("provisionedIOPerSec"u8); + writer.WriteNumberValue(ProvisionedIOPerSec.Value); + } + if (Optional.IsDefined(ProvisionedThroughputMiBPerSec)) + { + writer.WritePropertyName("provisionedThroughputMiBPerSec"u8); + writer.WriteNumberValue(ProvisionedThroughputMiBPerSec.Value); + } + if (Optional.IsDefined(NfsProtocolProperties)) + { + writer.WritePropertyName("nfsProtocolProperties"u8); + writer.WriteObjectValue(NfsProtocolProperties, options); + } + if (Optional.IsDefined(PublicAccessProperties)) + { + writer.WritePropertyName("publicAccessProperties"u8); + writer.WriteObjectValue(PublicAccessProperties, options); + } + if (Optional.IsDefined(PublicNetworkAccess)) + { + writer.WritePropertyName("publicNetworkAccess"u8); + writer.WriteStringValue(PublicNetworkAccess.Value.ToString()); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + FileShareUpdateProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(FileShareUpdateProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeFileShareUpdateProperties(document.RootElement, options); + } + + internal static FileShareUpdateProperties DeserializeFileShareUpdateProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + int? provisionedStorageGiB = default; + int? provisionedIOPerSec = default; + int? provisionedThroughputMiBPerSec = default; + NfsProtocolProperties nfsProtocolProperties = default; + PublicAccessProperties publicAccessProperties = default; + PublicNetworkAccess? publicNetworkAccess = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("provisionedStorageGiB"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisionedStorageGiB = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("provisionedIOPerSec"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisionedIOPerSec = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("provisionedThroughputMiBPerSec"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisionedThroughputMiBPerSec = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("nfsProtocolProperties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nfsProtocolProperties = NfsProtocolProperties.DeserializeNfsProtocolProperties(property.Value, options); + continue; + } + if (property.NameEquals("publicAccessProperties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + publicAccessProperties = PublicAccessProperties.DeserializePublicAccessProperties(property.Value, options); + continue; + } + if (property.NameEquals("publicNetworkAccess"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + publicNetworkAccess = new PublicNetworkAccess(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new FileShareUpdateProperties( + provisionedStorageGiB, + provisionedIOPerSec, + provisionedThroughputMiBPerSec, + nfsProtocolProperties, + publicAccessProperties, + publicNetworkAccess, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerFilesharesContext.Default); + default: + throw new FormatException($"The model {nameof(FileShareUpdateProperties)} does not support writing '{options.Format}' format."); + } + } + + FileShareUpdateProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeFileShareUpdateProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(FileShareUpdateProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Models/FileShareUpdateProperties.cs b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Models/FileShareUpdateProperties.cs new file mode 100644 index 000000000000..602856ec9b90 --- /dev/null +++ b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Models/FileShareUpdateProperties.cs @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.Fileshares.Models +{ + /// The updatable properties of the FileShare. + public partial class FileShareUpdateProperties + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public FileShareUpdateProperties() + { + } + + /// Initializes a new instance of . + /// The provisioned storage size of the share in GiB (1 GiB is 1024^3 bytes or 1073741824 bytes). A component of the file share's bill is the provisioned storage, regardless of the amount of used storage. + /// The provisioned IO / sec of the share. + /// The provisioned throughput / sec of the share. + /// Protocol settings specific NFS. + /// The set of properties for control public access. + /// Gets or sets allow or disallow public network access to azure managed file share. + /// Keeps track of any properties unknown to the library. + internal FileShareUpdateProperties(int? provisionedStorageGiB, int? provisionedIOPerSec, int? provisionedThroughputMiBPerSec, NfsProtocolProperties nfsProtocolProperties, PublicAccessProperties publicAccessProperties, PublicNetworkAccess? publicNetworkAccess, IDictionary serializedAdditionalRawData) + { + ProvisionedStorageGiB = provisionedStorageGiB; + ProvisionedIOPerSec = provisionedIOPerSec; + ProvisionedThroughputMiBPerSec = provisionedThroughputMiBPerSec; + NfsProtocolProperties = nfsProtocolProperties; + PublicAccessProperties = publicAccessProperties; + PublicNetworkAccess = publicNetworkAccess; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The provisioned storage size of the share in GiB (1 GiB is 1024^3 bytes or 1073741824 bytes). A component of the file share's bill is the provisioned storage, regardless of the amount of used storage. + public int? ProvisionedStorageGiB { get; set; } + /// The provisioned IO / sec of the share. + public int? ProvisionedIOPerSec { get; set; } + /// The provisioned throughput / sec of the share. + public int? ProvisionedThroughputMiBPerSec { get; set; } + /// Protocol settings specific NFS. + internal NfsProtocolProperties NfsProtocolProperties { get; set; } + /// Root squash defines how root users on clients are mapped to the NFS share. + public ShareRootSquash? NfsProtocolRootSquash + { + get => NfsProtocolProperties is null ? default : NfsProtocolProperties.RootSquash; + set + { + if (NfsProtocolProperties is null) + NfsProtocolProperties = new NfsProtocolProperties(); + NfsProtocolProperties.RootSquash = value; + } + } + + /// The set of properties for control public access. + internal PublicAccessProperties PublicAccessProperties { get; set; } + /// The allowed set of subnets when access is restricted. + public IList PublicAccessAllowedSubnets + { + get + { + if (PublicAccessProperties is null) + PublicAccessProperties = new PublicAccessProperties(); + return PublicAccessProperties.AllowedSubnets; + } + } + + /// Gets or sets allow or disallow public network access to azure managed file share. + public PublicNetworkAccess? PublicNetworkAccess { get; set; } + } +} diff --git a/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Models/FilesharesPrivateEndpointConnection.Serialization.cs b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Models/FilesharesPrivateEndpointConnection.Serialization.cs new file mode 100644 index 000000000000..5416d6f50856 --- /dev/null +++ b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Models/FilesharesPrivateEndpointConnection.Serialization.cs @@ -0,0 +1,154 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.Fileshares.Models +{ + public partial class FilesharesPrivateEndpointConnection : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(FilesharesPrivateEndpointConnection)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); + } + } + + FilesharesPrivateEndpointConnection IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(FilesharesPrivateEndpointConnection)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeFilesharesPrivateEndpointConnection(document.RootElement, options); + } + + internal static FilesharesPrivateEndpointConnection DeserializeFilesharesPrivateEndpointConnection(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + PrivateEndpointConnectionProperties properties = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + SystemData systemData = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = PrivateEndpointConnectionProperties.DeserializePrivateEndpointConnectionProperties(property.Value, options); + continue; + } + 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 (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new FilesharesPrivateEndpointConnection( + id, + name, + type, + systemData, + properties, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerFilesharesContext.Default); + default: + throw new FormatException($"The model {nameof(FilesharesPrivateEndpointConnection)} does not support writing '{options.Format}' format."); + } + } + + FilesharesPrivateEndpointConnection IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeFilesharesPrivateEndpointConnection(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(FilesharesPrivateEndpointConnection)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Models/FilesharesPrivateEndpointConnection.cs b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Models/FilesharesPrivateEndpointConnection.cs new file mode 100644 index 000000000000..148351df137c --- /dev/null +++ b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Models/FilesharesPrivateEndpointConnection.cs @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.Fileshares.Models +{ + /// The private endpoint connection resource. + public partial class FilesharesPrivateEndpointConnection : ResourceData + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + internal FilesharesPrivateEndpointConnection() + { + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The private endpoint connection properties. + /// Keeps track of any properties unknown to the library. + internal FilesharesPrivateEndpointConnection(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, PrivateEndpointConnectionProperties properties, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + { + Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The private endpoint connection properties. + public PrivateEndpointConnectionProperties Properties { get; } + } +} diff --git a/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Models/FilesharesPrivateEndpointConnectionProvisioningState.cs b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Models/FilesharesPrivateEndpointConnectionProvisioningState.cs new file mode 100644 index 000000000000..d03a3ce38baf --- /dev/null +++ b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Models/FilesharesPrivateEndpointConnectionProvisioningState.cs @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.Fileshares.Models +{ + /// The current provisioning state. + public readonly partial struct FilesharesPrivateEndpointConnectionProvisioningState : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public FilesharesPrivateEndpointConnectionProvisioningState(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string SucceededValue = "Succeeded"; + private const string CreatingValue = "Creating"; + private const string DeletingValue = "Deleting"; + private const string FailedValue = "Failed"; + + /// Connection has been provisioned. + public static FilesharesPrivateEndpointConnectionProvisioningState Succeeded { get; } = new FilesharesPrivateEndpointConnectionProvisioningState(SucceededValue); + /// Connection is being created. + public static FilesharesPrivateEndpointConnectionProvisioningState Creating { get; } = new FilesharesPrivateEndpointConnectionProvisioningState(CreatingValue); + /// Connection is being deleted. + public static FilesharesPrivateEndpointConnectionProvisioningState Deleting { get; } = new FilesharesPrivateEndpointConnectionProvisioningState(DeletingValue); + /// Connection provisioning has failed. + public static FilesharesPrivateEndpointConnectionProvisioningState Failed { get; } = new FilesharesPrivateEndpointConnectionProvisioningState(FailedValue); + /// Determines if two values are the same. + public static bool operator ==(FilesharesPrivateEndpointConnectionProvisioningState left, FilesharesPrivateEndpointConnectionProvisioningState right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(FilesharesPrivateEndpointConnectionProvisioningState left, FilesharesPrivateEndpointConnectionProvisioningState right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator FilesharesPrivateEndpointConnectionProvisioningState(string value) => new FilesharesPrivateEndpointConnectionProvisioningState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is FilesharesPrivateEndpointConnectionProvisioningState other && Equals(other); + /// + public bool Equals(FilesharesPrivateEndpointConnectionProvisioningState other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Models/FilesharesPrivateEndpointServiceConnectionStatus.cs b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Models/FilesharesPrivateEndpointServiceConnectionStatus.cs new file mode 100644 index 000000000000..4d24b761d9d8 --- /dev/null +++ b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Models/FilesharesPrivateEndpointServiceConnectionStatus.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.Fileshares.Models +{ + /// The private endpoint connection status. + public readonly partial struct FilesharesPrivateEndpointServiceConnectionStatus : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public FilesharesPrivateEndpointServiceConnectionStatus(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string PendingValue = "Pending"; + private const string ApprovedValue = "Approved"; + private const string RejectedValue = "Rejected"; + + /// Connectionaiting for approval or rejection. + public static FilesharesPrivateEndpointServiceConnectionStatus Pending { get; } = new FilesharesPrivateEndpointServiceConnectionStatus(PendingValue); + /// Connection approved. + public static FilesharesPrivateEndpointServiceConnectionStatus Approved { get; } = new FilesharesPrivateEndpointServiceConnectionStatus(ApprovedValue); + /// Connection Rejected. + public static FilesharesPrivateEndpointServiceConnectionStatus Rejected { get; } = new FilesharesPrivateEndpointServiceConnectionStatus(RejectedValue); + /// Determines if two values are the same. + public static bool operator ==(FilesharesPrivateEndpointServiceConnectionStatus left, FilesharesPrivateEndpointServiceConnectionStatus right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(FilesharesPrivateEndpointServiceConnectionStatus left, FilesharesPrivateEndpointServiceConnectionStatus right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator FilesharesPrivateEndpointServiceConnectionStatus(string value) => new FilesharesPrivateEndpointServiceConnectionStatus(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is FilesharesPrivateEndpointServiceConnectionStatus other && Equals(other); + /// + public bool Equals(FilesharesPrivateEndpointServiceConnectionStatus other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Models/FilesharesPrivateLinkServiceConnectionState.Serialization.cs b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Models/FilesharesPrivateLinkServiceConnectionState.Serialization.cs new file mode 100644 index 000000000000..f1b5a46b6ac1 --- /dev/null +++ b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Models/FilesharesPrivateLinkServiceConnectionState.Serialization.cs @@ -0,0 +1,155 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Fileshares.Models +{ + public partial class FilesharesPrivateLinkServiceConnectionState : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(FilesharesPrivateLinkServiceConnectionState)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(Status)) + { + writer.WritePropertyName("status"u8); + writer.WriteStringValue(Status.Value.ToString()); + } + if (Optional.IsDefined(Description)) + { + writer.WritePropertyName("description"u8); + writer.WriteStringValue(Description); + } + if (Optional.IsDefined(ActionsRequired)) + { + writer.WritePropertyName("actionsRequired"u8); + writer.WriteStringValue(ActionsRequired); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + FilesharesPrivateLinkServiceConnectionState IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(FilesharesPrivateLinkServiceConnectionState)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeFilesharesPrivateLinkServiceConnectionState(document.RootElement, options); + } + + internal static FilesharesPrivateLinkServiceConnectionState DeserializeFilesharesPrivateLinkServiceConnectionState(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + FilesharesPrivateEndpointServiceConnectionStatus? status = default; + string description = default; + string actionsRequired = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("status"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + status = new FilesharesPrivateEndpointServiceConnectionStatus(property.Value.GetString()); + continue; + } + if (property.NameEquals("description"u8)) + { + description = property.Value.GetString(); + continue; + } + if (property.NameEquals("actionsRequired"u8)) + { + actionsRequired = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new FilesharesPrivateLinkServiceConnectionState(status, description, actionsRequired, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerFilesharesContext.Default); + default: + throw new FormatException($"The model {nameof(FilesharesPrivateLinkServiceConnectionState)} does not support writing '{options.Format}' format."); + } + } + + FilesharesPrivateLinkServiceConnectionState IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeFilesharesPrivateLinkServiceConnectionState(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(FilesharesPrivateLinkServiceConnectionState)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Models/FilesharesPrivateLinkServiceConnectionState.cs b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Models/FilesharesPrivateLinkServiceConnectionState.cs new file mode 100644 index 000000000000..ded0fe8b65d7 --- /dev/null +++ b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Models/FilesharesPrivateLinkServiceConnectionState.cs @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.Fileshares.Models +{ + /// A collection of information about the state of the connection between service consumer and provider. + public partial class FilesharesPrivateLinkServiceConnectionState + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + internal FilesharesPrivateLinkServiceConnectionState() + { + } + + /// Initializes a new instance of . + /// Indicates whether the connection has been Approved/Rejected/Removed by the owner of the service. + /// The reason for approval/rejection of the connection. + /// A message indicating if changes on the service provider require any updates on the consumer. + /// Keeps track of any properties unknown to the library. + internal FilesharesPrivateLinkServiceConnectionState(FilesharesPrivateEndpointServiceConnectionStatus? status, string description, string actionsRequired, IDictionary serializedAdditionalRawData) + { + Status = status; + Description = description; + ActionsRequired = actionsRequired; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Indicates whether the connection has been Approved/Rejected/Removed by the owner of the service. + public FilesharesPrivateEndpointServiceConnectionStatus? Status { get; } + /// The reason for approval/rejection of the connection. + public string Description { get; } + /// A message indicating if changes on the service provider require any updates on the consumer. + public string ActionsRequired { get; } + } +} diff --git a/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Models/Info.Serialization.cs b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Models/Info.Serialization.cs new file mode 100644 index 000000000000..46396f7091dd --- /dev/null +++ b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Models/Info.Serialization.cs @@ -0,0 +1,195 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Fileshares.Models +{ + public partial class Info : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(Info)} does not support writing '{format}' format."); + } + + if (options.Format != "W" && Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (options.Format != "W" && Optional.IsDefined(IsDataAction)) + { + writer.WritePropertyName("isDataAction"u8); + writer.WriteBooleanValue(IsDataAction.Value); + } + if (Optional.IsDefined(Display)) + { + writer.WritePropertyName("display"u8); + writer.WriteObjectValue(Display, options); + } + if (options.Format != "W" && Optional.IsDefined(Origin)) + { + writer.WritePropertyName("origin"u8); + writer.WriteStringValue(Origin.Value.ToString()); + } + if (options.Format != "W" && Optional.IsDefined(ActionType)) + { + writer.WritePropertyName("actionType"u8); + writer.WriteStringValue(ActionType.Value.ToString()); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + Info IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(Info)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeInfo(document.RootElement, options); + } + + internal static Info DeserializeInfo(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string name = default; + bool? isDataAction = default; + OperationDisplay display = default; + Origin? origin = default; + ActionType? actionType = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("isDataAction"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + isDataAction = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("display"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + display = OperationDisplay.DeserializeOperationDisplay(property.Value, options); + continue; + } + if (property.NameEquals("origin"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + origin = new Origin(property.Value.GetString()); + continue; + } + if (property.NameEquals("actionType"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + actionType = new ActionType(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new Info( + name, + isDataAction, + display, + origin, + actionType, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerFilesharesContext.Default); + default: + throw new FormatException($"The model {nameof(Info)} does not support writing '{options.Format}' format."); + } + } + + Info IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeInfo(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(Info)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Models/Info.cs b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Models/Info.cs new file mode 100644 index 000000000000..56b2cca542fe --- /dev/null +++ b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Models/Info.cs @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.Fileshares.Models +{ + /// Details of a REST API operation, returned from the Resource Provider Operations API. + public partial class Info + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + internal Info() + { + } + + /// Initializes a new instance of . + /// The name of the operation, as per Resource-Based Access Control (RBAC). Examples: "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action". + /// Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for Azure Resource Manager/control-plane operations. + /// Localized display information for this particular operation. + /// The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value is "user,system". + /// Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + /// Keeps track of any properties unknown to the library. + internal Info(string name, bool? isDataAction, OperationDisplay display, Origin? origin, ActionType? actionType, IDictionary serializedAdditionalRawData) + { + Name = name; + IsDataAction = isDataAction; + Display = display; + Origin = origin; + ActionType = actionType; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The name of the operation, as per Resource-Based Access Control (RBAC). Examples: "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action". + public string Name { get; } + /// Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for Azure Resource Manager/control-plane operations. + public bool? IsDataAction { get; } + /// Localized display information for this particular operation. + public OperationDisplay Display { get; } + /// The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value is "user,system". + public Origin? Origin { get; } + /// Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + public ActionType? ActionType { get; } + } +} diff --git a/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Models/MediaTier.Serialization.cs b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Models/MediaTier.Serialization.cs new file mode 100644 index 000000000000..fbb17505c182 --- /dev/null +++ b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Models/MediaTier.Serialization.cs @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.Fileshares.Models +{ + internal static partial class MediaTierExtensions + { + public static string ToSerialString(this MediaTier value) => value switch + { + MediaTier.SSD => "SSD", + _ => throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown MediaTier value.") + }; + + public static MediaTier ToMediaTier(this string value) + { + if (StringComparer.OrdinalIgnoreCase.Equals(value, "SSD")) return MediaTier.SSD; + throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown MediaTier value."); + } + } +} diff --git a/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Models/MediaTier.cs b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Models/MediaTier.cs new file mode 100644 index 000000000000..e7f3834b04ca --- /dev/null +++ b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Models/MediaTier.cs @@ -0,0 +1,16 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.Fileshares.Models +{ + /// Media Tier enum. + public enum MediaTier + { + /// SSD. + SSD + } +} diff --git a/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Models/NfsProtocolProperties.Serialization.cs b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Models/NfsProtocolProperties.Serialization.cs new file mode 100644 index 000000000000..49029943d724 --- /dev/null +++ b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Models/NfsProtocolProperties.Serialization.cs @@ -0,0 +1,133 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Fileshares.Models +{ + internal partial class NfsProtocolProperties : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(NfsProtocolProperties)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(RootSquash)) + { + writer.WritePropertyName("rootSquash"u8); + writer.WriteStringValue(RootSquash.Value.ToSerialString()); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + NfsProtocolProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(NfsProtocolProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeNfsProtocolProperties(document.RootElement, options); + } + + internal static NfsProtocolProperties DeserializeNfsProtocolProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ShareRootSquash? rootSquash = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("rootSquash"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + rootSquash = property.Value.GetString().ToShareRootSquash(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new NfsProtocolProperties(rootSquash, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerFilesharesContext.Default); + default: + throw new FormatException($"The model {nameof(NfsProtocolProperties)} does not support writing '{options.Format}' format."); + } + } + + NfsProtocolProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeNfsProtocolProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(NfsProtocolProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Models/NfsProtocolProperties.cs b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Models/NfsProtocolProperties.cs new file mode 100644 index 000000000000..6336fdbbea90 --- /dev/null +++ b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Models/NfsProtocolProperties.cs @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.Fileshares.Models +{ + /// Properties specific to the NFS protocol. + internal partial class NfsProtocolProperties + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public NfsProtocolProperties() + { + } + + /// Initializes a new instance of . + /// Root squash defines how root users on clients are mapped to the NFS share. + /// Keeps track of any properties unknown to the library. + internal NfsProtocolProperties(ShareRootSquash? rootSquash, IDictionary serializedAdditionalRawData) + { + RootSquash = rootSquash; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Root squash defines how root users on clients are mapped to the NFS share. + public ShareRootSquash? RootSquash { get; set; } + } +} diff --git a/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Models/OperationDisplay.Serialization.cs b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Models/OperationDisplay.Serialization.cs new file mode 100644 index 000000000000..3d5c750cc49e --- /dev/null +++ b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Models/OperationDisplay.Serialization.cs @@ -0,0 +1,162 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Fileshares.Models +{ + public partial class OperationDisplay : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(OperationDisplay)} does not support writing '{format}' format."); + } + + if (options.Format != "W" && Optional.IsDefined(Provider)) + { + writer.WritePropertyName("provider"u8); + writer.WriteStringValue(Provider); + } + if (options.Format != "W" && Optional.IsDefined(Resource)) + { + writer.WritePropertyName("resource"u8); + writer.WriteStringValue(Resource); + } + if (options.Format != "W" && Optional.IsDefined(Operation)) + { + writer.WritePropertyName("operation"u8); + writer.WriteStringValue(Operation); + } + if (options.Format != "W" && Optional.IsDefined(Description)) + { + writer.WritePropertyName("description"u8); + writer.WriteStringValue(Description); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + OperationDisplay IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(OperationDisplay)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeOperationDisplay(document.RootElement, options); + } + + internal static OperationDisplay DeserializeOperationDisplay(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string provider = default; + string resource = default; + string operation = default; + string description = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("provider"u8)) + { + provider = property.Value.GetString(); + continue; + } + if (property.NameEquals("resource"u8)) + { + resource = property.Value.GetString(); + continue; + } + if (property.NameEquals("operation"u8)) + { + operation = property.Value.GetString(); + continue; + } + if (property.NameEquals("description"u8)) + { + description = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new OperationDisplay(provider, resource, operation, description, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerFilesharesContext.Default); + default: + throw new FormatException($"The model {nameof(OperationDisplay)} does not support writing '{options.Format}' format."); + } + } + + OperationDisplay IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeOperationDisplay(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(OperationDisplay)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Models/OperationDisplay.cs b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Models/OperationDisplay.cs new file mode 100644 index 000000000000..8f9005ffffd4 --- /dev/null +++ b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Models/OperationDisplay.cs @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.Fileshares.Models +{ + /// Localized display information for and operation. + public partial class OperationDisplay + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + internal OperationDisplay() + { + } + + /// Initializes a new instance of . + /// The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or "Microsoft Compute". + /// The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or "Job Schedule Collections". + /// The concise, localized friendly name for the operation; suitable for dropdowns. E.g. "Create or Update Virtual Machine", "Restart Virtual Machine". + /// The short, localized friendly description of the operation; suitable for tool tips and detailed views. + /// Keeps track of any properties unknown to the library. + internal OperationDisplay(string provider, string resource, string operation, string description, IDictionary serializedAdditionalRawData) + { + Provider = provider; + Resource = resource; + Operation = operation; + Description = description; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or "Microsoft Compute". + public string Provider { get; } + /// The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or "Job Schedule Collections". + public string Resource { get; } + /// The concise, localized friendly name for the operation; suitable for dropdowns. E.g. "Create or Update Virtual Machine", "Restart Virtual Machine". + public string Operation { get; } + /// The short, localized friendly description of the operation; suitable for tool tips and detailed views. + public string Description { get; } + } +} diff --git a/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Models/OperationListResult.Serialization.cs b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Models/OperationListResult.Serialization.cs new file mode 100644 index 000000000000..ecd9b8e070b7 --- /dev/null +++ b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Models/OperationListResult.Serialization.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Fileshares.Models +{ + internal partial class OperationListResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(OperationListResult)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink.AbsoluteUri); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + OperationListResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(OperationListResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeOperationListResult(document.RootElement, options); + } + + internal static OperationListResult DeserializeOperationListResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList value = default; + Uri nextLink = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(Info.DeserializeInfo(item, options)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = new Uri(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new OperationListResult(value, nextLink, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerFilesharesContext.Default); + default: + throw new FormatException($"The model {nameof(OperationListResult)} does not support writing '{options.Format}' format."); + } + } + + OperationListResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeOperationListResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(OperationListResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Models/OperationListResult.cs b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Models/OperationListResult.cs new file mode 100644 index 000000000000..aafa76114680 --- /dev/null +++ b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Models/OperationListResult.cs @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.ResourceManager.Fileshares.Models +{ + /// A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of results. + internal partial class OperationListResult + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The Operation items on this page. + /// is null. + internal OperationListResult(IEnumerable value) + { + Argument.AssertNotNull(value, nameof(value)); + + Value = value.ToList(); + } + + /// Initializes a new instance of . + /// The Operation items on this page. + /// The link to the next page of items. + /// Keeps track of any properties unknown to the library. + internal OperationListResult(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) + { + Value = value; + NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal OperationListResult() + { + } + + /// The Operation items on this page. + public IReadOnlyList Value { get; } + /// The link to the next page of items. + public Uri NextLink { get; } + } +} diff --git a/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Models/Origin.cs b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Models/Origin.cs new file mode 100644 index 000000000000..f45e7775e151 --- /dev/null +++ b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Models/Origin.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.Fileshares.Models +{ + /// The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value is "user,system". + public readonly partial struct Origin : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public Origin(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string UserValue = "user"; + private const string SystemValue = "system"; + private const string UserSystemValue = "user,system"; + + /// Indicates the operation is initiated by a user. + public static Origin User { get; } = new Origin(UserValue); + /// Indicates the operation is initiated by a system. + public static Origin System { get; } = new Origin(SystemValue); + /// Indicates the operation is initiated by a user or system. + public static Origin UserSystem { get; } = new Origin(UserSystemValue); + /// Determines if two values are the same. + public static bool operator ==(Origin left, Origin right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(Origin left, Origin right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator Origin(string value) => new Origin(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is Origin other && Equals(other); + /// + public bool Equals(Origin other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Models/PrivateEndpointConnectionProperties.Serialization.cs b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Models/PrivateEndpointConnectionProperties.Serialization.cs new file mode 100644 index 000000000000..a154d1b59f09 --- /dev/null +++ b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Models/PrivateEndpointConnectionProperties.Serialization.cs @@ -0,0 +1,182 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Resources.Models; + +namespace Azure.ResourceManager.Fileshares.Models +{ + public partial class PrivateEndpointConnectionProperties : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(PrivateEndpointConnectionProperties)} does not support writing '{format}' format."); + } + + if (options.Format != "W" && Optional.IsCollectionDefined(GroupIds)) + { + writer.WritePropertyName("groupIds"u8); + writer.WriteStartArray(); + foreach (var item in GroupIds) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(PrivateEndpoint)) + { + writer.WritePropertyName("privateEndpoint"u8); + JsonSerializer.Serialize(writer, PrivateEndpoint); + } + writer.WritePropertyName("privateLinkServiceConnectionState"u8); + writer.WriteObjectValue(PrivateLinkServiceConnectionState, options); + if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState.Value.ToString()); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + PrivateEndpointConnectionProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(PrivateEndpointConnectionProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializePrivateEndpointConnectionProperties(document.RootElement, options); + } + + internal static PrivateEndpointConnectionProperties DeserializePrivateEndpointConnectionProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList groupIds = default; + SubResource privateEndpoint = default; + FilesharesPrivateLinkServiceConnectionState privateLinkServiceConnectionState = default; + FilesharesPrivateEndpointConnectionProvisioningState? provisioningState = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("groupIds"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + groupIds = array; + continue; + } + if (property.NameEquals("privateEndpoint"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + privateEndpoint = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (property.NameEquals("privateLinkServiceConnectionState"u8)) + { + privateLinkServiceConnectionState = FilesharesPrivateLinkServiceConnectionState.DeserializeFilesharesPrivateLinkServiceConnectionState(property.Value, options); + continue; + } + if (property.NameEquals("provisioningState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new FilesharesPrivateEndpointConnectionProvisioningState(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new PrivateEndpointConnectionProperties(groupIds ?? new ChangeTrackingList(), privateEndpoint, privateLinkServiceConnectionState, provisioningState, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerFilesharesContext.Default); + default: + throw new FormatException($"The model {nameof(PrivateEndpointConnectionProperties)} does not support writing '{options.Format}' format."); + } + } + + PrivateEndpointConnectionProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializePrivateEndpointConnectionProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(PrivateEndpointConnectionProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Models/PrivateEndpointConnectionProperties.cs b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Models/PrivateEndpointConnectionProperties.cs new file mode 100644 index 000000000000..ccfd4843b32f --- /dev/null +++ b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Models/PrivateEndpointConnectionProperties.cs @@ -0,0 +1,96 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.Resources.Models; + +namespace Azure.ResourceManager.Fileshares.Models +{ + /// Properties of the private endpoint connection. + public partial class PrivateEndpointConnectionProperties + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// A collection of information about the state of the connection between service consumer and provider. + /// is null. + internal PrivateEndpointConnectionProperties(FilesharesPrivateLinkServiceConnectionState privateLinkServiceConnectionState) + { + Argument.AssertNotNull(privateLinkServiceConnectionState, nameof(privateLinkServiceConnectionState)); + + GroupIds = new ChangeTrackingList(); + PrivateLinkServiceConnectionState = privateLinkServiceConnectionState; + } + + /// Initializes a new instance of . + /// The group ids for the private endpoint resource. + /// The private endpoint resource. + /// A collection of information about the state of the connection between service consumer and provider. + /// The provisioning state of the private endpoint connection resource. + /// Keeps track of any properties unknown to the library. + internal PrivateEndpointConnectionProperties(IReadOnlyList groupIds, SubResource privateEndpoint, FilesharesPrivateLinkServiceConnectionState privateLinkServiceConnectionState, FilesharesPrivateEndpointConnectionProvisioningState? provisioningState, IDictionary serializedAdditionalRawData) + { + GroupIds = groupIds; + PrivateEndpoint = privateEndpoint; + PrivateLinkServiceConnectionState = privateLinkServiceConnectionState; + ProvisioningState = provisioningState; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal PrivateEndpointConnectionProperties() + { + } + + /// The group ids for the private endpoint resource. + public IReadOnlyList GroupIds { get; } + /// The private endpoint resource. + internal SubResource PrivateEndpoint { get; } + /// Gets Id. + public ResourceIdentifier PrivateEndpointId + { + get => PrivateEndpoint?.Id; + } + + /// A collection of information about the state of the connection between service consumer and provider. + public FilesharesPrivateLinkServiceConnectionState PrivateLinkServiceConnectionState { get; } + /// The provisioning state of the private endpoint connection resource. + public FilesharesPrivateEndpointConnectionProvisioningState? ProvisioningState { get; } + } +} diff --git a/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Models/Protocol.Serialization.cs b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Models/Protocol.Serialization.cs new file mode 100644 index 000000000000..e2eacc63164f --- /dev/null +++ b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Models/Protocol.Serialization.cs @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.Fileshares.Models +{ + internal static partial class ProtocolExtensions + { + public static string ToSerialString(this Protocol value) => value switch + { + Protocol.NFS => "NFS", + _ => throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown Protocol value.") + }; + + public static Protocol ToProtocol(this string value) + { + if (StringComparer.OrdinalIgnoreCase.Equals(value, "NFS")) return Protocol.NFS; + throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown Protocol value."); + } + } +} diff --git a/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Models/Protocol.cs b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Models/Protocol.cs new file mode 100644 index 000000000000..0e4bb844519c --- /dev/null +++ b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Models/Protocol.cs @@ -0,0 +1,16 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.Fileshares.Models +{ + /// Protocol enum. + public enum Protocol + { + /// NFS. + NFS + } +} diff --git a/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Models/PublicAccessProperties.Serialization.cs b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Models/PublicAccessProperties.Serialization.cs new file mode 100644 index 000000000000..75660167a51d --- /dev/null +++ b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Models/PublicAccessProperties.Serialization.cs @@ -0,0 +1,143 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Fileshares.Models +{ + internal partial class PublicAccessProperties : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(PublicAccessProperties)} does not support writing '{format}' format."); + } + + if (Optional.IsCollectionDefined(AllowedSubnets)) + { + writer.WritePropertyName("allowedSubnets"u8); + writer.WriteStartArray(); + foreach (var item in AllowedSubnets) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + PublicAccessProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(PublicAccessProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializePublicAccessProperties(document.RootElement, options); + } + + internal static PublicAccessProperties DeserializePublicAccessProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IList allowedSubnets = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("allowedSubnets"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + allowedSubnets = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new PublicAccessProperties(allowedSubnets ?? new ChangeTrackingList(), serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerFilesharesContext.Default); + default: + throw new FormatException($"The model {nameof(PublicAccessProperties)} does not support writing '{options.Format}' format."); + } + } + + PublicAccessProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializePublicAccessProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(PublicAccessProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Models/PublicAccessProperties.cs b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Models/PublicAccessProperties.cs new file mode 100644 index 000000000000..407f31303c1c --- /dev/null +++ b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Models/PublicAccessProperties.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.Fileshares.Models +{ + /// The set of properties for control public access. + internal partial class PublicAccessProperties + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public PublicAccessProperties() + { + AllowedSubnets = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// The allowed set of subnets when access is restricted. + /// Keeps track of any properties unknown to the library. + internal PublicAccessProperties(IList allowedSubnets, IDictionary serializedAdditionalRawData) + { + AllowedSubnets = allowedSubnets; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The allowed set of subnets when access is restricted. + public IList AllowedSubnets { get; } + } +} diff --git a/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Models/PublicNetworkAccess.cs b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Models/PublicNetworkAccess.cs new file mode 100644 index 000000000000..ef0db22b07c7 --- /dev/null +++ b/sdk/fileshares/Azure.ResourceManager.Fileshares/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.Fileshares.Models +{ + /// State of the public network access. + 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"; + + /// The public network access is enabled. + public static PublicNetworkAccess Enabled { get; } = new PublicNetworkAccess(EnabledValue); + /// The public network access is 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 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 != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Models/Redundancy.Serialization.cs b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Models/Redundancy.Serialization.cs new file mode 100644 index 000000000000..9fc6ddef190d --- /dev/null +++ b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Models/Redundancy.Serialization.cs @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.Fileshares.Models +{ + internal static partial class RedundancyExtensions + { + public static string ToSerialString(this Redundancy value) => value switch + { + Redundancy.Local => "Local", + Redundancy.Zone => "Zone", + _ => throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown Redundancy value.") + }; + + public static Redundancy ToRedundancy(this string value) + { + if (StringComparer.OrdinalIgnoreCase.Equals(value, "Local")) return Redundancy.Local; + if (StringComparer.OrdinalIgnoreCase.Equals(value, "Zone")) return Redundancy.Zone; + throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown Redundancy value."); + } + } +} diff --git a/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Models/Redundancy.cs b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Models/Redundancy.cs new file mode 100644 index 000000000000..a83541b21cb3 --- /dev/null +++ b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Models/Redundancy.cs @@ -0,0 +1,18 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.Fileshares.Models +{ + /// Redundancy enum. + public enum Redundancy + { + /// Local. + Local, + /// Zone. + Zone + } +} diff --git a/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Models/ShareRootSquash.Serialization.cs b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Models/ShareRootSquash.Serialization.cs new file mode 100644 index 000000000000..e8a70d840f0f --- /dev/null +++ b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Models/ShareRootSquash.Serialization.cs @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.Fileshares.Models +{ + internal static partial class ShareRootSquashExtensions + { + public static string ToSerialString(this ShareRootSquash value) => value switch + { + ShareRootSquash.NoRootSquash => "NoRootSquash", + ShareRootSquash.RootSquash => "RootSquash", + ShareRootSquash.AllSquash => "AllSquash", + _ => throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown ShareRootSquash value.") + }; + + public static ShareRootSquash ToShareRootSquash(this string value) + { + if (StringComparer.OrdinalIgnoreCase.Equals(value, "NoRootSquash")) return ShareRootSquash.NoRootSquash; + if (StringComparer.OrdinalIgnoreCase.Equals(value, "RootSquash")) return ShareRootSquash.RootSquash; + if (StringComparer.OrdinalIgnoreCase.Equals(value, "AllSquash")) return ShareRootSquash.AllSquash; + throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown ShareRootSquash value."); + } + } +} diff --git a/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Models/ShareRootSquash.cs b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Models/ShareRootSquash.cs new file mode 100644 index 000000000000..43967359d29c --- /dev/null +++ b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/Models/ShareRootSquash.cs @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.Fileshares.Models +{ + /// Share root squash enum. + public enum ShareRootSquash + { + /// NoRootSquash. + NoRootSquash, + /// RootSquash. + RootSquash, + /// AllSquash. + AllSquash + } +} diff --git a/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/ProviderConstants.cs b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/ProviderConstants.cs new file mode 100644 index 000000000000..e4e732a43d3e --- /dev/null +++ b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/ProviderConstants.cs @@ -0,0 +1,16 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.Fileshares +{ + internal static class ProviderConstants + { + public static string DefaultProviderNamespace { get; } = ClientDiagnostics.GetResourceProviderNamespace(typeof(ProviderConstants).Assembly); + } +} diff --git a/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/RestOperations/FileSharesRestOperations.cs b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/RestOperations/FileSharesRestOperations.cs new file mode 100644 index 000000000000..82b579958f7d --- /dev/null +++ b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/RestOperations/FileSharesRestOperations.cs @@ -0,0 +1,1399 @@ +// 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.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Fileshares.Models; + +namespace Azure.ResourceManager.Fileshares +{ + internal partial class FileSharesRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of FileSharesRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// Service host. + /// The API version to use for this operation. + /// or is null. + public FileSharesRestOperations(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 ?? "2024-01-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string resourceName) + { + 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.FileShares/fileShares/", false); + uri.AppendPath(resourceName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string resourceName) + { + 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.FileShares/fileShares/", false); + uri.AppendPath(resourceName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get a FileShare. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The resource name of the file share, as seen by the administrator through Azure Resource Manager. + /// 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 resourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, resourceName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + FileShareData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = FileShareData.DeserializeFileShareData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((FileShareData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get a FileShare. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The resource name of the file share, as seen by the administrator through Azure Resource Manager. + /// 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 resourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, resourceName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + FileShareData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = FileShareData.DeserializeFileShareData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((FileShareData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, string resourceGroupName, string resourceName, FileShareData data) + { + 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.FileShares/fileShares/", false); + uri.AppendPath(resourceName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string resourceName, FileShareData 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.FileShares/fileShares/", false); + uri.AppendPath(resourceName, 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, ModelSerializationExtensions.WireOptions); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Create or update a file share. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The resource name of the file share, as seen by the administrator through Azure Resource Manager. + /// Resource create parameters. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string resourceName, FileShareData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, resourceName, 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 or update a file share. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The resource name of the file share, as seen by the administrator through Azure Resource Manager. + /// Resource create parameters. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string resourceName, FileShareData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, resourceName, data); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateUpdateRequestUri(string subscriptionId, string resourceGroupName, string resourceName, FileSharePatch patch) + { + 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.FileShares/fileShares/", false); + uri.AppendPath(resourceName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string resourceName, FileSharePatch patch) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Patch; + 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.FileShares/fileShares/", false); + uri.AppendPath(resourceName, 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(patch, ModelSerializationExtensions.WireOptions); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Update a FileShare. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The resource name of the file share, as seen by the administrator through Azure Resource Manager. + /// The resource properties to be updated. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task UpdateAsync(string subscriptionId, string resourceGroupName, string resourceName, FileSharePatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + Argument.AssertNotNull(patch, nameof(patch)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, resourceName, patch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Update a FileShare. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The resource name of the file share, as seen by the administrator through Azure Resource Manager. + /// The resource properties to be updated. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response Update(string subscriptionId, string resourceGroupName, string resourceName, FileSharePatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + Argument.AssertNotNull(patch, nameof(patch)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, resourceName, patch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string resourceGroupName, string resourceName) + { + 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.FileShares/fileShares/", false); + uri.AppendPath(resourceName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string resourceName) + { + 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.FileShares/fileShares/", false); + uri.AppendPath(resourceName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Delete a FileShare. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The resource name of the file share, as seen by the administrator through Azure Resource Manager. + /// 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 resourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, resourceName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Delete a FileShare. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The resource name of the file share, as seen by the administrator through Azure Resource Manager. + /// 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 resourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, resourceName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListBySubscriptionRequestUri(string subscriptionId) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.FileShares/fileShares", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateListBySubscriptionRequest(string subscriptionId) + { + 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("/providers/Microsoft.FileShares/fileShares", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List FileShare resources by subscription ID. + /// The ID of the target subscription. The value must be an UUID. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public async Task> ListBySubscriptionAsync(string subscriptionId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListBySubscriptionRequest(subscriptionId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + FileShareListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = FileShareListResult.DeserializeFileShareListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List FileShare resources by subscription ID. + /// The ID of the target subscription. The value must be an UUID. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public Response ListBySubscription(string subscriptionId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListBySubscriptionRequest(subscriptionId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + FileShareListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = FileShareListResult.DeserializeFileShareListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListByParentRequestUri(string subscriptionId, string resourceGroupName) + { + 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.FileShares/fileShares", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateListByParentRequest(string subscriptionId, string resourceGroupName) + { + 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.FileShares/fileShares", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List FileShare resources by resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public async Task> ListByParentAsync(string subscriptionId, string resourceGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + + using var message = CreateListByParentRequest(subscriptionId, resourceGroupName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + FileShareListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = FileShareListResult.DeserializeFileShareListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List FileShare resources by resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public Response ListByParent(string subscriptionId, string resourceGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + + using var message = CreateListByParentRequest(subscriptionId, resourceGroupName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + FileShareListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = FileShareListResult.DeserializeFileShareListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateCheckNameAvailabilityRequestUri(string subscriptionId, AzureLocation location, CheckNameAvailabilityContent content) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.FileShares/locations/", false); + uri.AppendPath(location, true); + uri.AppendPath("/checkNameAvailability", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateCheckNameAvailabilityRequest(string subscriptionId, AzureLocation location, CheckNameAvailabilityContent content) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.FileShares/locations/", false); + uri.AppendPath(location, true); + uri.AppendPath("/checkNameAvailability", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content0 = new Utf8JsonRequestContent(); + content0.JsonWriter.WriteObjectValue(content, ModelSerializationExtensions.WireOptions); + request.Content = content0; + _userAgent.Apply(message); + return message; + } + + /// Implements local CheckNameAvailability operations. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the Azure region. + /// The CheckAvailability request. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public async Task> CheckNameAvailabilityAsync(string subscriptionId, AzureLocation location, CheckNameAvailabilityContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNull(content, nameof(content)); + + using var message = CreateCheckNameAvailabilityRequest(subscriptionId, location, content); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + CheckNameAvailabilityResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = CheckNameAvailabilityResult.DeserializeCheckNameAvailabilityResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Implements local CheckNameAvailability operations. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the Azure region. + /// The CheckAvailability request. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public Response CheckNameAvailability(string subscriptionId, AzureLocation location, CheckNameAvailabilityContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNull(content, nameof(content)); + + using var message = CreateCheckNameAvailabilityRequest(subscriptionId, location, content); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + CheckNameAvailabilityResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = CheckNameAvailabilityResult.DeserializeCheckNameAvailabilityResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateGetFileShareSnapshotRequestUri(string subscriptionId, string resourceGroupName, string resourceName, string name) + { + 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.FileShares/fileShares/", false); + uri.AppendPath(resourceName, true); + uri.AppendPath("/fileShareSnapshots/", false); + uri.AppendPath(name, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateGetFileShareSnapshotRequest(string subscriptionId, string resourceGroupName, string resourceName, string name) + { + 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.FileShares/fileShares/", false); + uri.AppendPath(resourceName, true); + uri.AppendPath("/fileShareSnapshots/", false); + uri.AppendPath(name, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get a FileShareSnapshot. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The resource name of the file share, as seen by the administrator through Azure Resource Manager. + /// The name of the FileShareSnapshot. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> GetFileShareSnapshotAsync(string subscriptionId, string resourceGroupName, string resourceName, string name, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var message = CreateGetFileShareSnapshotRequest(subscriptionId, resourceGroupName, resourceName, name); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + FileShareSnapshotData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = FileShareSnapshotData.DeserializeFileShareSnapshotData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((FileShareSnapshotData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get a FileShareSnapshot. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The resource name of the file share, as seen by the administrator through Azure Resource Manager. + /// The name of the FileShareSnapshot. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response GetFileShareSnapshot(string subscriptionId, string resourceGroupName, string resourceName, string name, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var message = CreateGetFileShareSnapshotRequest(subscriptionId, resourceGroupName, resourceName, name); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + FileShareSnapshotData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = FileShareSnapshotData.DeserializeFileShareSnapshotData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((FileShareSnapshotData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateCreateOrUpdateFileShareSnapshotRequestUri(string subscriptionId, string resourceGroupName, string resourceName, string name, FileShareSnapshotData data) + { + 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.FileShares/fileShares/", false); + uri.AppendPath(resourceName, true); + uri.AppendPath("/fileShareSnapshots/", false); + uri.AppendPath(name, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateCreateOrUpdateFileShareSnapshotRequest(string subscriptionId, string resourceGroupName, string resourceName, string name, FileShareSnapshotData 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.FileShares/fileShares/", false); + uri.AppendPath(resourceName, true); + uri.AppendPath("/fileShareSnapshots/", false); + uri.AppendPath(name, 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, ModelSerializationExtensions.WireOptions); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Create a FileShareSnapshot. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The resource name of the file share, as seen by the administrator through Azure Resource Manager. + /// The name of the FileShareSnapshot. + /// Resource create parameters. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> CreateOrUpdateFileShareSnapshotAsync(string subscriptionId, string resourceGroupName, string resourceName, string name, FileShareSnapshotData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + Argument.AssertNotNullOrEmpty(name, nameof(name)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateFileShareSnapshotRequest(subscriptionId, resourceGroupName, resourceName, name, data); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + { + FileShareSnapshotData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = FileShareSnapshotData.DeserializeFileShareSnapshotData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Create a FileShareSnapshot. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The resource name of the file share, as seen by the administrator through Azure Resource Manager. + /// The name of the FileShareSnapshot. + /// Resource create parameters. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response CreateOrUpdateFileShareSnapshot(string subscriptionId, string resourceGroupName, string resourceName, string name, FileShareSnapshotData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + Argument.AssertNotNullOrEmpty(name, nameof(name)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateFileShareSnapshotRequest(subscriptionId, resourceGroupName, resourceName, name, data); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + { + FileShareSnapshotData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = FileShareSnapshotData.DeserializeFileShareSnapshotData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateUpdateFileShareSnapshotRequestUri(string subscriptionId, string resourceGroupName, string resourceName, string name, FileShareSnapshotPatch patch) + { + 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.FileShares/fileShares/", false); + uri.AppendPath(resourceName, true); + uri.AppendPath("/fileShareSnapshots/", false); + uri.AppendPath(name, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateUpdateFileShareSnapshotRequest(string subscriptionId, string resourceGroupName, string resourceName, string name, FileShareSnapshotPatch patch) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Patch; + 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.FileShares/fileShares/", false); + uri.AppendPath(resourceName, true); + uri.AppendPath("/fileShareSnapshots/", false); + uri.AppendPath(name, 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(patch, ModelSerializationExtensions.WireOptions); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Update a FileShareSnapshot. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The resource name of the file share, as seen by the administrator through Azure Resource Manager. + /// The name of the FileShareSnapshot. + /// The resource properties to be updated. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task UpdateFileShareSnapshotAsync(string subscriptionId, string resourceGroupName, string resourceName, string name, FileShareSnapshotPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + Argument.AssertNotNullOrEmpty(name, nameof(name)); + Argument.AssertNotNull(patch, nameof(patch)); + + using var message = CreateUpdateFileShareSnapshotRequest(subscriptionId, resourceGroupName, resourceName, name, patch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Update a FileShareSnapshot. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The resource name of the file share, as seen by the administrator through Azure Resource Manager. + /// The name of the FileShareSnapshot. + /// The resource properties to be updated. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response UpdateFileShareSnapshot(string subscriptionId, string resourceGroupName, string resourceName, string name, FileShareSnapshotPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + Argument.AssertNotNullOrEmpty(name, nameof(name)); + Argument.AssertNotNull(patch, nameof(patch)); + + using var message = CreateUpdateFileShareSnapshotRequest(subscriptionId, resourceGroupName, resourceName, name, patch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateDeleteFileShareSnapshotRequestUri(string subscriptionId, string resourceGroupName, string resourceName, string name) + { + 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.FileShares/fileShares/", false); + uri.AppendPath(resourceName, true); + uri.AppendPath("/fileShareSnapshots/", false); + uri.AppendPath(name, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateDeleteFileShareSnapshotRequest(string subscriptionId, string resourceGroupName, string resourceName, string name) + { + 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.FileShares/fileShares/", false); + uri.AppendPath(resourceName, true); + uri.AppendPath("/fileShareSnapshots/", false); + uri.AppendPath(name, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Delete a FileShareSnapshot. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The resource name of the file share, as seen by the administrator through Azure Resource Manager. + /// The name of the FileShareSnapshot. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task DeleteFileShareSnapshotAsync(string subscriptionId, string resourceGroupName, string resourceName, string name, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var message = CreateDeleteFileShareSnapshotRequest(subscriptionId, resourceGroupName, resourceName, name); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Delete a FileShareSnapshot. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The resource name of the file share, as seen by the administrator through Azure Resource Manager. + /// The name of the FileShareSnapshot. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response DeleteFileShareSnapshot(string subscriptionId, string resourceGroupName, string resourceName, string name, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var message = CreateDeleteFileShareSnapshotRequest(subscriptionId, resourceGroupName, resourceName, name); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListByFileShareRequestUri(string subscriptionId, string resourceGroupName, string resourceName) + { + 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.FileShares/fileShares/", false); + uri.AppendPath(resourceName, true); + uri.AppendPath("/fileShareSnapshots", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateListByFileShareRequest(string subscriptionId, string resourceGroupName, string resourceName) + { + 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.FileShares/fileShares/", false); + uri.AppendPath(resourceName, true); + uri.AppendPath("/fileShareSnapshots", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List FileShareSnapshot by FileShare. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The resource name of the file share, as seen by the administrator through Azure Resource Manager. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListByFileShareAsync(string subscriptionId, string resourceGroupName, string resourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + + using var message = CreateListByFileShareRequest(subscriptionId, resourceGroupName, resourceName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + FileShareSnapshotListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = FileShareSnapshotListResult.DeserializeFileShareSnapshotListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List FileShareSnapshot by FileShare. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The resource name of the file share, as seen by the administrator through Azure Resource Manager. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListByFileShare(string subscriptionId, string resourceGroupName, string resourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + + using var message = CreateListByFileShareRequest(subscriptionId, resourceGroupName, resourceName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + FileShareSnapshotListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = FileShareSnapshotListResult.DeserializeFileShareSnapshotListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListBySubscriptionNextPageRequestUri(string nextLink, string subscriptionId) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + return uri; + } + + internal HttpMessage CreateListBySubscriptionNextPageRequest(string nextLink, string subscriptionId) + { + 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 FileShare resources by subscription ID. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public async Task> ListBySubscriptionNextPageAsync(string nextLink, string subscriptionId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListBySubscriptionNextPageRequest(nextLink, subscriptionId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + FileShareListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = FileShareListResult.DeserializeFileShareListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List FileShare resources by subscription ID. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public Response ListBySubscriptionNextPage(string nextLink, string subscriptionId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListBySubscriptionNextPageRequest(nextLink, subscriptionId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + FileShareListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = FileShareListResult.DeserializeFileShareListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListByParentNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + return uri; + } + + internal HttpMessage CreateListByParentNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName) + { + 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 FileShare resources by resource group. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The cancellation token to use. + /// , or is null. + /// or is an empty string, and was expected to be non-empty. + public async Task> ListByParentNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + + using var message = CreateListByParentNextPageRequest(nextLink, subscriptionId, resourceGroupName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + FileShareListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = FileShareListResult.DeserializeFileShareListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List FileShare resources by resource group. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The cancellation token to use. + /// , or is null. + /// or is an empty string, and was expected to be non-empty. + public Response ListByParentNextPage(string nextLink, string subscriptionId, string resourceGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + + using var message = CreateListByParentNextPageRequest(nextLink, subscriptionId, resourceGroupName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + FileShareListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = FileShareListResult.DeserializeFileShareListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListByFileShareNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, string resourceName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + return uri; + } + + internal HttpMessage CreateListByFileShareNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string resourceName) + { + 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 FileShareSnapshot by FileShare. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The resource name of the file share, as seen by the administrator through Azure Resource Manager. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListByFileShareNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string resourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + + using var message = CreateListByFileShareNextPageRequest(nextLink, subscriptionId, resourceGroupName, resourceName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + FileShareSnapshotListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = FileShareSnapshotListResult.DeserializeFileShareSnapshotListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List FileShareSnapshot by FileShare. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The resource name of the file share, as seen by the administrator through Azure Resource Manager. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListByFileShareNextPage(string nextLink, string subscriptionId, string resourceGroupName, string resourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + + using var message = CreateListByFileShareNextPageRequest(nextLink, subscriptionId, resourceGroupName, resourceName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + FileShareSnapshotListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = FileShareSnapshotListResult.DeserializeFileShareSnapshotListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/RestOperations/OperationsRestOperations.cs b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/RestOperations/OperationsRestOperations.cs new file mode 100644 index 000000000000..c8c0f3e18bff --- /dev/null +++ b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Generated/RestOperations/OperationsRestOperations.cs @@ -0,0 +1,173 @@ +// 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.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Fileshares.Models; + +namespace Azure.ResourceManager.Fileshares +{ + internal partial class OperationsRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of OperationsRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// Service host. + /// The API version to use for this operation. + /// or is null. + public OperationsRestOperations(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 ?? "2024-01-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal RequestUriBuilder CreateListRequestUri() + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/providers/Microsoft.FileShares/operations", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateListRequest() + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/providers/Microsoft.FileShares/operations", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List the operations for the provider. + /// The cancellation token to use. + public async Task> ListAsync(CancellationToken cancellationToken = default) + { + using var message = CreateListRequest(); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + OperationListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = OperationListResult.DeserializeOperationListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List the operations for the provider. + /// The cancellation token to use. + public Response List(CancellationToken cancellationToken = default) + { + using var message = CreateListRequest(); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + OperationListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = OperationListResult.DeserializeOperationListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListNextPageRequestUri(string nextLink) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + return uri; + } + + internal HttpMessage CreateListNextPageRequest(string nextLink) + { + 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 the operations for the provider. + /// The URL to the next page of results. + /// The cancellation token to use. + /// is null. + public async Task> ListNextPageAsync(string nextLink, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + + using var message = CreateListNextPageRequest(nextLink); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + OperationListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = OperationListResult.DeserializeOperationListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List the operations for the provider. + /// The URL to the next page of results. + /// The cancellation token to use. + /// is null. + public Response ListNextPage(string nextLink, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + + using var message = CreateListNextPageRequest(nextLink); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + OperationListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = OperationListResult.DeserializeOperationListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Properties/AssemblyInfo.cs b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Properties/AssemblyInfo.cs new file mode 100644 index 000000000000..dd9245c45429 --- /dev/null +++ b/sdk/fileshares/Azure.ResourceManager.Fileshares/src/Properties/AssemblyInfo.cs @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System.Runtime.CompilerServices; + +[assembly: InternalsVisibleTo("Azure.ResourceManager.Fileshares.Tests, PublicKey = 0024000004800000940000000602000000240000525341310004000001000100d15ddcb29688295338af4b7686603fe614abd555e09efba8fb88ee09e1f7b1ccaeed2e8f823fa9eef3fdd60217fc012ea67d2479751a0b8c087a4185541b851bd8b16f8d91b840e51b1cb0ba6fe647997e57429265e85ef62d565db50a69ae1647d54d7bd855e4db3d8a91510e5bcbd0edfbbecaa20a7bd9ae74593daa7b11b4")] + +// Replace Microsoft.Test with the correct resource provider namepace for your service and uncomment. +// See https://docs.microsoft.com/en-us/azure/azure-resource-manager/management/azure-services-resource-providers +// for the list of possible values. +[assembly: Azure.Core.AzureResourceProviderNamespace("Fileshares")] diff --git a/sdk/fileshares/Azure.ResourceManager.Fileshares/tests/Azure.ResourceManager.Fileshares.Tests.csproj b/sdk/fileshares/Azure.ResourceManager.Fileshares/tests/Azure.ResourceManager.Fileshares.Tests.csproj new file mode 100644 index 000000000000..fd34baa633b0 --- /dev/null +++ b/sdk/fileshares/Azure.ResourceManager.Fileshares/tests/Azure.ResourceManager.Fileshares.Tests.csproj @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/sdk/fileshares/Azure.ResourceManager.Fileshares/tests/FilesharesManagementTestBase.cs b/sdk/fileshares/Azure.ResourceManager.Fileshares/tests/FilesharesManagementTestBase.cs new file mode 100644 index 000000000000..212b5b49a331 --- /dev/null +++ b/sdk/fileshares/Azure.ResourceManager.Fileshares/tests/FilesharesManagementTestBase.cs @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using Azure; +using Azure.Core; +using Azure.Core.TestFramework; +using Azure.ResourceManager; +using Azure.ResourceManager.Resources; +using Azure.ResourceManager.TestFramework; +using NUnit.Framework; +using System.Threading.Tasks; + +namespace Azure.ResourceManager.Fileshares.Tests +{ + public class FilesharesManagementTestBase : ManagementRecordedTestBase + { + protected ArmClient Client { get; private set; } + protected SubscriptionResource DefaultSubscription { get; private set; } + + protected FilesharesManagementTestBase(bool isAsync, RecordedTestMode mode) + : base(isAsync, mode) + { + } + + protected FilesharesManagementTestBase(bool isAsync) + : base(isAsync) + { + } + + [SetUp] + public async Task CreateCommonClient() + { + Client = GetArmClient(); + DefaultSubscription = await Client.GetDefaultSubscriptionAsync().ConfigureAwait(false); + } + + protected async Task CreateResourceGroup(SubscriptionResource subscription, string rgNamePrefix, AzureLocation location) + { + string rgName = Recording.GenerateAssetName(rgNamePrefix); + ResourceGroupData input = new ResourceGroupData(location); + var lro = await subscription.GetResourceGroups().CreateOrUpdateAsync(WaitUntil.Completed, rgName, input); + return lro.Value; + } + } +} diff --git a/sdk/fileshares/Azure.ResourceManager.Fileshares/tests/FilesharesManagementTestEnvironment.cs b/sdk/fileshares/Azure.ResourceManager.Fileshares/tests/FilesharesManagementTestEnvironment.cs new file mode 100644 index 000000000000..7f4c2a03a323 --- /dev/null +++ b/sdk/fileshares/Azure.ResourceManager.Fileshares/tests/FilesharesManagementTestEnvironment.cs @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using Azure.Core.TestFramework; + +namespace Azure.ResourceManager.Fileshares.Tests +{ + public class FilesharesManagementTestEnvironment : TestEnvironment + { + } +} diff --git a/sdk/fileshares/Azure.ResourceManager.Fileshares/tsp-location.yaml b/sdk/fileshares/Azure.ResourceManager.Fileshares/tsp-location.yaml new file mode 100644 index 000000000000..d0035f67ffae --- /dev/null +++ b/sdk/fileshares/Azure.ResourceManager.Fileshares/tsp-location.yaml @@ -0,0 +1,4 @@ +directory: specification/fileshares/FileShares.Management +commit: 10678c182980043df9e9bb514ac859467f5ecc42 +repo: Azure/azure-rest-api-specs +additionalDirectories: diff --git a/sdk/fileshares/ci.mgmt.yml b/sdk/fileshares/ci.mgmt.yml new file mode 100644 index 000000000000..e9748c6edfd2 --- /dev/null +++ b/sdk/fileshares/ci.mgmt.yml @@ -0,0 +1,26 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. + +trigger: none + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/fileshares /ci.mgmt.yml + - sdk/fileshares /Azure.ResourceManager.Fileshares / + + +extends: + template: /eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: fileshares + ArtifactName: packages + LimitForPullRequest: true + Artifacts: + - name: Azure.ResourceManager.Fileshares + safeName: AzureResourceManagerFileshares diff --git a/sdk/resourcemanager/ci.mgmt.yml b/sdk/resourcemanager/ci.mgmt.yml index 9ae0a7e75290..2a25c2f22c3b 100644 --- a/sdk/resourcemanager/ci.mgmt.yml +++ b/sdk/resourcemanager/ci.mgmt.yml @@ -90,6 +90,7 @@ trigger: - sdk/eventhub/Azure.ResourceManager.EventHubs - sdk/extendedlocation/Azure.ResourceManager.ExtendedLocations - sdk/fabric/Azure.ResourceManager.Fabric + - sdk/fileshares/Azure.ResourceManager.Fileshares - sdk/fleet/Azure.ResourceManager.ContainerServiceFleet - sdk/fluidrelay/Azure.ResourceManager.FluidRelay - sdk/frontdoor/Azure.ResourceManager.FrontDoor @@ -306,6 +307,7 @@ pr: - sdk/eventhub/Azure.ResourceManager.EventHubs - sdk/extendedlocation/Azure.ResourceManager.ExtendedLocations - sdk/fabric/Azure.ResourceManager.Fabric + - sdk/fileshares/Azure.ResourceManager.Fileshares - sdk/fleet/Azure.ResourceManager.ContainerServiceFleet - sdk/fluidrelay/Azure.ResourceManager.FluidRelay - sdk/frontdoor/Azure.ResourceManager.FrontDoor diff --git a/sdk/storage/ci.yml b/sdk/storage/ci.yml index 2ca0501b60bd..4e749e6b85b1 100644 --- a/sdk/storage/ci.yml +++ b/sdk/storage/ci.yml @@ -12,6 +12,8 @@ trigger: - sdk/storage/Azure.Storage.DataMovement/ - sdk/storage/Azure.Storage.DataMovement.Blobs/ - sdk/storage/Azure.Storage.DataMovement.Files/ + exclude: + - sdk/storage/Azure.ResourceManager.Storage/ - sdk/storage/Azure.Storage.DataMovement.Blobs.Files.Shares/ exclude: - sdk/storage/Azure.ResourceManager.Storage/