diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/Azure.ResourceManager.HybridNetwork.sln b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/Azure.ResourceManager.HybridNetwork.sln new file mode 100644 index 000000000000..4f167b8127c5 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/Azure.ResourceManager.HybridNetwork.sln @@ -0,0 +1,65 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.7.34031.279 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.ResourceManager.HybridNetwork", "src\Azure.ResourceManager.HybridNetwork.csproj", "{E72C9DBA-B4E0-4CCE-9C67-0A86653E37B6}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.ResourceManager.HybridNetwork.Tests", "tests\Azure.ResourceManager.HybridNetwork.Tests.csproj", "{0DA1D992-22DA-41D2-A677-0735E6FAB7B0}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.ResourceManager.HybridNetwork.Samples", "samples\Azure.ResourceManager.HybridNetwork.Samples.csproj", "{E47361C6-0DD0-49CC-9359-13955426D0F7}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|Any CPU = Release|Any CPU + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {E72C9DBA-B4E0-4CCE-9C67-0A86653E37B6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E72C9DBA-B4E0-4CCE-9C67-0A86653E37B6}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E72C9DBA-B4E0-4CCE-9C67-0A86653E37B6}.Debug|x64.ActiveCfg = Debug|Any CPU + {E72C9DBA-B4E0-4CCE-9C67-0A86653E37B6}.Debug|x64.Build.0 = Debug|Any CPU + {E72C9DBA-B4E0-4CCE-9C67-0A86653E37B6}.Debug|x86.ActiveCfg = Debug|Any CPU + {E72C9DBA-B4E0-4CCE-9C67-0A86653E37B6}.Debug|x86.Build.0 = Debug|Any CPU + {E72C9DBA-B4E0-4CCE-9C67-0A86653E37B6}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E72C9DBA-B4E0-4CCE-9C67-0A86653E37B6}.Release|Any CPU.Build.0 = Release|Any CPU + {E72C9DBA-B4E0-4CCE-9C67-0A86653E37B6}.Release|x64.ActiveCfg = Release|Any CPU + {E72C9DBA-B4E0-4CCE-9C67-0A86653E37B6}.Release|x64.Build.0 = Release|Any CPU + {E72C9DBA-B4E0-4CCE-9C67-0A86653E37B6}.Release|x86.ActiveCfg = Release|Any CPU + {E72C9DBA-B4E0-4CCE-9C67-0A86653E37B6}.Release|x86.Build.0 = Release|Any CPU + {0DA1D992-22DA-41D2-A677-0735E6FAB7B0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0DA1D992-22DA-41D2-A677-0735E6FAB7B0}.Debug|Any CPU.Build.0 = Debug|Any CPU + {0DA1D992-22DA-41D2-A677-0735E6FAB7B0}.Debug|x64.ActiveCfg = Debug|Any CPU + {0DA1D992-22DA-41D2-A677-0735E6FAB7B0}.Debug|x64.Build.0 = Debug|Any CPU + {0DA1D992-22DA-41D2-A677-0735E6FAB7B0}.Debug|x86.ActiveCfg = Debug|Any CPU + {0DA1D992-22DA-41D2-A677-0735E6FAB7B0}.Debug|x86.Build.0 = Debug|Any CPU + {0DA1D992-22DA-41D2-A677-0735E6FAB7B0}.Release|Any CPU.ActiveCfg = Release|Any CPU + {0DA1D992-22DA-41D2-A677-0735E6FAB7B0}.Release|Any CPU.Build.0 = Release|Any CPU + {0DA1D992-22DA-41D2-A677-0735E6FAB7B0}.Release|x64.ActiveCfg = Release|Any CPU + {0DA1D992-22DA-41D2-A677-0735E6FAB7B0}.Release|x64.Build.0 = Release|Any CPU + {0DA1D992-22DA-41D2-A677-0735E6FAB7B0}.Release|x86.ActiveCfg = Release|Any CPU + {0DA1D992-22DA-41D2-A677-0735E6FAB7B0}.Release|x86.Build.0 = Release|Any CPU + {E47361C6-0DD0-49CC-9359-13955426D0F7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E47361C6-0DD0-49CC-9359-13955426D0F7}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E47361C6-0DD0-49CC-9359-13955426D0F7}.Debug|x64.ActiveCfg = Debug|Any CPU + {E47361C6-0DD0-49CC-9359-13955426D0F7}.Debug|x64.Build.0 = Debug|Any CPU + {E47361C6-0DD0-49CC-9359-13955426D0F7}.Debug|x86.ActiveCfg = Debug|Any CPU + {E47361C6-0DD0-49CC-9359-13955426D0F7}.Debug|x86.Build.0 = Debug|Any CPU + {E47361C6-0DD0-49CC-9359-13955426D0F7}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E47361C6-0DD0-49CC-9359-13955426D0F7}.Release|Any CPU.Build.0 = Release|Any CPU + {E47361C6-0DD0-49CC-9359-13955426D0F7}.Release|x64.ActiveCfg = Release|Any CPU + {E47361C6-0DD0-49CC-9359-13955426D0F7}.Release|x64.Build.0 = Release|Any CPU + {E47361C6-0DD0-49CC-9359-13955426D0F7}.Release|x86.ActiveCfg = Release|Any CPU + {E47361C6-0DD0-49CC-9359-13955426D0F7}.Release|x86.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {53195F07-6A9F-44C3-B0D2-3380769A7E2C} + EndGlobalSection +EndGlobal diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/CHANGELOG.md b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/CHANGELOG.md new file mode 100644 index 000000000000..23f86d1e896e --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/CHANGELOG.md @@ -0,0 +1,17 @@ +# Release History + +## 1.0.0-beta.1 (Unreleased) + +### General New Features + +This package 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. + +This package is a Public Preview version, so expect incompatible changes in subsequent releases as we improve the product. To provide feedback, submit an issue in our [Azure SDK for .NET GitHub repo](https://github.com/Azure/azure-sdk-for-net/issues). + +> NOTE: For more information about unified authentication, please refer to [Microsoft Azure Identity documentation for .NET](https://docs.microsoft.com//dotnet/api/overview/azure/identity-readme?view=azure-dotnet). \ No newline at end of file diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/Directory.Build.props b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/Directory.Build.props new file mode 100644 index 000000000000..1a9611bd4924 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/Directory.Build.props @@ -0,0 +1,6 @@ + + + + diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/README.md b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/README.md new file mode 100644 index 000000000000..087ebd730e3c --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/README.md @@ -0,0 +1,80 @@ +# Microsoft Azure HybridNetwork 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 HybridNetwork management library for .NET with [NuGet](https://www.nuget.org/): + +```dotnetcli +dotnet add package Azure.ResourceManager.HybridNetwork --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://docs.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/hybridnetwork/Azure.ResourceManager.HybridNetwork/api/Azure.ResourceManager.HybridNetwork.netstandard2.0.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/api/Azure.ResourceManager.HybridNetwork.netstandard2.0.cs new file mode 100644 index 000000000000..dc257ad0bfcd --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/api/Azure.ResourceManager.HybridNetwork.netstandard2.0.cs @@ -0,0 +1,1624 @@ +namespace Azure.ResourceManager.HybridNetwork +{ + public partial class ArtifactManifestCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected ArtifactManifestCollection() { } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string artifactManifestName, Azure.ResourceManager.HybridNetwork.ArtifactManifestData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(Azure.WaitUntil waitUntil, string artifactManifestName, Azure.ResourceManager.HybridNetwork.ArtifactManifestData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Exists(string artifactManifestName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string artifactManifestName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string artifactManifestName, 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 artifactManifestName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.NullableResponse GetIfExists(string artifactManifestName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string artifactManifestName, 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 ArtifactManifestData : Azure.ResourceManager.Models.TrackedResourceData + { + public ArtifactManifestData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public Azure.ResourceManager.HybridNetwork.Models.ArtifactManifestPropertiesFormat Properties { get { throw null; } set { } } + } + public partial class ArtifactManifestResource : Azure.ResourceManager.ArmResource + { + public static readonly Azure.Core.ResourceType ResourceType; + protected ArtifactManifestResource() { } + public virtual Azure.ResourceManager.HybridNetwork.ArtifactManifestData 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 publisherName, string artifactStoreName, string artifactManifestName) { 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 GetCredential(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetCredentialAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { 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; } + public virtual Azure.Response Update(Azure.ResourceManager.HybridNetwork.Models.TagsObject tagsObject, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.ResourceManager.HybridNetwork.Models.TagsObject tagsObject, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.ArmOperation UpdateState(Azure.WaitUntil waitUntil, Azure.ResourceManager.HybridNetwork.Models.ArtifactManifestUpdateState artifactManifestUpdateState, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateStateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.HybridNetwork.Models.ArtifactManifestUpdateState artifactManifestUpdateState, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class ArtifactStoreCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected ArtifactStoreCollection() { } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string artifactStoreName, Azure.ResourceManager.HybridNetwork.ArtifactStoreData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(Azure.WaitUntil waitUntil, string artifactStoreName, Azure.ResourceManager.HybridNetwork.ArtifactStoreData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Exists(string artifactStoreName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string artifactStoreName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string artifactStoreName, 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 artifactStoreName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.NullableResponse GetIfExists(string artifactStoreName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string artifactStoreName, 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 ArtifactStoreData : Azure.ResourceManager.Models.TrackedResourceData + { + public ArtifactStoreData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public Azure.ResourceManager.HybridNetwork.Models.ArtifactStorePropertiesFormat Properties { get { throw null; } set { } } + } + public partial class ArtifactStoreResource : Azure.ResourceManager.ArmResource + { + public static readonly Azure.Core.ResourceType ResourceType; + protected ArtifactStoreResource() { } + public virtual Azure.ResourceManager.HybridNetwork.ArtifactStoreData 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 publisherName, string artifactStoreName) { 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 Azure.Response GetArtifactManifest(string artifactManifestName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetArtifactManifestAsync(string artifactManifestName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.HybridNetwork.ArtifactManifestCollection GetArtifactManifests() { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetProxyArtifacts(string artifactName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetProxyArtifacts(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetProxyArtifactsAsync(string artifactName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetProxyArtifactsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { 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; } + public virtual Azure.Response Update(Azure.ResourceManager.HybridNetwork.Models.TagsObject tagsObject, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.ResourceManager.HybridNetwork.Models.TagsObject tagsObject, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.ArmOperation UpdateStateProxyArtifact(Azure.WaitUntil waitUntil, string artifactVersionName, string artifactName, Azure.ResourceManager.HybridNetwork.Models.ArtifactChangeState artifactChangeState, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateStateProxyArtifactAsync(Azure.WaitUntil waitUntil, string artifactVersionName, string artifactName, Azure.ResourceManager.HybridNetwork.Models.ArtifactChangeState artifactChangeState, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class ComponentCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected ComponentCollection() { } + public virtual Azure.Response Exists(string componentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string componentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string componentName, 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 componentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.NullableResponse GetIfExists(string componentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string componentName, 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 ComponentData : Azure.ResourceManager.Models.ResourceData + { + public ComponentData() { } + public Azure.ResourceManager.HybridNetwork.Models.ComponentProperties Properties { get { throw null; } set { } } + } + public partial class ComponentResource : Azure.ResourceManager.ArmResource + { + public static readonly Azure.Core.ResourceType ResourceType; + protected ComponentResource() { } + public virtual Azure.ResourceManager.HybridNetwork.ComponentData Data { get { throw null; } } + public virtual bool HasData { get { throw null; } } + public static Azure.Core.ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string networkFunctionName, string componentName) { 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 partial class ConfigurationGroupSchemaCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected ConfigurationGroupSchemaCollection() { } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string configurationGroupSchemaName, Azure.ResourceManager.HybridNetwork.ConfigurationGroupSchemaData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(Azure.WaitUntil waitUntil, string configurationGroupSchemaName, Azure.ResourceManager.HybridNetwork.ConfigurationGroupSchemaData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Exists(string configurationGroupSchemaName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string configurationGroupSchemaName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string configurationGroupSchemaName, 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 configurationGroupSchemaName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.NullableResponse GetIfExists(string configurationGroupSchemaName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string configurationGroupSchemaName, 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 ConfigurationGroupSchemaData : Azure.ResourceManager.Models.TrackedResourceData + { + public ConfigurationGroupSchemaData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public Azure.ResourceManager.HybridNetwork.Models.ConfigurationGroupSchemaPropertiesFormat Properties { get { throw null; } set { } } + } + public partial class ConfigurationGroupSchemaResource : Azure.ResourceManager.ArmResource + { + public static readonly Azure.Core.ResourceType ResourceType; + protected ConfigurationGroupSchemaResource() { } + public virtual Azure.ResourceManager.HybridNetwork.ConfigurationGroupSchemaData 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 publisherName, string configurationGroupSchemaName) { 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 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; } + public virtual Azure.Response Update(Azure.ResourceManager.HybridNetwork.Models.TagsObject tagsObject, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.ResourceManager.HybridNetwork.Models.TagsObject tagsObject, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.ArmOperation UpdateState(Azure.WaitUntil waitUntil, Azure.ResourceManager.HybridNetwork.Models.ConfigurationGroupSchemaVersionUpdateState configurationGroupSchemaVersionUpdateState, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateStateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.HybridNetwork.Models.ConfigurationGroupSchemaVersionUpdateState configurationGroupSchemaVersionUpdateState, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class ConfigurationGroupValueCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected ConfigurationGroupValueCollection() { } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string configurationGroupValueName, Azure.ResourceManager.HybridNetwork.ConfigurationGroupValueData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(Azure.WaitUntil waitUntil, string configurationGroupValueName, Azure.ResourceManager.HybridNetwork.ConfigurationGroupValueData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Exists(string configurationGroupValueName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string configurationGroupValueName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string configurationGroupValueName, 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 configurationGroupValueName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.NullableResponse GetIfExists(string configurationGroupValueName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string configurationGroupValueName, 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 ConfigurationGroupValueData : Azure.ResourceManager.Models.TrackedResourceData + { + public ConfigurationGroupValueData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public Azure.ResourceManager.HybridNetwork.Models.ConfigurationGroupValuePropertiesFormat Properties { get { throw null; } set { } } + } + public partial class ConfigurationGroupValueResource : Azure.ResourceManager.ArmResource + { + public static readonly Azure.Core.ResourceType ResourceType; + protected ConfigurationGroupValueResource() { } + public virtual Azure.ResourceManager.HybridNetwork.ConfigurationGroupValueData 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 configurationGroupValueName) { 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 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; } + public virtual Azure.Response Update(Azure.ResourceManager.HybridNetwork.Models.TagsObject tagsObject, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.ResourceManager.HybridNetwork.Models.TagsObject tagsObject, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public static partial class HybridNetworkExtensions + { + public static Azure.ResourceManager.HybridNetwork.ArtifactManifestResource GetArtifactManifestResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.ResourceManager.HybridNetwork.ArtifactStoreResource GetArtifactStoreResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.ResourceManager.HybridNetwork.ComponentResource GetComponentResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.ResourceManager.HybridNetwork.ConfigurationGroupSchemaResource GetConfigurationGroupSchemaResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.Response GetConfigurationGroupValue(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string configurationGroupValueName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static System.Threading.Tasks.Task> GetConfigurationGroupValueAsync(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string configurationGroupValueName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.ResourceManager.HybridNetwork.ConfigurationGroupValueResource GetConfigurationGroupValueResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.ResourceManager.HybridNetwork.ConfigurationGroupValueCollection GetConfigurationGroupValues(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource) { throw null; } + public static Azure.Pageable GetConfigurationGroupValues(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.AsyncPageable GetConfigurationGroupValuesAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.Response GetNetworkFunction(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string networkFunctionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static System.Threading.Tasks.Task> GetNetworkFunctionAsync(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string networkFunctionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.ResourceManager.HybridNetwork.NetworkFunctionDefinitionGroupResource GetNetworkFunctionDefinitionGroupResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.ResourceManager.HybridNetwork.NetworkFunctionDefinitionVersionResource GetNetworkFunctionDefinitionVersionResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.ResourceManager.HybridNetwork.NetworkFunctionResource GetNetworkFunctionResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.ResourceManager.HybridNetwork.NetworkFunctionCollection GetNetworkFunctions(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource) { throw null; } + public static Azure.Pageable GetNetworkFunctions(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.AsyncPageable GetNetworkFunctionsAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.ResourceManager.HybridNetwork.NetworkServiceDesignGroupResource GetNetworkServiceDesignGroupResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.ResourceManager.HybridNetwork.NetworkServiceDesignVersionResource GetNetworkServiceDesignVersionResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.Response GetPublisher(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string publisherName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static System.Threading.Tasks.Task> GetPublisherAsync(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string publisherName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.ResourceManager.HybridNetwork.PublisherResource GetPublisherResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.ResourceManager.HybridNetwork.PublisherCollection GetPublishers(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource) { throw null; } + public static Azure.Pageable GetPublishers(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.AsyncPageable GetPublishersAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.Response GetSite(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string siteName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static System.Threading.Tasks.Task> GetSiteAsync(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string siteName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.Response GetSiteNetworkService(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string siteNetworkServiceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static System.Threading.Tasks.Task> GetSiteNetworkServiceAsync(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string siteNetworkServiceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.ResourceManager.HybridNetwork.SiteNetworkServiceResource GetSiteNetworkServiceResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.ResourceManager.HybridNetwork.SiteNetworkServiceCollection GetSiteNetworkServices(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource) { throw null; } + public static Azure.Pageable GetSiteNetworkServices(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.AsyncPageable GetSiteNetworkServicesAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.ResourceManager.HybridNetwork.SiteResource GetSiteResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.ResourceManager.HybridNetwork.SiteCollection GetSites(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource) { throw null; } + public static Azure.Pageable GetSites(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.AsyncPageable GetSitesAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class NetworkFunctionCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected NetworkFunctionCollection() { } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string networkFunctionName, Azure.ResourceManager.HybridNetwork.NetworkFunctionData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(Azure.WaitUntil waitUntil, string networkFunctionName, Azure.ResourceManager.HybridNetwork.NetworkFunctionData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Exists(string networkFunctionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string networkFunctionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string networkFunctionName, 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 networkFunctionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.NullableResponse GetIfExists(string networkFunctionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string networkFunctionName, 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 NetworkFunctionData : Azure.ResourceManager.Models.TrackedResourceData + { + public NetworkFunctionData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public Azure.ETag? ETag { get { throw null; } set { } } + public Azure.ResourceManager.Models.ManagedServiceIdentity Identity { get { throw null; } set { } } + public Azure.ResourceManager.HybridNetwork.Models.NetworkFunctionPropertiesFormat Properties { get { throw null; } set { } } + } + public partial class NetworkFunctionDefinitionGroupCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected NetworkFunctionDefinitionGroupCollection() { } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string networkFunctionDefinitionGroupName, Azure.ResourceManager.HybridNetwork.NetworkFunctionDefinitionGroupData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(Azure.WaitUntil waitUntil, string networkFunctionDefinitionGroupName, Azure.ResourceManager.HybridNetwork.NetworkFunctionDefinitionGroupData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Exists(string networkFunctionDefinitionGroupName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string networkFunctionDefinitionGroupName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string networkFunctionDefinitionGroupName, 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 networkFunctionDefinitionGroupName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.NullableResponse GetIfExists(string networkFunctionDefinitionGroupName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string networkFunctionDefinitionGroupName, 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 NetworkFunctionDefinitionGroupData : Azure.ResourceManager.Models.TrackedResourceData + { + public NetworkFunctionDefinitionGroupData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public Azure.ResourceManager.HybridNetwork.Models.NetworkFunctionDefinitionGroupPropertiesFormat Properties { get { throw null; } set { } } + } + public partial class NetworkFunctionDefinitionGroupResource : Azure.ResourceManager.ArmResource + { + public static readonly Azure.Core.ResourceType ResourceType; + protected NetworkFunctionDefinitionGroupResource() { } + public virtual Azure.ResourceManager.HybridNetwork.NetworkFunctionDefinitionGroupData 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 publisherName, string networkFunctionDefinitionGroupName) { 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 GetNetworkFunctionDefinitionVersion(string networkFunctionDefinitionVersionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetNetworkFunctionDefinitionVersionAsync(string networkFunctionDefinitionVersionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.HybridNetwork.NetworkFunctionDefinitionVersionCollection GetNetworkFunctionDefinitionVersions() { 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; } + public virtual Azure.Response Update(Azure.ResourceManager.HybridNetwork.Models.TagsObject tagsObject, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.ResourceManager.HybridNetwork.Models.TagsObject tagsObject, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class NetworkFunctionDefinitionVersionCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected NetworkFunctionDefinitionVersionCollection() { } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string networkFunctionDefinitionVersionName, Azure.ResourceManager.HybridNetwork.NetworkFunctionDefinitionVersionData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(Azure.WaitUntil waitUntil, string networkFunctionDefinitionVersionName, Azure.ResourceManager.HybridNetwork.NetworkFunctionDefinitionVersionData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Exists(string networkFunctionDefinitionVersionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string networkFunctionDefinitionVersionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string networkFunctionDefinitionVersionName, 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 networkFunctionDefinitionVersionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.NullableResponse GetIfExists(string networkFunctionDefinitionVersionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string networkFunctionDefinitionVersionName, 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 NetworkFunctionDefinitionVersionData : Azure.ResourceManager.Models.TrackedResourceData + { + public NetworkFunctionDefinitionVersionData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public Azure.ResourceManager.HybridNetwork.Models.NetworkFunctionDefinitionVersionPropertiesFormat Properties { get { throw null; } set { } } + } + public partial class NetworkFunctionDefinitionVersionResource : Azure.ResourceManager.ArmResource + { + public static readonly Azure.Core.ResourceType ResourceType; + protected NetworkFunctionDefinitionVersionResource() { } + public virtual Azure.ResourceManager.HybridNetwork.NetworkFunctionDefinitionVersionData 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 publisherName, string networkFunctionDefinitionGroupName, string networkFunctionDefinitionVersionName) { 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 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; } + public virtual Azure.Response Update(Azure.ResourceManager.HybridNetwork.Models.TagsObject tagsObject, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.ResourceManager.HybridNetwork.Models.TagsObject tagsObject, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.ArmOperation UpdateState(Azure.WaitUntil waitUntil, Azure.ResourceManager.HybridNetwork.Models.NetworkFunctionDefinitionVersionUpdateState networkFunctionDefinitionVersionUpdateState, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateStateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.HybridNetwork.Models.NetworkFunctionDefinitionVersionUpdateState networkFunctionDefinitionVersionUpdateState, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class NetworkFunctionResource : Azure.ResourceManager.ArmResource + { + public static readonly Azure.Core.ResourceType ResourceType; + protected NetworkFunctionResource() { } + public virtual Azure.ResourceManager.HybridNetwork.NetworkFunctionData 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 networkFunctionName) { throw null; } + public virtual Azure.ResourceManager.ArmOperation Delete(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task DeleteAsync(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.ArmOperation ExecuteRequest(Azure.WaitUntil waitUntil, Azure.ResourceManager.HybridNetwork.Models.ExecuteRequestContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task ExecuteRequestAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.HybridNetwork.Models.ExecuteRequestContent content, 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 GetComponent(string componentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetComponentAsync(string componentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.HybridNetwork.ComponentCollection GetComponents() { 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; } + public virtual Azure.Response Update(Azure.ResourceManager.HybridNetwork.Models.TagsObject tagsObject, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.ResourceManager.HybridNetwork.Models.TagsObject tagsObject, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class NetworkServiceDesignGroupCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected NetworkServiceDesignGroupCollection() { } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string networkServiceDesignGroupName, Azure.ResourceManager.HybridNetwork.NetworkServiceDesignGroupData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(Azure.WaitUntil waitUntil, string networkServiceDesignGroupName, Azure.ResourceManager.HybridNetwork.NetworkServiceDesignGroupData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Exists(string networkServiceDesignGroupName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string networkServiceDesignGroupName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string networkServiceDesignGroupName, 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 networkServiceDesignGroupName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.NullableResponse GetIfExists(string networkServiceDesignGroupName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string networkServiceDesignGroupName, 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 NetworkServiceDesignGroupData : Azure.ResourceManager.Models.TrackedResourceData + { + public NetworkServiceDesignGroupData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public Azure.ResourceManager.HybridNetwork.Models.NetworkServiceDesignGroupPropertiesFormat Properties { get { throw null; } set { } } + } + public partial class NetworkServiceDesignGroupResource : Azure.ResourceManager.ArmResource + { + public static readonly Azure.Core.ResourceType ResourceType; + protected NetworkServiceDesignGroupResource() { } + public virtual Azure.ResourceManager.HybridNetwork.NetworkServiceDesignGroupData 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 publisherName, string networkServiceDesignGroupName) { 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 GetNetworkServiceDesignVersion(string networkServiceDesignVersionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetNetworkServiceDesignVersionAsync(string networkServiceDesignVersionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.HybridNetwork.NetworkServiceDesignVersionCollection GetNetworkServiceDesignVersions() { 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; } + public virtual Azure.Response Update(Azure.ResourceManager.HybridNetwork.Models.TagsObject tagsObject, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.ResourceManager.HybridNetwork.Models.TagsObject tagsObject, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class NetworkServiceDesignVersionCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected NetworkServiceDesignVersionCollection() { } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string networkServiceDesignVersionName, Azure.ResourceManager.HybridNetwork.NetworkServiceDesignVersionData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(Azure.WaitUntil waitUntil, string networkServiceDesignVersionName, Azure.ResourceManager.HybridNetwork.NetworkServiceDesignVersionData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Exists(string networkServiceDesignVersionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string networkServiceDesignVersionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string networkServiceDesignVersionName, 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 networkServiceDesignVersionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.NullableResponse GetIfExists(string networkServiceDesignVersionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string networkServiceDesignVersionName, 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 NetworkServiceDesignVersionData : Azure.ResourceManager.Models.TrackedResourceData + { + public NetworkServiceDesignVersionData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public Azure.ResourceManager.HybridNetwork.Models.NetworkServiceDesignVersionPropertiesFormat Properties { get { throw null; } set { } } + } + public partial class NetworkServiceDesignVersionResource : Azure.ResourceManager.ArmResource + { + public static readonly Azure.Core.ResourceType ResourceType; + protected NetworkServiceDesignVersionResource() { } + public virtual Azure.ResourceManager.HybridNetwork.NetworkServiceDesignVersionData 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 publisherName, string networkServiceDesignGroupName, string networkServiceDesignVersionName) { 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 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; } + public virtual Azure.Response Update(Azure.ResourceManager.HybridNetwork.Models.TagsObject tagsObject, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.ResourceManager.HybridNetwork.Models.TagsObject tagsObject, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.ArmOperation UpdateState(Azure.WaitUntil waitUntil, Azure.ResourceManager.HybridNetwork.Models.NetworkServiceDesignVersionUpdateState networkServiceDesignVersionUpdateState, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateStateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.HybridNetwork.Models.NetworkServiceDesignVersionUpdateState networkServiceDesignVersionUpdateState, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class PublisherCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected PublisherCollection() { } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string publisherName, Azure.ResourceManager.HybridNetwork.PublisherData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(Azure.WaitUntil waitUntil, string publisherName, Azure.ResourceManager.HybridNetwork.PublisherData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Exists(string publisherName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string publisherName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string publisherName, 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 publisherName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.NullableResponse GetIfExists(string publisherName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string publisherName, 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 PublisherData : Azure.ResourceManager.Models.TrackedResourceData + { + public PublisherData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public Azure.ResourceManager.Models.ManagedServiceIdentity Identity { get { throw null; } set { } } + public Azure.ResourceManager.HybridNetwork.Models.PublisherPropertiesFormat Properties { get { throw null; } set { } } + } + public partial class PublisherResource : Azure.ResourceManager.ArmResource + { + public static readonly Azure.Core.ResourceType ResourceType; + protected PublisherResource() { } + public virtual Azure.ResourceManager.HybridNetwork.PublisherData 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 publisherName) { 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 Azure.Response GetArtifactStore(string artifactStoreName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetArtifactStoreAsync(string artifactStoreName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.HybridNetwork.ArtifactStoreCollection GetArtifactStores() { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetConfigurationGroupSchema(string configurationGroupSchemaName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetConfigurationGroupSchemaAsync(string configurationGroupSchemaName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.HybridNetwork.ConfigurationGroupSchemaCollection GetConfigurationGroupSchemas() { throw null; } + public virtual Azure.Response GetNetworkFunctionDefinitionGroup(string networkFunctionDefinitionGroupName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetNetworkFunctionDefinitionGroupAsync(string networkFunctionDefinitionGroupName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.HybridNetwork.NetworkFunctionDefinitionGroupCollection GetNetworkFunctionDefinitionGroups() { throw null; } + public virtual Azure.Response GetNetworkServiceDesignGroup(string networkServiceDesignGroupName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetNetworkServiceDesignGroupAsync(string networkServiceDesignGroupName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.HybridNetwork.NetworkServiceDesignGroupCollection GetNetworkServiceDesignGroups() { 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; } + public virtual Azure.Response Update(Azure.ResourceManager.HybridNetwork.Models.TagsObject tagsObject, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.ResourceManager.HybridNetwork.Models.TagsObject tagsObject, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class SiteCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected SiteCollection() { } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string siteName, Azure.ResourceManager.HybridNetwork.SiteData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(Azure.WaitUntil waitUntil, string siteName, Azure.ResourceManager.HybridNetwork.SiteData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Exists(string siteName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string siteName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string siteName, 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 siteName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.NullableResponse GetIfExists(string siteName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string siteName, 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 SiteData : Azure.ResourceManager.Models.TrackedResourceData + { + public SiteData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public Azure.ResourceManager.HybridNetwork.Models.SitePropertiesFormat Properties { get { throw null; } set { } } + } + public partial class SiteNetworkServiceCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected SiteNetworkServiceCollection() { } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string siteNetworkServiceName, Azure.ResourceManager.HybridNetwork.SiteNetworkServiceData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(Azure.WaitUntil waitUntil, string siteNetworkServiceName, Azure.ResourceManager.HybridNetwork.SiteNetworkServiceData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Exists(string siteNetworkServiceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string siteNetworkServiceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string siteNetworkServiceName, 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 siteNetworkServiceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.NullableResponse GetIfExists(string siteNetworkServiceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string siteNetworkServiceName, 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 SiteNetworkServiceData : Azure.ResourceManager.Models.TrackedResourceData + { + public SiteNetworkServiceData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public Azure.ResourceManager.Models.ManagedServiceIdentity Identity { get { throw null; } set { } } + public Azure.ResourceManager.HybridNetwork.Models.SiteNetworkServicePropertiesFormat Properties { get { throw null; } set { } } + public Azure.ResourceManager.HybridNetwork.Models.HybridNetworkSku Sku { get { throw null; } set { } } + } + public partial class SiteNetworkServiceResource : Azure.ResourceManager.ArmResource + { + public static readonly Azure.Core.ResourceType ResourceType; + protected SiteNetworkServiceResource() { } + public virtual Azure.ResourceManager.HybridNetwork.SiteNetworkServiceData 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 siteNetworkServiceName) { 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 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; } + public virtual Azure.Response Update(Azure.ResourceManager.HybridNetwork.Models.TagsObject tagsObject, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.ResourceManager.HybridNetwork.Models.TagsObject tagsObject, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class SiteResource : Azure.ResourceManager.ArmResource + { + public static readonly Azure.Core.ResourceType ResourceType; + protected SiteResource() { } + public virtual Azure.ResourceManager.HybridNetwork.SiteData 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 siteName) { 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 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; } + public virtual Azure.Response Update(Azure.ResourceManager.HybridNetwork.Models.TagsObject tagsObject, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.ResourceManager.HybridNetwork.Models.TagsObject tagsObject, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} +namespace Azure.ResourceManager.HybridNetwork.Models +{ + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct ApplicationEnablement : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public ApplicationEnablement(string value) { throw null; } + public static Azure.ResourceManager.HybridNetwork.Models.ApplicationEnablement Disabled { get { throw null; } } + public static Azure.ResourceManager.HybridNetwork.Models.ApplicationEnablement Enabled { get { throw null; } } + public static Azure.ResourceManager.HybridNetwork.Models.ApplicationEnablement Unknown { get { throw null; } } + public bool Equals(Azure.ResourceManager.HybridNetwork.Models.ApplicationEnablement 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.HybridNetwork.Models.ApplicationEnablement left, Azure.ResourceManager.HybridNetwork.Models.ApplicationEnablement right) { throw null; } + public static implicit operator Azure.ResourceManager.HybridNetwork.Models.ApplicationEnablement (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.HybridNetwork.Models.ApplicationEnablement left, Azure.ResourceManager.HybridNetwork.Models.ApplicationEnablement right) { throw null; } + public override string ToString() { throw null; } + } + public static partial class ArmHybridNetworkModelFactory + { + public static Azure.ResourceManager.HybridNetwork.ArtifactManifestData ArtifactManifestData(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.HybridNetwork.Models.ArtifactManifestPropertiesFormat properties = null) { throw null; } + public static Azure.ResourceManager.HybridNetwork.Models.ArtifactManifestPropertiesFormat ArtifactManifestPropertiesFormat(Azure.ResourceManager.HybridNetwork.Models.ProvisioningState? provisioningState = default(Azure.ResourceManager.HybridNetwork.Models.ProvisioningState?), Azure.ResourceManager.HybridNetwork.Models.ArtifactManifestState? artifactManifestState = default(Azure.ResourceManager.HybridNetwork.Models.ArtifactManifestState?), System.Collections.Generic.IEnumerable artifacts = null) { throw null; } + public static Azure.ResourceManager.HybridNetwork.ArtifactStoreData ArtifactStoreData(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.HybridNetwork.Models.ArtifactStorePropertiesFormat properties = null) { throw null; } + public static Azure.ResourceManager.HybridNetwork.Models.ArtifactStorePropertiesFormat ArtifactStorePropertiesFormat(Azure.ResourceManager.HybridNetwork.Models.ProvisioningState? provisioningState = default(Azure.ResourceManager.HybridNetwork.Models.ProvisioningState?), Azure.ResourceManager.HybridNetwork.Models.ArtifactStoreType? storeType = default(Azure.ResourceManager.HybridNetwork.Models.ArtifactStoreType?), Azure.ResourceManager.HybridNetwork.Models.ArtifactReplicationStrategy? replicationStrategy = default(Azure.ResourceManager.HybridNetwork.Models.ArtifactReplicationStrategy?), Azure.ResourceManager.HybridNetwork.Models.ArtifactStorePropertiesFormatManagedResourceGroupConfiguration managedResourceGroupConfiguration = null, Azure.Core.ResourceIdentifier storageResourceId = null) { throw null; } + public static Azure.ResourceManager.HybridNetwork.Models.AzureContainerRegistryScopedTokenCredential AzureContainerRegistryScopedTokenCredential(string username = null, string acrToken = null, System.Uri acrServerUri = null, System.Collections.Generic.IEnumerable repositories = null, System.DateTimeOffset? expiry = default(System.DateTimeOffset?)) { throw null; } + public static Azure.ResourceManager.HybridNetwork.Models.AzureStorageAccountContainerCredential AzureStorageAccountContainerCredential(string containerName = null, System.Uri containerSasUri = null) { throw null; } + public static Azure.ResourceManager.HybridNetwork.Models.AzureStorageAccountCredential AzureStorageAccountCredential(Azure.Core.ResourceIdentifier storageAccountId = null, System.Collections.Generic.IEnumerable containerCredentials = null, System.DateTimeOffset? expiry = default(System.DateTimeOffset?)) { throw null; } + public static Azure.ResourceManager.HybridNetwork.ComponentData ComponentData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.ResourceManager.HybridNetwork.Models.ComponentProperties properties = null) { throw null; } + public static Azure.ResourceManager.HybridNetwork.Models.ComponentKubernetesResources ComponentKubernetesResources(System.Collections.Generic.IEnumerable deployments = null, System.Collections.Generic.IEnumerable pods = null, System.Collections.Generic.IEnumerable replicaSets = null, System.Collections.Generic.IEnumerable statefulSets = null, System.Collections.Generic.IEnumerable daemonSets = null) { throw null; } + public static Azure.ResourceManager.HybridNetwork.Models.ComponentProperties ComponentProperties(Azure.ResourceManager.HybridNetwork.Models.ProvisioningState? provisioningState = default(Azure.ResourceManager.HybridNetwork.Models.ProvisioningState?), string deploymentProfile = null, Azure.ResourceManager.HybridNetwork.Models.DeploymentStatusProperties deploymentStatus = null) { throw null; } + public static Azure.ResourceManager.HybridNetwork.ConfigurationGroupSchemaData ConfigurationGroupSchemaData(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.HybridNetwork.Models.ConfigurationGroupSchemaPropertiesFormat properties = null) { throw null; } + public static Azure.ResourceManager.HybridNetwork.Models.ConfigurationGroupSchemaPropertiesFormat ConfigurationGroupSchemaPropertiesFormat(Azure.ResourceManager.HybridNetwork.Models.ProvisioningState? provisioningState = default(Azure.ResourceManager.HybridNetwork.Models.ProvisioningState?), Azure.ResourceManager.HybridNetwork.Models.VersionState? versionState = default(Azure.ResourceManager.HybridNetwork.Models.VersionState?), string description = null, string schemaDefinition = null) { throw null; } + public static Azure.ResourceManager.HybridNetwork.ConfigurationGroupValueData ConfigurationGroupValueData(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.HybridNetwork.Models.ConfigurationGroupValuePropertiesFormat properties = null) { throw null; } + public static Azure.ResourceManager.HybridNetwork.Models.ConfigurationGroupValuePropertiesFormat ConfigurationGroupValuePropertiesFormat(Azure.ResourceManager.HybridNetwork.Models.ProvisioningState? provisioningState = default(Azure.ResourceManager.HybridNetwork.Models.ProvisioningState?), string publisherName = null, Azure.ResourceManager.HybridNetwork.Models.PublisherScope? publisherScope = default(Azure.ResourceManager.HybridNetwork.Models.PublisherScope?), string configurationGroupSchemaName = null, string configurationGroupSchemaOfferingLocation = null, Azure.ResourceManager.HybridNetwork.Models.DeploymentResourceIdReference configurationGroupSchemaResourceReference = null, string configurationType = "Unknown") { throw null; } + public static Azure.ResourceManager.HybridNetwork.Models.ConfigurationValueWithoutSecrets ConfigurationValueWithoutSecrets(Azure.ResourceManager.HybridNetwork.Models.ProvisioningState? provisioningState = default(Azure.ResourceManager.HybridNetwork.Models.ProvisioningState?), string publisherName = null, Azure.ResourceManager.HybridNetwork.Models.PublisherScope? publisherScope = default(Azure.ResourceManager.HybridNetwork.Models.PublisherScope?), string configurationGroupSchemaName = null, string configurationGroupSchemaOfferingLocation = null, Azure.ResourceManager.HybridNetwork.Models.DeploymentResourceIdReference configurationGroupSchemaResourceReference = null, string configurationValue = null) { throw null; } + public static Azure.ResourceManager.HybridNetwork.Models.ConfigurationValueWithSecrets ConfigurationValueWithSecrets(Azure.ResourceManager.HybridNetwork.Models.ProvisioningState? provisioningState = default(Azure.ResourceManager.HybridNetwork.Models.ProvisioningState?), string publisherName = null, Azure.ResourceManager.HybridNetwork.Models.PublisherScope? publisherScope = default(Azure.ResourceManager.HybridNetwork.Models.PublisherScope?), string configurationGroupSchemaName = null, string configurationGroupSchemaOfferingLocation = null, Azure.ResourceManager.HybridNetwork.Models.DeploymentResourceIdReference configurationGroupSchemaResourceReference = null, string secretConfigurationValue = null) { throw null; } + public static Azure.ResourceManager.HybridNetwork.Models.ContainerizedNetworkFunctionDefinitionVersion ContainerizedNetworkFunctionDefinitionVersion(Azure.ResourceManager.HybridNetwork.Models.ProvisioningState? provisioningState = default(Azure.ResourceManager.HybridNetwork.Models.ProvisioningState?), Azure.ResourceManager.HybridNetwork.Models.VersionState? versionState = default(Azure.ResourceManager.HybridNetwork.Models.VersionState?), string description = null, string deployParameters = null, Azure.ResourceManager.HybridNetwork.Models.ContainerizedNetworkFunctionTemplate networkFunctionTemplate = null) { throw null; } + public static Azure.ResourceManager.HybridNetwork.Models.DeploymentStatusProperties DeploymentStatusProperties(Azure.ResourceManager.HybridNetwork.Models.ComponentStatus? status = default(Azure.ResourceManager.HybridNetwork.Models.ComponentStatus?), Azure.ResourceManager.HybridNetwork.Models.ComponentKubernetesResources resources = null, System.DateTimeOffset? nextExpectedUpdateOn = default(System.DateTimeOffset?)) { throw null; } + public static Azure.ResourceManager.HybridNetwork.Models.HybridNetworkSku HybridNetworkSku(Azure.ResourceManager.HybridNetwork.Models.HybridNetworkSkuName name = default(Azure.ResourceManager.HybridNetwork.Models.HybridNetworkSkuName), Azure.ResourceManager.HybridNetwork.Models.HybridNetworkSkuTier? tier = default(Azure.ResourceManager.HybridNetwork.Models.HybridNetworkSkuTier?)) { throw null; } + public static Azure.ResourceManager.HybridNetwork.Models.KubernetesDaemonSet KubernetesDaemonSet(string name = null, string @namespace = null, int? desiredNumberOfPods = default(int?), int? currentNumberOfPods = default(int?), int? readyNumberOfPods = default(int?), int? upToDateNumberOfPods = default(int?), int? availableNumberOfPods = default(int?), System.DateTimeOffset? createdOn = default(System.DateTimeOffset?)) { throw null; } + public static Azure.ResourceManager.HybridNetwork.Models.KubernetesDeployment KubernetesDeployment(string name = null, string @namespace = null, int? desiredNumberOfPods = default(int?), int? readyNumberOfPods = default(int?), int? upToDateNumberOfPods = default(int?), int? availableNumberOfPods = default(int?), System.DateTimeOffset? createdOn = default(System.DateTimeOffset?)) { throw null; } + public static Azure.ResourceManager.HybridNetwork.Models.KubernetesPod KubernetesPod(string name = null, string @namespace = null, int? desiredNumberOfContainers = default(int?), int? readyNumberOfContainers = default(int?), Azure.ResourceManager.HybridNetwork.Models.PodStatus? status = default(Azure.ResourceManager.HybridNetwork.Models.PodStatus?), System.DateTimeOffset? createdOn = default(System.DateTimeOffset?), System.Collections.Generic.IEnumerable events = null) { throw null; } + public static Azure.ResourceManager.HybridNetwork.Models.KubernetesReplicaSet KubernetesReplicaSet(string name = null, string @namespace = null, int? desiredNumberOfPods = default(int?), int? readyNumberOfPods = default(int?), int? currentNumberOfPods = default(int?), System.DateTimeOffset? createdOn = default(System.DateTimeOffset?)) { throw null; } + public static Azure.ResourceManager.HybridNetwork.Models.KubernetesStatefulSet KubernetesStatefulSet(string name = null, string @namespace = null, int? desiredNumberOfPods = default(int?), int? readyNumberOfPods = default(int?), System.DateTimeOffset? createdOn = default(System.DateTimeOffset?)) { throw null; } + public static Azure.ResourceManager.HybridNetwork.NetworkFunctionData NetworkFunctionData(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.HybridNetwork.Models.NetworkFunctionPropertiesFormat properties = null, Azure.ETag? etag = default(Azure.ETag?), Azure.ResourceManager.Models.ManagedServiceIdentity identity = null) { throw null; } + public static Azure.ResourceManager.HybridNetwork.NetworkFunctionDefinitionGroupData NetworkFunctionDefinitionGroupData(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.HybridNetwork.Models.NetworkFunctionDefinitionGroupPropertiesFormat properties = null) { throw null; } + public static Azure.ResourceManager.HybridNetwork.Models.NetworkFunctionDefinitionGroupPropertiesFormat NetworkFunctionDefinitionGroupPropertiesFormat(Azure.ResourceManager.HybridNetwork.Models.ProvisioningState? provisioningState = default(Azure.ResourceManager.HybridNetwork.Models.ProvisioningState?), string description = null) { throw null; } + public static Azure.ResourceManager.HybridNetwork.NetworkFunctionDefinitionVersionData NetworkFunctionDefinitionVersionData(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.HybridNetwork.Models.NetworkFunctionDefinitionVersionPropertiesFormat properties = null) { throw null; } + public static Azure.ResourceManager.HybridNetwork.Models.NetworkFunctionDefinitionVersionPropertiesFormat NetworkFunctionDefinitionVersionPropertiesFormat(Azure.ResourceManager.HybridNetwork.Models.ProvisioningState? provisioningState = default(Azure.ResourceManager.HybridNetwork.Models.ProvisioningState?), Azure.ResourceManager.HybridNetwork.Models.VersionState? versionState = default(Azure.ResourceManager.HybridNetwork.Models.VersionState?), string description = null, string deployParameters = null, string networkFunctionType = "Unknown") { throw null; } + public static Azure.ResourceManager.HybridNetwork.Models.NetworkFunctionPropertiesFormat NetworkFunctionPropertiesFormat(Azure.ResourceManager.HybridNetwork.Models.ProvisioningState? provisioningState = default(Azure.ResourceManager.HybridNetwork.Models.ProvisioningState?), string publisherName = null, Azure.ResourceManager.HybridNetwork.Models.PublisherScope? publisherScope = default(Azure.ResourceManager.HybridNetwork.Models.PublisherScope?), string networkFunctionDefinitionGroupName = null, string networkFunctionDefinitionVersion = null, string networkFunctionDefinitionOfferingLocation = null, Azure.ResourceManager.HybridNetwork.Models.DeploymentResourceIdReference networkFunctionDefinitionVersionResourceReference = null, Azure.ResourceManager.HybridNetwork.Models.NfviType? nfviType = default(Azure.ResourceManager.HybridNetwork.Models.NfviType?), Azure.Core.ResourceIdentifier nfviId = null, bool? allowSoftwareUpdate = default(bool?), string configurationType = "Unknown", System.Collections.Generic.IEnumerable roleOverrideValues = null) { throw null; } + public static Azure.ResourceManager.HybridNetwork.Models.NetworkFunctionValueWithoutSecrets NetworkFunctionValueWithoutSecrets(Azure.ResourceManager.HybridNetwork.Models.ProvisioningState? provisioningState = default(Azure.ResourceManager.HybridNetwork.Models.ProvisioningState?), string publisherName = null, Azure.ResourceManager.HybridNetwork.Models.PublisherScope? publisherScope = default(Azure.ResourceManager.HybridNetwork.Models.PublisherScope?), string networkFunctionDefinitionGroupName = null, string networkFunctionDefinitionVersion = null, string networkFunctionDefinitionOfferingLocation = null, Azure.ResourceManager.HybridNetwork.Models.DeploymentResourceIdReference networkFunctionDefinitionVersionResourceReference = null, Azure.ResourceManager.HybridNetwork.Models.NfviType? nfviType = default(Azure.ResourceManager.HybridNetwork.Models.NfviType?), Azure.Core.ResourceIdentifier nfviId = null, bool? allowSoftwareUpdate = default(bool?), System.Collections.Generic.IEnumerable roleOverrideValues = null, string deploymentValues = null) { throw null; } + public static Azure.ResourceManager.HybridNetwork.Models.NetworkFunctionValueWithSecrets NetworkFunctionValueWithSecrets(Azure.ResourceManager.HybridNetwork.Models.ProvisioningState? provisioningState = default(Azure.ResourceManager.HybridNetwork.Models.ProvisioningState?), string publisherName = null, Azure.ResourceManager.HybridNetwork.Models.PublisherScope? publisherScope = default(Azure.ResourceManager.HybridNetwork.Models.PublisherScope?), string networkFunctionDefinitionGroupName = null, string networkFunctionDefinitionVersion = null, string networkFunctionDefinitionOfferingLocation = null, Azure.ResourceManager.HybridNetwork.Models.DeploymentResourceIdReference networkFunctionDefinitionVersionResourceReference = null, Azure.ResourceManager.HybridNetwork.Models.NfviType? nfviType = default(Azure.ResourceManager.HybridNetwork.Models.NfviType?), Azure.Core.ResourceIdentifier nfviId = null, bool? allowSoftwareUpdate = default(bool?), System.Collections.Generic.IEnumerable roleOverrideValues = null, string secretDeploymentValues = null) { throw null; } + public static Azure.ResourceManager.HybridNetwork.NetworkServiceDesignGroupData NetworkServiceDesignGroupData(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.HybridNetwork.Models.NetworkServiceDesignGroupPropertiesFormat properties = null) { throw null; } + public static Azure.ResourceManager.HybridNetwork.Models.NetworkServiceDesignGroupPropertiesFormat NetworkServiceDesignGroupPropertiesFormat(Azure.ResourceManager.HybridNetwork.Models.ProvisioningState? provisioningState = default(Azure.ResourceManager.HybridNetwork.Models.ProvisioningState?), string description = null) { throw null; } + public static Azure.ResourceManager.HybridNetwork.NetworkServiceDesignVersionData NetworkServiceDesignVersionData(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.HybridNetwork.Models.NetworkServiceDesignVersionPropertiesFormat properties = null) { throw null; } + public static Azure.ResourceManager.HybridNetwork.Models.NetworkServiceDesignVersionPropertiesFormat NetworkServiceDesignVersionPropertiesFormat(Azure.ResourceManager.HybridNetwork.Models.ProvisioningState? provisioningState = default(Azure.ResourceManager.HybridNetwork.Models.ProvisioningState?), Azure.ResourceManager.HybridNetwork.Models.VersionState? versionState = default(Azure.ResourceManager.HybridNetwork.Models.VersionState?), string description = null, System.Collections.Generic.IDictionary configurationGroupSchemaReferences = null, System.Collections.Generic.IDictionary nfvisFromSite = null, System.Collections.Generic.IEnumerable resourceElementTemplates = null) { throw null; } + public static Azure.ResourceManager.HybridNetwork.Models.PodEvent PodEvent(Azure.ResourceManager.HybridNetwork.Models.PodEventType? eventType = default(Azure.ResourceManager.HybridNetwork.Models.PodEventType?), string reason = null, string message = null, System.DateTimeOffset? lastSeenOn = default(System.DateTimeOffset?)) { throw null; } + public static Azure.ResourceManager.HybridNetwork.Models.ProxyArtifactListOverview ProxyArtifactListOverview(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null) { throw null; } + public static Azure.ResourceManager.HybridNetwork.Models.ProxyArtifactOverviewPropertiesValue ProxyArtifactOverviewPropertiesValue(Azure.ResourceManager.HybridNetwork.Models.ArtifactType? artifactType = default(Azure.ResourceManager.HybridNetwork.Models.ArtifactType?), string artifactVersion = null, Azure.ResourceManager.HybridNetwork.Models.ArtifactState? artifactState = default(Azure.ResourceManager.HybridNetwork.Models.ArtifactState?)) { throw null; } + public static Azure.ResourceManager.HybridNetwork.Models.ProxyArtifactVersionsListOverview ProxyArtifactVersionsListOverview(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.ResourceManager.HybridNetwork.Models.ProxyArtifactOverviewPropertiesValue properties = null) { throw null; } + public static Azure.ResourceManager.HybridNetwork.PublisherData PublisherData(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.HybridNetwork.Models.PublisherPropertiesFormat properties = null, Azure.ResourceManager.Models.ManagedServiceIdentity identity = null) { throw null; } + public static Azure.ResourceManager.HybridNetwork.Models.PublisherPropertiesFormat PublisherPropertiesFormat(Azure.ResourceManager.HybridNetwork.Models.ProvisioningState? provisioningState = default(Azure.ResourceManager.HybridNetwork.Models.ProvisioningState?), Azure.ResourceManager.HybridNetwork.Models.PublisherScope? scope = default(Azure.ResourceManager.HybridNetwork.Models.PublisherScope?)) { throw null; } + public static Azure.ResourceManager.HybridNetwork.SiteData SiteData(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.HybridNetwork.Models.SitePropertiesFormat properties = null) { throw null; } + public static Azure.ResourceManager.HybridNetwork.SiteNetworkServiceData SiteNetworkServiceData(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.HybridNetwork.Models.SiteNetworkServicePropertiesFormat properties = null, Azure.ResourceManager.Models.ManagedServiceIdentity identity = null, Azure.ResourceManager.HybridNetwork.Models.HybridNetworkSku sku = null) { throw null; } + public static Azure.ResourceManager.HybridNetwork.Models.SiteNetworkServicePropertiesFormat SiteNetworkServicePropertiesFormat(Azure.ResourceManager.HybridNetwork.Models.ProvisioningState? provisioningState = default(Azure.ResourceManager.HybridNetwork.Models.ProvisioningState?), Azure.ResourceManager.HybridNetwork.Models.ManagedResourceGroupConfiguration managedResourceGroupConfiguration = null, Azure.Core.ResourceIdentifier siteReferenceId = null, string publisherName = null, Azure.ResourceManager.HybridNetwork.Models.PublisherScope? publisherScope = default(Azure.ResourceManager.HybridNetwork.Models.PublisherScope?), string networkServiceDesignGroupName = null, string networkServiceDesignVersionName = null, string networkServiceDesignVersionOfferingLocation = null, Azure.ResourceManager.HybridNetwork.Models.DeploymentResourceIdReference networkServiceDesignVersionResourceReference = null, System.Collections.Generic.IDictionary desiredStateConfigurationGroupValueReferences = null, string lastStateNetworkServiceDesignVersionName = null, System.Collections.Generic.IReadOnlyDictionary lastStateConfigurationGroupValueReferences = null) { throw null; } + public static Azure.ResourceManager.HybridNetwork.Models.SitePropertiesFormat SitePropertiesFormat(Azure.ResourceManager.HybridNetwork.Models.ProvisioningState? provisioningState = default(Azure.ResourceManager.HybridNetwork.Models.ProvisioningState?), System.Collections.Generic.IEnumerable nfvis = null, System.Collections.Generic.IEnumerable siteNetworkServiceReferences = null) { throw null; } + public static Azure.ResourceManager.HybridNetwork.Models.VirtualNetworkFunctionDefinitionVersion VirtualNetworkFunctionDefinitionVersion(Azure.ResourceManager.HybridNetwork.Models.ProvisioningState? provisioningState = default(Azure.ResourceManager.HybridNetwork.Models.ProvisioningState?), Azure.ResourceManager.HybridNetwork.Models.VersionState? versionState = default(Azure.ResourceManager.HybridNetwork.Models.VersionState?), string description = null, string deployParameters = null, Azure.ResourceManager.HybridNetwork.Models.VirtualNetworkFunctionTemplate networkFunctionTemplate = null) { throw null; } + } + public partial class ArmResourceDefinitionResourceElementTemplate + { + public ArmResourceDefinitionResourceElementTemplate() { } + public Azure.ResourceManager.HybridNetwork.Models.NSDArtifactProfile ArtifactProfile { get { throw null; } set { } } + public string ParameterValues { get { throw null; } set { } } + public Azure.ResourceManager.HybridNetwork.Models.TemplateType? TemplateType { get { throw null; } set { } } + } + public partial class ArmResourceDefinitionResourceElementTemplateDetails : Azure.ResourceManager.HybridNetwork.Models.ResourceElementTemplate + { + public ArmResourceDefinitionResourceElementTemplateDetails() { } + public Azure.ResourceManager.HybridNetwork.Models.ArmResourceDefinitionResourceElementTemplate Configuration { get { throw null; } set { } } + } + public partial class ArmTemplateArtifactProfile + { + public ArmTemplateArtifactProfile() { } + public string TemplateName { get { throw null; } set { } } + public string TemplateVersion { get { throw null; } set { } } + } + public abstract partial class ArtifactAccessCredential + { + protected ArtifactAccessCredential() { } + } + public partial class ArtifactChangeState + { + public ArtifactChangeState() { } + public Azure.ResourceManager.HybridNetwork.Models.ArtifactState? ArtifactState { get { throw null; } set { } } + } + public partial class ArtifactManifestPropertiesFormat + { + public ArtifactManifestPropertiesFormat() { } + public Azure.ResourceManager.HybridNetwork.Models.ArtifactManifestState? ArtifactManifestState { get { throw null; } } + public System.Collections.Generic.IList Artifacts { get { throw null; } } + public Azure.ResourceManager.HybridNetwork.Models.ProvisioningState? ProvisioningState { get { throw null; } } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct ArtifactManifestState : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public ArtifactManifestState(string value) { throw null; } + public static Azure.ResourceManager.HybridNetwork.Models.ArtifactManifestState Succeeded { get { throw null; } } + public static Azure.ResourceManager.HybridNetwork.Models.ArtifactManifestState Unknown { get { throw null; } } + public static Azure.ResourceManager.HybridNetwork.Models.ArtifactManifestState Uploaded { get { throw null; } } + public static Azure.ResourceManager.HybridNetwork.Models.ArtifactManifestState Uploading { get { throw null; } } + public static Azure.ResourceManager.HybridNetwork.Models.ArtifactManifestState Validating { get { throw null; } } + public static Azure.ResourceManager.HybridNetwork.Models.ArtifactManifestState ValidationFailed { get { throw null; } } + public bool Equals(Azure.ResourceManager.HybridNetwork.Models.ArtifactManifestState 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.HybridNetwork.Models.ArtifactManifestState left, Azure.ResourceManager.HybridNetwork.Models.ArtifactManifestState right) { throw null; } + public static implicit operator Azure.ResourceManager.HybridNetwork.Models.ArtifactManifestState (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.HybridNetwork.Models.ArtifactManifestState left, Azure.ResourceManager.HybridNetwork.Models.ArtifactManifestState right) { throw null; } + public override string ToString() { throw null; } + } + public partial class ArtifactManifestUpdateState + { + public ArtifactManifestUpdateState() { } + public Azure.ResourceManager.HybridNetwork.Models.ArtifactManifestState? ArtifactManifestState { get { throw null; } set { } } + } + public partial class ArtifactProfile + { + public ArtifactProfile() { } + public Azure.Core.ResourceIdentifier ArtifactStoreId { get { throw null; } set { } } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct ArtifactReplicationStrategy : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public ArtifactReplicationStrategy(string value) { throw null; } + public static Azure.ResourceManager.HybridNetwork.Models.ArtifactReplicationStrategy SingleReplication { get { throw null; } } + public static Azure.ResourceManager.HybridNetwork.Models.ArtifactReplicationStrategy Unknown { get { throw null; } } + public bool Equals(Azure.ResourceManager.HybridNetwork.Models.ArtifactReplicationStrategy 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.HybridNetwork.Models.ArtifactReplicationStrategy left, Azure.ResourceManager.HybridNetwork.Models.ArtifactReplicationStrategy right) { throw null; } + public static implicit operator Azure.ResourceManager.HybridNetwork.Models.ArtifactReplicationStrategy (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.HybridNetwork.Models.ArtifactReplicationStrategy left, Azure.ResourceManager.HybridNetwork.Models.ArtifactReplicationStrategy right) { throw null; } + public override string ToString() { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct ArtifactState : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public ArtifactState(string value) { throw null; } + public static Azure.ResourceManager.HybridNetwork.Models.ArtifactState Active { get { throw null; } } + public static Azure.ResourceManager.HybridNetwork.Models.ArtifactState Deprecated { get { throw null; } } + public static Azure.ResourceManager.HybridNetwork.Models.ArtifactState Preview { get { throw null; } } + public static Azure.ResourceManager.HybridNetwork.Models.ArtifactState Unknown { get { throw null; } } + public bool Equals(Azure.ResourceManager.HybridNetwork.Models.ArtifactState 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.HybridNetwork.Models.ArtifactState left, Azure.ResourceManager.HybridNetwork.Models.ArtifactState right) { throw null; } + public static implicit operator Azure.ResourceManager.HybridNetwork.Models.ArtifactState (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.HybridNetwork.Models.ArtifactState left, Azure.ResourceManager.HybridNetwork.Models.ArtifactState right) { throw null; } + public override string ToString() { throw null; } + } + public partial class ArtifactStorePropertiesFormat + { + public ArtifactStorePropertiesFormat() { } + public Azure.ResourceManager.HybridNetwork.Models.ArtifactStorePropertiesFormatManagedResourceGroupConfiguration ManagedResourceGroupConfiguration { get { throw null; } set { } } + public Azure.ResourceManager.HybridNetwork.Models.ProvisioningState? ProvisioningState { get { throw null; } } + public Azure.ResourceManager.HybridNetwork.Models.ArtifactReplicationStrategy? ReplicationStrategy { get { throw null; } set { } } + public Azure.Core.ResourceIdentifier StorageResourceId { get { throw null; } } + public Azure.ResourceManager.HybridNetwork.Models.ArtifactStoreType? StoreType { get { throw null; } set { } } + } + public partial class ArtifactStorePropertiesFormatManagedResourceGroupConfiguration + { + public ArtifactStorePropertiesFormatManagedResourceGroupConfiguration() { } + public Azure.Core.AzureLocation? Location { get { throw null; } set { } } + public string Name { get { throw null; } set { } } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct ArtifactStoreType : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public ArtifactStoreType(string value) { throw null; } + public static Azure.ResourceManager.HybridNetwork.Models.ArtifactStoreType AzureContainerRegistry { get { throw null; } } + public static Azure.ResourceManager.HybridNetwork.Models.ArtifactStoreType AzureStorageAccount { get { throw null; } } + public static Azure.ResourceManager.HybridNetwork.Models.ArtifactStoreType Unknown { get { throw null; } } + public bool Equals(Azure.ResourceManager.HybridNetwork.Models.ArtifactStoreType 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.HybridNetwork.Models.ArtifactStoreType left, Azure.ResourceManager.HybridNetwork.Models.ArtifactStoreType right) { throw null; } + public static implicit operator Azure.ResourceManager.HybridNetwork.Models.ArtifactStoreType (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.HybridNetwork.Models.ArtifactStoreType left, Azure.ResourceManager.HybridNetwork.Models.ArtifactStoreType right) { throw null; } + public override string ToString() { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct ArtifactType : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public ArtifactType(string value) { throw null; } + public static Azure.ResourceManager.HybridNetwork.Models.ArtifactType ArmTemplate { get { throw null; } } + public static Azure.ResourceManager.HybridNetwork.Models.ArtifactType ImageFile { get { throw null; } } + public static Azure.ResourceManager.HybridNetwork.Models.ArtifactType OCIArtifact { get { throw null; } } + public static Azure.ResourceManager.HybridNetwork.Models.ArtifactType Unknown { get { throw null; } } + public static Azure.ResourceManager.HybridNetwork.Models.ArtifactType VhdImageFile { get { throw null; } } + public bool Equals(Azure.ResourceManager.HybridNetwork.Models.ArtifactType 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.HybridNetwork.Models.ArtifactType left, Azure.ResourceManager.HybridNetwork.Models.ArtifactType right) { throw null; } + public static implicit operator Azure.ResourceManager.HybridNetwork.Models.ArtifactType (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.HybridNetwork.Models.ArtifactType left, Azure.ResourceManager.HybridNetwork.Models.ArtifactType right) { throw null; } + public override string ToString() { throw null; } + } + public partial class AzureArcK8SClusterNfviDetails : Azure.ResourceManager.HybridNetwork.Models.NFVIs + { + public AzureArcK8SClusterNfviDetails() { } + public Azure.Core.ResourceIdentifier CustomLocationReferenceId { get { throw null; } set { } } + } + public partial class AzureArcKubernetesArtifactProfile : Azure.ResourceManager.HybridNetwork.Models.ArtifactProfile + { + public AzureArcKubernetesArtifactProfile() { } + public Azure.ResourceManager.HybridNetwork.Models.HelmArtifactProfile HelmArtifactProfile { get { throw null; } set { } } + } + public partial class AzureArcKubernetesDeployMappingRuleProfile : Azure.ResourceManager.HybridNetwork.Models.MappingRuleProfile + { + public AzureArcKubernetesDeployMappingRuleProfile() { } + public Azure.ResourceManager.HybridNetwork.Models.HelmMappingRuleProfile HelmMappingRuleProfile { get { throw null; } set { } } + } + public partial class AzureArcKubernetesHelmApplication : Azure.ResourceManager.HybridNetwork.Models.AzureArcKubernetesNetworkFunctionApplication + { + public AzureArcKubernetesHelmApplication() { } + public Azure.ResourceManager.HybridNetwork.Models.AzureArcKubernetesArtifactProfile ArtifactProfile { get { throw null; } set { } } + public Azure.ResourceManager.HybridNetwork.Models.AzureArcKubernetesDeployMappingRuleProfile DeployParametersMappingRuleProfile { get { throw null; } set { } } + } + public partial class AzureArcKubernetesNetworkFunctionApplication : Azure.ResourceManager.HybridNetwork.Models.NetworkFunctionApplication + { + public AzureArcKubernetesNetworkFunctionApplication() { } + } + public partial class AzureArcKubernetesNetworkFunctionTemplate : Azure.ResourceManager.HybridNetwork.Models.ContainerizedNetworkFunctionTemplate + { + public AzureArcKubernetesNetworkFunctionTemplate() { } + public System.Collections.Generic.IList NetworkFunctionApplications { get { throw null; } } + } + public partial class AzureContainerRegistryScopedTokenCredential : Azure.ResourceManager.HybridNetwork.Models.ArtifactAccessCredential + { + internal AzureContainerRegistryScopedTokenCredential() { } + public System.Uri AcrServerUri { get { throw null; } } + public string AcrToken { get { throw null; } } + public System.DateTimeOffset? Expiry { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Repositories { get { throw null; } } + public string Username { get { throw null; } } + } + public partial class AzureCoreArmTemplateArtifactProfile : Azure.ResourceManager.HybridNetwork.Models.ArtifactProfile + { + public AzureCoreArmTemplateArtifactProfile() { } + public Azure.ResourceManager.HybridNetwork.Models.ArmTemplateArtifactProfile TemplateArtifactProfile { get { throw null; } set { } } + } + public partial class AzureCoreArmTemplateDeployMappingRuleProfile : Azure.ResourceManager.HybridNetwork.Models.MappingRuleProfile + { + public AzureCoreArmTemplateDeployMappingRuleProfile() { } + public string TemplateParameters { get { throw null; } set { } } + } + public partial class AzureCoreNetworkFunctionApplication : Azure.ResourceManager.HybridNetwork.Models.NetworkFunctionApplication + { + public AzureCoreNetworkFunctionApplication() { } + } + public partial class AzureCoreNetworkFunctionArmTemplateApplication : Azure.ResourceManager.HybridNetwork.Models.AzureCoreNetworkFunctionApplication + { + public AzureCoreNetworkFunctionArmTemplateApplication() { } + public Azure.ResourceManager.HybridNetwork.Models.AzureCoreArmTemplateArtifactProfile ArtifactProfile { get { throw null; } set { } } + public Azure.ResourceManager.HybridNetwork.Models.AzureCoreArmTemplateDeployMappingRuleProfile DeployParametersMappingRuleProfile { get { throw null; } set { } } + } + public partial class AzureCoreNetworkFunctionTemplate : Azure.ResourceManager.HybridNetwork.Models.VirtualNetworkFunctionTemplate + { + public AzureCoreNetworkFunctionTemplate() { } + public System.Collections.Generic.IList NetworkFunctionApplications { get { throw null; } } + } + public partial class AzureCoreNetworkFunctionVhdApplication : Azure.ResourceManager.HybridNetwork.Models.AzureCoreNetworkFunctionApplication + { + public AzureCoreNetworkFunctionVhdApplication() { } + public Azure.ResourceManager.HybridNetwork.Models.AzureCoreVhdImageArtifactProfile ArtifactProfile { get { throw null; } set { } } + public Azure.ResourceManager.HybridNetwork.Models.AzureCoreVhdImageDeployMappingRuleProfile DeployParametersMappingRuleProfile { get { throw null; } set { } } + } + public partial class AzureCoreNfviDetails : Azure.ResourceManager.HybridNetwork.Models.NFVIs + { + public AzureCoreNfviDetails() { } + public Azure.Core.AzureLocation? Location { get { throw null; } set { } } + } + public partial class AzureCoreVhdImageArtifactProfile : Azure.ResourceManager.HybridNetwork.Models.ArtifactProfile + { + public AzureCoreVhdImageArtifactProfile() { } + public Azure.ResourceManager.HybridNetwork.Models.VhdImageArtifactProfile VhdArtifactProfile { get { throw null; } set { } } + } + public partial class AzureCoreVhdImageDeployMappingRuleProfile : Azure.ResourceManager.HybridNetwork.Models.MappingRuleProfile + { + public AzureCoreVhdImageDeployMappingRuleProfile() { } + public string VhdImageMappingRuleUserConfiguration { get { throw null; } set { } } + } + public partial class AzureOperatorNexusArmTemplateArtifactProfile : Azure.ResourceManager.HybridNetwork.Models.ArtifactProfile + { + public AzureOperatorNexusArmTemplateArtifactProfile() { } + public Azure.ResourceManager.HybridNetwork.Models.ArmTemplateArtifactProfile TemplateArtifactProfile { get { throw null; } set { } } + } + public partial class AzureOperatorNexusArmTemplateDeployMappingRuleProfile : Azure.ResourceManager.HybridNetwork.Models.MappingRuleProfile + { + public AzureOperatorNexusArmTemplateDeployMappingRuleProfile() { } + public string TemplateParameters { get { throw null; } set { } } + } + public partial class AzureOperatorNexusClusterNfviDetails : Azure.ResourceManager.HybridNetwork.Models.NFVIs + { + public AzureOperatorNexusClusterNfviDetails() { } + public Azure.Core.ResourceIdentifier CustomLocationReferenceId { get { throw null; } set { } } + } + public partial class AzureOperatorNexusImageArtifactProfile : Azure.ResourceManager.HybridNetwork.Models.ArtifactProfile + { + public AzureOperatorNexusImageArtifactProfile() { } + public Azure.ResourceManager.HybridNetwork.Models.ImageArtifactProfile ImageArtifactProfile { get { throw null; } set { } } + } + public partial class AzureOperatorNexusImageDeployMappingRuleProfile : Azure.ResourceManager.HybridNetwork.Models.MappingRuleProfile + { + public AzureOperatorNexusImageDeployMappingRuleProfile() { } + public string ImageMappingRuleUserConfiguration { get { throw null; } set { } } + } + public partial class AzureOperatorNexusNetworkFunctionApplication : Azure.ResourceManager.HybridNetwork.Models.NetworkFunctionApplication + { + public AzureOperatorNexusNetworkFunctionApplication() { } + } + public partial class AzureOperatorNexusNetworkFunctionArmTemplateApplication : Azure.ResourceManager.HybridNetwork.Models.AzureOperatorNexusNetworkFunctionApplication + { + public AzureOperatorNexusNetworkFunctionArmTemplateApplication() { } + public Azure.ResourceManager.HybridNetwork.Models.AzureOperatorNexusArmTemplateArtifactProfile ArtifactProfile { get { throw null; } set { } } + public Azure.ResourceManager.HybridNetwork.Models.AzureOperatorNexusArmTemplateDeployMappingRuleProfile DeployParametersMappingRuleProfile { get { throw null; } set { } } + } + public partial class AzureOperatorNexusNetworkFunctionImageApplication : Azure.ResourceManager.HybridNetwork.Models.AzureOperatorNexusNetworkFunctionApplication + { + public AzureOperatorNexusNetworkFunctionImageApplication() { } + public Azure.ResourceManager.HybridNetwork.Models.AzureOperatorNexusImageArtifactProfile ArtifactProfile { get { throw null; } set { } } + public Azure.ResourceManager.HybridNetwork.Models.AzureOperatorNexusImageDeployMappingRuleProfile DeployParametersMappingRuleProfile { get { throw null; } set { } } + } + public partial class AzureOperatorNexusNetworkFunctionTemplate : Azure.ResourceManager.HybridNetwork.Models.VirtualNetworkFunctionTemplate + { + public AzureOperatorNexusNetworkFunctionTemplate() { } + public System.Collections.Generic.IList NetworkFunctionApplications { get { throw null; } } + } + public partial class AzureStorageAccountContainerCredential + { + internal AzureStorageAccountContainerCredential() { } + public string ContainerName { get { throw null; } } + public System.Uri ContainerSasUri { get { throw null; } } + } + public partial class AzureStorageAccountCredential : Azure.ResourceManager.HybridNetwork.Models.ArtifactAccessCredential + { + internal AzureStorageAccountCredential() { } + public System.Collections.Generic.IReadOnlyList ContainerCredentials { get { throw null; } } + public System.DateTimeOffset? Expiry { get { throw null; } } + public Azure.Core.ResourceIdentifier StorageAccountId { get { throw null; } } + } + public partial class ComponentKubernetesResources + { + internal ComponentKubernetesResources() { } + public System.Collections.Generic.IReadOnlyList DaemonSets { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Deployments { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Pods { get { throw null; } } + public System.Collections.Generic.IReadOnlyList ReplicaSets { get { throw null; } } + public System.Collections.Generic.IReadOnlyList StatefulSets { get { throw null; } } + } + public partial class ComponentProperties + { + public ComponentProperties() { } + public string DeploymentProfile { get { throw null; } } + public Azure.ResourceManager.HybridNetwork.Models.DeploymentStatusProperties DeploymentStatus { get { throw null; } } + public Azure.ResourceManager.HybridNetwork.Models.ProvisioningState? ProvisioningState { get { throw null; } } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct ComponentStatus : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public ComponentStatus(string value) { throw null; } + public static Azure.ResourceManager.HybridNetwork.Models.ComponentStatus Deployed { get { throw null; } } + public static Azure.ResourceManager.HybridNetwork.Models.ComponentStatus Downloading { get { throw null; } } + public static Azure.ResourceManager.HybridNetwork.Models.ComponentStatus Failed { get { throw null; } } + public static Azure.ResourceManager.HybridNetwork.Models.ComponentStatus Installing { get { throw null; } } + public static Azure.ResourceManager.HybridNetwork.Models.ComponentStatus PendingInstall { get { throw null; } } + public static Azure.ResourceManager.HybridNetwork.Models.ComponentStatus PendingRollback { get { throw null; } } + public static Azure.ResourceManager.HybridNetwork.Models.ComponentStatus PendingUpgrade { get { throw null; } } + public static Azure.ResourceManager.HybridNetwork.Models.ComponentStatus Reinstalling { get { throw null; } } + public static Azure.ResourceManager.HybridNetwork.Models.ComponentStatus Rollingback { get { throw null; } } + public static Azure.ResourceManager.HybridNetwork.Models.ComponentStatus Superseded { get { throw null; } } + public static Azure.ResourceManager.HybridNetwork.Models.ComponentStatus Uninstalled { get { throw null; } } + public static Azure.ResourceManager.HybridNetwork.Models.ComponentStatus Uninstalling { get { throw null; } } + public static Azure.ResourceManager.HybridNetwork.Models.ComponentStatus Unknown { get { throw null; } } + public static Azure.ResourceManager.HybridNetwork.Models.ComponentStatus Upgrading { get { throw null; } } + public bool Equals(Azure.ResourceManager.HybridNetwork.Models.ComponentStatus 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.HybridNetwork.Models.ComponentStatus left, Azure.ResourceManager.HybridNetwork.Models.ComponentStatus right) { throw null; } + public static implicit operator Azure.ResourceManager.HybridNetwork.Models.ComponentStatus (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.HybridNetwork.Models.ComponentStatus left, Azure.ResourceManager.HybridNetwork.Models.ComponentStatus right) { throw null; } + public override string ToString() { throw null; } + } + public partial class ConfigurationGroupSchemaPropertiesFormat + { + public ConfigurationGroupSchemaPropertiesFormat() { } + public string Description { get { throw null; } set { } } + public Azure.ResourceManager.HybridNetwork.Models.ProvisioningState? ProvisioningState { get { throw null; } } + public string SchemaDefinition { get { throw null; } set { } } + public Azure.ResourceManager.HybridNetwork.Models.VersionState? VersionState { get { throw null; } } + } + public partial class ConfigurationGroupSchemaVersionUpdateState + { + public ConfigurationGroupSchemaVersionUpdateState() { } + public Azure.ResourceManager.HybridNetwork.Models.VersionState? VersionState { get { throw null; } set { } } + } + public abstract partial class ConfigurationGroupValuePropertiesFormat + { + protected ConfigurationGroupValuePropertiesFormat() { } + public string ConfigurationGroupSchemaName { get { throw null; } } + public string ConfigurationGroupSchemaOfferingLocation { get { throw null; } } + public Azure.ResourceManager.HybridNetwork.Models.DeploymentResourceIdReference ConfigurationGroupSchemaResourceReference { get { throw null; } set { } } + public Azure.ResourceManager.HybridNetwork.Models.ProvisioningState? ProvisioningState { get { throw null; } } + public string PublisherName { get { throw null; } } + public Azure.ResourceManager.HybridNetwork.Models.PublisherScope? PublisherScope { get { throw null; } } + } + public partial class ConfigurationValueWithoutSecrets : Azure.ResourceManager.HybridNetwork.Models.ConfigurationGroupValuePropertiesFormat + { + public ConfigurationValueWithoutSecrets() { } + public string ConfigurationValue { get { throw null; } set { } } + } + public partial class ConfigurationValueWithSecrets : Azure.ResourceManager.HybridNetwork.Models.ConfigurationGroupValuePropertiesFormat + { + public ConfigurationValueWithSecrets() { } + public string SecretConfigurationValue { get { throw null; } set { } } + } + public partial class ContainerizedNetworkFunctionDefinitionVersion : Azure.ResourceManager.HybridNetwork.Models.NetworkFunctionDefinitionVersionPropertiesFormat + { + public ContainerizedNetworkFunctionDefinitionVersion() { } + public Azure.ResourceManager.HybridNetwork.Models.ContainerizedNetworkFunctionTemplate NetworkFunctionTemplate { get { throw null; } set { } } + } + public abstract partial class ContainerizedNetworkFunctionTemplate + { + protected ContainerizedNetworkFunctionTemplate() { } + } + public partial class DependsOnProfile + { + public DependsOnProfile() { } + public System.Collections.Generic.IList InstallDependsOn { get { throw null; } } + public System.Collections.Generic.IList UninstallDependsOn { get { throw null; } } + public System.Collections.Generic.IList UpdateDependsOn { get { throw null; } } + } + public abstract partial class DeploymentResourceIdReference + { + protected DeploymentResourceIdReference() { } + } + public partial class DeploymentStatusProperties + { + internal DeploymentStatusProperties() { } + public System.DateTimeOffset? NextExpectedUpdateOn { get { throw null; } } + public Azure.ResourceManager.HybridNetwork.Models.ComponentKubernetesResources Resources { get { throw null; } } + public Azure.ResourceManager.HybridNetwork.Models.ComponentStatus? Status { get { throw null; } } + } + public partial class ExecuteRequestContent + { + public ExecuteRequestContent(string serviceEndpoint, Azure.ResourceManager.HybridNetwork.Models.RequestMetadata requestMetadata) { } + public Azure.ResourceManager.HybridNetwork.Models.RequestMetadata RequestMetadata { get { throw null; } } + public string ServiceEndpoint { get { throw null; } } + } + public partial class HelmArtifactProfile + { + public HelmArtifactProfile() { } + public string HelmPackageName { get { throw null; } set { } } + public string HelmPackageVersionRange { get { throw null; } set { } } + public System.Collections.Generic.IList ImagePullSecretsValuesPaths { get { throw null; } } + public System.Collections.Generic.IList RegistryValuesPaths { get { throw null; } } + } + public partial class HelmInstallConfig + { + public HelmInstallConfig() { } + public string Atomic { get { throw null; } set { } } + public string Timeout { get { throw null; } set { } } + public string Wait { get { throw null; } set { } } + } + public partial class HelmMappingRuleProfile + { + public HelmMappingRuleProfile() { } + public string HelmPackageVersion { get { throw null; } set { } } + public Azure.ResourceManager.HybridNetwork.Models.HelmMappingRuleProfileConfig Options { get { throw null; } set { } } + public string ReleaseName { get { throw null; } set { } } + public string ReleaseNamespace { get { throw null; } set { } } + public string Values { get { throw null; } set { } } + } + public partial class HelmMappingRuleProfileConfig + { + public HelmMappingRuleProfileConfig() { } + public Azure.ResourceManager.HybridNetwork.Models.HelmInstallConfig InstallOptions { get { throw null; } set { } } + public Azure.ResourceManager.HybridNetwork.Models.HelmUpgradeConfig UpgradeOptions { get { throw null; } set { } } + } + public partial class HelmUpgradeConfig + { + public HelmUpgradeConfig() { } + public string Atomic { get { throw null; } set { } } + public string Timeout { get { throw null; } set { } } + public string Wait { get { throw null; } set { } } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct HttpMethod : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public HttpMethod(string value) { throw null; } + public static Azure.ResourceManager.HybridNetwork.Models.HttpMethod Delete { get { throw null; } } + public static Azure.ResourceManager.HybridNetwork.Models.HttpMethod Get { get { throw null; } } + public static Azure.ResourceManager.HybridNetwork.Models.HttpMethod Patch { get { throw null; } } + public static Azure.ResourceManager.HybridNetwork.Models.HttpMethod Post { get { throw null; } } + public static Azure.ResourceManager.HybridNetwork.Models.HttpMethod Put { get { throw null; } } + public static Azure.ResourceManager.HybridNetwork.Models.HttpMethod Unknown { get { throw null; } } + public bool Equals(Azure.ResourceManager.HybridNetwork.Models.HttpMethod 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.HybridNetwork.Models.HttpMethod left, Azure.ResourceManager.HybridNetwork.Models.HttpMethod right) { throw null; } + public static implicit operator Azure.ResourceManager.HybridNetwork.Models.HttpMethod (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.HybridNetwork.Models.HttpMethod left, Azure.ResourceManager.HybridNetwork.Models.HttpMethod right) { throw null; } + public override string ToString() { throw null; } + } + public partial class HybridNetworkSku + { + public HybridNetworkSku(Azure.ResourceManager.HybridNetwork.Models.HybridNetworkSkuName name) { } + public Azure.ResourceManager.HybridNetwork.Models.HybridNetworkSkuName Name { get { throw null; } set { } } + public Azure.ResourceManager.HybridNetwork.Models.HybridNetworkSkuTier? Tier { get { throw null; } } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct HybridNetworkSkuName : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public HybridNetworkSkuName(string value) { throw null; } + public static Azure.ResourceManager.HybridNetwork.Models.HybridNetworkSkuName Basic { get { throw null; } } + public static Azure.ResourceManager.HybridNetwork.Models.HybridNetworkSkuName Standard { get { throw null; } } + public bool Equals(Azure.ResourceManager.HybridNetwork.Models.HybridNetworkSkuName 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.HybridNetwork.Models.HybridNetworkSkuName left, Azure.ResourceManager.HybridNetwork.Models.HybridNetworkSkuName right) { throw null; } + public static implicit operator Azure.ResourceManager.HybridNetwork.Models.HybridNetworkSkuName (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.HybridNetwork.Models.HybridNetworkSkuName left, Azure.ResourceManager.HybridNetwork.Models.HybridNetworkSkuName right) { throw null; } + public override string ToString() { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct HybridNetworkSkuTier : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public HybridNetworkSkuTier(string value) { throw null; } + public static Azure.ResourceManager.HybridNetwork.Models.HybridNetworkSkuTier Basic { get { throw null; } } + public static Azure.ResourceManager.HybridNetwork.Models.HybridNetworkSkuTier Standard { get { throw null; } } + public bool Equals(Azure.ResourceManager.HybridNetwork.Models.HybridNetworkSkuTier 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.HybridNetwork.Models.HybridNetworkSkuTier left, Azure.ResourceManager.HybridNetwork.Models.HybridNetworkSkuTier right) { throw null; } + public static implicit operator Azure.ResourceManager.HybridNetwork.Models.HybridNetworkSkuTier (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.HybridNetwork.Models.HybridNetworkSkuTier left, Azure.ResourceManager.HybridNetwork.Models.HybridNetworkSkuTier right) { throw null; } + public override string ToString() { throw null; } + } + public partial class ImageArtifactProfile + { + public ImageArtifactProfile() { } + public string ImageName { get { throw null; } set { } } + public string ImageVersion { get { throw null; } set { } } + } + public partial class KubernetesDaemonSet + { + internal KubernetesDaemonSet() { } + public int? AvailableNumberOfPods { get { throw null; } } + public System.DateTimeOffset? CreatedOn { get { throw null; } } + public int? CurrentNumberOfPods { get { throw null; } } + public int? DesiredNumberOfPods { get { throw null; } } + public string Name { get { throw null; } } + public string Namespace { get { throw null; } } + public int? ReadyNumberOfPods { get { throw null; } } + public int? UpToDateNumberOfPods { get { throw null; } } + } + public partial class KubernetesDeployment + { + internal KubernetesDeployment() { } + public int? AvailableNumberOfPods { get { throw null; } } + public System.DateTimeOffset? CreatedOn { get { throw null; } } + public int? DesiredNumberOfPods { get { throw null; } } + public string Name { get { throw null; } } + public string Namespace { get { throw null; } } + public int? ReadyNumberOfPods { get { throw null; } } + public int? UpToDateNumberOfPods { get { throw null; } } + } + public partial class KubernetesPod + { + internal KubernetesPod() { } + public System.DateTimeOffset? CreatedOn { get { throw null; } } + public int? DesiredNumberOfContainers { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Events { get { throw null; } } + public string Name { get { throw null; } } + public string Namespace { get { throw null; } } + public int? ReadyNumberOfContainers { get { throw null; } } + public Azure.ResourceManager.HybridNetwork.Models.PodStatus? Status { get { throw null; } } + } + public partial class KubernetesReplicaSet + { + internal KubernetesReplicaSet() { } + public System.DateTimeOffset? CreatedOn { get { throw null; } } + public int? CurrentNumberOfPods { get { throw null; } } + public int? DesiredNumberOfPods { get { throw null; } } + public string Name { get { throw null; } } + public string Namespace { get { throw null; } } + public int? ReadyNumberOfPods { get { throw null; } } + } + public partial class KubernetesStatefulSet + { + internal KubernetesStatefulSet() { } + public System.DateTimeOffset? CreatedOn { get { throw null; } } + public int? DesiredNumberOfPods { get { throw null; } } + public string Name { get { throw null; } } + public string Namespace { get { throw null; } } + public int? ReadyNumberOfPods { get { throw null; } } + } + public partial class ManagedResourceGroupConfiguration + { + public ManagedResourceGroupConfiguration() { } + public Azure.Core.AzureLocation? Location { get { throw null; } set { } } + public string Name { get { throw null; } set { } } + } + public partial class ManifestArtifactFormat + { + public ManifestArtifactFormat() { } + public string ArtifactName { get { throw null; } set { } } + public Azure.ResourceManager.HybridNetwork.Models.ArtifactType? ArtifactType { get { throw null; } set { } } + public string ArtifactVersion { get { throw null; } set { } } + } + public partial class MappingRuleProfile + { + public MappingRuleProfile() { } + public Azure.ResourceManager.HybridNetwork.Models.ApplicationEnablement? ApplicationEnablement { get { throw null; } set { } } + } + public partial class NetworkFunctionApplication + { + public NetworkFunctionApplication() { } + public Azure.ResourceManager.HybridNetwork.Models.DependsOnProfile DependsOnProfile { get { throw null; } set { } } + public string Name { get { throw null; } set { } } + } + public partial class NetworkFunctionDefinitionGroupPropertiesFormat + { + public NetworkFunctionDefinitionGroupPropertiesFormat() { } + public string Description { get { throw null; } set { } } + public Azure.ResourceManager.HybridNetwork.Models.ProvisioningState? ProvisioningState { get { throw null; } } + } + public partial class NetworkFunctionDefinitionResourceElementTemplateDetails : Azure.ResourceManager.HybridNetwork.Models.ResourceElementTemplate + { + public NetworkFunctionDefinitionResourceElementTemplateDetails() { } + public Azure.ResourceManager.HybridNetwork.Models.ArmResourceDefinitionResourceElementTemplate Configuration { get { throw null; } set { } } + } + public abstract partial class NetworkFunctionDefinitionVersionPropertiesFormat + { + protected NetworkFunctionDefinitionVersionPropertiesFormat() { } + public string DeployParameters { get { throw null; } set { } } + public string Description { get { throw null; } set { } } + public Azure.ResourceManager.HybridNetwork.Models.ProvisioningState? ProvisioningState { get { throw null; } } + public Azure.ResourceManager.HybridNetwork.Models.VersionState? VersionState { get { throw null; } } + } + public partial class NetworkFunctionDefinitionVersionUpdateState + { + public NetworkFunctionDefinitionVersionUpdateState() { } + public Azure.ResourceManager.HybridNetwork.Models.VersionState? VersionState { get { throw null; } set { } } + } + public abstract partial class NetworkFunctionPropertiesFormat + { + protected NetworkFunctionPropertiesFormat() { } + public bool? AllowSoftwareUpdate { get { throw null; } set { } } + public string NetworkFunctionDefinitionGroupName { get { throw null; } } + public string NetworkFunctionDefinitionOfferingLocation { get { throw null; } } + public string NetworkFunctionDefinitionVersion { get { throw null; } } + public Azure.ResourceManager.HybridNetwork.Models.DeploymentResourceIdReference NetworkFunctionDefinitionVersionResourceReference { get { throw null; } set { } } + public Azure.Core.ResourceIdentifier NfviId { get { throw null; } set { } } + public Azure.ResourceManager.HybridNetwork.Models.NfviType? NfviType { get { throw null; } set { } } + public Azure.ResourceManager.HybridNetwork.Models.ProvisioningState? ProvisioningState { get { throw null; } } + public string PublisherName { get { throw null; } } + public Azure.ResourceManager.HybridNetwork.Models.PublisherScope? PublisherScope { get { throw null; } } + public System.Collections.Generic.IList RoleOverrideValues { get { throw null; } } + } + public partial class NetworkFunctionValueWithoutSecrets : Azure.ResourceManager.HybridNetwork.Models.NetworkFunctionPropertiesFormat + { + public NetworkFunctionValueWithoutSecrets() { } + public string DeploymentValues { get { throw null; } set { } } + } + public partial class NetworkFunctionValueWithSecrets : Azure.ResourceManager.HybridNetwork.Models.NetworkFunctionPropertiesFormat + { + public NetworkFunctionValueWithSecrets() { } + public string SecretDeploymentValues { get { throw null; } set { } } + } + public partial class NetworkServiceDesignGroupPropertiesFormat + { + public NetworkServiceDesignGroupPropertiesFormat() { } + public string Description { get { throw null; } set { } } + public Azure.ResourceManager.HybridNetwork.Models.ProvisioningState? ProvisioningState { get { throw null; } } + } + public partial class NetworkServiceDesignVersionPropertiesFormat + { + public NetworkServiceDesignVersionPropertiesFormat() { } + public System.Collections.Generic.IDictionary ConfigurationGroupSchemaReferences { get { throw null; } } + public string Description { get { throw null; } set { } } + public System.Collections.Generic.IDictionary NfvisFromSite { get { throw null; } } + public Azure.ResourceManager.HybridNetwork.Models.ProvisioningState? ProvisioningState { get { throw null; } } + public System.Collections.Generic.IList ResourceElementTemplates { get { throw null; } } + public Azure.ResourceManager.HybridNetwork.Models.VersionState? VersionState { get { throw null; } } + } + public partial class NetworkServiceDesignVersionUpdateState + { + public NetworkServiceDesignVersionUpdateState() { } + public Azure.ResourceManager.HybridNetwork.Models.VersionState? VersionState { get { throw null; } set { } } + } + public partial class NfviDetails + { + public NfviDetails() { } + public string Name { get { throw null; } set { } } + public string NfviDetailsType { get { throw null; } set { } } + } + public abstract partial class NFVIs + { + protected NFVIs() { } + public string Name { get { throw null; } set { } } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct NfviType : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public NfviType(string value) { throw null; } + public static Azure.ResourceManager.HybridNetwork.Models.NfviType AzureArcKubernetes { get { throw null; } } + public static Azure.ResourceManager.HybridNetwork.Models.NfviType AzureCore { get { throw null; } } + public static Azure.ResourceManager.HybridNetwork.Models.NfviType AzureOperatorNexus { get { throw null; } } + public static Azure.ResourceManager.HybridNetwork.Models.NfviType Unknown { get { throw null; } } + public bool Equals(Azure.ResourceManager.HybridNetwork.Models.NfviType 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.HybridNetwork.Models.NfviType left, Azure.ResourceManager.HybridNetwork.Models.NfviType right) { throw null; } + public static implicit operator Azure.ResourceManager.HybridNetwork.Models.NfviType (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.HybridNetwork.Models.NfviType left, Azure.ResourceManager.HybridNetwork.Models.NfviType right) { throw null; } + public override string ToString() { throw null; } + } + public partial class NSDArtifactProfile + { + public NSDArtifactProfile() { } + public string ArtifactName { get { throw null; } set { } } + public Azure.Core.ResourceIdentifier ArtifactStoreReferenceId { get { throw null; } set { } } + public string ArtifactVersion { get { throw null; } set { } } + } + public partial class OpenDeploymentResourceReference : Azure.ResourceManager.HybridNetwork.Models.DeploymentResourceIdReference + { + public OpenDeploymentResourceReference() { } + public Azure.Core.ResourceIdentifier Id { get { throw null; } set { } } + } + public partial class PodEvent + { + internal PodEvent() { } + public Azure.ResourceManager.HybridNetwork.Models.PodEventType? EventType { get { throw null; } } + public System.DateTimeOffset? LastSeenOn { get { throw null; } } + public string Message { get { throw null; } } + public string Reason { get { throw null; } } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct PodEventType : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public PodEventType(string value) { throw null; } + public static Azure.ResourceManager.HybridNetwork.Models.PodEventType Normal { get { throw null; } } + public static Azure.ResourceManager.HybridNetwork.Models.PodEventType Warning { get { throw null; } } + public bool Equals(Azure.ResourceManager.HybridNetwork.Models.PodEventType 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.HybridNetwork.Models.PodEventType left, Azure.ResourceManager.HybridNetwork.Models.PodEventType right) { throw null; } + public static implicit operator Azure.ResourceManager.HybridNetwork.Models.PodEventType (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.HybridNetwork.Models.PodEventType left, Azure.ResourceManager.HybridNetwork.Models.PodEventType right) { throw null; } + public override string ToString() { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct PodStatus : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public PodStatus(string value) { throw null; } + public static Azure.ResourceManager.HybridNetwork.Models.PodStatus Failed { get { throw null; } } + public static Azure.ResourceManager.HybridNetwork.Models.PodStatus NotReady { get { throw null; } } + public static Azure.ResourceManager.HybridNetwork.Models.PodStatus Pending { get { throw null; } } + public static Azure.ResourceManager.HybridNetwork.Models.PodStatus Running { get { throw null; } } + public static Azure.ResourceManager.HybridNetwork.Models.PodStatus Succeeded { get { throw null; } } + public static Azure.ResourceManager.HybridNetwork.Models.PodStatus Terminating { get { throw null; } } + public static Azure.ResourceManager.HybridNetwork.Models.PodStatus Unknown { get { throw null; } } + public bool Equals(Azure.ResourceManager.HybridNetwork.Models.PodStatus 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.HybridNetwork.Models.PodStatus left, Azure.ResourceManager.HybridNetwork.Models.PodStatus right) { throw null; } + public static implicit operator Azure.ResourceManager.HybridNetwork.Models.PodStatus (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.HybridNetwork.Models.PodStatus left, Azure.ResourceManager.HybridNetwork.Models.PodStatus right) { throw null; } + public override string ToString() { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct ProvisioningState : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public ProvisioningState(string value) { throw null; } + public static Azure.ResourceManager.HybridNetwork.Models.ProvisioningState Accepted { get { throw null; } } + public static Azure.ResourceManager.HybridNetwork.Models.ProvisioningState Canceled { get { throw null; } } + public static Azure.ResourceManager.HybridNetwork.Models.ProvisioningState Converging { get { throw null; } } + public static Azure.ResourceManager.HybridNetwork.Models.ProvisioningState Deleted { get { throw null; } } + public static Azure.ResourceManager.HybridNetwork.Models.ProvisioningState Deleting { get { throw null; } } + public static Azure.ResourceManager.HybridNetwork.Models.ProvisioningState Failed { get { throw null; } } + public static Azure.ResourceManager.HybridNetwork.Models.ProvisioningState Succeeded { get { throw null; } } + public static Azure.ResourceManager.HybridNetwork.Models.ProvisioningState Unknown { get { throw null; } } + public bool Equals(Azure.ResourceManager.HybridNetwork.Models.ProvisioningState 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.HybridNetwork.Models.ProvisioningState left, Azure.ResourceManager.HybridNetwork.Models.ProvisioningState right) { throw null; } + public static implicit operator Azure.ResourceManager.HybridNetwork.Models.ProvisioningState (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.HybridNetwork.Models.ProvisioningState left, Azure.ResourceManager.HybridNetwork.Models.ProvisioningState right) { throw null; } + public override string ToString() { throw null; } + } + public partial class ProxyArtifactListOverview : Azure.ResourceManager.Models.ResourceData + { + public ProxyArtifactListOverview() { } + } + public partial class ProxyArtifactOverviewPropertiesValue + { + internal ProxyArtifactOverviewPropertiesValue() { } + public Azure.ResourceManager.HybridNetwork.Models.ArtifactState? ArtifactState { get { throw null; } } + public Azure.ResourceManager.HybridNetwork.Models.ArtifactType? ArtifactType { get { throw null; } } + public string ArtifactVersion { get { throw null; } } + } + public partial class ProxyArtifactVersionsListOverview : Azure.ResourceManager.Models.ResourceData + { + public ProxyArtifactVersionsListOverview() { } + public Azure.ResourceManager.HybridNetwork.Models.ProxyArtifactOverviewPropertiesValue Properties { get { throw null; } } + } + public partial class PublisherPropertiesFormat + { + public PublisherPropertiesFormat() { } + public Azure.ResourceManager.HybridNetwork.Models.ProvisioningState? ProvisioningState { get { throw null; } } + public Azure.ResourceManager.HybridNetwork.Models.PublisherScope? Scope { get { throw null; } set { } } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct PublisherScope : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public PublisherScope(string value) { throw null; } + public static Azure.ResourceManager.HybridNetwork.Models.PublisherScope Private { get { throw null; } } + public static Azure.ResourceManager.HybridNetwork.Models.PublisherScope Unknown { get { throw null; } } + public bool Equals(Azure.ResourceManager.HybridNetwork.Models.PublisherScope 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.HybridNetwork.Models.PublisherScope left, Azure.ResourceManager.HybridNetwork.Models.PublisherScope right) { throw null; } + public static implicit operator Azure.ResourceManager.HybridNetwork.Models.PublisherScope (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.HybridNetwork.Models.PublisherScope left, Azure.ResourceManager.HybridNetwork.Models.PublisherScope right) { throw null; } + public override string ToString() { throw null; } + } + public partial class RequestMetadata + { + public RequestMetadata(string relativePath, Azure.ResourceManager.HybridNetwork.Models.HttpMethod httpMethod, string serializedBody) { } + public string ApiVersion { get { throw null; } set { } } + public Azure.ResourceManager.HybridNetwork.Models.HttpMethod HttpMethod { get { throw null; } } + public string RelativePath { get { throw null; } } + public string SerializedBody { get { throw null; } } + } + public abstract partial class ResourceElementTemplate + { + protected ResourceElementTemplate() { } + public Azure.ResourceManager.HybridNetwork.Models.DependsOnProfile DependsOnProfile { get { throw null; } set { } } + public string Name { get { throw null; } set { } } + } + public partial class SecretDeploymentResourceReference : Azure.ResourceManager.HybridNetwork.Models.DeploymentResourceIdReference + { + public SecretDeploymentResourceReference() { } + public Azure.Core.ResourceIdentifier Id { get { throw null; } set { } } + } + public partial class SiteNetworkServicePropertiesFormat + { + public SiteNetworkServicePropertiesFormat() { } + public System.Collections.Generic.IDictionary DesiredStateConfigurationGroupValueReferences { get { throw null; } } + public System.Collections.Generic.IReadOnlyDictionary LastStateConfigurationGroupValueReferences { get { throw null; } } + public string LastStateNetworkServiceDesignVersionName { get { throw null; } } + public Azure.ResourceManager.HybridNetwork.Models.ManagedResourceGroupConfiguration ManagedResourceGroupConfiguration { get { throw null; } set { } } + public string NetworkServiceDesignGroupName { get { throw null; } } + public string NetworkServiceDesignVersionName { get { throw null; } } + public string NetworkServiceDesignVersionOfferingLocation { get { throw null; } } + public Azure.ResourceManager.HybridNetwork.Models.DeploymentResourceIdReference NetworkServiceDesignVersionResourceReference { get { throw null; } set { } } + public Azure.ResourceManager.HybridNetwork.Models.ProvisioningState? ProvisioningState { get { throw null; } } + public string PublisherName { get { throw null; } } + public Azure.ResourceManager.HybridNetwork.Models.PublisherScope? PublisherScope { get { throw null; } } + public Azure.Core.ResourceIdentifier SiteReferenceId { get { throw null; } set { } } + } + public partial class SitePropertiesFormat + { + public SitePropertiesFormat() { } + public System.Collections.Generic.IList Nfvis { get { throw null; } } + public Azure.ResourceManager.HybridNetwork.Models.ProvisioningState? ProvisioningState { get { throw null; } } + public System.Collections.Generic.IReadOnlyList SiteNetworkServiceReferences { get { throw null; } } + } + public partial class TagsObject + { + public TagsObject() { } + public System.Collections.Generic.IDictionary Tags { get { throw null; } } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct TemplateType : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public TemplateType(string value) { throw null; } + public static Azure.ResourceManager.HybridNetwork.Models.TemplateType ArmTemplate { get { throw null; } } + public static Azure.ResourceManager.HybridNetwork.Models.TemplateType Unknown { get { throw null; } } + public bool Equals(Azure.ResourceManager.HybridNetwork.Models.TemplateType 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.HybridNetwork.Models.TemplateType left, Azure.ResourceManager.HybridNetwork.Models.TemplateType right) { throw null; } + public static implicit operator Azure.ResourceManager.HybridNetwork.Models.TemplateType (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.HybridNetwork.Models.TemplateType left, Azure.ResourceManager.HybridNetwork.Models.TemplateType right) { throw null; } + public override string ToString() { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct VersionState : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public VersionState(string value) { throw null; } + public static Azure.ResourceManager.HybridNetwork.Models.VersionState Active { get { throw null; } } + public static Azure.ResourceManager.HybridNetwork.Models.VersionState Deprecated { get { throw null; } } + public static Azure.ResourceManager.HybridNetwork.Models.VersionState Preview { get { throw null; } } + public static Azure.ResourceManager.HybridNetwork.Models.VersionState Unknown { get { throw null; } } + public static Azure.ResourceManager.HybridNetwork.Models.VersionState Validating { get { throw null; } } + public static Azure.ResourceManager.HybridNetwork.Models.VersionState ValidationFailed { get { throw null; } } + public bool Equals(Azure.ResourceManager.HybridNetwork.Models.VersionState 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.HybridNetwork.Models.VersionState left, Azure.ResourceManager.HybridNetwork.Models.VersionState right) { throw null; } + public static implicit operator Azure.ResourceManager.HybridNetwork.Models.VersionState (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.HybridNetwork.Models.VersionState left, Azure.ResourceManager.HybridNetwork.Models.VersionState right) { throw null; } + public override string ToString() { throw null; } + } + public partial class VhdImageArtifactProfile + { + public VhdImageArtifactProfile() { } + public string VhdName { get { throw null; } set { } } + public string VhdVersion { get { throw null; } set { } } + } + public partial class VirtualNetworkFunctionDefinitionVersion : Azure.ResourceManager.HybridNetwork.Models.NetworkFunctionDefinitionVersionPropertiesFormat + { + public VirtualNetworkFunctionDefinitionVersion() { } + public Azure.ResourceManager.HybridNetwork.Models.VirtualNetworkFunctionTemplate NetworkFunctionTemplate { get { throw null; } set { } } + } + public abstract partial class VirtualNetworkFunctionTemplate + { + protected VirtualNetworkFunctionTemplate() { } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/assets.json b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/assets.json new file mode 100644 index 000000000000..7e0945cad72a --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/assets.json @@ -0,0 +1,6 @@ +{ + "AssetsRepo": "Azure/azure-sdk-assets", + "AssetsRepoPrefixPath": "net", + "TagPrefix": "net/hybridnetwork/Azure.ResourceManager.HybridNetwork", + "Tag": "net/hybridnetwork/Azure.ResourceManager.HybridNetwork_0c12edd669" +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/samples/Azure.ResourceManager.HybridNetwork.Samples.csproj b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/samples/Azure.ResourceManager.HybridNetwork.Samples.csproj new file mode 100644 index 000000000000..323462fa107e --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/samples/Azure.ResourceManager.HybridNetwork.Samples.csproj @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/samples/Generated/Samples/Sample_ArtifactManifestCollection.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/samples/Generated/Samples/Sample_ArtifactManifestCollection.cs new file mode 100644 index 000000000000..f46c43d7d5df --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/samples/Generated/Samples/Sample_ArtifactManifestCollection.cs @@ -0,0 +1,228 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.HybridNetwork; +using Azure.ResourceManager.HybridNetwork.Models; + +namespace Azure.ResourceManager.HybridNetwork.Samples +{ + public partial class Sample_ArtifactManifestCollection + { + // Get artifact manifest list resource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_GetArtifactManifestListResource() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/ArtifactManifestListByArtifactStore.json + // this example is just showing the usage of "ArtifactManifests_ListByArtifactStore" 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 ArtifactStoreResource created on azure + // for more information of creating ArtifactStoreResource, please refer to the document of ArtifactStoreResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string publisherName = "TestPublisher"; + string artifactStoreName = "TestArtifactStore"; + ResourceIdentifier artifactStoreResourceId = ArtifactStoreResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, publisherName, artifactStoreName); + ArtifactStoreResource artifactStore = client.GetArtifactStoreResource(artifactStoreResourceId); + + // get the collection of this ArtifactManifestResource + ArtifactManifestCollection collection = artifactStore.GetArtifactManifests(); + + // invoke the operation and iterate over the result + await foreach (ArtifactManifestResource 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 + ArtifactManifestData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // Create or update the artifact manifest resource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_CreateOrUpdateTheArtifactManifestResource() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/ArtifactManifestCreate.json + // this example is just showing the usage of "ArtifactManifests_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 ArtifactStoreResource created on azure + // for more information of creating ArtifactStoreResource, please refer to the document of ArtifactStoreResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string publisherName = "TestPublisher"; + string artifactStoreName = "TestArtifactStore"; + ResourceIdentifier artifactStoreResourceId = ArtifactStoreResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, publisherName, artifactStoreName); + ArtifactStoreResource artifactStore = client.GetArtifactStoreResource(artifactStoreResourceId); + + // get the collection of this ArtifactManifestResource + ArtifactManifestCollection collection = artifactStore.GetArtifactManifests(); + + // invoke the operation + string artifactManifestName = "TestManifest"; + ArtifactManifestData data = new ArtifactManifestData(new AzureLocation("eastus")) + { + Properties = new ArtifactManifestPropertiesFormat() + { + Artifacts = +{ +new ManifestArtifactFormat() +{ +ArtifactName = "fed-rbac", +ArtifactType = ArtifactType.OCIArtifact, +ArtifactVersion = "1.0.0", +},new ManifestArtifactFormat() +{ +ArtifactName = "nginx", +ArtifactType = ArtifactType.OCIArtifact, +ArtifactVersion = "v1", +} +}, + }, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, artifactManifestName, data); + ArtifactManifestResource 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 + ArtifactManifestData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Get a artifact manifest resource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetAArtifactManifestResource() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/ArtifactManifestGet.json + // this example is just showing the usage of "ArtifactManifests_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 ArtifactStoreResource created on azure + // for more information of creating ArtifactStoreResource, please refer to the document of ArtifactStoreResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string publisherName = "TestPublisher"; + string artifactStoreName = "TestArtifactStore"; + ResourceIdentifier artifactStoreResourceId = ArtifactStoreResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, publisherName, artifactStoreName); + ArtifactStoreResource artifactStore = client.GetArtifactStoreResource(artifactStoreResourceId); + + // get the collection of this ArtifactManifestResource + ArtifactManifestCollection collection = artifactStore.GetArtifactManifests(); + + // invoke the operation + string artifactManifestName = "TestManifest"; + ArtifactManifestResource result = await collection.GetAsync(artifactManifestName); + + // 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 + ArtifactManifestData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Get a artifact manifest resource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_GetAArtifactManifestResource() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/ArtifactManifestGet.json + // this example is just showing the usage of "ArtifactManifests_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 ArtifactStoreResource created on azure + // for more information of creating ArtifactStoreResource, please refer to the document of ArtifactStoreResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string publisherName = "TestPublisher"; + string artifactStoreName = "TestArtifactStore"; + ResourceIdentifier artifactStoreResourceId = ArtifactStoreResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, publisherName, artifactStoreName); + ArtifactStoreResource artifactStore = client.GetArtifactStoreResource(artifactStoreResourceId); + + // get the collection of this ArtifactManifestResource + ArtifactManifestCollection collection = artifactStore.GetArtifactManifests(); + + // invoke the operation + string artifactManifestName = "TestManifest"; + bool result = await collection.ExistsAsync(artifactManifestName); + + Console.WriteLine($"Succeeded: {result}"); + } + + // Get a artifact manifest resource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAArtifactManifestResource() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/ArtifactManifestGet.json + // this example is just showing the usage of "ArtifactManifests_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 ArtifactStoreResource created on azure + // for more information of creating ArtifactStoreResource, please refer to the document of ArtifactStoreResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string publisherName = "TestPublisher"; + string artifactStoreName = "TestArtifactStore"; + ResourceIdentifier artifactStoreResourceId = ArtifactStoreResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, publisherName, artifactStoreName); + ArtifactStoreResource artifactStore = client.GetArtifactStoreResource(artifactStoreResourceId); + + // get the collection of this ArtifactManifestResource + ArtifactManifestCollection collection = artifactStore.GetArtifactManifests(); + + // invoke the operation + string artifactManifestName = "TestManifest"; + NullableResponse response = await collection.GetIfExistsAsync(artifactManifestName); + ArtifactManifestResource 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 + ArtifactManifestData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/samples/Generated/Samples/Sample_ArtifactManifestResource.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/samples/Generated/Samples/Sample_ArtifactManifestResource.cs new file mode 100644 index 000000000000..d7906b9d3819 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/samples/Generated/Samples/Sample_ArtifactManifestResource.cs @@ -0,0 +1,187 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.HybridNetwork; +using Azure.ResourceManager.HybridNetwork.Models; + +namespace Azure.ResourceManager.HybridNetwork.Samples +{ + public partial class Sample_ArtifactManifestResource + { + // Delete a artifact manifest resource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_DeleteAArtifactManifestResource() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/ArtifactManifestDelete.json + // this example is just showing the usage of "ArtifactManifests_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 ArtifactManifestResource created on azure + // for more information of creating ArtifactManifestResource, please refer to the document of ArtifactManifestResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string publisherName = "TestPublisher"; + string artifactStoreName = "TestArtifactStore"; + string artifactManifestName = "TestManifest"; + ResourceIdentifier artifactManifestResourceId = ArtifactManifestResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, publisherName, artifactStoreName, artifactManifestName); + ArtifactManifestResource artifactManifest = client.GetArtifactManifestResource(artifactManifestResourceId); + + // invoke the operation + await artifactManifest.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine($"Succeeded"); + } + + // Get a artifact manifest resource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetAArtifactManifestResource() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/ArtifactManifestGet.json + // this example is just showing the usage of "ArtifactManifests_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 ArtifactManifestResource created on azure + // for more information of creating ArtifactManifestResource, please refer to the document of ArtifactManifestResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string publisherName = "TestPublisher"; + string artifactStoreName = "TestArtifactStore"; + string artifactManifestName = "TestManifest"; + ResourceIdentifier artifactManifestResourceId = ArtifactManifestResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, publisherName, artifactStoreName, artifactManifestName); + ArtifactManifestResource artifactManifest = client.GetArtifactManifestResource(artifactManifestResourceId); + + // invoke the operation + ArtifactManifestResource result = await artifactManifest.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 + ArtifactManifestData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Update a artifact manifest resource tags + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_UpdateAArtifactManifestResourceTags() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/ArtifactManifestUpdateTags.json + // this example is just showing the usage of "ArtifactManifests_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 ArtifactManifestResource created on azure + // for more information of creating ArtifactManifestResource, please refer to the document of ArtifactManifestResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string publisherName = "TestPublisher"; + string artifactStoreName = "TestArtifactStore"; + string artifactManifestName = "TestManifest"; + ResourceIdentifier artifactManifestResourceId = ArtifactManifestResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, publisherName, artifactStoreName, artifactManifestName); + ArtifactManifestResource artifactManifest = client.GetArtifactManifestResource(artifactManifestResourceId); + + // invoke the operation + TagsObject tagsObject = new TagsObject() + { + Tags = +{ +["tag1"] = "value1", +["tag2"] = "value2", +}, + }; + ArtifactManifestResource result = await artifactManifest.UpdateAsync(tagsObject); + + // 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 + ArtifactManifestData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // List a credential for artifact manifest + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetCredential_ListACredentialForArtifactManifest() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/ArtifactManifestListCredential.json + // this example is just showing the usage of "ArtifactManifests_ListCredential" 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 ArtifactManifestResource created on azure + // for more information of creating ArtifactManifestResource, please refer to the document of ArtifactManifestResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string publisherName = "TestPublisher"; + string artifactStoreName = "TestArtifactStore"; + string artifactManifestName = "TestArtifactManifestName"; + ResourceIdentifier artifactManifestResourceId = ArtifactManifestResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, publisherName, artifactStoreName, artifactManifestName); + ArtifactManifestResource artifactManifest = client.GetArtifactManifestResource(artifactManifestResourceId); + + // invoke the operation + ArtifactAccessCredential result = await artifactManifest.GetCredentialAsync(); + + Console.WriteLine($"Succeeded: {result}"); + } + + // Update artifact manifest state + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task UpdateState_UpdateArtifactManifestState() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/ArtifactManifestUpdateState.json + // this example is just showing the usage of "ArtifactManifests_UpdateState" 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 ArtifactManifestResource created on azure + // for more information of creating ArtifactManifestResource, please refer to the document of ArtifactManifestResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string publisherName = "TestPublisher"; + string artifactStoreName = "TestArtifactStore"; + string artifactManifestName = "TestArtifactManifestName"; + ResourceIdentifier artifactManifestResourceId = ArtifactManifestResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, publisherName, artifactStoreName, artifactManifestName); + ArtifactManifestResource artifactManifest = client.GetArtifactManifestResource(artifactManifestResourceId); + + // invoke the operation + ArtifactManifestUpdateState artifactManifestUpdateState = new ArtifactManifestUpdateState() + { + ArtifactManifestState = ArtifactManifestState.Uploaded, + }; + ArmOperation lro = await artifactManifest.UpdateStateAsync(WaitUntil.Completed, artifactManifestUpdateState); + ArtifactManifestUpdateState result = lro.Value; + + Console.WriteLine($"Succeeded: {result}"); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/samples/Generated/Samples/Sample_ArtifactStoreCollection.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/samples/Generated/Samples/Sample_ArtifactStoreCollection.cs new file mode 100644 index 000000000000..7a794b5f47ae --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/samples/Generated/Samples/Sample_ArtifactStoreCollection.cs @@ -0,0 +1,216 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.HybridNetwork; +using Azure.ResourceManager.HybridNetwork.Models; + +namespace Azure.ResourceManager.HybridNetwork.Samples +{ + public partial class Sample_ArtifactStoreCollection + { + // Get application groups under a publisher resource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_GetApplicationGroupsUnderAPublisherResource() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/ArtifactStoresListByPublisherName.json + // this example is just showing the usage of "ArtifactStores_ListByPublisher" 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 PublisherResource created on azure + // for more information of creating PublisherResource, please refer to the document of PublisherResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string publisherName = "TestPublisher"; + ResourceIdentifier publisherResourceId = PublisherResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, publisherName); + PublisherResource publisher = client.GetPublisherResource(publisherResourceId); + + // get the collection of this ArtifactStoreResource + ArtifactStoreCollection collection = publisher.GetArtifactStores(); + + // invoke the operation and iterate over the result + await foreach (ArtifactStoreResource 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 + ArtifactStoreData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // Create or update an artifact store of publisher resource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_CreateOrUpdateAnArtifactStoreOfPublisherResource() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/ArtifactStoreCreate.json + // this example is just showing the usage of "ArtifactStores_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 PublisherResource created on azure + // for more information of creating PublisherResource, please refer to the document of PublisherResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string publisherName = "TestPublisher"; + ResourceIdentifier publisherResourceId = PublisherResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, publisherName); + PublisherResource publisher = client.GetPublisherResource(publisherResourceId); + + // get the collection of this ArtifactStoreResource + ArtifactStoreCollection collection = publisher.GetArtifactStores(); + + // invoke the operation + string artifactStoreName = "TestArtifactStore"; + ArtifactStoreData data = new ArtifactStoreData(new AzureLocation("eastus")) + { + Properties = new ArtifactStorePropertiesFormat() + { + StoreType = ArtifactStoreType.AzureContainerRegistry, + ReplicationStrategy = ArtifactReplicationStrategy.SingleReplication, + ManagedResourceGroupConfiguration = new ArtifactStorePropertiesFormatManagedResourceGroupConfiguration() + { + Name = "testRg", + Location = new AzureLocation("eastus"), + }, + }, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, artifactStoreName, data); + ArtifactStoreResource 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 + ArtifactStoreData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Get a artifact store resource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetAArtifactStoreResource() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/ArtifactStoreGet.json + // this example is just showing the usage of "ArtifactStores_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 PublisherResource created on azure + // for more information of creating PublisherResource, please refer to the document of PublisherResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string publisherName = "TestPublisher"; + ResourceIdentifier publisherResourceId = PublisherResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, publisherName); + PublisherResource publisher = client.GetPublisherResource(publisherResourceId); + + // get the collection of this ArtifactStoreResource + ArtifactStoreCollection collection = publisher.GetArtifactStores(); + + // invoke the operation + string artifactStoreName = "TestArtifactStoreName"; + ArtifactStoreResource result = await collection.GetAsync(artifactStoreName); + + // 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 + ArtifactStoreData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Get a artifact store resource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_GetAArtifactStoreResource() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/ArtifactStoreGet.json + // this example is just showing the usage of "ArtifactStores_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 PublisherResource created on azure + // for more information of creating PublisherResource, please refer to the document of PublisherResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string publisherName = "TestPublisher"; + ResourceIdentifier publisherResourceId = PublisherResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, publisherName); + PublisherResource publisher = client.GetPublisherResource(publisherResourceId); + + // get the collection of this ArtifactStoreResource + ArtifactStoreCollection collection = publisher.GetArtifactStores(); + + // invoke the operation + string artifactStoreName = "TestArtifactStoreName"; + bool result = await collection.ExistsAsync(artifactStoreName); + + Console.WriteLine($"Succeeded: {result}"); + } + + // Get a artifact store resource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAArtifactStoreResource() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/ArtifactStoreGet.json + // this example is just showing the usage of "ArtifactStores_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 PublisherResource created on azure + // for more information of creating PublisherResource, please refer to the document of PublisherResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string publisherName = "TestPublisher"; + ResourceIdentifier publisherResourceId = PublisherResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, publisherName); + PublisherResource publisher = client.GetPublisherResource(publisherResourceId); + + // get the collection of this ArtifactStoreResource + ArtifactStoreCollection collection = publisher.GetArtifactStores(); + + // invoke the operation + string artifactStoreName = "TestArtifactStoreName"; + NullableResponse response = await collection.GetIfExistsAsync(artifactStoreName); + ArtifactStoreResource 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 + ArtifactStoreData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/samples/Generated/Samples/Sample_ArtifactStoreResource.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/samples/Generated/Samples/Sample_ArtifactStoreResource.cs new file mode 100644 index 000000000000..e5db3180e782 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/samples/Generated/Samples/Sample_ArtifactStoreResource.cs @@ -0,0 +1,219 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.HybridNetwork; +using Azure.ResourceManager.HybridNetwork.Models; + +namespace Azure.ResourceManager.HybridNetwork.Samples +{ + public partial class Sample_ArtifactStoreResource + { + // Delete a artifact store of publisher resource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_DeleteAArtifactStoreOfPublisherResource() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/ArtifactStoreDelete.json + // this example is just showing the usage of "ArtifactStores_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 ArtifactStoreResource created on azure + // for more information of creating ArtifactStoreResource, please refer to the document of ArtifactStoreResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string publisherName = "TestPublisher"; + string artifactStoreName = "TestArtifactStore"; + ResourceIdentifier artifactStoreResourceId = ArtifactStoreResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, publisherName, artifactStoreName); + ArtifactStoreResource artifactStore = client.GetArtifactStoreResource(artifactStoreResourceId); + + // invoke the operation + await artifactStore.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine($"Succeeded"); + } + + // Get a artifact store resource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetAArtifactStoreResource() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/ArtifactStoreGet.json + // this example is just showing the usage of "ArtifactStores_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 ArtifactStoreResource created on azure + // for more information of creating ArtifactStoreResource, please refer to the document of ArtifactStoreResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string publisherName = "TestPublisher"; + string artifactStoreName = "TestArtifactStoreName"; + ResourceIdentifier artifactStoreResourceId = ArtifactStoreResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, publisherName, artifactStoreName); + ArtifactStoreResource artifactStore = client.GetArtifactStoreResource(artifactStoreResourceId); + + // invoke the operation + ArtifactStoreResource result = await artifactStore.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 + ArtifactStoreData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Update artifact store resource tags + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_UpdateArtifactStoreResourceTags() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/ArtifactStoreUpdateTags.json + // this example is just showing the usage of "ArtifactStores_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 ArtifactStoreResource created on azure + // for more information of creating ArtifactStoreResource, please refer to the document of ArtifactStoreResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string publisherName = "TestPublisher"; + string artifactStoreName = "TestArtifactStore"; + ResourceIdentifier artifactStoreResourceId = ArtifactStoreResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, publisherName, artifactStoreName); + ArtifactStoreResource artifactStore = client.GetArtifactStoreResource(artifactStoreResourceId); + + // invoke the operation + TagsObject tagsObject = new TagsObject() + { + Tags = +{ +["tag1"] = "value1", +["tag2"] = "value2", +}, + }; + ArtifactStoreResource result = await artifactStore.UpdateAsync(tagsObject); + + // 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 + ArtifactStoreData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // List artifacts under an artifact store + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetProxyArtifacts_ListArtifactsUnderAnArtifactStore() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/PureProxyArtifact/ArtifactList.json + // this example is just showing the usage of "ProxyArtifact_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); + + // this example assumes you already have this ArtifactStoreResource created on azure + // for more information of creating ArtifactStoreResource, please refer to the document of ArtifactStoreResource + string subscriptionId = "subid"; + string resourceGroupName = "TestResourceGroup"; + string publisherName = "TestPublisher"; + string artifactStoreName = "TestArtifactStoreName"; + ResourceIdentifier artifactStoreResourceId = ArtifactStoreResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, publisherName, artifactStoreName); + ArtifactStoreResource artifactStore = client.GetArtifactStoreResource(artifactStoreResourceId); + + // invoke the operation and iterate over the result + await foreach (ProxyArtifactListOverview item in artifactStore.GetProxyArtifactsAsync()) + { + Console.WriteLine($"Succeeded: {item}"); + } + + Console.WriteLine($"Succeeded"); + } + + // Get an artifact overview + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetProxyArtifacts_GetAnArtifactOverview() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/PureProxyArtifact/ArtifactGet.json + // this example is just showing the usage of "ProxyArtifact_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 ArtifactStoreResource created on azure + // for more information of creating ArtifactStoreResource, please refer to the document of ArtifactStoreResource + string subscriptionId = "subid"; + string resourceGroupName = "TestResourceGroup"; + string publisherName = "TestPublisher"; + string artifactStoreName = "TestArtifactStoreName"; + ResourceIdentifier artifactStoreResourceId = ArtifactStoreResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, publisherName, artifactStoreName); + ArtifactStoreResource artifactStore = client.GetArtifactStoreResource(artifactStoreResourceId); + + // invoke the operation and iterate over the result + string artifactName = "fedrbac"; + await foreach (ProxyArtifactVersionsListOverview item in artifactStore.GetProxyArtifactsAsync(artifactName)) + { + Console.WriteLine($"Succeeded: {item}"); + } + + Console.WriteLine($"Succeeded"); + } + + // Update an artifact state + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task UpdateStateProxyArtifact_UpdateAnArtifactState() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/PureProxyArtifact/ArtifactChangeState.json + // this example is just showing the usage of "ProxyArtifact_UpdateState" 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 ArtifactStoreResource created on azure + // for more information of creating ArtifactStoreResource, please refer to the document of ArtifactStoreResource + string subscriptionId = "subid"; + string resourceGroupName = "TestResourceGroup"; + string publisherName = "TestPublisher"; + string artifactStoreName = "TestArtifactStoreName"; + ResourceIdentifier artifactStoreResourceId = ArtifactStoreResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, publisherName, artifactStoreName); + ArtifactStoreResource artifactStore = client.GetArtifactStoreResource(artifactStoreResourceId); + + // invoke the operation + string artifactVersionName = "1.0.0"; + string artifactName = "fedrbac"; + ArtifactChangeState artifactChangeState = new ArtifactChangeState() + { + ArtifactState = ArtifactState.Deprecated, + }; + ArmOperation lro = await artifactStore.UpdateStateProxyArtifactAsync(WaitUntil.Completed, artifactVersionName, artifactName, artifactChangeState); + ProxyArtifactVersionsListOverview result = lro.Value; + + Console.WriteLine($"Succeeded: {result}"); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/samples/Generated/Samples/Sample_ComponentCollection.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/samples/Generated/Samples/Sample_ComponentCollection.cs new file mode 100644 index 000000000000..ea73ea660fbb --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/samples/Generated/Samples/Sample_ComponentCollection.cs @@ -0,0 +1,166 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.HybridNetwork; + +namespace Azure.ResourceManager.HybridNetwork.Samples +{ + public partial class Sample_ComponentCollection + { + // Get component resource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetComponentResource() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/ComponentGet.json + // this example is just showing the usage of "Components_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 NetworkFunctionResource created on azure + // for more information of creating NetworkFunctionResource, please refer to the document of NetworkFunctionResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string networkFunctionName = "testNf"; + ResourceIdentifier networkFunctionResourceId = NetworkFunctionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, networkFunctionName); + NetworkFunctionResource networkFunction = client.GetNetworkFunctionResource(networkFunctionResourceId); + + // get the collection of this ComponentResource + ComponentCollection collection = networkFunction.GetComponents(); + + // invoke the operation + string componentName = "testComponent"; + ComponentResource result = await collection.GetAsync(componentName); + + // 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 + ComponentData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Get component resource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_GetComponentResource() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/ComponentGet.json + // this example is just showing the usage of "Components_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 NetworkFunctionResource created on azure + // for more information of creating NetworkFunctionResource, please refer to the document of NetworkFunctionResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string networkFunctionName = "testNf"; + ResourceIdentifier networkFunctionResourceId = NetworkFunctionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, networkFunctionName); + NetworkFunctionResource networkFunction = client.GetNetworkFunctionResource(networkFunctionResourceId); + + // get the collection of this ComponentResource + ComponentCollection collection = networkFunction.GetComponents(); + + // invoke the operation + string componentName = "testComponent"; + bool result = await collection.ExistsAsync(componentName); + + Console.WriteLine($"Succeeded: {result}"); + } + + // Get component resource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetComponentResource() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/ComponentGet.json + // this example is just showing the usage of "Components_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 NetworkFunctionResource created on azure + // for more information of creating NetworkFunctionResource, please refer to the document of NetworkFunctionResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string networkFunctionName = "testNf"; + ResourceIdentifier networkFunctionResourceId = NetworkFunctionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, networkFunctionName); + NetworkFunctionResource networkFunction = client.GetNetworkFunctionResource(networkFunctionResourceId); + + // get the collection of this ComponentResource + ComponentCollection collection = networkFunction.GetComponents(); + + // invoke the operation + string componentName = "testComponent"; + NullableResponse response = await collection.GetIfExistsAsync(componentName); + ComponentResource 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 + ComponentData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + // List components in network function + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_ListComponentsInNetworkFunction() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/ComponentListByNetworkFunction.json + // this example is just showing the usage of "Components_ListByNetworkFunction" 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 NetworkFunctionResource created on azure + // for more information of creating NetworkFunctionResource, please refer to the document of NetworkFunctionResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string networkFunctionName = "testNf"; + ResourceIdentifier networkFunctionResourceId = NetworkFunctionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, networkFunctionName); + NetworkFunctionResource networkFunction = client.GetNetworkFunctionResource(networkFunctionResourceId); + + // get the collection of this ComponentResource + ComponentCollection collection = networkFunction.GetComponents(); + + // invoke the operation and iterate over the result + await foreach (ComponentResource 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 + ComponentData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/samples/Generated/Samples/Sample_ComponentResource.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/samples/Generated/Samples/Sample_ComponentResource.cs new file mode 100644 index 000000000000..47bb5361ba58 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/samples/Generated/Samples/Sample_ComponentResource.cs @@ -0,0 +1,51 @@ +// 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; +using Azure.ResourceManager.HybridNetwork; + +namespace Azure.ResourceManager.HybridNetwork.Samples +{ + public partial class Sample_ComponentResource + { + // Get component resource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetComponentResource() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/ComponentGet.json + // this example is just showing the usage of "Components_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 ComponentResource created on azure + // for more information of creating ComponentResource, please refer to the document of ComponentResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string networkFunctionName = "testNf"; + string componentName = "testComponent"; + ResourceIdentifier componentResourceId = ComponentResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, networkFunctionName, componentName); + ComponentResource component = client.GetComponentResource(componentResourceId); + + // invoke the operation + ComponentResource result = await component.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 + ComponentData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/samples/Generated/Samples/Sample_ConfigurationGroupSchemaCollection.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/samples/Generated/Samples/Sample_ConfigurationGroupSchemaCollection.cs new file mode 100644 index 000000000000..81429c8ca7a2 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/samples/Generated/Samples/Sample_ConfigurationGroupSchemaCollection.cs @@ -0,0 +1,211 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.HybridNetwork; +using Azure.ResourceManager.HybridNetwork.Models; + +namespace Azure.ResourceManager.HybridNetwork.Samples +{ + public partial class Sample_ConfigurationGroupSchemaCollection + { + // Get networkFunctionDefinition groups under publisher resource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_GetNetworkFunctionDefinitionGroupsUnderPublisherResource() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/ConfigurationGroupSchemaListByPublisherName.json + // this example is just showing the usage of "ConfigurationGroupSchemas_ListByPublisher" 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 PublisherResource created on azure + // for more information of creating PublisherResource, please refer to the document of PublisherResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string publisherName = "testPublisher"; + ResourceIdentifier publisherResourceId = PublisherResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, publisherName); + PublisherResource publisher = client.GetPublisherResource(publisherResourceId); + + // get the collection of this ConfigurationGroupSchemaResource + ConfigurationGroupSchemaCollection collection = publisher.GetConfigurationGroupSchemas(); + + // invoke the operation and iterate over the result + await foreach (ConfigurationGroupSchemaResource 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 + ConfigurationGroupSchemaData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // Create or update the network function definition group + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_CreateOrUpdateTheNetworkFunctionDefinitionGroup() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/ConfigurationGroupSchemaCreate.json + // this example is just showing the usage of "ConfigurationGroupSchemas_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 PublisherResource created on azure + // for more information of creating PublisherResource, please refer to the document of PublisherResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string publisherName = "testPublisher"; + ResourceIdentifier publisherResourceId = PublisherResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, publisherName); + PublisherResource publisher = client.GetPublisherResource(publisherResourceId); + + // get the collection of this ConfigurationGroupSchemaResource + ConfigurationGroupSchemaCollection collection = publisher.GetConfigurationGroupSchemas(); + + // invoke the operation + string configurationGroupSchemaName = "testConfigurationGroupSchema"; + ConfigurationGroupSchemaData data = new ConfigurationGroupSchemaData(new AzureLocation("westUs2")) + { + Properties = new ConfigurationGroupSchemaPropertiesFormat() + { + Description = "Schema with no secrets", + SchemaDefinition = "{\"type\":\"object\",\"properties\":{\"interconnect-groups\":{\"type\":\"object\",\"properties\":{\"type\":\"object\",\"properties\":{\"name\":{\"type\":\"string\"},\"international-interconnects\":{\"type\":\"array\",\"item\":{\"type\":\"string\"}},\"domestic-interconnects\":{\"type\":\"array\",\"item\":{\"type\":\"string\"}}}}},\"interconnect-group-assignments\":{\"type\":\"object\",\"properties\":{\"type\":\"object\",\"properties\":{\"ssc\":{\"type\":\"string\"},\"interconnects-interconnects\":{\"type\":\"string\"}}}}},\"required\":[\"interconnect-groups\",\"interconnect-group-assignments\"]}", + }, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, configurationGroupSchemaName, data); + ConfigurationGroupSchemaResource 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 + ConfigurationGroupSchemaData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Get a networkFunctionDefinition group resource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetANetworkFunctionDefinitionGroupResource() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/ConfigurationGroupSchemaGet.json + // this example is just showing the usage of "ConfigurationGroupSchemas_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 PublisherResource created on azure + // for more information of creating PublisherResource, please refer to the document of PublisherResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string publisherName = "testPublisher"; + ResourceIdentifier publisherResourceId = PublisherResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, publisherName); + PublisherResource publisher = client.GetPublisherResource(publisherResourceId); + + // get the collection of this ConfigurationGroupSchemaResource + ConfigurationGroupSchemaCollection collection = publisher.GetConfigurationGroupSchemas(); + + // invoke the operation + string configurationGroupSchemaName = "testConfigurationGroupSchema"; + ConfigurationGroupSchemaResource result = await collection.GetAsync(configurationGroupSchemaName); + + // 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 + ConfigurationGroupSchemaData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Get a networkFunctionDefinition group resource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_GetANetworkFunctionDefinitionGroupResource() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/ConfigurationGroupSchemaGet.json + // this example is just showing the usage of "ConfigurationGroupSchemas_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 PublisherResource created on azure + // for more information of creating PublisherResource, please refer to the document of PublisherResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string publisherName = "testPublisher"; + ResourceIdentifier publisherResourceId = PublisherResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, publisherName); + PublisherResource publisher = client.GetPublisherResource(publisherResourceId); + + // get the collection of this ConfigurationGroupSchemaResource + ConfigurationGroupSchemaCollection collection = publisher.GetConfigurationGroupSchemas(); + + // invoke the operation + string configurationGroupSchemaName = "testConfigurationGroupSchema"; + bool result = await collection.ExistsAsync(configurationGroupSchemaName); + + Console.WriteLine($"Succeeded: {result}"); + } + + // Get a networkFunctionDefinition group resource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetANetworkFunctionDefinitionGroupResource() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/ConfigurationGroupSchemaGet.json + // this example is just showing the usage of "ConfigurationGroupSchemas_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 PublisherResource created on azure + // for more information of creating PublisherResource, please refer to the document of PublisherResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string publisherName = "testPublisher"; + ResourceIdentifier publisherResourceId = PublisherResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, publisherName); + PublisherResource publisher = client.GetPublisherResource(publisherResourceId); + + // get the collection of this ConfigurationGroupSchemaResource + ConfigurationGroupSchemaCollection collection = publisher.GetConfigurationGroupSchemas(); + + // invoke the operation + string configurationGroupSchemaName = "testConfigurationGroupSchema"; + NullableResponse response = await collection.GetIfExistsAsync(configurationGroupSchemaName); + ConfigurationGroupSchemaResource 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 + ConfigurationGroupSchemaData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/samples/Generated/Samples/Sample_ConfigurationGroupSchemaResource.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/samples/Generated/Samples/Sample_ConfigurationGroupSchemaResource.cs new file mode 100644 index 000000000000..144ca2c31a63 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/samples/Generated/Samples/Sample_ConfigurationGroupSchemaResource.cs @@ -0,0 +1,154 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.HybridNetwork; +using Azure.ResourceManager.HybridNetwork.Models; + +namespace Azure.ResourceManager.HybridNetwork.Samples +{ + public partial class Sample_ConfigurationGroupSchemaResource + { + // Delete a network function group resource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_DeleteANetworkFunctionGroupResource() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/ConfigurationGroupSchemaDelete.json + // this example is just showing the usage of "ConfigurationGroupSchemas_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 ConfigurationGroupSchemaResource created on azure + // for more information of creating ConfigurationGroupSchemaResource, please refer to the document of ConfigurationGroupSchemaResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string publisherName = "testPublisher"; + string configurationGroupSchemaName = "testConfigurationGroupSchema"; + ResourceIdentifier configurationGroupSchemaResourceId = ConfigurationGroupSchemaResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, publisherName, configurationGroupSchemaName); + ConfigurationGroupSchemaResource configurationGroupSchema = client.GetConfigurationGroupSchemaResource(configurationGroupSchemaResourceId); + + // invoke the operation + await configurationGroupSchema.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine($"Succeeded"); + } + + // Get a networkFunctionDefinition group resource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetANetworkFunctionDefinitionGroupResource() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/ConfigurationGroupSchemaGet.json + // this example is just showing the usage of "ConfigurationGroupSchemas_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 ConfigurationGroupSchemaResource created on azure + // for more information of creating ConfigurationGroupSchemaResource, please refer to the document of ConfigurationGroupSchemaResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string publisherName = "testPublisher"; + string configurationGroupSchemaName = "testConfigurationGroupSchema"; + ResourceIdentifier configurationGroupSchemaResourceId = ConfigurationGroupSchemaResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, publisherName, configurationGroupSchemaName); + ConfigurationGroupSchemaResource configurationGroupSchema = client.GetConfigurationGroupSchemaResource(configurationGroupSchemaResourceId); + + // invoke the operation + ConfigurationGroupSchemaResource result = await configurationGroupSchema.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 + ConfigurationGroupSchemaData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Create or update the configuration group schema resource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_CreateOrUpdateTheConfigurationGroupSchemaResource() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/ConfigurationGroupSchemaUpdateTags.json + // this example is just showing the usage of "ConfigurationGroupSchemas_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 ConfigurationGroupSchemaResource created on azure + // for more information of creating ConfigurationGroupSchemaResource, please refer to the document of ConfigurationGroupSchemaResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string publisherName = "testPublisher"; + string configurationGroupSchemaName = "testConfigurationGroupSchema"; + ResourceIdentifier configurationGroupSchemaResourceId = ConfigurationGroupSchemaResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, publisherName, configurationGroupSchemaName); + ConfigurationGroupSchemaResource configurationGroupSchema = client.GetConfigurationGroupSchemaResource(configurationGroupSchemaResourceId); + + // invoke the operation + TagsObject tagsObject = new TagsObject() + { + Tags = +{ +["tag1"] = "value1", +["tag2"] = "value2", +}, + }; + ConfigurationGroupSchemaResource result = await configurationGroupSchema.UpdateAsync(tagsObject); + + // 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 + ConfigurationGroupSchemaData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Update network service design version state + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task UpdateState_UpdateNetworkServiceDesignVersionState() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/ConfigurationGroupSchemaVersionUpdateState.json + // this example is just showing the usage of "ConfigurationGroupSchemas_updateState" 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 ConfigurationGroupSchemaResource created on azure + // for more information of creating ConfigurationGroupSchemaResource, please refer to the document of ConfigurationGroupSchemaResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string publisherName = "testPublisher"; + string configurationGroupSchemaName = "testConfigurationGroupSchema"; + ResourceIdentifier configurationGroupSchemaResourceId = ConfigurationGroupSchemaResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, publisherName, configurationGroupSchemaName); + ConfigurationGroupSchemaResource configurationGroupSchema = client.GetConfigurationGroupSchemaResource(configurationGroupSchemaResourceId); + + // invoke the operation + ConfigurationGroupSchemaVersionUpdateState configurationGroupSchemaVersionUpdateState = new ConfigurationGroupSchemaVersionUpdateState() + { + VersionState = VersionState.Active, + }; + ArmOperation lro = await configurationGroupSchema.UpdateStateAsync(WaitUntil.Completed, configurationGroupSchemaVersionUpdateState); + ConfigurationGroupSchemaVersionUpdateState result = lro.Value; + + Console.WriteLine($"Succeeded: {result}"); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/samples/Generated/Samples/Sample_ConfigurationGroupValueCollection.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/samples/Generated/Samples/Sample_ConfigurationGroupValueCollection.cs new file mode 100644 index 000000000000..bba04cdb30af --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/samples/Generated/Samples/Sample_ConfigurationGroupValueCollection.cs @@ -0,0 +1,302 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.HybridNetwork; +using Azure.ResourceManager.HybridNetwork.Models; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.HybridNetwork.Samples +{ + public partial class Sample_ConfigurationGroupValueCollection + { + // Get hybrid configuration group + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetHybridConfigurationGroup() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/ConfigurationGroupValueGet.json + // this example is just showing the usage of "ConfigurationGroupValues_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 = "subid"; + string resourceGroupName = "rg1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this ConfigurationGroupValueResource + ConfigurationGroupValueCollection collection = resourceGroupResource.GetConfigurationGroupValues(); + + // invoke the operation + string configurationGroupValueName = "testConfigurationGroupValue"; + ConfigurationGroupValueResource result = await collection.GetAsync(configurationGroupValueName); + + // 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 + ConfigurationGroupValueData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Get hybrid configuration group + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_GetHybridConfigurationGroup() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/ConfigurationGroupValueGet.json + // this example is just showing the usage of "ConfigurationGroupValues_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 = "subid"; + string resourceGroupName = "rg1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this ConfigurationGroupValueResource + ConfigurationGroupValueCollection collection = resourceGroupResource.GetConfigurationGroupValues(); + + // invoke the operation + string configurationGroupValueName = "testConfigurationGroupValue"; + bool result = await collection.ExistsAsync(configurationGroupValueName); + + Console.WriteLine($"Succeeded: {result}"); + } + + // Get hybrid configuration group + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetHybridConfigurationGroup() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/ConfigurationGroupValueGet.json + // this example is just showing the usage of "ConfigurationGroupValues_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 = "subid"; + string resourceGroupName = "rg1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this ConfigurationGroupValueResource + ConfigurationGroupValueCollection collection = resourceGroupResource.GetConfigurationGroupValues(); + + // invoke the operation + string configurationGroupValueName = "testConfigurationGroupValue"; + NullableResponse response = await collection.GetIfExistsAsync(configurationGroupValueName); + ConfigurationGroupValueResource 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 + ConfigurationGroupValueData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + // Create or update configuration group value + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_CreateOrUpdateConfigurationGroupValue() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/ConfigurationGroupValueCreate.json + // this example is just showing the usage of "ConfigurationGroupValues_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 = "subid"; + string resourceGroupName = "rg1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this ConfigurationGroupValueResource + ConfigurationGroupValueCollection collection = resourceGroupResource.GetConfigurationGroupValues(); + + // invoke the operation + string configurationGroupValueName = "testConfigurationGroupValue"; + ConfigurationGroupValueData data = new ConfigurationGroupValueData(new AzureLocation("eastus")) + { + Properties = new ConfigurationValueWithoutSecrets() + { + ConfigurationValue = "{\"interconnect-groups\":{\"stripe-one\":{\"name\":\"Stripe one\",\"international-interconnects\":[\"france\",\"germany\"],\"domestic-interconnects\":[\"birmingham\",\"edinburgh\"]},\"stripe-two\":{\"name\":\"Stripe two\",\"international-interconnects\":[\"germany\",\"italy\"],\"domestic-interconnects\":[\"edinburgh\",\"london\"]}},\"interconnect-group-assignments\":{\"ssc-one\":{\"ssc\":\"SSC 1\",\"interconnects\":\"stripe-one\"},\"ssc-two\":{\"ssc\":\"SSC 2\",\"interconnects\":\"stripe-two\"}}}", + ConfigurationGroupSchemaResourceReference = new OpenDeploymentResourceReference() + { + Id = new ResourceIdentifier("/subscriptions/subid/resourcegroups/testRG/providers/microsoft.hybridnetwork/publishers/testPublisher/configurationGroupSchemas/testConfigurationGroupSchemaName"), + }, + }, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, configurationGroupValueName, data); + ConfigurationGroupValueResource 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 + ConfigurationGroupValueData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Create or update configuration group value with secrets + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_CreateOrUpdateConfigurationGroupValueWithSecrets() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/ConfigurationGroupValueCreateSecret.json + // this example is just showing the usage of "ConfigurationGroupValues_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 = "subid"; + string resourceGroupName = "rg1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this ConfigurationGroupValueResource + ConfigurationGroupValueCollection collection = resourceGroupResource.GetConfigurationGroupValues(); + + // invoke the operation + string configurationGroupValueName = "testConfigurationGroupValue"; + ConfigurationGroupValueData data = new ConfigurationGroupValueData(new AzureLocation("eastus")) + { + Properties = new ConfigurationValueWithSecrets() + { + SecretConfigurationValue = "{\"interconnect-groups\":{\"stripe-one\":{\"name\":\"Stripe one\",\"international-interconnects\":[\"france\",\"germany\"],\"domestic-interconnects\":[\"birmingham\",\"edinburgh\"]},\"stripe-two\":{\"name\":\"Stripe two\",\"international-interconnects\":[\"germany\",\"italy\"],\"domestic-interconnects\":[\"edinburgh\",\"london\"]}},\"interconnect-group-assignments\":{\"ssc-one\":{\"ssc\":\"SSC 1\",\"interconnects\":\"stripe-one\"},\"ssc-two\":{\"ssc\":\"SSC 2\",\"interconnects\":\"stripe-two\"}}}", + ConfigurationGroupSchemaResourceReference = new OpenDeploymentResourceReference() + { + Id = new ResourceIdentifier("/subscriptions/subid/resourcegroups/testRG/providers/microsoft.hybridnetwork/publishers/testPublisher/configurationGroupSchemas/testConfigurationGroupSchemaName"), + }, + }, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, configurationGroupValueName, data); + ConfigurationGroupValueResource 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 + ConfigurationGroupValueData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Create or update first party configuration group value + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_CreateOrUpdateFirstPartyConfigurationGroupValue() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/ConfigurationGroupValueFirstPartyCreate.json + // this example is just showing the usage of "ConfigurationGroupValues_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 = "subid"; + string resourceGroupName = "rg1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this ConfigurationGroupValueResource + ConfigurationGroupValueCollection collection = resourceGroupResource.GetConfigurationGroupValues(); + + // invoke the operation + string configurationGroupValueName = "testConfigurationGroupValue"; + ConfigurationGroupValueData data = new ConfigurationGroupValueData(new AzureLocation("eastus")) + { + Properties = new ConfigurationValueWithoutSecrets() + { + ConfigurationValue = "{\"interconnect-groups\":{\"stripe-one\":{\"name\":\"Stripe one\",\"international-interconnects\":[\"france\",\"germany\"],\"domestic-interconnects\":[\"birmingham\",\"edinburgh\"]},\"stripe-two\":{\"name\":\"Stripe two\",\"international-interconnects\":[\"germany\",\"italy\"],\"domestic-interconnects\":[\"edinburgh\",\"london\"]}},\"interconnect-group-assignments\":{\"ssc-one\":{\"ssc\":\"SSC 1\",\"interconnects\":\"stripe-one\"},\"ssc-two\":{\"ssc\":\"SSC 2\",\"interconnects\":\"stripe-two\"}}}", + ConfigurationGroupSchemaResourceReference = new SecretDeploymentResourceReference() + { + Id = new ResourceIdentifier("/subscriptions/subid/resourcegroups/testRG/providers/microsoft.hybridnetwork/publishers/testPublisher/configurationGroupSchemas/testConfigurationGroupSchemaName"), + }, + }, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, configurationGroupValueName, data); + ConfigurationGroupValueResource 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 + ConfigurationGroupValueData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // List all hybrid network configurationGroupValues in a subscription. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_ListAllHybridNetworkConfigurationGroupValuesInASubscription() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/ConfigurationGroupValueListByResourceGroup.json + // this example is just showing the usage of "ConfigurationGroupValues_ListByResourceGroup" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + 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 = "subid"; + string resourceGroupName = "rg1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this ConfigurationGroupValueResource + ConfigurationGroupValueCollection collection = resourceGroupResource.GetConfigurationGroupValues(); + + // invoke the operation and iterate over the result + await foreach (ConfigurationGroupValueResource 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 + ConfigurationGroupValueData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/samples/Generated/Samples/Sample_ConfigurationGroupValueResource.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/samples/Generated/Samples/Sample_ConfigurationGroupValueResource.cs new file mode 100644 index 000000000000..6e8535443a7a --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/samples/Generated/Samples/Sample_ConfigurationGroupValueResource.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.HybridNetwork; +using Azure.ResourceManager.HybridNetwork.Models; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.HybridNetwork.Samples +{ + public partial class Sample_ConfigurationGroupValueResource + { + // Delete hybrid configuration group resource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_DeleteHybridConfigurationGroupResource() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/ConfigurationGroupValueDelete.json + // this example is just showing the usage of "ConfigurationGroupValues_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 ConfigurationGroupValueResource created on azure + // for more information of creating ConfigurationGroupValueResource, please refer to the document of ConfigurationGroupValueResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string configurationGroupValueName = "testConfigurationGroupValue"; + ResourceIdentifier configurationGroupValueResourceId = ConfigurationGroupValueResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, configurationGroupValueName); + ConfigurationGroupValueResource configurationGroupValue = client.GetConfigurationGroupValueResource(configurationGroupValueResourceId); + + // invoke the operation + await configurationGroupValue.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine($"Succeeded"); + } + + // Get hybrid configuration group + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetHybridConfigurationGroup() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/ConfigurationGroupValueGet.json + // this example is just showing the usage of "ConfigurationGroupValues_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 ConfigurationGroupValueResource created on azure + // for more information of creating ConfigurationGroupValueResource, please refer to the document of ConfigurationGroupValueResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string configurationGroupValueName = "testConfigurationGroupValue"; + ResourceIdentifier configurationGroupValueResourceId = ConfigurationGroupValueResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, configurationGroupValueName); + ConfigurationGroupValueResource configurationGroupValue = client.GetConfigurationGroupValueResource(configurationGroupValueResourceId); + + // invoke the operation + ConfigurationGroupValueResource result = await configurationGroupValue.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 + ConfigurationGroupValueData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Update hybrid configuration group tags + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_UpdateHybridConfigurationGroupTags() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/ConfigurationGroupValueUpdateTags.json + // this example is just showing the usage of "ConfigurationGroupValues_UpdateTags" 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 ConfigurationGroupValueResource created on azure + // for more information of creating ConfigurationGroupValueResource, please refer to the document of ConfigurationGroupValueResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string configurationGroupValueName = "testConfigurationGroupValue"; + ResourceIdentifier configurationGroupValueResourceId = ConfigurationGroupValueResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, configurationGroupValueName); + ConfigurationGroupValueResource configurationGroupValue = client.GetConfigurationGroupValueResource(configurationGroupValueResourceId); + + // invoke the operation + TagsObject tagsObject = new TagsObject() + { + Tags = +{ +["tag1"] = "value1", +["tag2"] = "value2", +}, + }; + ConfigurationGroupValueResource result = await configurationGroupValue.UpdateAsync(tagsObject); + + // 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 + ConfigurationGroupValueData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // List all hybrid network sites in a subscription. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetConfigurationGroupValues_ListAllHybridNetworkSitesInASubscription() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/ConfigurationGroupValueListBySubscription.json + // this example is just showing the usage of "ConfigurationGroupValues_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 = "subid"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // invoke the operation and iterate over the result + await foreach (ConfigurationGroupValueResource item in subscriptionResource.GetConfigurationGroupValuesAsync()) + { + // 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 + ConfigurationGroupValueData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/samples/Generated/Samples/Sample_NetworkFunctionCollection.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/samples/Generated/Samples/Sample_NetworkFunctionCollection.cs new file mode 100644 index 000000000000..06d99308d92f --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/samples/Generated/Samples/Sample_NetworkFunctionCollection.cs @@ -0,0 +1,633 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.HybridNetwork; +using Azure.ResourceManager.HybridNetwork.Models; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.HybridNetwork.Samples +{ + public partial class Sample_NetworkFunctionCollection + { + // Get network function resource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetNetworkFunctionResource() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/NetworkFunctionGet.json + // this example is just showing the usage of "NetworkFunctions_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 = "subid"; + string resourceGroupName = "rg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this NetworkFunctionResource + NetworkFunctionCollection collection = resourceGroupResource.GetNetworkFunctions(); + + // invoke the operation + string networkFunctionName = "testNf"; + NetworkFunctionResource result = await collection.GetAsync(networkFunctionName); + + // 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 + NetworkFunctionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Get network function resource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_GetNetworkFunctionResource() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/NetworkFunctionGet.json + // this example is just showing the usage of "NetworkFunctions_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 = "subid"; + string resourceGroupName = "rg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this NetworkFunctionResource + NetworkFunctionCollection collection = resourceGroupResource.GetNetworkFunctions(); + + // invoke the operation + string networkFunctionName = "testNf"; + bool result = await collection.ExistsAsync(networkFunctionName); + + Console.WriteLine($"Succeeded: {result}"); + } + + // Get network function resource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetNetworkFunctionResource() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/NetworkFunctionGet.json + // this example is just showing the usage of "NetworkFunctions_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 = "subid"; + string resourceGroupName = "rg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this NetworkFunctionResource + NetworkFunctionCollection collection = resourceGroupResource.GetNetworkFunctions(); + + // invoke the operation + string networkFunctionName = "testNf"; + NullableResponse response = await collection.GetIfExistsAsync(networkFunctionName); + NetworkFunctionResource 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 + NetworkFunctionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + // Get virtual network function resource on AzureCore + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetVirtualNetworkFunctionResourceOnAzureCore() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/AzureCore/VirtualNetworkFunctionGet.json + // this example is just showing the usage of "NetworkFunctions_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 = "subid"; + string resourceGroupName = "rg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this NetworkFunctionResource + NetworkFunctionCollection collection = resourceGroupResource.GetNetworkFunctions(); + + // invoke the operation + string networkFunctionName = "testNf"; + NetworkFunctionResource result = await collection.GetAsync(networkFunctionName); + + // 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 + NetworkFunctionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Get virtual network function resource on AzureCore + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_GetVirtualNetworkFunctionResourceOnAzureCore() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/AzureCore/VirtualNetworkFunctionGet.json + // this example is just showing the usage of "NetworkFunctions_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 = "subid"; + string resourceGroupName = "rg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this NetworkFunctionResource + NetworkFunctionCollection collection = resourceGroupResource.GetNetworkFunctions(); + + // invoke the operation + string networkFunctionName = "testNf"; + bool result = await collection.ExistsAsync(networkFunctionName); + + Console.WriteLine($"Succeeded: {result}"); + } + + // Get virtual network function resource on AzureCore + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetVirtualNetworkFunctionResourceOnAzureCore() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/AzureCore/VirtualNetworkFunctionGet.json + // this example is just showing the usage of "NetworkFunctions_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 = "subid"; + string resourceGroupName = "rg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this NetworkFunctionResource + NetworkFunctionCollection collection = resourceGroupResource.GetNetworkFunctions(); + + // invoke the operation + string networkFunctionName = "testNf"; + NullableResponse response = await collection.GetIfExistsAsync(networkFunctionName); + NetworkFunctionResource 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 + NetworkFunctionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + // Get virtual network function resource on AzureOperatorNexus + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetVirtualNetworkFunctionResourceOnAzureOperatorNexus() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/AzureOperatorNexus/VirtualNetworkFunctionGet.json + // this example is just showing the usage of "NetworkFunctions_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 = "subid"; + string resourceGroupName = "rg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this NetworkFunctionResource + NetworkFunctionCollection collection = resourceGroupResource.GetNetworkFunctions(); + + // invoke the operation + string networkFunctionName = "testNf"; + NetworkFunctionResource result = await collection.GetAsync(networkFunctionName); + + // 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 + NetworkFunctionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Get virtual network function resource on AzureOperatorNexus + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_GetVirtualNetworkFunctionResourceOnAzureOperatorNexus() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/AzureOperatorNexus/VirtualNetworkFunctionGet.json + // this example is just showing the usage of "NetworkFunctions_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 = "subid"; + string resourceGroupName = "rg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this NetworkFunctionResource + NetworkFunctionCollection collection = resourceGroupResource.GetNetworkFunctions(); + + // invoke the operation + string networkFunctionName = "testNf"; + bool result = await collection.ExistsAsync(networkFunctionName); + + Console.WriteLine($"Succeeded: {result}"); + } + + // Get virtual network function resource on AzureOperatorNexus + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetVirtualNetworkFunctionResourceOnAzureOperatorNexus() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/AzureOperatorNexus/VirtualNetworkFunctionGet.json + // this example is just showing the usage of "NetworkFunctions_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 = "subid"; + string resourceGroupName = "rg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this NetworkFunctionResource + NetworkFunctionCollection collection = resourceGroupResource.GetNetworkFunctions(); + + // invoke the operation + string networkFunctionName = "testNf"; + NullableResponse response = await collection.GetIfExistsAsync(networkFunctionName); + NetworkFunctionResource 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 + NetworkFunctionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + // Create first party network function resource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_CreateFirstPartyNetworkFunctionResource() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/NetworkFunctionFirstPartyCreate.json + // this example is just showing the usage of "NetworkFunctions_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 = "subid"; + string resourceGroupName = "rg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this NetworkFunctionResource + NetworkFunctionCollection collection = resourceGroupResource.GetNetworkFunctions(); + + // invoke the operation + string networkFunctionName = "testNf"; + NetworkFunctionData data = new NetworkFunctionData(new AzureLocation("eastus")) + { + Properties = new NetworkFunctionValueWithoutSecrets() + { + DeploymentValues = "{\"releaseName\":\"testReleaseName\",\"namespace\":\"testNamespace\"}", + NetworkFunctionDefinitionVersionResourceReference = new SecretDeploymentResourceReference() + { + Id = new ResourceIdentifier("/subscriptions/subid/resourcegroups/rg/providers/Microsoft.HybridNetwork/publishers/testVendor/networkFunctionDefinitionGroups/testnetworkFunctionDefinitionGroupName/networkFunctionDefinitionVersions/1.0.1"), + }, + NfviType = NfviType.AzureArcKubernetes, + NfviId = new ResourceIdentifier("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testResourceGroup/providers/Microsoft.ExtendedLocation/customLocations/testCustomLocation"), + AllowSoftwareUpdate = false, + RoleOverrideValues = +{ +"{\"name\":\"testRoleOne\",\"deployParametersMappingRuleProfile\":{\"helmMappingRuleProfile\":{\"helmPackageVersion\":\"2.1.3\",\"values\":\"{\\\"roleOneParam\\\":\\\"roleOneOverrideValue\\\"}\"}}}","{\"name\":\"testRoleTwo\",\"deployParametersMappingRuleProfile\":{\"helmMappingRuleProfile\":{\"releaseName\":\"overrideReleaseName\",\"releaseNamespace\":\"overrideNamespace\",\"values\":\"{\\\"roleTwoParam\\\":\\\"roleTwoOverrideValue\\\"}\"}}}" +}, + }, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, networkFunctionName, data); + NetworkFunctionResource 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 + NetworkFunctionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Create network function resource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_CreateNetworkFunctionResource() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/NetworkFunctionCreate.json + // this example is just showing the usage of "NetworkFunctions_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 = "subid"; + string resourceGroupName = "rg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this NetworkFunctionResource + NetworkFunctionCollection collection = resourceGroupResource.GetNetworkFunctions(); + + // invoke the operation + string networkFunctionName = "testNf"; + NetworkFunctionData data = new NetworkFunctionData(new AzureLocation("eastus")) + { + Properties = new NetworkFunctionValueWithoutSecrets() + { + DeploymentValues = "{\"releaseName\":\"testReleaseName\",\"namespace\":\"testNamespace\"}", + NetworkFunctionDefinitionVersionResourceReference = new OpenDeploymentResourceReference() + { + Id = new ResourceIdentifier("/subscriptions/subid/resourcegroups/rg/providers/Microsoft.HybridNetwork/publishers/testVendor/networkFunctionDefinitionGroups/testnetworkFunctionDefinitionGroupName/networkFunctionDefinitionVersions/1.0.1"), + }, + NfviType = NfviType.AzureArcKubernetes, + NfviId = new ResourceIdentifier("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testResourceGroup/providers/Microsoft.ExtendedLocation/customLocations/testCustomLocation"), + AllowSoftwareUpdate = false, + RoleOverrideValues = +{ +"{\"name\":\"testRoleOne\",\"deployParametersMappingRuleProfile\":{\"helmMappingRuleProfile\":{\"helmPackageVersion\":\"2.1.3\",\"values\":\"{\\\"roleOneParam\\\":\\\"roleOneOverrideValue\\\"}\"}}}","{\"name\":\"testRoleTwo\",\"deployParametersMappingRuleProfile\":{\"helmMappingRuleProfile\":{\"releaseName\":\"overrideReleaseName\",\"releaseNamespace\":\"overrideNamespace\",\"values\":\"{\\\"roleTwoParam\\\":\\\"roleTwoOverrideValue\\\"}\"}}}" +}, + }, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, networkFunctionName, data); + NetworkFunctionResource 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 + NetworkFunctionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Create network function resource with secrets + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_CreateNetworkFunctionResourceWithSecrets() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/NetworkFunctionCreateSecret.json + // this example is just showing the usage of "NetworkFunctions_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 = "subid"; + string resourceGroupName = "rg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this NetworkFunctionResource + NetworkFunctionCollection collection = resourceGroupResource.GetNetworkFunctions(); + + // invoke the operation + string networkFunctionName = "testNf"; + NetworkFunctionData data = new NetworkFunctionData(new AzureLocation("eastus")) + { + Properties = new NetworkFunctionValueWithSecrets() + { + SecretDeploymentValues = "{\"adminPassword\":\"password1\",\"userPassword\":\"password2\"}", + NetworkFunctionDefinitionVersionResourceReference = new OpenDeploymentResourceReference() + { + Id = new ResourceIdentifier("/subscriptions/subid/resourcegroups/rg/providers/Microsoft.HybridNetwork/publishers/testVendor/networkFunctionDefinitionGroups/testnetworkFunctionDefinitionGroupName/networkFunctionDefinitionVersions/1.0.1"), + }, + NfviType = NfviType.AzureArcKubernetes, + NfviId = new ResourceIdentifier("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testResourceGroup/providers/Microsoft.ExtendedLocation/customLocations/testCustomLocation"), + AllowSoftwareUpdate = false, + RoleOverrideValues = +{ +"{\"name\":\"testRoleOne\",\"deployParametersMappingRuleProfile\":{\"helmMappingRuleProfile\":{\"helmPackageVersion\":\"2.1.3\",\"values\":\"{\\\"roleOneParam\\\":\\\"roleOneOverrideValue\\\"}\"}}}","{\"name\":\"testRoleTwo\",\"deployParametersMappingRuleProfile\":{\"helmMappingRuleProfile\":{\"releaseName\":\"overrideReleaseName\",\"releaseNamespace\":\"overrideNamespace\",\"values\":\"{\\\"roleTwoParam\\\":\\\"roleTwoOverrideValue\\\"}\"}}}" +}, + }, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, networkFunctionName, data); + NetworkFunctionResource 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 + NetworkFunctionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Create virtual network function resource on AzureCore + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_CreateVirtualNetworkFunctionResourceOnAzureCore() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/AzureCore/VirtualNetworkFunctionCreate.json + // this example is just showing the usage of "NetworkFunctions_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 = "subid"; + string resourceGroupName = "rg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this NetworkFunctionResource + NetworkFunctionCollection collection = resourceGroupResource.GetNetworkFunctions(); + + // invoke the operation + string networkFunctionName = "testNf"; + NetworkFunctionData data = new NetworkFunctionData(new AzureLocation("eastus")) + { + Properties = new NetworkFunctionValueWithoutSecrets() + { + DeploymentValues = "{\"virtualMachineName\":\"test-VM\",\"cpuCores\":4,\"memorySizeGB\":8,\"cloudServicesNetworkAttachment\":{\"attachedNetworkId\":\"test-csnet\",\"ipAllocationMethod\":\"Dynamic\",\"networkAttachmentName\":\"test-cs-vlan\"},\"networkAttachments\":[{\"attachedNetworkId\":\"test-l3vlan\",\"defaultGateway\":\"True\",\"ipAllocationMethod\":\"Dynamic\",\"networkAttachmentName\":\"test-vlan\"}],\"sshPublicKeys\":[{\"keyData\":\"ssh-rsa CMIIIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA0TqlveKKlc2MFvEmuXJiLGBsY1t4ML4uiRADGSZlnc+7Ugv3h+MCjkkwOKiOdsNo8k4KSBIG5GcQfKYOOd17AJvqCL6cGQbaLuqv0a64jeDm8oO8/xN/IM0oKw7rMr/2oAJOgIsfeXPkRxWWic9AVIS++H5Qi2r7bUFX+cqFsyUCAwEBBQ==\"}],\"storageProfile\":{\"osDisk\":{\"createOption\":\"Ephemeral\",\"deleteOption\":\"Delete\",\"diskSizeGB\":10}},\"userData\":\"testUserData\",\"adminUsername\":\"testUser\",\"virtioInterface\":\"Transitional\",\"isolateEmulatorThread\":\"False\",\"bootMethod\":\"BIOS\",\"placementHints\":[]}", + NetworkFunctionDefinitionVersionResourceReference = new OpenDeploymentResourceReference() + { + Id = new ResourceIdentifier("/subscriptions/subid/resourcegroups/rg/providers/Microsoft.HybridNetwork/publishers/testVendor/networkFunctionDefinitionGroups/testnetworkFunctionDefinitionGroupName/networkFunctionDefinitionVersions/1.0.1"), + }, + NfviType = NfviType.AzureCore, + NfviId = new ResourceIdentifier("/subscriptions/subid/resourceGroups/testResourceGroup"), + AllowSoftwareUpdate = false, + }, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, networkFunctionName, data); + NetworkFunctionResource 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 + NetworkFunctionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Create virtual network function resource on AzureOperatorNexus + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_CreateVirtualNetworkFunctionResourceOnAzureOperatorNexus() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/AzureOperatorNexus/VirtualNetworkFunctionCreate.json + // this example is just showing the usage of "NetworkFunctions_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 = "subid"; + string resourceGroupName = "rg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this NetworkFunctionResource + NetworkFunctionCollection collection = resourceGroupResource.GetNetworkFunctions(); + + // invoke the operation + string networkFunctionName = "testNf"; + NetworkFunctionData data = new NetworkFunctionData(new AzureLocation("eastus")) + { + Properties = new NetworkFunctionValueWithoutSecrets() + { + DeploymentValues = "{\"virtualMachineName\":\"test-VM\",\"extendedLocationName\":\"test-cluster\",\"cpuCores\":4,\"memorySizeGB\":8,\"cloudServicesNetworkAttachment\":{\"attachedNetworkId\":\"test-csnet\",\"ipAllocationMethod\":\"Dynamic\",\"networkAttachmentName\":\"test-cs-vlan\"},\"networkAttachments\":[{\"attachedNetworkId\":\"test-l3vlan\",\"defaultGateway\":\"True\",\"ipAllocationMethod\":\"Dynamic\",\"networkAttachmentName\":\"test-vlan\"}],\"sshPublicKeys\":[{\"keyData\":\"ssh-rsa CMIIIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA0TqlveKKlc2MFvEmuXJiLGBsY1t4ML4uiRADGSZlnc+7Ugv3h+MCjkkwOKiOdsNo8k4KSBIG5GcQfKYOOd17AJvqCL6cGQbaLuqv0a64jeDm8oO8/xN/IM0oKw7rMr/2oAJOgIsfeXPkRxWWic9AVIS++H5Qi2r7bUFX+cqFsyUCAwEBBQ==\"}],\"storageProfile\":{\"osDisk\":{\"createOption\":\"Ephemeral\",\"deleteOption\":\"Delete\",\"diskSizeGB\":10}},\"userData\":\"testUserData\",\"adminUsername\":\"testUser\",\"virtioInterface\":\"Transitional\",\"isolateEmulatorThread\":\"False\",\"bootMethod\":\"BIOS\",\"placementHints\":[]}", + NetworkFunctionDefinitionVersionResourceReference = new OpenDeploymentResourceReference() + { + Id = new ResourceIdentifier("/subscriptions/subid/resourcegroups/rg/providers/Microsoft.HybridNetwork/publishers/testVendor/networkFunctionDefinitionGroups/testnetworkFunctionDefinitionGroupName/networkFunctionDefinitionVersions/1.0.1"), + }, + NfviType = NfviType.AzureOperatorNexus, + NfviId = new ResourceIdentifier("/subscriptions/subid/resourceGroups/testResourceGroup/providers/Microsoft.ExtendedLocation/customLocations/testCustomLocation"), + AllowSoftwareUpdate = false, + }, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, networkFunctionName, data); + NetworkFunctionResource 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 + NetworkFunctionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // List network function in resource group + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_ListNetworkFunctionInResourceGroup() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/NetworkFunctionListByResourceGroup.json + // this example is just showing the usage of "NetworkFunctions_ListByResourceGroup" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + 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 = "subid"; + string resourceGroupName = "rg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this NetworkFunctionResource + NetworkFunctionCollection collection = resourceGroupResource.GetNetworkFunctions(); + + // invoke the operation and iterate over the result + await foreach (NetworkFunctionResource 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 + NetworkFunctionData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/samples/Generated/Samples/Sample_NetworkFunctionDefinitionGroupCollection.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/samples/Generated/Samples/Sample_NetworkFunctionDefinitionGroupCollection.cs new file mode 100644 index 000000000000..95a8238082b3 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/samples/Generated/Samples/Sample_NetworkFunctionDefinitionGroupCollection.cs @@ -0,0 +1,203 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.HybridNetwork; + +namespace Azure.ResourceManager.HybridNetwork.Samples +{ + public partial class Sample_NetworkFunctionDefinitionGroupCollection + { + // Get networkFunctionDefinition groups under publisher resource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_GetNetworkFunctionDefinitionGroupsUnderPublisherResource() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/NetworkFunctionDefinitionGroupsListByPublisherName.json + // this example is just showing the usage of "NetworkFunctionDefinitionGroups_ListByPublisher" 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 PublisherResource created on azure + // for more information of creating PublisherResource, please refer to the document of PublisherResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string publisherName = "TestPublisher"; + ResourceIdentifier publisherResourceId = PublisherResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, publisherName); + PublisherResource publisher = client.GetPublisherResource(publisherResourceId); + + // get the collection of this NetworkFunctionDefinitionGroupResource + NetworkFunctionDefinitionGroupCollection collection = publisher.GetNetworkFunctionDefinitionGroups(); + + // invoke the operation and iterate over the result + await foreach (NetworkFunctionDefinitionGroupResource 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 + NetworkFunctionDefinitionGroupData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // Create or update the network function definition group + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_CreateOrUpdateTheNetworkFunctionDefinitionGroup() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/NetworkFunctionDefinitionGroupCreate.json + // this example is just showing the usage of "NetworkFunctionDefinitionGroups_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 PublisherResource created on azure + // for more information of creating PublisherResource, please refer to the document of PublisherResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string publisherName = "TestPublisher"; + ResourceIdentifier publisherResourceId = PublisherResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, publisherName); + PublisherResource publisher = client.GetPublisherResource(publisherResourceId); + + // get the collection of this NetworkFunctionDefinitionGroupResource + NetworkFunctionDefinitionGroupCollection collection = publisher.GetNetworkFunctionDefinitionGroups(); + + // invoke the operation + string networkFunctionDefinitionGroupName = "TestNetworkFunctionDefinitionGroupName"; + NetworkFunctionDefinitionGroupData data = new NetworkFunctionDefinitionGroupData(new AzureLocation("eastus")); + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, networkFunctionDefinitionGroupName, data); + NetworkFunctionDefinitionGroupResource 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 + NetworkFunctionDefinitionGroupData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Get a networkFunctionDefinition group resource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetANetworkFunctionDefinitionGroupResource() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/NetworkFunctionDefinitionGroupGet.json + // this example is just showing the usage of "NetworkFunctionDefinitionGroups_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 PublisherResource created on azure + // for more information of creating PublisherResource, please refer to the document of PublisherResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string publisherName = "TestPublisher"; + ResourceIdentifier publisherResourceId = PublisherResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, publisherName); + PublisherResource publisher = client.GetPublisherResource(publisherResourceId); + + // get the collection of this NetworkFunctionDefinitionGroupResource + NetworkFunctionDefinitionGroupCollection collection = publisher.GetNetworkFunctionDefinitionGroups(); + + // invoke the operation + string networkFunctionDefinitionGroupName = "TestNetworkFunctionDefinitionGroupName"; + NetworkFunctionDefinitionGroupResource result = await collection.GetAsync(networkFunctionDefinitionGroupName); + + // 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 + NetworkFunctionDefinitionGroupData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Get a networkFunctionDefinition group resource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_GetANetworkFunctionDefinitionGroupResource() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/NetworkFunctionDefinitionGroupGet.json + // this example is just showing the usage of "NetworkFunctionDefinitionGroups_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 PublisherResource created on azure + // for more information of creating PublisherResource, please refer to the document of PublisherResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string publisherName = "TestPublisher"; + ResourceIdentifier publisherResourceId = PublisherResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, publisherName); + PublisherResource publisher = client.GetPublisherResource(publisherResourceId); + + // get the collection of this NetworkFunctionDefinitionGroupResource + NetworkFunctionDefinitionGroupCollection collection = publisher.GetNetworkFunctionDefinitionGroups(); + + // invoke the operation + string networkFunctionDefinitionGroupName = "TestNetworkFunctionDefinitionGroupName"; + bool result = await collection.ExistsAsync(networkFunctionDefinitionGroupName); + + Console.WriteLine($"Succeeded: {result}"); + } + + // Get a networkFunctionDefinition group resource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetANetworkFunctionDefinitionGroupResource() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/NetworkFunctionDefinitionGroupGet.json + // this example is just showing the usage of "NetworkFunctionDefinitionGroups_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 PublisherResource created on azure + // for more information of creating PublisherResource, please refer to the document of PublisherResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string publisherName = "TestPublisher"; + ResourceIdentifier publisherResourceId = PublisherResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, publisherName); + PublisherResource publisher = client.GetPublisherResource(publisherResourceId); + + // get the collection of this NetworkFunctionDefinitionGroupResource + NetworkFunctionDefinitionGroupCollection collection = publisher.GetNetworkFunctionDefinitionGroups(); + + // invoke the operation + string networkFunctionDefinitionGroupName = "TestNetworkFunctionDefinitionGroupName"; + NullableResponse response = await collection.GetIfExistsAsync(networkFunctionDefinitionGroupName); + NetworkFunctionDefinitionGroupResource 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 + NetworkFunctionDefinitionGroupData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/samples/Generated/Samples/Sample_NetworkFunctionDefinitionGroupResource.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/samples/Generated/Samples/Sample_NetworkFunctionDefinitionGroupResource.cs new file mode 100644 index 000000000000..73ad1c4130c4 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/samples/Generated/Samples/Sample_NetworkFunctionDefinitionGroupResource.cs @@ -0,0 +1,121 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.HybridNetwork; +using Azure.ResourceManager.HybridNetwork.Models; + +namespace Azure.ResourceManager.HybridNetwork.Samples +{ + public partial class Sample_NetworkFunctionDefinitionGroupResource + { + // Delete a network function group resource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_DeleteANetworkFunctionGroupResource() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/NetworkFunctionDefinitionGroupDelete.json + // this example is just showing the usage of "NetworkFunctionDefinitionGroups_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 NetworkFunctionDefinitionGroupResource created on azure + // for more information of creating NetworkFunctionDefinitionGroupResource, please refer to the document of NetworkFunctionDefinitionGroupResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string publisherName = "TestPublisher"; + string networkFunctionDefinitionGroupName = "TestNetworkFunctionDefinitionGroupName"; + ResourceIdentifier networkFunctionDefinitionGroupResourceId = NetworkFunctionDefinitionGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, publisherName, networkFunctionDefinitionGroupName); + NetworkFunctionDefinitionGroupResource networkFunctionDefinitionGroup = client.GetNetworkFunctionDefinitionGroupResource(networkFunctionDefinitionGroupResourceId); + + // invoke the operation + await networkFunctionDefinitionGroup.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine($"Succeeded"); + } + + // Get a networkFunctionDefinition group resource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetANetworkFunctionDefinitionGroupResource() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/NetworkFunctionDefinitionGroupGet.json + // this example is just showing the usage of "NetworkFunctionDefinitionGroups_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 NetworkFunctionDefinitionGroupResource created on azure + // for more information of creating NetworkFunctionDefinitionGroupResource, please refer to the document of NetworkFunctionDefinitionGroupResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string publisherName = "TestPublisher"; + string networkFunctionDefinitionGroupName = "TestNetworkFunctionDefinitionGroupName"; + ResourceIdentifier networkFunctionDefinitionGroupResourceId = NetworkFunctionDefinitionGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, publisherName, networkFunctionDefinitionGroupName); + NetworkFunctionDefinitionGroupResource networkFunctionDefinitionGroup = client.GetNetworkFunctionDefinitionGroupResource(networkFunctionDefinitionGroupResourceId); + + // invoke the operation + NetworkFunctionDefinitionGroupResource result = await networkFunctionDefinitionGroup.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 + NetworkFunctionDefinitionGroupData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Create or update the network function definition group resource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_CreateOrUpdateTheNetworkFunctionDefinitionGroupResource() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/NetworkFunctionDefinitionGroupUpdateTags.json + // this example is just showing the usage of "NetworkFunctionDefinitionGroups_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 NetworkFunctionDefinitionGroupResource created on azure + // for more information of creating NetworkFunctionDefinitionGroupResource, please refer to the document of NetworkFunctionDefinitionGroupResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string publisherName = "TestPublisher"; + string networkFunctionDefinitionGroupName = "TestNetworkFunctionDefinitionGroupName"; + ResourceIdentifier networkFunctionDefinitionGroupResourceId = NetworkFunctionDefinitionGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, publisherName, networkFunctionDefinitionGroupName); + NetworkFunctionDefinitionGroupResource networkFunctionDefinitionGroup = client.GetNetworkFunctionDefinitionGroupResource(networkFunctionDefinitionGroupResourceId); + + // invoke the operation + TagsObject tagsObject = new TagsObject() + { + Tags = +{ +["tag1"] = "value1", +["tag2"] = "value2", +}, + }; + NetworkFunctionDefinitionGroupResource result = await networkFunctionDefinitionGroup.UpdateAsync(tagsObject); + + // 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 + NetworkFunctionDefinitionGroupData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/samples/Generated/Samples/Sample_NetworkFunctionDefinitionVersionCollection.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/samples/Generated/Samples/Sample_NetworkFunctionDefinitionVersionCollection.cs new file mode 100644 index 000000000000..61f56c471916 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/samples/Generated/Samples/Sample_NetworkFunctionDefinitionVersionCollection.cs @@ -0,0 +1,730 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.HybridNetwork; +using Azure.ResourceManager.HybridNetwork.Models; + +namespace Azure.ResourceManager.HybridNetwork.Samples +{ + public partial class Sample_NetworkFunctionDefinitionVersionCollection + { + // Create or update a network function definition version resource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_CreateOrUpdateANetworkFunctionDefinitionVersionResource() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/NetworkFunctionDefinitionVersionCreate.json + // this example is just showing the usage of "NetworkFunctionDefinitionVersions_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 NetworkFunctionDefinitionGroupResource created on azure + // for more information of creating NetworkFunctionDefinitionGroupResource, please refer to the document of NetworkFunctionDefinitionGroupResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string publisherName = "TestPublisher"; + string networkFunctionDefinitionGroupName = "TestNetworkFunctionDefinitionGroupName"; + ResourceIdentifier networkFunctionDefinitionGroupResourceId = NetworkFunctionDefinitionGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, publisherName, networkFunctionDefinitionGroupName); + NetworkFunctionDefinitionGroupResource networkFunctionDefinitionGroup = client.GetNetworkFunctionDefinitionGroupResource(networkFunctionDefinitionGroupResourceId); + + // get the collection of this NetworkFunctionDefinitionVersionResource + NetworkFunctionDefinitionVersionCollection collection = networkFunctionDefinitionGroup.GetNetworkFunctionDefinitionVersions(); + + // invoke the operation + string networkFunctionDefinitionVersionName = "1.0.0"; + NetworkFunctionDefinitionVersionData data = new NetworkFunctionDefinitionVersionData(new AzureLocation("eastus")) + { + Properties = new ContainerizedNetworkFunctionDefinitionVersion() + { + NetworkFunctionTemplate = new AzureArcKubernetesNetworkFunctionTemplate() + { + NetworkFunctionApplications = +{ +new AzureArcKubernetesHelmApplication() +{ +ArtifactProfile = new AzureArcKubernetesArtifactProfile() +{ +HelmArtifactProfile = new HelmArtifactProfile() +{ +HelmPackageName = "fed-rbac", +HelmPackageVersionRange = "~2.1.3", +RegistryValuesPaths = +{ +"global.registry.docker.repoPath" +}, +ImagePullSecretsValuesPaths = +{ +"global.imagePullSecrets" +}, +}, +ArtifactStoreId = new ResourceIdentifier("/subscriptions/subid/resourcegroups/rg/providers/microsoft.hybridnetwork/publishers/TestPublisher/artifactStores/testArtifactStore"), +}, +DeployParametersMappingRuleProfile = new AzureArcKubernetesDeployMappingRuleProfile() +{ +HelmMappingRuleProfile = new HelmMappingRuleProfile() +{ +ReleaseNamespace = "{deployParameters.namesapce}", +ReleaseName = "{deployParameters.releaseName}", +HelmPackageVersion = "2.1.3", +Values = "", +Options = new HelmMappingRuleProfileConfig() +{ +InstallOptions = new HelmInstallConfig() +{ +Atomic = "true", +Wait = "waitValue", +Timeout = "30", +}, +UpgradeOptions = new HelmUpgradeConfig() +{ +Atomic = "true", +Wait = "waitValue", +Timeout = "30", +}, +}, +}, +ApplicationEnablement = ApplicationEnablement.Enabled, +}, +Name = "fedrbac", +DependsOnProfile = new DependsOnProfile() +{ +InstallDependsOn = +{ +}, +UninstallDependsOn = +{ +}, +UpdateDependsOn = +{ +}, +}, +} +}, + }, + DeployParameters = "{\"type\":\"object\",\"properties\":{\"releaseName\":{\"type\":\"string\"},\"namespace\":{\"type\":\"string\"}}}", + }, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, networkFunctionDefinitionVersionName, data); + NetworkFunctionDefinitionVersionResource 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 + NetworkFunctionDefinitionVersionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Create or update a network function definition version resource for AzureCore VNF + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_CreateOrUpdateANetworkFunctionDefinitionVersionResourceForAzureCoreVNF() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/AzureCore/VirtualNetworkFunctionDefinitionVersionCreate.json + // this example is just showing the usage of "NetworkFunctionDefinitionVersions_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 NetworkFunctionDefinitionGroupResource created on azure + // for more information of creating NetworkFunctionDefinitionGroupResource, please refer to the document of NetworkFunctionDefinitionGroupResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string publisherName = "TestPublisher"; + string networkFunctionDefinitionGroupName = "TestNetworkFunctionDefinitionGroupName"; + ResourceIdentifier networkFunctionDefinitionGroupResourceId = NetworkFunctionDefinitionGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, publisherName, networkFunctionDefinitionGroupName); + NetworkFunctionDefinitionGroupResource networkFunctionDefinitionGroup = client.GetNetworkFunctionDefinitionGroupResource(networkFunctionDefinitionGroupResourceId); + + // get the collection of this NetworkFunctionDefinitionVersionResource + NetworkFunctionDefinitionVersionCollection collection = networkFunctionDefinitionGroup.GetNetworkFunctionDefinitionVersions(); + + // invoke the operation + string networkFunctionDefinitionVersionName = "1.0.0"; + NetworkFunctionDefinitionVersionData data = new NetworkFunctionDefinitionVersionData(new AzureLocation("eastus")) + { + Properties = new VirtualNetworkFunctionDefinitionVersion() + { + NetworkFunctionTemplate = new AzureCoreNetworkFunctionTemplate() + { + NetworkFunctionApplications = +{ +new AzureCoreNetworkFunctionVhdApplication() +{ +ArtifactProfile = new AzureCoreVhdImageArtifactProfile() +{ +VhdArtifactProfile = new VhdImageArtifactProfile() +{ +VhdName = "test-image", +VhdVersion = "1-0-0", +}, +ArtifactStoreId = new ResourceIdentifier("/subscriptions/subid/resourceGroups/rg/providers/microsoft.hybridnetwork/publishers/TestPublisher/artifactStores/TestArtifactStore"), +}, +DeployParametersMappingRuleProfile = new AzureCoreVhdImageDeployMappingRuleProfile() +{ +VhdImageMappingRuleUserConfiguration = "", +ApplicationEnablement = ApplicationEnablement.Unknown, +}, +Name = "testImageRole", +DependsOnProfile = new DependsOnProfile() +{ +InstallDependsOn = +{ +}, +UninstallDependsOn = +{ +}, +UpdateDependsOn = +{ +}, +}, +},new AzureCoreNetworkFunctionArmTemplateApplication() +{ +ArtifactProfile = new AzureCoreArmTemplateArtifactProfile() +{ +TemplateArtifactProfile = new ArmTemplateArtifactProfile() +{ +TemplateName = "test-template", +TemplateVersion = "1.0.0", +}, +ArtifactStoreId = new ResourceIdentifier("/subscriptions/subid/resourceGroups/rg/providers/microsoft.hybridnetwork/publishers/TestPublisher/artifactStores/TestArtifactStore"), +}, +DeployParametersMappingRuleProfile = new AzureCoreArmTemplateDeployMappingRuleProfile() +{ +TemplateParameters = "{\"virtualMachineName\":\"{deployParameters.virtualMachineName}\",\"cpuCores\":\"{deployParameters.cpuCores}\",\"memorySizeGB\":\"{deployParameters.memorySizeGB}\",\"cloudServicesNetworkAttachment\":\"{deployParameters.cloudServicesNetworkAttachment}\",\"networkAttachments\":\"{deployParameters.networkAttachments}\",\"sshPublicKeys\":\"{deployParameters.sshPublicKeys}\",\"storageProfile\":\"{deployParameters.storageProfile}\",\"isolateEmulatorThread\":\"{deployParameters.isolateEmulatorThread}\",\"virtioInterface\":\"{deployParameters.virtioInterface}\",\"userData\":\"{deployParameters.userData}\",\"adminUsername\":\"{deployParameters.adminUsername}\",\"bootMethod\":\"{deployParameters.bootMethod}\",\"placementHints\":\"{deployParameters.placementHints}\"}", +ApplicationEnablement = ApplicationEnablement.Unknown, +}, +Name = "testTemplateRole", +DependsOnProfile = new DependsOnProfile() +{ +InstallDependsOn = +{ +"testImageRole" +}, +UninstallDependsOn = +{ +"testImageRole" +}, +UpdateDependsOn = +{ +"testImageRole" +}, +}, +} +}, + }, + Description = "test NFDV for AzureCore", + DeployParameters = "{\"virtualMachineName\":{\"type\":\"string\"},\"cpuCores\":{\"type\":\"int\"},\"memorySizeGB\":{\"type\":\"int\"},\"cloudServicesNetworkAttachment\":{\"type\":\"object\",\"properties\":{\"networkAttachmentName\":{\"type\":\"string\"},\"attachedNetworkId\":{\"type\":\"string\"},\"ipAllocationMethod\":{\"type\":\"string\"},\"ipv4Address\":{\"type\":\"string\"},\"ipv6Address\":{\"type\":\"string\"},\"defaultGateway\":{\"type\":\"string\"}},\"required\":[\"attachedNetworkId\",\"ipAllocationMethod\"]},\"networkAttachments\":{\"type\":\"array\",\"items\":{\"type\":\"object\",\"properties\":{\"networkAttachmentName\":{\"type\":\"string\"},\"attachedNetworkId\":{\"type\":\"string\"},\"ipAllocationMethod\":{\"type\":\"string\"},\"ipv4Address\":{\"type\":\"string\"},\"ipv6Address\":{\"type\":\"string\"},\"defaultGateway\":{\"type\":\"string\"}},\"required\":[\"attachedNetworkId\",\"ipAllocationMethod\"]}},\"storageProfile\":{\"type\":\"object\",\"properties\":{\"osDisk\":{\"type\":\"object\",\"properties\":{\"createOption\":{\"type\":\"string\"},\"deleteOption\":{\"type\":\"string\"},\"diskSizeGB\":{\"type\":\"integer\"}},\"required\":[\"diskSizeGB\"]}},\"required\":[\"osDisk\"]},\"sshPublicKeys\":{\"type\":\"array\",\"items\":{\"type\":\"object\",\"properties\":{\"keyData\":{\"type\":\"string\"}},\"required\":[\"keyData\"]}},\"userData\":{\"type\":\"string\"},\"adminUsername\":{\"type\":\"string\"},\"bootMethod\":{\"type\":\"string\",\"default\":\"UEFI\",\"enum\":[\"UEFI\",\"BIOS\"]},\"isolateEmulatorThread\":{\"type\":\"string\"},\"virtioInterface\":{\"type\":\"string\"},\"placementHints\":{\"type\":\"array\",\"items\":{\"type\":\"object\",\"properties\":{\"hintType\":{\"type\":\"string\",\"enum\":[\"Affinity\",\"AntiAffinity\"]},\"resourceId\":{\"type\":\"string\"},\"schedulingExecution\":{\"type\":\"string\",\"enum\":[\"Soft\",\"Hard\"]},\"scope\":{\"type\":\"string\"}},\"required\":[\"hintType\",\"schedulingExecution\",\"resourceId\",\"scope\"]}}}", + }, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, networkFunctionDefinitionVersionName, data); + NetworkFunctionDefinitionVersionResource 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 + NetworkFunctionDefinitionVersionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Create or update a network function definition version resource for AzureOperatorNexus VNF + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_CreateOrUpdateANetworkFunctionDefinitionVersionResourceForAzureOperatorNexusVNF() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/AzureOperatorNexus/VirtualNetworkFunctionDefinitionVersionCreate.json + // this example is just showing the usage of "NetworkFunctionDefinitionVersions_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 NetworkFunctionDefinitionGroupResource created on azure + // for more information of creating NetworkFunctionDefinitionGroupResource, please refer to the document of NetworkFunctionDefinitionGroupResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string publisherName = "TestPublisher"; + string networkFunctionDefinitionGroupName = "TestNetworkFunctionDefinitionGroupName"; + ResourceIdentifier networkFunctionDefinitionGroupResourceId = NetworkFunctionDefinitionGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, publisherName, networkFunctionDefinitionGroupName); + NetworkFunctionDefinitionGroupResource networkFunctionDefinitionGroup = client.GetNetworkFunctionDefinitionGroupResource(networkFunctionDefinitionGroupResourceId); + + // get the collection of this NetworkFunctionDefinitionVersionResource + NetworkFunctionDefinitionVersionCollection collection = networkFunctionDefinitionGroup.GetNetworkFunctionDefinitionVersions(); + + // invoke the operation + string networkFunctionDefinitionVersionName = "1.0.0"; + NetworkFunctionDefinitionVersionData data = new NetworkFunctionDefinitionVersionData(new AzureLocation("eastus")) + { + Properties = new VirtualNetworkFunctionDefinitionVersion() + { + NetworkFunctionTemplate = new AzureOperatorNexusNetworkFunctionTemplate() + { + NetworkFunctionApplications = +{ +new AzureOperatorNexusNetworkFunctionImageApplication() +{ +ArtifactProfile = new AzureOperatorNexusImageArtifactProfile() +{ +ImageArtifactProfile = new ImageArtifactProfile() +{ +ImageName = "test-image", +ImageVersion = "1.0.0", +}, +ArtifactStoreId = new ResourceIdentifier("/subscriptions/subid/resourceGroups/rg/providers/microsoft.hybridnetwork/publishers/TestPublisher/artifactStores/TestArtifactStore"), +}, +DeployParametersMappingRuleProfile = new AzureOperatorNexusImageDeployMappingRuleProfile() +{ +ImageMappingRuleUserConfiguration = "", +ApplicationEnablement = ApplicationEnablement.Unknown, +}, +Name = "testImageRole", +DependsOnProfile = new DependsOnProfile() +{ +InstallDependsOn = +{ +}, +UninstallDependsOn = +{ +}, +UpdateDependsOn = +{ +}, +}, +},new AzureOperatorNexusNetworkFunctionArmTemplateApplication() +{ +ArtifactProfile = new AzureOperatorNexusArmTemplateArtifactProfile() +{ +TemplateArtifactProfile = new ArmTemplateArtifactProfile() +{ +TemplateName = "test-template", +TemplateVersion = "1.0.0", +}, +ArtifactStoreId = new ResourceIdentifier("/subscriptions/subid/resourceGroups/rg/providers/microsoft.hybridnetwork/publishers/TestPublisher/artifactStores/TestArtifactStore"), +}, +DeployParametersMappingRuleProfile = new AzureOperatorNexusArmTemplateDeployMappingRuleProfile() +{ +TemplateParameters = "{\"virtualMachineName\":\"{deployParameters.virtualMachineName}\",\"extendedLocationName\":\"{deployParameters.extendedLocationName}\",\"cpuCores\":\"{deployParameters.cpuCores}\",\"memorySizeGB\":\"{deployParameters.memorySizeGB}\",\"cloudServicesNetworkAttachment\":\"{deployParameters.cloudServicesNetworkAttachment}\",\"networkAttachments\":\"{deployParameters.networkAttachments}\",\"sshPublicKeys\":\"{deployParameters.sshPublicKeys}\",\"storageProfile\":\"{deployParameters.storageProfile}\",\"isolateEmulatorThread\":\"{deployParameters.isolateEmulatorThread}\",\"virtioInterface\":\"{deployParameters.virtioInterface}\",\"userData\":\"{deployParameters.userData}\",\"adminUsername\":\"{deployParameters.adminUsername}\",\"bootMethod\":\"{deployParameters.bootMethod}\",\"placementHints\":\"{deployParameters.placementHints}\"}", +ApplicationEnablement = ApplicationEnablement.Unknown, +}, +Name = "testTemplateRole", +DependsOnProfile = new DependsOnProfile() +{ +InstallDependsOn = +{ +"testImageRole" +}, +UninstallDependsOn = +{ +"testImageRole" +}, +UpdateDependsOn = +{ +"testImageRole" +}, +}, +} +}, + }, + Description = "test NFDV for AzureOperatorNexus", + DeployParameters = "{\"virtualMachineName\":{\"type\":\"string\"},\"extendedLocationName\":{\"type\":\"string\"},\"cpuCores\":{\"type\":\"int\"},\"memorySizeGB\":{\"type\":\"int\"},\"cloudServicesNetworkAttachment\":{\"type\":\"object\",\"properties\":{\"networkAttachmentName\":{\"type\":\"string\"},\"attachedNetworkId\":{\"type\":\"string\"},\"ipAllocationMethod\":{\"type\":\"string\"},\"ipv4Address\":{\"type\":\"string\"},\"ipv6Address\":{\"type\":\"string\"},\"defaultGateway\":{\"type\":\"string\"}},\"required\":[\"attachedNetworkId\",\"ipAllocationMethod\"]},\"networkAttachments\":{\"type\":\"array\",\"items\":{\"type\":\"object\",\"properties\":{\"networkAttachmentName\":{\"type\":\"string\"},\"attachedNetworkId\":{\"type\":\"string\"},\"ipAllocationMethod\":{\"type\":\"string\"},\"ipv4Address\":{\"type\":\"string\"},\"ipv6Address\":{\"type\":\"string\"},\"defaultGateway\":{\"type\":\"string\"}},\"required\":[\"attachedNetworkId\",\"ipAllocationMethod\"]}},\"storageProfile\":{\"type\":\"object\",\"properties\":{\"osDisk\":{\"type\":\"object\",\"properties\":{\"createOption\":{\"type\":\"string\"},\"deleteOption\":{\"type\":\"string\"},\"diskSizeGB\":{\"type\":\"integer\"}},\"required\":[\"diskSizeGB\"]}},\"required\":[\"osDisk\"]},\"sshPublicKeys\":{\"type\":\"array\",\"items\":{\"type\":\"object\",\"properties\":{\"keyData\":{\"type\":\"string\"}},\"required\":[\"keyData\"]}},\"userData\":{\"type\":\"string\"},\"adminUsername\":{\"type\":\"string\"},\"bootMethod\":{\"type\":\"string\",\"default\":\"UEFI\",\"enum\":[\"UEFI\",\"BIOS\"]},\"isolateEmulatorThread\":{\"type\":\"string\"},\"virtioInterface\":{\"type\":\"string\"},\"placementHints\":{\"type\":\"array\",\"items\":{\"type\":\"object\",\"properties\":{\"hintType\":{\"type\":\"string\",\"enum\":[\"Affinity\",\"AntiAffinity\"]},\"resourceId\":{\"type\":\"string\"},\"schedulingExecution\":{\"type\":\"string\",\"enum\":[\"Soft\",\"Hard\"]},\"scope\":{\"type\":\"string\"}},\"required\":[\"hintType\",\"schedulingExecution\",\"resourceId\",\"scope\"]}}}", + }, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, networkFunctionDefinitionVersionName, data); + NetworkFunctionDefinitionVersionResource 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 + NetworkFunctionDefinitionVersionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Get a network function definition version resource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetANetworkFunctionDefinitionVersionResource() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/NetworkFunctionDefinitionVersionGet.json + // this example is just showing the usage of "NetworkFunctionDefinitionVersions_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 NetworkFunctionDefinitionGroupResource created on azure + // for more information of creating NetworkFunctionDefinitionGroupResource, please refer to the document of NetworkFunctionDefinitionGroupResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string publisherName = "TestPublisher"; + string networkFunctionDefinitionGroupName = "TestNetworkFunctionDefinitionGroupName"; + ResourceIdentifier networkFunctionDefinitionGroupResourceId = NetworkFunctionDefinitionGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, publisherName, networkFunctionDefinitionGroupName); + NetworkFunctionDefinitionGroupResource networkFunctionDefinitionGroup = client.GetNetworkFunctionDefinitionGroupResource(networkFunctionDefinitionGroupResourceId); + + // get the collection of this NetworkFunctionDefinitionVersionResource + NetworkFunctionDefinitionVersionCollection collection = networkFunctionDefinitionGroup.GetNetworkFunctionDefinitionVersions(); + + // invoke the operation + string networkFunctionDefinitionVersionName = "1.0.0"; + NetworkFunctionDefinitionVersionResource result = await collection.GetAsync(networkFunctionDefinitionVersionName); + + // 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 + NetworkFunctionDefinitionVersionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Get a network function definition version resource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_GetANetworkFunctionDefinitionVersionResource() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/NetworkFunctionDefinitionVersionGet.json + // this example is just showing the usage of "NetworkFunctionDefinitionVersions_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 NetworkFunctionDefinitionGroupResource created on azure + // for more information of creating NetworkFunctionDefinitionGroupResource, please refer to the document of NetworkFunctionDefinitionGroupResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string publisherName = "TestPublisher"; + string networkFunctionDefinitionGroupName = "TestNetworkFunctionDefinitionGroupName"; + ResourceIdentifier networkFunctionDefinitionGroupResourceId = NetworkFunctionDefinitionGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, publisherName, networkFunctionDefinitionGroupName); + NetworkFunctionDefinitionGroupResource networkFunctionDefinitionGroup = client.GetNetworkFunctionDefinitionGroupResource(networkFunctionDefinitionGroupResourceId); + + // get the collection of this NetworkFunctionDefinitionVersionResource + NetworkFunctionDefinitionVersionCollection collection = networkFunctionDefinitionGroup.GetNetworkFunctionDefinitionVersions(); + + // invoke the operation + string networkFunctionDefinitionVersionName = "1.0.0"; + bool result = await collection.ExistsAsync(networkFunctionDefinitionVersionName); + + Console.WriteLine($"Succeeded: {result}"); + } + + // Get a network function definition version resource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetANetworkFunctionDefinitionVersionResource() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/NetworkFunctionDefinitionVersionGet.json + // this example is just showing the usage of "NetworkFunctionDefinitionVersions_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 NetworkFunctionDefinitionGroupResource created on azure + // for more information of creating NetworkFunctionDefinitionGroupResource, please refer to the document of NetworkFunctionDefinitionGroupResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string publisherName = "TestPublisher"; + string networkFunctionDefinitionGroupName = "TestNetworkFunctionDefinitionGroupName"; + ResourceIdentifier networkFunctionDefinitionGroupResourceId = NetworkFunctionDefinitionGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, publisherName, networkFunctionDefinitionGroupName); + NetworkFunctionDefinitionGroupResource networkFunctionDefinitionGroup = client.GetNetworkFunctionDefinitionGroupResource(networkFunctionDefinitionGroupResourceId); + + // get the collection of this NetworkFunctionDefinitionVersionResource + NetworkFunctionDefinitionVersionCollection collection = networkFunctionDefinitionGroup.GetNetworkFunctionDefinitionVersions(); + + // invoke the operation + string networkFunctionDefinitionVersionName = "1.0.0"; + NullableResponse response = await collection.GetIfExistsAsync(networkFunctionDefinitionVersionName); + NetworkFunctionDefinitionVersionResource 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 + NetworkFunctionDefinitionVersionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + // Get network function definition version resource for AzureCore VNF + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetNetworkFunctionDefinitionVersionResourceForAzureCoreVNF() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/AzureCore/VirtualNetworkFunctionDefinitionVersionGet.json + // this example is just showing the usage of "NetworkFunctionDefinitionVersions_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 NetworkFunctionDefinitionGroupResource created on azure + // for more information of creating NetworkFunctionDefinitionGroupResource, please refer to the document of NetworkFunctionDefinitionGroupResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string publisherName = "TestPublisher"; + string networkFunctionDefinitionGroupName = "TestNetworkFunctionDefinitionGroupName"; + ResourceIdentifier networkFunctionDefinitionGroupResourceId = NetworkFunctionDefinitionGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, publisherName, networkFunctionDefinitionGroupName); + NetworkFunctionDefinitionGroupResource networkFunctionDefinitionGroup = client.GetNetworkFunctionDefinitionGroupResource(networkFunctionDefinitionGroupResourceId); + + // get the collection of this NetworkFunctionDefinitionVersionResource + NetworkFunctionDefinitionVersionCollection collection = networkFunctionDefinitionGroup.GetNetworkFunctionDefinitionVersions(); + + // invoke the operation + string networkFunctionDefinitionVersionName = "1.0.0"; + NetworkFunctionDefinitionVersionResource result = await collection.GetAsync(networkFunctionDefinitionVersionName); + + // 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 + NetworkFunctionDefinitionVersionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Get network function definition version resource for AzureCore VNF + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_GetNetworkFunctionDefinitionVersionResourceForAzureCoreVNF() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/AzureCore/VirtualNetworkFunctionDefinitionVersionGet.json + // this example is just showing the usage of "NetworkFunctionDefinitionVersions_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 NetworkFunctionDefinitionGroupResource created on azure + // for more information of creating NetworkFunctionDefinitionGroupResource, please refer to the document of NetworkFunctionDefinitionGroupResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string publisherName = "TestPublisher"; + string networkFunctionDefinitionGroupName = "TestNetworkFunctionDefinitionGroupName"; + ResourceIdentifier networkFunctionDefinitionGroupResourceId = NetworkFunctionDefinitionGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, publisherName, networkFunctionDefinitionGroupName); + NetworkFunctionDefinitionGroupResource networkFunctionDefinitionGroup = client.GetNetworkFunctionDefinitionGroupResource(networkFunctionDefinitionGroupResourceId); + + // get the collection of this NetworkFunctionDefinitionVersionResource + NetworkFunctionDefinitionVersionCollection collection = networkFunctionDefinitionGroup.GetNetworkFunctionDefinitionVersions(); + + // invoke the operation + string networkFunctionDefinitionVersionName = "1.0.0"; + bool result = await collection.ExistsAsync(networkFunctionDefinitionVersionName); + + Console.WriteLine($"Succeeded: {result}"); + } + + // Get network function definition version resource for AzureCore VNF + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetNetworkFunctionDefinitionVersionResourceForAzureCoreVNF() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/AzureCore/VirtualNetworkFunctionDefinitionVersionGet.json + // this example is just showing the usage of "NetworkFunctionDefinitionVersions_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 NetworkFunctionDefinitionGroupResource created on azure + // for more information of creating NetworkFunctionDefinitionGroupResource, please refer to the document of NetworkFunctionDefinitionGroupResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string publisherName = "TestPublisher"; + string networkFunctionDefinitionGroupName = "TestNetworkFunctionDefinitionGroupName"; + ResourceIdentifier networkFunctionDefinitionGroupResourceId = NetworkFunctionDefinitionGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, publisherName, networkFunctionDefinitionGroupName); + NetworkFunctionDefinitionGroupResource networkFunctionDefinitionGroup = client.GetNetworkFunctionDefinitionGroupResource(networkFunctionDefinitionGroupResourceId); + + // get the collection of this NetworkFunctionDefinitionVersionResource + NetworkFunctionDefinitionVersionCollection collection = networkFunctionDefinitionGroup.GetNetworkFunctionDefinitionVersions(); + + // invoke the operation + string networkFunctionDefinitionVersionName = "1.0.0"; + NullableResponse response = await collection.GetIfExistsAsync(networkFunctionDefinitionVersionName); + NetworkFunctionDefinitionVersionResource 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 + NetworkFunctionDefinitionVersionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + // Get network function definition version resource for AzureOperatorNexus VNF + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetNetworkFunctionDefinitionVersionResourceForAzureOperatorNexusVNF() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/AzureOperatorNexus/VirtualNetworkFunctionDefinitionVersionGet.json + // this example is just showing the usage of "NetworkFunctionDefinitionVersions_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 NetworkFunctionDefinitionGroupResource created on azure + // for more information of creating NetworkFunctionDefinitionGroupResource, please refer to the document of NetworkFunctionDefinitionGroupResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string publisherName = "TestPublisher"; + string networkFunctionDefinitionGroupName = "TestNetworkFunctionDefinitionGroupName"; + ResourceIdentifier networkFunctionDefinitionGroupResourceId = NetworkFunctionDefinitionGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, publisherName, networkFunctionDefinitionGroupName); + NetworkFunctionDefinitionGroupResource networkFunctionDefinitionGroup = client.GetNetworkFunctionDefinitionGroupResource(networkFunctionDefinitionGroupResourceId); + + // get the collection of this NetworkFunctionDefinitionVersionResource + NetworkFunctionDefinitionVersionCollection collection = networkFunctionDefinitionGroup.GetNetworkFunctionDefinitionVersions(); + + // invoke the operation + string networkFunctionDefinitionVersionName = "1.0.0"; + NetworkFunctionDefinitionVersionResource result = await collection.GetAsync(networkFunctionDefinitionVersionName); + + // 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 + NetworkFunctionDefinitionVersionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Get network function definition version resource for AzureOperatorNexus VNF + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_GetNetworkFunctionDefinitionVersionResourceForAzureOperatorNexusVNF() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/AzureOperatorNexus/VirtualNetworkFunctionDefinitionVersionGet.json + // this example is just showing the usage of "NetworkFunctionDefinitionVersions_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 NetworkFunctionDefinitionGroupResource created on azure + // for more information of creating NetworkFunctionDefinitionGroupResource, please refer to the document of NetworkFunctionDefinitionGroupResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string publisherName = "TestPublisher"; + string networkFunctionDefinitionGroupName = "TestNetworkFunctionDefinitionGroupName"; + ResourceIdentifier networkFunctionDefinitionGroupResourceId = NetworkFunctionDefinitionGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, publisherName, networkFunctionDefinitionGroupName); + NetworkFunctionDefinitionGroupResource networkFunctionDefinitionGroup = client.GetNetworkFunctionDefinitionGroupResource(networkFunctionDefinitionGroupResourceId); + + // get the collection of this NetworkFunctionDefinitionVersionResource + NetworkFunctionDefinitionVersionCollection collection = networkFunctionDefinitionGroup.GetNetworkFunctionDefinitionVersions(); + + // invoke the operation + string networkFunctionDefinitionVersionName = "1.0.0"; + bool result = await collection.ExistsAsync(networkFunctionDefinitionVersionName); + + Console.WriteLine($"Succeeded: {result}"); + } + + // Get network function definition version resource for AzureOperatorNexus VNF + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetNetworkFunctionDefinitionVersionResourceForAzureOperatorNexusVNF() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/AzureOperatorNexus/VirtualNetworkFunctionDefinitionVersionGet.json + // this example is just showing the usage of "NetworkFunctionDefinitionVersions_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 NetworkFunctionDefinitionGroupResource created on azure + // for more information of creating NetworkFunctionDefinitionGroupResource, please refer to the document of NetworkFunctionDefinitionGroupResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string publisherName = "TestPublisher"; + string networkFunctionDefinitionGroupName = "TestNetworkFunctionDefinitionGroupName"; + ResourceIdentifier networkFunctionDefinitionGroupResourceId = NetworkFunctionDefinitionGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, publisherName, networkFunctionDefinitionGroupName); + NetworkFunctionDefinitionGroupResource networkFunctionDefinitionGroup = client.GetNetworkFunctionDefinitionGroupResource(networkFunctionDefinitionGroupResourceId); + + // get the collection of this NetworkFunctionDefinitionVersionResource + NetworkFunctionDefinitionVersionCollection collection = networkFunctionDefinitionGroup.GetNetworkFunctionDefinitionVersions(); + + // invoke the operation + string networkFunctionDefinitionVersionName = "1.0.0"; + NullableResponse response = await collection.GetIfExistsAsync(networkFunctionDefinitionVersionName); + NetworkFunctionDefinitionVersionResource 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 + NetworkFunctionDefinitionVersionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + // Get Publisher resource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_GetPublisherResource() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/NetworkFunctionDefinitionVersionListByNetworkFunctionDefinitionGroup.json + // this example is just showing the usage of "NetworkFunctionDefinitionVersions_ListByNetworkFunctionDefinitionGroup" 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 NetworkFunctionDefinitionGroupResource created on azure + // for more information of creating NetworkFunctionDefinitionGroupResource, please refer to the document of NetworkFunctionDefinitionGroupResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string publisherName = "TestPublisher"; + string networkFunctionDefinitionGroupName = "TestNetworkFunctionDefinitionGroupNameName"; + ResourceIdentifier networkFunctionDefinitionGroupResourceId = NetworkFunctionDefinitionGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, publisherName, networkFunctionDefinitionGroupName); + NetworkFunctionDefinitionGroupResource networkFunctionDefinitionGroup = client.GetNetworkFunctionDefinitionGroupResource(networkFunctionDefinitionGroupResourceId); + + // get the collection of this NetworkFunctionDefinitionVersionResource + NetworkFunctionDefinitionVersionCollection collection = networkFunctionDefinitionGroup.GetNetworkFunctionDefinitionVersions(); + + // invoke the operation and iterate over the result + await foreach (NetworkFunctionDefinitionVersionResource 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 + NetworkFunctionDefinitionVersionData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/samples/Generated/Samples/Sample_NetworkFunctionDefinitionVersionResource.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/samples/Generated/Samples/Sample_NetworkFunctionDefinitionVersionResource.cs new file mode 100644 index 000000000000..af5f2bed20e4 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/samples/Generated/Samples/Sample_NetworkFunctionDefinitionVersionResource.cs @@ -0,0 +1,282 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.HybridNetwork; +using Azure.ResourceManager.HybridNetwork.Models; + +namespace Azure.ResourceManager.HybridNetwork.Samples +{ + public partial class Sample_NetworkFunctionDefinitionVersionResource + { + // Delete a network function definition version + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_DeleteANetworkFunctionDefinitionVersion() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/NetworkFunctionDefinitionVersionDelete.json + // this example is just showing the usage of "NetworkFunctionDefinitionVersions_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 NetworkFunctionDefinitionVersionResource created on azure + // for more information of creating NetworkFunctionDefinitionVersionResource, please refer to the document of NetworkFunctionDefinitionVersionResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string publisherName = "TestPublisher"; + string networkFunctionDefinitionGroupName = "TestNetworkFunctionDefinitionGroupName"; + string networkFunctionDefinitionVersionName = "1.0.0"; + ResourceIdentifier networkFunctionDefinitionVersionResourceId = NetworkFunctionDefinitionVersionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, publisherName, networkFunctionDefinitionGroupName, networkFunctionDefinitionVersionName); + NetworkFunctionDefinitionVersionResource networkFunctionDefinitionVersion = client.GetNetworkFunctionDefinitionVersionResource(networkFunctionDefinitionVersionResourceId); + + // invoke the operation + await networkFunctionDefinitionVersion.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine($"Succeeded"); + } + + // Delete a network function definition version for AzureCore VNF + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_DeleteANetworkFunctionDefinitionVersionForAzureCoreVNF() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/AzureCore/VirtualNetworkFunctionDefinitionVersionDelete.json + // this example is just showing the usage of "NetworkFunctionDefinitionVersions_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 NetworkFunctionDefinitionVersionResource created on azure + // for more information of creating NetworkFunctionDefinitionVersionResource, please refer to the document of NetworkFunctionDefinitionVersionResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string publisherName = "TestPublisher"; + string networkFunctionDefinitionGroupName = "TestNetworkFunctionDefinitionGroupName"; + string networkFunctionDefinitionVersionName = "1.0.0"; + ResourceIdentifier networkFunctionDefinitionVersionResourceId = NetworkFunctionDefinitionVersionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, publisherName, networkFunctionDefinitionGroupName, networkFunctionDefinitionVersionName); + NetworkFunctionDefinitionVersionResource networkFunctionDefinitionVersion = client.GetNetworkFunctionDefinitionVersionResource(networkFunctionDefinitionVersionResourceId); + + // invoke the operation + await networkFunctionDefinitionVersion.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine($"Succeeded"); + } + + // Delete a network function definition version for AzureOperatorNexus VNF + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_DeleteANetworkFunctionDefinitionVersionForAzureOperatorNexusVNF() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/AzureOperatorNexus/VirtualNetworkFunctionDefinitionVersionDelete.json + // this example is just showing the usage of "NetworkFunctionDefinitionVersions_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 NetworkFunctionDefinitionVersionResource created on azure + // for more information of creating NetworkFunctionDefinitionVersionResource, please refer to the document of NetworkFunctionDefinitionVersionResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string publisherName = "TestPublisher"; + string networkFunctionDefinitionGroupName = "TestNetworkFunctionDefinitionGroupName"; + string networkFunctionDefinitionVersionName = "1.0.0"; + ResourceIdentifier networkFunctionDefinitionVersionResourceId = NetworkFunctionDefinitionVersionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, publisherName, networkFunctionDefinitionGroupName, networkFunctionDefinitionVersionName); + NetworkFunctionDefinitionVersionResource networkFunctionDefinitionVersion = client.GetNetworkFunctionDefinitionVersionResource(networkFunctionDefinitionVersionResourceId); + + // invoke the operation + await networkFunctionDefinitionVersion.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine($"Succeeded"); + } + + // Get a network function definition version resource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetANetworkFunctionDefinitionVersionResource() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/NetworkFunctionDefinitionVersionGet.json + // this example is just showing the usage of "NetworkFunctionDefinitionVersions_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 NetworkFunctionDefinitionVersionResource created on azure + // for more information of creating NetworkFunctionDefinitionVersionResource, please refer to the document of NetworkFunctionDefinitionVersionResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string publisherName = "TestPublisher"; + string networkFunctionDefinitionGroupName = "TestNetworkFunctionDefinitionGroupName"; + string networkFunctionDefinitionVersionName = "1.0.0"; + ResourceIdentifier networkFunctionDefinitionVersionResourceId = NetworkFunctionDefinitionVersionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, publisherName, networkFunctionDefinitionGroupName, networkFunctionDefinitionVersionName); + NetworkFunctionDefinitionVersionResource networkFunctionDefinitionVersion = client.GetNetworkFunctionDefinitionVersionResource(networkFunctionDefinitionVersionResourceId); + + // invoke the operation + NetworkFunctionDefinitionVersionResource result = await networkFunctionDefinitionVersion.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 + NetworkFunctionDefinitionVersionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Get network function definition version resource for AzureCore VNF + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetNetworkFunctionDefinitionVersionResourceForAzureCoreVNF() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/AzureCore/VirtualNetworkFunctionDefinitionVersionGet.json + // this example is just showing the usage of "NetworkFunctionDefinitionVersions_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 NetworkFunctionDefinitionVersionResource created on azure + // for more information of creating NetworkFunctionDefinitionVersionResource, please refer to the document of NetworkFunctionDefinitionVersionResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string publisherName = "TestPublisher"; + string networkFunctionDefinitionGroupName = "TestNetworkFunctionDefinitionGroupName"; + string networkFunctionDefinitionVersionName = "1.0.0"; + ResourceIdentifier networkFunctionDefinitionVersionResourceId = NetworkFunctionDefinitionVersionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, publisherName, networkFunctionDefinitionGroupName, networkFunctionDefinitionVersionName); + NetworkFunctionDefinitionVersionResource networkFunctionDefinitionVersion = client.GetNetworkFunctionDefinitionVersionResource(networkFunctionDefinitionVersionResourceId); + + // invoke the operation + NetworkFunctionDefinitionVersionResource result = await networkFunctionDefinitionVersion.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 + NetworkFunctionDefinitionVersionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Get network function definition version resource for AzureOperatorNexus VNF + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetNetworkFunctionDefinitionVersionResourceForAzureOperatorNexusVNF() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/AzureOperatorNexus/VirtualNetworkFunctionDefinitionVersionGet.json + // this example is just showing the usage of "NetworkFunctionDefinitionVersions_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 NetworkFunctionDefinitionVersionResource created on azure + // for more information of creating NetworkFunctionDefinitionVersionResource, please refer to the document of NetworkFunctionDefinitionVersionResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string publisherName = "TestPublisher"; + string networkFunctionDefinitionGroupName = "TestNetworkFunctionDefinitionGroupName"; + string networkFunctionDefinitionVersionName = "1.0.0"; + ResourceIdentifier networkFunctionDefinitionVersionResourceId = NetworkFunctionDefinitionVersionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, publisherName, networkFunctionDefinitionGroupName, networkFunctionDefinitionVersionName); + NetworkFunctionDefinitionVersionResource networkFunctionDefinitionVersion = client.GetNetworkFunctionDefinitionVersionResource(networkFunctionDefinitionVersionResourceId); + + // invoke the operation + NetworkFunctionDefinitionVersionResource result = await networkFunctionDefinitionVersion.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 + NetworkFunctionDefinitionVersionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Update the network function definition version tags + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_UpdateTheNetworkFunctionDefinitionVersionTags() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/NetworkFunctionDefinitionVersionUpdateTags.json + // this example is just showing the usage of "NetworkFunctionDefinitionVersions_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 NetworkFunctionDefinitionVersionResource created on azure + // for more information of creating NetworkFunctionDefinitionVersionResource, please refer to the document of NetworkFunctionDefinitionVersionResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string publisherName = "TestPublisher"; + string networkFunctionDefinitionGroupName = "TestNetworkFunctionDefinitionGroupName"; + string networkFunctionDefinitionVersionName = "1.0.0"; + ResourceIdentifier networkFunctionDefinitionVersionResourceId = NetworkFunctionDefinitionVersionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, publisherName, networkFunctionDefinitionGroupName, networkFunctionDefinitionVersionName); + NetworkFunctionDefinitionVersionResource networkFunctionDefinitionVersion = client.GetNetworkFunctionDefinitionVersionResource(networkFunctionDefinitionVersionResourceId); + + // invoke the operation + TagsObject tagsObject = new TagsObject() + { + Tags = +{ +["tag1"] = "value1", +["tag2"] = "value2", +}, + }; + NetworkFunctionDefinitionVersionResource result = await networkFunctionDefinitionVersion.UpdateAsync(tagsObject); + + // 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 + NetworkFunctionDefinitionVersionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Update network function definition version state + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task UpdateState_UpdateNetworkFunctionDefinitionVersionState() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/NetworkFunctionDefinitionVersionUpdateState.json + // this example is just showing the usage of "NetworkFunctionDefinitionVersions_updateState" 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 NetworkFunctionDefinitionVersionResource created on azure + // for more information of creating NetworkFunctionDefinitionVersionResource, please refer to the document of NetworkFunctionDefinitionVersionResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string publisherName = "TestPublisher"; + string networkFunctionDefinitionGroupName = "TestSkuGroup"; + string networkFunctionDefinitionVersionName = "1.0.0"; + ResourceIdentifier networkFunctionDefinitionVersionResourceId = NetworkFunctionDefinitionVersionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, publisherName, networkFunctionDefinitionGroupName, networkFunctionDefinitionVersionName); + NetworkFunctionDefinitionVersionResource networkFunctionDefinitionVersion = client.GetNetworkFunctionDefinitionVersionResource(networkFunctionDefinitionVersionResourceId); + + // invoke the operation + NetworkFunctionDefinitionVersionUpdateState networkFunctionDefinitionVersionUpdateState = new NetworkFunctionDefinitionVersionUpdateState() + { + VersionState = VersionState.Active, + }; + ArmOperation lro = await networkFunctionDefinitionVersion.UpdateStateAsync(WaitUntil.Completed, networkFunctionDefinitionVersionUpdateState); + NetworkFunctionDefinitionVersionUpdateState result = lro.Value; + + Console.WriteLine($"Succeeded: {result}"); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/samples/Generated/Samples/Sample_NetworkFunctionResource.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/samples/Generated/Samples/Sample_NetworkFunctionResource.cs new file mode 100644 index 000000000000..89110f6edeb7 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/samples/Generated/Samples/Sample_NetworkFunctionResource.cs @@ -0,0 +1,298 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.HybridNetwork; +using Azure.ResourceManager.HybridNetwork.Models; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.HybridNetwork.Samples +{ + public partial class Sample_NetworkFunctionResource + { + // Delete network function resource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_DeleteNetworkFunctionResource() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/NetworkFunctionDelete.json + // this example is just showing the usage of "NetworkFunctions_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 NetworkFunctionResource created on azure + // for more information of creating NetworkFunctionResource, please refer to the document of NetworkFunctionResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string networkFunctionName = "testNf"; + ResourceIdentifier networkFunctionResourceId = NetworkFunctionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, networkFunctionName); + NetworkFunctionResource networkFunction = client.GetNetworkFunctionResource(networkFunctionResourceId); + + // invoke the operation + await networkFunction.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine($"Succeeded"); + } + + // Delete virtual network function resource on AzureCore + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_DeleteVirtualNetworkFunctionResourceOnAzureCore() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/AzureCore/VirtualNetworkFunctionDelete.json + // this example is just showing the usage of "NetworkFunctions_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 NetworkFunctionResource created on azure + // for more information of creating NetworkFunctionResource, please refer to the document of NetworkFunctionResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string networkFunctionName = "testNf"; + ResourceIdentifier networkFunctionResourceId = NetworkFunctionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, networkFunctionName); + NetworkFunctionResource networkFunction = client.GetNetworkFunctionResource(networkFunctionResourceId); + + // invoke the operation + await networkFunction.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine($"Succeeded"); + } + + // Delete virtual network function resource on AzureOperatorNexus + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_DeleteVirtualNetworkFunctionResourceOnAzureOperatorNexus() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/AzureOperatorNexus/VirtualNetworkFunctionDelete.json + // this example is just showing the usage of "NetworkFunctions_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 NetworkFunctionResource created on azure + // for more information of creating NetworkFunctionResource, please refer to the document of NetworkFunctionResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string networkFunctionName = "testNf"; + ResourceIdentifier networkFunctionResourceId = NetworkFunctionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, networkFunctionName); + NetworkFunctionResource networkFunction = client.GetNetworkFunctionResource(networkFunctionResourceId); + + // invoke the operation + await networkFunction.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine($"Succeeded"); + } + + // Get network function resource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetNetworkFunctionResource() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/NetworkFunctionGet.json + // this example is just showing the usage of "NetworkFunctions_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 NetworkFunctionResource created on azure + // for more information of creating NetworkFunctionResource, please refer to the document of NetworkFunctionResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string networkFunctionName = "testNf"; + ResourceIdentifier networkFunctionResourceId = NetworkFunctionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, networkFunctionName); + NetworkFunctionResource networkFunction = client.GetNetworkFunctionResource(networkFunctionResourceId); + + // invoke the operation + NetworkFunctionResource result = await networkFunction.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 + NetworkFunctionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Get virtual network function resource on AzureCore + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetVirtualNetworkFunctionResourceOnAzureCore() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/AzureCore/VirtualNetworkFunctionGet.json + // this example is just showing the usage of "NetworkFunctions_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 NetworkFunctionResource created on azure + // for more information of creating NetworkFunctionResource, please refer to the document of NetworkFunctionResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string networkFunctionName = "testNf"; + ResourceIdentifier networkFunctionResourceId = NetworkFunctionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, networkFunctionName); + NetworkFunctionResource networkFunction = client.GetNetworkFunctionResource(networkFunctionResourceId); + + // invoke the operation + NetworkFunctionResource result = await networkFunction.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 + NetworkFunctionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Get virtual network function resource on AzureOperatorNexus + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetVirtualNetworkFunctionResourceOnAzureOperatorNexus() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/AzureOperatorNexus/VirtualNetworkFunctionGet.json + // this example is just showing the usage of "NetworkFunctions_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 NetworkFunctionResource created on azure + // for more information of creating NetworkFunctionResource, please refer to the document of NetworkFunctionResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string networkFunctionName = "testNf"; + ResourceIdentifier networkFunctionResourceId = NetworkFunctionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, networkFunctionName); + NetworkFunctionResource networkFunction = client.GetNetworkFunctionResource(networkFunctionResourceId); + + // invoke the operation + NetworkFunctionResource result = await networkFunction.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 + NetworkFunctionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Update tags for network function resource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_UpdateTagsForNetworkFunctionResource() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/NetworkFunctionUpdateTags.json + // this example is just showing the usage of "NetworkFunctions_UpdateTags" 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 NetworkFunctionResource created on azure + // for more information of creating NetworkFunctionResource, please refer to the document of NetworkFunctionResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string networkFunctionName = "testNf"; + ResourceIdentifier networkFunctionResourceId = NetworkFunctionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, networkFunctionName); + NetworkFunctionResource networkFunction = client.GetNetworkFunctionResource(networkFunctionResourceId); + + // invoke the operation + TagsObject tagsObject = new TagsObject() + { + Tags = +{ +["tag1"] = "value1", +["tag2"] = "value2", +}, + }; + NetworkFunctionResource result = await networkFunction.UpdateAsync(tagsObject); + + // 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 + NetworkFunctionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // List all network function resources in subscription. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetNetworkFunctions_ListAllNetworkFunctionResourcesInSubscription() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/NetworkFunctionListBySubscription.json + // this example is just showing the usage of "NetworkFunctions_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 = "subid"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // invoke the operation and iterate over the result + await foreach (NetworkFunctionResource item in subscriptionResource.GetNetworkFunctionsAsync()) + { + // 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 + NetworkFunctionData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // Send request to network function services + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task ExecuteRequest_SendRequestToNetworkFunctionServices() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/NetworkFunctionsExecuteRequest.json + // this example is just showing the usage of "NetworkFunctions_ExecuteRequest" 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 NetworkFunctionResource created on azure + // for more information of creating NetworkFunctionResource, please refer to the document of NetworkFunctionResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string networkFunctionName = "testNetworkfunction"; + ResourceIdentifier networkFunctionResourceId = NetworkFunctionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, networkFunctionName); + NetworkFunctionResource networkFunction = client.GetNetworkFunctionResource(networkFunctionResourceId); + + // invoke the operation + ExecuteRequestContent content = new ExecuteRequestContent("serviceEndpoint", new RequestMetadata("/simProfiles/testSimProfile", HttpMethod.Post, "{\"subscriptionProfile\":\"ChantestSubscription15\",\"permanentKey\":\"00112233445566778899AABBCCDDEEFF\",\"opcOperatorCode\":\"63bfa50ee6523365ff14c1f45f88737d\",\"staticIpAddresses\":{\"internet\":{\"ipv4Addr\":\"198.51.100.1\",\"ipv6Prefix\":\"2001:db8:abcd:12::0/64\"},\"another_network\":{\"ipv6Prefix\":\"2001:111:cdef:22::0/64\"}}}") + { + ApiVersion = "apiVersionQueryString", + }); + await networkFunction.ExecuteRequestAsync(WaitUntil.Completed, content); + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/samples/Generated/Samples/Sample_NetworkServiceDesignGroupCollection.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/samples/Generated/Samples/Sample_NetworkServiceDesignGroupCollection.cs new file mode 100644 index 000000000000..781284a4ffe0 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/samples/Generated/Samples/Sample_NetworkServiceDesignGroupCollection.cs @@ -0,0 +1,203 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.HybridNetwork; + +namespace Azure.ResourceManager.HybridNetwork.Samples +{ + public partial class Sample_NetworkServiceDesignGroupCollection + { + // Get networkServiceDesign groups under publisher resource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_GetNetworkServiceDesignGroupsUnderPublisherResource() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/NetworkServiceDesignGroupsListByPublisherName.json + // this example is just showing the usage of "NetworkServiceDesignGroups_ListByPublisher" 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 PublisherResource created on azure + // for more information of creating PublisherResource, please refer to the document of PublisherResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string publisherName = "TestPublisher"; + ResourceIdentifier publisherResourceId = PublisherResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, publisherName); + PublisherResource publisher = client.GetPublisherResource(publisherResourceId); + + // get the collection of this NetworkServiceDesignGroupResource + NetworkServiceDesignGroupCollection collection = publisher.GetNetworkServiceDesignGroups(); + + // invoke the operation and iterate over the result + await foreach (NetworkServiceDesignGroupResource 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 + NetworkServiceDesignGroupData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // Create or update the network service design group + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_CreateOrUpdateTheNetworkServiceDesignGroup() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/NetworkServiceDesignGroupCreate.json + // this example is just showing the usage of "NetworkServiceDesignGroups_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 PublisherResource created on azure + // for more information of creating PublisherResource, please refer to the document of PublisherResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string publisherName = "TestPublisher"; + ResourceIdentifier publisherResourceId = PublisherResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, publisherName); + PublisherResource publisher = client.GetPublisherResource(publisherResourceId); + + // get the collection of this NetworkServiceDesignGroupResource + NetworkServiceDesignGroupCollection collection = publisher.GetNetworkServiceDesignGroups(); + + // invoke the operation + string networkServiceDesignGroupName = "TestNetworkServiceDesignGroupName"; + NetworkServiceDesignGroupData data = new NetworkServiceDesignGroupData(new AzureLocation("eastus")); + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, networkServiceDesignGroupName, data); + NetworkServiceDesignGroupResource 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 + NetworkServiceDesignGroupData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Get a networkServiceDesign group resource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetANetworkServiceDesignGroupResource() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/NetworkServiceDesignGroupGet.json + // this example is just showing the usage of "NetworkServiceDesignGroups_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 PublisherResource created on azure + // for more information of creating PublisherResource, please refer to the document of PublisherResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string publisherName = "TestPublisher"; + ResourceIdentifier publisherResourceId = PublisherResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, publisherName); + PublisherResource publisher = client.GetPublisherResource(publisherResourceId); + + // get the collection of this NetworkServiceDesignGroupResource + NetworkServiceDesignGroupCollection collection = publisher.GetNetworkServiceDesignGroups(); + + // invoke the operation + string networkServiceDesignGroupName = "TestNetworkServiceDesignGroupName"; + NetworkServiceDesignGroupResource result = await collection.GetAsync(networkServiceDesignGroupName); + + // 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 + NetworkServiceDesignGroupData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Get a networkServiceDesign group resource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_GetANetworkServiceDesignGroupResource() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/NetworkServiceDesignGroupGet.json + // this example is just showing the usage of "NetworkServiceDesignGroups_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 PublisherResource created on azure + // for more information of creating PublisherResource, please refer to the document of PublisherResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string publisherName = "TestPublisher"; + ResourceIdentifier publisherResourceId = PublisherResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, publisherName); + PublisherResource publisher = client.GetPublisherResource(publisherResourceId); + + // get the collection of this NetworkServiceDesignGroupResource + NetworkServiceDesignGroupCollection collection = publisher.GetNetworkServiceDesignGroups(); + + // invoke the operation + string networkServiceDesignGroupName = "TestNetworkServiceDesignGroupName"; + bool result = await collection.ExistsAsync(networkServiceDesignGroupName); + + Console.WriteLine($"Succeeded: {result}"); + } + + // Get a networkServiceDesign group resource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetANetworkServiceDesignGroupResource() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/NetworkServiceDesignGroupGet.json + // this example is just showing the usage of "NetworkServiceDesignGroups_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 PublisherResource created on azure + // for more information of creating PublisherResource, please refer to the document of PublisherResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string publisherName = "TestPublisher"; + ResourceIdentifier publisherResourceId = PublisherResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, publisherName); + PublisherResource publisher = client.GetPublisherResource(publisherResourceId); + + // get the collection of this NetworkServiceDesignGroupResource + NetworkServiceDesignGroupCollection collection = publisher.GetNetworkServiceDesignGroups(); + + // invoke the operation + string networkServiceDesignGroupName = "TestNetworkServiceDesignGroupName"; + NullableResponse response = await collection.GetIfExistsAsync(networkServiceDesignGroupName); + NetworkServiceDesignGroupResource 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 + NetworkServiceDesignGroupData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/samples/Generated/Samples/Sample_NetworkServiceDesignGroupResource.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/samples/Generated/Samples/Sample_NetworkServiceDesignGroupResource.cs new file mode 100644 index 000000000000..a606ae1b5965 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/samples/Generated/Samples/Sample_NetworkServiceDesignGroupResource.cs @@ -0,0 +1,121 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.HybridNetwork; +using Azure.ResourceManager.HybridNetwork.Models; + +namespace Azure.ResourceManager.HybridNetwork.Samples +{ + public partial class Sample_NetworkServiceDesignGroupResource + { + // Delete a network function group resource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_DeleteANetworkFunctionGroupResource() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/NetworkServiceDesignGroupDelete.json + // this example is just showing the usage of "NetworkServiceDesignGroups_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 NetworkServiceDesignGroupResource created on azure + // for more information of creating NetworkServiceDesignGroupResource, please refer to the document of NetworkServiceDesignGroupResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string publisherName = "TestPublisher"; + string networkServiceDesignGroupName = "TestNetworkServiceDesignGroupName"; + ResourceIdentifier networkServiceDesignGroupResourceId = NetworkServiceDesignGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, publisherName, networkServiceDesignGroupName); + NetworkServiceDesignGroupResource networkServiceDesignGroup = client.GetNetworkServiceDesignGroupResource(networkServiceDesignGroupResourceId); + + // invoke the operation + await networkServiceDesignGroup.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine($"Succeeded"); + } + + // Get a networkServiceDesign group resource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetANetworkServiceDesignGroupResource() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/NetworkServiceDesignGroupGet.json + // this example is just showing the usage of "NetworkServiceDesignGroups_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 NetworkServiceDesignGroupResource created on azure + // for more information of creating NetworkServiceDesignGroupResource, please refer to the document of NetworkServiceDesignGroupResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string publisherName = "TestPublisher"; + string networkServiceDesignGroupName = "TestNetworkServiceDesignGroupName"; + ResourceIdentifier networkServiceDesignGroupResourceId = NetworkServiceDesignGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, publisherName, networkServiceDesignGroupName); + NetworkServiceDesignGroupResource networkServiceDesignGroup = client.GetNetworkServiceDesignGroupResource(networkServiceDesignGroupResourceId); + + // invoke the operation + NetworkServiceDesignGroupResource result = await networkServiceDesignGroup.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 + NetworkServiceDesignGroupData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Create or update the network service design group resource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_CreateOrUpdateTheNetworkServiceDesignGroupResource() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/NetworkServiceDesignGroupUpdateTags.json + // this example is just showing the usage of "NetworkServiceDesignGroups_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 NetworkServiceDesignGroupResource created on azure + // for more information of creating NetworkServiceDesignGroupResource, please refer to the document of NetworkServiceDesignGroupResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string publisherName = "TestPublisher"; + string networkServiceDesignGroupName = "TestNetworkServiceDesignGroupName"; + ResourceIdentifier networkServiceDesignGroupResourceId = NetworkServiceDesignGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, publisherName, networkServiceDesignGroupName); + NetworkServiceDesignGroupResource networkServiceDesignGroup = client.GetNetworkServiceDesignGroupResource(networkServiceDesignGroupResourceId); + + // invoke the operation + TagsObject tagsObject = new TagsObject() + { + Tags = +{ +["tag1"] = "value1", +["tag2"] = "value2", +}, + }; + NetworkServiceDesignGroupResource result = await networkServiceDesignGroup.UpdateAsync(tagsObject); + + // 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 + NetworkServiceDesignGroupData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/samples/Generated/Samples/Sample_NetworkServiceDesignVersionCollection.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/samples/Generated/Samples/Sample_NetworkServiceDesignVersionCollection.cs new file mode 100644 index 000000000000..05282cc09fe2 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/samples/Generated/Samples/Sample_NetworkServiceDesignVersionCollection.cs @@ -0,0 +1,246 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.HybridNetwork; +using Azure.ResourceManager.HybridNetwork.Models; +using Azure.ResourceManager.Resources.Models; + +namespace Azure.ResourceManager.HybridNetwork.Samples +{ + public partial class Sample_NetworkServiceDesignVersionCollection + { + // Create or update a network service design version resource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_CreateOrUpdateANetworkServiceDesignVersionResource() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/NetworkServiceDesignVersionCreate.json + // this example is just showing the usage of "NetworkServiceDesignVersions_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 NetworkServiceDesignGroupResource created on azure + // for more information of creating NetworkServiceDesignGroupResource, please refer to the document of NetworkServiceDesignGroupResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string publisherName = "TestPublisher"; + string networkServiceDesignGroupName = "TestNetworkServiceDesignGroupName"; + ResourceIdentifier networkServiceDesignGroupResourceId = NetworkServiceDesignGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, publisherName, networkServiceDesignGroupName); + NetworkServiceDesignGroupResource networkServiceDesignGroup = client.GetNetworkServiceDesignGroupResource(networkServiceDesignGroupResourceId); + + // get the collection of this NetworkServiceDesignVersionResource + NetworkServiceDesignVersionCollection collection = networkServiceDesignGroup.GetNetworkServiceDesignVersions(); + + // invoke the operation + string networkServiceDesignVersionName = "1.0.0"; + NetworkServiceDesignVersionData data = new NetworkServiceDesignVersionData(new AzureLocation("eastus")) + { + Properties = new NetworkServiceDesignVersionPropertiesFormat() + { + ConfigurationGroupSchemaReferences = +{ +["MyVM_Configuration"] = new WritableSubResource() +{ +Id = new ResourceIdentifier("/subscriptions/subid/resourcegroups/contosorg1/providers/microsoft.hybridnetwork/publishers/contosoGroup/networkServiceDesignGroups/NSD_contoso/configurationGroupSchemas/MyVM_Configuration_Schema"), +}, +}, + ResourceElementTemplates = +{ +new ArmResourceDefinitionResourceElementTemplateDetails() +{ +Configuration = new ArmResourceDefinitionResourceElementTemplate() +{ +TemplateType = TemplateType.ArmTemplate, +ParameterValues = "{\"publisherName\":\"{configurationparameters('MyVM_Configuration').publisherName}\",\"skuGroupName\":\"{configurationparameters('MyVM_Configuration').skuGroupName}\",\"skuVersion\":\"{configurationparameters('MyVM_Configuration').skuVersion}\",\"skuOfferingLocation\":\"{configurationparameters('MyVM_Configuration').skuOfferingLocation}\",\"nfviType\":\"{nfvis().nfvisFromSitePerNfviType.AzureCore.nfviAlias1.nfviType}\",\"nfviId\":\"{nfvis().nfvisFromSitePerNfviType.AzureCore.nfviAlias1.nfviId}\",\"allowSoftwareUpdates\":\"{configurationparameters('MyVM_Configuration').allowSoftwareUpdates}\",\"virtualNetworkName\":\"{configurationparameters('MyVM_Configuration').vnetName}\",\"subnetName\":\"{configurationparameters('MyVM_Configuration').subnetName}\",\"subnetAddressPrefix\":\"{configurationparameters('MyVM_Configuration').subnetAddressPrefix}\",\"managedResourceGroup\":\"{configurationparameters('SNSSelf').managedResourceGroupName}\",\"adminPassword\":\"{secretparameters('MyVM_Configuration').adminPassword}\"}", +ArtifactProfile = new NSDArtifactProfile() +{ +ArtifactStoreReferenceId = new ResourceIdentifier("/subscriptions/subid/providers/Microsoft.HybridNetwork/publishers/contosoGroup/artifactStoreReference/store1"), +ArtifactName = "MyVMArmTemplate", +ArtifactVersion = "1.0.0", +}, +}, +Name = "MyVM", +DependsOnProfile = new DependsOnProfile() +{ +InstallDependsOn = +{ +}, +}, +} +}, + }, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, networkServiceDesignVersionName, data); + NetworkServiceDesignVersionResource 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 + NetworkServiceDesignVersionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Get a network service design version resource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetANetworkServiceDesignVersionResource() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/NetworkServiceDesignVersionGet.json + // this example is just showing the usage of "NetworkServiceDesignVersions_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 NetworkServiceDesignGroupResource created on azure + // for more information of creating NetworkServiceDesignGroupResource, please refer to the document of NetworkServiceDesignGroupResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string publisherName = "TestPublisher"; + string networkServiceDesignGroupName = "TestNetworkServiceDesignGroupName"; + ResourceIdentifier networkServiceDesignGroupResourceId = NetworkServiceDesignGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, publisherName, networkServiceDesignGroupName); + NetworkServiceDesignGroupResource networkServiceDesignGroup = client.GetNetworkServiceDesignGroupResource(networkServiceDesignGroupResourceId); + + // get the collection of this NetworkServiceDesignVersionResource + NetworkServiceDesignVersionCollection collection = networkServiceDesignGroup.GetNetworkServiceDesignVersions(); + + // invoke the operation + string networkServiceDesignVersionName = "1.0.0"; + NetworkServiceDesignVersionResource result = await collection.GetAsync(networkServiceDesignVersionName); + + // 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 + NetworkServiceDesignVersionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Get a network service design version resource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_GetANetworkServiceDesignVersionResource() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/NetworkServiceDesignVersionGet.json + // this example is just showing the usage of "NetworkServiceDesignVersions_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 NetworkServiceDesignGroupResource created on azure + // for more information of creating NetworkServiceDesignGroupResource, please refer to the document of NetworkServiceDesignGroupResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string publisherName = "TestPublisher"; + string networkServiceDesignGroupName = "TestNetworkServiceDesignGroupName"; + ResourceIdentifier networkServiceDesignGroupResourceId = NetworkServiceDesignGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, publisherName, networkServiceDesignGroupName); + NetworkServiceDesignGroupResource networkServiceDesignGroup = client.GetNetworkServiceDesignGroupResource(networkServiceDesignGroupResourceId); + + // get the collection of this NetworkServiceDesignVersionResource + NetworkServiceDesignVersionCollection collection = networkServiceDesignGroup.GetNetworkServiceDesignVersions(); + + // invoke the operation + string networkServiceDesignVersionName = "1.0.0"; + bool result = await collection.ExistsAsync(networkServiceDesignVersionName); + + Console.WriteLine($"Succeeded: {result}"); + } + + // Get a network service design version resource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetANetworkServiceDesignVersionResource() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/NetworkServiceDesignVersionGet.json + // this example is just showing the usage of "NetworkServiceDesignVersions_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 NetworkServiceDesignGroupResource created on azure + // for more information of creating NetworkServiceDesignGroupResource, please refer to the document of NetworkServiceDesignGroupResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string publisherName = "TestPublisher"; + string networkServiceDesignGroupName = "TestNetworkServiceDesignGroupName"; + ResourceIdentifier networkServiceDesignGroupResourceId = NetworkServiceDesignGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, publisherName, networkServiceDesignGroupName); + NetworkServiceDesignGroupResource networkServiceDesignGroup = client.GetNetworkServiceDesignGroupResource(networkServiceDesignGroupResourceId); + + // get the collection of this NetworkServiceDesignVersionResource + NetworkServiceDesignVersionCollection collection = networkServiceDesignGroup.GetNetworkServiceDesignVersions(); + + // invoke the operation + string networkServiceDesignVersionName = "1.0.0"; + NullableResponse response = await collection.GetIfExistsAsync(networkServiceDesignVersionName); + NetworkServiceDesignVersionResource 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 + NetworkServiceDesignVersionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + // Get Publisher resource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_GetPublisherResource() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/NetworkServiceDesignVersionListByNetworkServiceDesignGroup.json + // this example is just showing the usage of "NetworkServiceDesignVersions_ListByNetworkServiceDesignGroup" 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 NetworkServiceDesignGroupResource created on azure + // for more information of creating NetworkServiceDesignGroupResource, please refer to the document of NetworkServiceDesignGroupResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string publisherName = "TestPublisher"; + string networkServiceDesignGroupName = "TestNetworkServiceDesignGroupName"; + ResourceIdentifier networkServiceDesignGroupResourceId = NetworkServiceDesignGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, publisherName, networkServiceDesignGroupName); + NetworkServiceDesignGroupResource networkServiceDesignGroup = client.GetNetworkServiceDesignGroupResource(networkServiceDesignGroupResourceId); + + // get the collection of this NetworkServiceDesignVersionResource + NetworkServiceDesignVersionCollection collection = networkServiceDesignGroup.GetNetworkServiceDesignVersions(); + + // invoke the operation and iterate over the result + await foreach (NetworkServiceDesignVersionResource 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 + NetworkServiceDesignVersionData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/samples/Generated/Samples/Sample_NetworkServiceDesignVersionResource.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/samples/Generated/Samples/Sample_NetworkServiceDesignVersionResource.cs new file mode 100644 index 000000000000..b3b9d32e8c8c --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/samples/Generated/Samples/Sample_NetworkServiceDesignVersionResource.cs @@ -0,0 +1,158 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.HybridNetwork; +using Azure.ResourceManager.HybridNetwork.Models; + +namespace Azure.ResourceManager.HybridNetwork.Samples +{ + public partial class Sample_NetworkServiceDesignVersionResource + { + // Delete a network service design version + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_DeleteANetworkServiceDesignVersion() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/NetworkServiceDesignVersionDelete.json + // this example is just showing the usage of "NetworkServiceDesignVersions_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 NetworkServiceDesignVersionResource created on azure + // for more information of creating NetworkServiceDesignVersionResource, please refer to the document of NetworkServiceDesignVersionResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string publisherName = "TestPublisher"; + string networkServiceDesignGroupName = "TestNetworkServiceDesignGroupName"; + string networkServiceDesignVersionName = "1.0.0"; + ResourceIdentifier networkServiceDesignVersionResourceId = NetworkServiceDesignVersionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, publisherName, networkServiceDesignGroupName, networkServiceDesignVersionName); + NetworkServiceDesignVersionResource networkServiceDesignVersion = client.GetNetworkServiceDesignVersionResource(networkServiceDesignVersionResourceId); + + // invoke the operation + await networkServiceDesignVersion.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine($"Succeeded"); + } + + // Get a network service design version resource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetANetworkServiceDesignVersionResource() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/NetworkServiceDesignVersionGet.json + // this example is just showing the usage of "NetworkServiceDesignVersions_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 NetworkServiceDesignVersionResource created on azure + // for more information of creating NetworkServiceDesignVersionResource, please refer to the document of NetworkServiceDesignVersionResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string publisherName = "TestPublisher"; + string networkServiceDesignGroupName = "TestNetworkServiceDesignGroupName"; + string networkServiceDesignVersionName = "1.0.0"; + ResourceIdentifier networkServiceDesignVersionResourceId = NetworkServiceDesignVersionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, publisherName, networkServiceDesignGroupName, networkServiceDesignVersionName); + NetworkServiceDesignVersionResource networkServiceDesignVersion = client.GetNetworkServiceDesignVersionResource(networkServiceDesignVersionResourceId); + + // invoke the operation + NetworkServiceDesignVersionResource result = await networkServiceDesignVersion.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 + NetworkServiceDesignVersionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Update the network service design version tags + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_UpdateTheNetworkServiceDesignVersionTags() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/NetworkServiceDesignVersionUpdateTags.json + // this example is just showing the usage of "NetworkServiceDesignVersions_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 NetworkServiceDesignVersionResource created on azure + // for more information of creating NetworkServiceDesignVersionResource, please refer to the document of NetworkServiceDesignVersionResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string publisherName = "TestPublisher"; + string networkServiceDesignGroupName = "TestNetworkServiceDesignGroupName"; + string networkServiceDesignVersionName = "1.0.0"; + ResourceIdentifier networkServiceDesignVersionResourceId = NetworkServiceDesignVersionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, publisherName, networkServiceDesignGroupName, networkServiceDesignVersionName); + NetworkServiceDesignVersionResource networkServiceDesignVersion = client.GetNetworkServiceDesignVersionResource(networkServiceDesignVersionResourceId); + + // invoke the operation + TagsObject tagsObject = new TagsObject() + { + Tags = +{ +["tag1"] = "value1", +["tag2"] = "value2", +}, + }; + NetworkServiceDesignVersionResource result = await networkServiceDesignVersion.UpdateAsync(tagsObject); + + // 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 + NetworkServiceDesignVersionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Update network service design version state + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task UpdateState_UpdateNetworkServiceDesignVersionState() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/NetworkServiceDesignVersionUpdateState.json + // this example is just showing the usage of "NetworkServiceDesignVersions_updateState" 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 NetworkServiceDesignVersionResource created on azure + // for more information of creating NetworkServiceDesignVersionResource, please refer to the document of NetworkServiceDesignVersionResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string publisherName = "TestPublisher"; + string networkServiceDesignGroupName = "TestNetworkServiceDesignGroupName"; + string networkServiceDesignVersionName = "1.0.0"; + ResourceIdentifier networkServiceDesignVersionResourceId = NetworkServiceDesignVersionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, publisherName, networkServiceDesignGroupName, networkServiceDesignVersionName); + NetworkServiceDesignVersionResource networkServiceDesignVersion = client.GetNetworkServiceDesignVersionResource(networkServiceDesignVersionResourceId); + + // invoke the operation + NetworkServiceDesignVersionUpdateState networkServiceDesignVersionUpdateState = new NetworkServiceDesignVersionUpdateState() + { + VersionState = VersionState.Active, + }; + ArmOperation lro = await networkServiceDesignVersion.UpdateStateAsync(WaitUntil.Completed, networkServiceDesignVersionUpdateState); + NetworkServiceDesignVersionUpdateState result = lro.Value; + + Console.WriteLine($"Succeeded: {result}"); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/samples/Generated/Samples/Sample_PublisherCollection.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/samples/Generated/Samples/Sample_PublisherCollection.cs new file mode 100644 index 000000000000..4721a586f245 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/samples/Generated/Samples/Sample_PublisherCollection.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; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.HybridNetwork; +using Azure.ResourceManager.HybridNetwork.Models; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.HybridNetwork.Samples +{ + public partial class Sample_PublisherCollection + { + // List all publisher resources in a resource group + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_ListAllPublisherResourcesInAResourceGroup() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/PublisherListByResourceGroup.json + // this example is just showing the usage of "Publishers_ListByResourceGroup" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + 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 = "subid"; + string resourceGroupName = "rg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this PublisherResource + PublisherCollection collection = resourceGroupResource.GetPublishers(); + + // invoke the operation and iterate over the result + await foreach (PublisherResource 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 + PublisherData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // Get a publisher resource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetAPublisherResource() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/PublisherGet.json + // this example is just showing the usage of "Publishers_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 = "subid"; + string resourceGroupName = "rg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this PublisherResource + PublisherCollection collection = resourceGroupResource.GetPublishers(); + + // invoke the operation + string publisherName = "TestPublisher"; + PublisherResource result = await collection.GetAsync(publisherName); + + // 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 + PublisherData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Get a publisher resource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_GetAPublisherResource() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/PublisherGet.json + // this example is just showing the usage of "Publishers_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 = "subid"; + string resourceGroupName = "rg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this PublisherResource + PublisherCollection collection = resourceGroupResource.GetPublishers(); + + // invoke the operation + string publisherName = "TestPublisher"; + bool result = await collection.ExistsAsync(publisherName); + + Console.WriteLine($"Succeeded: {result}"); + } + + // Get a publisher resource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAPublisherResource() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/PublisherGet.json + // this example is just showing the usage of "Publishers_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 = "subid"; + string resourceGroupName = "rg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this PublisherResource + PublisherCollection collection = resourceGroupResource.GetPublishers(); + + // invoke the operation + string publisherName = "TestPublisher"; + NullableResponse response = await collection.GetIfExistsAsync(publisherName); + PublisherResource 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 + PublisherData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + // Create or update a publisher resource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_CreateOrUpdateAPublisherResource() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/PublisherCreate.json + // this example is just showing the usage of "Publishers_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 = "subid"; + string resourceGroupName = "rg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this PublisherResource + PublisherCollection collection = resourceGroupResource.GetPublishers(); + + // invoke the operation + string publisherName = "TestPublisher"; + PublisherData data = new PublisherData(new AzureLocation("eastus")) + { + Properties = new PublisherPropertiesFormat() + { + Scope = new PublisherScope("Public"), + }, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, publisherName, data); + PublisherResource 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 + PublisherData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/samples/Generated/Samples/Sample_PublisherResource.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/samples/Generated/Samples/Sample_PublisherResource.cs new file mode 100644 index 000000000000..95f6934c6d45 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/samples/Generated/Samples/Sample_PublisherResource.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.HybridNetwork; +using Azure.ResourceManager.HybridNetwork.Models; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.HybridNetwork.Samples +{ + public partial class Sample_PublisherResource + { + // List all publisher resources in a subscription + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetPublishers_ListAllPublisherResourcesInASubscription() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/PublisherListBySubscription.json + // this example is just showing the usage of "Publishers_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 = "subid"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // invoke the operation and iterate over the result + await foreach (PublisherResource item in subscriptionResource.GetPublishersAsync()) + { + // 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 + PublisherData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // Delete a publisher resource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_DeleteAPublisherResource() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/PublisherDelete.json + // this example is just showing the usage of "Publishers_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 PublisherResource created on azure + // for more information of creating PublisherResource, please refer to the document of PublisherResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string publisherName = "TestPublisher"; + ResourceIdentifier publisherResourceId = PublisherResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, publisherName); + PublisherResource publisher = client.GetPublisherResource(publisherResourceId); + + // invoke the operation + await publisher.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine($"Succeeded"); + } + + // Get a publisher resource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetAPublisherResource() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/PublisherGet.json + // this example is just showing the usage of "Publishers_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 PublisherResource created on azure + // for more information of creating PublisherResource, please refer to the document of PublisherResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string publisherName = "TestPublisher"; + ResourceIdentifier publisherResourceId = PublisherResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, publisherName); + PublisherResource publisher = client.GetPublisherResource(publisherResourceId); + + // invoke the operation + PublisherResource result = await publisher.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 + PublisherData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Update a publisher tags + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_UpdateAPublisherTags() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/PublisherUpdateTags.json + // this example is just showing the usage of "Publishers_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 PublisherResource created on azure + // for more information of creating PublisherResource, please refer to the document of PublisherResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string publisherName = "TestPublisher"; + ResourceIdentifier publisherResourceId = PublisherResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, publisherName); + PublisherResource publisher = client.GetPublisherResource(publisherResourceId); + + // invoke the operation + TagsObject tagsObject = new TagsObject() + { + Tags = +{ +["tag1"] = "value1", +["tag2"] = "value2", +}, + }; + PublisherResource result = await publisher.UpdateAsync(tagsObject); + + // 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 + PublisherData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/samples/Generated/Samples/Sample_SiteCollection.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/samples/Generated/Samples/Sample_SiteCollection.cs new file mode 100644 index 000000000000..c57c4deac604 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/samples/Generated/Samples/Sample_SiteCollection.cs @@ -0,0 +1,221 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.HybridNetwork; +using Azure.ResourceManager.HybridNetwork.Models; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.HybridNetwork.Samples +{ + public partial class Sample_SiteCollection + { + // Get network site + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetNetworkSite() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/SiteGet.json + // this example is just showing the usage of "Sites_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 = "subid"; + string resourceGroupName = "rg1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this SiteResource + SiteCollection collection = resourceGroupResource.GetSites(); + + // invoke the operation + string siteName = "testSite"; + SiteResource result = await collection.GetAsync(siteName); + + // 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 + SiteData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Get network site + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_GetNetworkSite() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/SiteGet.json + // this example is just showing the usage of "Sites_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 = "subid"; + string resourceGroupName = "rg1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this SiteResource + SiteCollection collection = resourceGroupResource.GetSites(); + + // invoke the operation + string siteName = "testSite"; + bool result = await collection.ExistsAsync(siteName); + + Console.WriteLine($"Succeeded: {result}"); + } + + // Get network site + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetNetworkSite() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/SiteGet.json + // this example is just showing the usage of "Sites_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 = "subid"; + string resourceGroupName = "rg1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this SiteResource + SiteCollection collection = resourceGroupResource.GetSites(); + + // invoke the operation + string siteName = "testSite"; + NullableResponse response = await collection.GetIfExistsAsync(siteName); + SiteResource 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 + SiteData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + // Create network site + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_CreateNetworkSite() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/SiteCreate.json + // this example is just showing the usage of "Sites_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 = "subid"; + string resourceGroupName = "rg1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this SiteResource + SiteCollection collection = resourceGroupResource.GetSites(); + + // invoke the operation + string siteName = "testSite"; + SiteData data = new SiteData(new AzureLocation("westUs2")) + { + Properties = new SitePropertiesFormat() + { + Nfvis = +{ +new AzureCoreNfviDetails() +{ +Location = new AzureLocation("westUs2"), +Name = "nfvi1", +},new AzureArcK8SClusterNfviDetails() +{ +CustomLocationReferenceId = new ResourceIdentifier("/subscriptions/subid/resourceGroups/testResourceGroup/providers/Microsoft.ExtendedLocation/customLocations/testCustomLocation1"), +Name = "nfvi2", +},new AzureOperatorNexusClusterNfviDetails() +{ +CustomLocationReferenceId = new ResourceIdentifier("/subscriptions/subid/resourceGroups/testResourceGroup/providers/Microsoft.ExtendedLocation/customLocations/testCustomLocation2"), +Name = "nfvi3", +} +}, + }, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, siteName, data); + SiteResource 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 + SiteData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // List all network sites + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_ListAllNetworkSites() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/SiteListByResourceGroup.json + // this example is just showing the usage of "Sites_ListByResourceGroup" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + 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 = "subid"; + string resourceGroupName = "rg1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this SiteResource + SiteCollection collection = resourceGroupResource.GetSites(); + + // invoke the operation and iterate over the result + await foreach (SiteResource 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 + SiteData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/samples/Generated/Samples/Sample_SiteNetworkServiceCollection.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/samples/Generated/Samples/Sample_SiteNetworkServiceCollection.cs new file mode 100644 index 000000000000..5b56a137f9c8 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/samples/Generated/Samples/Sample_SiteNetworkServiceCollection.cs @@ -0,0 +1,273 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.HybridNetwork; +using Azure.ResourceManager.HybridNetwork.Models; +using Azure.ResourceManager.Resources; +using Azure.ResourceManager.Resources.Models; + +namespace Azure.ResourceManager.HybridNetwork.Samples +{ + public partial class Sample_SiteNetworkServiceCollection + { + // Get network site + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetNetworkSite() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/SiteNetworkServiceGet.json + // this example is just showing the usage of "SiteNetworkServices_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 = "subid"; + string resourceGroupName = "rg1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this SiteNetworkServiceResource + SiteNetworkServiceCollection collection = resourceGroupResource.GetSiteNetworkServices(); + + // invoke the operation + string siteNetworkServiceName = "testSiteNetworkServiceName"; + SiteNetworkServiceResource result = await collection.GetAsync(siteNetworkServiceName); + + // 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 + SiteNetworkServiceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Get network site + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_GetNetworkSite() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/SiteNetworkServiceGet.json + // this example is just showing the usage of "SiteNetworkServices_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 = "subid"; + string resourceGroupName = "rg1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this SiteNetworkServiceResource + SiteNetworkServiceCollection collection = resourceGroupResource.GetSiteNetworkServices(); + + // invoke the operation + string siteNetworkServiceName = "testSiteNetworkServiceName"; + bool result = await collection.ExistsAsync(siteNetworkServiceName); + + Console.WriteLine($"Succeeded: {result}"); + } + + // Get network site + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetNetworkSite() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/SiteNetworkServiceGet.json + // this example is just showing the usage of "SiteNetworkServices_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 = "subid"; + string resourceGroupName = "rg1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this SiteNetworkServiceResource + SiteNetworkServiceCollection collection = resourceGroupResource.GetSiteNetworkServices(); + + // invoke the operation + string siteNetworkServiceName = "testSiteNetworkServiceName"; + NullableResponse response = await collection.GetIfExistsAsync(siteNetworkServiceName); + SiteNetworkServiceResource 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 + SiteNetworkServiceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + // Create first party site network service + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_CreateFirstPartySiteNetworkService() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/SiteNetworkServiceFirstPartyCreate.json + // this example is just showing the usage of "SiteNetworkServices_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 = "subid"; + string resourceGroupName = "rg1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this SiteNetworkServiceResource + SiteNetworkServiceCollection collection = resourceGroupResource.GetSiteNetworkServices(); + + // invoke the operation + string siteNetworkServiceName = "testSiteNetworkServiceName"; + SiteNetworkServiceData data = new SiteNetworkServiceData(new AzureLocation("westUs2")) + { + Properties = new SiteNetworkServicePropertiesFormat() + { + SiteReferenceId = new ResourceIdentifier("/subscriptions/subid/resourcegroups/contosorg1/providers/microsoft.hybridnetwork/sites/testSite"), + NetworkServiceDesignVersionResourceReference = new SecretDeploymentResourceReference() + { + Id = new ResourceIdentifier("/subscriptions/subid/resourcegroups/rg/providers/Microsoft.HybridNetwork/publishers/TestPublisher/networkServiceDesignGroups/TestNetworkServiceDesignGroupName/networkServiceDesignVersions/1.0.0"), + }, + DesiredStateConfigurationGroupValueReferences = +{ +["MyVM_Configuration"] = new WritableSubResource() +{ +Id = new ResourceIdentifier("/subscriptions/subid/resourcegroups/contosorg1/providers/microsoft.hybridnetwork/configurationgroupvalues/MyVM_Configuration1"), +}, +}, + }, + Sku = new HybridNetworkSku(HybridNetworkSkuName.Standard), + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, siteNetworkServiceName, data); + SiteNetworkServiceResource 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 + SiteNetworkServiceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Create site network service + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_CreateSiteNetworkService() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/SiteNetworkServiceCreate.json + // this example is just showing the usage of "SiteNetworkServices_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 = "subid"; + string resourceGroupName = "rg1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this SiteNetworkServiceResource + SiteNetworkServiceCollection collection = resourceGroupResource.GetSiteNetworkServices(); + + // invoke the operation + string siteNetworkServiceName = "testSiteNetworkServiceName"; + SiteNetworkServiceData data = new SiteNetworkServiceData(new AzureLocation("westUs2")) + { + Properties = new SiteNetworkServicePropertiesFormat() + { + SiteReferenceId = new ResourceIdentifier("/subscriptions/subid/resourcegroups/contosorg1/providers/microsoft.hybridnetwork/sites/testSite"), + NetworkServiceDesignVersionResourceReference = new OpenDeploymentResourceReference() + { + Id = new ResourceIdentifier("/subscriptions/subid/resourcegroups/rg/providers/Microsoft.HybridNetwork/publishers/TestPublisher/networkServiceDesignGroups/TestNetworkServiceDesignGroupName/networkServiceDesignVersions/1.0.0"), + }, + DesiredStateConfigurationGroupValueReferences = +{ +["MyVM_Configuration"] = new WritableSubResource() +{ +Id = new ResourceIdentifier("/subscriptions/subid/resourcegroups/contosorg1/providers/microsoft.hybridnetwork/configurationgroupvalues/MyVM_Configuration1"), +}, +}, + }, + Sku = new HybridNetworkSku(HybridNetworkSkuName.Standard), + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, siteNetworkServiceName, data); + SiteNetworkServiceResource 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 + SiteNetworkServiceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // List all network sites + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_ListAllNetworkSites() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/SiteNetworkServiceListByResourceGroup.json + // this example is just showing the usage of "SiteNetworkServices_ListByResourceGroup" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + 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 = "subid"; + string resourceGroupName = "rg1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this SiteNetworkServiceResource + SiteNetworkServiceCollection collection = resourceGroupResource.GetSiteNetworkServices(); + + // invoke the operation and iterate over the result + await foreach (SiteNetworkServiceResource 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 + SiteNetworkServiceData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/samples/Generated/Samples/Sample_SiteNetworkServiceResource.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/samples/Generated/Samples/Sample_SiteNetworkServiceResource.cs new file mode 100644 index 000000000000..30aff3047669 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/samples/Generated/Samples/Sample_SiteNetworkServiceResource.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.HybridNetwork; +using Azure.ResourceManager.HybridNetwork.Models; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.HybridNetwork.Samples +{ + public partial class Sample_SiteNetworkServiceResource + { + // Delete network site + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_DeleteNetworkSite() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/SiteNetworkServiceDelete.json + // this example is just showing the usage of "SiteNetworkServices_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 SiteNetworkServiceResource created on azure + // for more information of creating SiteNetworkServiceResource, please refer to the document of SiteNetworkServiceResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string siteNetworkServiceName = "testSiteNetworkServiceName"; + ResourceIdentifier siteNetworkServiceResourceId = SiteNetworkServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, siteNetworkServiceName); + SiteNetworkServiceResource siteNetworkService = client.GetSiteNetworkServiceResource(siteNetworkServiceResourceId); + + // invoke the operation + await siteNetworkService.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine($"Succeeded"); + } + + // Get network site + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetNetworkSite() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/SiteNetworkServiceGet.json + // this example is just showing the usage of "SiteNetworkServices_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 SiteNetworkServiceResource created on azure + // for more information of creating SiteNetworkServiceResource, please refer to the document of SiteNetworkServiceResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string siteNetworkServiceName = "testSiteNetworkServiceName"; + ResourceIdentifier siteNetworkServiceResourceId = SiteNetworkServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, siteNetworkServiceName); + SiteNetworkServiceResource siteNetworkService = client.GetSiteNetworkServiceResource(siteNetworkServiceResourceId); + + // invoke the operation + SiteNetworkServiceResource result = await siteNetworkService.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 + SiteNetworkServiceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Update network site tags + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_UpdateNetworkSiteTags() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/SiteNetworkServiceUpdateTags.json + // this example is just showing the usage of "SiteNetworkServices_UpdateTags" 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 SiteNetworkServiceResource created on azure + // for more information of creating SiteNetworkServiceResource, please refer to the document of SiteNetworkServiceResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string siteNetworkServiceName = "testSiteNetworkServiceName"; + ResourceIdentifier siteNetworkServiceResourceId = SiteNetworkServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, siteNetworkServiceName); + SiteNetworkServiceResource siteNetworkService = client.GetSiteNetworkServiceResource(siteNetworkServiceResourceId); + + // invoke the operation + TagsObject tagsObject = new TagsObject() + { + Tags = +{ +["tag1"] = "value1", +["tag2"] = "value2", +}, + }; + SiteNetworkServiceResource result = await siteNetworkService.UpdateAsync(tagsObject); + + // 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 + SiteNetworkServiceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // List all hybrid network sites in a subscription. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetSiteNetworkServices_ListAllHybridNetworkSitesInASubscription() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/SiteNetworkServiceListBySubscription.json + // this example is just showing the usage of "SiteNetworkServices_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 = "subid"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // invoke the operation and iterate over the result + await foreach (SiteNetworkServiceResource item in subscriptionResource.GetSiteNetworkServicesAsync()) + { + // 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 + SiteNetworkServiceData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/samples/Generated/Samples/Sample_SiteResource.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/samples/Generated/Samples/Sample_SiteResource.cs new file mode 100644 index 000000000000..fcb3dad0bf71 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/samples/Generated/Samples/Sample_SiteResource.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.HybridNetwork; +using Azure.ResourceManager.HybridNetwork.Models; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.HybridNetwork.Samples +{ + public partial class Sample_SiteResource + { + // Delete network site + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_DeleteNetworkSite() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/SiteDelete.json + // this example is just showing the usage of "Sites_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 SiteResource created on azure + // for more information of creating SiteResource, please refer to the document of SiteResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string siteName = "testSite"; + ResourceIdentifier siteResourceId = SiteResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, siteName); + SiteResource site = client.GetSiteResource(siteResourceId); + + // invoke the operation + await site.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine($"Succeeded"); + } + + // Get network site + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetNetworkSite() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/SiteGet.json + // this example is just showing the usage of "Sites_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 SiteResource created on azure + // for more information of creating SiteResource, please refer to the document of SiteResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string siteName = "testSite"; + ResourceIdentifier siteResourceId = SiteResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, siteName); + SiteResource site = client.GetSiteResource(siteResourceId); + + // invoke the operation + SiteResource result = await site.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 + SiteData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Update network site tags + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_UpdateNetworkSiteTags() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/SiteUpdateTags.json + // this example is just showing the usage of "Sites_UpdateTags" 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 SiteResource created on azure + // for more information of creating SiteResource, please refer to the document of SiteResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string siteName = "testSite"; + ResourceIdentifier siteResourceId = SiteResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, siteName); + SiteResource site = client.GetSiteResource(siteResourceId); + + // invoke the operation + TagsObject tagsObject = new TagsObject() + { + Tags = +{ +["tag1"] = "value1", +["tag2"] = "value2", +}, + }; + SiteResource result = await site.UpdateAsync(tagsObject); + + // 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 + SiteData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // List all hybrid network sites in a subscription. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetSites_ListAllHybridNetworkSitesInASubscription() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/SiteListBySubscription.json + // this example is just showing the usage of "Sites_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 = "subid"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // invoke the operation and iterate over the result + await foreach (SiteResource item in subscriptionResource.GetSitesAsync()) + { + // 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 + SiteData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Azure.ResourceManager.HybridNetwork.csproj b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Azure.ResourceManager.HybridNetwork.csproj new file mode 100644 index 000000000000..f3383fe9225a --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Azure.ResourceManager.HybridNetwork.csproj @@ -0,0 +1,8 @@ + + + 1.0.0-beta.1 + Azure.ResourceManager.HybridNetwork + Azure Resource Manager client SDK for Azure resource provider HybridNetwork. + azure;management;arm;resource manager;hybridnetwork + + diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/ArmHybridNetworkModelFactory.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/ArmHybridNetworkModelFactory.cs new file mode 100644 index 000000000000..f662c2d9caa3 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/ArmHybridNetworkModelFactory.cs @@ -0,0 +1,738 @@ +// 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; +using Azure.Core; +using Azure.ResourceManager.HybridNetwork; +using Azure.ResourceManager.Models; +using Azure.ResourceManager.Resources.Models; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// Model factory for models. + public static partial class ArmHybridNetworkModelFactory + { + /// Initializes a new instance of ConfigurationGroupSchemaData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The tags. + /// The location. + /// Configuration group schema properties. + /// A new instance for mocking. + public static ConfigurationGroupSchemaData ConfigurationGroupSchemaData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, ConfigurationGroupSchemaPropertiesFormat properties = null) + { + tags ??= new Dictionary(); + + return new ConfigurationGroupSchemaData(id, name, resourceType, systemData, tags, location, properties); + } + + /// Initializes a new instance of ConfigurationGroupSchemaPropertiesFormat. + /// The provisioning state of the Configuration group schema resource. + /// The configuration group schema version state. + /// Description of what schema can contain. + /// Name and value pairs that define the configuration value. It can be a well formed escaped JSON string. + /// A new instance for mocking. + public static ConfigurationGroupSchemaPropertiesFormat ConfigurationGroupSchemaPropertiesFormat(ProvisioningState? provisioningState = null, VersionState? versionState = null, string description = null, string schemaDefinition = null) + { + return new ConfigurationGroupSchemaPropertiesFormat(provisioningState, versionState, description, schemaDefinition); + } + + /// Initializes a new instance of ConfigurationGroupValueData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The tags. + /// The location. + /// + /// Hybrid configuration group value properties. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include and . + /// + /// A new instance for mocking. + public static ConfigurationGroupValueData ConfigurationGroupValueData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, ConfigurationGroupValuePropertiesFormat properties = null) + { + tags ??= new Dictionary(); + + return new ConfigurationGroupValueData(id, name, resourceType, systemData, tags, location, properties); + } + + /// Initializes a new instance of ConfigurationGroupValuePropertiesFormat. + /// The provisioning state of the site resource. + /// The publisher name for the configuration group schema. + /// The scope of the publisher. + /// The configuration group schema name. + /// The location of the configuration group schema offering. + /// + /// The configuration group schema resource reference. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include and . + /// + /// The value which indicates if configuration values are secrets. + /// A new instance for mocking. + public static ConfigurationGroupValuePropertiesFormat ConfigurationGroupValuePropertiesFormat(ProvisioningState? provisioningState = null, string publisherName = null, PublisherScope? publisherScope = null, string configurationGroupSchemaName = null, string configurationGroupSchemaOfferingLocation = null, DeploymentResourceIdReference configurationGroupSchemaResourceReference = null, string configurationType = "Unknown") + { + return new UnknownConfigurationGroupValuePropertiesFormat(provisioningState, publisherName, publisherScope, configurationGroupSchemaName, configurationGroupSchemaOfferingLocation, configurationGroupSchemaResourceReference, configurationType); + } + + /// Initializes a new instance of NetworkFunctionData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The tags. + /// The location. + /// + /// Network function properties. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include and . + /// + /// A unique read-only string that changes whenever the resource is updated. + /// The managed identity of the network function. + /// A new instance for mocking. + public static NetworkFunctionData NetworkFunctionData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, NetworkFunctionPropertiesFormat properties = null, ETag? etag = null, ManagedServiceIdentity identity = null) + { + tags ??= new Dictionary(); + + return new NetworkFunctionData(id, name, resourceType, systemData, tags, location, properties, etag, identity); + } + + /// Initializes a new instance of NetworkFunctionPropertiesFormat. + /// The provisioning state of the network function resource. + /// The publisher name for the network function. + /// The scope of the publisher. + /// The network function definition group name for the network function. + /// The network function definition version for the network function. + /// The location of the network function definition offering. + /// + /// The network function definition version resource reference. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include and . + /// + /// The nfvi type for the network function. + /// The nfviId for the network function. + /// Indicates if software updates are allowed during deployment. + /// The value which indicates if NF values are secrets. + /// The role configuration override values from the user. + /// A new instance for mocking. + public static NetworkFunctionPropertiesFormat NetworkFunctionPropertiesFormat(ProvisioningState? provisioningState = null, string publisherName = null, PublisherScope? publisherScope = null, string networkFunctionDefinitionGroupName = null, string networkFunctionDefinitionVersion = null, string networkFunctionDefinitionOfferingLocation = null, DeploymentResourceIdReference networkFunctionDefinitionVersionResourceReference = null, NfviType? nfviType = null, ResourceIdentifier nfviId = null, bool? allowSoftwareUpdate = null, string configurationType = "Unknown", IEnumerable roleOverrideValues = null) + { + roleOverrideValues ??= new List(); + + return new UnknownNetworkFunctionPropertiesFormat(provisioningState, publisherName, publisherScope, networkFunctionDefinitionGroupName, networkFunctionDefinitionVersion, networkFunctionDefinitionOfferingLocation, networkFunctionDefinitionVersionResourceReference, nfviType, nfviId, allowSoftwareUpdate, configurationType, roleOverrideValues?.ToList()); + } + + /// Initializes a new instance of ComponentData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The component properties. + /// A new instance for mocking. + public static ComponentData ComponentData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, ComponentProperties properties = null) + { + return new ComponentData(id, name, resourceType, systemData, properties); + } + + /// Initializes a new instance of ComponentProperties. + /// The provisioning state of the component resource. + /// The JSON-serialized deployment profile of the component resource. + /// The deployment status of the component resource. + /// A new instance for mocking. + public static ComponentProperties ComponentProperties(ProvisioningState? provisioningState = null, string deploymentProfile = null, DeploymentStatusProperties deploymentStatus = null) + { + return new ComponentProperties(provisioningState, deploymentProfile, deploymentStatus); + } + + /// Initializes a new instance of DeploymentStatusProperties. + /// The status of the component resource. + /// The resource related to the component resource. + /// The next expected update of deployment status. + /// A new instance for mocking. + public static DeploymentStatusProperties DeploymentStatusProperties(ComponentStatus? status = null, ComponentKubernetesResources resources = null, DateTimeOffset? nextExpectedUpdateOn = null) + { + return new DeploymentStatusProperties(status, resources, nextExpectedUpdateOn); + } + + /// Initializes a new instance of ComponentKubernetesResources. + /// Deployments that are related to component resource. + /// Pods related to component resource. + /// Replica sets related to component resource. + /// Stateful sets related to component resource. + /// Daemonsets related to component resource. + /// A new instance for mocking. + public static ComponentKubernetesResources ComponentKubernetesResources(IEnumerable deployments = null, IEnumerable pods = null, IEnumerable replicaSets = null, IEnumerable statefulSets = null, IEnumerable daemonSets = null) + { + deployments ??= new List(); + pods ??= new List(); + replicaSets ??= new List(); + statefulSets ??= new List(); + daemonSets ??= new List(); + + return new ComponentKubernetesResources(deployments?.ToList(), pods?.ToList(), replicaSets?.ToList(), statefulSets?.ToList(), daemonSets?.ToList()); + } + + /// Initializes a new instance of KubernetesDeployment. + /// The name of the deployment. + /// The namespace of the deployment. + /// Desired number of pods. + /// Number of ready pods. + /// Number of upto date pods. + /// Number of available pods. + /// Creation Time of deployment. + /// A new instance for mocking. + public static KubernetesDeployment KubernetesDeployment(string name = null, string @namespace = null, int? desiredNumberOfPods = null, int? readyNumberOfPods = null, int? upToDateNumberOfPods = null, int? availableNumberOfPods = null, DateTimeOffset? createdOn = null) + { + return new KubernetesDeployment(name, @namespace, desiredNumberOfPods, readyNumberOfPods, upToDateNumberOfPods, availableNumberOfPods, createdOn); + } + + /// Initializes a new instance of KubernetesPod. + /// The name of the Pod. + /// The namespace of the Pod. + /// Desired number of containers. + /// Number of ready containers. + /// The status of a pod. + /// Creation Time of Pod. + /// Last 5 Pod events. + /// A new instance for mocking. + public static KubernetesPod KubernetesPod(string name = null, string @namespace = null, int? desiredNumberOfContainers = null, int? readyNumberOfContainers = null, PodStatus? status = null, DateTimeOffset? createdOn = null, IEnumerable events = null) + { + events ??= new List(); + + return new KubernetesPod(name, @namespace, desiredNumberOfContainers, readyNumberOfContainers, status, createdOn, events?.ToList()); + } + + /// Initializes a new instance of PodEvent. + /// The type of pod event. + /// Event reason. + /// Event message. + /// Event Last seen. + /// A new instance for mocking. + public static PodEvent PodEvent(PodEventType? eventType = null, string reason = null, string message = null, DateTimeOffset? lastSeenOn = null) + { + return new PodEvent(eventType, reason, message, lastSeenOn); + } + + /// Initializes a new instance of KubernetesReplicaSet. + /// The name of the replicaSet. + /// The namespace of the replicaSet. + /// Desired number of pods. + /// Number of ready pods. + /// Number of current pods. + /// Creation Time of replicaSet. + /// A new instance for mocking. + public static KubernetesReplicaSet KubernetesReplicaSet(string name = null, string @namespace = null, int? desiredNumberOfPods = null, int? readyNumberOfPods = null, int? currentNumberOfPods = null, DateTimeOffset? createdOn = null) + { + return new KubernetesReplicaSet(name, @namespace, desiredNumberOfPods, readyNumberOfPods, currentNumberOfPods, createdOn); + } + + /// Initializes a new instance of KubernetesStatefulSet. + /// The name of the statefulset. + /// The namespace of the statefulset. + /// Desired number of pods. + /// Number of ready pods. + /// Creation Time of statefulset. + /// A new instance for mocking. + public static KubernetesStatefulSet KubernetesStatefulSet(string name = null, string @namespace = null, int? desiredNumberOfPods = null, int? readyNumberOfPods = null, DateTimeOffset? createdOn = null) + { + return new KubernetesStatefulSet(name, @namespace, desiredNumberOfPods, readyNumberOfPods, createdOn); + } + + /// Initializes a new instance of KubernetesDaemonSet. + /// The name of the daemonSet. + /// The namespace of the daemonSet. + /// Desired number of pods. + /// Current number of pods. + /// Number of Ready pods. + /// Number of upto date pods. + /// Number of available pods. + /// Creation Time of daemonSet. + /// A new instance for mocking. + public static KubernetesDaemonSet KubernetesDaemonSet(string name = null, string @namespace = null, int? desiredNumberOfPods = null, int? currentNumberOfPods = null, int? readyNumberOfPods = null, int? upToDateNumberOfPods = null, int? availableNumberOfPods = null, DateTimeOffset? createdOn = null) + { + return new KubernetesDaemonSet(name, @namespace, desiredNumberOfPods, currentNumberOfPods, readyNumberOfPods, upToDateNumberOfPods, availableNumberOfPods, createdOn); + } + + /// Initializes a new instance of NetworkFunctionDefinitionGroupData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The tags. + /// The location. + /// Network function definition group properties. + /// A new instance for mocking. + public static NetworkFunctionDefinitionGroupData NetworkFunctionDefinitionGroupData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, NetworkFunctionDefinitionGroupPropertiesFormat properties = null) + { + tags ??= new Dictionary(); + + return new NetworkFunctionDefinitionGroupData(id, name, resourceType, systemData, tags, location, properties); + } + + /// Initializes a new instance of NetworkFunctionDefinitionGroupPropertiesFormat. + /// The provisioning state of the network function definition groups resource. + /// The network function definition group description. + /// A new instance for mocking. + public static NetworkFunctionDefinitionGroupPropertiesFormat NetworkFunctionDefinitionGroupPropertiesFormat(ProvisioningState? provisioningState = null, string description = null) + { + return new NetworkFunctionDefinitionGroupPropertiesFormat(provisioningState, description); + } + + /// Initializes a new instance of NetworkFunctionDefinitionVersionData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The tags. + /// The location. + /// + /// Network function definition version properties. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include and . + /// + /// A new instance for mocking. + public static NetworkFunctionDefinitionVersionData NetworkFunctionDefinitionVersionData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, NetworkFunctionDefinitionVersionPropertiesFormat properties = null) + { + tags ??= new Dictionary(); + + return new NetworkFunctionDefinitionVersionData(id, name, resourceType, systemData, tags, location, properties); + } + + /// Initializes a new instance of NetworkFunctionDefinitionVersionPropertiesFormat. + /// The provisioning state of the network function definition version resource. + /// The network function definition version state. + /// The network function definition version description. + /// The deployment parameters of the network function definition version. + /// The network function type. + /// A new instance for mocking. + public static NetworkFunctionDefinitionVersionPropertiesFormat NetworkFunctionDefinitionVersionPropertiesFormat(ProvisioningState? provisioningState = null, VersionState? versionState = null, string description = null, string deployParameters = null, string networkFunctionType = "Unknown") + { + return new UnknownNetworkFunctionDefinitionVersionPropertiesFormat(provisioningState, versionState, description, deployParameters, networkFunctionType); + } + + /// Initializes a new instance of NetworkServiceDesignGroupData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The tags. + /// The location. + /// network service design group properties. + /// A new instance for mocking. + public static NetworkServiceDesignGroupData NetworkServiceDesignGroupData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, NetworkServiceDesignGroupPropertiesFormat properties = null) + { + tags ??= new Dictionary(); + + return new NetworkServiceDesignGroupData(id, name, resourceType, systemData, tags, location, properties); + } + + /// Initializes a new instance of NetworkServiceDesignGroupPropertiesFormat. + /// The provisioning state of the network service design groups resource. + /// The network service design group description. + /// A new instance for mocking. + public static NetworkServiceDesignGroupPropertiesFormat NetworkServiceDesignGroupPropertiesFormat(ProvisioningState? provisioningState = null, string description = null) + { + return new NetworkServiceDesignGroupPropertiesFormat(provisioningState, description); + } + + /// Initializes a new instance of NetworkServiceDesignVersionData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The tags. + /// The location. + /// network service design version properties. + /// A new instance for mocking. + public static NetworkServiceDesignVersionData NetworkServiceDesignVersionData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, NetworkServiceDesignVersionPropertiesFormat properties = null) + { + tags ??= new Dictionary(); + + return new NetworkServiceDesignVersionData(id, name, resourceType, systemData, tags, location, properties); + } + + /// Initializes a new instance of NetworkServiceDesignVersionPropertiesFormat. + /// The provisioning state of the network service design version resource. + /// The network service design version state. + /// The network service design version description. + /// The configuration schemas to used to define the values. + /// The nfvis from the site. + /// + /// List of resource element template + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include and . + /// + /// A new instance for mocking. + public static NetworkServiceDesignVersionPropertiesFormat NetworkServiceDesignVersionPropertiesFormat(ProvisioningState? provisioningState = null, VersionState? versionState = null, string description = null, IDictionary configurationGroupSchemaReferences = null, IDictionary nfvisFromSite = null, IEnumerable resourceElementTemplates = null) + { + configurationGroupSchemaReferences ??= new Dictionary(); + nfvisFromSite ??= new Dictionary(); + resourceElementTemplates ??= new List(); + + return new NetworkServiceDesignVersionPropertiesFormat(provisioningState, versionState, description, configurationGroupSchemaReferences, nfvisFromSite, resourceElementTemplates?.ToList()); + } + + /// Initializes a new instance of PublisherData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The tags. + /// The location. + /// Publisher properties. + /// The managed identity of the publisher, if configured. + /// A new instance for mocking. + public static PublisherData PublisherData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, PublisherPropertiesFormat properties = null, ManagedServiceIdentity identity = null) + { + tags ??= new Dictionary(); + + return new PublisherData(id, name, resourceType, systemData, tags, location, properties, identity); + } + + /// Initializes a new instance of PublisherPropertiesFormat. + /// The provisioning state of the publisher resource. + /// The publisher scope. + /// A new instance for mocking. + public static PublisherPropertiesFormat PublisherPropertiesFormat(ProvisioningState? provisioningState = null, PublisherScope? scope = null) + { + return new PublisherPropertiesFormat(provisioningState, scope); + } + + /// Initializes a new instance of ArtifactStoreData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The tags. + /// The location. + /// ArtifactStores properties. + /// A new instance for mocking. + public static ArtifactStoreData ArtifactStoreData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, ArtifactStorePropertiesFormat properties = null) + { + tags ??= new Dictionary(); + + return new ArtifactStoreData(id, name, resourceType, systemData, tags, location, properties); + } + + /// Initializes a new instance of ArtifactStorePropertiesFormat. + /// The provisioning state of the application groups resource. + /// The artifact store type. + /// The replication strategy. + /// + /// The created storage resource id. + /// A new instance for mocking. + public static ArtifactStorePropertiesFormat ArtifactStorePropertiesFormat(ProvisioningState? provisioningState = null, ArtifactStoreType? storeType = null, ArtifactReplicationStrategy? replicationStrategy = null, ArtifactStorePropertiesFormatManagedResourceGroupConfiguration managedResourceGroupConfiguration = null, ResourceIdentifier storageResourceId = null) + { + return new ArtifactStorePropertiesFormat(provisioningState, storeType, replicationStrategy, managedResourceGroupConfiguration, storageResourceId); + } + + /// Initializes a new instance of ArtifactManifestData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The tags. + /// The location. + /// Artifact manifest properties. + /// A new instance for mocking. + public static ArtifactManifestData ArtifactManifestData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, ArtifactManifestPropertiesFormat properties = null) + { + tags ??= new Dictionary(); + + return new ArtifactManifestData(id, name, resourceType, systemData, tags, location, properties); + } + + /// Initializes a new instance of ArtifactManifestPropertiesFormat. + /// The provisioning state of the ArtifactManifest resource. + /// The artifact manifest state. + /// The artifacts list. + /// A new instance for mocking. + public static ArtifactManifestPropertiesFormat ArtifactManifestPropertiesFormat(ProvisioningState? provisioningState = null, ArtifactManifestState? artifactManifestState = null, IEnumerable artifacts = null) + { + artifacts ??= new List(); + + return new ArtifactManifestPropertiesFormat(provisioningState, artifactManifestState, artifacts?.ToList()); + } + + /// Initializes a new instance of ProxyArtifactListOverview. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// A new instance for mocking. + public static ProxyArtifactListOverview ProxyArtifactListOverview(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null) + { + return new ProxyArtifactListOverview(id, name, resourceType, systemData); + } + + /// Initializes a new instance of ProxyArtifactVersionsListOverview. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Proxy Artifact overview properties. + /// A new instance for mocking. + public static ProxyArtifactVersionsListOverview ProxyArtifactVersionsListOverview(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, ProxyArtifactOverviewPropertiesValue properties = null) + { + return new ProxyArtifactVersionsListOverview(id, name, resourceType, systemData, properties); + } + + /// Initializes a new instance of ProxyArtifactOverviewPropertiesValue. + /// The artifact type. + /// The artifact version. + /// The artifact state. + /// A new instance for mocking. + public static ProxyArtifactOverviewPropertiesValue ProxyArtifactOverviewPropertiesValue(ArtifactType? artifactType = null, string artifactVersion = null, ArtifactState? artifactState = null) + { + return new ProxyArtifactOverviewPropertiesValue(artifactType, artifactVersion, artifactState); + } + + /// Initializes a new instance of SiteData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The tags. + /// The location. + /// Site properties. + /// A new instance for mocking. + public static SiteData SiteData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, SitePropertiesFormat properties = null) + { + tags ??= new Dictionary(); + + return new SiteData(id, name, resourceType, systemData, tags, location, properties); + } + + /// Initializes a new instance of SitePropertiesFormat. + /// The provisioning state of the site resource. **TODO**: Confirm if this is needed. + /// + /// List of NFVIs + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , and . + /// + /// The list of site network services on the site. + /// A new instance for mocking. + public static SitePropertiesFormat SitePropertiesFormat(ProvisioningState? provisioningState = null, IEnumerable nfvis = null, IEnumerable siteNetworkServiceReferences = null) + { + nfvis ??= new List(); + siteNetworkServiceReferences ??= new List(); + + return new SitePropertiesFormat(provisioningState, nfvis?.ToList(), siteNetworkServiceReferences?.ToList()); + } + + /// Initializes a new instance of SiteNetworkServiceData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The tags. + /// The location. + /// Site network service properties. + /// The managed identity of the Site network service, if configured. + /// Sku of the site network service. + /// A new instance for mocking. + public static SiteNetworkServiceData SiteNetworkServiceData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, SiteNetworkServicePropertiesFormat properties = null, ManagedServiceIdentity identity = null, HybridNetworkSku sku = null) + { + tags ??= new Dictionary(); + + return new SiteNetworkServiceData(id, name, resourceType, systemData, tags, location, properties, identity, sku); + } + + /// Initializes a new instance of SiteNetworkServicePropertiesFormat. + /// The provisioning state of the site network service resource. + /// Managed resource group configuration. + /// The site details. + /// The publisher name for the site network service. + /// The scope of the publisher. + /// The network service design group name for the site network service. + /// The network service design version for the site network service. + /// The location of the network service design offering. + /// + /// The network service design version resource reference. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include and . + /// + /// The goal state of the site network service resource. This has references to the configuration group value objects that describe the desired state of the site network service. + /// The network service design version for the site network service. + /// The last state of the site network service resource. + /// A new instance for mocking. + public static SiteNetworkServicePropertiesFormat SiteNetworkServicePropertiesFormat(ProvisioningState? provisioningState = null, ManagedResourceGroupConfiguration managedResourceGroupConfiguration = null, ResourceIdentifier siteReferenceId = null, string publisherName = null, PublisherScope? publisherScope = null, string networkServiceDesignGroupName = null, string networkServiceDesignVersionName = null, string networkServiceDesignVersionOfferingLocation = null, DeploymentResourceIdReference networkServiceDesignVersionResourceReference = null, IDictionary desiredStateConfigurationGroupValueReferences = null, string lastStateNetworkServiceDesignVersionName = null, IReadOnlyDictionary lastStateConfigurationGroupValueReferences = null) + { + desiredStateConfigurationGroupValueReferences ??= new Dictionary(); + lastStateConfigurationGroupValueReferences ??= new Dictionary(); + + return new SiteNetworkServicePropertiesFormat(provisioningState, managedResourceGroupConfiguration, siteReferenceId != null ? ResourceManagerModelFactory.WritableSubResource(siteReferenceId) : null, publisherName, publisherScope, networkServiceDesignGroupName, networkServiceDesignVersionName, networkServiceDesignVersionOfferingLocation, networkServiceDesignVersionResourceReference, desiredStateConfigurationGroupValueReferences, lastStateNetworkServiceDesignVersionName, lastStateConfigurationGroupValueReferences); + } + + /// Initializes a new instance of HybridNetworkSku. + /// Name of this Sku. + /// The SKU tier based on the SKU name. + /// A new instance for mocking. + public static HybridNetworkSku HybridNetworkSku(HybridNetworkSkuName name = default, HybridNetworkSkuTier? tier = null) + { + return new HybridNetworkSku(name, tier); + } + + /// Initializes a new instance of AzureContainerRegistryScopedTokenCredential. + /// The username of the credential. + /// The credential value. + /// The Acr server url. + /// The repositories that could be accessed using the current credential. + /// The UTC time when credential will expire. + /// A new instance for mocking. + public static AzureContainerRegistryScopedTokenCredential AzureContainerRegistryScopedTokenCredential(string username = null, string acrToken = null, Uri acrServerUri = null, IEnumerable repositories = null, DateTimeOffset? expiry = null) + { + repositories ??= new List(); + + return new AzureContainerRegistryScopedTokenCredential(CredentialType.AzureContainerRegistryScopedToken, username, acrToken, acrServerUri, repositories?.ToList(), expiry); + } + + /// Initializes a new instance of AzureStorageAccountCredential. + /// The storage account Id. + /// The containers that could be accessed using the current credential. + /// The UTC time when credential will expire. + /// A new instance for mocking. + public static AzureStorageAccountCredential AzureStorageAccountCredential(ResourceIdentifier storageAccountId = null, IEnumerable containerCredentials = null, DateTimeOffset? expiry = null) + { + containerCredentials ??= new List(); + + return new AzureStorageAccountCredential(CredentialType.AzureStorageAccountToken, storageAccountId, containerCredentials?.ToList(), expiry); + } + + /// Initializes a new instance of AzureStorageAccountContainerCredential. + /// The storage account container name. + /// The storage account container sas uri. + /// A new instance for mocking. + public static AzureStorageAccountContainerCredential AzureStorageAccountContainerCredential(string containerName = null, Uri containerSasUri = null) + { + return new AzureStorageAccountContainerCredential(containerName, containerSasUri); + } + + /// Initializes a new instance of ConfigurationValueWithSecrets. + /// The provisioning state of the site resource. + /// The publisher name for the configuration group schema. + /// The scope of the publisher. + /// The configuration group schema name. + /// The location of the configuration group schema offering. + /// + /// The configuration group schema resource reference. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include and . + /// + /// Name and value pairs that define the configuration value secrets. It can be a well formed escaped JSON string. + /// A new instance for mocking. + public static ConfigurationValueWithSecrets ConfigurationValueWithSecrets(ProvisioningState? provisioningState = null, string publisherName = null, PublisherScope? publisherScope = null, string configurationGroupSchemaName = null, string configurationGroupSchemaOfferingLocation = null, DeploymentResourceIdReference configurationGroupSchemaResourceReference = null, string secretConfigurationValue = null) + { + return new ConfigurationValueWithSecrets(provisioningState, publisherName, publisherScope, configurationGroupSchemaName, configurationGroupSchemaOfferingLocation, configurationGroupSchemaResourceReference, ConfigurationGroupValueConfigurationType.Secret, secretConfigurationValue); + } + + /// Initializes a new instance of ConfigurationValueWithoutSecrets. + /// The provisioning state of the site resource. + /// The publisher name for the configuration group schema. + /// The scope of the publisher. + /// The configuration group schema name. + /// The location of the configuration group schema offering. + /// + /// The configuration group schema resource reference. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include and . + /// + /// Name and value pairs that define the configuration value. It can be a well formed escaped JSON string. + /// A new instance for mocking. + public static ConfigurationValueWithoutSecrets ConfigurationValueWithoutSecrets(ProvisioningState? provisioningState = null, string publisherName = null, PublisherScope? publisherScope = null, string configurationGroupSchemaName = null, string configurationGroupSchemaOfferingLocation = null, DeploymentResourceIdReference configurationGroupSchemaResourceReference = null, string configurationValue = null) + { + return new ConfigurationValueWithoutSecrets(provisioningState, publisherName, publisherScope, configurationGroupSchemaName, configurationGroupSchemaOfferingLocation, configurationGroupSchemaResourceReference, ConfigurationGroupValueConfigurationType.Open, configurationValue); + } + + /// Initializes a new instance of NetworkFunctionValueWithSecrets. + /// The provisioning state of the network function resource. + /// The publisher name for the network function. + /// The scope of the publisher. + /// The network function definition group name for the network function. + /// The network function definition version for the network function. + /// The location of the network function definition offering. + /// + /// The network function definition version resource reference. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include and . + /// + /// The nfvi type for the network function. + /// The nfviId for the network function. + /// Indicates if software updates are allowed during deployment. + /// The role configuration override values from the user. + /// The JSON-serialized secret deployment values from the user. This contains secrets like passwords,keys etc. + /// A new instance for mocking. + public static NetworkFunctionValueWithSecrets NetworkFunctionValueWithSecrets(ProvisioningState? provisioningState = null, string publisherName = null, PublisherScope? publisherScope = null, string networkFunctionDefinitionGroupName = null, string networkFunctionDefinitionVersion = null, string networkFunctionDefinitionOfferingLocation = null, DeploymentResourceIdReference networkFunctionDefinitionVersionResourceReference = null, NfviType? nfviType = null, ResourceIdentifier nfviId = null, bool? allowSoftwareUpdate = null, IEnumerable roleOverrideValues = null, string secretDeploymentValues = null) + { + roleOverrideValues ??= new List(); + + return new NetworkFunctionValueWithSecrets(provisioningState, publisherName, publisherScope, networkFunctionDefinitionGroupName, networkFunctionDefinitionVersion, networkFunctionDefinitionOfferingLocation, networkFunctionDefinitionVersionResourceReference, nfviType, nfviId, allowSoftwareUpdate, NetworkFunctionConfigurationType.Secret, roleOverrideValues?.ToList(), secretDeploymentValues); + } + + /// Initializes a new instance of NetworkFunctionValueWithoutSecrets. + /// The provisioning state of the network function resource. + /// The publisher name for the network function. + /// The scope of the publisher. + /// The network function definition group name for the network function. + /// The network function definition version for the network function. + /// The location of the network function definition offering. + /// + /// The network function definition version resource reference. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include and . + /// + /// The nfvi type for the network function. + /// The nfviId for the network function. + /// Indicates if software updates are allowed during deployment. + /// The role configuration override values from the user. + /// The JSON-serialized deployment values from the user. + /// A new instance for mocking. + public static NetworkFunctionValueWithoutSecrets NetworkFunctionValueWithoutSecrets(ProvisioningState? provisioningState = null, string publisherName = null, PublisherScope? publisherScope = null, string networkFunctionDefinitionGroupName = null, string networkFunctionDefinitionVersion = null, string networkFunctionDefinitionOfferingLocation = null, DeploymentResourceIdReference networkFunctionDefinitionVersionResourceReference = null, NfviType? nfviType = null, ResourceIdentifier nfviId = null, bool? allowSoftwareUpdate = null, IEnumerable roleOverrideValues = null, string deploymentValues = null) + { + roleOverrideValues ??= new List(); + + return new NetworkFunctionValueWithoutSecrets(provisioningState, publisherName, publisherScope, networkFunctionDefinitionGroupName, networkFunctionDefinitionVersion, networkFunctionDefinitionOfferingLocation, networkFunctionDefinitionVersionResourceReference, nfviType, nfviId, allowSoftwareUpdate, NetworkFunctionConfigurationType.Open, roleOverrideValues?.ToList(), deploymentValues); + } + + /// Initializes a new instance of ContainerizedNetworkFunctionDefinitionVersion. + /// The provisioning state of the network function definition version resource. + /// The network function definition version state. + /// The network function definition version description. + /// The deployment parameters of the network function definition version. + /// + /// Containerized network function template. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include . + /// + /// A new instance for mocking. + public static ContainerizedNetworkFunctionDefinitionVersion ContainerizedNetworkFunctionDefinitionVersion(ProvisioningState? provisioningState = null, VersionState? versionState = null, string description = null, string deployParameters = null, ContainerizedNetworkFunctionTemplate networkFunctionTemplate = null) + { + return new ContainerizedNetworkFunctionDefinitionVersion(provisioningState, versionState, description, deployParameters, NetworkFunctionType.ContainerizedNetworkFunction, networkFunctionTemplate); + } + + /// Initializes a new instance of VirtualNetworkFunctionDefinitionVersion. + /// The provisioning state of the network function definition version resource. + /// The network function definition version state. + /// The network function definition version description. + /// The deployment parameters of the network function definition version. + /// + /// Virtual network function template. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include and . + /// + /// A new instance for mocking. + public static VirtualNetworkFunctionDefinitionVersion VirtualNetworkFunctionDefinitionVersion(ProvisioningState? provisioningState = null, VersionState? versionState = null, string description = null, string deployParameters = null, VirtualNetworkFunctionTemplate networkFunctionTemplate = null) + { + return new VirtualNetworkFunctionDefinitionVersion(provisioningState, versionState, description, deployParameters, NetworkFunctionType.VirtualNetworkFunction, networkFunctionTemplate); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/ArtifactManifestCollection.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/ArtifactManifestCollection.cs new file mode 100644 index 000000000000..13472b043e87 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/ArtifactManifestCollection.cs @@ -0,0 +1,415 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.HybridNetwork +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get an instance call the GetArtifactManifests method from an instance of . + /// + public partial class ArtifactManifestCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _artifactManifestClientDiagnostics; + private readonly ArtifactManifestsRestOperations _artifactManifestRestClient; + + /// Initializes a new instance of the class for mocking. + protected ArtifactManifestCollection() + { + } + + /// 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 ArtifactManifestCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _artifactManifestClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.HybridNetwork", ArtifactManifestResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ArtifactManifestResource.ResourceType, out string artifactManifestApiVersion); + _artifactManifestRestClient = new ArtifactManifestsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, artifactManifestApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ArtifactStoreResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ArtifactStoreResource.ResourceType), nameof(id)); + } + + /// + /// Creates or updates a artifact manifest. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}/artifactManifests/{artifactManifestName} + /// + /// + /// Operation Id + /// ArtifactManifests_CreateOrUpdate + /// + /// + /// + /// 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 artifact manifest. + /// Parameters supplied to the create or update artifact manifest operation. + /// 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 artifactManifestName, ArtifactManifestData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(artifactManifestName, nameof(artifactManifestName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _artifactManifestClientDiagnostics.CreateScope("ArtifactManifestCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _artifactManifestRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, artifactManifestName, data, cancellationToken).ConfigureAwait(false); + var operation = new HybridNetworkArmOperation(new ArtifactManifestOperationSource(Client), _artifactManifestClientDiagnostics, Pipeline, _artifactManifestRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, artifactManifestName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates or updates a artifact manifest. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}/artifactManifests/{artifactManifestName} + /// + /// + /// Operation Id + /// ArtifactManifests_CreateOrUpdate + /// + /// + /// + /// 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 artifact manifest. + /// Parameters supplied to the create or update artifact manifest operation. + /// 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 artifactManifestName, ArtifactManifestData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(artifactManifestName, nameof(artifactManifestName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _artifactManifestClientDiagnostics.CreateScope("ArtifactManifestCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _artifactManifestRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, artifactManifestName, data, cancellationToken); + var operation = new HybridNetworkArmOperation(new ArtifactManifestOperationSource(Client), _artifactManifestClientDiagnostics, Pipeline, _artifactManifestRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, artifactManifestName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets information about a artifact manifest resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}/artifactManifests/{artifactManifestName} + /// + /// + /// Operation Id + /// ArtifactManifests_Get + /// + /// + /// + /// The name of the artifact manifest. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string artifactManifestName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(artifactManifestName, nameof(artifactManifestName)); + + using var scope = _artifactManifestClientDiagnostics.CreateScope("ArtifactManifestCollection.Get"); + scope.Start(); + try + { + var response = await _artifactManifestRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, artifactManifestName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ArtifactManifestResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets information about a artifact manifest resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}/artifactManifests/{artifactManifestName} + /// + /// + /// Operation Id + /// ArtifactManifests_Get + /// + /// + /// + /// The name of the artifact manifest. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string artifactManifestName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(artifactManifestName, nameof(artifactManifestName)); + + using var scope = _artifactManifestClientDiagnostics.CreateScope("ArtifactManifestCollection.Get"); + scope.Start(); + try + { + var response = _artifactManifestRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, artifactManifestName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ArtifactManifestResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets information about the artifact manifest. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}/artifactManifests + /// + /// + /// Operation Id + /// ArtifactManifests_ListByArtifactStore + /// + /// + /// + /// 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) => _artifactManifestRestClient.CreateListByArtifactStoreRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _artifactManifestRestClient.CreateListByArtifactStoreNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ArtifactManifestResource(Client, ArtifactManifestData.DeserializeArtifactManifestData(e)), _artifactManifestClientDiagnostics, Pipeline, "ArtifactManifestCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Gets information about the artifact manifest. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}/artifactManifests + /// + /// + /// Operation Id + /// ArtifactManifests_ListByArtifactStore + /// + /// + /// + /// 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) => _artifactManifestRestClient.CreateListByArtifactStoreRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _artifactManifestRestClient.CreateListByArtifactStoreNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ArtifactManifestResource(Client, ArtifactManifestData.DeserializeArtifactManifestData(e)), _artifactManifestClientDiagnostics, Pipeline, "ArtifactManifestCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}/artifactManifests/{artifactManifestName} + /// + /// + /// Operation Id + /// ArtifactManifests_Get + /// + /// + /// + /// The name of the artifact manifest. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string artifactManifestName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(artifactManifestName, nameof(artifactManifestName)); + + using var scope = _artifactManifestClientDiagnostics.CreateScope("ArtifactManifestCollection.Exists"); + scope.Start(); + try + { + var response = await _artifactManifestRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, artifactManifestName, 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.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}/artifactManifests/{artifactManifestName} + /// + /// + /// Operation Id + /// ArtifactManifests_Get + /// + /// + /// + /// The name of the artifact manifest. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string artifactManifestName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(artifactManifestName, nameof(artifactManifestName)); + + using var scope = _artifactManifestClientDiagnostics.CreateScope("ArtifactManifestCollection.Exists"); + scope.Start(); + try + { + var response = _artifactManifestRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, artifactManifestName, 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.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}/artifactManifests/{artifactManifestName} + /// + /// + /// Operation Id + /// ArtifactManifests_Get + /// + /// + /// + /// The name of the artifact manifest. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string artifactManifestName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(artifactManifestName, nameof(artifactManifestName)); + + using var scope = _artifactManifestClientDiagnostics.CreateScope("ArtifactManifestCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _artifactManifestRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, artifactManifestName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ArtifactManifestResource(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.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}/artifactManifests/{artifactManifestName} + /// + /// + /// Operation Id + /// ArtifactManifests_Get + /// + /// + /// + /// The name of the artifact manifest. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string artifactManifestName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(artifactManifestName, nameof(artifactManifestName)); + + using var scope = _artifactManifestClientDiagnostics.CreateScope("ArtifactManifestCollection.GetIfExists"); + scope.Start(); + try + { + var response = _artifactManifestRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, artifactManifestName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ArtifactManifestResource(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/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/ArtifactManifestData.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/ArtifactManifestData.cs new file mode 100644 index 000000000000..3d2705977b09 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/ArtifactManifestData.cs @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.HybridNetwork.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.HybridNetwork +{ + /// + /// A class representing the ArtifactManifest data model. + /// Artifact manifest properties. + /// + public partial class ArtifactManifestData : TrackedResourceData + { + /// Initializes a new instance of ArtifactManifestData. + /// The location. + public ArtifactManifestData(AzureLocation location) : base(location) + { + } + + /// Initializes a new instance of ArtifactManifestData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The tags. + /// The location. + /// Artifact manifest properties. + internal ArtifactManifestData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ArtifactManifestPropertiesFormat properties) : base(id, name, resourceType, systemData, tags, location) + { + Properties = properties; + } + + /// Artifact manifest properties. + public ArtifactManifestPropertiesFormat Properties { get; set; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/ArtifactManifestResource.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/ArtifactManifestResource.cs new file mode 100644 index 000000000000..d2ea3e14e30b --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/ArtifactManifestResource.cs @@ -0,0 +1,737 @@ +// 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; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.HybridNetwork.Models; + +namespace Azure.ResourceManager.HybridNetwork +{ + /// + /// A Class representing an ArtifactManifest along with the instance operations that can be performed on it. + /// If you have a you can construct an + /// from an instance of using the GetArtifactManifestResource method. + /// Otherwise you can get one from its parent resource using the GetArtifactManifest method. + /// + public partial class ArtifactManifestResource : ArmResource + { + /// Generate the resource identifier of a instance. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string publisherName, string artifactStoreName, string artifactManifestName) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}/artifactManifests/{artifactManifestName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _artifactManifestClientDiagnostics; + private readonly ArtifactManifestsRestOperations _artifactManifestRestClient; + private readonly ArtifactManifestData _data; + + /// Initializes a new instance of the class for mocking. + protected ArtifactManifestResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal ArtifactManifestResource(ArmClient client, ArtifactManifestData 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 ArtifactManifestResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _artifactManifestClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.HybridNetwork", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string artifactManifestApiVersion); + _artifactManifestRestClient = new ArtifactManifestsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, artifactManifestApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.HybridNetwork/publishers/artifactStores/artifactManifests"; + + /// 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 ArtifactManifestData 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 information about a artifact manifest resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}/artifactManifests/{artifactManifestName} + /// + /// + /// Operation Id + /// ArtifactManifests_Get + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _artifactManifestClientDiagnostics.CreateScope("ArtifactManifestResource.Get"); + scope.Start(); + try + { + var response = await _artifactManifestRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ArtifactManifestResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets information about a artifact manifest resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}/artifactManifests/{artifactManifestName} + /// + /// + /// Operation Id + /// ArtifactManifests_Get + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _artifactManifestClientDiagnostics.CreateScope("ArtifactManifestResource.Get"); + scope.Start(); + try + { + var response = _artifactManifestRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ArtifactManifestResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes the specified artifact manifest. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}/artifactManifests/{artifactManifestName} + /// + /// + /// Operation Id + /// ArtifactManifests_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _artifactManifestClientDiagnostics.CreateScope("ArtifactManifestResource.Delete"); + scope.Start(); + try + { + var response = await _artifactManifestRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new HybridNetworkArmOperation(_artifactManifestClientDiagnostics, Pipeline, _artifactManifestRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes the specified artifact manifest. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}/artifactManifests/{artifactManifestName} + /// + /// + /// Operation Id + /// ArtifactManifests_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _artifactManifestClientDiagnostics.CreateScope("ArtifactManifestResource.Delete"); + scope.Start(); + try + { + var response = _artifactManifestRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + var operation = new HybridNetworkArmOperation(_artifactManifestClientDiagnostics, Pipeline, _artifactManifestRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Updates a artifact manifest resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}/artifactManifests/{artifactManifestName} + /// + /// + /// Operation Id + /// ArtifactManifests_Update + /// + /// + /// + /// Parameters supplied to the create or update artifact manifest operation. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(TagsObject tagsObject, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tagsObject, nameof(tagsObject)); + + using var scope = _artifactManifestClientDiagnostics.CreateScope("ArtifactManifestResource.Update"); + scope.Start(); + try + { + var response = await _artifactManifestRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, tagsObject, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new ArtifactManifestResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Updates a artifact manifest resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}/artifactManifests/{artifactManifestName} + /// + /// + /// Operation Id + /// ArtifactManifests_Update + /// + /// + /// + /// Parameters supplied to the create or update artifact manifest operation. + /// The cancellation token to use. + /// is null. + public virtual Response Update(TagsObject tagsObject, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tagsObject, nameof(tagsObject)); + + using var scope = _artifactManifestClientDiagnostics.CreateScope("ArtifactManifestResource.Update"); + scope.Start(); + try + { + var response = _artifactManifestRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, tagsObject, cancellationToken); + return Response.FromValue(new ArtifactManifestResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// List credential for publishing artifacts defined in artifact manifest. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}/artifactManifests/{artifactManifestName}/listCredential + /// + /// + /// Operation Id + /// ArtifactManifests_ListCredential + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetCredentialAsync(CancellationToken cancellationToken = default) + { + using var scope = _artifactManifestClientDiagnostics.CreateScope("ArtifactManifestResource.GetCredential"); + scope.Start(); + try + { + var response = await _artifactManifestRestClient.ListCredentialAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// List credential for publishing artifacts defined in artifact manifest. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}/artifactManifests/{artifactManifestName}/listCredential + /// + /// + /// Operation Id + /// ArtifactManifests_ListCredential + /// + /// + /// + /// The cancellation token to use. + public virtual Response GetCredential(CancellationToken cancellationToken = default) + { + using var scope = _artifactManifestClientDiagnostics.CreateScope("ArtifactManifestResource.GetCredential"); + scope.Start(); + try + { + var response = _artifactManifestRestClient.ListCredential(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Update state for artifact manifest. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}/artifactManifests/{artifactManifestName}/updateState + /// + /// + /// Operation Id + /// ArtifactManifests_UpdateState + /// + /// + /// + /// 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. + /// Parameters supplied to update the state of artifact manifest. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateStateAsync(WaitUntil waitUntil, ArtifactManifestUpdateState artifactManifestUpdateState, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(artifactManifestUpdateState, nameof(artifactManifestUpdateState)); + + using var scope = _artifactManifestClientDiagnostics.CreateScope("ArtifactManifestResource.UpdateState"); + scope.Start(); + try + { + var response = await _artifactManifestRestClient.UpdateStateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, artifactManifestUpdateState, cancellationToken).ConfigureAwait(false); + var operation = new HybridNetworkArmOperation(new ArtifactManifestUpdateStateOperationSource(), _artifactManifestClientDiagnostics, Pipeline, _artifactManifestRestClient.CreateUpdateStateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, artifactManifestUpdateState).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Update state for artifact manifest. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}/artifactManifests/{artifactManifestName}/updateState + /// + /// + /// Operation Id + /// ArtifactManifests_UpdateState + /// + /// + /// + /// 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. + /// Parameters supplied to update the state of artifact manifest. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation UpdateState(WaitUntil waitUntil, ArtifactManifestUpdateState artifactManifestUpdateState, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(artifactManifestUpdateState, nameof(artifactManifestUpdateState)); + + using var scope = _artifactManifestClientDiagnostics.CreateScope("ArtifactManifestResource.UpdateState"); + scope.Start(); + try + { + var response = _artifactManifestRestClient.UpdateState(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, artifactManifestUpdateState, cancellationToken); + var operation = new HybridNetworkArmOperation(new ArtifactManifestUpdateStateOperationSource(), _artifactManifestClientDiagnostics, Pipeline, _artifactManifestRestClient.CreateUpdateStateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, artifactManifestUpdateState).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.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}/artifactManifests/{artifactManifestName} + /// + /// + /// Operation Id + /// ArtifactManifests_Get + /// + /// + /// + /// 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 = _artifactManifestClientDiagnostics.CreateScope("ArtifactManifestResource.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 _artifactManifestRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new ArtifactManifestResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new TagsObject(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags[key] = value; + var result = await UpdateAsync(patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return result; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Add a tag to the current resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}/artifactManifests/{artifactManifestName} + /// + /// + /// Operation Id + /// ArtifactManifests_Get + /// + /// + /// + /// 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 = _artifactManifestClientDiagnostics.CreateScope("ArtifactManifestResource.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 = _artifactManifestRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + return Response.FromValue(new ArtifactManifestResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new TagsObject(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags[key] = value; + var result = Update(patch, cancellationToken: cancellationToken); + return result; + } + } + 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.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}/artifactManifests/{artifactManifestName} + /// + /// + /// Operation Id + /// ArtifactManifests_Get + /// + /// + /// + /// 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 = _artifactManifestClientDiagnostics.CreateScope("ArtifactManifestResource.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 _artifactManifestRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new ArtifactManifestResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new TagsObject(); + patch.Tags.ReplaceWith(tags); + var result = await UpdateAsync(patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return result; + } + } + 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.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}/artifactManifests/{artifactManifestName} + /// + /// + /// Operation Id + /// ArtifactManifests_Get + /// + /// + /// + /// 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 = _artifactManifestClientDiagnostics.CreateScope("ArtifactManifestResource.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 = _artifactManifestRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + return Response.FromValue(new ArtifactManifestResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new TagsObject(); + patch.Tags.ReplaceWith(tags); + var result = Update(patch, cancellationToken: cancellationToken); + return result; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Removes a tag by key from the resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}/artifactManifests/{artifactManifestName} + /// + /// + /// Operation Id + /// ArtifactManifests_Get + /// + /// + /// + /// 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 = _artifactManifestClientDiagnostics.CreateScope("ArtifactManifestResource.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 _artifactManifestRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new ArtifactManifestResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new TagsObject(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags.Remove(key); + var result = await UpdateAsync(patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return result; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Removes a tag by key from the resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}/artifactManifests/{artifactManifestName} + /// + /// + /// Operation Id + /// ArtifactManifests_Get + /// + /// + /// + /// 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 = _artifactManifestClientDiagnostics.CreateScope("ArtifactManifestResource.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 = _artifactManifestRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + return Response.FromValue(new ArtifactManifestResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new TagsObject(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags.Remove(key); + var result = Update(patch, cancellationToken: cancellationToken); + return result; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/ArtifactStoreCollection.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/ArtifactStoreCollection.cs new file mode 100644 index 000000000000..c400693ef64c --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/ArtifactStoreCollection.cs @@ -0,0 +1,415 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.HybridNetwork +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get an instance call the GetArtifactStores method from an instance of . + /// + public partial class ArtifactStoreCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _artifactStoreClientDiagnostics; + private readonly ArtifactStoresRestOperations _artifactStoreRestClient; + + /// Initializes a new instance of the class for mocking. + protected ArtifactStoreCollection() + { + } + + /// 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 ArtifactStoreCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _artifactStoreClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.HybridNetwork", ArtifactStoreResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ArtifactStoreResource.ResourceType, out string artifactStoreApiVersion); + _artifactStoreRestClient = new ArtifactStoresRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, artifactStoreApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != PublisherResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, PublisherResource.ResourceType), nameof(id)); + } + + /// + /// Creates or updates a artifact store. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName} + /// + /// + /// Operation Id + /// ArtifactStores_CreateOrUpdate + /// + /// + /// + /// 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 artifact store. + /// Parameters supplied to the create or update application group operation. + /// 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 artifactStoreName, ArtifactStoreData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(artifactStoreName, nameof(artifactStoreName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _artifactStoreClientDiagnostics.CreateScope("ArtifactStoreCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _artifactStoreRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, artifactStoreName, data, cancellationToken).ConfigureAwait(false); + var operation = new HybridNetworkArmOperation(new ArtifactStoreOperationSource(Client), _artifactStoreClientDiagnostics, Pipeline, _artifactStoreRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, artifactStoreName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates or updates a artifact store. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName} + /// + /// + /// Operation Id + /// ArtifactStores_CreateOrUpdate + /// + /// + /// + /// 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 artifact store. + /// Parameters supplied to the create or update application group operation. + /// 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 artifactStoreName, ArtifactStoreData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(artifactStoreName, nameof(artifactStoreName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _artifactStoreClientDiagnostics.CreateScope("ArtifactStoreCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _artifactStoreRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, artifactStoreName, data, cancellationToken); + var operation = new HybridNetworkArmOperation(new ArtifactStoreOperationSource(Client), _artifactStoreClientDiagnostics, Pipeline, _artifactStoreRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, artifactStoreName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets information about the specified artifact store. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName} + /// + /// + /// Operation Id + /// ArtifactStores_Get + /// + /// + /// + /// The name of the artifact store. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string artifactStoreName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(artifactStoreName, nameof(artifactStoreName)); + + using var scope = _artifactStoreClientDiagnostics.CreateScope("ArtifactStoreCollection.Get"); + scope.Start(); + try + { + var response = await _artifactStoreRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, artifactStoreName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ArtifactStoreResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets information about the specified artifact store. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName} + /// + /// + /// Operation Id + /// ArtifactStores_Get + /// + /// + /// + /// The name of the artifact store. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string artifactStoreName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(artifactStoreName, nameof(artifactStoreName)); + + using var scope = _artifactStoreClientDiagnostics.CreateScope("ArtifactStoreCollection.Get"); + scope.Start(); + try + { + var response = _artifactStoreRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, artifactStoreName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ArtifactStoreResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets information of the ArtifactStores under publisher. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores + /// + /// + /// Operation Id + /// ArtifactStores_ListByPublisher + /// + /// + /// + /// 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) => _artifactStoreRestClient.CreateListByPublisherRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _artifactStoreRestClient.CreateListByPublisherNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ArtifactStoreResource(Client, ArtifactStoreData.DeserializeArtifactStoreData(e)), _artifactStoreClientDiagnostics, Pipeline, "ArtifactStoreCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Gets information of the ArtifactStores under publisher. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores + /// + /// + /// Operation Id + /// ArtifactStores_ListByPublisher + /// + /// + /// + /// 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) => _artifactStoreRestClient.CreateListByPublisherRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _artifactStoreRestClient.CreateListByPublisherNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ArtifactStoreResource(Client, ArtifactStoreData.DeserializeArtifactStoreData(e)), _artifactStoreClientDiagnostics, Pipeline, "ArtifactStoreCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName} + /// + /// + /// Operation Id + /// ArtifactStores_Get + /// + /// + /// + /// The name of the artifact store. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string artifactStoreName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(artifactStoreName, nameof(artifactStoreName)); + + using var scope = _artifactStoreClientDiagnostics.CreateScope("ArtifactStoreCollection.Exists"); + scope.Start(); + try + { + var response = await _artifactStoreRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, artifactStoreName, 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.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName} + /// + /// + /// Operation Id + /// ArtifactStores_Get + /// + /// + /// + /// The name of the artifact store. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string artifactStoreName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(artifactStoreName, nameof(artifactStoreName)); + + using var scope = _artifactStoreClientDiagnostics.CreateScope("ArtifactStoreCollection.Exists"); + scope.Start(); + try + { + var response = _artifactStoreRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, artifactStoreName, 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.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName} + /// + /// + /// Operation Id + /// ArtifactStores_Get + /// + /// + /// + /// The name of the artifact store. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string artifactStoreName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(artifactStoreName, nameof(artifactStoreName)); + + using var scope = _artifactStoreClientDiagnostics.CreateScope("ArtifactStoreCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _artifactStoreRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, artifactStoreName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ArtifactStoreResource(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.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName} + /// + /// + /// Operation Id + /// ArtifactStores_Get + /// + /// + /// + /// The name of the artifact store. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string artifactStoreName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(artifactStoreName, nameof(artifactStoreName)); + + using var scope = _artifactStoreClientDiagnostics.CreateScope("ArtifactStoreCollection.GetIfExists"); + scope.Start(); + try + { + var response = _artifactStoreRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, artifactStoreName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ArtifactStoreResource(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/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/ArtifactStoreData.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/ArtifactStoreData.cs new file mode 100644 index 000000000000..faae13817e19 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/ArtifactStoreData.cs @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.HybridNetwork.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.HybridNetwork +{ + /// + /// A class representing the ArtifactStore data model. + /// Artifact store properties. + /// + public partial class ArtifactStoreData : TrackedResourceData + { + /// Initializes a new instance of ArtifactStoreData. + /// The location. + public ArtifactStoreData(AzureLocation location) : base(location) + { + } + + /// Initializes a new instance of ArtifactStoreData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The tags. + /// The location. + /// ArtifactStores properties. + internal ArtifactStoreData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ArtifactStorePropertiesFormat properties) : base(id, name, resourceType, systemData, tags, location) + { + Properties = properties; + } + + /// ArtifactStores properties. + public ArtifactStorePropertiesFormat Properties { get; set; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/ArtifactStoreResource.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/ArtifactStoreResource.cs new file mode 100644 index 000000000000..6c22170a1ac8 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/ArtifactStoreResource.cs @@ -0,0 +1,841 @@ +// 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 Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.HybridNetwork.Models; + +namespace Azure.ResourceManager.HybridNetwork +{ + /// + /// A Class representing an ArtifactStore along with the instance operations that can be performed on it. + /// If you have a you can construct an + /// from an instance of using the GetArtifactStoreResource method. + /// Otherwise you can get one from its parent resource using the GetArtifactStore method. + /// + public partial class ArtifactStoreResource : ArmResource + { + /// Generate the resource identifier of a instance. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string publisherName, string artifactStoreName) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _artifactStoreClientDiagnostics; + private readonly ArtifactStoresRestOperations _artifactStoreRestClient; + private readonly ClientDiagnostics _proxyArtifactClientDiagnostics; + private readonly ProxyArtifactRestOperations _proxyArtifactRestClient; + private readonly ArtifactStoreData _data; + + /// Initializes a new instance of the class for mocking. + protected ArtifactStoreResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal ArtifactStoreResource(ArmClient client, ArtifactStoreData 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 ArtifactStoreResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _artifactStoreClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.HybridNetwork", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string artifactStoreApiVersion); + _artifactStoreRestClient = new ArtifactStoresRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, artifactStoreApiVersion); + _proxyArtifactClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.HybridNetwork", ProviderConstants.DefaultProviderNamespace, Diagnostics); + _proxyArtifactRestClient = new ProxyArtifactRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.HybridNetwork/publishers/artifactStores"; + + /// 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 ArtifactStoreData 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 ArtifactManifestResources in the ArtifactStore. + /// An object representing collection of ArtifactManifestResources and their operations over a ArtifactManifestResource. + public virtual ArtifactManifestCollection GetArtifactManifests() + { + return GetCachedClient(Client => new ArtifactManifestCollection(Client, Id)); + } + + /// + /// Gets information about a artifact manifest resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}/artifactManifests/{artifactManifestName} + /// + /// + /// Operation Id + /// ArtifactManifests_Get + /// + /// + /// + /// The name of the artifact manifest. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public virtual async Task> GetArtifactManifestAsync(string artifactManifestName, CancellationToken cancellationToken = default) + { + return await GetArtifactManifests().GetAsync(artifactManifestName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets information about a artifact manifest resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}/artifactManifests/{artifactManifestName} + /// + /// + /// Operation Id + /// ArtifactManifests_Get + /// + /// + /// + /// The name of the artifact manifest. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public virtual Response GetArtifactManifest(string artifactManifestName, CancellationToken cancellationToken = default) + { + return GetArtifactManifests().Get(artifactManifestName, cancellationToken); + } + + /// + /// Gets information about the specified artifact store. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName} + /// + /// + /// Operation Id + /// ArtifactStores_Get + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _artifactStoreClientDiagnostics.CreateScope("ArtifactStoreResource.Get"); + scope.Start(); + try + { + var response = await _artifactStoreRestClient.GetAsync(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 ArtifactStoreResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets information about the specified artifact store. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName} + /// + /// + /// Operation Id + /// ArtifactStores_Get + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _artifactStoreClientDiagnostics.CreateScope("ArtifactStoreResource.Get"); + scope.Start(); + try + { + var response = _artifactStoreRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ArtifactStoreResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes the specified artifact store. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName} + /// + /// + /// Operation Id + /// ArtifactStores_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _artifactStoreClientDiagnostics.CreateScope("ArtifactStoreResource.Delete"); + scope.Start(); + try + { + var response = await _artifactStoreRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new HybridNetworkArmOperation(_artifactStoreClientDiagnostics, Pipeline, _artifactStoreRestClient.CreateDeleteRequest(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; + } + } + + /// + /// Deletes the specified artifact store. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName} + /// + /// + /// Operation Id + /// ArtifactStores_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _artifactStoreClientDiagnostics.CreateScope("ArtifactStoreResource.Delete"); + scope.Start(); + try + { + var response = _artifactStoreRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + var operation = new HybridNetworkArmOperation(_artifactStoreClientDiagnostics, Pipeline, _artifactStoreRestClient.CreateDeleteRequest(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 artifact store resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName} + /// + /// + /// Operation Id + /// ArtifactStores_Update + /// + /// + /// + /// Parameters supplied to the create or update application group operation. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(TagsObject tagsObject, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tagsObject, nameof(tagsObject)); + + using var scope = _artifactStoreClientDiagnostics.CreateScope("ArtifactStoreResource.Update"); + scope.Start(); + try + { + var response = await _artifactStoreRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, tagsObject, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new ArtifactStoreResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Update artifact store resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName} + /// + /// + /// Operation Id + /// ArtifactStores_Update + /// + /// + /// + /// Parameters supplied to the create or update application group operation. + /// The cancellation token to use. + /// is null. + public virtual Response Update(TagsObject tagsObject, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tagsObject, nameof(tagsObject)); + + using var scope = _artifactStoreClientDiagnostics.CreateScope("ArtifactStoreResource.Update"); + scope.Start(); + try + { + var response = _artifactStoreRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, tagsObject, cancellationToken); + return Response.FromValue(new ArtifactStoreResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Lists all the available artifacts in the parent Artifact Store. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}/artifacts + /// + /// + /// Operation Id + /// ProxyArtifact_List + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetProxyArtifactsAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _proxyArtifactRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _proxyArtifactRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, ProxyArtifactListOverview.DeserializeProxyArtifactListOverview, _proxyArtifactClientDiagnostics, Pipeline, "ArtifactStoreResource.GetProxyArtifacts", "value", "nextLink", cancellationToken); + } + + /// + /// Lists all the available artifacts in the parent Artifact Store. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}/artifacts + /// + /// + /// Operation Id + /// ProxyArtifact_List + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetProxyArtifacts(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _proxyArtifactRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _proxyArtifactRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, ProxyArtifactListOverview.DeserializeProxyArtifactListOverview, _proxyArtifactClientDiagnostics, Pipeline, "ArtifactStoreResource.GetProxyArtifacts", "value", "nextLink", cancellationToken); + } + + /// + /// Get a Artifact overview information. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}/artifactVersions + /// + /// + /// Operation Id + /// ProxyArtifact_Get + /// + /// + /// + /// The name of the artifact. + /// The cancellation token to use. + /// is null. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetProxyArtifactsAsync(string artifactName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(artifactName, nameof(artifactName)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => _proxyArtifactRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, artifactName); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _proxyArtifactRestClient.CreateGetNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, artifactName); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, ProxyArtifactVersionsListOverview.DeserializeProxyArtifactVersionsListOverview, _proxyArtifactClientDiagnostics, Pipeline, "ArtifactStoreResource.GetProxyArtifacts", "value", "nextLink", cancellationToken); + } + + /// + /// Get a Artifact overview information. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}/artifactVersions + /// + /// + /// Operation Id + /// ProxyArtifact_Get + /// + /// + /// + /// The name of the artifact. + /// The cancellation token to use. + /// is null. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetProxyArtifacts(string artifactName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(artifactName, nameof(artifactName)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => _proxyArtifactRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, artifactName); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _proxyArtifactRestClient.CreateGetNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, artifactName); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, ProxyArtifactVersionsListOverview.DeserializeProxyArtifactVersionsListOverview, _proxyArtifactClientDiagnostics, Pipeline, "ArtifactStoreResource.GetProxyArtifacts", "value", "nextLink", cancellationToken); + } + + /// + /// Change artifact state defined in artifact store. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}/artifactVersions/{artifactVersionName} + /// + /// + /// Operation Id + /// ProxyArtifact_UpdateState + /// + /// + /// + /// 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 artifact version. + /// The name of the artifact. + /// Parameters supplied to update the state of artifact manifest. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// , or is null. + public virtual async Task> UpdateStateProxyArtifactAsync(WaitUntil waitUntil, string artifactVersionName, string artifactName, ArtifactChangeState artifactChangeState, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(artifactVersionName, nameof(artifactVersionName)); + Argument.AssertNotNull(artifactName, nameof(artifactName)); + Argument.AssertNotNull(artifactChangeState, nameof(artifactChangeState)); + + using var scope = _proxyArtifactClientDiagnostics.CreateScope("ArtifactStoreResource.UpdateStateProxyArtifact"); + scope.Start(); + try + { + var response = await _proxyArtifactRestClient.UpdateStateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, artifactVersionName, artifactName, artifactChangeState, cancellationToken).ConfigureAwait(false); + var operation = new HybridNetworkArmOperation(new ProxyArtifactVersionsListOverviewOperationSource(), _proxyArtifactClientDiagnostics, Pipeline, _proxyArtifactRestClient.CreateUpdateStateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, artifactVersionName, artifactName, artifactChangeState).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Change artifact state defined in artifact store. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}/artifactVersions/{artifactVersionName} + /// + /// + /// Operation Id + /// ProxyArtifact_UpdateState + /// + /// + /// + /// 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 artifact version. + /// The name of the artifact. + /// Parameters supplied to update the state of artifact manifest. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// , or is null. + public virtual ArmOperation UpdateStateProxyArtifact(WaitUntil waitUntil, string artifactVersionName, string artifactName, ArtifactChangeState artifactChangeState, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(artifactVersionName, nameof(artifactVersionName)); + Argument.AssertNotNull(artifactName, nameof(artifactName)); + Argument.AssertNotNull(artifactChangeState, nameof(artifactChangeState)); + + using var scope = _proxyArtifactClientDiagnostics.CreateScope("ArtifactStoreResource.UpdateStateProxyArtifact"); + scope.Start(); + try + { + var response = _proxyArtifactRestClient.UpdateState(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, artifactVersionName, artifactName, artifactChangeState, cancellationToken); + var operation = new HybridNetworkArmOperation(new ProxyArtifactVersionsListOverviewOperationSource(), _proxyArtifactClientDiagnostics, Pipeline, _proxyArtifactRestClient.CreateUpdateStateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, artifactVersionName, artifactName, artifactChangeState).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.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName} + /// + /// + /// Operation Id + /// ArtifactStores_Get + /// + /// + /// + /// 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 = _artifactStoreClientDiagnostics.CreateScope("ArtifactStoreResource.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 _artifactStoreRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new ArtifactStoreResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new TagsObject(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags[key] = value; + var result = await UpdateAsync(patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return result; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Add a tag to the current resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName} + /// + /// + /// Operation Id + /// ArtifactStores_Get + /// + /// + /// + /// 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 = _artifactStoreClientDiagnostics.CreateScope("ArtifactStoreResource.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 = _artifactStoreRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + return Response.FromValue(new ArtifactStoreResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new TagsObject(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags[key] = value; + var result = Update(patch, cancellationToken: cancellationToken); + return result; + } + } + 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.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName} + /// + /// + /// Operation Id + /// ArtifactStores_Get + /// + /// + /// + /// 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 = _artifactStoreClientDiagnostics.CreateScope("ArtifactStoreResource.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 _artifactStoreRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new ArtifactStoreResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new TagsObject(); + patch.Tags.ReplaceWith(tags); + var result = await UpdateAsync(patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return result; + } + } + 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.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName} + /// + /// + /// Operation Id + /// ArtifactStores_Get + /// + /// + /// + /// 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 = _artifactStoreClientDiagnostics.CreateScope("ArtifactStoreResource.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 = _artifactStoreRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + return Response.FromValue(new ArtifactStoreResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new TagsObject(); + patch.Tags.ReplaceWith(tags); + var result = Update(patch, cancellationToken: cancellationToken); + return result; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Removes a tag by key from the resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName} + /// + /// + /// Operation Id + /// ArtifactStores_Get + /// + /// + /// + /// 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 = _artifactStoreClientDiagnostics.CreateScope("ArtifactStoreResource.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 _artifactStoreRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new ArtifactStoreResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new TagsObject(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags.Remove(key); + var result = await UpdateAsync(patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return result; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Removes a tag by key from the resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName} + /// + /// + /// Operation Id + /// ArtifactStores_Get + /// + /// + /// + /// 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 = _artifactStoreClientDiagnostics.CreateScope("ArtifactStoreResource.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 = _artifactStoreRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + return Response.FromValue(new ArtifactStoreResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new TagsObject(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags.Remove(key); + var result = Update(patch, cancellationToken: cancellationToken); + return result; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/ComponentCollection.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/ComponentCollection.cs new file mode 100644 index 000000000000..412dfbcfc483 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/ComponentCollection.cs @@ -0,0 +1,333 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.HybridNetwork +{ + /// + /// 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 GetComponents method from an instance of . + /// + public partial class ComponentCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _componentClientDiagnostics; + private readonly ComponentsRestOperations _componentRestClient; + + /// Initializes a new instance of the class for mocking. + protected ComponentCollection() + { + } + + /// 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 ComponentCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _componentClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.HybridNetwork", ComponentResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ComponentResource.ResourceType, out string componentApiVersion); + _componentRestClient = new ComponentsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, componentApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != NetworkFunctionResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, NetworkFunctionResource.ResourceType), nameof(id)); + } + + /// + /// Gets information about the specified application instance resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/networkFunctions/{networkFunctionName}/components/{componentName} + /// + /// + /// Operation Id + /// Components_Get + /// + /// + /// + /// The name of the component. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string componentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(componentName, nameof(componentName)); + + using var scope = _componentClientDiagnostics.CreateScope("ComponentCollection.Get"); + scope.Start(); + try + { + var response = await _componentRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, componentName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ComponentResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets information about the specified application instance resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/networkFunctions/{networkFunctionName}/components/{componentName} + /// + /// + /// Operation Id + /// Components_Get + /// + /// + /// + /// The name of the component. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string componentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(componentName, nameof(componentName)); + + using var scope = _componentClientDiagnostics.CreateScope("ComponentCollection.Get"); + scope.Start(); + try + { + var response = _componentRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, componentName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ComponentResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Lists all the component resources in a network function. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/networkFunctions/{networkFunctionName}/components + /// + /// + /// Operation Id + /// Components_ListByNetworkFunction + /// + /// + /// + /// 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) => _componentRestClient.CreateListByNetworkFunctionRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _componentRestClient.CreateListByNetworkFunctionNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ComponentResource(Client, ComponentData.DeserializeComponentData(e)), _componentClientDiagnostics, Pipeline, "ComponentCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Lists all the component resources in a network function. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/networkFunctions/{networkFunctionName}/components + /// + /// + /// Operation Id + /// Components_ListByNetworkFunction + /// + /// + /// + /// 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) => _componentRestClient.CreateListByNetworkFunctionRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _componentRestClient.CreateListByNetworkFunctionNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ComponentResource(Client, ComponentData.DeserializeComponentData(e)), _componentClientDiagnostics, Pipeline, "ComponentCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/networkFunctions/{networkFunctionName}/components/{componentName} + /// + /// + /// Operation Id + /// Components_Get + /// + /// + /// + /// The name of the component. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string componentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(componentName, nameof(componentName)); + + using var scope = _componentClientDiagnostics.CreateScope("ComponentCollection.Exists"); + scope.Start(); + try + { + var response = await _componentRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, componentName, 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.HybridNetwork/networkFunctions/{networkFunctionName}/components/{componentName} + /// + /// + /// Operation Id + /// Components_Get + /// + /// + /// + /// The name of the component. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string componentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(componentName, nameof(componentName)); + + using var scope = _componentClientDiagnostics.CreateScope("ComponentCollection.Exists"); + scope.Start(); + try + { + var response = _componentRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, componentName, 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.HybridNetwork/networkFunctions/{networkFunctionName}/components/{componentName} + /// + /// + /// Operation Id + /// Components_Get + /// + /// + /// + /// The name of the component. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string componentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(componentName, nameof(componentName)); + + using var scope = _componentClientDiagnostics.CreateScope("ComponentCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _componentRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, componentName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ComponentResource(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.HybridNetwork/networkFunctions/{networkFunctionName}/components/{componentName} + /// + /// + /// Operation Id + /// Components_Get + /// + /// + /// + /// The name of the component. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string componentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(componentName, nameof(componentName)); + + using var scope = _componentClientDiagnostics.CreateScope("ComponentCollection.GetIfExists"); + scope.Start(); + try + { + var response = _componentRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, componentName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ComponentResource(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/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/ComponentData.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/ComponentData.cs new file mode 100644 index 000000000000..1719f91ec4ed --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/ComponentData.cs @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager.HybridNetwork.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.HybridNetwork +{ + /// + /// A class representing the Component data model. + /// The component sub resource. + /// + public partial class ComponentData : ResourceData + { + /// Initializes a new instance of ComponentData. + public ComponentData() + { + } + + /// Initializes a new instance of ComponentData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The component properties. + internal ComponentData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ComponentProperties properties) : base(id, name, resourceType, systemData) + { + Properties = properties; + } + + /// The component properties. + public ComponentProperties Properties { get; set; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/ComponentResource.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/ComponentResource.cs new file mode 100644 index 000000000000..1024a3cede00 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/ComponentResource.cs @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.HybridNetwork +{ + /// + /// A Class representing a Component 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 GetComponentResource method. + /// Otherwise you can get one from its parent resource using the GetComponent method. + /// + public partial class ComponentResource : ArmResource + { + /// Generate the resource identifier of a instance. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string networkFunctionName, string componentName) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/networkFunctions/{networkFunctionName}/components/{componentName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _componentClientDiagnostics; + private readonly ComponentsRestOperations _componentRestClient; + private readonly ComponentData _data; + + /// Initializes a new instance of the class for mocking. + protected ComponentResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal ComponentResource(ArmClient client, ComponentData 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 ComponentResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _componentClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.HybridNetwork", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string componentApiVersion); + _componentRestClient = new ComponentsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, componentApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.HybridNetwork/networkFunctions/components"; + + /// 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 ComponentData 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 information about the specified application instance resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/networkFunctions/{networkFunctionName}/components/{componentName} + /// + /// + /// Operation Id + /// Components_Get + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _componentClientDiagnostics.CreateScope("ComponentResource.Get"); + scope.Start(); + try + { + var response = await _componentRestClient.GetAsync(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 ComponentResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets information about the specified application instance resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/networkFunctions/{networkFunctionName}/components/{componentName} + /// + /// + /// Operation Id + /// Components_Get + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _componentClientDiagnostics.CreateScope("ComponentResource.Get"); + scope.Start(); + try + { + var response = _componentRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ComponentResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/ConfigurationGroupSchemaCollection.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/ConfigurationGroupSchemaCollection.cs new file mode 100644 index 000000000000..7be8aac019de --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/ConfigurationGroupSchemaCollection.cs @@ -0,0 +1,415 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.HybridNetwork +{ + /// + /// 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 GetConfigurationGroupSchemas method from an instance of . + /// + public partial class ConfigurationGroupSchemaCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _configurationGroupSchemaClientDiagnostics; + private readonly ConfigurationGroupSchemasRestOperations _configurationGroupSchemaRestClient; + + /// Initializes a new instance of the class for mocking. + protected ConfigurationGroupSchemaCollection() + { + } + + /// 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 ConfigurationGroupSchemaCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _configurationGroupSchemaClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.HybridNetwork", ConfigurationGroupSchemaResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ConfigurationGroupSchemaResource.ResourceType, out string configurationGroupSchemaApiVersion); + _configurationGroupSchemaRestClient = new ConfigurationGroupSchemasRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, configurationGroupSchemaApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != PublisherResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, PublisherResource.ResourceType), nameof(id)); + } + + /// + /// Creates or updates a configuration group schema. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/configurationGroupSchemas/{configurationGroupSchemaName} + /// + /// + /// Operation Id + /// ConfigurationGroupSchemas_CreateOrUpdate + /// + /// + /// + /// 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 configuration group schema. + /// Parameters supplied to the create or update configuration group schema resource. + /// 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 configurationGroupSchemaName, ConfigurationGroupSchemaData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(configurationGroupSchemaName, nameof(configurationGroupSchemaName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _configurationGroupSchemaClientDiagnostics.CreateScope("ConfigurationGroupSchemaCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _configurationGroupSchemaRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, configurationGroupSchemaName, data, cancellationToken).ConfigureAwait(false); + var operation = new HybridNetworkArmOperation(new ConfigurationGroupSchemaOperationSource(Client), _configurationGroupSchemaClientDiagnostics, Pipeline, _configurationGroupSchemaRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, configurationGroupSchemaName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates or updates a configuration group schema. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/configurationGroupSchemas/{configurationGroupSchemaName} + /// + /// + /// Operation Id + /// ConfigurationGroupSchemas_CreateOrUpdate + /// + /// + /// + /// 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 configuration group schema. + /// Parameters supplied to the create or update configuration group schema resource. + /// 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 configurationGroupSchemaName, ConfigurationGroupSchemaData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(configurationGroupSchemaName, nameof(configurationGroupSchemaName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _configurationGroupSchemaClientDiagnostics.CreateScope("ConfigurationGroupSchemaCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _configurationGroupSchemaRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, configurationGroupSchemaName, data, cancellationToken); + var operation = new HybridNetworkArmOperation(new ConfigurationGroupSchemaOperationSource(Client), _configurationGroupSchemaClientDiagnostics, Pipeline, _configurationGroupSchemaRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, configurationGroupSchemaName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets information about the specified configuration group schema. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/configurationGroupSchemas/{configurationGroupSchemaName} + /// + /// + /// Operation Id + /// ConfigurationGroupSchemas_Get + /// + /// + /// + /// The name of the configuration group schema. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string configurationGroupSchemaName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(configurationGroupSchemaName, nameof(configurationGroupSchemaName)); + + using var scope = _configurationGroupSchemaClientDiagnostics.CreateScope("ConfigurationGroupSchemaCollection.Get"); + scope.Start(); + try + { + var response = await _configurationGroupSchemaRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, configurationGroupSchemaName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ConfigurationGroupSchemaResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets information about the specified configuration group schema. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/configurationGroupSchemas/{configurationGroupSchemaName} + /// + /// + /// Operation Id + /// ConfigurationGroupSchemas_Get + /// + /// + /// + /// The name of the configuration group schema. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string configurationGroupSchemaName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(configurationGroupSchemaName, nameof(configurationGroupSchemaName)); + + using var scope = _configurationGroupSchemaClientDiagnostics.CreateScope("ConfigurationGroupSchemaCollection.Get"); + scope.Start(); + try + { + var response = _configurationGroupSchemaRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, configurationGroupSchemaName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ConfigurationGroupSchemaResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets information of the configuration group schemas under a publisher. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/configurationGroupSchemas + /// + /// + /// Operation Id + /// ConfigurationGroupSchemas_ListByPublisher + /// + /// + /// + /// 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) => _configurationGroupSchemaRestClient.CreateListByPublisherRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _configurationGroupSchemaRestClient.CreateListByPublisherNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ConfigurationGroupSchemaResource(Client, ConfigurationGroupSchemaData.DeserializeConfigurationGroupSchemaData(e)), _configurationGroupSchemaClientDiagnostics, Pipeline, "ConfigurationGroupSchemaCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Gets information of the configuration group schemas under a publisher. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/configurationGroupSchemas + /// + /// + /// Operation Id + /// ConfigurationGroupSchemas_ListByPublisher + /// + /// + /// + /// 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) => _configurationGroupSchemaRestClient.CreateListByPublisherRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _configurationGroupSchemaRestClient.CreateListByPublisherNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ConfigurationGroupSchemaResource(Client, ConfigurationGroupSchemaData.DeserializeConfigurationGroupSchemaData(e)), _configurationGroupSchemaClientDiagnostics, Pipeline, "ConfigurationGroupSchemaCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/configurationGroupSchemas/{configurationGroupSchemaName} + /// + /// + /// Operation Id + /// ConfigurationGroupSchemas_Get + /// + /// + /// + /// The name of the configuration group schema. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string configurationGroupSchemaName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(configurationGroupSchemaName, nameof(configurationGroupSchemaName)); + + using var scope = _configurationGroupSchemaClientDiagnostics.CreateScope("ConfigurationGroupSchemaCollection.Exists"); + scope.Start(); + try + { + var response = await _configurationGroupSchemaRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, configurationGroupSchemaName, 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.HybridNetwork/publishers/{publisherName}/configurationGroupSchemas/{configurationGroupSchemaName} + /// + /// + /// Operation Id + /// ConfigurationGroupSchemas_Get + /// + /// + /// + /// The name of the configuration group schema. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string configurationGroupSchemaName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(configurationGroupSchemaName, nameof(configurationGroupSchemaName)); + + using var scope = _configurationGroupSchemaClientDiagnostics.CreateScope("ConfigurationGroupSchemaCollection.Exists"); + scope.Start(); + try + { + var response = _configurationGroupSchemaRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, configurationGroupSchemaName, 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.HybridNetwork/publishers/{publisherName}/configurationGroupSchemas/{configurationGroupSchemaName} + /// + /// + /// Operation Id + /// ConfigurationGroupSchemas_Get + /// + /// + /// + /// The name of the configuration group schema. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string configurationGroupSchemaName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(configurationGroupSchemaName, nameof(configurationGroupSchemaName)); + + using var scope = _configurationGroupSchemaClientDiagnostics.CreateScope("ConfigurationGroupSchemaCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _configurationGroupSchemaRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, configurationGroupSchemaName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ConfigurationGroupSchemaResource(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.HybridNetwork/publishers/{publisherName}/configurationGroupSchemas/{configurationGroupSchemaName} + /// + /// + /// Operation Id + /// ConfigurationGroupSchemas_Get + /// + /// + /// + /// The name of the configuration group schema. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string configurationGroupSchemaName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(configurationGroupSchemaName, nameof(configurationGroupSchemaName)); + + using var scope = _configurationGroupSchemaClientDiagnostics.CreateScope("ConfigurationGroupSchemaCollection.GetIfExists"); + scope.Start(); + try + { + var response = _configurationGroupSchemaRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, configurationGroupSchemaName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ConfigurationGroupSchemaResource(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/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/ConfigurationGroupSchemaData.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/ConfigurationGroupSchemaData.cs new file mode 100644 index 000000000000..2e2315f0db4c --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/ConfigurationGroupSchemaData.cs @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.HybridNetwork.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.HybridNetwork +{ + /// + /// A class representing the ConfigurationGroupSchema data model. + /// Configuration group schema resource. + /// + public partial class ConfigurationGroupSchemaData : TrackedResourceData + { + /// Initializes a new instance of ConfigurationGroupSchemaData. + /// The location. + public ConfigurationGroupSchemaData(AzureLocation location) : base(location) + { + } + + /// Initializes a new instance of ConfigurationGroupSchemaData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The tags. + /// The location. + /// Configuration group schema properties. + internal ConfigurationGroupSchemaData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ConfigurationGroupSchemaPropertiesFormat properties) : base(id, name, resourceType, systemData, tags, location) + { + Properties = properties; + } + + /// Configuration group schema properties. + public ConfigurationGroupSchemaPropertiesFormat Properties { get; set; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/ConfigurationGroupSchemaResource.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/ConfigurationGroupSchemaResource.cs new file mode 100644 index 000000000000..531012cbcf46 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/ConfigurationGroupSchemaResource.cs @@ -0,0 +1,677 @@ +// 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; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.HybridNetwork.Models; + +namespace Azure.ResourceManager.HybridNetwork +{ + /// + /// A Class representing a ConfigurationGroupSchema 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 GetConfigurationGroupSchemaResource method. + /// Otherwise you can get one from its parent resource using the GetConfigurationGroupSchema method. + /// + public partial class ConfigurationGroupSchemaResource : ArmResource + { + /// Generate the resource identifier of a instance. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string publisherName, string configurationGroupSchemaName) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/configurationGroupSchemas/{configurationGroupSchemaName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _configurationGroupSchemaClientDiagnostics; + private readonly ConfigurationGroupSchemasRestOperations _configurationGroupSchemaRestClient; + private readonly ConfigurationGroupSchemaData _data; + + /// Initializes a new instance of the class for mocking. + protected ConfigurationGroupSchemaResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal ConfigurationGroupSchemaResource(ArmClient client, ConfigurationGroupSchemaData 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 ConfigurationGroupSchemaResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _configurationGroupSchemaClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.HybridNetwork", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string configurationGroupSchemaApiVersion); + _configurationGroupSchemaRestClient = new ConfigurationGroupSchemasRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, configurationGroupSchemaApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.HybridNetwork/publishers/configurationGroupSchemas"; + + /// 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 ConfigurationGroupSchemaData 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 information about the specified configuration group schema. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/configurationGroupSchemas/{configurationGroupSchemaName} + /// + /// + /// Operation Id + /// ConfigurationGroupSchemas_Get + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _configurationGroupSchemaClientDiagnostics.CreateScope("ConfigurationGroupSchemaResource.Get"); + scope.Start(); + try + { + var response = await _configurationGroupSchemaRestClient.GetAsync(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 ConfigurationGroupSchemaResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets information about the specified configuration group schema. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/configurationGroupSchemas/{configurationGroupSchemaName} + /// + /// + /// Operation Id + /// ConfigurationGroupSchemas_Get + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _configurationGroupSchemaClientDiagnostics.CreateScope("ConfigurationGroupSchemaResource.Get"); + scope.Start(); + try + { + var response = _configurationGroupSchemaRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ConfigurationGroupSchemaResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes a specified configuration group schema. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/configurationGroupSchemas/{configurationGroupSchemaName} + /// + /// + /// Operation Id + /// ConfigurationGroupSchemas_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _configurationGroupSchemaClientDiagnostics.CreateScope("ConfigurationGroupSchemaResource.Delete"); + scope.Start(); + try + { + var response = await _configurationGroupSchemaRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new HybridNetworkArmOperation(_configurationGroupSchemaClientDiagnostics, Pipeline, _configurationGroupSchemaRestClient.CreateDeleteRequest(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; + } + } + + /// + /// Deletes a specified configuration group schema. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/configurationGroupSchemas/{configurationGroupSchemaName} + /// + /// + /// Operation Id + /// ConfigurationGroupSchemas_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _configurationGroupSchemaClientDiagnostics.CreateScope("ConfigurationGroupSchemaResource.Delete"); + scope.Start(); + try + { + var response = _configurationGroupSchemaRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + var operation = new HybridNetworkArmOperation(_configurationGroupSchemaClientDiagnostics, Pipeline, _configurationGroupSchemaRestClient.CreateDeleteRequest(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; + } + } + + /// + /// Updates a configuration group schema resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/configurationGroupSchemas/{configurationGroupSchemaName} + /// + /// + /// Operation Id + /// ConfigurationGroupSchemas_Update + /// + /// + /// + /// Parameters supplied to the create or update network service design version operation. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(TagsObject tagsObject, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tagsObject, nameof(tagsObject)); + + using var scope = _configurationGroupSchemaClientDiagnostics.CreateScope("ConfigurationGroupSchemaResource.Update"); + scope.Start(); + try + { + var response = await _configurationGroupSchemaRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, tagsObject, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new ConfigurationGroupSchemaResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Updates a configuration group schema resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/configurationGroupSchemas/{configurationGroupSchemaName} + /// + /// + /// Operation Id + /// ConfigurationGroupSchemas_Update + /// + /// + /// + /// Parameters supplied to the create or update network service design version operation. + /// The cancellation token to use. + /// is null. + public virtual Response Update(TagsObject tagsObject, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tagsObject, nameof(tagsObject)); + + using var scope = _configurationGroupSchemaClientDiagnostics.CreateScope("ConfigurationGroupSchemaResource.Update"); + scope.Start(); + try + { + var response = _configurationGroupSchemaRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, tagsObject, cancellationToken); + return Response.FromValue(new ConfigurationGroupSchemaResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Update configuration group schema state. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/configurationGroupSchemas/{configurationGroupSchemaName}/updateState + /// + /// + /// Operation Id + /// ConfigurationGroupSchemas_updateState + /// + /// + /// + /// 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. + /// Parameters supplied to update the state of configuration group schema. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateStateAsync(WaitUntil waitUntil, ConfigurationGroupSchemaVersionUpdateState configurationGroupSchemaVersionUpdateState, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(configurationGroupSchemaVersionUpdateState, nameof(configurationGroupSchemaVersionUpdateState)); + + using var scope = _configurationGroupSchemaClientDiagnostics.CreateScope("ConfigurationGroupSchemaResource.UpdateState"); + scope.Start(); + try + { + var response = await _configurationGroupSchemaRestClient.UpdateStateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, configurationGroupSchemaVersionUpdateState, cancellationToken).ConfigureAwait(false); + var operation = new HybridNetworkArmOperation(new ConfigurationGroupSchemaVersionUpdateStateOperationSource(), _configurationGroupSchemaClientDiagnostics, Pipeline, _configurationGroupSchemaRestClient.CreateUpdateStateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, configurationGroupSchemaVersionUpdateState).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Update configuration group schema state. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/configurationGroupSchemas/{configurationGroupSchemaName}/updateState + /// + /// + /// Operation Id + /// ConfigurationGroupSchemas_updateState + /// + /// + /// + /// 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. + /// Parameters supplied to update the state of configuration group schema. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation UpdateState(WaitUntil waitUntil, ConfigurationGroupSchemaVersionUpdateState configurationGroupSchemaVersionUpdateState, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(configurationGroupSchemaVersionUpdateState, nameof(configurationGroupSchemaVersionUpdateState)); + + using var scope = _configurationGroupSchemaClientDiagnostics.CreateScope("ConfigurationGroupSchemaResource.UpdateState"); + scope.Start(); + try + { + var response = _configurationGroupSchemaRestClient.UpdateState(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, configurationGroupSchemaVersionUpdateState, cancellationToken); + var operation = new HybridNetworkArmOperation(new ConfigurationGroupSchemaVersionUpdateStateOperationSource(), _configurationGroupSchemaClientDiagnostics, Pipeline, _configurationGroupSchemaRestClient.CreateUpdateStateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, configurationGroupSchemaVersionUpdateState).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.HybridNetwork/publishers/{publisherName}/configurationGroupSchemas/{configurationGroupSchemaName} + /// + /// + /// Operation Id + /// ConfigurationGroupSchemas_Get + /// + /// + /// + /// 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 = _configurationGroupSchemaClientDiagnostics.CreateScope("ConfigurationGroupSchemaResource.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 _configurationGroupSchemaRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new ConfigurationGroupSchemaResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new TagsObject(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags[key] = value; + var result = await UpdateAsync(patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return result; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Add a tag to the current resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/configurationGroupSchemas/{configurationGroupSchemaName} + /// + /// + /// Operation Id + /// ConfigurationGroupSchemas_Get + /// + /// + /// + /// 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 = _configurationGroupSchemaClientDiagnostics.CreateScope("ConfigurationGroupSchemaResource.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 = _configurationGroupSchemaRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + return Response.FromValue(new ConfigurationGroupSchemaResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new TagsObject(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags[key] = value; + var result = Update(patch, cancellationToken: cancellationToken); + return result; + } + } + 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.HybridNetwork/publishers/{publisherName}/configurationGroupSchemas/{configurationGroupSchemaName} + /// + /// + /// Operation Id + /// ConfigurationGroupSchemas_Get + /// + /// + /// + /// 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 = _configurationGroupSchemaClientDiagnostics.CreateScope("ConfigurationGroupSchemaResource.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 _configurationGroupSchemaRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new ConfigurationGroupSchemaResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new TagsObject(); + patch.Tags.ReplaceWith(tags); + var result = await UpdateAsync(patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return result; + } + } + 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.HybridNetwork/publishers/{publisherName}/configurationGroupSchemas/{configurationGroupSchemaName} + /// + /// + /// Operation Id + /// ConfigurationGroupSchemas_Get + /// + /// + /// + /// 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 = _configurationGroupSchemaClientDiagnostics.CreateScope("ConfigurationGroupSchemaResource.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 = _configurationGroupSchemaRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + return Response.FromValue(new ConfigurationGroupSchemaResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new TagsObject(); + patch.Tags.ReplaceWith(tags); + var result = Update(patch, cancellationToken: cancellationToken); + return result; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Removes a tag by key from the resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/configurationGroupSchemas/{configurationGroupSchemaName} + /// + /// + /// Operation Id + /// ConfigurationGroupSchemas_Get + /// + /// + /// + /// 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 = _configurationGroupSchemaClientDiagnostics.CreateScope("ConfigurationGroupSchemaResource.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 _configurationGroupSchemaRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new ConfigurationGroupSchemaResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new TagsObject(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags.Remove(key); + var result = await UpdateAsync(patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return result; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Removes a tag by key from the resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/configurationGroupSchemas/{configurationGroupSchemaName} + /// + /// + /// Operation Id + /// ConfigurationGroupSchemas_Get + /// + /// + /// + /// 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 = _configurationGroupSchemaClientDiagnostics.CreateScope("ConfigurationGroupSchemaResource.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 = _configurationGroupSchemaRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + return Response.FromValue(new ConfigurationGroupSchemaResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new TagsObject(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags.Remove(key); + var result = Update(patch, cancellationToken: cancellationToken); + return result; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/ConfigurationGroupValueCollection.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/ConfigurationGroupValueCollection.cs new file mode 100644 index 000000000000..d26a73bbd4e9 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/ConfigurationGroupValueCollection.cs @@ -0,0 +1,416 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.HybridNetwork +{ + /// + /// 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 GetConfigurationGroupValues method from an instance of . + /// + public partial class ConfigurationGroupValueCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _configurationGroupValueClientDiagnostics; + private readonly ConfigurationGroupValuesRestOperations _configurationGroupValueRestClient; + + /// Initializes a new instance of the class for mocking. + protected ConfigurationGroupValueCollection() + { + } + + /// 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 ConfigurationGroupValueCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _configurationGroupValueClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.HybridNetwork", ConfigurationGroupValueResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ConfigurationGroupValueResource.ResourceType, out string configurationGroupValueApiVersion); + _configurationGroupValueRestClient = new ConfigurationGroupValuesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, configurationGroupValueApiVersion); +#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)); + } + + /// + /// Creates or updates a hybrid configuration group value. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/configurationGroupValues/{configurationGroupValueName} + /// + /// + /// Operation Id + /// ConfigurationGroupValues_CreateOrUpdate + /// + /// + /// + /// 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 configuration group value. + /// Parameters supplied to the create or update configuration group value resource. + /// 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 configurationGroupValueName, ConfigurationGroupValueData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(configurationGroupValueName, nameof(configurationGroupValueName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _configurationGroupValueClientDiagnostics.CreateScope("ConfigurationGroupValueCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _configurationGroupValueRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, configurationGroupValueName, data, cancellationToken).ConfigureAwait(false); + var operation = new HybridNetworkArmOperation(new ConfigurationGroupValueOperationSource(Client), _configurationGroupValueClientDiagnostics, Pipeline, _configurationGroupValueRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, configurationGroupValueName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates or updates a hybrid configuration group value. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/configurationGroupValues/{configurationGroupValueName} + /// + /// + /// Operation Id + /// ConfigurationGroupValues_CreateOrUpdate + /// + /// + /// + /// 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 configuration group value. + /// Parameters supplied to the create or update configuration group value resource. + /// 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 configurationGroupValueName, ConfigurationGroupValueData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(configurationGroupValueName, nameof(configurationGroupValueName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _configurationGroupValueClientDiagnostics.CreateScope("ConfigurationGroupValueCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _configurationGroupValueRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, configurationGroupValueName, data, cancellationToken); + var operation = new HybridNetworkArmOperation(new ConfigurationGroupValueOperationSource(Client), _configurationGroupValueClientDiagnostics, Pipeline, _configurationGroupValueRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, configurationGroupValueName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets information about the specified hybrid configuration group values. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/configurationGroupValues/{configurationGroupValueName} + /// + /// + /// Operation Id + /// ConfigurationGroupValues_Get + /// + /// + /// + /// The name of the configuration group value. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string configurationGroupValueName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(configurationGroupValueName, nameof(configurationGroupValueName)); + + using var scope = _configurationGroupValueClientDiagnostics.CreateScope("ConfigurationGroupValueCollection.Get"); + scope.Start(); + try + { + var response = await _configurationGroupValueRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, configurationGroupValueName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ConfigurationGroupValueResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets information about the specified hybrid configuration group values. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/configurationGroupValues/{configurationGroupValueName} + /// + /// + /// Operation Id + /// ConfigurationGroupValues_Get + /// + /// + /// + /// The name of the configuration group value. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string configurationGroupValueName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(configurationGroupValueName, nameof(configurationGroupValueName)); + + using var scope = _configurationGroupValueClientDiagnostics.CreateScope("ConfigurationGroupValueCollection.Get"); + scope.Start(); + try + { + var response = _configurationGroupValueRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, configurationGroupValueName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ConfigurationGroupValueResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Lists all the hybrid network configurationGroupValues in a resource group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/configurationGroupValues + /// + /// + /// Operation Id + /// ConfigurationGroupValues_ListByResourceGroup + /// + /// + /// + /// 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) => _configurationGroupValueRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _configurationGroupValueRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ConfigurationGroupValueResource(Client, ConfigurationGroupValueData.DeserializeConfigurationGroupValueData(e)), _configurationGroupValueClientDiagnostics, Pipeline, "ConfigurationGroupValueCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Lists all the hybrid network configurationGroupValues in a resource group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/configurationGroupValues + /// + /// + /// Operation Id + /// ConfigurationGroupValues_ListByResourceGroup + /// + /// + /// + /// 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) => _configurationGroupValueRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _configurationGroupValueRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ConfigurationGroupValueResource(Client, ConfigurationGroupValueData.DeserializeConfigurationGroupValueData(e)), _configurationGroupValueClientDiagnostics, Pipeline, "ConfigurationGroupValueCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/configurationGroupValues/{configurationGroupValueName} + /// + /// + /// Operation Id + /// ConfigurationGroupValues_Get + /// + /// + /// + /// The name of the configuration group value. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string configurationGroupValueName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(configurationGroupValueName, nameof(configurationGroupValueName)); + + using var scope = _configurationGroupValueClientDiagnostics.CreateScope("ConfigurationGroupValueCollection.Exists"); + scope.Start(); + try + { + var response = await _configurationGroupValueRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, configurationGroupValueName, 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.HybridNetwork/configurationGroupValues/{configurationGroupValueName} + /// + /// + /// Operation Id + /// ConfigurationGroupValues_Get + /// + /// + /// + /// The name of the configuration group value. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string configurationGroupValueName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(configurationGroupValueName, nameof(configurationGroupValueName)); + + using var scope = _configurationGroupValueClientDiagnostics.CreateScope("ConfigurationGroupValueCollection.Exists"); + scope.Start(); + try + { + var response = _configurationGroupValueRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, configurationGroupValueName, 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.HybridNetwork/configurationGroupValues/{configurationGroupValueName} + /// + /// + /// Operation Id + /// ConfigurationGroupValues_Get + /// + /// + /// + /// The name of the configuration group value. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string configurationGroupValueName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(configurationGroupValueName, nameof(configurationGroupValueName)); + + using var scope = _configurationGroupValueClientDiagnostics.CreateScope("ConfigurationGroupValueCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _configurationGroupValueRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, configurationGroupValueName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ConfigurationGroupValueResource(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.HybridNetwork/configurationGroupValues/{configurationGroupValueName} + /// + /// + /// Operation Id + /// ConfigurationGroupValues_Get + /// + /// + /// + /// The name of the configuration group value. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string configurationGroupValueName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(configurationGroupValueName, nameof(configurationGroupValueName)); + + using var scope = _configurationGroupValueClientDiagnostics.CreateScope("ConfigurationGroupValueCollection.GetIfExists"); + scope.Start(); + try + { + var response = _configurationGroupValueRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, configurationGroupValueName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ConfigurationGroupValueResource(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/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/ConfigurationGroupValueData.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/ConfigurationGroupValueData.cs new file mode 100644 index 000000000000..a3b804a43be9 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/ConfigurationGroupValueData.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.HybridNetwork.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.HybridNetwork +{ + /// + /// A class representing the ConfigurationGroupValue data model. + /// Hybrid configuration group value resource. + /// + public partial class ConfigurationGroupValueData : TrackedResourceData + { + /// Initializes a new instance of ConfigurationGroupValueData. + /// The location. + public ConfigurationGroupValueData(AzureLocation location) : base(location) + { + } + + /// Initializes a new instance of ConfigurationGroupValueData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The tags. + /// The location. + /// + /// Hybrid configuration group value properties. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include and . + /// + internal ConfigurationGroupValueData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ConfigurationGroupValuePropertiesFormat properties) : base(id, name, resourceType, systemData, tags, location) + { + Properties = properties; + } + + /// + /// Hybrid configuration group value properties. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include and . + /// + public ConfigurationGroupValuePropertiesFormat Properties { get; set; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/ConfigurationGroupValueResource.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/ConfigurationGroupValueResource.cs new file mode 100644 index 000000000000..d2ec17d37f05 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/ConfigurationGroupValueResource.cs @@ -0,0 +1,602 @@ +// 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; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.HybridNetwork.Models; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.HybridNetwork +{ + /// + /// A Class representing a ConfigurationGroupValue 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 GetConfigurationGroupValueResource method. + /// Otherwise you can get one from its parent resource using the GetConfigurationGroupValue method. + /// + public partial class ConfigurationGroupValueResource : ArmResource + { + /// Generate the resource identifier of a instance. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string configurationGroupValueName) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/configurationGroupValues/{configurationGroupValueName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _configurationGroupValueClientDiagnostics; + private readonly ConfigurationGroupValuesRestOperations _configurationGroupValueRestClient; + private readonly ConfigurationGroupValueData _data; + + /// Initializes a new instance of the class for mocking. + protected ConfigurationGroupValueResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal ConfigurationGroupValueResource(ArmClient client, ConfigurationGroupValueData 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 ConfigurationGroupValueResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _configurationGroupValueClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.HybridNetwork", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string configurationGroupValueApiVersion); + _configurationGroupValueRestClient = new ConfigurationGroupValuesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, configurationGroupValueApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.HybridNetwork/configurationGroupValues"; + + /// 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 ConfigurationGroupValueData 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 information about the specified hybrid configuration group values. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/configurationGroupValues/{configurationGroupValueName} + /// + /// + /// Operation Id + /// ConfigurationGroupValues_Get + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _configurationGroupValueClientDiagnostics.CreateScope("ConfigurationGroupValueResource.Get"); + scope.Start(); + try + { + var response = await _configurationGroupValueRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ConfigurationGroupValueResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets information about the specified hybrid configuration group values. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/configurationGroupValues/{configurationGroupValueName} + /// + /// + /// Operation Id + /// ConfigurationGroupValues_Get + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _configurationGroupValueClientDiagnostics.CreateScope("ConfigurationGroupValueResource.Get"); + scope.Start(); + try + { + var response = _configurationGroupValueRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ConfigurationGroupValueResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes the specified hybrid configuration group value. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/configurationGroupValues/{configurationGroupValueName} + /// + /// + /// Operation Id + /// ConfigurationGroupValues_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _configurationGroupValueClientDiagnostics.CreateScope("ConfigurationGroupValueResource.Delete"); + scope.Start(); + try + { + var response = await _configurationGroupValueRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new HybridNetworkArmOperation(_configurationGroupValueClientDiagnostics, Pipeline, _configurationGroupValueRestClient.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; + } + } + + /// + /// Deletes the specified hybrid configuration group value. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/configurationGroupValues/{configurationGroupValueName} + /// + /// + /// Operation Id + /// ConfigurationGroupValues_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _configurationGroupValueClientDiagnostics.CreateScope("ConfigurationGroupValueResource.Delete"); + scope.Start(); + try + { + var response = _configurationGroupValueRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + var operation = new HybridNetworkArmOperation(_configurationGroupValueClientDiagnostics, Pipeline, _configurationGroupValueRestClient.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; + } + } + + /// + /// Updates a hybrid configuration group tags. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/configurationGroupValues/{configurationGroupValueName} + /// + /// + /// Operation Id + /// ConfigurationGroupValues_UpdateTags + /// + /// + /// + /// Parameters supplied to update configuration group values tags. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(TagsObject tagsObject, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tagsObject, nameof(tagsObject)); + + using var scope = _configurationGroupValueClientDiagnostics.CreateScope("ConfigurationGroupValueResource.Update"); + scope.Start(); + try + { + var response = await _configurationGroupValueRestClient.UpdateTagsAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, tagsObject, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new ConfigurationGroupValueResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Updates a hybrid configuration group tags. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/configurationGroupValues/{configurationGroupValueName} + /// + /// + /// Operation Id + /// ConfigurationGroupValues_UpdateTags + /// + /// + /// + /// Parameters supplied to update configuration group values tags. + /// The cancellation token to use. + /// is null. + public virtual Response Update(TagsObject tagsObject, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tagsObject, nameof(tagsObject)); + + using var scope = _configurationGroupValueClientDiagnostics.CreateScope("ConfigurationGroupValueResource.Update"); + scope.Start(); + try + { + var response = _configurationGroupValueRestClient.UpdateTags(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, tagsObject, cancellationToken); + return Response.FromValue(new ConfigurationGroupValueResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Add a tag to the current resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/configurationGroupValues/{configurationGroupValueName} + /// + /// + /// Operation Id + /// ConfigurationGroupValues_Get + /// + /// + /// + /// 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 = _configurationGroupValueClientDiagnostics.CreateScope("ConfigurationGroupValueResource.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 _configurationGroupValueRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new ConfigurationGroupValueResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new TagsObject(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags[key] = value; + var result = await UpdateAsync(patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return result; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Add a tag to the current resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/configurationGroupValues/{configurationGroupValueName} + /// + /// + /// Operation Id + /// ConfigurationGroupValues_Get + /// + /// + /// + /// 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 = _configurationGroupValueClientDiagnostics.CreateScope("ConfigurationGroupValueResource.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 = _configurationGroupValueRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + return Response.FromValue(new ConfigurationGroupValueResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new TagsObject(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags[key] = value; + var result = Update(patch, cancellationToken: cancellationToken); + return result; + } + } + 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.HybridNetwork/configurationGroupValues/{configurationGroupValueName} + /// + /// + /// Operation Id + /// ConfigurationGroupValues_Get + /// + /// + /// + /// 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 = _configurationGroupValueClientDiagnostics.CreateScope("ConfigurationGroupValueResource.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 _configurationGroupValueRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new ConfigurationGroupValueResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new TagsObject(); + patch.Tags.ReplaceWith(tags); + var result = await UpdateAsync(patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return result; + } + } + 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.HybridNetwork/configurationGroupValues/{configurationGroupValueName} + /// + /// + /// Operation Id + /// ConfigurationGroupValues_Get + /// + /// + /// + /// 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 = _configurationGroupValueClientDiagnostics.CreateScope("ConfigurationGroupValueResource.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 = _configurationGroupValueRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + return Response.FromValue(new ConfigurationGroupValueResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new TagsObject(); + patch.Tags.ReplaceWith(tags); + var result = Update(patch, cancellationToken: cancellationToken); + return result; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Removes a tag by key from the resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/configurationGroupValues/{configurationGroupValueName} + /// + /// + /// Operation Id + /// ConfigurationGroupValues_Get + /// + /// + /// + /// 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 = _configurationGroupValueClientDiagnostics.CreateScope("ConfigurationGroupValueResource.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 _configurationGroupValueRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new ConfigurationGroupValueResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new TagsObject(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags.Remove(key); + var result = await UpdateAsync(patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return result; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Removes a tag by key from the resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/configurationGroupValues/{configurationGroupValueName} + /// + /// + /// Operation Id + /// ConfigurationGroupValues_Get + /// + /// + /// + /// 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 = _configurationGroupValueClientDiagnostics.CreateScope("ConfigurationGroupValueResource.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 = _configurationGroupValueRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + return Response.FromValue(new ConfigurationGroupValueResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new TagsObject(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags.Remove(key); + var result = Update(patch, cancellationToken: cancellationToken); + return result; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Extensions/HybridNetworkExtensions.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Extensions/HybridNetworkExtensions.cs new file mode 100644 index 000000000000..25747d0c82db --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Extensions/HybridNetworkExtensions.cs @@ -0,0 +1,789 @@ +// 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; +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.HybridNetwork +{ + /// A class to add extension methods to Azure.ResourceManager.HybridNetwork. + public static partial class HybridNetworkExtensions + { + private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmResource resource) + { + return resource.GetCachedClient(client => + { + return new ResourceGroupResourceExtensionClient(client, resource.Id); + }); + } + + private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + { + return client.GetResourceClient(() => + { + return new ResourceGroupResourceExtensionClient(client, scope); + }); + } + + private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmResource resource) + { + return resource.GetCachedClient(client => + { + return new SubscriptionResourceExtensionClient(client, resource.Id); + }); + } + + private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + { + return client.GetResourceClient(() => + { + return new SubscriptionResourceExtensionClient(client, scope); + }); + } + #region ConfigurationGroupSchemaResource + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static ConfigurationGroupSchemaResource GetConfigurationGroupSchemaResource(this ArmClient client, ResourceIdentifier id) + { + return client.GetResourceClient(() => + { + ConfigurationGroupSchemaResource.ValidateResourceId(id); + return new ConfigurationGroupSchemaResource(client, id); + } + ); + } + #endregion + + #region ConfigurationGroupValueResource + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static ConfigurationGroupValueResource GetConfigurationGroupValueResource(this ArmClient client, ResourceIdentifier id) + { + return client.GetResourceClient(() => + { + ConfigurationGroupValueResource.ValidateResourceId(id); + return new ConfigurationGroupValueResource(client, id); + } + ); + } + #endregion + + #region NetworkFunctionResource + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static NetworkFunctionResource GetNetworkFunctionResource(this ArmClient client, ResourceIdentifier id) + { + return client.GetResourceClient(() => + { + NetworkFunctionResource.ValidateResourceId(id); + return new NetworkFunctionResource(client, id); + } + ); + } + #endregion + + #region ComponentResource + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static ComponentResource GetComponentResource(this ArmClient client, ResourceIdentifier id) + { + return client.GetResourceClient(() => + { + ComponentResource.ValidateResourceId(id); + return new ComponentResource(client, id); + } + ); + } + #endregion + + #region NetworkFunctionDefinitionGroupResource + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static NetworkFunctionDefinitionGroupResource GetNetworkFunctionDefinitionGroupResource(this ArmClient client, ResourceIdentifier id) + { + return client.GetResourceClient(() => + { + NetworkFunctionDefinitionGroupResource.ValidateResourceId(id); + return new NetworkFunctionDefinitionGroupResource(client, id); + } + ); + } + #endregion + + #region NetworkFunctionDefinitionVersionResource + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static NetworkFunctionDefinitionVersionResource GetNetworkFunctionDefinitionVersionResource(this ArmClient client, ResourceIdentifier id) + { + return client.GetResourceClient(() => + { + NetworkFunctionDefinitionVersionResource.ValidateResourceId(id); + return new NetworkFunctionDefinitionVersionResource(client, id); + } + ); + } + #endregion + + #region NetworkServiceDesignGroupResource + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static NetworkServiceDesignGroupResource GetNetworkServiceDesignGroupResource(this ArmClient client, ResourceIdentifier id) + { + return client.GetResourceClient(() => + { + NetworkServiceDesignGroupResource.ValidateResourceId(id); + return new NetworkServiceDesignGroupResource(client, id); + } + ); + } + #endregion + + #region NetworkServiceDesignVersionResource + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static NetworkServiceDesignVersionResource GetNetworkServiceDesignVersionResource(this ArmClient client, ResourceIdentifier id) + { + return client.GetResourceClient(() => + { + NetworkServiceDesignVersionResource.ValidateResourceId(id); + return new NetworkServiceDesignVersionResource(client, id); + } + ); + } + #endregion + + #region PublisherResource + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static PublisherResource GetPublisherResource(this ArmClient client, ResourceIdentifier id) + { + return client.GetResourceClient(() => + { + PublisherResource.ValidateResourceId(id); + return new PublisherResource(client, id); + } + ); + } + #endregion + + #region ArtifactStoreResource + /// + /// Gets an object representing an along with the instance operations that can be performed on it but with no data. + /// You can use to create an from its components. + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static ArtifactStoreResource GetArtifactStoreResource(this ArmClient client, ResourceIdentifier id) + { + return client.GetResourceClient(() => + { + ArtifactStoreResource.ValidateResourceId(id); + return new ArtifactStoreResource(client, id); + } + ); + } + #endregion + + #region ArtifactManifestResource + /// + /// Gets an object representing an along with the instance operations that can be performed on it but with no data. + /// You can use to create an from its components. + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static ArtifactManifestResource GetArtifactManifestResource(this ArmClient client, ResourceIdentifier id) + { + return client.GetResourceClient(() => + { + ArtifactManifestResource.ValidateResourceId(id); + return new ArtifactManifestResource(client, id); + } + ); + } + #endregion + + #region SiteResource + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static SiteResource GetSiteResource(this ArmClient client, ResourceIdentifier id) + { + return client.GetResourceClient(() => + { + SiteResource.ValidateResourceId(id); + return new SiteResource(client, id); + } + ); + } + #endregion + + #region SiteNetworkServiceResource + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static SiteNetworkServiceResource GetSiteNetworkServiceResource(this ArmClient client, ResourceIdentifier id) + { + return client.GetResourceClient(() => + { + SiteNetworkServiceResource.ValidateResourceId(id); + return new SiteNetworkServiceResource(client, id); + } + ); + } + #endregion + + /// Gets a collection of ConfigurationGroupValueResources in the ResourceGroupResource. + /// The instance the method will execute against. + /// An object representing collection of ConfigurationGroupValueResources and their operations over a ConfigurationGroupValueResource. + public static ConfigurationGroupValueCollection GetConfigurationGroupValues(this ResourceGroupResource resourceGroupResource) + { + return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetConfigurationGroupValues(); + } + + /// + /// Gets information about the specified hybrid configuration group values. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/configurationGroupValues/{configurationGroupValueName} + /// + /// + /// Operation Id + /// ConfigurationGroupValues_Get + /// + /// + /// + /// The instance the method will execute against. + /// The name of the configuration group value. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public static async Task> GetConfigurationGroupValueAsync(this ResourceGroupResource resourceGroupResource, string configurationGroupValueName, CancellationToken cancellationToken = default) + { + return await resourceGroupResource.GetConfigurationGroupValues().GetAsync(configurationGroupValueName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets information about the specified hybrid configuration group values. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/configurationGroupValues/{configurationGroupValueName} + /// + /// + /// Operation Id + /// ConfigurationGroupValues_Get + /// + /// + /// + /// The instance the method will execute against. + /// The name of the configuration group value. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public static Response GetConfigurationGroupValue(this ResourceGroupResource resourceGroupResource, string configurationGroupValueName, CancellationToken cancellationToken = default) + { + return resourceGroupResource.GetConfigurationGroupValues().Get(configurationGroupValueName, cancellationToken); + } + + /// Gets a collection of NetworkFunctionResources in the ResourceGroupResource. + /// The instance the method will execute against. + /// An object representing collection of NetworkFunctionResources and their operations over a NetworkFunctionResource. + public static NetworkFunctionCollection GetNetworkFunctions(this ResourceGroupResource resourceGroupResource) + { + return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetNetworkFunctions(); + } + + /// + /// Gets information about the specified network function resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/networkFunctions/{networkFunctionName} + /// + /// + /// Operation Id + /// NetworkFunctions_Get + /// + /// + /// + /// The instance the method will execute against. + /// The name of the network function resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public static async Task> GetNetworkFunctionAsync(this ResourceGroupResource resourceGroupResource, string networkFunctionName, CancellationToken cancellationToken = default) + { + return await resourceGroupResource.GetNetworkFunctions().GetAsync(networkFunctionName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets information about the specified network function resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/networkFunctions/{networkFunctionName} + /// + /// + /// Operation Id + /// NetworkFunctions_Get + /// + /// + /// + /// The instance the method will execute against. + /// The name of the network function resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public static Response GetNetworkFunction(this ResourceGroupResource resourceGroupResource, string networkFunctionName, CancellationToken cancellationToken = default) + { + return resourceGroupResource.GetNetworkFunctions().Get(networkFunctionName, cancellationToken); + } + + /// Gets a collection of PublisherResources in the ResourceGroupResource. + /// The instance the method will execute against. + /// An object representing collection of PublisherResources and their operations over a PublisherResource. + public static PublisherCollection GetPublishers(this ResourceGroupResource resourceGroupResource) + { + return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetPublishers(); + } + + /// + /// Gets information about the specified publisher. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName} + /// + /// + /// Operation Id + /// Publishers_Get + /// + /// + /// + /// The instance the method will execute against. + /// The name of the publisher. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public static async Task> GetPublisherAsync(this ResourceGroupResource resourceGroupResource, string publisherName, CancellationToken cancellationToken = default) + { + return await resourceGroupResource.GetPublishers().GetAsync(publisherName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets information about the specified publisher. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName} + /// + /// + /// Operation Id + /// Publishers_Get + /// + /// + /// + /// The instance the method will execute against. + /// The name of the publisher. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public static Response GetPublisher(this ResourceGroupResource resourceGroupResource, string publisherName, CancellationToken cancellationToken = default) + { + return resourceGroupResource.GetPublishers().Get(publisherName, cancellationToken); + } + + /// Gets a collection of SiteResources in the ResourceGroupResource. + /// The instance the method will execute against. + /// An object representing collection of SiteResources and their operations over a SiteResource. + public static SiteCollection GetSites(this ResourceGroupResource resourceGroupResource) + { + return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetSites(); + } + + /// + /// Gets information about the specified network site. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/sites/{siteName} + /// + /// + /// Operation Id + /// Sites_Get + /// + /// + /// + /// The instance the method will execute against. + /// The name of the network service site. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public static async Task> GetSiteAsync(this ResourceGroupResource resourceGroupResource, string siteName, CancellationToken cancellationToken = default) + { + return await resourceGroupResource.GetSites().GetAsync(siteName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets information about the specified network site. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/sites/{siteName} + /// + /// + /// Operation Id + /// Sites_Get + /// + /// + /// + /// The instance the method will execute against. + /// The name of the network service site. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public static Response GetSite(this ResourceGroupResource resourceGroupResource, string siteName, CancellationToken cancellationToken = default) + { + return resourceGroupResource.GetSites().Get(siteName, cancellationToken); + } + + /// Gets a collection of SiteNetworkServiceResources in the ResourceGroupResource. + /// The instance the method will execute against. + /// An object representing collection of SiteNetworkServiceResources and their operations over a SiteNetworkServiceResource. + public static SiteNetworkServiceCollection GetSiteNetworkServices(this ResourceGroupResource resourceGroupResource) + { + return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetSiteNetworkServices(); + } + + /// + /// Gets information about the specified site network service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/siteNetworkServices/{siteNetworkServiceName} + /// + /// + /// Operation Id + /// SiteNetworkServices_Get + /// + /// + /// + /// The instance the method will execute against. + /// The name of the site network service. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public static async Task> GetSiteNetworkServiceAsync(this ResourceGroupResource resourceGroupResource, string siteNetworkServiceName, CancellationToken cancellationToken = default) + { + return await resourceGroupResource.GetSiteNetworkServices().GetAsync(siteNetworkServiceName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets information about the specified site network service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/siteNetworkServices/{siteNetworkServiceName} + /// + /// + /// Operation Id + /// SiteNetworkServices_Get + /// + /// + /// + /// The instance the method will execute against. + /// The name of the site network service. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public static Response GetSiteNetworkService(this ResourceGroupResource resourceGroupResource, string siteNetworkServiceName, CancellationToken cancellationToken = default) + { + return resourceGroupResource.GetSiteNetworkServices().Get(siteNetworkServiceName, cancellationToken); + } + + /// + /// Lists all sites in the configuration group value in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/configurationGroupValues + /// + /// + /// Operation Id + /// ConfigurationGroupValues_ListBySubscription + /// + /// + /// + /// The instance the method will execute against. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public static AsyncPageable GetConfigurationGroupValuesAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) + { + return GetSubscriptionResourceExtensionClient(subscriptionResource).GetConfigurationGroupValuesAsync(cancellationToken); + } + + /// + /// Lists all sites in the configuration group value in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/configurationGroupValues + /// + /// + /// Operation Id + /// ConfigurationGroupValues_ListBySubscription + /// + /// + /// + /// The instance the method will execute against. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public static Pageable GetConfigurationGroupValues(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) + { + return GetSubscriptionResourceExtensionClient(subscriptionResource).GetConfigurationGroupValues(cancellationToken); + } + + /// + /// Lists all the network functions in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/networkFunctions + /// + /// + /// Operation Id + /// NetworkFunctions_ListBySubscription + /// + /// + /// + /// The instance the method will execute against. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public static AsyncPageable GetNetworkFunctionsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) + { + return GetSubscriptionResourceExtensionClient(subscriptionResource).GetNetworkFunctionsAsync(cancellationToken); + } + + /// + /// Lists all the network functions in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/networkFunctions + /// + /// + /// Operation Id + /// NetworkFunctions_ListBySubscription + /// + /// + /// + /// The instance the method will execute against. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public static Pageable GetNetworkFunctions(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) + { + return GetSubscriptionResourceExtensionClient(subscriptionResource).GetNetworkFunctions(cancellationToken); + } + + /// + /// Lists all the publishers in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/publishers + /// + /// + /// Operation Id + /// Publishers_ListBySubscription + /// + /// + /// + /// The instance the method will execute against. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public static AsyncPageable GetPublishersAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) + { + return GetSubscriptionResourceExtensionClient(subscriptionResource).GetPublishersAsync(cancellationToken); + } + + /// + /// Lists all the publishers in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/publishers + /// + /// + /// Operation Id + /// Publishers_ListBySubscription + /// + /// + /// + /// The instance the method will execute against. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public static Pageable GetPublishers(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) + { + return GetSubscriptionResourceExtensionClient(subscriptionResource).GetPublishers(cancellationToken); + } + + /// + /// Lists all sites in the network service in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/sites + /// + /// + /// Operation Id + /// Sites_ListBySubscription + /// + /// + /// + /// The instance the method will execute against. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public static AsyncPageable GetSitesAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) + { + return GetSubscriptionResourceExtensionClient(subscriptionResource).GetSitesAsync(cancellationToken); + } + + /// + /// Lists all sites in the network service in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/sites + /// + /// + /// Operation Id + /// Sites_ListBySubscription + /// + /// + /// + /// The instance the method will execute against. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public static Pageable GetSites(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) + { + return GetSubscriptionResourceExtensionClient(subscriptionResource).GetSites(cancellationToken); + } + + /// + /// Lists all sites in the network service in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/siteNetworkServices + /// + /// + /// Operation Id + /// SiteNetworkServices_ListBySubscription + /// + /// + /// + /// The instance the method will execute against. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public static AsyncPageable GetSiteNetworkServicesAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) + { + return GetSubscriptionResourceExtensionClient(subscriptionResource).GetSiteNetworkServicesAsync(cancellationToken); + } + + /// + /// Lists all sites in the network service in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/siteNetworkServices + /// + /// + /// Operation Id + /// SiteNetworkServices_ListBySubscription + /// + /// + /// + /// The instance the method will execute against. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public static Pageable GetSiteNetworkServices(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) + { + return GetSubscriptionResourceExtensionClient(subscriptionResource).GetSiteNetworkServices(cancellationToken); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs new file mode 100644 index 000000000000..685cf98a5c50 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.HybridNetwork +{ + /// A class to add extension methods to ResourceGroupResource. + internal partial class ResourceGroupResourceExtensionClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected ResourceGroupResourceExtensionClient() + { + } + + /// 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 ResourceGroupResourceExtensionClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of ConfigurationGroupValueResources in the ResourceGroupResource. + /// An object representing collection of ConfigurationGroupValueResources and their operations over a ConfigurationGroupValueResource. + public virtual ConfigurationGroupValueCollection GetConfigurationGroupValues() + { + return GetCachedClient(Client => new ConfigurationGroupValueCollection(Client, Id)); + } + + /// Gets a collection of NetworkFunctionResources in the ResourceGroupResource. + /// An object representing collection of NetworkFunctionResources and their operations over a NetworkFunctionResource. + public virtual NetworkFunctionCollection GetNetworkFunctions() + { + return GetCachedClient(Client => new NetworkFunctionCollection(Client, Id)); + } + + /// Gets a collection of PublisherResources in the ResourceGroupResource. + /// An object representing collection of PublisherResources and their operations over a PublisherResource. + public virtual PublisherCollection GetPublishers() + { + return GetCachedClient(Client => new PublisherCollection(Client, Id)); + } + + /// Gets a collection of SiteResources in the ResourceGroupResource. + /// An object representing collection of SiteResources and their operations over a SiteResource. + public virtual SiteCollection GetSites() + { + return GetCachedClient(Client => new SiteCollection(Client, Id)); + } + + /// Gets a collection of SiteNetworkServiceResources in the ResourceGroupResource. + /// An object representing collection of SiteNetworkServiceResources and their operations over a SiteNetworkServiceResource. + public virtual SiteNetworkServiceCollection GetSiteNetworkServices() + { + return GetCachedClient(Client => new SiteNetworkServiceCollection(Client, Id)); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs new file mode 100644 index 000000000000..91ab1541a0eb --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs @@ -0,0 +1,280 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Threading; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.HybridNetwork +{ + /// A class to add extension methods to SubscriptionResource. + internal partial class SubscriptionResourceExtensionClient : ArmResource + { + private ClientDiagnostics _configurationGroupValueClientDiagnostics; + private ConfigurationGroupValuesRestOperations _configurationGroupValueRestClient; + private ClientDiagnostics _networkFunctionClientDiagnostics; + private NetworkFunctionsRestOperations _networkFunctionRestClient; + private ClientDiagnostics _publisherClientDiagnostics; + private PublishersRestOperations _publisherRestClient; + private ClientDiagnostics _siteClientDiagnostics; + private SitesRestOperations _siteRestClient; + private ClientDiagnostics _siteNetworkServiceClientDiagnostics; + private SiteNetworkServicesRestOperations _siteNetworkServiceRestClient; + + /// Initializes a new instance of the class for mocking. + protected SubscriptionResourceExtensionClient() + { + } + + /// 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 SubscriptionResourceExtensionClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics ConfigurationGroupValueClientDiagnostics => _configurationGroupValueClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.HybridNetwork", ConfigurationGroupValueResource.ResourceType.Namespace, Diagnostics); + private ConfigurationGroupValuesRestOperations ConfigurationGroupValueRestClient => _configurationGroupValueRestClient ??= new ConfigurationGroupValuesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(ConfigurationGroupValueResource.ResourceType)); + private ClientDiagnostics NetworkFunctionClientDiagnostics => _networkFunctionClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.HybridNetwork", NetworkFunctionResource.ResourceType.Namespace, Diagnostics); + private NetworkFunctionsRestOperations NetworkFunctionRestClient => _networkFunctionRestClient ??= new NetworkFunctionsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(NetworkFunctionResource.ResourceType)); + private ClientDiagnostics PublisherClientDiagnostics => _publisherClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.HybridNetwork", PublisherResource.ResourceType.Namespace, Diagnostics); + private PublishersRestOperations PublisherRestClient => _publisherRestClient ??= new PublishersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(PublisherResource.ResourceType)); + private ClientDiagnostics SiteClientDiagnostics => _siteClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.HybridNetwork", SiteResource.ResourceType.Namespace, Diagnostics); + private SitesRestOperations SiteRestClient => _siteRestClient ??= new SitesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(SiteResource.ResourceType)); + private ClientDiagnostics SiteNetworkServiceClientDiagnostics => _siteNetworkServiceClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.HybridNetwork", SiteNetworkServiceResource.ResourceType.Namespace, Diagnostics); + private SiteNetworkServicesRestOperations SiteNetworkServiceRestClient => _siteNetworkServiceRestClient ??= new SiteNetworkServicesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(SiteNetworkServiceResource.ResourceType)); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Lists all sites in the configuration group value in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/configurationGroupValues + /// + /// + /// Operation Id + /// ConfigurationGroupValues_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetConfigurationGroupValuesAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ConfigurationGroupValueRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ConfigurationGroupValueRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ConfigurationGroupValueResource(Client, ConfigurationGroupValueData.DeserializeConfigurationGroupValueData(e)), ConfigurationGroupValueClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetConfigurationGroupValues", "value", "nextLink", cancellationToken); + } + + /// + /// Lists all sites in the configuration group value in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/configurationGroupValues + /// + /// + /// Operation Id + /// ConfigurationGroupValues_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetConfigurationGroupValues(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ConfigurationGroupValueRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ConfigurationGroupValueRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ConfigurationGroupValueResource(Client, ConfigurationGroupValueData.DeserializeConfigurationGroupValueData(e)), ConfigurationGroupValueClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetConfigurationGroupValues", "value", "nextLink", cancellationToken); + } + + /// + /// Lists all the network functions in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/networkFunctions + /// + /// + /// Operation Id + /// NetworkFunctions_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetNetworkFunctionsAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => NetworkFunctionRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NetworkFunctionRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new NetworkFunctionResource(Client, NetworkFunctionData.DeserializeNetworkFunctionData(e)), NetworkFunctionClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetNetworkFunctions", "value", "nextLink", cancellationToken); + } + + /// + /// Lists all the network functions in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/networkFunctions + /// + /// + /// Operation Id + /// NetworkFunctions_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetNetworkFunctions(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => NetworkFunctionRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NetworkFunctionRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new NetworkFunctionResource(Client, NetworkFunctionData.DeserializeNetworkFunctionData(e)), NetworkFunctionClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetNetworkFunctions", "value", "nextLink", cancellationToken); + } + + /// + /// Lists all the publishers in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/publishers + /// + /// + /// Operation Id + /// Publishers_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetPublishersAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => PublisherRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PublisherRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new PublisherResource(Client, PublisherData.DeserializePublisherData(e)), PublisherClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetPublishers", "value", "nextLink", cancellationToken); + } + + /// + /// Lists all the publishers in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/publishers + /// + /// + /// Operation Id + /// Publishers_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetPublishers(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => PublisherRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PublisherRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new PublisherResource(Client, PublisherData.DeserializePublisherData(e)), PublisherClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetPublishers", "value", "nextLink", cancellationToken); + } + + /// + /// Lists all sites in the network service in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/sites + /// + /// + /// Operation Id + /// Sites_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetSitesAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => SiteRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SiteRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new SiteResource(Client, SiteData.DeserializeSiteData(e)), SiteClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetSites", "value", "nextLink", cancellationToken); + } + + /// + /// Lists all sites in the network service in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/sites + /// + /// + /// Operation Id + /// Sites_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetSites(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => SiteRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SiteRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new SiteResource(Client, SiteData.DeserializeSiteData(e)), SiteClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetSites", "value", "nextLink", cancellationToken); + } + + /// + /// Lists all sites in the network service in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/siteNetworkServices + /// + /// + /// Operation Id + /// SiteNetworkServices_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetSiteNetworkServicesAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => SiteNetworkServiceRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SiteNetworkServiceRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new SiteNetworkServiceResource(Client, SiteNetworkServiceData.DeserializeSiteNetworkServiceData(e)), SiteNetworkServiceClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetSiteNetworkServices", "value", "nextLink", cancellationToken); + } + + /// + /// Lists all sites in the network service in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/siteNetworkServices + /// + /// + /// Operation Id + /// SiteNetworkServices_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetSiteNetworkServices(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => SiteNetworkServiceRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SiteNetworkServiceRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new SiteNetworkServiceResource(Client, SiteNetworkServiceData.DeserializeSiteNetworkServiceData(e)), SiteNetworkServiceClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetSiteNetworkServices", "value", "nextLink", cancellationToken); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/LongRunningOperation/ArtifactManifestOperationSource.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/LongRunningOperation/ArtifactManifestOperationSource.cs new file mode 100644 index 000000000000..e64c6280660e --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/LongRunningOperation/ArtifactManifestOperationSource.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.HybridNetwork +{ + internal class ArtifactManifestOperationSource : IOperationSource + { + private readonly ArmClient _client; + + internal ArtifactManifestOperationSource(ArmClient client) + { + _client = client; + } + + ArtifactManifestResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + var data = ArtifactManifestData.DeserializeArtifactManifestData(document.RootElement); + return new ArtifactManifestResource(_client, data); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + var data = ArtifactManifestData.DeserializeArtifactManifestData(document.RootElement); + return new ArtifactManifestResource(_client, data); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/LongRunningOperation/ArtifactManifestUpdateStateOperationSource.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/LongRunningOperation/ArtifactManifestUpdateStateOperationSource.cs new file mode 100644 index 000000000000..f3d5c9d3e546 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/LongRunningOperation/ArtifactManifestUpdateStateOperationSource.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.ResourceManager.HybridNetwork.Models; + +namespace Azure.ResourceManager.HybridNetwork +{ + internal class ArtifactManifestUpdateStateOperationSource : IOperationSource + { + ArtifactManifestUpdateState IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + return ArtifactManifestUpdateState.DeserializeArtifactManifestUpdateState(document.RootElement); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + return ArtifactManifestUpdateState.DeserializeArtifactManifestUpdateState(document.RootElement); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/LongRunningOperation/ArtifactStoreOperationSource.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/LongRunningOperation/ArtifactStoreOperationSource.cs new file mode 100644 index 000000000000..047992f4dbc3 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/LongRunningOperation/ArtifactStoreOperationSource.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.HybridNetwork +{ + internal class ArtifactStoreOperationSource : IOperationSource + { + private readonly ArmClient _client; + + internal ArtifactStoreOperationSource(ArmClient client) + { + _client = client; + } + + ArtifactStoreResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + var data = ArtifactStoreData.DeserializeArtifactStoreData(document.RootElement); + return new ArtifactStoreResource(_client, data); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + var data = ArtifactStoreData.DeserializeArtifactStoreData(document.RootElement); + return new ArtifactStoreResource(_client, data); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/LongRunningOperation/ConfigurationGroupSchemaOperationSource.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/LongRunningOperation/ConfigurationGroupSchemaOperationSource.cs new file mode 100644 index 000000000000..dbdfe706a43d --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/LongRunningOperation/ConfigurationGroupSchemaOperationSource.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.HybridNetwork +{ + internal class ConfigurationGroupSchemaOperationSource : IOperationSource + { + private readonly ArmClient _client; + + internal ConfigurationGroupSchemaOperationSource(ArmClient client) + { + _client = client; + } + + ConfigurationGroupSchemaResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + var data = ConfigurationGroupSchemaData.DeserializeConfigurationGroupSchemaData(document.RootElement); + return new ConfigurationGroupSchemaResource(_client, data); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + var data = ConfigurationGroupSchemaData.DeserializeConfigurationGroupSchemaData(document.RootElement); + return new ConfigurationGroupSchemaResource(_client, data); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/LongRunningOperation/ConfigurationGroupSchemaVersionUpdateStateOperationSource.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/LongRunningOperation/ConfigurationGroupSchemaVersionUpdateStateOperationSource.cs new file mode 100644 index 000000000000..ae88fd24df18 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/LongRunningOperation/ConfigurationGroupSchemaVersionUpdateStateOperationSource.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.ResourceManager.HybridNetwork.Models; + +namespace Azure.ResourceManager.HybridNetwork +{ + internal class ConfigurationGroupSchemaVersionUpdateStateOperationSource : IOperationSource + { + ConfigurationGroupSchemaVersionUpdateState IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + return ConfigurationGroupSchemaVersionUpdateState.DeserializeConfigurationGroupSchemaVersionUpdateState(document.RootElement); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + return ConfigurationGroupSchemaVersionUpdateState.DeserializeConfigurationGroupSchemaVersionUpdateState(document.RootElement); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/LongRunningOperation/ConfigurationGroupValueOperationSource.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/LongRunningOperation/ConfigurationGroupValueOperationSource.cs new file mode 100644 index 000000000000..eeeb1d7bf2df --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/LongRunningOperation/ConfigurationGroupValueOperationSource.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.HybridNetwork +{ + internal class ConfigurationGroupValueOperationSource : IOperationSource + { + private readonly ArmClient _client; + + internal ConfigurationGroupValueOperationSource(ArmClient client) + { + _client = client; + } + + ConfigurationGroupValueResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + var data = ConfigurationGroupValueData.DeserializeConfigurationGroupValueData(document.RootElement); + return new ConfigurationGroupValueResource(_client, data); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + var data = ConfigurationGroupValueData.DeserializeConfigurationGroupValueData(document.RootElement); + return new ConfigurationGroupValueResource(_client, data); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/LongRunningOperation/HybridNetworkArmOperation.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/LongRunningOperation/HybridNetworkArmOperation.cs new file mode 100644 index 000000000000..bfe340a9d6ba --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/LongRunningOperation/HybridNetworkArmOperation.cs @@ -0,0 +1,70 @@ +// 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; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.HybridNetwork +{ +#pragma warning disable SA1649 // File name should match first type name + internal class HybridNetworkArmOperation : ArmOperation +#pragma warning restore SA1649 // File name should match first type name + { + private readonly OperationInternal _operation; + + /// Initializes a new instance of HybridNetworkArmOperation for mocking. + protected HybridNetworkArmOperation() + { + } + + internal HybridNetworkArmOperation(Response response) + { + _operation = OperationInternal.Succeeded(response); + } + + internal HybridNetworkArmOperation(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); + _operation = new OperationInternal(nextLinkOperation, clientDiagnostics, response, "HybridNetworkArmOperation", fallbackStrategy: new SequentialDelayStrategy()); + } + + /// +#pragma warning disable CA1822 + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public override string Id => throw new NotImplementedException(); +#pragma warning restore CA1822 + + /// + 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/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/LongRunningOperation/HybridNetworkArmOperationOfT.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/LongRunningOperation/HybridNetworkArmOperationOfT.cs new file mode 100644 index 000000000000..cde1354b2a6b --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/LongRunningOperation/HybridNetworkArmOperationOfT.cs @@ -0,0 +1,76 @@ +// 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; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.HybridNetwork +{ +#pragma warning disable SA1649 // File name should match first type name + internal class HybridNetworkArmOperation : ArmOperation +#pragma warning restore SA1649 // File name should match first type name + { + private readonly OperationInternal _operation; + + /// Initializes a new instance of HybridNetworkArmOperation for mocking. + protected HybridNetworkArmOperation() + { + } + + internal HybridNetworkArmOperation(Response response) + { + _operation = OperationInternal.Succeeded(response.GetRawResponse(), response.Value); + } + + internal HybridNetworkArmOperation(IOperationSource source, ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response, OperationFinalStateVia finalStateVia, bool skipApiVersionOverride = false, string apiVersionOverrideValue = null) + { + var nextLinkOperation = NextLinkOperationImplementation.Create(source, pipeline, request.Method, request.Uri.ToUri(), response, finalStateVia, skipApiVersionOverride, apiVersionOverrideValue); + _operation = new OperationInternal(nextLinkOperation, clientDiagnostics, response, "HybridNetworkArmOperation", fallbackStrategy: new SequentialDelayStrategy()); + } + + /// +#pragma warning disable CA1822 + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public override string Id => throw new NotImplementedException(); +#pragma warning restore CA1822 + + /// + 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/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/LongRunningOperation/NetworkFunctionDefinitionGroupOperationSource.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/LongRunningOperation/NetworkFunctionDefinitionGroupOperationSource.cs new file mode 100644 index 000000000000..90ef9146a921 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/LongRunningOperation/NetworkFunctionDefinitionGroupOperationSource.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.HybridNetwork +{ + internal class NetworkFunctionDefinitionGroupOperationSource : IOperationSource + { + private readonly ArmClient _client; + + internal NetworkFunctionDefinitionGroupOperationSource(ArmClient client) + { + _client = client; + } + + NetworkFunctionDefinitionGroupResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + var data = NetworkFunctionDefinitionGroupData.DeserializeNetworkFunctionDefinitionGroupData(document.RootElement); + return new NetworkFunctionDefinitionGroupResource(_client, data); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + var data = NetworkFunctionDefinitionGroupData.DeserializeNetworkFunctionDefinitionGroupData(document.RootElement); + return new NetworkFunctionDefinitionGroupResource(_client, data); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/LongRunningOperation/NetworkFunctionDefinitionVersionOperationSource.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/LongRunningOperation/NetworkFunctionDefinitionVersionOperationSource.cs new file mode 100644 index 000000000000..08682e389ea5 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/LongRunningOperation/NetworkFunctionDefinitionVersionOperationSource.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.HybridNetwork +{ + internal class NetworkFunctionDefinitionVersionOperationSource : IOperationSource + { + private readonly ArmClient _client; + + internal NetworkFunctionDefinitionVersionOperationSource(ArmClient client) + { + _client = client; + } + + NetworkFunctionDefinitionVersionResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + var data = NetworkFunctionDefinitionVersionData.DeserializeNetworkFunctionDefinitionVersionData(document.RootElement); + return new NetworkFunctionDefinitionVersionResource(_client, data); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + var data = NetworkFunctionDefinitionVersionData.DeserializeNetworkFunctionDefinitionVersionData(document.RootElement); + return new NetworkFunctionDefinitionVersionResource(_client, data); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/LongRunningOperation/NetworkFunctionDefinitionVersionUpdateStateOperationSource.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/LongRunningOperation/NetworkFunctionDefinitionVersionUpdateStateOperationSource.cs new file mode 100644 index 000000000000..019dae6813d8 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/LongRunningOperation/NetworkFunctionDefinitionVersionUpdateStateOperationSource.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.ResourceManager.HybridNetwork.Models; + +namespace Azure.ResourceManager.HybridNetwork +{ + internal class NetworkFunctionDefinitionVersionUpdateStateOperationSource : IOperationSource + { + NetworkFunctionDefinitionVersionUpdateState IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + return NetworkFunctionDefinitionVersionUpdateState.DeserializeNetworkFunctionDefinitionVersionUpdateState(document.RootElement); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + return NetworkFunctionDefinitionVersionUpdateState.DeserializeNetworkFunctionDefinitionVersionUpdateState(document.RootElement); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/LongRunningOperation/NetworkFunctionOperationSource.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/LongRunningOperation/NetworkFunctionOperationSource.cs new file mode 100644 index 000000000000..3c5c93a4f704 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/LongRunningOperation/NetworkFunctionOperationSource.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.HybridNetwork +{ + internal class NetworkFunctionOperationSource : IOperationSource + { + private readonly ArmClient _client; + + internal NetworkFunctionOperationSource(ArmClient client) + { + _client = client; + } + + NetworkFunctionResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + var data = NetworkFunctionData.DeserializeNetworkFunctionData(document.RootElement); + return new NetworkFunctionResource(_client, data); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + var data = NetworkFunctionData.DeserializeNetworkFunctionData(document.RootElement); + return new NetworkFunctionResource(_client, data); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/LongRunningOperation/NetworkServiceDesignGroupOperationSource.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/LongRunningOperation/NetworkServiceDesignGroupOperationSource.cs new file mode 100644 index 000000000000..0c803a5502a1 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/LongRunningOperation/NetworkServiceDesignGroupOperationSource.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.HybridNetwork +{ + internal class NetworkServiceDesignGroupOperationSource : IOperationSource + { + private readonly ArmClient _client; + + internal NetworkServiceDesignGroupOperationSource(ArmClient client) + { + _client = client; + } + + NetworkServiceDesignGroupResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + var data = NetworkServiceDesignGroupData.DeserializeNetworkServiceDesignGroupData(document.RootElement); + return new NetworkServiceDesignGroupResource(_client, data); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + var data = NetworkServiceDesignGroupData.DeserializeNetworkServiceDesignGroupData(document.RootElement); + return new NetworkServiceDesignGroupResource(_client, data); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/LongRunningOperation/NetworkServiceDesignVersionOperationSource.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/LongRunningOperation/NetworkServiceDesignVersionOperationSource.cs new file mode 100644 index 000000000000..2e3245dcdcb5 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/LongRunningOperation/NetworkServiceDesignVersionOperationSource.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.HybridNetwork +{ + internal class NetworkServiceDesignVersionOperationSource : IOperationSource + { + private readonly ArmClient _client; + + internal NetworkServiceDesignVersionOperationSource(ArmClient client) + { + _client = client; + } + + NetworkServiceDesignVersionResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + var data = NetworkServiceDesignVersionData.DeserializeNetworkServiceDesignVersionData(document.RootElement); + return new NetworkServiceDesignVersionResource(_client, data); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + var data = NetworkServiceDesignVersionData.DeserializeNetworkServiceDesignVersionData(document.RootElement); + return new NetworkServiceDesignVersionResource(_client, data); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/LongRunningOperation/NetworkServiceDesignVersionUpdateStateOperationSource.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/LongRunningOperation/NetworkServiceDesignVersionUpdateStateOperationSource.cs new file mode 100644 index 000000000000..fc88d9b8ce85 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/LongRunningOperation/NetworkServiceDesignVersionUpdateStateOperationSource.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.ResourceManager.HybridNetwork.Models; + +namespace Azure.ResourceManager.HybridNetwork +{ + internal class NetworkServiceDesignVersionUpdateStateOperationSource : IOperationSource + { + NetworkServiceDesignVersionUpdateState IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + return NetworkServiceDesignVersionUpdateState.DeserializeNetworkServiceDesignVersionUpdateState(document.RootElement); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + return NetworkServiceDesignVersionUpdateState.DeserializeNetworkServiceDesignVersionUpdateState(document.RootElement); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/LongRunningOperation/ProxyArtifactVersionsListOverviewOperationSource.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/LongRunningOperation/ProxyArtifactVersionsListOverviewOperationSource.cs new file mode 100644 index 000000000000..e88107bc7eda --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/LongRunningOperation/ProxyArtifactVersionsListOverviewOperationSource.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.ResourceManager.HybridNetwork.Models; + +namespace Azure.ResourceManager.HybridNetwork +{ + internal class ProxyArtifactVersionsListOverviewOperationSource : IOperationSource + { + ProxyArtifactVersionsListOverview IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + return ProxyArtifactVersionsListOverview.DeserializeProxyArtifactVersionsListOverview(document.RootElement); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + return ProxyArtifactVersionsListOverview.DeserializeProxyArtifactVersionsListOverview(document.RootElement); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/LongRunningOperation/PublisherOperationSource.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/LongRunningOperation/PublisherOperationSource.cs new file mode 100644 index 000000000000..ff93e7b242eb --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/LongRunningOperation/PublisherOperationSource.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.HybridNetwork +{ + internal class PublisherOperationSource : IOperationSource + { + private readonly ArmClient _client; + + internal PublisherOperationSource(ArmClient client) + { + _client = client; + } + + PublisherResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + var data = PublisherData.DeserializePublisherData(document.RootElement); + return new PublisherResource(_client, data); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + var data = PublisherData.DeserializePublisherData(document.RootElement); + return new PublisherResource(_client, data); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/LongRunningOperation/SiteNetworkServiceOperationSource.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/LongRunningOperation/SiteNetworkServiceOperationSource.cs new file mode 100644 index 000000000000..e81b9fa04617 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/LongRunningOperation/SiteNetworkServiceOperationSource.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.HybridNetwork +{ + internal class SiteNetworkServiceOperationSource : IOperationSource + { + private readonly ArmClient _client; + + internal SiteNetworkServiceOperationSource(ArmClient client) + { + _client = client; + } + + SiteNetworkServiceResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + var data = SiteNetworkServiceData.DeserializeSiteNetworkServiceData(document.RootElement); + return new SiteNetworkServiceResource(_client, data); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + var data = SiteNetworkServiceData.DeserializeSiteNetworkServiceData(document.RootElement); + return new SiteNetworkServiceResource(_client, data); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/LongRunningOperation/SiteOperationSource.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/LongRunningOperation/SiteOperationSource.cs new file mode 100644 index 000000000000..cb48cc156764 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/LongRunningOperation/SiteOperationSource.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.HybridNetwork +{ + internal class SiteOperationSource : IOperationSource + { + private readonly ArmClient _client; + + internal SiteOperationSource(ArmClient client) + { + _client = client; + } + + SiteResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + var data = SiteData.DeserializeSiteData(document.RootElement); + return new SiteResource(_client, data); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + var data = SiteData.DeserializeSiteData(document.RootElement); + return new SiteResource(_client, data); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ApplicationEnablement.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ApplicationEnablement.cs new file mode 100644 index 000000000000..f4af6d6f6638 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ApplicationEnablement.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.HybridNetwork.Models +{ + /// The application enablement. + public readonly partial struct ApplicationEnablement : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public ApplicationEnablement(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string UnknownValue = "Unknown"; + private const string EnabledValue = "Enabled"; + private const string DisabledValue = "Disabled"; + + /// Unknown. + public static ApplicationEnablement Unknown { get; } = new ApplicationEnablement(UnknownValue); + /// Enabled. + public static ApplicationEnablement Enabled { get; } = new ApplicationEnablement(EnabledValue); + /// Disabled. + public static ApplicationEnablement Disabled { get; } = new ApplicationEnablement(DisabledValue); + /// Determines if two values are the same. + public static bool operator ==(ApplicationEnablement left, ApplicationEnablement right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ApplicationEnablement left, ApplicationEnablement right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator ApplicationEnablement(string value) => new ApplicationEnablement(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ApplicationEnablement other && Equals(other); + /// + public bool Equals(ApplicationEnablement other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArmResourceDefinitionResourceElementTemplate.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArmResourceDefinitionResourceElementTemplate.Serialization.cs new file mode 100644 index 000000000000..e0c848778c90 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArmResourceDefinitionResourceElementTemplate.Serialization.cs @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class ArmResourceDefinitionResourceElementTemplate : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(TemplateType)) + { + writer.WritePropertyName("templateType"u8); + writer.WriteStringValue(TemplateType.Value.ToString()); + } + if (Optional.IsDefined(ParameterValues)) + { + writer.WritePropertyName("parameterValues"u8); + writer.WriteStringValue(ParameterValues); + } + if (Optional.IsDefined(ArtifactProfile)) + { + writer.WritePropertyName("artifactProfile"u8); + writer.WriteObjectValue(ArtifactProfile); + } + writer.WriteEndObject(); + } + + internal static ArmResourceDefinitionResourceElementTemplate DeserializeArmResourceDefinitionResourceElementTemplate(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional templateType = default; + Optional parameterValues = default; + Optional artifactProfile = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("templateType"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + templateType = new TemplateType(property.Value.GetString()); + continue; + } + if (property.NameEquals("parameterValues"u8)) + { + parameterValues = property.Value.GetString(); + continue; + } + if (property.NameEquals("artifactProfile"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + artifactProfile = NSDArtifactProfile.DeserializeNSDArtifactProfile(property.Value); + continue; + } + } + return new ArmResourceDefinitionResourceElementTemplate(Optional.ToNullable(templateType), parameterValues.Value, artifactProfile.Value); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArmResourceDefinitionResourceElementTemplate.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArmResourceDefinitionResourceElementTemplate.cs new file mode 100644 index 000000000000..6599e1269f21 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArmResourceDefinitionResourceElementTemplate.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// The arm template RE. + public partial class ArmResourceDefinitionResourceElementTemplate + { + /// Initializes a new instance of ArmResourceDefinitionResourceElementTemplate. + public ArmResourceDefinitionResourceElementTemplate() + { + } + + /// Initializes a new instance of ArmResourceDefinitionResourceElementTemplate. + /// The template type. + /// Name and value pairs that define the parameter values. It can be a well formed escaped JSON string. + /// Artifact profile properties. + internal ArmResourceDefinitionResourceElementTemplate(TemplateType? templateType, string parameterValues, NSDArtifactProfile artifactProfile) + { + TemplateType = templateType; + ParameterValues = parameterValues; + ArtifactProfile = artifactProfile; + } + + /// The template type. + public TemplateType? TemplateType { get; set; } + /// Name and value pairs that define the parameter values. It can be a well formed escaped JSON string. + public string ParameterValues { get; set; } + /// Artifact profile properties. + public NSDArtifactProfile ArtifactProfile { get; set; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArmResourceDefinitionResourceElementTemplateDetails.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArmResourceDefinitionResourceElementTemplateDetails.Serialization.cs new file mode 100644 index 000000000000..eb5b5261b74a --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArmResourceDefinitionResourceElementTemplateDetails.Serialization.cs @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class ArmResourceDefinitionResourceElementTemplateDetails : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Configuration)) + { + writer.WritePropertyName("configuration"u8); + writer.WriteObjectValue(Configuration); + } + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + writer.WritePropertyName("type"u8); + writer.WriteStringValue(ResourceElementType.ToString()); + if (Optional.IsDefined(DependsOnProfile)) + { + writer.WritePropertyName("dependsOnProfile"u8); + writer.WriteObjectValue(DependsOnProfile); + } + writer.WriteEndObject(); + } + + internal static ArmResourceDefinitionResourceElementTemplateDetails DeserializeArmResourceDefinitionResourceElementTemplateDetails(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional configuration = default; + Optional name = default; + Type type = default; + Optional dependsOnProfile = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("configuration"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + configuration = ArmResourceDefinitionResourceElementTemplate.DeserializeArmResourceDefinitionResourceElementTemplate(property.Value); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new Type(property.Value.GetString()); + continue; + } + if (property.NameEquals("dependsOnProfile"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + dependsOnProfile = DependsOnProfile.DeserializeDependsOnProfile(property.Value); + continue; + } + } + return new ArmResourceDefinitionResourceElementTemplateDetails(name.Value, type, dependsOnProfile.Value, configuration.Value); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArmResourceDefinitionResourceElementTemplateDetails.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArmResourceDefinitionResourceElementTemplateDetails.cs new file mode 100644 index 000000000000..8b68707e5642 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArmResourceDefinitionResourceElementTemplateDetails.cs @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// The arm resource definition resource element template details. + public partial class ArmResourceDefinitionResourceElementTemplateDetails : ResourceElementTemplate + { + /// Initializes a new instance of ArmResourceDefinitionResourceElementTemplateDetails. + public ArmResourceDefinitionResourceElementTemplateDetails() + { + ResourceElementType = Type.ArmResourceDefinition; + } + + /// Initializes a new instance of ArmResourceDefinitionResourceElementTemplateDetails. + /// Name of the resource element template. + /// The resource element template type. + /// The depends on profile. + /// The resource element template type. + internal ArmResourceDefinitionResourceElementTemplateDetails(string name, Type resourceElementType, DependsOnProfile dependsOnProfile, ArmResourceDefinitionResourceElementTemplate configuration) : base(name, resourceElementType, dependsOnProfile) + { + Configuration = configuration; + ResourceElementType = resourceElementType; + } + + /// The resource element template type. + public ArmResourceDefinitionResourceElementTemplate Configuration { get; set; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArmTemplateArtifactProfile.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArmTemplateArtifactProfile.Serialization.cs new file mode 100644 index 000000000000..1f0bf26b5a5e --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArmTemplateArtifactProfile.Serialization.cs @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class ArmTemplateArtifactProfile : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(TemplateName)) + { + writer.WritePropertyName("templateName"u8); + writer.WriteStringValue(TemplateName); + } + if (Optional.IsDefined(TemplateVersion)) + { + writer.WritePropertyName("templateVersion"u8); + writer.WriteStringValue(TemplateVersion); + } + writer.WriteEndObject(); + } + + internal static ArmTemplateArtifactProfile DeserializeArmTemplateArtifactProfile(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional templateName = default; + Optional templateVersion = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("templateName"u8)) + { + templateName = property.Value.GetString(); + continue; + } + if (property.NameEquals("templateVersion"u8)) + { + templateVersion = property.Value.GetString(); + continue; + } + } + return new ArmTemplateArtifactProfile(templateName.Value, templateVersion.Value); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArmTemplateArtifactProfile.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArmTemplateArtifactProfile.cs new file mode 100644 index 000000000000..7cc65f2051be --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArmTemplateArtifactProfile.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// Template artifact profile. + public partial class ArmTemplateArtifactProfile + { + /// Initializes a new instance of ArmTemplateArtifactProfile. + public ArmTemplateArtifactProfile() + { + } + + /// Initializes a new instance of ArmTemplateArtifactProfile. + /// Template name. + /// Template version. + internal ArmTemplateArtifactProfile(string templateName, string templateVersion) + { + TemplateName = templateName; + TemplateVersion = templateVersion; + } + + /// Template name. + public string TemplateName { get; set; } + /// Template version. + public string TemplateVersion { get; set; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArmTemplateMappingRuleProfile.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArmTemplateMappingRuleProfile.Serialization.cs new file mode 100644 index 000000000000..d28e6e08e21c --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArmTemplateMappingRuleProfile.Serialization.cs @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + internal partial class ArmTemplateMappingRuleProfile : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(TemplateParameters)) + { + writer.WritePropertyName("templateParameters"u8); + writer.WriteStringValue(TemplateParameters); + } + writer.WriteEndObject(); + } + + internal static ArmTemplateMappingRuleProfile DeserializeArmTemplateMappingRuleProfile(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional templateParameters = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("templateParameters"u8)) + { + templateParameters = property.Value.GetString(); + continue; + } + } + return new ArmTemplateMappingRuleProfile(templateParameters.Value); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArmTemplateMappingRuleProfile.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArmTemplateMappingRuleProfile.cs new file mode 100644 index 000000000000..c92e8da2a0b8 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArmTemplateMappingRuleProfile.cs @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// Template mapping rule profile. + internal partial class ArmTemplateMappingRuleProfile + { + /// Initializes a new instance of ArmTemplateMappingRuleProfile. + public ArmTemplateMappingRuleProfile() + { + } + + /// Initializes a new instance of ArmTemplateMappingRuleProfile. + /// List of template parameters. + internal ArmTemplateMappingRuleProfile(string templateParameters) + { + TemplateParameters = templateParameters; + } + + /// List of template parameters. + public string TemplateParameters { get; set; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArtifactAccessCredential.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArtifactAccessCredential.Serialization.cs new file mode 100644 index 000000000000..5397cca59afb --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArtifactAccessCredential.Serialization.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class ArtifactAccessCredential + { + internal static ArtifactAccessCredential DeserializeArtifactAccessCredential(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + if (element.TryGetProperty("credentialType", out JsonElement discriminator)) + { + switch (discriminator.GetString()) + { + case "AzureContainerRegistryScopedToken": return AzureContainerRegistryScopedTokenCredential.DeserializeAzureContainerRegistryScopedTokenCredential(element); + case "AzureStorageAccountToken": return AzureStorageAccountCredential.DeserializeAzureStorageAccountCredential(element); + } + } + return UnknownArtifactAccessCredential.DeserializeUnknownArtifactAccessCredential(element); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArtifactAccessCredential.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArtifactAccessCredential.cs new file mode 100644 index 000000000000..826b9637e2cf --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArtifactAccessCredential.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// + /// The artifact manifest credential definition. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include and . + /// + public abstract partial class ArtifactAccessCredential + { + /// Initializes a new instance of ArtifactAccessCredential. + protected ArtifactAccessCredential() + { + } + + /// Initializes a new instance of ArtifactAccessCredential. + /// The credential type. + internal ArtifactAccessCredential(CredentialType credentialType) + { + CredentialType = credentialType; + } + + /// The credential type. + internal CredentialType CredentialType { get; set; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArtifactChangeState.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArtifactChangeState.Serialization.cs new file mode 100644 index 000000000000..0c085bee928a --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArtifactChangeState.Serialization.cs @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class ArtifactChangeState : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties); + } + writer.WriteEndObject(); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArtifactChangeState.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArtifactChangeState.cs new file mode 100644 index 000000000000..dce6f7c045b9 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArtifactChangeState.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// The artifact updating request payload. + public partial class ArtifactChangeState + { + /// Initializes a new instance of ArtifactChangeState. + public ArtifactChangeState() + { + } + + /// Artifact update state properties. + internal ArtifactChangeStateProperties Properties { get; set; } + /// The artifact state. + public ArtifactState? ArtifactState + { + get => Properties is null ? default : Properties.ArtifactState; + set + { + if (Properties is null) + Properties = new ArtifactChangeStateProperties(); + Properties.ArtifactState = value; + } + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArtifactChangeStateProperties.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArtifactChangeStateProperties.Serialization.cs new file mode 100644 index 000000000000..fdb778613844 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArtifactChangeStateProperties.Serialization.cs @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + internal partial class ArtifactChangeStateProperties : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(ArtifactState)) + { + writer.WritePropertyName("artifactState"u8); + writer.WriteStringValue(ArtifactState.Value.ToString()); + } + writer.WriteEndObject(); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArtifactChangeStateProperties.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArtifactChangeStateProperties.cs new file mode 100644 index 000000000000..8944da1804b7 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArtifactChangeStateProperties.cs @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// The artifact update state properties. + internal partial class ArtifactChangeStateProperties + { + /// Initializes a new instance of ArtifactChangeStateProperties. + public ArtifactChangeStateProperties() + { + } + + /// The artifact state. + public ArtifactState? ArtifactState { get; set; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArtifactManifestData.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArtifactManifestData.Serialization.cs new file mode 100644 index 000000000000..e0bc39084a9b --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArtifactManifestData.Serialization.cs @@ -0,0 +1,113 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.HybridNetwork.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.HybridNetwork +{ + public partial class ArtifactManifestData : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties); + } + 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(); + } + writer.WritePropertyName("location"u8); + writer.WriteStringValue(Location); + writer.WriteEndObject(); + } + + internal static ArtifactManifestData DeserializeArtifactManifestData(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional properties = default; + Optional> tags = default; + AzureLocation location = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + Optional systemData = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = ArtifactManifestPropertiesFormat.DeserializeArtifactManifestPropertiesFormat(property.Value); + 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; + } + } + return new ArtifactManifestData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, properties.Value); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArtifactManifestListResult.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArtifactManifestListResult.Serialization.cs new file mode 100644 index 000000000000..7dc541de7e09 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArtifactManifestListResult.Serialization.cs @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.HybridNetwork; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + internal partial class ArtifactManifestListResult + { + internal static ArtifactManifestListResult DeserializeArtifactManifestListResult(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> value = default; + Optional nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ArtifactManifestData.DeserializeArtifactManifestData(item)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + } + return new ArtifactManifestListResult(Optional.ToList(value), nextLink.Value); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArtifactManifestListResult.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArtifactManifestListResult.cs new file mode 100644 index 000000000000..4898dda5a037 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArtifactManifestListResult.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.HybridNetwork; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// A list of artifact manifests. + internal partial class ArtifactManifestListResult + { + /// Initializes a new instance of ArtifactManifestListResult. + internal ArtifactManifestListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of ArtifactManifestListResult. + /// A list of artifact manifests. + /// The URI to get the next set of results. + internal ArtifactManifestListResult(IReadOnlyList value, string nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// A list of artifact manifests. + public IReadOnlyList Value { get; } + /// The URI to get the next set of results. + public string NextLink { get; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArtifactManifestPropertiesFormat.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArtifactManifestPropertiesFormat.Serialization.cs new file mode 100644 index 000000000000..a60535112c18 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArtifactManifestPropertiesFormat.Serialization.cs @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class ArtifactManifestPropertiesFormat : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Artifacts)) + { + writer.WritePropertyName("artifacts"u8); + writer.WriteStartArray(); + foreach (var item in Artifacts) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + writer.WriteEndObject(); + } + + internal static ArtifactManifestPropertiesFormat DeserializeArtifactManifestPropertiesFormat(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional provisioningState = default; + Optional artifactManifestState = default; + Optional> artifacts = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("provisioningState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new ProvisioningState(property.Value.GetString()); + continue; + } + if (property.NameEquals("artifactManifestState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + artifactManifestState = new ArtifactManifestState(property.Value.GetString()); + continue; + } + if (property.NameEquals("artifacts"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ManifestArtifactFormat.DeserializeManifestArtifactFormat(item)); + } + artifacts = array; + continue; + } + } + return new ArtifactManifestPropertiesFormat(Optional.ToNullable(provisioningState), Optional.ToNullable(artifactManifestState), Optional.ToList(artifacts)); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArtifactManifestPropertiesFormat.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArtifactManifestPropertiesFormat.cs new file mode 100644 index 000000000000..9896e761f62a --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArtifactManifestPropertiesFormat.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// Artifact manifest properties. + public partial class ArtifactManifestPropertiesFormat + { + /// Initializes a new instance of ArtifactManifestPropertiesFormat. + public ArtifactManifestPropertiesFormat() + { + Artifacts = new ChangeTrackingList(); + } + + /// Initializes a new instance of ArtifactManifestPropertiesFormat. + /// The provisioning state of the ArtifactManifest resource. + /// The artifact manifest state. + /// The artifacts list. + internal ArtifactManifestPropertiesFormat(ProvisioningState? provisioningState, ArtifactManifestState? artifactManifestState, IList artifacts) + { + ProvisioningState = provisioningState; + ArtifactManifestState = artifactManifestState; + Artifacts = artifacts; + } + + /// The provisioning state of the ArtifactManifest resource. + public ProvisioningState? ProvisioningState { get; } + /// The artifact manifest state. + public ArtifactManifestState? ArtifactManifestState { get; } + /// The artifacts list. + public IList Artifacts { get; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArtifactManifestState.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArtifactManifestState.cs new file mode 100644 index 000000000000..0e0caced327f --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArtifactManifestState.cs @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// The artifact manifest state. + public readonly partial struct ArtifactManifestState : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public ArtifactManifestState(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string UnknownValue = "Unknown"; + private const string UploadingValue = "Uploading"; + private const string UploadedValue = "Uploaded"; + private const string ValidatingValue = "Validating"; + private const string ValidationFailedValue = "ValidationFailed"; + private const string SucceededValue = "Succeeded"; + + /// Unknown. + public static ArtifactManifestState Unknown { get; } = new ArtifactManifestState(UnknownValue); + /// Uploading. + public static ArtifactManifestState Uploading { get; } = new ArtifactManifestState(UploadingValue); + /// Uploaded. + public static ArtifactManifestState Uploaded { get; } = new ArtifactManifestState(UploadedValue); + /// Validating. + public static ArtifactManifestState Validating { get; } = new ArtifactManifestState(ValidatingValue); + /// ValidationFailed. + public static ArtifactManifestState ValidationFailed { get; } = new ArtifactManifestState(ValidationFailedValue); + /// Succeeded. + public static ArtifactManifestState Succeeded { get; } = new ArtifactManifestState(SucceededValue); + /// Determines if two values are the same. + public static bool operator ==(ArtifactManifestState left, ArtifactManifestState right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ArtifactManifestState left, ArtifactManifestState right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator ArtifactManifestState(string value) => new ArtifactManifestState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ArtifactManifestState other && Equals(other); + /// + public bool Equals(ArtifactManifestState other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArtifactManifestUpdateState.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArtifactManifestUpdateState.Serialization.cs new file mode 100644 index 000000000000..5f42908415ad --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArtifactManifestUpdateState.Serialization.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class ArtifactManifestUpdateState : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(ArtifactManifestState)) + { + writer.WritePropertyName("artifactManifestState"u8); + writer.WriteStringValue(ArtifactManifestState.Value.ToString()); + } + writer.WriteEndObject(); + } + + internal static ArtifactManifestUpdateState DeserializeArtifactManifestUpdateState(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional artifactManifestState = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("artifactManifestState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + artifactManifestState = new ArtifactManifestState(property.Value.GetString()); + continue; + } + } + return new ArtifactManifestUpdateState(Optional.ToNullable(artifactManifestState)); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArtifactManifestUpdateState.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArtifactManifestUpdateState.cs new file mode 100644 index 000000000000..e0418df9d096 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArtifactManifestUpdateState.cs @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// The artifact manifest updating request payload. Only the 'Uploaded' state is allowed for updates. Other states are used for internal state transitioning. + public partial class ArtifactManifestUpdateState + { + /// Initializes a new instance of ArtifactManifestUpdateState. + public ArtifactManifestUpdateState() + { + } + + /// Initializes a new instance of ArtifactManifestUpdateState. + /// The artifact manifest state. + internal ArtifactManifestUpdateState(ArtifactManifestState? artifactManifestState) + { + ArtifactManifestState = artifactManifestState; + } + + /// The artifact manifest state. + public ArtifactManifestState? ArtifactManifestState { get; set; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArtifactProfile.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArtifactProfile.Serialization.cs new file mode 100644 index 000000000000..d9f77f8a5503 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArtifactProfile.Serialization.cs @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Resources.Models; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class ArtifactProfile : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(ArtifactStore)) + { + writer.WritePropertyName("artifactStore"u8); + JsonSerializer.Serialize(writer, ArtifactStore); + } + writer.WriteEndObject(); + } + + internal static ArtifactProfile DeserializeArtifactProfile(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional artifactStore = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("artifactStore"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + artifactStore = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + } + return new ArtifactProfile(artifactStore); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArtifactProfile.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArtifactProfile.cs new file mode 100644 index 000000000000..d5965975ae6a --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArtifactProfile.cs @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager.Resources.Models; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// Artifact profile properties. + public partial class ArtifactProfile + { + /// Initializes a new instance of ArtifactProfile. + public ArtifactProfile() + { + } + + /// Initializes a new instance of ArtifactProfile. + /// The reference to artifact store. + internal ArtifactProfile(WritableSubResource artifactStore) + { + ArtifactStore = artifactStore; + } + + /// The reference to artifact store. + internal WritableSubResource ArtifactStore { get; set; } + /// Gets or sets Id. + public ResourceIdentifier ArtifactStoreId + { + get => ArtifactStore is null ? default : ArtifactStore.Id; + set + { + if (ArtifactStore is null) + ArtifactStore = new WritableSubResource(); + ArtifactStore.Id = value; + } + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArtifactReplicationStrategy.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArtifactReplicationStrategy.cs new file mode 100644 index 000000000000..445da137117a --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArtifactReplicationStrategy.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.HybridNetwork.Models +{ + /// The replication strategy. + public readonly partial struct ArtifactReplicationStrategy : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public ArtifactReplicationStrategy(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string UnknownValue = "Unknown"; + private const string SingleReplicationValue = "SingleReplication"; + + /// Unknown. + public static ArtifactReplicationStrategy Unknown { get; } = new ArtifactReplicationStrategy(UnknownValue); + /// SingleReplication. + public static ArtifactReplicationStrategy SingleReplication { get; } = new ArtifactReplicationStrategy(SingleReplicationValue); + /// Determines if two values are the same. + public static bool operator ==(ArtifactReplicationStrategy left, ArtifactReplicationStrategy right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ArtifactReplicationStrategy left, ArtifactReplicationStrategy right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator ArtifactReplicationStrategy(string value) => new ArtifactReplicationStrategy(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ArtifactReplicationStrategy other && Equals(other); + /// + public bool Equals(ArtifactReplicationStrategy other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArtifactState.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArtifactState.cs new file mode 100644 index 000000000000..ce7a784507a1 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArtifactState.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.HybridNetwork.Models +{ + /// The artifact state. + public readonly partial struct ArtifactState : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public ArtifactState(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string UnknownValue = "Unknown"; + private const string PreviewValue = "Preview"; + private const string ActiveValue = "Active"; + private const string DeprecatedValue = "Deprecated"; + + /// Unknown. + public static ArtifactState Unknown { get; } = new ArtifactState(UnknownValue); + /// Preview. + public static ArtifactState Preview { get; } = new ArtifactState(PreviewValue); + /// Active. + public static ArtifactState Active { get; } = new ArtifactState(ActiveValue); + /// Deprecated. + public static ArtifactState Deprecated { get; } = new ArtifactState(DeprecatedValue); + /// Determines if two values are the same. + public static bool operator ==(ArtifactState left, ArtifactState right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ArtifactState left, ArtifactState right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator ArtifactState(string value) => new ArtifactState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ArtifactState other && Equals(other); + /// + public bool Equals(ArtifactState other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArtifactStoreData.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArtifactStoreData.Serialization.cs new file mode 100644 index 000000000000..85e6c1b684d3 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArtifactStoreData.Serialization.cs @@ -0,0 +1,113 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.HybridNetwork.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.HybridNetwork +{ + public partial class ArtifactStoreData : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties); + } + 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(); + } + writer.WritePropertyName("location"u8); + writer.WriteStringValue(Location); + writer.WriteEndObject(); + } + + internal static ArtifactStoreData DeserializeArtifactStoreData(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional properties = default; + Optional> tags = default; + AzureLocation location = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + Optional systemData = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = ArtifactStorePropertiesFormat.DeserializeArtifactStorePropertiesFormat(property.Value); + 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; + } + } + return new ArtifactStoreData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, properties.Value); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArtifactStoreListResult.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArtifactStoreListResult.Serialization.cs new file mode 100644 index 000000000000..7c3b5ec30077 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArtifactStoreListResult.Serialization.cs @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.HybridNetwork; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + internal partial class ArtifactStoreListResult + { + internal static ArtifactStoreListResult DeserializeArtifactStoreListResult(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> value = default; + Optional nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ArtifactStoreData.DeserializeArtifactStoreData(item)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + } + return new ArtifactStoreListResult(Optional.ToList(value), nextLink.Value); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArtifactStoreListResult.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArtifactStoreListResult.cs new file mode 100644 index 000000000000..82b5d897359a --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArtifactStoreListResult.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.HybridNetwork; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// A list of artifact stores. + internal partial class ArtifactStoreListResult + { + /// Initializes a new instance of ArtifactStoreListResult. + internal ArtifactStoreListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of ArtifactStoreListResult. + /// A list of artifact stores. + /// The URL to get the next set of results. + internal ArtifactStoreListResult(IReadOnlyList value, string nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// A list of artifact stores. + public IReadOnlyList Value { get; } + /// The URL to get the next set of results. + public string NextLink { get; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArtifactStorePropertiesFormat.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArtifactStorePropertiesFormat.Serialization.cs new file mode 100644 index 000000000000..4f8faed6941e --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArtifactStorePropertiesFormat.Serialization.cs @@ -0,0 +1,98 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class ArtifactStorePropertiesFormat : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(StoreType)) + { + writer.WritePropertyName("storeType"u8); + writer.WriteStringValue(StoreType.Value.ToString()); + } + if (Optional.IsDefined(ReplicationStrategy)) + { + writer.WritePropertyName("replicationStrategy"u8); + writer.WriteStringValue(ReplicationStrategy.Value.ToString()); + } + if (Optional.IsDefined(ManagedResourceGroupConfiguration)) + { + writer.WritePropertyName("managedResourceGroupConfiguration"u8); + writer.WriteObjectValue(ManagedResourceGroupConfiguration); + } + writer.WriteEndObject(); + } + + internal static ArtifactStorePropertiesFormat DeserializeArtifactStorePropertiesFormat(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional provisioningState = default; + Optional storeType = default; + Optional replicationStrategy = default; + Optional managedResourceGroupConfiguration = default; + Optional storageResourceId = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("provisioningState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new ProvisioningState(property.Value.GetString()); + continue; + } + if (property.NameEquals("storeType"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + storeType = new ArtifactStoreType(property.Value.GetString()); + continue; + } + if (property.NameEquals("replicationStrategy"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + replicationStrategy = new ArtifactReplicationStrategy(property.Value.GetString()); + continue; + } + if (property.NameEquals("managedResourceGroupConfiguration"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + managedResourceGroupConfiguration = ArtifactStorePropertiesFormatManagedResourceGroupConfiguration.DeserializeArtifactStorePropertiesFormatManagedResourceGroupConfiguration(property.Value); + continue; + } + if (property.NameEquals("storageResourceId"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + storageResourceId = new ResourceIdentifier(property.Value.GetString()); + continue; + } + } + return new ArtifactStorePropertiesFormat(Optional.ToNullable(provisioningState), Optional.ToNullable(storeType), Optional.ToNullable(replicationStrategy), managedResourceGroupConfiguration.Value, storageResourceId.Value); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArtifactStorePropertiesFormat.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArtifactStorePropertiesFormat.cs new file mode 100644 index 000000000000..1d4e65507623 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArtifactStorePropertiesFormat.cs @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// Artifact store properties. + public partial class ArtifactStorePropertiesFormat + { + /// Initializes a new instance of ArtifactStorePropertiesFormat. + public ArtifactStorePropertiesFormat() + { + } + + /// Initializes a new instance of ArtifactStorePropertiesFormat. + /// The provisioning state of the application groups resource. + /// The artifact store type. + /// The replication strategy. + /// + /// The created storage resource id. + internal ArtifactStorePropertiesFormat(ProvisioningState? provisioningState, ArtifactStoreType? storeType, ArtifactReplicationStrategy? replicationStrategy, ArtifactStorePropertiesFormatManagedResourceGroupConfiguration managedResourceGroupConfiguration, ResourceIdentifier storageResourceId) + { + ProvisioningState = provisioningState; + StoreType = storeType; + ReplicationStrategy = replicationStrategy; + ManagedResourceGroupConfiguration = managedResourceGroupConfiguration; + StorageResourceId = storageResourceId; + } + + /// The provisioning state of the application groups resource. + public ProvisioningState? ProvisioningState { get; } + /// The artifact store type. + public ArtifactStoreType? StoreType { get; set; } + /// The replication strategy. + public ArtifactReplicationStrategy? ReplicationStrategy { get; set; } + /// Gets or sets the managed resource group configuration. + public ArtifactStorePropertiesFormatManagedResourceGroupConfiguration ManagedResourceGroupConfiguration { get; set; } + /// The created storage resource id. + public ResourceIdentifier StorageResourceId { get; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArtifactStorePropertiesFormatManagedResourceGroupConfiguration.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArtifactStorePropertiesFormatManagedResourceGroupConfiguration.Serialization.cs new file mode 100644 index 000000000000..7506445ca812 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArtifactStorePropertiesFormatManagedResourceGroupConfiguration.Serialization.cs @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class ArtifactStorePropertiesFormatManagedResourceGroupConfiguration : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (Optional.IsDefined(Location)) + { + writer.WritePropertyName("location"u8); + writer.WriteStringValue(Location.Value); + } + writer.WriteEndObject(); + } + + internal static ArtifactStorePropertiesFormatManagedResourceGroupConfiguration DeserializeArtifactStorePropertiesFormatManagedResourceGroupConfiguration(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional name = default; + Optional location = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("location"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + location = new AzureLocation(property.Value.GetString()); + continue; + } + } + return new ArtifactStorePropertiesFormatManagedResourceGroupConfiguration(name.Value, Optional.ToNullable(location)); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArtifactStorePropertiesFormatManagedResourceGroupConfiguration.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArtifactStorePropertiesFormatManagedResourceGroupConfiguration.cs new file mode 100644 index 000000000000..1e82587d0c80 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArtifactStorePropertiesFormatManagedResourceGroupConfiguration.cs @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// The ArtifactStorePropertiesFormatManagedResourceGroupConfiguration. + public partial class ArtifactStorePropertiesFormatManagedResourceGroupConfiguration + { + /// Initializes a new instance of ArtifactStorePropertiesFormatManagedResourceGroupConfiguration. + public ArtifactStorePropertiesFormatManagedResourceGroupConfiguration() + { + } + + /// Initializes a new instance of ArtifactStorePropertiesFormatManagedResourceGroupConfiguration. + /// The managed resource group name. + /// The managed resource group location. + internal ArtifactStorePropertiesFormatManagedResourceGroupConfiguration(string name, AzureLocation? location) + { + Name = name; + Location = location; + } + + /// The managed resource group name. + public string Name { get; set; } + /// The managed resource group location. + public AzureLocation? Location { get; set; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArtifactStoreType.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArtifactStoreType.cs new file mode 100644 index 000000000000..d900364f7113 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArtifactStoreType.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.HybridNetwork.Models +{ + /// The artifact store type. + public readonly partial struct ArtifactStoreType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public ArtifactStoreType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string UnknownValue = "Unknown"; + private const string AzureContainerRegistryValue = "AzureContainerRegistry"; + private const string AzureStorageAccountValue = "AzureStorageAccount"; + + /// Unknown. + public static ArtifactStoreType Unknown { get; } = new ArtifactStoreType(UnknownValue); + /// AzureContainerRegistry. + public static ArtifactStoreType AzureContainerRegistry { get; } = new ArtifactStoreType(AzureContainerRegistryValue); + /// AzureStorageAccount. + public static ArtifactStoreType AzureStorageAccount { get; } = new ArtifactStoreType(AzureStorageAccountValue); + /// Determines if two values are the same. + public static bool operator ==(ArtifactStoreType left, ArtifactStoreType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ArtifactStoreType left, ArtifactStoreType right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator ArtifactStoreType(string value) => new ArtifactStoreType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ArtifactStoreType other && Equals(other); + /// + public bool Equals(ArtifactStoreType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArtifactType.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArtifactType.cs new file mode 100644 index 000000000000..653140511b8f --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArtifactType.cs @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// The artifact type. + public readonly partial struct ArtifactType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public ArtifactType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string UnknownValue = "Unknown"; + private const string OCIArtifactValue = "OCIArtifact"; + private const string VhdImageFileValue = "VhdImageFile"; + private const string ArmTemplateValue = "ArmTemplate"; + private const string ImageFileValue = "ImageFile"; + + /// Unknown. + public static ArtifactType Unknown { get; } = new ArtifactType(UnknownValue); + /// OCIArtifact. + public static ArtifactType OCIArtifact { get; } = new ArtifactType(OCIArtifactValue); + /// VhdImageFile. + public static ArtifactType VhdImageFile { get; } = new ArtifactType(VhdImageFileValue); + /// ArmTemplate. + public static ArtifactType ArmTemplate { get; } = new ArtifactType(ArmTemplateValue); + /// ImageFile. + public static ArtifactType ImageFile { get; } = new ArtifactType(ImageFileValue); + /// Determines if two values are the same. + public static bool operator ==(ArtifactType left, ArtifactType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ArtifactType left, ArtifactType right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator ArtifactType(string value) => new ArtifactType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ArtifactType other && Equals(other); + /// + public bool Equals(ArtifactType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureArcK8SClusterNfviDetails.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureArcK8SClusterNfviDetails.Serialization.cs new file mode 100644 index 000000000000..b0c88f3bd36a --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureArcK8SClusterNfviDetails.Serialization.cs @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Resources.Models; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class AzureArcK8SClusterNfviDetails : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(CustomLocationReference)) + { + writer.WritePropertyName("customLocationReference"u8); + JsonSerializer.Serialize(writer, CustomLocationReference); + } + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + writer.WritePropertyName("nfviType"u8); + writer.WriteStringValue(NfviType.ToString()); + writer.WriteEndObject(); + } + + internal static AzureArcK8SClusterNfviDetails DeserializeAzureArcK8SClusterNfviDetails(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional customLocationReference = default; + Optional name = default; + NfviType nfviType = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("customLocationReference"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + customLocationReference = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("nfviType"u8)) + { + nfviType = new NfviType(property.Value.GetString()); + continue; + } + } + return new AzureArcK8SClusterNfviDetails(name.Value, nfviType, customLocationReference); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureArcK8SClusterNfviDetails.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureArcK8SClusterNfviDetails.cs new file mode 100644 index 000000000000..7f81e13c6a5d --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureArcK8SClusterNfviDetails.cs @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager.Resources.Models; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// The AzureArcK8sCluster NFVI detail. + public partial class AzureArcK8SClusterNfviDetails : NFVIs + { + /// Initializes a new instance of AzureArcK8SClusterNfviDetails. + public AzureArcK8SClusterNfviDetails() + { + NfviType = NfviType.AzureArcKubernetes; + } + + /// Initializes a new instance of AzureArcK8SClusterNfviDetails. + /// Name of the nfvi. + /// The NFVI type. + /// The reference to the custom location. + internal AzureArcK8SClusterNfviDetails(string name, NfviType nfviType, WritableSubResource customLocationReference) : base(name, nfviType) + { + CustomLocationReference = customLocationReference; + NfviType = nfviType; + } + + /// The reference to the custom location. + internal WritableSubResource CustomLocationReference { get; set; } + /// Gets or sets Id. + public ResourceIdentifier CustomLocationReferenceId + { + get => CustomLocationReference is null ? default : CustomLocationReference.Id; + set + { + if (CustomLocationReference is null) + CustomLocationReference = new WritableSubResource(); + CustomLocationReference.Id = value; + } + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureArcKubernetesArtifactProfile.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureArcKubernetesArtifactProfile.Serialization.cs new file mode 100644 index 000000000000..2796133e9ea7 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureArcKubernetesArtifactProfile.Serialization.cs @@ -0,0 +1,64 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Resources.Models; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class AzureArcKubernetesArtifactProfile : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(HelmArtifactProfile)) + { + writer.WritePropertyName("helmArtifactProfile"u8); + writer.WriteObjectValue(HelmArtifactProfile); + } + if (Optional.IsDefined(ArtifactStore)) + { + writer.WritePropertyName("artifactStore"u8); + JsonSerializer.Serialize(writer, ArtifactStore); + } + writer.WriteEndObject(); + } + + internal static AzureArcKubernetesArtifactProfile DeserializeAzureArcKubernetesArtifactProfile(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional helmArtifactProfile = default; + Optional artifactStore = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("helmArtifactProfile"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + helmArtifactProfile = HelmArtifactProfile.DeserializeHelmArtifactProfile(property.Value); + continue; + } + if (property.NameEquals("artifactStore"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + artifactStore = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + } + return new AzureArcKubernetesArtifactProfile(artifactStore, helmArtifactProfile.Value); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureArcKubernetesArtifactProfile.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureArcKubernetesArtifactProfile.cs new file mode 100644 index 000000000000..711afe3cc8a9 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureArcKubernetesArtifactProfile.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.ResourceManager.Resources.Models; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// Azure arc kubernetes artifact profile properties. + public partial class AzureArcKubernetesArtifactProfile : ArtifactProfile + { + /// Initializes a new instance of AzureArcKubernetesArtifactProfile. + public AzureArcKubernetesArtifactProfile() + { + } + + /// Initializes a new instance of AzureArcKubernetesArtifactProfile. + /// The reference to artifact store. + /// Helm artifact profile. + internal AzureArcKubernetesArtifactProfile(WritableSubResource artifactStore, HelmArtifactProfile helmArtifactProfile) : base(artifactStore) + { + HelmArtifactProfile = helmArtifactProfile; + } + + /// Helm artifact profile. + public HelmArtifactProfile HelmArtifactProfile { get; set; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureArcKubernetesArtifactType.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureArcKubernetesArtifactType.cs new file mode 100644 index 000000000000..f7ae09b186ab --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureArcKubernetesArtifactType.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.HybridNetwork.Models +{ + /// The artifact type. + internal readonly partial struct AzureArcKubernetesArtifactType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public AzureArcKubernetesArtifactType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string UnknownValue = "Unknown"; + private const string HelmPackageValue = "HelmPackage"; + + /// Unknown. + public static AzureArcKubernetesArtifactType Unknown { get; } = new AzureArcKubernetesArtifactType(UnknownValue); + /// HelmPackage. + public static AzureArcKubernetesArtifactType HelmPackage { get; } = new AzureArcKubernetesArtifactType(HelmPackageValue); + /// Determines if two values are the same. + public static bool operator ==(AzureArcKubernetesArtifactType left, AzureArcKubernetesArtifactType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(AzureArcKubernetesArtifactType left, AzureArcKubernetesArtifactType right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator AzureArcKubernetesArtifactType(string value) => new AzureArcKubernetesArtifactType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is AzureArcKubernetesArtifactType other && Equals(other); + /// + public bool Equals(AzureArcKubernetesArtifactType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureArcKubernetesDeployMappingRuleProfile.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureArcKubernetesDeployMappingRuleProfile.Serialization.cs new file mode 100644 index 000000000000..e774309f91e8 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureArcKubernetesDeployMappingRuleProfile.Serialization.cs @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class AzureArcKubernetesDeployMappingRuleProfile : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(HelmMappingRuleProfile)) + { + writer.WritePropertyName("helmMappingRuleProfile"u8); + writer.WriteObjectValue(HelmMappingRuleProfile); + } + if (Optional.IsDefined(ApplicationEnablement)) + { + writer.WritePropertyName("applicationEnablement"u8); + writer.WriteStringValue(ApplicationEnablement.Value.ToString()); + } + writer.WriteEndObject(); + } + + internal static AzureArcKubernetesDeployMappingRuleProfile DeserializeAzureArcKubernetesDeployMappingRuleProfile(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional helmMappingRuleProfile = default; + Optional applicationEnablement = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("helmMappingRuleProfile"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + helmMappingRuleProfile = HelmMappingRuleProfile.DeserializeHelmMappingRuleProfile(property.Value); + continue; + } + if (property.NameEquals("applicationEnablement"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + applicationEnablement = new ApplicationEnablement(property.Value.GetString()); + continue; + } + } + return new AzureArcKubernetesDeployMappingRuleProfile(Optional.ToNullable(applicationEnablement), helmMappingRuleProfile.Value); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureArcKubernetesDeployMappingRuleProfile.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureArcKubernetesDeployMappingRuleProfile.cs new file mode 100644 index 000000000000..a53fea427ab2 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureArcKubernetesDeployMappingRuleProfile.cs @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// Azure arc kubernetes deploy mapping rule profile. + public partial class AzureArcKubernetesDeployMappingRuleProfile : MappingRuleProfile + { + /// Initializes a new instance of AzureArcKubernetesDeployMappingRuleProfile. + public AzureArcKubernetesDeployMappingRuleProfile() + { + } + + /// Initializes a new instance of AzureArcKubernetesDeployMappingRuleProfile. + /// The application enablement. + /// The helm mapping rule profile. + internal AzureArcKubernetesDeployMappingRuleProfile(ApplicationEnablement? applicationEnablement, HelmMappingRuleProfile helmMappingRuleProfile) : base(applicationEnablement) + { + HelmMappingRuleProfile = helmMappingRuleProfile; + } + + /// The helm mapping rule profile. + public HelmMappingRuleProfile HelmMappingRuleProfile { get; set; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureArcKubernetesHelmApplication.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureArcKubernetesHelmApplication.Serialization.cs new file mode 100644 index 000000000000..0c3727f62c2a --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureArcKubernetesHelmApplication.Serialization.cs @@ -0,0 +1,97 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class AzureArcKubernetesHelmApplication : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(ArtifactProfile)) + { + writer.WritePropertyName("artifactProfile"u8); + writer.WriteObjectValue(ArtifactProfile); + } + if (Optional.IsDefined(DeployParametersMappingRuleProfile)) + { + writer.WritePropertyName("deployParametersMappingRuleProfile"u8); + writer.WriteObjectValue(DeployParametersMappingRuleProfile); + } + writer.WritePropertyName("artifactType"u8); + writer.WriteStringValue(ArtifactType.ToString()); + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (Optional.IsDefined(DependsOnProfile)) + { + writer.WritePropertyName("dependsOnProfile"u8); + writer.WriteObjectValue(DependsOnProfile); + } + writer.WriteEndObject(); + } + + internal static AzureArcKubernetesHelmApplication DeserializeAzureArcKubernetesHelmApplication(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional artifactProfile = default; + Optional deployParametersMappingRuleProfile = default; + AzureArcKubernetesArtifactType artifactType = default; + Optional name = default; + Optional dependsOnProfile = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("artifactProfile"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + artifactProfile = AzureArcKubernetesArtifactProfile.DeserializeAzureArcKubernetesArtifactProfile(property.Value); + continue; + } + if (property.NameEquals("deployParametersMappingRuleProfile"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + deployParametersMappingRuleProfile = AzureArcKubernetesDeployMappingRuleProfile.DeserializeAzureArcKubernetesDeployMappingRuleProfile(property.Value); + continue; + } + if (property.NameEquals("artifactType"u8)) + { + artifactType = new AzureArcKubernetesArtifactType(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("dependsOnProfile"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + dependsOnProfile = DependsOnProfile.DeserializeDependsOnProfile(property.Value); + continue; + } + } + return new AzureArcKubernetesHelmApplication(name.Value, dependsOnProfile.Value, artifactType, artifactProfile.Value, deployParametersMappingRuleProfile.Value); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureArcKubernetesHelmApplication.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureArcKubernetesHelmApplication.cs new file mode 100644 index 000000000000..5c1aeff93b2a --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureArcKubernetesHelmApplication.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// Azure arc kubernetes helm application configurations. + public partial class AzureArcKubernetesHelmApplication : AzureArcKubernetesNetworkFunctionApplication + { + /// Initializes a new instance of AzureArcKubernetesHelmApplication. + public AzureArcKubernetesHelmApplication() + { + ArtifactType = AzureArcKubernetesArtifactType.HelmPackage; + } + + /// Initializes a new instance of AzureArcKubernetesHelmApplication. + /// The name of the network function application. + /// Depends on profile definition. + /// The artifact type. + /// Azure arc kubernetes artifact profile. + /// Deploy mapping rule profile. + internal AzureArcKubernetesHelmApplication(string name, DependsOnProfile dependsOnProfile, AzureArcKubernetesArtifactType artifactType, AzureArcKubernetesArtifactProfile artifactProfile, AzureArcKubernetesDeployMappingRuleProfile deployParametersMappingRuleProfile) : base(name, dependsOnProfile, artifactType) + { + ArtifactProfile = artifactProfile; + DeployParametersMappingRuleProfile = deployParametersMappingRuleProfile; + ArtifactType = artifactType; + } + + /// Azure arc kubernetes artifact profile. + public AzureArcKubernetesArtifactProfile ArtifactProfile { get; set; } + /// Deploy mapping rule profile. + public AzureArcKubernetesDeployMappingRuleProfile DeployParametersMappingRuleProfile { get; set; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureArcKubernetesNetworkFunctionApplication.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureArcKubernetesNetworkFunctionApplication.Serialization.cs new file mode 100644 index 000000000000..7d7703cc6ddc --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureArcKubernetesNetworkFunctionApplication.Serialization.cs @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class AzureArcKubernetesNetworkFunctionApplication : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("artifactType"u8); + writer.WriteStringValue(ArtifactType.ToString()); + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (Optional.IsDefined(DependsOnProfile)) + { + writer.WritePropertyName("dependsOnProfile"u8); + writer.WriteObjectValue(DependsOnProfile); + } + writer.WriteEndObject(); + } + + internal static AzureArcKubernetesNetworkFunctionApplication DeserializeAzureArcKubernetesNetworkFunctionApplication(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + if (element.TryGetProperty("artifactType", out JsonElement discriminator)) + { + switch (discriminator.GetString()) + { + case "HelmPackage": return AzureArcKubernetesHelmApplication.DeserializeAzureArcKubernetesHelmApplication(element); + } + } + AzureArcKubernetesArtifactType artifactType = default; + Optional name = default; + Optional dependsOnProfile = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("artifactType"u8)) + { + artifactType = new AzureArcKubernetesArtifactType(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("dependsOnProfile"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + dependsOnProfile = DependsOnProfile.DeserializeDependsOnProfile(property.Value); + continue; + } + } + return new AzureArcKubernetesNetworkFunctionApplication(name.Value, dependsOnProfile.Value, artifactType); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureArcKubernetesNetworkFunctionApplication.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureArcKubernetesNetworkFunctionApplication.cs new file mode 100644 index 000000000000..54d326b0d6e0 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureArcKubernetesNetworkFunctionApplication.cs @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// + /// Azure arc kubernetes network function application definition. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include . + /// + public partial class AzureArcKubernetesNetworkFunctionApplication : NetworkFunctionApplication + { + /// Initializes a new instance of AzureArcKubernetesNetworkFunctionApplication. + public AzureArcKubernetesNetworkFunctionApplication() + { + } + + /// Initializes a new instance of AzureArcKubernetesNetworkFunctionApplication. + /// The name of the network function application. + /// Depends on profile definition. + /// The artifact type. + internal AzureArcKubernetesNetworkFunctionApplication(string name, DependsOnProfile dependsOnProfile, AzureArcKubernetesArtifactType artifactType) : base(name, dependsOnProfile) + { + ArtifactType = artifactType; + } + + /// The artifact type. + internal AzureArcKubernetesArtifactType ArtifactType { get; set; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureArcKubernetesNetworkFunctionTemplate.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureArcKubernetesNetworkFunctionTemplate.Serialization.cs new file mode 100644 index 000000000000..c6dade8dc234 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureArcKubernetesNetworkFunctionTemplate.Serialization.cs @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class AzureArcKubernetesNetworkFunctionTemplate : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(NetworkFunctionApplications)) + { + writer.WritePropertyName("networkFunctionApplications"u8); + writer.WriteStartArray(); + foreach (var item in NetworkFunctionApplications) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + writer.WritePropertyName("nfviType"u8); + writer.WriteStringValue(NfviType.ToString()); + writer.WriteEndObject(); + } + + internal static AzureArcKubernetesNetworkFunctionTemplate DeserializeAzureArcKubernetesNetworkFunctionTemplate(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> networkFunctionApplications = default; + ContainerizedNetworkFunctionNfviType nfviType = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("networkFunctionApplications"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(AzureArcKubernetesNetworkFunctionApplication.DeserializeAzureArcKubernetesNetworkFunctionApplication(item)); + } + networkFunctionApplications = array; + continue; + } + if (property.NameEquals("nfviType"u8)) + { + nfviType = new ContainerizedNetworkFunctionNfviType(property.Value.GetString()); + continue; + } + } + return new AzureArcKubernetesNetworkFunctionTemplate(nfviType, Optional.ToList(networkFunctionApplications)); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureArcKubernetesNetworkFunctionTemplate.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureArcKubernetesNetworkFunctionTemplate.cs new file mode 100644 index 000000000000..5cf5806d1a8e --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureArcKubernetesNetworkFunctionTemplate.cs @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// Azure Arc kubernetes network function template. + public partial class AzureArcKubernetesNetworkFunctionTemplate : ContainerizedNetworkFunctionTemplate + { + /// Initializes a new instance of AzureArcKubernetesNetworkFunctionTemplate. + public AzureArcKubernetesNetworkFunctionTemplate() + { + NetworkFunctionApplications = new ChangeTrackingList(); + NfviType = ContainerizedNetworkFunctionNfviType.AzureArcKubernetes; + } + + /// Initializes a new instance of AzureArcKubernetesNetworkFunctionTemplate. + /// The network function type. + /// + /// Network function applications. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include . + /// + internal AzureArcKubernetesNetworkFunctionTemplate(ContainerizedNetworkFunctionNfviType nfviType, IList networkFunctionApplications) : base(nfviType) + { + NetworkFunctionApplications = networkFunctionApplications; + NfviType = nfviType; + } + + /// + /// Network function applications. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include . + /// + public IList NetworkFunctionApplications { get; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureContainerRegistryScopedTokenCredential.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureContainerRegistryScopedTokenCredential.Serialization.cs new file mode 100644 index 000000000000..1784aad6e4cf --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureContainerRegistryScopedTokenCredential.Serialization.cs @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class AzureContainerRegistryScopedTokenCredential + { + internal static AzureContainerRegistryScopedTokenCredential DeserializeAzureContainerRegistryScopedTokenCredential(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional username = default; + Optional acrToken = default; + Optional acrServerUrl = default; + Optional> repositories = default; + Optional expiry = default; + CredentialType credentialType = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("username"u8)) + { + username = property.Value.GetString(); + continue; + } + if (property.NameEquals("acrToken"u8)) + { + acrToken = property.Value.GetString(); + continue; + } + if (property.NameEquals("acrServerUrl"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + acrServerUrl = new Uri(property.Value.GetString()); + continue; + } + if (property.NameEquals("repositories"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + repositories = array; + continue; + } + if (property.NameEquals("expiry"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + expiry = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("credentialType"u8)) + { + credentialType = new CredentialType(property.Value.GetString()); + continue; + } + } + return new AzureContainerRegistryScopedTokenCredential(credentialType, username.Value, acrToken.Value, acrServerUrl.Value, Optional.ToList(repositories), Optional.ToNullable(expiry)); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureContainerRegistryScopedTokenCredential.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureContainerRegistryScopedTokenCredential.cs new file mode 100644 index 000000000000..d3ef92571255 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureContainerRegistryScopedTokenCredential.cs @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// The azure container registry scoped token credential definition. + public partial class AzureContainerRegistryScopedTokenCredential : ArtifactAccessCredential + { + /// Initializes a new instance of AzureContainerRegistryScopedTokenCredential. + internal AzureContainerRegistryScopedTokenCredential() + { + Repositories = new ChangeTrackingList(); + CredentialType = CredentialType.AzureContainerRegistryScopedToken; + } + + /// Initializes a new instance of AzureContainerRegistryScopedTokenCredential. + /// The credential type. + /// The username of the credential. + /// The credential value. + /// The Acr server url. + /// The repositories that could be accessed using the current credential. + /// The UTC time when credential will expire. + internal AzureContainerRegistryScopedTokenCredential(CredentialType credentialType, string username, string acrToken, Uri acrServerUri, IReadOnlyList repositories, DateTimeOffset? expiry) : base(credentialType) + { + Username = username; + AcrToken = acrToken; + AcrServerUri = acrServerUri; + Repositories = repositories; + Expiry = expiry; + CredentialType = credentialType; + } + + /// The username of the credential. + public string Username { get; } + /// The credential value. + public string AcrToken { get; } + /// The Acr server url. + public Uri AcrServerUri { get; } + /// The repositories that could be accessed using the current credential. + public IReadOnlyList Repositories { get; } + /// The UTC time when credential will expire. + public DateTimeOffset? Expiry { get; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureCoreArmTemplateArtifactProfile.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureCoreArmTemplateArtifactProfile.Serialization.cs new file mode 100644 index 000000000000..8d5ca0d888af --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureCoreArmTemplateArtifactProfile.Serialization.cs @@ -0,0 +1,64 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Resources.Models; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class AzureCoreArmTemplateArtifactProfile : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(TemplateArtifactProfile)) + { + writer.WritePropertyName("templateArtifactProfile"u8); + writer.WriteObjectValue(TemplateArtifactProfile); + } + if (Optional.IsDefined(ArtifactStore)) + { + writer.WritePropertyName("artifactStore"u8); + JsonSerializer.Serialize(writer, ArtifactStore); + } + writer.WriteEndObject(); + } + + internal static AzureCoreArmTemplateArtifactProfile DeserializeAzureCoreArmTemplateArtifactProfile(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional templateArtifactProfile = default; + Optional artifactStore = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("templateArtifactProfile"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + templateArtifactProfile = ArmTemplateArtifactProfile.DeserializeArmTemplateArtifactProfile(property.Value); + continue; + } + if (property.NameEquals("artifactStore"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + artifactStore = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + } + return new AzureCoreArmTemplateArtifactProfile(artifactStore, templateArtifactProfile.Value); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureCoreArmTemplateArtifactProfile.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureCoreArmTemplateArtifactProfile.cs new file mode 100644 index 000000000000..29fe007bd364 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureCoreArmTemplateArtifactProfile.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.ResourceManager.Resources.Models; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// Azure template artifact profile properties. + public partial class AzureCoreArmTemplateArtifactProfile : ArtifactProfile + { + /// Initializes a new instance of AzureCoreArmTemplateArtifactProfile. + public AzureCoreArmTemplateArtifactProfile() + { + } + + /// Initializes a new instance of AzureCoreArmTemplateArtifactProfile. + /// The reference to artifact store. + /// Template artifact profile. + internal AzureCoreArmTemplateArtifactProfile(WritableSubResource artifactStore, ArmTemplateArtifactProfile templateArtifactProfile) : base(artifactStore) + { + TemplateArtifactProfile = templateArtifactProfile; + } + + /// Template artifact profile. + public ArmTemplateArtifactProfile TemplateArtifactProfile { get; set; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureCoreArmTemplateDeployMappingRuleProfile.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureCoreArmTemplateDeployMappingRuleProfile.Serialization.cs new file mode 100644 index 000000000000..5b58542e5064 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureCoreArmTemplateDeployMappingRuleProfile.Serialization.cs @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class AzureCoreArmTemplateDeployMappingRuleProfile : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(TemplateMappingRuleProfile)) + { + writer.WritePropertyName("templateMappingRuleProfile"u8); + writer.WriteObjectValue(TemplateMappingRuleProfile); + } + if (Optional.IsDefined(ApplicationEnablement)) + { + writer.WritePropertyName("applicationEnablement"u8); + writer.WriteStringValue(ApplicationEnablement.Value.ToString()); + } + writer.WriteEndObject(); + } + + internal static AzureCoreArmTemplateDeployMappingRuleProfile DeserializeAzureCoreArmTemplateDeployMappingRuleProfile(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional templateMappingRuleProfile = default; + Optional applicationEnablement = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("templateMappingRuleProfile"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + templateMappingRuleProfile = ArmTemplateMappingRuleProfile.DeserializeArmTemplateMappingRuleProfile(property.Value); + continue; + } + if (property.NameEquals("applicationEnablement"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + applicationEnablement = new ApplicationEnablement(property.Value.GetString()); + continue; + } + } + return new AzureCoreArmTemplateDeployMappingRuleProfile(Optional.ToNullable(applicationEnablement), templateMappingRuleProfile.Value); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureCoreArmTemplateDeployMappingRuleProfile.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureCoreArmTemplateDeployMappingRuleProfile.cs new file mode 100644 index 000000000000..039ed46e15b1 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureCoreArmTemplateDeployMappingRuleProfile.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// Azure template deploy mapping rule profile. + public partial class AzureCoreArmTemplateDeployMappingRuleProfile : MappingRuleProfile + { + /// Initializes a new instance of AzureCoreArmTemplateDeployMappingRuleProfile. + public AzureCoreArmTemplateDeployMappingRuleProfile() + { + } + + /// Initializes a new instance of AzureCoreArmTemplateDeployMappingRuleProfile. + /// The application enablement. + /// The template mapping rule profile. + internal AzureCoreArmTemplateDeployMappingRuleProfile(ApplicationEnablement? applicationEnablement, ArmTemplateMappingRuleProfile templateMappingRuleProfile) : base(applicationEnablement) + { + TemplateMappingRuleProfile = templateMappingRuleProfile; + } + + /// The template mapping rule profile. + internal ArmTemplateMappingRuleProfile TemplateMappingRuleProfile { get; set; } + /// List of template parameters. + public string TemplateParameters + { + get => TemplateMappingRuleProfile is null ? default : TemplateMappingRuleProfile.TemplateParameters; + set + { + if (TemplateMappingRuleProfile is null) + TemplateMappingRuleProfile = new ArmTemplateMappingRuleProfile(); + TemplateMappingRuleProfile.TemplateParameters = value; + } + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureCoreArtifactType.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureCoreArtifactType.cs new file mode 100644 index 000000000000..374260833c74 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureCoreArtifactType.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.HybridNetwork.Models +{ + /// The artifact type. + internal readonly partial struct AzureCoreArtifactType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public AzureCoreArtifactType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string UnknownValue = "Unknown"; + private const string VhdImageFileValue = "VhdImageFile"; + private const string ArmTemplateValue = "ArmTemplate"; + + /// Unknown. + public static AzureCoreArtifactType Unknown { get; } = new AzureCoreArtifactType(UnknownValue); + /// VhdImageFile. + public static AzureCoreArtifactType VhdImageFile { get; } = new AzureCoreArtifactType(VhdImageFileValue); + /// ArmTemplate. + public static AzureCoreArtifactType ArmTemplate { get; } = new AzureCoreArtifactType(ArmTemplateValue); + /// Determines if two values are the same. + public static bool operator ==(AzureCoreArtifactType left, AzureCoreArtifactType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(AzureCoreArtifactType left, AzureCoreArtifactType right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator AzureCoreArtifactType(string value) => new AzureCoreArtifactType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is AzureCoreArtifactType other && Equals(other); + /// + public bool Equals(AzureCoreArtifactType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureCoreNetworkFunctionApplication.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureCoreNetworkFunctionApplication.Serialization.cs new file mode 100644 index 000000000000..621ea1c85d49 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureCoreNetworkFunctionApplication.Serialization.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class AzureCoreNetworkFunctionApplication : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("artifactType"u8); + writer.WriteStringValue(ArtifactType.ToString()); + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (Optional.IsDefined(DependsOnProfile)) + { + writer.WritePropertyName("dependsOnProfile"u8); + writer.WriteObjectValue(DependsOnProfile); + } + writer.WriteEndObject(); + } + + internal static AzureCoreNetworkFunctionApplication DeserializeAzureCoreNetworkFunctionApplication(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + if (element.TryGetProperty("artifactType", out JsonElement discriminator)) + { + switch (discriminator.GetString()) + { + case "ArmTemplate": return AzureCoreNetworkFunctionArmTemplateApplication.DeserializeAzureCoreNetworkFunctionArmTemplateApplication(element); + case "VhdImageFile": return AzureCoreNetworkFunctionVhdApplication.DeserializeAzureCoreNetworkFunctionVhdApplication(element); + } + } + AzureCoreArtifactType artifactType = default; + Optional name = default; + Optional dependsOnProfile = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("artifactType"u8)) + { + artifactType = new AzureCoreArtifactType(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("dependsOnProfile"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + dependsOnProfile = DependsOnProfile.DeserializeDependsOnProfile(property.Value); + continue; + } + } + return new AzureCoreNetworkFunctionApplication(name.Value, dependsOnProfile.Value, artifactType); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureCoreNetworkFunctionApplication.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureCoreNetworkFunctionApplication.cs new file mode 100644 index 000000000000..e3c4d9c3a066 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureCoreNetworkFunctionApplication.cs @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// + /// Azure virtual network function application definition. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include and . + /// + public partial class AzureCoreNetworkFunctionApplication : NetworkFunctionApplication + { + /// Initializes a new instance of AzureCoreNetworkFunctionApplication. + public AzureCoreNetworkFunctionApplication() + { + } + + /// Initializes a new instance of AzureCoreNetworkFunctionApplication. + /// The name of the network function application. + /// Depends on profile definition. + /// The artifact type. + internal AzureCoreNetworkFunctionApplication(string name, DependsOnProfile dependsOnProfile, AzureCoreArtifactType artifactType) : base(name, dependsOnProfile) + { + ArtifactType = artifactType; + } + + /// The artifact type. + internal AzureCoreArtifactType ArtifactType { get; set; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureCoreNetworkFunctionArmTemplateApplication.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureCoreNetworkFunctionArmTemplateApplication.Serialization.cs new file mode 100644 index 000000000000..f5641df49e77 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureCoreNetworkFunctionArmTemplateApplication.Serialization.cs @@ -0,0 +1,97 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class AzureCoreNetworkFunctionArmTemplateApplication : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(ArtifactProfile)) + { + writer.WritePropertyName("artifactProfile"u8); + writer.WriteObjectValue(ArtifactProfile); + } + if (Optional.IsDefined(DeployParametersMappingRuleProfile)) + { + writer.WritePropertyName("deployParametersMappingRuleProfile"u8); + writer.WriteObjectValue(DeployParametersMappingRuleProfile); + } + writer.WritePropertyName("artifactType"u8); + writer.WriteStringValue(ArtifactType.ToString()); + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (Optional.IsDefined(DependsOnProfile)) + { + writer.WritePropertyName("dependsOnProfile"u8); + writer.WriteObjectValue(DependsOnProfile); + } + writer.WriteEndObject(); + } + + internal static AzureCoreNetworkFunctionArmTemplateApplication DeserializeAzureCoreNetworkFunctionArmTemplateApplication(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional artifactProfile = default; + Optional deployParametersMappingRuleProfile = default; + AzureCoreArtifactType artifactType = default; + Optional name = default; + Optional dependsOnProfile = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("artifactProfile"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + artifactProfile = AzureCoreArmTemplateArtifactProfile.DeserializeAzureCoreArmTemplateArtifactProfile(property.Value); + continue; + } + if (property.NameEquals("deployParametersMappingRuleProfile"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + deployParametersMappingRuleProfile = AzureCoreArmTemplateDeployMappingRuleProfile.DeserializeAzureCoreArmTemplateDeployMappingRuleProfile(property.Value); + continue; + } + if (property.NameEquals("artifactType"u8)) + { + artifactType = new AzureCoreArtifactType(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("dependsOnProfile"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + dependsOnProfile = DependsOnProfile.DeserializeDependsOnProfile(property.Value); + continue; + } + } + return new AzureCoreNetworkFunctionArmTemplateApplication(name.Value, dependsOnProfile.Value, artifactType, artifactProfile.Value, deployParametersMappingRuleProfile.Value); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureCoreNetworkFunctionArmTemplateApplication.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureCoreNetworkFunctionArmTemplateApplication.cs new file mode 100644 index 000000000000..45ca56955c2d --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureCoreNetworkFunctionArmTemplateApplication.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// Azure core network function Template application definition. + public partial class AzureCoreNetworkFunctionArmTemplateApplication : AzureCoreNetworkFunctionApplication + { + /// Initializes a new instance of AzureCoreNetworkFunctionArmTemplateApplication. + public AzureCoreNetworkFunctionArmTemplateApplication() + { + ArtifactType = AzureCoreArtifactType.ArmTemplate; + } + + /// Initializes a new instance of AzureCoreNetworkFunctionArmTemplateApplication. + /// The name of the network function application. + /// Depends on profile definition. + /// The artifact type. + /// Azure template artifact profile. + /// Deploy mapping rule profile. + internal AzureCoreNetworkFunctionArmTemplateApplication(string name, DependsOnProfile dependsOnProfile, AzureCoreArtifactType artifactType, AzureCoreArmTemplateArtifactProfile artifactProfile, AzureCoreArmTemplateDeployMappingRuleProfile deployParametersMappingRuleProfile) : base(name, dependsOnProfile, artifactType) + { + ArtifactProfile = artifactProfile; + DeployParametersMappingRuleProfile = deployParametersMappingRuleProfile; + ArtifactType = artifactType; + } + + /// Azure template artifact profile. + public AzureCoreArmTemplateArtifactProfile ArtifactProfile { get; set; } + /// Deploy mapping rule profile. + public AzureCoreArmTemplateDeployMappingRuleProfile DeployParametersMappingRuleProfile { get; set; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureCoreNetworkFunctionTemplate.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureCoreNetworkFunctionTemplate.Serialization.cs new file mode 100644 index 000000000000..aac0951e037f --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureCoreNetworkFunctionTemplate.Serialization.cs @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class AzureCoreNetworkFunctionTemplate : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(NetworkFunctionApplications)) + { + writer.WritePropertyName("networkFunctionApplications"u8); + writer.WriteStartArray(); + foreach (var item in NetworkFunctionApplications) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + writer.WritePropertyName("nfviType"u8); + writer.WriteStringValue(NfviType.ToString()); + writer.WriteEndObject(); + } + + internal static AzureCoreNetworkFunctionTemplate DeserializeAzureCoreNetworkFunctionTemplate(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> networkFunctionApplications = default; + VirtualNetworkFunctionNfviType nfviType = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("networkFunctionApplications"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(AzureCoreNetworkFunctionApplication.DeserializeAzureCoreNetworkFunctionApplication(item)); + } + networkFunctionApplications = array; + continue; + } + if (property.NameEquals("nfviType"u8)) + { + nfviType = new VirtualNetworkFunctionNfviType(property.Value.GetString()); + continue; + } + } + return new AzureCoreNetworkFunctionTemplate(nfviType, Optional.ToList(networkFunctionApplications)); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureCoreNetworkFunctionTemplate.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureCoreNetworkFunctionTemplate.cs new file mode 100644 index 000000000000..f6e76c9a646a --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureCoreNetworkFunctionTemplate.cs @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// Azure virtual network function template. + public partial class AzureCoreNetworkFunctionTemplate : VirtualNetworkFunctionTemplate + { + /// Initializes a new instance of AzureCoreNetworkFunctionTemplate. + public AzureCoreNetworkFunctionTemplate() + { + NetworkFunctionApplications = new ChangeTrackingList(); + NfviType = VirtualNetworkFunctionNfviType.AzureCore; + } + + /// Initializes a new instance of AzureCoreNetworkFunctionTemplate. + /// The network function type. + /// + /// Network function applications. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include and . + /// + internal AzureCoreNetworkFunctionTemplate(VirtualNetworkFunctionNfviType nfviType, IList networkFunctionApplications) : base(nfviType) + { + NetworkFunctionApplications = networkFunctionApplications; + NfviType = nfviType; + } + + /// + /// Network function applications. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include and . + /// + public IList NetworkFunctionApplications { get; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureCoreNetworkFunctionVhdApplication.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureCoreNetworkFunctionVhdApplication.Serialization.cs new file mode 100644 index 000000000000..49cabe58dbb3 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureCoreNetworkFunctionVhdApplication.Serialization.cs @@ -0,0 +1,97 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class AzureCoreNetworkFunctionVhdApplication : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(ArtifactProfile)) + { + writer.WritePropertyName("artifactProfile"u8); + writer.WriteObjectValue(ArtifactProfile); + } + if (Optional.IsDefined(DeployParametersMappingRuleProfile)) + { + writer.WritePropertyName("deployParametersMappingRuleProfile"u8); + writer.WriteObjectValue(DeployParametersMappingRuleProfile); + } + writer.WritePropertyName("artifactType"u8); + writer.WriteStringValue(ArtifactType.ToString()); + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (Optional.IsDefined(DependsOnProfile)) + { + writer.WritePropertyName("dependsOnProfile"u8); + writer.WriteObjectValue(DependsOnProfile); + } + writer.WriteEndObject(); + } + + internal static AzureCoreNetworkFunctionVhdApplication DeserializeAzureCoreNetworkFunctionVhdApplication(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional artifactProfile = default; + Optional deployParametersMappingRuleProfile = default; + AzureCoreArtifactType artifactType = default; + Optional name = default; + Optional dependsOnProfile = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("artifactProfile"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + artifactProfile = AzureCoreVhdImageArtifactProfile.DeserializeAzureCoreVhdImageArtifactProfile(property.Value); + continue; + } + if (property.NameEquals("deployParametersMappingRuleProfile"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + deployParametersMappingRuleProfile = AzureCoreVhdImageDeployMappingRuleProfile.DeserializeAzureCoreVhdImageDeployMappingRuleProfile(property.Value); + continue; + } + if (property.NameEquals("artifactType"u8)) + { + artifactType = new AzureCoreArtifactType(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("dependsOnProfile"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + dependsOnProfile = DependsOnProfile.DeserializeDependsOnProfile(property.Value); + continue; + } + } + return new AzureCoreNetworkFunctionVhdApplication(name.Value, dependsOnProfile.Value, artifactType, artifactProfile.Value, deployParametersMappingRuleProfile.Value); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureCoreNetworkFunctionVhdApplication.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureCoreNetworkFunctionVhdApplication.cs new file mode 100644 index 000000000000..2e3bdf8b08ba --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureCoreNetworkFunctionVhdApplication.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// Azure core network function vhd application definition. + public partial class AzureCoreNetworkFunctionVhdApplication : AzureCoreNetworkFunctionApplication + { + /// Initializes a new instance of AzureCoreNetworkFunctionVhdApplication. + public AzureCoreNetworkFunctionVhdApplication() + { + ArtifactType = AzureCoreArtifactType.VhdImageFile; + } + + /// Initializes a new instance of AzureCoreNetworkFunctionVhdApplication. + /// The name of the network function application. + /// Depends on profile definition. + /// The artifact type. + /// Azure vhd image artifact profile. + /// Deploy mapping rule profile. + internal AzureCoreNetworkFunctionVhdApplication(string name, DependsOnProfile dependsOnProfile, AzureCoreArtifactType artifactType, AzureCoreVhdImageArtifactProfile artifactProfile, AzureCoreVhdImageDeployMappingRuleProfile deployParametersMappingRuleProfile) : base(name, dependsOnProfile, artifactType) + { + ArtifactProfile = artifactProfile; + DeployParametersMappingRuleProfile = deployParametersMappingRuleProfile; + ArtifactType = artifactType; + } + + /// Azure vhd image artifact profile. + public AzureCoreVhdImageArtifactProfile ArtifactProfile { get; set; } + /// Deploy mapping rule profile. + public AzureCoreVhdImageDeployMappingRuleProfile DeployParametersMappingRuleProfile { get; set; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureCoreNfviDetails.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureCoreNfviDetails.Serialization.cs new file mode 100644 index 000000000000..fe9c3eca0be1 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureCoreNfviDetails.Serialization.cs @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class AzureCoreNfviDetails : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Location)) + { + writer.WritePropertyName("location"u8); + writer.WriteStringValue(Location.Value); + } + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + writer.WritePropertyName("nfviType"u8); + writer.WriteStringValue(NfviType.ToString()); + writer.WriteEndObject(); + } + + internal static AzureCoreNfviDetails DeserializeAzureCoreNfviDetails(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional location = default; + Optional name = default; + NfviType nfviType = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("location"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + location = new AzureLocation(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("nfviType"u8)) + { + nfviType = new NfviType(property.Value.GetString()); + continue; + } + } + return new AzureCoreNfviDetails(name.Value, nfviType, Optional.ToNullable(location)); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureCoreNfviDetails.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureCoreNfviDetails.cs new file mode 100644 index 000000000000..10cde9bf455b --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureCoreNfviDetails.cs @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// The Azure Core NFVI detail. + public partial class AzureCoreNfviDetails : NFVIs + { + /// Initializes a new instance of AzureCoreNfviDetails. + public AzureCoreNfviDetails() + { + NfviType = NfviType.AzureCore; + } + + /// Initializes a new instance of AzureCoreNfviDetails. + /// Name of the nfvi. + /// The NFVI type. + /// Location of the Azure core. + internal AzureCoreNfviDetails(string name, NfviType nfviType, AzureLocation? location) : base(name, nfviType) + { + Location = location; + NfviType = nfviType; + } + + /// Location of the Azure core. + public AzureLocation? Location { get; set; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureCoreVhdImageArtifactProfile.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureCoreVhdImageArtifactProfile.Serialization.cs new file mode 100644 index 000000000000..a3f15b18146c --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureCoreVhdImageArtifactProfile.Serialization.cs @@ -0,0 +1,64 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Resources.Models; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class AzureCoreVhdImageArtifactProfile : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(VhdArtifactProfile)) + { + writer.WritePropertyName("vhdArtifactProfile"u8); + writer.WriteObjectValue(VhdArtifactProfile); + } + if (Optional.IsDefined(ArtifactStore)) + { + writer.WritePropertyName("artifactStore"u8); + JsonSerializer.Serialize(writer, ArtifactStore); + } + writer.WriteEndObject(); + } + + internal static AzureCoreVhdImageArtifactProfile DeserializeAzureCoreVhdImageArtifactProfile(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional vhdArtifactProfile = default; + Optional artifactStore = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("vhdArtifactProfile"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + vhdArtifactProfile = VhdImageArtifactProfile.DeserializeVhdImageArtifactProfile(property.Value); + continue; + } + if (property.NameEquals("artifactStore"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + artifactStore = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + } + return new AzureCoreVhdImageArtifactProfile(artifactStore, vhdArtifactProfile.Value); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureCoreVhdImageArtifactProfile.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureCoreVhdImageArtifactProfile.cs new file mode 100644 index 000000000000..66ec3471b5ca --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureCoreVhdImageArtifactProfile.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.ResourceManager.Resources.Models; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// Azure vhd artifact profile properties. + public partial class AzureCoreVhdImageArtifactProfile : ArtifactProfile + { + /// Initializes a new instance of AzureCoreVhdImageArtifactProfile. + public AzureCoreVhdImageArtifactProfile() + { + } + + /// Initializes a new instance of AzureCoreVhdImageArtifactProfile. + /// The reference to artifact store. + /// Vhd artifact profile. + internal AzureCoreVhdImageArtifactProfile(WritableSubResource artifactStore, VhdImageArtifactProfile vhdArtifactProfile) : base(artifactStore) + { + VhdArtifactProfile = vhdArtifactProfile; + } + + /// Vhd artifact profile. + public VhdImageArtifactProfile VhdArtifactProfile { get; set; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureCoreVhdImageDeployMappingRuleProfile.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureCoreVhdImageDeployMappingRuleProfile.Serialization.cs new file mode 100644 index 000000000000..3771fd9adb3e --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureCoreVhdImageDeployMappingRuleProfile.Serialization.cs @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class AzureCoreVhdImageDeployMappingRuleProfile : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(VhdImageMappingRuleProfile)) + { + writer.WritePropertyName("vhdImageMappingRuleProfile"u8); + writer.WriteObjectValue(VhdImageMappingRuleProfile); + } + if (Optional.IsDefined(ApplicationEnablement)) + { + writer.WritePropertyName("applicationEnablement"u8); + writer.WriteStringValue(ApplicationEnablement.Value.ToString()); + } + writer.WriteEndObject(); + } + + internal static AzureCoreVhdImageDeployMappingRuleProfile DeserializeAzureCoreVhdImageDeployMappingRuleProfile(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional vhdImageMappingRuleProfile = default; + Optional applicationEnablement = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("vhdImageMappingRuleProfile"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + vhdImageMappingRuleProfile = VhdImageMappingRuleProfile.DeserializeVhdImageMappingRuleProfile(property.Value); + continue; + } + if (property.NameEquals("applicationEnablement"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + applicationEnablement = new ApplicationEnablement(property.Value.GetString()); + continue; + } + } + return new AzureCoreVhdImageDeployMappingRuleProfile(Optional.ToNullable(applicationEnablement), vhdImageMappingRuleProfile.Value); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureCoreVhdImageDeployMappingRuleProfile.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureCoreVhdImageDeployMappingRuleProfile.cs new file mode 100644 index 000000000000..b395b712726d --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureCoreVhdImageDeployMappingRuleProfile.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// Azure vhd deploy mapping rule profile. + public partial class AzureCoreVhdImageDeployMappingRuleProfile : MappingRuleProfile + { + /// Initializes a new instance of AzureCoreVhdImageDeployMappingRuleProfile. + public AzureCoreVhdImageDeployMappingRuleProfile() + { + } + + /// Initializes a new instance of AzureCoreVhdImageDeployMappingRuleProfile. + /// The application enablement. + /// The vhd mapping rule profile. + internal AzureCoreVhdImageDeployMappingRuleProfile(ApplicationEnablement? applicationEnablement, VhdImageMappingRuleProfile vhdImageMappingRuleProfile) : base(applicationEnablement) + { + VhdImageMappingRuleProfile = vhdImageMappingRuleProfile; + } + + /// The vhd mapping rule profile. + internal VhdImageMappingRuleProfile VhdImageMappingRuleProfile { get; set; } + /// List of values. + public string VhdImageMappingRuleUserConfiguration + { + get => VhdImageMappingRuleProfile is null ? default : VhdImageMappingRuleProfile.UserConfiguration; + set + { + if (VhdImageMappingRuleProfile is null) + VhdImageMappingRuleProfile = new VhdImageMappingRuleProfile(); + VhdImageMappingRuleProfile.UserConfiguration = value; + } + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureOperatorNexusArmTemplateArtifactProfile.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureOperatorNexusArmTemplateArtifactProfile.Serialization.cs new file mode 100644 index 000000000000..80d3f5578802 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureOperatorNexusArmTemplateArtifactProfile.Serialization.cs @@ -0,0 +1,64 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Resources.Models; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class AzureOperatorNexusArmTemplateArtifactProfile : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(TemplateArtifactProfile)) + { + writer.WritePropertyName("templateArtifactProfile"u8); + writer.WriteObjectValue(TemplateArtifactProfile); + } + if (Optional.IsDefined(ArtifactStore)) + { + writer.WritePropertyName("artifactStore"u8); + JsonSerializer.Serialize(writer, ArtifactStore); + } + writer.WriteEndObject(); + } + + internal static AzureOperatorNexusArmTemplateArtifactProfile DeserializeAzureOperatorNexusArmTemplateArtifactProfile(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional templateArtifactProfile = default; + Optional artifactStore = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("templateArtifactProfile"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + templateArtifactProfile = ArmTemplateArtifactProfile.DeserializeArmTemplateArtifactProfile(property.Value); + continue; + } + if (property.NameEquals("artifactStore"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + artifactStore = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + } + return new AzureOperatorNexusArmTemplateArtifactProfile(artifactStore, templateArtifactProfile.Value); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureOperatorNexusArmTemplateArtifactProfile.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureOperatorNexusArmTemplateArtifactProfile.cs new file mode 100644 index 000000000000..1722736f09e0 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureOperatorNexusArmTemplateArtifactProfile.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.ResourceManager.Resources.Models; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// Azure Operator Distributed Services vhd artifact profile properties. + public partial class AzureOperatorNexusArmTemplateArtifactProfile : ArtifactProfile + { + /// Initializes a new instance of AzureOperatorNexusArmTemplateArtifactProfile. + public AzureOperatorNexusArmTemplateArtifactProfile() + { + } + + /// Initializes a new instance of AzureOperatorNexusArmTemplateArtifactProfile. + /// The reference to artifact store. + /// Template artifact profile. + internal AzureOperatorNexusArmTemplateArtifactProfile(WritableSubResource artifactStore, ArmTemplateArtifactProfile templateArtifactProfile) : base(artifactStore) + { + TemplateArtifactProfile = templateArtifactProfile; + } + + /// Template artifact profile. + public ArmTemplateArtifactProfile TemplateArtifactProfile { get; set; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureOperatorNexusArmTemplateDeployMappingRuleProfile.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureOperatorNexusArmTemplateDeployMappingRuleProfile.Serialization.cs new file mode 100644 index 000000000000..c2c9ede8f57b --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureOperatorNexusArmTemplateDeployMappingRuleProfile.Serialization.cs @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class AzureOperatorNexusArmTemplateDeployMappingRuleProfile : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(TemplateMappingRuleProfile)) + { + writer.WritePropertyName("templateMappingRuleProfile"u8); + writer.WriteObjectValue(TemplateMappingRuleProfile); + } + if (Optional.IsDefined(ApplicationEnablement)) + { + writer.WritePropertyName("applicationEnablement"u8); + writer.WriteStringValue(ApplicationEnablement.Value.ToString()); + } + writer.WriteEndObject(); + } + + internal static AzureOperatorNexusArmTemplateDeployMappingRuleProfile DeserializeAzureOperatorNexusArmTemplateDeployMappingRuleProfile(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional templateMappingRuleProfile = default; + Optional applicationEnablement = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("templateMappingRuleProfile"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + templateMappingRuleProfile = ArmTemplateMappingRuleProfile.DeserializeArmTemplateMappingRuleProfile(property.Value); + continue; + } + if (property.NameEquals("applicationEnablement"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + applicationEnablement = new ApplicationEnablement(property.Value.GetString()); + continue; + } + } + return new AzureOperatorNexusArmTemplateDeployMappingRuleProfile(Optional.ToNullable(applicationEnablement), templateMappingRuleProfile.Value); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureOperatorNexusArmTemplateDeployMappingRuleProfile.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureOperatorNexusArmTemplateDeployMappingRuleProfile.cs new file mode 100644 index 000000000000..144d22fab870 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureOperatorNexusArmTemplateDeployMappingRuleProfile.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// Azure Operator Distributed Services template deploy mapping rule profile. + public partial class AzureOperatorNexusArmTemplateDeployMappingRuleProfile : MappingRuleProfile + { + /// Initializes a new instance of AzureOperatorNexusArmTemplateDeployMappingRuleProfile. + public AzureOperatorNexusArmTemplateDeployMappingRuleProfile() + { + } + + /// Initializes a new instance of AzureOperatorNexusArmTemplateDeployMappingRuleProfile. + /// The application enablement. + /// The template mapping rule profile. + internal AzureOperatorNexusArmTemplateDeployMappingRuleProfile(ApplicationEnablement? applicationEnablement, ArmTemplateMappingRuleProfile templateMappingRuleProfile) : base(applicationEnablement) + { + TemplateMappingRuleProfile = templateMappingRuleProfile; + } + + /// The template mapping rule profile. + internal ArmTemplateMappingRuleProfile TemplateMappingRuleProfile { get; set; } + /// List of template parameters. + public string TemplateParameters + { + get => TemplateMappingRuleProfile is null ? default : TemplateMappingRuleProfile.TemplateParameters; + set + { + if (TemplateMappingRuleProfile is null) + TemplateMappingRuleProfile = new ArmTemplateMappingRuleProfile(); + TemplateMappingRuleProfile.TemplateParameters = value; + } + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureOperatorNexusArtifactType.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureOperatorNexusArtifactType.cs new file mode 100644 index 000000000000..41729113c591 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureOperatorNexusArtifactType.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.HybridNetwork.Models +{ + /// The artifact type. + internal readonly partial struct AzureOperatorNexusArtifactType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public AzureOperatorNexusArtifactType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string UnknownValue = "Unknown"; + private const string ImageFileValue = "ImageFile"; + private const string ArmTemplateValue = "ArmTemplate"; + + /// Unknown. + public static AzureOperatorNexusArtifactType Unknown { get; } = new AzureOperatorNexusArtifactType(UnknownValue); + /// ImageFile. + public static AzureOperatorNexusArtifactType ImageFile { get; } = new AzureOperatorNexusArtifactType(ImageFileValue); + /// ArmTemplate. + public static AzureOperatorNexusArtifactType ArmTemplate { get; } = new AzureOperatorNexusArtifactType(ArmTemplateValue); + /// Determines if two values are the same. + public static bool operator ==(AzureOperatorNexusArtifactType left, AzureOperatorNexusArtifactType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(AzureOperatorNexusArtifactType left, AzureOperatorNexusArtifactType right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator AzureOperatorNexusArtifactType(string value) => new AzureOperatorNexusArtifactType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is AzureOperatorNexusArtifactType other && Equals(other); + /// + public bool Equals(AzureOperatorNexusArtifactType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureOperatorNexusClusterNfviDetails.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureOperatorNexusClusterNfviDetails.Serialization.cs new file mode 100644 index 000000000000..18dbd4360f96 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureOperatorNexusClusterNfviDetails.Serialization.cs @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Resources.Models; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class AzureOperatorNexusClusterNfviDetails : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(CustomLocationReference)) + { + writer.WritePropertyName("customLocationReference"u8); + JsonSerializer.Serialize(writer, CustomLocationReference); + } + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + writer.WritePropertyName("nfviType"u8); + writer.WriteStringValue(NfviType.ToString()); + writer.WriteEndObject(); + } + + internal static AzureOperatorNexusClusterNfviDetails DeserializeAzureOperatorNexusClusterNfviDetails(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional customLocationReference = default; + Optional name = default; + NfviType nfviType = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("customLocationReference"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + customLocationReference = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("nfviType"u8)) + { + nfviType = new NfviType(property.Value.GetString()); + continue; + } + } + return new AzureOperatorNexusClusterNfviDetails(name.Value, nfviType, customLocationReference); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureOperatorNexusClusterNfviDetails.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureOperatorNexusClusterNfviDetails.cs new file mode 100644 index 000000000000..0a90b22e4c64 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureOperatorNexusClusterNfviDetails.cs @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager.Resources.Models; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// The AzureOperatorNexusCluster NFVI detail. + public partial class AzureOperatorNexusClusterNfviDetails : NFVIs + { + /// Initializes a new instance of AzureOperatorNexusClusterNfviDetails. + public AzureOperatorNexusClusterNfviDetails() + { + NfviType = NfviType.AzureOperatorNexus; + } + + /// Initializes a new instance of AzureOperatorNexusClusterNfviDetails. + /// Name of the nfvi. + /// The NFVI type. + /// The reference to the custom location. + internal AzureOperatorNexusClusterNfviDetails(string name, NfviType nfviType, WritableSubResource customLocationReference) : base(name, nfviType) + { + CustomLocationReference = customLocationReference; + NfviType = nfviType; + } + + /// The reference to the custom location. + internal WritableSubResource CustomLocationReference { get; set; } + /// Gets or sets Id. + public ResourceIdentifier CustomLocationReferenceId + { + get => CustomLocationReference is null ? default : CustomLocationReference.Id; + set + { + if (CustomLocationReference is null) + CustomLocationReference = new WritableSubResource(); + CustomLocationReference.Id = value; + } + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureOperatorNexusImageArtifactProfile.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureOperatorNexusImageArtifactProfile.Serialization.cs new file mode 100644 index 000000000000..cfab74b1e847 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureOperatorNexusImageArtifactProfile.Serialization.cs @@ -0,0 +1,64 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Resources.Models; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class AzureOperatorNexusImageArtifactProfile : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(ImageArtifactProfile)) + { + writer.WritePropertyName("imageArtifactProfile"u8); + writer.WriteObjectValue(ImageArtifactProfile); + } + if (Optional.IsDefined(ArtifactStore)) + { + writer.WritePropertyName("artifactStore"u8); + JsonSerializer.Serialize(writer, ArtifactStore); + } + writer.WriteEndObject(); + } + + internal static AzureOperatorNexusImageArtifactProfile DeserializeAzureOperatorNexusImageArtifactProfile(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional imageArtifactProfile = default; + Optional artifactStore = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("imageArtifactProfile"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + imageArtifactProfile = ImageArtifactProfile.DeserializeImageArtifactProfile(property.Value); + continue; + } + if (property.NameEquals("artifactStore"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + artifactStore = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + } + return new AzureOperatorNexusImageArtifactProfile(artifactStore, imageArtifactProfile.Value); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureOperatorNexusImageArtifactProfile.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureOperatorNexusImageArtifactProfile.cs new file mode 100644 index 000000000000..8c43438a7709 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureOperatorNexusImageArtifactProfile.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.ResourceManager.Resources.Models; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// Azure Operator Distributed Services image artifact profile properties. + public partial class AzureOperatorNexusImageArtifactProfile : ArtifactProfile + { + /// Initializes a new instance of AzureOperatorNexusImageArtifactProfile. + public AzureOperatorNexusImageArtifactProfile() + { + } + + /// Initializes a new instance of AzureOperatorNexusImageArtifactProfile. + /// The reference to artifact store. + /// Image artifact profile. + internal AzureOperatorNexusImageArtifactProfile(WritableSubResource artifactStore, ImageArtifactProfile imageArtifactProfile) : base(artifactStore) + { + ImageArtifactProfile = imageArtifactProfile; + } + + /// Image artifact profile. + public ImageArtifactProfile ImageArtifactProfile { get; set; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureOperatorNexusImageDeployMappingRuleProfile.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureOperatorNexusImageDeployMappingRuleProfile.Serialization.cs new file mode 100644 index 000000000000..e1f00b94548b --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureOperatorNexusImageDeployMappingRuleProfile.Serialization.cs @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class AzureOperatorNexusImageDeployMappingRuleProfile : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(ImageMappingRuleProfile)) + { + writer.WritePropertyName("imageMappingRuleProfile"u8); + writer.WriteObjectValue(ImageMappingRuleProfile); + } + if (Optional.IsDefined(ApplicationEnablement)) + { + writer.WritePropertyName("applicationEnablement"u8); + writer.WriteStringValue(ApplicationEnablement.Value.ToString()); + } + writer.WriteEndObject(); + } + + internal static AzureOperatorNexusImageDeployMappingRuleProfile DeserializeAzureOperatorNexusImageDeployMappingRuleProfile(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional imageMappingRuleProfile = default; + Optional applicationEnablement = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("imageMappingRuleProfile"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + imageMappingRuleProfile = ImageMappingRuleProfile.DeserializeImageMappingRuleProfile(property.Value); + continue; + } + if (property.NameEquals("applicationEnablement"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + applicationEnablement = new ApplicationEnablement(property.Value.GetString()); + continue; + } + } + return new AzureOperatorNexusImageDeployMappingRuleProfile(Optional.ToNullable(applicationEnablement), imageMappingRuleProfile.Value); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureOperatorNexusImageDeployMappingRuleProfile.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureOperatorNexusImageDeployMappingRuleProfile.cs new file mode 100644 index 000000000000..f7db1aeb1d63 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureOperatorNexusImageDeployMappingRuleProfile.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// Azure Operator Distributed Services image deploy mapping rule profile. + public partial class AzureOperatorNexusImageDeployMappingRuleProfile : MappingRuleProfile + { + /// Initializes a new instance of AzureOperatorNexusImageDeployMappingRuleProfile. + public AzureOperatorNexusImageDeployMappingRuleProfile() + { + } + + /// Initializes a new instance of AzureOperatorNexusImageDeployMappingRuleProfile. + /// The application enablement. + /// The vhd mapping rule profile. + internal AzureOperatorNexusImageDeployMappingRuleProfile(ApplicationEnablement? applicationEnablement, ImageMappingRuleProfile imageMappingRuleProfile) : base(applicationEnablement) + { + ImageMappingRuleProfile = imageMappingRuleProfile; + } + + /// The vhd mapping rule profile. + internal ImageMappingRuleProfile ImageMappingRuleProfile { get; set; } + /// List of values. + public string ImageMappingRuleUserConfiguration + { + get => ImageMappingRuleProfile is null ? default : ImageMappingRuleProfile.UserConfiguration; + set + { + if (ImageMappingRuleProfile is null) + ImageMappingRuleProfile = new ImageMappingRuleProfile(); + ImageMappingRuleProfile.UserConfiguration = value; + } + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureOperatorNexusNetworkFunctionApplication.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureOperatorNexusNetworkFunctionApplication.Serialization.cs new file mode 100644 index 000000000000..c4edfc2a86d4 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureOperatorNexusNetworkFunctionApplication.Serialization.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class AzureOperatorNexusNetworkFunctionApplication : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("artifactType"u8); + writer.WriteStringValue(ArtifactType.ToString()); + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (Optional.IsDefined(DependsOnProfile)) + { + writer.WritePropertyName("dependsOnProfile"u8); + writer.WriteObjectValue(DependsOnProfile); + } + writer.WriteEndObject(); + } + + internal static AzureOperatorNexusNetworkFunctionApplication DeserializeAzureOperatorNexusNetworkFunctionApplication(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + if (element.TryGetProperty("artifactType", out JsonElement discriminator)) + { + switch (discriminator.GetString()) + { + case "ArmTemplate": return AzureOperatorNexusNetworkFunctionArmTemplateApplication.DeserializeAzureOperatorNexusNetworkFunctionArmTemplateApplication(element); + case "ImageFile": return AzureOperatorNexusNetworkFunctionImageApplication.DeserializeAzureOperatorNexusNetworkFunctionImageApplication(element); + } + } + AzureOperatorNexusArtifactType artifactType = default; + Optional name = default; + Optional dependsOnProfile = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("artifactType"u8)) + { + artifactType = new AzureOperatorNexusArtifactType(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("dependsOnProfile"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + dependsOnProfile = DependsOnProfile.DeserializeDependsOnProfile(property.Value); + continue; + } + } + return new AzureOperatorNexusNetworkFunctionApplication(name.Value, dependsOnProfile.Value, artifactType); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureOperatorNexusNetworkFunctionApplication.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureOperatorNexusNetworkFunctionApplication.cs new file mode 100644 index 000000000000..66dd32e6c141 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureOperatorNexusNetworkFunctionApplication.cs @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// + /// Azure Operator Distributed Services network function application definition. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include and . + /// + public partial class AzureOperatorNexusNetworkFunctionApplication : NetworkFunctionApplication + { + /// Initializes a new instance of AzureOperatorNexusNetworkFunctionApplication. + public AzureOperatorNexusNetworkFunctionApplication() + { + } + + /// Initializes a new instance of AzureOperatorNexusNetworkFunctionApplication. + /// The name of the network function application. + /// Depends on profile definition. + /// The artifact type. + internal AzureOperatorNexusNetworkFunctionApplication(string name, DependsOnProfile dependsOnProfile, AzureOperatorNexusArtifactType artifactType) : base(name, dependsOnProfile) + { + ArtifactType = artifactType; + } + + /// The artifact type. + internal AzureOperatorNexusArtifactType ArtifactType { get; set; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureOperatorNexusNetworkFunctionArmTemplateApplication.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureOperatorNexusNetworkFunctionArmTemplateApplication.Serialization.cs new file mode 100644 index 000000000000..93f428f922aa --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureOperatorNexusNetworkFunctionArmTemplateApplication.Serialization.cs @@ -0,0 +1,97 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class AzureOperatorNexusNetworkFunctionArmTemplateApplication : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(ArtifactProfile)) + { + writer.WritePropertyName("artifactProfile"u8); + writer.WriteObjectValue(ArtifactProfile); + } + if (Optional.IsDefined(DeployParametersMappingRuleProfile)) + { + writer.WritePropertyName("deployParametersMappingRuleProfile"u8); + writer.WriteObjectValue(DeployParametersMappingRuleProfile); + } + writer.WritePropertyName("artifactType"u8); + writer.WriteStringValue(ArtifactType.ToString()); + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (Optional.IsDefined(DependsOnProfile)) + { + writer.WritePropertyName("dependsOnProfile"u8); + writer.WriteObjectValue(DependsOnProfile); + } + writer.WriteEndObject(); + } + + internal static AzureOperatorNexusNetworkFunctionArmTemplateApplication DeserializeAzureOperatorNexusNetworkFunctionArmTemplateApplication(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional artifactProfile = default; + Optional deployParametersMappingRuleProfile = default; + AzureOperatorNexusArtifactType artifactType = default; + Optional name = default; + Optional dependsOnProfile = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("artifactProfile"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + artifactProfile = AzureOperatorNexusArmTemplateArtifactProfile.DeserializeAzureOperatorNexusArmTemplateArtifactProfile(property.Value); + continue; + } + if (property.NameEquals("deployParametersMappingRuleProfile"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + deployParametersMappingRuleProfile = AzureOperatorNexusArmTemplateDeployMappingRuleProfile.DeserializeAzureOperatorNexusArmTemplateDeployMappingRuleProfile(property.Value); + continue; + } + if (property.NameEquals("artifactType"u8)) + { + artifactType = new AzureOperatorNexusArtifactType(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("dependsOnProfile"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + dependsOnProfile = DependsOnProfile.DeserializeDependsOnProfile(property.Value); + continue; + } + } + return new AzureOperatorNexusNetworkFunctionArmTemplateApplication(name.Value, dependsOnProfile.Value, artifactType, artifactProfile.Value, deployParametersMappingRuleProfile.Value); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureOperatorNexusNetworkFunctionArmTemplateApplication.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureOperatorNexusNetworkFunctionArmTemplateApplication.cs new file mode 100644 index 000000000000..ae8d80efdae6 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureOperatorNexusNetworkFunctionArmTemplateApplication.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// Azure Operator Distributed Services network function Template application definition. + public partial class AzureOperatorNexusNetworkFunctionArmTemplateApplication : AzureOperatorNexusNetworkFunctionApplication + { + /// Initializes a new instance of AzureOperatorNexusNetworkFunctionArmTemplateApplication. + public AzureOperatorNexusNetworkFunctionArmTemplateApplication() + { + ArtifactType = AzureOperatorNexusArtifactType.ArmTemplate; + } + + /// Initializes a new instance of AzureOperatorNexusNetworkFunctionArmTemplateApplication. + /// The name of the network function application. + /// Depends on profile definition. + /// The artifact type. + /// Azure Operator Distributed Services Template artifact profile. + /// Deploy mapping rule profile. + internal AzureOperatorNexusNetworkFunctionArmTemplateApplication(string name, DependsOnProfile dependsOnProfile, AzureOperatorNexusArtifactType artifactType, AzureOperatorNexusArmTemplateArtifactProfile artifactProfile, AzureOperatorNexusArmTemplateDeployMappingRuleProfile deployParametersMappingRuleProfile) : base(name, dependsOnProfile, artifactType) + { + ArtifactProfile = artifactProfile; + DeployParametersMappingRuleProfile = deployParametersMappingRuleProfile; + ArtifactType = artifactType; + } + + /// Azure Operator Distributed Services Template artifact profile. + public AzureOperatorNexusArmTemplateArtifactProfile ArtifactProfile { get; set; } + /// Deploy mapping rule profile. + public AzureOperatorNexusArmTemplateDeployMappingRuleProfile DeployParametersMappingRuleProfile { get; set; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureOperatorNexusNetworkFunctionImageApplication.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureOperatorNexusNetworkFunctionImageApplication.Serialization.cs new file mode 100644 index 000000000000..5453fed629a3 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureOperatorNexusNetworkFunctionImageApplication.Serialization.cs @@ -0,0 +1,97 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class AzureOperatorNexusNetworkFunctionImageApplication : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(ArtifactProfile)) + { + writer.WritePropertyName("artifactProfile"u8); + writer.WriteObjectValue(ArtifactProfile); + } + if (Optional.IsDefined(DeployParametersMappingRuleProfile)) + { + writer.WritePropertyName("deployParametersMappingRuleProfile"u8); + writer.WriteObjectValue(DeployParametersMappingRuleProfile); + } + writer.WritePropertyName("artifactType"u8); + writer.WriteStringValue(ArtifactType.ToString()); + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (Optional.IsDefined(DependsOnProfile)) + { + writer.WritePropertyName("dependsOnProfile"u8); + writer.WriteObjectValue(DependsOnProfile); + } + writer.WriteEndObject(); + } + + internal static AzureOperatorNexusNetworkFunctionImageApplication DeserializeAzureOperatorNexusNetworkFunctionImageApplication(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional artifactProfile = default; + Optional deployParametersMappingRuleProfile = default; + AzureOperatorNexusArtifactType artifactType = default; + Optional name = default; + Optional dependsOnProfile = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("artifactProfile"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + artifactProfile = AzureOperatorNexusImageArtifactProfile.DeserializeAzureOperatorNexusImageArtifactProfile(property.Value); + continue; + } + if (property.NameEquals("deployParametersMappingRuleProfile"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + deployParametersMappingRuleProfile = AzureOperatorNexusImageDeployMappingRuleProfile.DeserializeAzureOperatorNexusImageDeployMappingRuleProfile(property.Value); + continue; + } + if (property.NameEquals("artifactType"u8)) + { + artifactType = new AzureOperatorNexusArtifactType(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("dependsOnProfile"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + dependsOnProfile = DependsOnProfile.DeserializeDependsOnProfile(property.Value); + continue; + } + } + return new AzureOperatorNexusNetworkFunctionImageApplication(name.Value, dependsOnProfile.Value, artifactType, artifactProfile.Value, deployParametersMappingRuleProfile.Value); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureOperatorNexusNetworkFunctionImageApplication.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureOperatorNexusNetworkFunctionImageApplication.cs new file mode 100644 index 000000000000..5dc8e2c664a0 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureOperatorNexusNetworkFunctionImageApplication.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// Azure Operator Distributed Services network function image application definition. + public partial class AzureOperatorNexusNetworkFunctionImageApplication : AzureOperatorNexusNetworkFunctionApplication + { + /// Initializes a new instance of AzureOperatorNexusNetworkFunctionImageApplication. + public AzureOperatorNexusNetworkFunctionImageApplication() + { + ArtifactType = AzureOperatorNexusArtifactType.ImageFile; + } + + /// Initializes a new instance of AzureOperatorNexusNetworkFunctionImageApplication. + /// The name of the network function application. + /// Depends on profile definition. + /// The artifact type. + /// Azure Operator Distributed Services image artifact profile. + /// Deploy mapping rule profile. + internal AzureOperatorNexusNetworkFunctionImageApplication(string name, DependsOnProfile dependsOnProfile, AzureOperatorNexusArtifactType artifactType, AzureOperatorNexusImageArtifactProfile artifactProfile, AzureOperatorNexusImageDeployMappingRuleProfile deployParametersMappingRuleProfile) : base(name, dependsOnProfile, artifactType) + { + ArtifactProfile = artifactProfile; + DeployParametersMappingRuleProfile = deployParametersMappingRuleProfile; + ArtifactType = artifactType; + } + + /// Azure Operator Distributed Services image artifact profile. + public AzureOperatorNexusImageArtifactProfile ArtifactProfile { get; set; } + /// Deploy mapping rule profile. + public AzureOperatorNexusImageDeployMappingRuleProfile DeployParametersMappingRuleProfile { get; set; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureOperatorNexusNetworkFunctionTemplate.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureOperatorNexusNetworkFunctionTemplate.Serialization.cs new file mode 100644 index 000000000000..24717162b108 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureOperatorNexusNetworkFunctionTemplate.Serialization.cs @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class AzureOperatorNexusNetworkFunctionTemplate : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(NetworkFunctionApplications)) + { + writer.WritePropertyName("networkFunctionApplications"u8); + writer.WriteStartArray(); + foreach (var item in NetworkFunctionApplications) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + writer.WritePropertyName("nfviType"u8); + writer.WriteStringValue(NfviType.ToString()); + writer.WriteEndObject(); + } + + internal static AzureOperatorNexusNetworkFunctionTemplate DeserializeAzureOperatorNexusNetworkFunctionTemplate(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> networkFunctionApplications = default; + VirtualNetworkFunctionNfviType nfviType = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("networkFunctionApplications"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(AzureOperatorNexusNetworkFunctionApplication.DeserializeAzureOperatorNexusNetworkFunctionApplication(item)); + } + networkFunctionApplications = array; + continue; + } + if (property.NameEquals("nfviType"u8)) + { + nfviType = new VirtualNetworkFunctionNfviType(property.Value.GetString()); + continue; + } + } + return new AzureOperatorNexusNetworkFunctionTemplate(nfviType, Optional.ToList(networkFunctionApplications)); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureOperatorNexusNetworkFunctionTemplate.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureOperatorNexusNetworkFunctionTemplate.cs new file mode 100644 index 000000000000..dbb0c02b4eb6 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureOperatorNexusNetworkFunctionTemplate.cs @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// Azure Operator Distributed Services network function template. + public partial class AzureOperatorNexusNetworkFunctionTemplate : VirtualNetworkFunctionTemplate + { + /// Initializes a new instance of AzureOperatorNexusNetworkFunctionTemplate. + public AzureOperatorNexusNetworkFunctionTemplate() + { + NetworkFunctionApplications = new ChangeTrackingList(); + NfviType = VirtualNetworkFunctionNfviType.AzureOperatorNexus; + } + + /// Initializes a new instance of AzureOperatorNexusNetworkFunctionTemplate. + /// The network function type. + /// + /// Network function applications. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include and . + /// + internal AzureOperatorNexusNetworkFunctionTemplate(VirtualNetworkFunctionNfviType nfviType, IList networkFunctionApplications) : base(nfviType) + { + NetworkFunctionApplications = networkFunctionApplications; + NfviType = nfviType; + } + + /// + /// Network function applications. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include and . + /// + public IList NetworkFunctionApplications { get; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureStorageAccountContainerCredential.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureStorageAccountContainerCredential.Serialization.cs new file mode 100644 index 000000000000..5d8ae0bef2e2 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureStorageAccountContainerCredential.Serialization.cs @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class AzureStorageAccountContainerCredential + { + internal static AzureStorageAccountContainerCredential DeserializeAzureStorageAccountContainerCredential(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional containerName = default; + Optional containerSasUri = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("containerName"u8)) + { + containerName = property.Value.GetString(); + continue; + } + if (property.NameEquals("containerSasUri"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + containerSasUri = new Uri(property.Value.GetString()); + continue; + } + } + return new AzureStorageAccountContainerCredential(containerName.Value, containerSasUri.Value); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureStorageAccountContainerCredential.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureStorageAccountContainerCredential.cs new file mode 100644 index 000000000000..179b57b89693 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureStorageAccountContainerCredential.cs @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// The azure storage account container credential definition. + public partial class AzureStorageAccountContainerCredential + { + /// Initializes a new instance of AzureStorageAccountContainerCredential. + internal AzureStorageAccountContainerCredential() + { + } + + /// Initializes a new instance of AzureStorageAccountContainerCredential. + /// The storage account container name. + /// The storage account container sas uri. + internal AzureStorageAccountContainerCredential(string containerName, Uri containerSasUri) + { + ContainerName = containerName; + ContainerSasUri = containerSasUri; + } + + /// The storage account container name. + public string ContainerName { get; } + /// The storage account container sas uri. + public Uri ContainerSasUri { get; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureStorageAccountCredential.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureStorageAccountCredential.Serialization.cs new file mode 100644 index 000000000000..b7d839ad0c38 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureStorageAccountCredential.Serialization.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; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class AzureStorageAccountCredential + { + internal static AzureStorageAccountCredential DeserializeAzureStorageAccountCredential(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional storageAccountId = default; + Optional> containerCredentials = default; + Optional expiry = default; + CredentialType credentialType = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("storageAccountId"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + storageAccountId = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("containerCredentials"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(AzureStorageAccountContainerCredential.DeserializeAzureStorageAccountContainerCredential(item)); + } + containerCredentials = array; + continue; + } + if (property.NameEquals("expiry"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + expiry = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("credentialType"u8)) + { + credentialType = new CredentialType(property.Value.GetString()); + continue; + } + } + return new AzureStorageAccountCredential(credentialType, storageAccountId.Value, Optional.ToList(containerCredentials), Optional.ToNullable(expiry)); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureStorageAccountCredential.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureStorageAccountCredential.cs new file mode 100644 index 000000000000..93aeb8dfd886 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureStorageAccountCredential.cs @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// The azure storage account credential definition. + public partial class AzureStorageAccountCredential : ArtifactAccessCredential + { + /// Initializes a new instance of AzureStorageAccountCredential. + internal AzureStorageAccountCredential() + { + ContainerCredentials = new ChangeTrackingList(); + CredentialType = CredentialType.AzureStorageAccountToken; + } + + /// Initializes a new instance of AzureStorageAccountCredential. + /// The credential type. + /// The storage account Id. + /// The containers that could be accessed using the current credential. + /// The UTC time when credential will expire. + internal AzureStorageAccountCredential(CredentialType credentialType, ResourceIdentifier storageAccountId, IReadOnlyList containerCredentials, DateTimeOffset? expiry) : base(credentialType) + { + StorageAccountId = storageAccountId; + ContainerCredentials = containerCredentials; + Expiry = expiry; + CredentialType = credentialType; + } + + /// The storage account Id. + public ResourceIdentifier StorageAccountId { get; } + /// The containers that could be accessed using the current credential. + public IReadOnlyList ContainerCredentials { get; } + /// The UTC time when credential will expire. + public DateTimeOffset? Expiry { get; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ComponentData.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ComponentData.Serialization.cs new file mode 100644 index 000000000000..531ae16ff56a --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ComponentData.Serialization.cs @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.HybridNetwork.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.HybridNetwork +{ + public partial class ComponentData : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties); + } + writer.WriteEndObject(); + } + + internal static ComponentData DeserializeComponentData(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional properties = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + Optional systemData = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = ComponentProperties.DeserializeComponentProperties(property.Value); + 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; + } + } + return new ComponentData(id, name, type, systemData.Value, properties.Value); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ComponentKubernetesResources.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ComponentKubernetesResources.Serialization.cs new file mode 100644 index 000000000000..8f9045f0fcc5 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ComponentKubernetesResources.Serialization.cs @@ -0,0 +1,103 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class ComponentKubernetesResources + { + internal static ComponentKubernetesResources DeserializeComponentKubernetesResources(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> deployments = default; + Optional> pods = default; + Optional> replicaSets = default; + Optional> statefulSets = default; + Optional> daemonSets = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("deployments"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(KubernetesDeployment.DeserializeKubernetesDeployment(item)); + } + deployments = array; + continue; + } + if (property.NameEquals("pods"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(KubernetesPod.DeserializeKubernetesPod(item)); + } + pods = array; + continue; + } + if (property.NameEquals("replicaSets"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(KubernetesReplicaSet.DeserializeKubernetesReplicaSet(item)); + } + replicaSets = array; + continue; + } + if (property.NameEquals("statefulSets"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(KubernetesStatefulSet.DeserializeKubernetesStatefulSet(item)); + } + statefulSets = array; + continue; + } + if (property.NameEquals("daemonSets"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(KubernetesDaemonSet.DeserializeKubernetesDaemonSet(item)); + } + daemonSets = array; + continue; + } + } + return new ComponentKubernetesResources(Optional.ToList(deployments), Optional.ToList(pods), Optional.ToList(replicaSets), Optional.ToList(statefulSets), Optional.ToList(daemonSets)); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ComponentKubernetesResources.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ComponentKubernetesResources.cs new file mode 100644 index 000000000000..e9d3a0bf14ce --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ComponentKubernetesResources.cs @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// The resources of the network function component. + public partial class ComponentKubernetesResources + { + /// Initializes a new instance of ComponentKubernetesResources. + internal ComponentKubernetesResources() + { + Deployments = new ChangeTrackingList(); + Pods = new ChangeTrackingList(); + ReplicaSets = new ChangeTrackingList(); + StatefulSets = new ChangeTrackingList(); + DaemonSets = new ChangeTrackingList(); + } + + /// Initializes a new instance of ComponentKubernetesResources. + /// Deployments that are related to component resource. + /// Pods related to component resource. + /// Replica sets related to component resource. + /// Stateful sets related to component resource. + /// Daemonsets related to component resource. + internal ComponentKubernetesResources(IReadOnlyList deployments, IReadOnlyList pods, IReadOnlyList replicaSets, IReadOnlyList statefulSets, IReadOnlyList daemonSets) + { + Deployments = deployments; + Pods = pods; + ReplicaSets = replicaSets; + StatefulSets = statefulSets; + DaemonSets = daemonSets; + } + + /// Deployments that are related to component resource. + public IReadOnlyList Deployments { get; } + /// Pods related to component resource. + public IReadOnlyList Pods { get; } + /// Replica sets related to component resource. + public IReadOnlyList ReplicaSets { get; } + /// Stateful sets related to component resource. + public IReadOnlyList StatefulSets { get; } + /// Daemonsets related to component resource. + public IReadOnlyList DaemonSets { get; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ComponentListResult.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ComponentListResult.Serialization.cs new file mode 100644 index 000000000000..080700a8625a --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ComponentListResult.Serialization.cs @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.HybridNetwork; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + internal partial class ComponentListResult + { + internal static ComponentListResult DeserializeComponentListResult(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> value = default; + Optional nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ComponentData.DeserializeComponentData(item)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + } + return new ComponentListResult(Optional.ToList(value), nextLink.Value); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ComponentListResult.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ComponentListResult.cs new file mode 100644 index 000000000000..5e0f5871cca0 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ComponentListResult.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.HybridNetwork; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// Response for list component API service call. + internal partial class ComponentListResult + { + /// Initializes a new instance of ComponentListResult. + internal ComponentListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of ComponentListResult. + /// A list of component resources in a networkFunction. + /// The URL to get the next set of results. + internal ComponentListResult(IReadOnlyList value, string nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// A list of component resources in a networkFunction. + public IReadOnlyList Value { get; } + /// The URL to get the next set of results. + public string NextLink { get; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ComponentProperties.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ComponentProperties.Serialization.cs new file mode 100644 index 000000000000..7dd639ad627e --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ComponentProperties.Serialization.cs @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class ComponentProperties : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } + + internal static ComponentProperties DeserializeComponentProperties(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional provisioningState = default; + Optional deploymentProfile = default; + Optional deploymentStatus = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("provisioningState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new ProvisioningState(property.Value.GetString()); + continue; + } + if (property.NameEquals("deploymentProfile"u8)) + { + deploymentProfile = property.Value.GetString(); + continue; + } + if (property.NameEquals("deploymentStatus"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + deploymentStatus = DeploymentStatusProperties.DeserializeDeploymentStatusProperties(property.Value); + continue; + } + } + return new ComponentProperties(Optional.ToNullable(provisioningState), deploymentProfile.Value, deploymentStatus.Value); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ComponentProperties.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ComponentProperties.cs new file mode 100644 index 000000000000..d81ef30e21c8 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ComponentProperties.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// The component properties of the network function. + public partial class ComponentProperties + { + /// Initializes a new instance of ComponentProperties. + public ComponentProperties() + { + } + + /// Initializes a new instance of ComponentProperties. + /// The provisioning state of the component resource. + /// The JSON-serialized deployment profile of the component resource. + /// The deployment status of the component resource. + internal ComponentProperties(ProvisioningState? provisioningState, string deploymentProfile, DeploymentStatusProperties deploymentStatus) + { + ProvisioningState = provisioningState; + DeploymentProfile = deploymentProfile; + DeploymentStatus = deploymentStatus; + } + + /// The provisioning state of the component resource. + public ProvisioningState? ProvisioningState { get; } + /// The JSON-serialized deployment profile of the component resource. + public string DeploymentProfile { get; } + /// The deployment status of the component resource. + public DeploymentStatusProperties DeploymentStatus { get; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ComponentStatus.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ComponentStatus.cs new file mode 100644 index 000000000000..c64c9d52df11 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ComponentStatus.cs @@ -0,0 +1,87 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// The component resource deployment status. + public readonly partial struct ComponentStatus : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public ComponentStatus(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string UnknownValue = "Unknown"; + private const string DeployedValue = "Deployed"; + private const string UninstalledValue = "Uninstalled"; + private const string SupersededValue = "Superseded"; + private const string FailedValue = "Failed"; + private const string UninstallingValue = "Uninstalling"; + private const string PendingInstallValue = "Pending-Install"; + private const string PendingUpgradeValue = "Pending-Upgrade"; + private const string PendingRollbackValue = "Pending-Rollback"; + private const string DownloadingValue = "Downloading"; + private const string InstallingValue = "Installing"; + private const string ReinstallingValue = "Reinstalling"; + private const string RollingbackValue = "Rollingback"; + private const string UpgradingValue = "Upgrading"; + + /// Unknown. + public static ComponentStatus Unknown { get; } = new ComponentStatus(UnknownValue); + /// Deployed. + public static ComponentStatus Deployed { get; } = new ComponentStatus(DeployedValue); + /// Uninstalled. + public static ComponentStatus Uninstalled { get; } = new ComponentStatus(UninstalledValue); + /// Superseded. + public static ComponentStatus Superseded { get; } = new ComponentStatus(SupersededValue); + /// Failed. + public static ComponentStatus Failed { get; } = new ComponentStatus(FailedValue); + /// Uninstalling. + public static ComponentStatus Uninstalling { get; } = new ComponentStatus(UninstallingValue); + /// Pending-Install. + public static ComponentStatus PendingInstall { get; } = new ComponentStatus(PendingInstallValue); + /// Pending-Upgrade. + public static ComponentStatus PendingUpgrade { get; } = new ComponentStatus(PendingUpgradeValue); + /// Pending-Rollback. + public static ComponentStatus PendingRollback { get; } = new ComponentStatus(PendingRollbackValue); + /// Downloading. + public static ComponentStatus Downloading { get; } = new ComponentStatus(DownloadingValue); + /// Installing. + public static ComponentStatus Installing { get; } = new ComponentStatus(InstallingValue); + /// Reinstalling. + public static ComponentStatus Reinstalling { get; } = new ComponentStatus(ReinstallingValue); + /// Rollingback. + public static ComponentStatus Rollingback { get; } = new ComponentStatus(RollingbackValue); + /// Upgrading. + public static ComponentStatus Upgrading { get; } = new ComponentStatus(UpgradingValue); + /// Determines if two values are the same. + public static bool operator ==(ComponentStatus left, ComponentStatus right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ComponentStatus left, ComponentStatus right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator ComponentStatus(string value) => new ComponentStatus(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ComponentStatus other && Equals(other); + /// + public bool Equals(ComponentStatus other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ConfigurationGroupSchemaData.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ConfigurationGroupSchemaData.Serialization.cs new file mode 100644 index 000000000000..ecc80aa64b7c --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ConfigurationGroupSchemaData.Serialization.cs @@ -0,0 +1,113 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.HybridNetwork.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.HybridNetwork +{ + public partial class ConfigurationGroupSchemaData : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties); + } + 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(); + } + writer.WritePropertyName("location"u8); + writer.WriteStringValue(Location); + writer.WriteEndObject(); + } + + internal static ConfigurationGroupSchemaData DeserializeConfigurationGroupSchemaData(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional properties = default; + Optional> tags = default; + AzureLocation location = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + Optional systemData = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = ConfigurationGroupSchemaPropertiesFormat.DeserializeConfigurationGroupSchemaPropertiesFormat(property.Value); + 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; + } + } + return new ConfigurationGroupSchemaData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, properties.Value); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ConfigurationGroupSchemaListResult.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ConfigurationGroupSchemaListResult.Serialization.cs new file mode 100644 index 000000000000..729600d6cc9d --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ConfigurationGroupSchemaListResult.Serialization.cs @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.HybridNetwork; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + internal partial class ConfigurationGroupSchemaListResult + { + internal static ConfigurationGroupSchemaListResult DeserializeConfigurationGroupSchemaListResult(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> value = default; + Optional nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ConfigurationGroupSchemaData.DeserializeConfigurationGroupSchemaData(item)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + } + return new ConfigurationGroupSchemaListResult(Optional.ToList(value), nextLink.Value); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ConfigurationGroupSchemaListResult.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ConfigurationGroupSchemaListResult.cs new file mode 100644 index 000000000000..235872e24fa4 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ConfigurationGroupSchemaListResult.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.HybridNetwork; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// A list of configuration group schema resources. + internal partial class ConfigurationGroupSchemaListResult + { + /// Initializes a new instance of ConfigurationGroupSchemaListResult. + internal ConfigurationGroupSchemaListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of ConfigurationGroupSchemaListResult. + /// A list of configuration group schema. + /// The URL to get the next set of results. + internal ConfigurationGroupSchemaListResult(IReadOnlyList value, string nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// A list of configuration group schema. + public IReadOnlyList Value { get; } + /// The URL to get the next set of results. + public string NextLink { get; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ConfigurationGroupSchemaPropertiesFormat.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ConfigurationGroupSchemaPropertiesFormat.Serialization.cs new file mode 100644 index 000000000000..1d45906aeed6 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ConfigurationGroupSchemaPropertiesFormat.Serialization.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class ConfigurationGroupSchemaPropertiesFormat : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Description)) + { + writer.WritePropertyName("description"u8); + writer.WriteStringValue(Description); + } + if (Optional.IsDefined(SchemaDefinition)) + { + writer.WritePropertyName("schemaDefinition"u8); + writer.WriteStringValue(SchemaDefinition); + } + writer.WriteEndObject(); + } + + internal static ConfigurationGroupSchemaPropertiesFormat DeserializeConfigurationGroupSchemaPropertiesFormat(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional provisioningState = default; + Optional versionState = default; + Optional description = default; + Optional schemaDefinition = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("provisioningState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new ProvisioningState(property.Value.GetString()); + continue; + } + if (property.NameEquals("versionState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + versionState = new VersionState(property.Value.GetString()); + continue; + } + if (property.NameEquals("description"u8)) + { + description = property.Value.GetString(); + continue; + } + if (property.NameEquals("schemaDefinition"u8)) + { + schemaDefinition = property.Value.GetString(); + continue; + } + } + return new ConfigurationGroupSchemaPropertiesFormat(Optional.ToNullable(provisioningState), Optional.ToNullable(versionState), description.Value, schemaDefinition.Value); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ConfigurationGroupSchemaPropertiesFormat.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ConfigurationGroupSchemaPropertiesFormat.cs new file mode 100644 index 000000000000..b4bed58f3146 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ConfigurationGroupSchemaPropertiesFormat.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// Configuration group schema properties. + public partial class ConfigurationGroupSchemaPropertiesFormat + { + /// Initializes a new instance of ConfigurationGroupSchemaPropertiesFormat. + public ConfigurationGroupSchemaPropertiesFormat() + { + } + + /// Initializes a new instance of ConfigurationGroupSchemaPropertiesFormat. + /// The provisioning state of the Configuration group schema resource. + /// The configuration group schema version state. + /// Description of what schema can contain. + /// Name and value pairs that define the configuration value. It can be a well formed escaped JSON string. + internal ConfigurationGroupSchemaPropertiesFormat(ProvisioningState? provisioningState, VersionState? versionState, string description, string schemaDefinition) + { + ProvisioningState = provisioningState; + VersionState = versionState; + Description = description; + SchemaDefinition = schemaDefinition; + } + + /// The provisioning state of the Configuration group schema resource. + public ProvisioningState? ProvisioningState { get; } + /// The configuration group schema version state. + public VersionState? VersionState { get; } + /// Description of what schema can contain. + public string Description { get; set; } + /// Name and value pairs that define the configuration value. It can be a well formed escaped JSON string. + public string SchemaDefinition { get; set; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ConfigurationGroupSchemaVersionUpdateState.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ConfigurationGroupSchemaVersionUpdateState.Serialization.cs new file mode 100644 index 000000000000..46f6a62f76fa --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ConfigurationGroupSchemaVersionUpdateState.Serialization.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class ConfigurationGroupSchemaVersionUpdateState : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(VersionState)) + { + writer.WritePropertyName("versionState"u8); + writer.WriteStringValue(VersionState.Value.ToString()); + } + writer.WriteEndObject(); + } + + internal static ConfigurationGroupSchemaVersionUpdateState DeserializeConfigurationGroupSchemaVersionUpdateState(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional versionState = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("versionState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + versionState = new VersionState(property.Value.GetString()); + continue; + } + } + return new ConfigurationGroupSchemaVersionUpdateState(Optional.ToNullable(versionState)); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ConfigurationGroupSchemaVersionUpdateState.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ConfigurationGroupSchemaVersionUpdateState.cs new file mode 100644 index 000000000000..7f5ba7f9f04a --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ConfigurationGroupSchemaVersionUpdateState.cs @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// Publisher configuration group schema update request definition. + public partial class ConfigurationGroupSchemaVersionUpdateState + { + /// Initializes a new instance of ConfigurationGroupSchemaVersionUpdateState. + public ConfigurationGroupSchemaVersionUpdateState() + { + } + + /// Initializes a new instance of ConfigurationGroupSchemaVersionUpdateState. + /// The configuration group schema state. + internal ConfigurationGroupSchemaVersionUpdateState(VersionState? versionState) + { + VersionState = versionState; + } + + /// The configuration group schema state. + public VersionState? VersionState { get; set; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ConfigurationGroupValueConfigurationType.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ConfigurationGroupValueConfigurationType.cs new file mode 100644 index 000000000000..c7ae4b71d0d7 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ConfigurationGroupValueConfigurationType.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.HybridNetwork.Models +{ + /// The secret type which indicates if secret or not. + internal readonly partial struct ConfigurationGroupValueConfigurationType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public ConfigurationGroupValueConfigurationType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string UnknownValue = "Unknown"; + private const string SecretValue = "Secret"; + private const string OpenValue = "Open"; + + /// Unknown. + public static ConfigurationGroupValueConfigurationType Unknown { get; } = new ConfigurationGroupValueConfigurationType(UnknownValue); + /// Secret. + public static ConfigurationGroupValueConfigurationType Secret { get; } = new ConfigurationGroupValueConfigurationType(SecretValue); + /// Open. + public static ConfigurationGroupValueConfigurationType Open { get; } = new ConfigurationGroupValueConfigurationType(OpenValue); + /// Determines if two values are the same. + public static bool operator ==(ConfigurationGroupValueConfigurationType left, ConfigurationGroupValueConfigurationType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ConfigurationGroupValueConfigurationType left, ConfigurationGroupValueConfigurationType right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator ConfigurationGroupValueConfigurationType(string value) => new ConfigurationGroupValueConfigurationType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ConfigurationGroupValueConfigurationType other && Equals(other); + /// + public bool Equals(ConfigurationGroupValueConfigurationType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ConfigurationGroupValueData.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ConfigurationGroupValueData.Serialization.cs new file mode 100644 index 000000000000..4ab1e101262a --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ConfigurationGroupValueData.Serialization.cs @@ -0,0 +1,113 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.HybridNetwork.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.HybridNetwork +{ + public partial class ConfigurationGroupValueData : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties); + } + 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(); + } + writer.WritePropertyName("location"u8); + writer.WriteStringValue(Location); + writer.WriteEndObject(); + } + + internal static ConfigurationGroupValueData DeserializeConfigurationGroupValueData(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional properties = default; + Optional> tags = default; + AzureLocation location = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + Optional systemData = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = ConfigurationGroupValuePropertiesFormat.DeserializeConfigurationGroupValuePropertiesFormat(property.Value); + 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; + } + } + return new ConfigurationGroupValueData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, properties.Value); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ConfigurationGroupValueListResult.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ConfigurationGroupValueListResult.Serialization.cs new file mode 100644 index 000000000000..efed310a886b --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ConfigurationGroupValueListResult.Serialization.cs @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.HybridNetwork; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + internal partial class ConfigurationGroupValueListResult + { + internal static ConfigurationGroupValueListResult DeserializeConfigurationGroupValueListResult(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> value = default; + Optional nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ConfigurationGroupValueData.DeserializeConfigurationGroupValueData(item)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + } + return new ConfigurationGroupValueListResult(Optional.ToList(value), nextLink.Value); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ConfigurationGroupValueListResult.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ConfigurationGroupValueListResult.cs new file mode 100644 index 000000000000..348ed688626a --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ConfigurationGroupValueListResult.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.HybridNetwork; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// Response for hybrid configurationGroups API service call. + internal partial class ConfigurationGroupValueListResult + { + /// Initializes a new instance of ConfigurationGroupValueListResult. + internal ConfigurationGroupValueListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of ConfigurationGroupValueListResult. + /// A list of hybrid configurationGroups. + /// The URL to get the next set of results. + internal ConfigurationGroupValueListResult(IReadOnlyList value, string nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// A list of hybrid configurationGroups. + public IReadOnlyList Value { get; } + /// The URL to get the next set of results. + public string NextLink { get; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ConfigurationGroupValuePropertiesFormat.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ConfigurationGroupValuePropertiesFormat.Serialization.cs new file mode 100644 index 000000000000..f504563dbdf4 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ConfigurationGroupValuePropertiesFormat.Serialization.cs @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class ConfigurationGroupValuePropertiesFormat : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(ConfigurationGroupSchemaResourceReference)) + { + writer.WritePropertyName("configurationGroupSchemaResourceReference"u8); + writer.WriteObjectValue(ConfigurationGroupSchemaResourceReference); + } + writer.WritePropertyName("configurationType"u8); + writer.WriteStringValue(ConfigurationType.ToString()); + writer.WriteEndObject(); + } + + internal static ConfigurationGroupValuePropertiesFormat DeserializeConfigurationGroupValuePropertiesFormat(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + if (element.TryGetProperty("configurationType", out JsonElement discriminator)) + { + switch (discriminator.GetString()) + { + case "Open": return ConfigurationValueWithoutSecrets.DeserializeConfigurationValueWithoutSecrets(element); + case "Secret": return ConfigurationValueWithSecrets.DeserializeConfigurationValueWithSecrets(element); + } + } + return UnknownConfigurationGroupValuePropertiesFormat.DeserializeUnknownConfigurationGroupValuePropertiesFormat(element); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ConfigurationGroupValuePropertiesFormat.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ConfigurationGroupValuePropertiesFormat.cs new file mode 100644 index 000000000000..d16f10164e72 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ConfigurationGroupValuePropertiesFormat.cs @@ -0,0 +1,64 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// + /// Hybrid configuration group value properties. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include and . + /// + public abstract partial class ConfigurationGroupValuePropertiesFormat + { + /// Initializes a new instance of ConfigurationGroupValuePropertiesFormat. + protected ConfigurationGroupValuePropertiesFormat() + { + } + + /// Initializes a new instance of ConfigurationGroupValuePropertiesFormat. + /// The provisioning state of the site resource. + /// The publisher name for the configuration group schema. + /// The scope of the publisher. + /// The configuration group schema name. + /// The location of the configuration group schema offering. + /// + /// The configuration group schema resource reference. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include and . + /// + /// The value which indicates if configuration values are secrets. + internal ConfigurationGroupValuePropertiesFormat(ProvisioningState? provisioningState, string publisherName, PublisherScope? publisherScope, string configurationGroupSchemaName, string configurationGroupSchemaOfferingLocation, DeploymentResourceIdReference configurationGroupSchemaResourceReference, ConfigurationGroupValueConfigurationType configurationType) + { + ProvisioningState = provisioningState; + PublisherName = publisherName; + PublisherScope = publisherScope; + ConfigurationGroupSchemaName = configurationGroupSchemaName; + ConfigurationGroupSchemaOfferingLocation = configurationGroupSchemaOfferingLocation; + ConfigurationGroupSchemaResourceReference = configurationGroupSchemaResourceReference; + ConfigurationType = configurationType; + } + + /// The provisioning state of the site resource. + public ProvisioningState? ProvisioningState { get; } + /// The publisher name for the configuration group schema. + public string PublisherName { get; } + /// The scope of the publisher. + public PublisherScope? PublisherScope { get; } + /// The configuration group schema name. + public string ConfigurationGroupSchemaName { get; } + /// The location of the configuration group schema offering. + public string ConfigurationGroupSchemaOfferingLocation { get; } + /// + /// The configuration group schema resource reference. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include and . + /// + public DeploymentResourceIdReference ConfigurationGroupSchemaResourceReference { get; set; } + /// The value which indicates if configuration values are secrets. + internal ConfigurationGroupValueConfigurationType ConfigurationType { get; set; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ConfigurationValueWithSecrets.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ConfigurationValueWithSecrets.Serialization.cs new file mode 100644 index 000000000000..e11e556de56d --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ConfigurationValueWithSecrets.Serialization.cs @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class ConfigurationValueWithSecrets : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(SecretConfigurationValue)) + { + writer.WritePropertyName("secretConfigurationValue"u8); + writer.WriteStringValue(SecretConfigurationValue); + } + if (Optional.IsDefined(ConfigurationGroupSchemaResourceReference)) + { + writer.WritePropertyName("configurationGroupSchemaResourceReference"u8); + writer.WriteObjectValue(ConfigurationGroupSchemaResourceReference); + } + writer.WritePropertyName("configurationType"u8); + writer.WriteStringValue(ConfigurationType.ToString()); + writer.WriteEndObject(); + } + + internal static ConfigurationValueWithSecrets DeserializeConfigurationValueWithSecrets(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional secretConfigurationValue = default; + Optional provisioningState = default; + Optional publisherName = default; + Optional publisherScope = default; + Optional configurationGroupSchemaName = default; + Optional configurationGroupSchemaOfferingLocation = default; + Optional configurationGroupSchemaResourceReference = default; + ConfigurationGroupValueConfigurationType configurationType = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("secretConfigurationValue"u8)) + { + secretConfigurationValue = property.Value.GetString(); + continue; + } + if (property.NameEquals("provisioningState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new ProvisioningState(property.Value.GetString()); + continue; + } + if (property.NameEquals("publisherName"u8)) + { + publisherName = property.Value.GetString(); + continue; + } + if (property.NameEquals("publisherScope"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + publisherScope = new PublisherScope(property.Value.GetString()); + continue; + } + if (property.NameEquals("configurationGroupSchemaName"u8)) + { + configurationGroupSchemaName = property.Value.GetString(); + continue; + } + if (property.NameEquals("configurationGroupSchemaOfferingLocation"u8)) + { + configurationGroupSchemaOfferingLocation = property.Value.GetString(); + continue; + } + if (property.NameEquals("configurationGroupSchemaResourceReference"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + configurationGroupSchemaResourceReference = DeploymentResourceIdReference.DeserializeDeploymentResourceIdReference(property.Value); + continue; + } + if (property.NameEquals("configurationType"u8)) + { + configurationType = new ConfigurationGroupValueConfigurationType(property.Value.GetString()); + continue; + } + } + return new ConfigurationValueWithSecrets(Optional.ToNullable(provisioningState), publisherName.Value, Optional.ToNullable(publisherScope), configurationGroupSchemaName.Value, configurationGroupSchemaOfferingLocation.Value, configurationGroupSchemaResourceReference.Value, configurationType, secretConfigurationValue.Value); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ConfigurationValueWithSecrets.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ConfigurationValueWithSecrets.cs new file mode 100644 index 000000000000..1ea61092654b --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ConfigurationValueWithSecrets.cs @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// The ConfigurationValue with secrets. + public partial class ConfigurationValueWithSecrets : ConfigurationGroupValuePropertiesFormat + { + /// Initializes a new instance of ConfigurationValueWithSecrets. + public ConfigurationValueWithSecrets() + { + ConfigurationType = ConfigurationGroupValueConfigurationType.Secret; + } + + /// Initializes a new instance of ConfigurationValueWithSecrets. + /// The provisioning state of the site resource. + /// The publisher name for the configuration group schema. + /// The scope of the publisher. + /// The configuration group schema name. + /// The location of the configuration group schema offering. + /// + /// The configuration group schema resource reference. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include and . + /// + /// The value which indicates if configuration values are secrets. + /// Name and value pairs that define the configuration value secrets. It can be a well formed escaped JSON string. + internal ConfigurationValueWithSecrets(ProvisioningState? provisioningState, string publisherName, PublisherScope? publisherScope, string configurationGroupSchemaName, string configurationGroupSchemaOfferingLocation, DeploymentResourceIdReference configurationGroupSchemaResourceReference, ConfigurationGroupValueConfigurationType configurationType, string secretConfigurationValue) : base(provisioningState, publisherName, publisherScope, configurationGroupSchemaName, configurationGroupSchemaOfferingLocation, configurationGroupSchemaResourceReference, configurationType) + { + SecretConfigurationValue = secretConfigurationValue; + ConfigurationType = configurationType; + } + + /// Name and value pairs that define the configuration value secrets. It can be a well formed escaped JSON string. + public string SecretConfigurationValue { get; set; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ConfigurationValueWithoutSecrets.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ConfigurationValueWithoutSecrets.Serialization.cs new file mode 100644 index 000000000000..d4143c149e92 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ConfigurationValueWithoutSecrets.Serialization.cs @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class ConfigurationValueWithoutSecrets : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(ConfigurationValue)) + { + writer.WritePropertyName("configurationValue"u8); + writer.WriteStringValue(ConfigurationValue); + } + if (Optional.IsDefined(ConfigurationGroupSchemaResourceReference)) + { + writer.WritePropertyName("configurationGroupSchemaResourceReference"u8); + writer.WriteObjectValue(ConfigurationGroupSchemaResourceReference); + } + writer.WritePropertyName("configurationType"u8); + writer.WriteStringValue(ConfigurationType.ToString()); + writer.WriteEndObject(); + } + + internal static ConfigurationValueWithoutSecrets DeserializeConfigurationValueWithoutSecrets(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional configurationValue = default; + Optional provisioningState = default; + Optional publisherName = default; + Optional publisherScope = default; + Optional configurationGroupSchemaName = default; + Optional configurationGroupSchemaOfferingLocation = default; + Optional configurationGroupSchemaResourceReference = default; + ConfigurationGroupValueConfigurationType configurationType = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("configurationValue"u8)) + { + configurationValue = property.Value.GetString(); + continue; + } + if (property.NameEquals("provisioningState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new ProvisioningState(property.Value.GetString()); + continue; + } + if (property.NameEquals("publisherName"u8)) + { + publisherName = property.Value.GetString(); + continue; + } + if (property.NameEquals("publisherScope"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + publisherScope = new PublisherScope(property.Value.GetString()); + continue; + } + if (property.NameEquals("configurationGroupSchemaName"u8)) + { + configurationGroupSchemaName = property.Value.GetString(); + continue; + } + if (property.NameEquals("configurationGroupSchemaOfferingLocation"u8)) + { + configurationGroupSchemaOfferingLocation = property.Value.GetString(); + continue; + } + if (property.NameEquals("configurationGroupSchemaResourceReference"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + configurationGroupSchemaResourceReference = DeploymentResourceIdReference.DeserializeDeploymentResourceIdReference(property.Value); + continue; + } + if (property.NameEquals("configurationType"u8)) + { + configurationType = new ConfigurationGroupValueConfigurationType(property.Value.GetString()); + continue; + } + } + return new ConfigurationValueWithoutSecrets(Optional.ToNullable(provisioningState), publisherName.Value, Optional.ToNullable(publisherScope), configurationGroupSchemaName.Value, configurationGroupSchemaOfferingLocation.Value, configurationGroupSchemaResourceReference.Value, configurationType, configurationValue.Value); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ConfigurationValueWithoutSecrets.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ConfigurationValueWithoutSecrets.cs new file mode 100644 index 000000000000..189e8bce56fa --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ConfigurationValueWithoutSecrets.cs @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// The ConfigurationValue with no secrets. + public partial class ConfigurationValueWithoutSecrets : ConfigurationGroupValuePropertiesFormat + { + /// Initializes a new instance of ConfigurationValueWithoutSecrets. + public ConfigurationValueWithoutSecrets() + { + ConfigurationType = ConfigurationGroupValueConfigurationType.Open; + } + + /// Initializes a new instance of ConfigurationValueWithoutSecrets. + /// The provisioning state of the site resource. + /// The publisher name for the configuration group schema. + /// The scope of the publisher. + /// The configuration group schema name. + /// The location of the configuration group schema offering. + /// + /// The configuration group schema resource reference. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include and . + /// + /// The value which indicates if configuration values are secrets. + /// Name and value pairs that define the configuration value. It can be a well formed escaped JSON string. + internal ConfigurationValueWithoutSecrets(ProvisioningState? provisioningState, string publisherName, PublisherScope? publisherScope, string configurationGroupSchemaName, string configurationGroupSchemaOfferingLocation, DeploymentResourceIdReference configurationGroupSchemaResourceReference, ConfigurationGroupValueConfigurationType configurationType, string configurationValue) : base(provisioningState, publisherName, publisherScope, configurationGroupSchemaName, configurationGroupSchemaOfferingLocation, configurationGroupSchemaResourceReference, configurationType) + { + ConfigurationValue = configurationValue; + ConfigurationType = configurationType; + } + + /// Name and value pairs that define the configuration value. It can be a well formed escaped JSON string. + public string ConfigurationValue { get; set; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ContainerizedNetworkFunctionDefinitionVersion.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ContainerizedNetworkFunctionDefinitionVersion.Serialization.cs new file mode 100644 index 000000000000..f22b65348fbf --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ContainerizedNetworkFunctionDefinitionVersion.Serialization.cs @@ -0,0 +1,98 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class ContainerizedNetworkFunctionDefinitionVersion : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(NetworkFunctionTemplate)) + { + writer.WritePropertyName("networkFunctionTemplate"u8); + writer.WriteObjectValue(NetworkFunctionTemplate); + } + if (Optional.IsDefined(Description)) + { + writer.WritePropertyName("description"u8); + writer.WriteStringValue(Description); + } + if (Optional.IsDefined(DeployParameters)) + { + writer.WritePropertyName("deployParameters"u8); + writer.WriteStringValue(DeployParameters); + } + writer.WritePropertyName("networkFunctionType"u8); + writer.WriteStringValue(NetworkFunctionType.ToString()); + writer.WriteEndObject(); + } + + internal static ContainerizedNetworkFunctionDefinitionVersion DeserializeContainerizedNetworkFunctionDefinitionVersion(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional networkFunctionTemplate = default; + Optional provisioningState = default; + Optional versionState = default; + Optional description = default; + Optional deployParameters = default; + NetworkFunctionType networkFunctionType = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("networkFunctionTemplate"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + networkFunctionTemplate = ContainerizedNetworkFunctionTemplate.DeserializeContainerizedNetworkFunctionTemplate(property.Value); + continue; + } + if (property.NameEquals("provisioningState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new ProvisioningState(property.Value.GetString()); + continue; + } + if (property.NameEquals("versionState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + versionState = new VersionState(property.Value.GetString()); + continue; + } + if (property.NameEquals("description"u8)) + { + description = property.Value.GetString(); + continue; + } + if (property.NameEquals("deployParameters"u8)) + { + deployParameters = property.Value.GetString(); + continue; + } + if (property.NameEquals("networkFunctionType"u8)) + { + networkFunctionType = new NetworkFunctionType(property.Value.GetString()); + continue; + } + } + return new ContainerizedNetworkFunctionDefinitionVersion(Optional.ToNullable(provisioningState), Optional.ToNullable(versionState), description.Value, deployParameters.Value, networkFunctionType, networkFunctionTemplate.Value); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ContainerizedNetworkFunctionDefinitionVersion.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ContainerizedNetworkFunctionDefinitionVersion.cs new file mode 100644 index 000000000000..6fec3cec65ec --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ContainerizedNetworkFunctionDefinitionVersion.cs @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// Containerized network function network function definition version properties. + public partial class ContainerizedNetworkFunctionDefinitionVersion : NetworkFunctionDefinitionVersionPropertiesFormat + { + /// Initializes a new instance of ContainerizedNetworkFunctionDefinitionVersion. + public ContainerizedNetworkFunctionDefinitionVersion() + { + NetworkFunctionType = NetworkFunctionType.ContainerizedNetworkFunction; + } + + /// Initializes a new instance of ContainerizedNetworkFunctionDefinitionVersion. + /// The provisioning state of the network function definition version resource. + /// The network function definition version state. + /// The network function definition version description. + /// The deployment parameters of the network function definition version. + /// The network function type. + /// + /// Containerized network function template. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include . + /// + internal ContainerizedNetworkFunctionDefinitionVersion(ProvisioningState? provisioningState, VersionState? versionState, string description, string deployParameters, NetworkFunctionType networkFunctionType, ContainerizedNetworkFunctionTemplate networkFunctionTemplate) : base(provisioningState, versionState, description, deployParameters, networkFunctionType) + { + NetworkFunctionTemplate = networkFunctionTemplate; + NetworkFunctionType = networkFunctionType; + } + + /// + /// Containerized network function template. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include . + /// + public ContainerizedNetworkFunctionTemplate NetworkFunctionTemplate { get; set; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ContainerizedNetworkFunctionNfviType.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ContainerizedNetworkFunctionNfviType.cs new file mode 100644 index 000000000000..1694ceb9e68e --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ContainerizedNetworkFunctionNfviType.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.HybridNetwork.Models +{ + /// The network function type. + internal readonly partial struct ContainerizedNetworkFunctionNfviType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public ContainerizedNetworkFunctionNfviType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string UnknownValue = "Unknown"; + private const string AzureArcKubernetesValue = "AzureArcKubernetes"; + + /// Unknown. + public static ContainerizedNetworkFunctionNfviType Unknown { get; } = new ContainerizedNetworkFunctionNfviType(UnknownValue); + /// AzureArcKubernetes. + public static ContainerizedNetworkFunctionNfviType AzureArcKubernetes { get; } = new ContainerizedNetworkFunctionNfviType(AzureArcKubernetesValue); + /// Determines if two values are the same. + public static bool operator ==(ContainerizedNetworkFunctionNfviType left, ContainerizedNetworkFunctionNfviType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ContainerizedNetworkFunctionNfviType left, ContainerizedNetworkFunctionNfviType right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator ContainerizedNetworkFunctionNfviType(string value) => new ContainerizedNetworkFunctionNfviType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ContainerizedNetworkFunctionNfviType other && Equals(other); + /// + public bool Equals(ContainerizedNetworkFunctionNfviType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ContainerizedNetworkFunctionTemplate.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ContainerizedNetworkFunctionTemplate.Serialization.cs new file mode 100644 index 000000000000..94ed73d63705 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ContainerizedNetworkFunctionTemplate.Serialization.cs @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class ContainerizedNetworkFunctionTemplate : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("nfviType"u8); + writer.WriteStringValue(NfviType.ToString()); + writer.WriteEndObject(); + } + + internal static ContainerizedNetworkFunctionTemplate DeserializeContainerizedNetworkFunctionTemplate(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + if (element.TryGetProperty("nfviType", out JsonElement discriminator)) + { + switch (discriminator.GetString()) + { + case "AzureArcKubernetes": return AzureArcKubernetesNetworkFunctionTemplate.DeserializeAzureArcKubernetesNetworkFunctionTemplate(element); + } + } + return UnknownContainerizedNetworkFunctionTemplate.DeserializeUnknownContainerizedNetworkFunctionTemplate(element); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ContainerizedNetworkFunctionTemplate.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ContainerizedNetworkFunctionTemplate.cs new file mode 100644 index 000000000000..3b321acb7591 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ContainerizedNetworkFunctionTemplate.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// + /// Containerized network function template. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include . + /// + public abstract partial class ContainerizedNetworkFunctionTemplate + { + /// Initializes a new instance of ContainerizedNetworkFunctionTemplate. + protected ContainerizedNetworkFunctionTemplate() + { + } + + /// Initializes a new instance of ContainerizedNetworkFunctionTemplate. + /// The network function type. + internal ContainerizedNetworkFunctionTemplate(ContainerizedNetworkFunctionNfviType nfviType) + { + NfviType = nfviType; + } + + /// The network function type. + internal ContainerizedNetworkFunctionNfviType NfviType { get; set; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/CredentialType.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/CredentialType.cs new file mode 100644 index 000000000000..125f2b2abb24 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/CredentialType.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.HybridNetwork.Models +{ + /// The credential type. + internal readonly partial struct CredentialType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public CredentialType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string UnknownValue = "Unknown"; + private const string AzureContainerRegistryScopedTokenValue = "AzureContainerRegistryScopedToken"; + private const string AzureStorageAccountTokenValue = "AzureStorageAccountToken"; + + /// Unknown. + public static CredentialType Unknown { get; } = new CredentialType(UnknownValue); + /// AzureContainerRegistryScopedToken. + public static CredentialType AzureContainerRegistryScopedToken { get; } = new CredentialType(AzureContainerRegistryScopedTokenValue); + /// AzureStorageAccountToken. + public static CredentialType AzureStorageAccountToken { get; } = new CredentialType(AzureStorageAccountTokenValue); + /// Determines if two values are the same. + public static bool operator ==(CredentialType left, CredentialType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(CredentialType left, CredentialType right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator CredentialType(string value) => new CredentialType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is CredentialType other && Equals(other); + /// + public bool Equals(CredentialType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/DependsOnProfile.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/DependsOnProfile.Serialization.cs new file mode 100644 index 000000000000..76fd29485029 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/DependsOnProfile.Serialization.cs @@ -0,0 +1,109 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class DependsOnProfile : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(InstallDependsOn)) + { + writer.WritePropertyName("installDependsOn"u8); + writer.WriteStartArray(); + foreach (var item in InstallDependsOn) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(UninstallDependsOn)) + { + writer.WritePropertyName("uninstallDependsOn"u8); + writer.WriteStartArray(); + foreach (var item in UninstallDependsOn) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(UpdateDependsOn)) + { + writer.WritePropertyName("updateDependsOn"u8); + writer.WriteStartArray(); + foreach (var item in UpdateDependsOn) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + writer.WriteEndObject(); + } + + internal static DependsOnProfile DeserializeDependsOnProfile(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> installDependsOn = default; + Optional> uninstallDependsOn = default; + Optional> updateDependsOn = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("installDependsOn"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + installDependsOn = array; + continue; + } + if (property.NameEquals("uninstallDependsOn"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + uninstallDependsOn = array; + continue; + } + if (property.NameEquals("updateDependsOn"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + updateDependsOn = array; + continue; + } + } + return new DependsOnProfile(Optional.ToList(installDependsOn), Optional.ToList(uninstallDependsOn), Optional.ToList(updateDependsOn)); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/DependsOnProfile.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/DependsOnProfile.cs new file mode 100644 index 000000000000..d838ee614d3a --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/DependsOnProfile.cs @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// Depends on profile definition. + public partial class DependsOnProfile + { + /// Initializes a new instance of DependsOnProfile. + public DependsOnProfile() + { + InstallDependsOn = new ChangeTrackingList(); + UninstallDependsOn = new ChangeTrackingList(); + UpdateDependsOn = new ChangeTrackingList(); + } + + /// Initializes a new instance of DependsOnProfile. + /// Application installation operation dependency. + /// Application deletion operation dependency. + /// Application update operation dependency. + internal DependsOnProfile(IList installDependsOn, IList uninstallDependsOn, IList updateDependsOn) + { + InstallDependsOn = installDependsOn; + UninstallDependsOn = uninstallDependsOn; + UpdateDependsOn = updateDependsOn; + } + + /// Application installation operation dependency. + public IList InstallDependsOn { get; } + /// Application deletion operation dependency. + public IList UninstallDependsOn { get; } + /// Application update operation dependency. + public IList UpdateDependsOn { get; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/DeploymentResourceIdReference.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/DeploymentResourceIdReference.Serialization.cs new file mode 100644 index 000000000000..b24c4fe9dfde --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/DeploymentResourceIdReference.Serialization.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class DeploymentResourceIdReference : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("idType"u8); + writer.WriteStringValue(IdType.ToString()); + writer.WriteEndObject(); + } + + internal static DeploymentResourceIdReference DeserializeDeploymentResourceIdReference(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + if (element.TryGetProperty("idType", out JsonElement discriminator)) + { + switch (discriminator.GetString()) + { + case "Open": return OpenDeploymentResourceReference.DeserializeOpenDeploymentResourceReference(element); + case "Secret": return SecretDeploymentResourceReference.DeserializeSecretDeploymentResourceReference(element); + } + } + return UnknownDeploymentResourceIdReference.DeserializeUnknownDeploymentResourceIdReference(element); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/DeploymentResourceIdReference.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/DeploymentResourceIdReference.cs new file mode 100644 index 000000000000..97514c2a17ab --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/DeploymentResourceIdReference.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// + /// The azure resource reference which is used for deployment. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include and . + /// + public abstract partial class DeploymentResourceIdReference + { + /// Initializes a new instance of DeploymentResourceIdReference. + protected DeploymentResourceIdReference() + { + } + + /// Initializes a new instance of DeploymentResourceIdReference. + /// The resource reference arm id type. + internal DeploymentResourceIdReference(IdType idType) + { + IdType = idType; + } + + /// The resource reference arm id type. + internal IdType IdType { get; set; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/DeploymentStatusProperties.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/DeploymentStatusProperties.Serialization.cs new file mode 100644 index 000000000000..7ad1cc082728 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/DeploymentStatusProperties.Serialization.cs @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class DeploymentStatusProperties + { + internal static DeploymentStatusProperties DeserializeDeploymentStatusProperties(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional status = default; + Optional resources = default; + Optional nextExpectedUpdateAt = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("status"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + status = new ComponentStatus(property.Value.GetString()); + continue; + } + if (property.NameEquals("resources"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + resources = ComponentKubernetesResources.DeserializeComponentKubernetesResources(property.Value); + continue; + } + if (property.NameEquals("nextExpectedUpdateAt"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextExpectedUpdateAt = property.Value.GetDateTimeOffset("O"); + continue; + } + } + return new DeploymentStatusProperties(Optional.ToNullable(status), resources.Value, Optional.ToNullable(nextExpectedUpdateAt)); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/DeploymentStatusProperties.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/DeploymentStatusProperties.cs new file mode 100644 index 000000000000..d0230b599b7f --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/DeploymentStatusProperties.cs @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// The deployment status properties of the network function component. + public partial class DeploymentStatusProperties + { + /// Initializes a new instance of DeploymentStatusProperties. + internal DeploymentStatusProperties() + { + } + + /// Initializes a new instance of DeploymentStatusProperties. + /// The status of the component resource. + /// The resource related to the component resource. + /// The next expected update of deployment status. + internal DeploymentStatusProperties(ComponentStatus? status, ComponentKubernetesResources resources, DateTimeOffset? nextExpectedUpdateOn) + { + Status = status; + Resources = resources; + NextExpectedUpdateOn = nextExpectedUpdateOn; + } + + /// The status of the component resource. + public ComponentStatus? Status { get; } + /// The resource related to the component resource. + public ComponentKubernetesResources Resources { get; } + /// The next expected update of deployment status. + public DateTimeOffset? NextExpectedUpdateOn { get; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ExecuteRequestContent.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ExecuteRequestContent.Serialization.cs new file mode 100644 index 000000000000..a09a6fdd8de3 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ExecuteRequestContent.Serialization.cs @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class ExecuteRequestContent : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("serviceEndpoint"u8); + writer.WriteStringValue(ServiceEndpoint); + writer.WritePropertyName("requestMetadata"u8); + writer.WriteObjectValue(RequestMetadata); + writer.WriteEndObject(); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ExecuteRequestContent.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ExecuteRequestContent.cs new file mode 100644 index 000000000000..c0483b67c1df --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ExecuteRequestContent.cs @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// Payload for execute request post call. + public partial class ExecuteRequestContent + { + /// Initializes a new instance of ExecuteRequestContent. + /// The endpoint of service to call. + /// The request metadata. + /// or is null. + public ExecuteRequestContent(string serviceEndpoint, RequestMetadata requestMetadata) + { + Argument.AssertNotNull(serviceEndpoint, nameof(serviceEndpoint)); + Argument.AssertNotNull(requestMetadata, nameof(requestMetadata)); + + ServiceEndpoint = serviceEndpoint; + RequestMetadata = requestMetadata; + } + + /// The endpoint of service to call. + public string ServiceEndpoint { get; } + /// The request metadata. + public RequestMetadata RequestMetadata { get; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/HelmArtifactProfile.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/HelmArtifactProfile.Serialization.cs new file mode 100644 index 000000000000..0b0052f66b3f --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/HelmArtifactProfile.Serialization.cs @@ -0,0 +1,106 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class HelmArtifactProfile : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(HelmPackageName)) + { + writer.WritePropertyName("helmPackageName"u8); + writer.WriteStringValue(HelmPackageName); + } + if (Optional.IsDefined(HelmPackageVersionRange)) + { + writer.WritePropertyName("helmPackageVersionRange"u8); + writer.WriteStringValue(HelmPackageVersionRange); + } + if (Optional.IsCollectionDefined(RegistryValuesPaths)) + { + writer.WritePropertyName("registryValuesPaths"u8); + writer.WriteStartArray(); + foreach (var item in RegistryValuesPaths) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(ImagePullSecretsValuesPaths)) + { + writer.WritePropertyName("imagePullSecretsValuesPaths"u8); + writer.WriteStartArray(); + foreach (var item in ImagePullSecretsValuesPaths) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + writer.WriteEndObject(); + } + + internal static HelmArtifactProfile DeserializeHelmArtifactProfile(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional helmPackageName = default; + Optional helmPackageVersionRange = default; + Optional> registryValuesPaths = default; + Optional> imagePullSecretsValuesPaths = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("helmPackageName"u8)) + { + helmPackageName = property.Value.GetString(); + continue; + } + if (property.NameEquals("helmPackageVersionRange"u8)) + { + helmPackageVersionRange = property.Value.GetString(); + continue; + } + if (property.NameEquals("registryValuesPaths"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + registryValuesPaths = array; + continue; + } + if (property.NameEquals("imagePullSecretsValuesPaths"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + imagePullSecretsValuesPaths = array; + continue; + } + } + return new HelmArtifactProfile(helmPackageName.Value, helmPackageVersionRange.Value, Optional.ToList(registryValuesPaths), Optional.ToList(imagePullSecretsValuesPaths)); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/HelmArtifactProfile.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/HelmArtifactProfile.cs new file mode 100644 index 000000000000..7e6466ad5216 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/HelmArtifactProfile.cs @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// Helm artifact profile. + public partial class HelmArtifactProfile + { + /// Initializes a new instance of HelmArtifactProfile. + public HelmArtifactProfile() + { + RegistryValuesPaths = new ChangeTrackingList(); + ImagePullSecretsValuesPaths = new ChangeTrackingList(); + } + + /// Initializes a new instance of HelmArtifactProfile. + /// Helm package name. + /// Helm package version range. + /// The registry values path list. + /// The image pull secrets values path list. + internal HelmArtifactProfile(string helmPackageName, string helmPackageVersionRange, IList registryValuesPaths, IList imagePullSecretsValuesPaths) + { + HelmPackageName = helmPackageName; + HelmPackageVersionRange = helmPackageVersionRange; + RegistryValuesPaths = registryValuesPaths; + ImagePullSecretsValuesPaths = imagePullSecretsValuesPaths; + } + + /// Helm package name. + public string HelmPackageName { get; set; } + /// Helm package version range. + public string HelmPackageVersionRange { get; set; } + /// The registry values path list. + public IList RegistryValuesPaths { get; } + /// The image pull secrets values path list. + public IList ImagePullSecretsValuesPaths { get; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/HelmInstallConfig.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/HelmInstallConfig.Serialization.cs new file mode 100644 index 000000000000..1d5972d073e5 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/HelmInstallConfig.Serialization.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class HelmInstallConfig : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Atomic)) + { + writer.WritePropertyName("atomic"u8); + writer.WriteStringValue(Atomic); + } + if (Optional.IsDefined(Wait)) + { + writer.WritePropertyName("wait"u8); + writer.WriteStringValue(Wait); + } + if (Optional.IsDefined(Timeout)) + { + writer.WritePropertyName("timeout"u8); + writer.WriteStringValue(Timeout); + } + writer.WriteEndObject(); + } + + internal static HelmInstallConfig DeserializeHelmInstallConfig(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional atomic = default; + Optional wait = default; + Optional timeout = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("atomic"u8)) + { + atomic = property.Value.GetString(); + continue; + } + if (property.NameEquals("wait"u8)) + { + wait = property.Value.GetString(); + continue; + } + if (property.NameEquals("timeout"u8)) + { + timeout = property.Value.GetString(); + continue; + } + } + return new HelmInstallConfig(atomic.Value, wait.Value, timeout.Value); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/HelmInstallConfig.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/HelmInstallConfig.cs new file mode 100644 index 000000000000..424097f4e324 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/HelmInstallConfig.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// The helm deployment install options. + public partial class HelmInstallConfig + { + /// Initializes a new instance of HelmInstallConfig. + public HelmInstallConfig() + { + } + + /// Initializes a new instance of HelmInstallConfig. + /// The helm deployment atomic options. + /// The helm deployment wait options. + /// The helm deployment timeout options. + internal HelmInstallConfig(string atomic, string wait, string timeout) + { + Atomic = atomic; + Wait = wait; + Timeout = timeout; + } + + /// The helm deployment atomic options. + public string Atomic { get; set; } + /// The helm deployment wait options. + public string Wait { get; set; } + /// The helm deployment timeout options. + public string Timeout { get; set; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/HelmMappingRuleProfile.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/HelmMappingRuleProfile.Serialization.cs new file mode 100644 index 000000000000..9ae20c6f4991 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/HelmMappingRuleProfile.Serialization.cs @@ -0,0 +1,92 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class HelmMappingRuleProfile : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(ReleaseNamespace)) + { + writer.WritePropertyName("releaseNamespace"u8); + writer.WriteStringValue(ReleaseNamespace); + } + if (Optional.IsDefined(ReleaseName)) + { + writer.WritePropertyName("releaseName"u8); + writer.WriteStringValue(ReleaseName); + } + if (Optional.IsDefined(HelmPackageVersion)) + { + writer.WritePropertyName("helmPackageVersion"u8); + writer.WriteStringValue(HelmPackageVersion); + } + if (Optional.IsDefined(Values)) + { + writer.WritePropertyName("values"u8); + writer.WriteStringValue(Values); + } + if (Optional.IsDefined(Options)) + { + writer.WritePropertyName("options"u8); + writer.WriteObjectValue(Options); + } + writer.WriteEndObject(); + } + + internal static HelmMappingRuleProfile DeserializeHelmMappingRuleProfile(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional releaseNamespace = default; + Optional releaseName = default; + Optional helmPackageVersion = default; + Optional values = default; + Optional options = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("releaseNamespace"u8)) + { + releaseNamespace = property.Value.GetString(); + continue; + } + if (property.NameEquals("releaseName"u8)) + { + releaseName = property.Value.GetString(); + continue; + } + if (property.NameEquals("helmPackageVersion"u8)) + { + helmPackageVersion = property.Value.GetString(); + continue; + } + if (property.NameEquals("values"u8)) + { + values = property.Value.GetString(); + continue; + } + if (property.NameEquals("options"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + options = HelmMappingRuleProfileConfig.DeserializeHelmMappingRuleProfileConfig(property.Value); + continue; + } + } + return new HelmMappingRuleProfile(releaseNamespace.Value, releaseName.Value, helmPackageVersion.Value, values.Value, options.Value); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/HelmMappingRuleProfile.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/HelmMappingRuleProfile.cs new file mode 100644 index 000000000000..5d2359368668 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/HelmMappingRuleProfile.cs @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// Helm mapping rule profile. + public partial class HelmMappingRuleProfile + { + /// Initializes a new instance of HelmMappingRuleProfile. + public HelmMappingRuleProfile() + { + } + + /// Initializes a new instance of HelmMappingRuleProfile. + /// Helm release namespace. + /// Helm release name. + /// Helm package version. + /// Helm release values. + /// The helm deployment options. + internal HelmMappingRuleProfile(string releaseNamespace, string releaseName, string helmPackageVersion, string values, HelmMappingRuleProfileConfig options) + { + ReleaseNamespace = releaseNamespace; + ReleaseName = releaseName; + HelmPackageVersion = helmPackageVersion; + Values = values; + Options = options; + } + + /// Helm release namespace. + public string ReleaseNamespace { get; set; } + /// Helm release name. + public string ReleaseName { get; set; } + /// Helm package version. + public string HelmPackageVersion { get; set; } + /// Helm release values. + public string Values { get; set; } + /// The helm deployment options. + public HelmMappingRuleProfileConfig Options { get; set; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/HelmMappingRuleProfileConfig.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/HelmMappingRuleProfileConfig.Serialization.cs new file mode 100644 index 000000000000..7e0e1e8e26a0 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/HelmMappingRuleProfileConfig.Serialization.cs @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class HelmMappingRuleProfileConfig : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(InstallOptions)) + { + writer.WritePropertyName("installOptions"u8); + writer.WriteObjectValue(InstallOptions); + } + if (Optional.IsDefined(UpgradeOptions)) + { + writer.WritePropertyName("upgradeOptions"u8); + writer.WriteObjectValue(UpgradeOptions); + } + writer.WriteEndObject(); + } + + internal static HelmMappingRuleProfileConfig DeserializeHelmMappingRuleProfileConfig(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional installOptions = default; + Optional upgradeOptions = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("installOptions"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + installOptions = HelmInstallConfig.DeserializeHelmInstallConfig(property.Value); + continue; + } + if (property.NameEquals("upgradeOptions"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + upgradeOptions = HelmUpgradeConfig.DeserializeHelmUpgradeConfig(property.Value); + continue; + } + } + return new HelmMappingRuleProfileConfig(installOptions.Value, upgradeOptions.Value); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/HelmMappingRuleProfileConfig.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/HelmMappingRuleProfileConfig.cs new file mode 100644 index 000000000000..310bb760e0b9 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/HelmMappingRuleProfileConfig.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// The helm deployment options. + public partial class HelmMappingRuleProfileConfig + { + /// Initializes a new instance of HelmMappingRuleProfileConfig. + public HelmMappingRuleProfileConfig() + { + } + + /// Initializes a new instance of HelmMappingRuleProfileConfig. + /// The helm deployment install options. + /// The helm deployment upgrade options. + internal HelmMappingRuleProfileConfig(HelmInstallConfig installOptions, HelmUpgradeConfig upgradeOptions) + { + InstallOptions = installOptions; + UpgradeOptions = upgradeOptions; + } + + /// The helm deployment install options. + public HelmInstallConfig InstallOptions { get; set; } + /// The helm deployment upgrade options. + public HelmUpgradeConfig UpgradeOptions { get; set; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/HelmUpgradeConfig.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/HelmUpgradeConfig.Serialization.cs new file mode 100644 index 000000000000..ab02d005e80b --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/HelmUpgradeConfig.Serialization.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class HelmUpgradeConfig : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Atomic)) + { + writer.WritePropertyName("atomic"u8); + writer.WriteStringValue(Atomic); + } + if (Optional.IsDefined(Wait)) + { + writer.WritePropertyName("wait"u8); + writer.WriteStringValue(Wait); + } + if (Optional.IsDefined(Timeout)) + { + writer.WritePropertyName("timeout"u8); + writer.WriteStringValue(Timeout); + } + writer.WriteEndObject(); + } + + internal static HelmUpgradeConfig DeserializeHelmUpgradeConfig(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional atomic = default; + Optional wait = default; + Optional timeout = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("atomic"u8)) + { + atomic = property.Value.GetString(); + continue; + } + if (property.NameEquals("wait"u8)) + { + wait = property.Value.GetString(); + continue; + } + if (property.NameEquals("timeout"u8)) + { + timeout = property.Value.GetString(); + continue; + } + } + return new HelmUpgradeConfig(atomic.Value, wait.Value, timeout.Value); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/HelmUpgradeConfig.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/HelmUpgradeConfig.cs new file mode 100644 index 000000000000..8386119d0928 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/HelmUpgradeConfig.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// The helm deployment install options. + public partial class HelmUpgradeConfig + { + /// Initializes a new instance of HelmUpgradeConfig. + public HelmUpgradeConfig() + { + } + + /// Initializes a new instance of HelmUpgradeConfig. + /// The helm deployment atomic options. + /// The helm deployment wait options. + /// The helm deployment timeout options. + internal HelmUpgradeConfig(string atomic, string wait, string timeout) + { + Atomic = atomic; + Wait = wait; + Timeout = timeout; + } + + /// The helm deployment atomic options. + public string Atomic { get; set; } + /// The helm deployment wait options. + public string Wait { get; set; } + /// The helm deployment timeout options. + public string Timeout { get; set; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/HttpMethod.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/HttpMethod.cs new file mode 100644 index 000000000000..69c294f7beae --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/HttpMethod.cs @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// The http method of the request. + public readonly partial struct HttpMethod : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public HttpMethod(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string UnknownValue = "Unknown"; + private const string PostValue = "Post"; + private const string PutValue = "Put"; + private const string GetValue = "Get"; + private const string PatchValue = "Patch"; + private const string DeleteValue = "Delete"; + + /// Unknown. + public static HttpMethod Unknown { get; } = new HttpMethod(UnknownValue); + /// Post. + public static HttpMethod Post { get; } = new HttpMethod(PostValue); + /// Put. + public static HttpMethod Put { get; } = new HttpMethod(PutValue); + /// Get. + public static HttpMethod Get { get; } = new HttpMethod(GetValue); + /// Patch. + public static HttpMethod Patch { get; } = new HttpMethod(PatchValue); + /// Delete. + public static HttpMethod Delete { get; } = new HttpMethod(DeleteValue); + /// Determines if two values are the same. + public static bool operator ==(HttpMethod left, HttpMethod right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(HttpMethod left, HttpMethod right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator HttpMethod(string value) => new HttpMethod(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is HttpMethod other && Equals(other); + /// + public bool Equals(HttpMethod other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/HybridNetworkSku.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/HybridNetworkSku.Serialization.cs new file mode 100644 index 000000000000..aa01ed063156 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/HybridNetworkSku.Serialization.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class HybridNetworkSku : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name.ToString()); + writer.WriteEndObject(); + } + + internal static HybridNetworkSku DeserializeHybridNetworkSku(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + HybridNetworkSkuName name = default; + Optional tier = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = new HybridNetworkSkuName(property.Value.GetString()); + continue; + } + if (property.NameEquals("tier"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + tier = new HybridNetworkSkuTier(property.Value.GetString()); + continue; + } + } + return new HybridNetworkSku(name, Optional.ToNullable(tier)); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/HybridNetworkSku.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/HybridNetworkSku.cs new file mode 100644 index 000000000000..26e05b57abd7 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/HybridNetworkSku.cs @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// Sku, to be associated with a SiteNetworkService. + public partial class HybridNetworkSku + { + /// Initializes a new instance of HybridNetworkSku. + /// Name of this Sku. + public HybridNetworkSku(HybridNetworkSkuName name) + { + Name = name; + } + + /// Initializes a new instance of HybridNetworkSku. + /// Name of this Sku. + /// The SKU tier based on the SKU name. + internal HybridNetworkSku(HybridNetworkSkuName name, HybridNetworkSkuTier? tier) + { + Name = name; + Tier = tier; + } + + /// Name of this Sku. + public HybridNetworkSkuName Name { get; set; } + /// The SKU tier based on the SKU name. + public HybridNetworkSkuTier? Tier { get; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/HybridNetworkSkuName.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/HybridNetworkSkuName.cs new file mode 100644 index 000000000000..db4f18a90a8f --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/HybridNetworkSkuName.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.HybridNetwork.Models +{ + /// Name of this Sku. + public readonly partial struct HybridNetworkSkuName : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public HybridNetworkSkuName(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string BasicValue = "Basic"; + private const string StandardValue = "Standard"; + + /// Basic. + public static HybridNetworkSkuName Basic { get; } = new HybridNetworkSkuName(BasicValue); + /// Standard. + public static HybridNetworkSkuName Standard { get; } = new HybridNetworkSkuName(StandardValue); + /// Determines if two values are the same. + public static bool operator ==(HybridNetworkSkuName left, HybridNetworkSkuName right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(HybridNetworkSkuName left, HybridNetworkSkuName right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator HybridNetworkSkuName(string value) => new HybridNetworkSkuName(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is HybridNetworkSkuName other && Equals(other); + /// + public bool Equals(HybridNetworkSkuName other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/HybridNetworkSkuTier.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/HybridNetworkSkuTier.cs new file mode 100644 index 000000000000..7dcb03ae6ecc --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/HybridNetworkSkuTier.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.HybridNetwork.Models +{ + /// The SKU tier based on the SKU name. + public readonly partial struct HybridNetworkSkuTier : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public HybridNetworkSkuTier(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string BasicValue = "Basic"; + private const string StandardValue = "Standard"; + + /// Basic. + public static HybridNetworkSkuTier Basic { get; } = new HybridNetworkSkuTier(BasicValue); + /// Standard. + public static HybridNetworkSkuTier Standard { get; } = new HybridNetworkSkuTier(StandardValue); + /// Determines if two values are the same. + public static bool operator ==(HybridNetworkSkuTier left, HybridNetworkSkuTier right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(HybridNetworkSkuTier left, HybridNetworkSkuTier right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator HybridNetworkSkuTier(string value) => new HybridNetworkSkuTier(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is HybridNetworkSkuTier other && Equals(other); + /// + public bool Equals(HybridNetworkSkuTier other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/IdType.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/IdType.cs new file mode 100644 index 000000000000..ec050230ac4f --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/IdType.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.HybridNetwork.Models +{ + /// The resource reference arm id type. + internal readonly partial struct IdType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public IdType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string UnknownValue = "Unknown"; + private const string OpenValue = "Open"; + private const string SecretValue = "Secret"; + + /// Unknown. + public static IdType Unknown { get; } = new IdType(UnknownValue); + /// Open. + public static IdType Open { get; } = new IdType(OpenValue); + /// Secret. + public static IdType Secret { get; } = new IdType(SecretValue); + /// Determines if two values are the same. + public static bool operator ==(IdType left, IdType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(IdType left, IdType right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator IdType(string value) => new IdType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is IdType other && Equals(other); + /// + public bool Equals(IdType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ImageArtifactProfile.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ImageArtifactProfile.Serialization.cs new file mode 100644 index 000000000000..3dab8c70d494 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ImageArtifactProfile.Serialization.cs @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class ImageArtifactProfile : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(ImageName)) + { + writer.WritePropertyName("imageName"u8); + writer.WriteStringValue(ImageName); + } + if (Optional.IsDefined(ImageVersion)) + { + writer.WritePropertyName("imageVersion"u8); + writer.WriteStringValue(ImageVersion); + } + writer.WriteEndObject(); + } + + internal static ImageArtifactProfile DeserializeImageArtifactProfile(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional imageName = default; + Optional imageVersion = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("imageName"u8)) + { + imageName = property.Value.GetString(); + continue; + } + if (property.NameEquals("imageVersion"u8)) + { + imageVersion = property.Value.GetString(); + continue; + } + } + return new ImageArtifactProfile(imageName.Value, imageVersion.Value); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ImageArtifactProfile.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ImageArtifactProfile.cs new file mode 100644 index 000000000000..cc343ded631f --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ImageArtifactProfile.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// Image artifact profile. + public partial class ImageArtifactProfile + { + /// Initializes a new instance of ImageArtifactProfile. + public ImageArtifactProfile() + { + } + + /// Initializes a new instance of ImageArtifactProfile. + /// Image name. + /// Image version. + internal ImageArtifactProfile(string imageName, string imageVersion) + { + ImageName = imageName; + ImageVersion = imageVersion; + } + + /// Image name. + public string ImageName { get; set; } + /// Image version. + public string ImageVersion { get; set; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ImageMappingRuleProfile.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ImageMappingRuleProfile.Serialization.cs new file mode 100644 index 000000000000..323899bcbd49 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ImageMappingRuleProfile.Serialization.cs @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + internal partial class ImageMappingRuleProfile : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(UserConfiguration)) + { + writer.WritePropertyName("userConfiguration"u8); + writer.WriteStringValue(UserConfiguration); + } + writer.WriteEndObject(); + } + + internal static ImageMappingRuleProfile DeserializeImageMappingRuleProfile(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional userConfiguration = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("userConfiguration"u8)) + { + userConfiguration = property.Value.GetString(); + continue; + } + } + return new ImageMappingRuleProfile(userConfiguration.Value); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ImageMappingRuleProfile.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ImageMappingRuleProfile.cs new file mode 100644 index 000000000000..3332235f6b9b --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ImageMappingRuleProfile.cs @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// Image mapping rule profile. + internal partial class ImageMappingRuleProfile + { + /// Initializes a new instance of ImageMappingRuleProfile. + public ImageMappingRuleProfile() + { + } + + /// Initializes a new instance of ImageMappingRuleProfile. + /// List of values. + internal ImageMappingRuleProfile(string userConfiguration) + { + UserConfiguration = userConfiguration; + } + + /// List of values. + public string UserConfiguration { get; set; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/KubernetesDaemonSet.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/KubernetesDaemonSet.Serialization.cs new file mode 100644 index 000000000000..5cc9afeac327 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/KubernetesDaemonSet.Serialization.cs @@ -0,0 +1,100 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class KubernetesDaemonSet + { + internal static KubernetesDaemonSet DeserializeKubernetesDaemonSet(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional name = default; + Optional @namespace = default; + Optional desired = default; + Optional current = default; + Optional ready = default; + Optional upToDate = default; + Optional available = default; + Optional creationTime = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("namespace"u8)) + { + @namespace = property.Value.GetString(); + continue; + } + if (property.NameEquals("desired"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + desired = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("current"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + current = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("ready"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + ready = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("upToDate"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + upToDate = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("available"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + available = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("creationTime"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + creationTime = property.Value.GetDateTimeOffset("O"); + continue; + } + } + return new KubernetesDaemonSet(name.Value, @namespace.Value, Optional.ToNullable(desired), Optional.ToNullable(current), Optional.ToNullable(ready), Optional.ToNullable(upToDate), Optional.ToNullable(available), Optional.ToNullable(creationTime)); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/KubernetesDaemonSet.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/KubernetesDaemonSet.cs new file mode 100644 index 000000000000..36d1ef89d6ab --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/KubernetesDaemonSet.cs @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// Helm DaemonSet status properties. + public partial class KubernetesDaemonSet + { + /// Initializes a new instance of KubernetesDaemonSet. + internal KubernetesDaemonSet() + { + } + + /// Initializes a new instance of KubernetesDaemonSet. + /// The name of the daemonSet. + /// The namespace of the daemonSet. + /// Desired number of pods. + /// Current number of pods. + /// Number of Ready pods. + /// Number of upto date pods. + /// Number of available pods. + /// Creation Time of daemonSet. + internal KubernetesDaemonSet(string name, string @namespace, int? desiredNumberOfPods, int? currentNumberOfPods, int? readyNumberOfPods, int? upToDateNumberOfPods, int? availableNumberOfPods, DateTimeOffset? createdOn) + { + Name = name; + Namespace = @namespace; + DesiredNumberOfPods = desiredNumberOfPods; + CurrentNumberOfPods = currentNumberOfPods; + ReadyNumberOfPods = readyNumberOfPods; + UpToDateNumberOfPods = upToDateNumberOfPods; + AvailableNumberOfPods = availableNumberOfPods; + CreatedOn = createdOn; + } + + /// The name of the daemonSet. + public string Name { get; } + /// The namespace of the daemonSet. + public string Namespace { get; } + /// Desired number of pods. + public int? DesiredNumberOfPods { get; } + /// Current number of pods. + public int? CurrentNumberOfPods { get; } + /// Number of Ready pods. + public int? ReadyNumberOfPods { get; } + /// Number of upto date pods. + public int? UpToDateNumberOfPods { get; } + /// Number of available pods. + public int? AvailableNumberOfPods { get; } + /// Creation Time of daemonSet. + public DateTimeOffset? CreatedOn { get; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/KubernetesDeployment.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/KubernetesDeployment.Serialization.cs new file mode 100644 index 000000000000..f24f94f46d68 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/KubernetesDeployment.Serialization.cs @@ -0,0 +1,90 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class KubernetesDeployment + { + internal static KubernetesDeployment DeserializeKubernetesDeployment(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional name = default; + Optional @namespace = default; + Optional desired = default; + Optional ready = default; + Optional upToDate = default; + Optional available = default; + Optional creationTime = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("namespace"u8)) + { + @namespace = property.Value.GetString(); + continue; + } + if (property.NameEquals("desired"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + desired = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("ready"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + ready = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("upToDate"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + upToDate = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("available"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + available = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("creationTime"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + creationTime = property.Value.GetDateTimeOffset("O"); + continue; + } + } + return new KubernetesDeployment(name.Value, @namespace.Value, Optional.ToNullable(desired), Optional.ToNullable(ready), Optional.ToNullable(upToDate), Optional.ToNullable(available), Optional.ToNullable(creationTime)); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/KubernetesDeployment.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/KubernetesDeployment.cs new file mode 100644 index 000000000000..a7fe2f9b6c40 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/KubernetesDeployment.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// Helm Deployment status properties. + public partial class KubernetesDeployment + { + /// Initializes a new instance of KubernetesDeployment. + internal KubernetesDeployment() + { + } + + /// Initializes a new instance of KubernetesDeployment. + /// The name of the deployment. + /// The namespace of the deployment. + /// Desired number of pods. + /// Number of ready pods. + /// Number of upto date pods. + /// Number of available pods. + /// Creation Time of deployment. + internal KubernetesDeployment(string name, string @namespace, int? desiredNumberOfPods, int? readyNumberOfPods, int? upToDateNumberOfPods, int? availableNumberOfPods, DateTimeOffset? createdOn) + { + Name = name; + Namespace = @namespace; + DesiredNumberOfPods = desiredNumberOfPods; + ReadyNumberOfPods = readyNumberOfPods; + UpToDateNumberOfPods = upToDateNumberOfPods; + AvailableNumberOfPods = availableNumberOfPods; + CreatedOn = createdOn; + } + + /// The name of the deployment. + public string Name { get; } + /// The namespace of the deployment. + public string Namespace { get; } + /// Desired number of pods. + public int? DesiredNumberOfPods { get; } + /// Number of ready pods. + public int? ReadyNumberOfPods { get; } + /// Number of upto date pods. + public int? UpToDateNumberOfPods { get; } + /// Number of available pods. + public int? AvailableNumberOfPods { get; } + /// Creation Time of deployment. + public DateTimeOffset? CreatedOn { get; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/KubernetesPod.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/KubernetesPod.Serialization.cs new file mode 100644 index 000000000000..03257a7bbb93 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/KubernetesPod.Serialization.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 System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class KubernetesPod + { + internal static KubernetesPod DeserializeKubernetesPod(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional name = default; + Optional @namespace = default; + Optional desired = default; + Optional ready = default; + Optional status = default; + Optional creationTime = default; + Optional> events = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("namespace"u8)) + { + @namespace = property.Value.GetString(); + continue; + } + if (property.NameEquals("desired"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + desired = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("ready"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + ready = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("status"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + status = new PodStatus(property.Value.GetString()); + continue; + } + if (property.NameEquals("creationTime"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + creationTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("events"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(PodEvent.DeserializePodEvent(item)); + } + events = array; + continue; + } + } + return new KubernetesPod(name.Value, @namespace.Value, Optional.ToNullable(desired), Optional.ToNullable(ready), Optional.ToNullable(status), Optional.ToNullable(creationTime), Optional.ToList(events)); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/KubernetesPod.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/KubernetesPod.cs new file mode 100644 index 000000000000..a1fce6de7302 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/KubernetesPod.cs @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// Helm Pod status properties. + public partial class KubernetesPod + { + /// Initializes a new instance of KubernetesPod. + internal KubernetesPod() + { + Events = new ChangeTrackingList(); + } + + /// Initializes a new instance of KubernetesPod. + /// The name of the Pod. + /// The namespace of the Pod. + /// Desired number of containers. + /// Number of ready containers. + /// The status of a pod. + /// Creation Time of Pod. + /// Last 5 Pod events. + internal KubernetesPod(string name, string @namespace, int? desiredNumberOfContainers, int? readyNumberOfContainers, PodStatus? status, DateTimeOffset? createdOn, IReadOnlyList events) + { + Name = name; + Namespace = @namespace; + DesiredNumberOfContainers = desiredNumberOfContainers; + ReadyNumberOfContainers = readyNumberOfContainers; + Status = status; + CreatedOn = createdOn; + Events = events; + } + + /// The name of the Pod. + public string Name { get; } + /// The namespace of the Pod. + public string Namespace { get; } + /// Desired number of containers. + public int? DesiredNumberOfContainers { get; } + /// Number of ready containers. + public int? ReadyNumberOfContainers { get; } + /// The status of a pod. + public PodStatus? Status { get; } + /// Creation Time of Pod. + public DateTimeOffset? CreatedOn { get; } + /// Last 5 Pod events. + public IReadOnlyList Events { get; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/KubernetesReplicaSet.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/KubernetesReplicaSet.Serialization.cs new file mode 100644 index 000000000000..b4c5375d3009 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/KubernetesReplicaSet.Serialization.cs @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class KubernetesReplicaSet + { + internal static KubernetesReplicaSet DeserializeKubernetesReplicaSet(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional name = default; + Optional @namespace = default; + Optional desired = default; + Optional ready = default; + Optional current = default; + Optional creationTime = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("namespace"u8)) + { + @namespace = property.Value.GetString(); + continue; + } + if (property.NameEquals("desired"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + desired = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("ready"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + ready = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("current"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + current = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("creationTime"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + creationTime = property.Value.GetDateTimeOffset("O"); + continue; + } + } + return new KubernetesReplicaSet(name.Value, @namespace.Value, Optional.ToNullable(desired), Optional.ToNullable(ready), Optional.ToNullable(current), Optional.ToNullable(creationTime)); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/KubernetesReplicaSet.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/KubernetesReplicaSet.cs new file mode 100644 index 000000000000..7e165e964605 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/KubernetesReplicaSet.cs @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// Helm ReplicaSet status properties. + public partial class KubernetesReplicaSet + { + /// Initializes a new instance of KubernetesReplicaSet. + internal KubernetesReplicaSet() + { + } + + /// Initializes a new instance of KubernetesReplicaSet. + /// The name of the replicaSet. + /// The namespace of the replicaSet. + /// Desired number of pods. + /// Number of ready pods. + /// Number of current pods. + /// Creation Time of replicaSet. + internal KubernetesReplicaSet(string name, string @namespace, int? desiredNumberOfPods, int? readyNumberOfPods, int? currentNumberOfPods, DateTimeOffset? createdOn) + { + Name = name; + Namespace = @namespace; + DesiredNumberOfPods = desiredNumberOfPods; + ReadyNumberOfPods = readyNumberOfPods; + CurrentNumberOfPods = currentNumberOfPods; + CreatedOn = createdOn; + } + + /// The name of the replicaSet. + public string Name { get; } + /// The namespace of the replicaSet. + public string Namespace { get; } + /// Desired number of pods. + public int? DesiredNumberOfPods { get; } + /// Number of ready pods. + public int? ReadyNumberOfPods { get; } + /// Number of current pods. + public int? CurrentNumberOfPods { get; } + /// Creation Time of replicaSet. + public DateTimeOffset? CreatedOn { get; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/KubernetesStatefulSet.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/KubernetesStatefulSet.Serialization.cs new file mode 100644 index 000000000000..7e9db26ac757 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/KubernetesStatefulSet.Serialization.cs @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class KubernetesStatefulSet + { + internal static KubernetesStatefulSet DeserializeKubernetesStatefulSet(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional name = default; + Optional @namespace = default; + Optional desired = default; + Optional ready = default; + Optional creationTime = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("namespace"u8)) + { + @namespace = property.Value.GetString(); + continue; + } + if (property.NameEquals("desired"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + desired = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("ready"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + ready = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("creationTime"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + creationTime = property.Value.GetDateTimeOffset("O"); + continue; + } + } + return new KubernetesStatefulSet(name.Value, @namespace.Value, Optional.ToNullable(desired), Optional.ToNullable(ready), Optional.ToNullable(creationTime)); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/KubernetesStatefulSet.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/KubernetesStatefulSet.cs new file mode 100644 index 000000000000..49b1b3da637b --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/KubernetesStatefulSet.cs @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// Helm StatefulSet status properties. + public partial class KubernetesStatefulSet + { + /// Initializes a new instance of KubernetesStatefulSet. + internal KubernetesStatefulSet() + { + } + + /// Initializes a new instance of KubernetesStatefulSet. + /// The name of the statefulset. + /// The namespace of the statefulset. + /// Desired number of pods. + /// Number of ready pods. + /// Creation Time of statefulset. + internal KubernetesStatefulSet(string name, string @namespace, int? desiredNumberOfPods, int? readyNumberOfPods, DateTimeOffset? createdOn) + { + Name = name; + Namespace = @namespace; + DesiredNumberOfPods = desiredNumberOfPods; + ReadyNumberOfPods = readyNumberOfPods; + CreatedOn = createdOn; + } + + /// The name of the statefulset. + public string Name { get; } + /// The namespace of the statefulset. + public string Namespace { get; } + /// Desired number of pods. + public int? DesiredNumberOfPods { get; } + /// Number of ready pods. + public int? ReadyNumberOfPods { get; } + /// Creation Time of statefulset. + public DateTimeOffset? CreatedOn { get; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ManagedResourceGroupConfiguration.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ManagedResourceGroupConfiguration.Serialization.cs new file mode 100644 index 000000000000..5dc87cb829d6 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ManagedResourceGroupConfiguration.Serialization.cs @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class ManagedResourceGroupConfiguration : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (Optional.IsDefined(Location)) + { + writer.WritePropertyName("location"u8); + writer.WriteStringValue(Location.Value); + } + writer.WriteEndObject(); + } + + internal static ManagedResourceGroupConfiguration DeserializeManagedResourceGroupConfiguration(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional name = default; + Optional location = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("location"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + location = new AzureLocation(property.Value.GetString()); + continue; + } + } + return new ManagedResourceGroupConfiguration(name.Value, Optional.ToNullable(location)); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ManagedResourceGroupConfiguration.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ManagedResourceGroupConfiguration.cs new file mode 100644 index 000000000000..625bf5a1d452 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ManagedResourceGroupConfiguration.cs @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// Managed resource group configuration. + public partial class ManagedResourceGroupConfiguration + { + /// Initializes a new instance of ManagedResourceGroupConfiguration. + public ManagedResourceGroupConfiguration() + { + } + + /// Initializes a new instance of ManagedResourceGroupConfiguration. + /// Managed resource group name. + /// Managed resource group location. + internal ManagedResourceGroupConfiguration(string name, AzureLocation? location) + { + Name = name; + Location = location; + } + + /// Managed resource group name. + public string Name { get; set; } + /// Managed resource group location. + public AzureLocation? Location { get; set; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ManifestArtifactFormat.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ManifestArtifactFormat.Serialization.cs new file mode 100644 index 000000000000..80169399a63f --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ManifestArtifactFormat.Serialization.cs @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class ManifestArtifactFormat : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(ArtifactName)) + { + writer.WritePropertyName("artifactName"u8); + writer.WriteStringValue(ArtifactName); + } + if (Optional.IsDefined(ArtifactType)) + { + writer.WritePropertyName("artifactType"u8); + writer.WriteStringValue(ArtifactType.Value.ToString()); + } + if (Optional.IsDefined(ArtifactVersion)) + { + writer.WritePropertyName("artifactVersion"u8); + writer.WriteStringValue(ArtifactVersion); + } + writer.WriteEndObject(); + } + + internal static ManifestArtifactFormat DeserializeManifestArtifactFormat(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional artifactName = default; + Optional artifactType = default; + Optional artifactVersion = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("artifactName"u8)) + { + artifactName = property.Value.GetString(); + continue; + } + if (property.NameEquals("artifactType"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + artifactType = new ArtifactType(property.Value.GetString()); + continue; + } + if (property.NameEquals("artifactVersion"u8)) + { + artifactVersion = property.Value.GetString(); + continue; + } + } + return new ManifestArtifactFormat(artifactName.Value, Optional.ToNullable(artifactType), artifactVersion.Value); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ManifestArtifactFormat.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ManifestArtifactFormat.cs new file mode 100644 index 000000000000..1660df45e27f --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ManifestArtifactFormat.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// Manifest artifact properties. + public partial class ManifestArtifactFormat + { + /// Initializes a new instance of ManifestArtifactFormat. + public ManifestArtifactFormat() + { + } + + /// Initializes a new instance of ManifestArtifactFormat. + /// The artifact name. + /// The artifact type. + /// The artifact version. + internal ManifestArtifactFormat(string artifactName, ArtifactType? artifactType, string artifactVersion) + { + ArtifactName = artifactName; + ArtifactType = artifactType; + ArtifactVersion = artifactVersion; + } + + /// The artifact name. + public string ArtifactName { get; set; } + /// The artifact type. + public ArtifactType? ArtifactType { get; set; } + /// The artifact version. + public string ArtifactVersion { get; set; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/MappingRuleProfile.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/MappingRuleProfile.Serialization.cs new file mode 100644 index 000000000000..de095515aa7a --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/MappingRuleProfile.Serialization.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class MappingRuleProfile : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(ApplicationEnablement)) + { + writer.WritePropertyName("applicationEnablement"u8); + writer.WriteStringValue(ApplicationEnablement.Value.ToString()); + } + writer.WriteEndObject(); + } + + internal static MappingRuleProfile DeserializeMappingRuleProfile(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional applicationEnablement = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("applicationEnablement"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + applicationEnablement = new ApplicationEnablement(property.Value.GetString()); + continue; + } + } + return new MappingRuleProfile(Optional.ToNullable(applicationEnablement)); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/MappingRuleProfile.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/MappingRuleProfile.cs new file mode 100644 index 000000000000..098099457328 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/MappingRuleProfile.cs @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// Mapping rule profile properties. + public partial class MappingRuleProfile + { + /// Initializes a new instance of MappingRuleProfile. + public MappingRuleProfile() + { + } + + /// Initializes a new instance of MappingRuleProfile. + /// The application enablement. + internal MappingRuleProfile(ApplicationEnablement? applicationEnablement) + { + ApplicationEnablement = applicationEnablement; + } + + /// The application enablement. + public ApplicationEnablement? ApplicationEnablement { get; set; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NFVIs.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NFVIs.Serialization.cs new file mode 100644 index 000000000000..6fd40da43385 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NFVIs.Serialization.cs @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class NFVIs : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + writer.WritePropertyName("nfviType"u8); + writer.WriteStringValue(NfviType.ToString()); + writer.WriteEndObject(); + } + + internal static NFVIs DeserializeNFVIs(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + if (element.TryGetProperty("nfviType", out JsonElement discriminator)) + { + switch (discriminator.GetString()) + { + case "AzureArcKubernetes": return AzureArcK8SClusterNfviDetails.DeserializeAzureArcK8SClusterNfviDetails(element); + case "AzureCore": return AzureCoreNfviDetails.DeserializeAzureCoreNfviDetails(element); + case "AzureOperatorNexus": return AzureOperatorNexusClusterNfviDetails.DeserializeAzureOperatorNexusClusterNfviDetails(element); + } + } + return UnknownNFVIs.DeserializeUnknownNFVIs(element); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NFVIs.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NFVIs.cs new file mode 100644 index 000000000000..e0198644dec0 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NFVIs.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// + /// The NFVI object. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , and . + /// + public abstract partial class NFVIs + { + /// Initializes a new instance of NFVIs. + protected NFVIs() + { + } + + /// Initializes a new instance of NFVIs. + /// Name of the nfvi. + /// The NFVI type. + internal NFVIs(string name, NfviType nfviType) + { + Name = name; + NfviType = nfviType; + } + + /// Name of the nfvi. + public string Name { get; set; } + /// The NFVI type. + internal NfviType NfviType { get; set; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NSDArtifactProfile.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NSDArtifactProfile.Serialization.cs new file mode 100644 index 000000000000..e5c6e5617395 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NSDArtifactProfile.Serialization.cs @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Resources.Models; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class NSDArtifactProfile : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(ArtifactStoreReference)) + { + writer.WritePropertyName("artifactStoreReference"u8); + JsonSerializer.Serialize(writer, ArtifactStoreReference); + } + if (Optional.IsDefined(ArtifactName)) + { + writer.WritePropertyName("artifactName"u8); + writer.WriteStringValue(ArtifactName); + } + if (Optional.IsDefined(ArtifactVersion)) + { + writer.WritePropertyName("artifactVersion"u8); + writer.WriteStringValue(ArtifactVersion); + } + writer.WriteEndObject(); + } + + internal static NSDArtifactProfile DeserializeNSDArtifactProfile(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional artifactStoreReference = default; + Optional artifactName = default; + Optional artifactVersion = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("artifactStoreReference"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + artifactStoreReference = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (property.NameEquals("artifactName"u8)) + { + artifactName = property.Value.GetString(); + continue; + } + if (property.NameEquals("artifactVersion"u8)) + { + artifactVersion = property.Value.GetString(); + continue; + } + } + return new NSDArtifactProfile(artifactStoreReference, artifactName.Value, artifactVersion.Value); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NSDArtifactProfile.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NSDArtifactProfile.cs new file mode 100644 index 000000000000..b58202c8ca1e --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NSDArtifactProfile.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager.Resources.Models; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// Artifact profile properties. + public partial class NSDArtifactProfile + { + /// Initializes a new instance of NSDArtifactProfile. + public NSDArtifactProfile() + { + } + + /// Initializes a new instance of NSDArtifactProfile. + /// The artifact store resource id. + /// Artifact name. + /// Artifact version. + internal NSDArtifactProfile(WritableSubResource artifactStoreReference, string artifactName, string artifactVersion) + { + ArtifactStoreReference = artifactStoreReference; + ArtifactName = artifactName; + ArtifactVersion = artifactVersion; + } + + /// The artifact store resource id. + internal WritableSubResource ArtifactStoreReference { get; set; } + /// Gets or sets Id. + public ResourceIdentifier ArtifactStoreReferenceId + { + get => ArtifactStoreReference is null ? default : ArtifactStoreReference.Id; + set + { + if (ArtifactStoreReference is null) + ArtifactStoreReference = new WritableSubResource(); + ArtifactStoreReference.Id = value; + } + } + + /// Artifact name. + public string ArtifactName { get; set; } + /// Artifact version. + public string ArtifactVersion { get; set; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkFunctionApplication.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkFunctionApplication.Serialization.cs new file mode 100644 index 000000000000..31dd5fe608c1 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkFunctionApplication.Serialization.cs @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class NetworkFunctionApplication : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (Optional.IsDefined(DependsOnProfile)) + { + writer.WritePropertyName("dependsOnProfile"u8); + writer.WriteObjectValue(DependsOnProfile); + } + writer.WriteEndObject(); + } + + internal static NetworkFunctionApplication DeserializeNetworkFunctionApplication(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional name = default; + Optional dependsOnProfile = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("dependsOnProfile"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + dependsOnProfile = DependsOnProfile.DeserializeDependsOnProfile(property.Value); + continue; + } + } + return new NetworkFunctionApplication(name.Value, dependsOnProfile.Value); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkFunctionApplication.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkFunctionApplication.cs new file mode 100644 index 000000000000..160719e4b617 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkFunctionApplication.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// Network function application definition. + public partial class NetworkFunctionApplication + { + /// Initializes a new instance of NetworkFunctionApplication. + public NetworkFunctionApplication() + { + } + + /// Initializes a new instance of NetworkFunctionApplication. + /// The name of the network function application. + /// Depends on profile definition. + internal NetworkFunctionApplication(string name, DependsOnProfile dependsOnProfile) + { + Name = name; + DependsOnProfile = dependsOnProfile; + } + + /// The name of the network function application. + public string Name { get; set; } + /// Depends on profile definition. + public DependsOnProfile DependsOnProfile { get; set; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkFunctionConfigurationType.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkFunctionConfigurationType.cs new file mode 100644 index 000000000000..153f22f75b77 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkFunctionConfigurationType.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.HybridNetwork.Models +{ + /// The secret type which indicates if secret or not. + internal readonly partial struct NetworkFunctionConfigurationType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public NetworkFunctionConfigurationType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string UnknownValue = "Unknown"; + private const string SecretValue = "Secret"; + private const string OpenValue = "Open"; + + /// Unknown. + public static NetworkFunctionConfigurationType Unknown { get; } = new NetworkFunctionConfigurationType(UnknownValue); + /// Secret. + public static NetworkFunctionConfigurationType Secret { get; } = new NetworkFunctionConfigurationType(SecretValue); + /// Open. + public static NetworkFunctionConfigurationType Open { get; } = new NetworkFunctionConfigurationType(OpenValue); + /// Determines if two values are the same. + public static bool operator ==(NetworkFunctionConfigurationType left, NetworkFunctionConfigurationType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(NetworkFunctionConfigurationType left, NetworkFunctionConfigurationType right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator NetworkFunctionConfigurationType(string value) => new NetworkFunctionConfigurationType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is NetworkFunctionConfigurationType other && Equals(other); + /// + public bool Equals(NetworkFunctionConfigurationType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkFunctionData.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkFunctionData.Serialization.cs new file mode 100644 index 000000000000..f5eb0c7f9ead --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkFunctionData.Serialization.cs @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure; +using Azure.Core; +using Azure.ResourceManager.HybridNetwork.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.HybridNetwork +{ + public partial class NetworkFunctionData : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties); + } + if (Optional.IsDefined(ETag)) + { + writer.WritePropertyName("etag"u8); + writer.WriteStringValue(ETag.Value.ToString()); + } + if (Optional.IsDefined(Identity)) + { + writer.WritePropertyName("identity"u8); + var serializeOptions = new JsonSerializerOptions { Converters = { new ManagedServiceIdentityTypeV3Converter() } }; + JsonSerializer.Serialize(writer, Identity, serializeOptions); + } + 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(); + } + writer.WritePropertyName("location"u8); + writer.WriteStringValue(Location); + writer.WriteEndObject(); + } + + internal static NetworkFunctionData DeserializeNetworkFunctionData(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional properties = default; + Optional etag = default; + Optional identity = default; + Optional> tags = default; + AzureLocation location = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + Optional systemData = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = NetworkFunctionPropertiesFormat.DeserializeNetworkFunctionPropertiesFormat(property.Value); + continue; + } + if (property.NameEquals("etag"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + etag = new ETag(property.Value.GetString()); + continue; + } + if (property.NameEquals("identity"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + var serializeOptions = new JsonSerializerOptions { Converters = { new ManagedServiceIdentityTypeV3Converter() } }; + identity = JsonSerializer.Deserialize(property.Value.GetRawText(), serializeOptions); + 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; + } + } + return new NetworkFunctionData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, properties.Value, Optional.ToNullable(etag), identity); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkFunctionDefinitionGroupData.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkFunctionDefinitionGroupData.Serialization.cs new file mode 100644 index 000000000000..594115ab9e8c --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkFunctionDefinitionGroupData.Serialization.cs @@ -0,0 +1,113 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.HybridNetwork.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.HybridNetwork +{ + public partial class NetworkFunctionDefinitionGroupData : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties); + } + 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(); + } + writer.WritePropertyName("location"u8); + writer.WriteStringValue(Location); + writer.WriteEndObject(); + } + + internal static NetworkFunctionDefinitionGroupData DeserializeNetworkFunctionDefinitionGroupData(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional properties = default; + Optional> tags = default; + AzureLocation location = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + Optional systemData = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = NetworkFunctionDefinitionGroupPropertiesFormat.DeserializeNetworkFunctionDefinitionGroupPropertiesFormat(property.Value); + 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; + } + } + return new NetworkFunctionDefinitionGroupData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, properties.Value); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkFunctionDefinitionGroupListResult.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkFunctionDefinitionGroupListResult.Serialization.cs new file mode 100644 index 000000000000..419e09dc029f --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkFunctionDefinitionGroupListResult.Serialization.cs @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.HybridNetwork; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + internal partial class NetworkFunctionDefinitionGroupListResult + { + internal static NetworkFunctionDefinitionGroupListResult DeserializeNetworkFunctionDefinitionGroupListResult(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> value = default; + Optional nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(NetworkFunctionDefinitionGroupData.DeserializeNetworkFunctionDefinitionGroupData(item)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + } + return new NetworkFunctionDefinitionGroupListResult(Optional.ToList(value), nextLink.Value); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkFunctionDefinitionGroupListResult.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkFunctionDefinitionGroupListResult.cs new file mode 100644 index 000000000000..33a67d2605e1 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkFunctionDefinitionGroupListResult.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.HybridNetwork; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// A list of network function definition group resources. + internal partial class NetworkFunctionDefinitionGroupListResult + { + /// Initializes a new instance of NetworkFunctionDefinitionGroupListResult. + internal NetworkFunctionDefinitionGroupListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of NetworkFunctionDefinitionGroupListResult. + /// A list of network function definition group. + /// The URL to get the next set of results. + internal NetworkFunctionDefinitionGroupListResult(IReadOnlyList value, string nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// A list of network function definition group. + public IReadOnlyList Value { get; } + /// The URL to get the next set of results. + public string NextLink { get; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkFunctionDefinitionGroupPropertiesFormat.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkFunctionDefinitionGroupPropertiesFormat.Serialization.cs new file mode 100644 index 000000000000..6bda3eb90d53 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkFunctionDefinitionGroupPropertiesFormat.Serialization.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class NetworkFunctionDefinitionGroupPropertiesFormat : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Description)) + { + writer.WritePropertyName("description"u8); + writer.WriteStringValue(Description); + } + writer.WriteEndObject(); + } + + internal static NetworkFunctionDefinitionGroupPropertiesFormat DeserializeNetworkFunctionDefinitionGroupPropertiesFormat(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional provisioningState = default; + Optional description = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("provisioningState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new ProvisioningState(property.Value.GetString()); + continue; + } + if (property.NameEquals("description"u8)) + { + description = property.Value.GetString(); + continue; + } + } + return new NetworkFunctionDefinitionGroupPropertiesFormat(Optional.ToNullable(provisioningState), description.Value); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkFunctionDefinitionGroupPropertiesFormat.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkFunctionDefinitionGroupPropertiesFormat.cs new file mode 100644 index 000000000000..74eb4756f021 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkFunctionDefinitionGroupPropertiesFormat.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// Network function definition group properties. + public partial class NetworkFunctionDefinitionGroupPropertiesFormat + { + /// Initializes a new instance of NetworkFunctionDefinitionGroupPropertiesFormat. + public NetworkFunctionDefinitionGroupPropertiesFormat() + { + } + + /// Initializes a new instance of NetworkFunctionDefinitionGroupPropertiesFormat. + /// The provisioning state of the network function definition groups resource. + /// The network function definition group description. + internal NetworkFunctionDefinitionGroupPropertiesFormat(ProvisioningState? provisioningState, string description) + { + ProvisioningState = provisioningState; + Description = description; + } + + /// The provisioning state of the network function definition groups resource. + public ProvisioningState? ProvisioningState { get; } + /// The network function definition group description. + public string Description { get; set; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkFunctionDefinitionResourceElementTemplateDetails.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkFunctionDefinitionResourceElementTemplateDetails.Serialization.cs new file mode 100644 index 000000000000..eaa5624b1532 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkFunctionDefinitionResourceElementTemplateDetails.Serialization.cs @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class NetworkFunctionDefinitionResourceElementTemplateDetails : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Configuration)) + { + writer.WritePropertyName("configuration"u8); + writer.WriteObjectValue(Configuration); + } + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + writer.WritePropertyName("type"u8); + writer.WriteStringValue(ResourceElementType.ToString()); + if (Optional.IsDefined(DependsOnProfile)) + { + writer.WritePropertyName("dependsOnProfile"u8); + writer.WriteObjectValue(DependsOnProfile); + } + writer.WriteEndObject(); + } + + internal static NetworkFunctionDefinitionResourceElementTemplateDetails DeserializeNetworkFunctionDefinitionResourceElementTemplateDetails(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional configuration = default; + Optional name = default; + Type type = default; + Optional dependsOnProfile = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("configuration"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + configuration = ArmResourceDefinitionResourceElementTemplate.DeserializeArmResourceDefinitionResourceElementTemplate(property.Value); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new Type(property.Value.GetString()); + continue; + } + if (property.NameEquals("dependsOnProfile"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + dependsOnProfile = DependsOnProfile.DeserializeDependsOnProfile(property.Value); + continue; + } + } + return new NetworkFunctionDefinitionResourceElementTemplateDetails(name.Value, type, dependsOnProfile.Value, configuration.Value); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkFunctionDefinitionResourceElementTemplateDetails.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkFunctionDefinitionResourceElementTemplateDetails.cs new file mode 100644 index 000000000000..a26a6d740fbc --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkFunctionDefinitionResourceElementTemplateDetails.cs @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// The network function definition resource element template details. + public partial class NetworkFunctionDefinitionResourceElementTemplateDetails : ResourceElementTemplate + { + /// Initializes a new instance of NetworkFunctionDefinitionResourceElementTemplateDetails. + public NetworkFunctionDefinitionResourceElementTemplateDetails() + { + ResourceElementType = Type.NetworkFunctionDefinition; + } + + /// Initializes a new instance of NetworkFunctionDefinitionResourceElementTemplateDetails. + /// Name of the resource element template. + /// The resource element template type. + /// The depends on profile. + /// The resource element template type. + internal NetworkFunctionDefinitionResourceElementTemplateDetails(string name, Type resourceElementType, DependsOnProfile dependsOnProfile, ArmResourceDefinitionResourceElementTemplate configuration) : base(name, resourceElementType, dependsOnProfile) + { + Configuration = configuration; + ResourceElementType = resourceElementType; + } + + /// The resource element template type. + public ArmResourceDefinitionResourceElementTemplate Configuration { get; set; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkFunctionDefinitionVersionData.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkFunctionDefinitionVersionData.Serialization.cs new file mode 100644 index 000000000000..9bb8c856d376 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkFunctionDefinitionVersionData.Serialization.cs @@ -0,0 +1,113 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.HybridNetwork.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.HybridNetwork +{ + public partial class NetworkFunctionDefinitionVersionData : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties); + } + 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(); + } + writer.WritePropertyName("location"u8); + writer.WriteStringValue(Location); + writer.WriteEndObject(); + } + + internal static NetworkFunctionDefinitionVersionData DeserializeNetworkFunctionDefinitionVersionData(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional properties = default; + Optional> tags = default; + AzureLocation location = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + Optional systemData = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = NetworkFunctionDefinitionVersionPropertiesFormat.DeserializeNetworkFunctionDefinitionVersionPropertiesFormat(property.Value); + 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; + } + } + return new NetworkFunctionDefinitionVersionData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, properties.Value); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkFunctionDefinitionVersionListResult.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkFunctionDefinitionVersionListResult.Serialization.cs new file mode 100644 index 000000000000..8cc0f92ee8a7 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkFunctionDefinitionVersionListResult.Serialization.cs @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.HybridNetwork; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + internal partial class NetworkFunctionDefinitionVersionListResult + { + internal static NetworkFunctionDefinitionVersionListResult DeserializeNetworkFunctionDefinitionVersionListResult(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> value = default; + Optional nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(NetworkFunctionDefinitionVersionData.DeserializeNetworkFunctionDefinitionVersionData(item)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + } + return new NetworkFunctionDefinitionVersionListResult(Optional.ToList(value), nextLink.Value); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkFunctionDefinitionVersionListResult.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkFunctionDefinitionVersionListResult.cs new file mode 100644 index 000000000000..10679f87e7dc --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkFunctionDefinitionVersionListResult.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.HybridNetwork; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// A list of network function definition versions. + internal partial class NetworkFunctionDefinitionVersionListResult + { + /// Initializes a new instance of NetworkFunctionDefinitionVersionListResult. + internal NetworkFunctionDefinitionVersionListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of NetworkFunctionDefinitionVersionListResult. + /// A list of network function definition versions. + /// The URI to get the next set of results. + internal NetworkFunctionDefinitionVersionListResult(IReadOnlyList value, string nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// A list of network function definition versions. + public IReadOnlyList Value { get; } + /// The URI to get the next set of results. + public string NextLink { get; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkFunctionDefinitionVersionPropertiesFormat.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkFunctionDefinitionVersionPropertiesFormat.Serialization.cs new file mode 100644 index 000000000000..8fe6e75e2a8d --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkFunctionDefinitionVersionPropertiesFormat.Serialization.cs @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class NetworkFunctionDefinitionVersionPropertiesFormat : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Description)) + { + writer.WritePropertyName("description"u8); + writer.WriteStringValue(Description); + } + if (Optional.IsDefined(DeployParameters)) + { + writer.WritePropertyName("deployParameters"u8); + writer.WriteStringValue(DeployParameters); + } + writer.WritePropertyName("networkFunctionType"u8); + writer.WriteStringValue(NetworkFunctionType.ToString()); + writer.WriteEndObject(); + } + + internal static NetworkFunctionDefinitionVersionPropertiesFormat DeserializeNetworkFunctionDefinitionVersionPropertiesFormat(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + if (element.TryGetProperty("networkFunctionType", out JsonElement discriminator)) + { + switch (discriminator.GetString()) + { + case "ContainerizedNetworkFunction": return ContainerizedNetworkFunctionDefinitionVersion.DeserializeContainerizedNetworkFunctionDefinitionVersion(element); + case "VirtualNetworkFunction": return VirtualNetworkFunctionDefinitionVersion.DeserializeVirtualNetworkFunctionDefinitionVersion(element); + } + } + return UnknownNetworkFunctionDefinitionVersionPropertiesFormat.DeserializeUnknownNetworkFunctionDefinitionVersionPropertiesFormat(element); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkFunctionDefinitionVersionPropertiesFormat.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkFunctionDefinitionVersionPropertiesFormat.cs new file mode 100644 index 000000000000..1c8faadbb141 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkFunctionDefinitionVersionPropertiesFormat.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// + /// Network function definition version properties. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include and . + /// + public abstract partial class NetworkFunctionDefinitionVersionPropertiesFormat + { + /// Initializes a new instance of NetworkFunctionDefinitionVersionPropertiesFormat. + protected NetworkFunctionDefinitionVersionPropertiesFormat() + { + } + + /// Initializes a new instance of NetworkFunctionDefinitionVersionPropertiesFormat. + /// The provisioning state of the network function definition version resource. + /// The network function definition version state. + /// The network function definition version description. + /// The deployment parameters of the network function definition version. + /// The network function type. + internal NetworkFunctionDefinitionVersionPropertiesFormat(ProvisioningState? provisioningState, VersionState? versionState, string description, string deployParameters, NetworkFunctionType networkFunctionType) + { + ProvisioningState = provisioningState; + VersionState = versionState; + Description = description; + DeployParameters = deployParameters; + NetworkFunctionType = networkFunctionType; + } + + /// The provisioning state of the network function definition version resource. + public ProvisioningState? ProvisioningState { get; } + /// The network function definition version state. + public VersionState? VersionState { get; } + /// The network function definition version description. + public string Description { get; set; } + /// The deployment parameters of the network function definition version. + public string DeployParameters { get; set; } + /// The network function type. + internal NetworkFunctionType NetworkFunctionType { get; set; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkFunctionDefinitionVersionUpdateState.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkFunctionDefinitionVersionUpdateState.Serialization.cs new file mode 100644 index 000000000000..f564748fa441 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkFunctionDefinitionVersionUpdateState.Serialization.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class NetworkFunctionDefinitionVersionUpdateState : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(VersionState)) + { + writer.WritePropertyName("versionState"u8); + writer.WriteStringValue(VersionState.Value.ToString()); + } + writer.WriteEndObject(); + } + + internal static NetworkFunctionDefinitionVersionUpdateState DeserializeNetworkFunctionDefinitionVersionUpdateState(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional versionState = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("versionState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + versionState = new VersionState(property.Value.GetString()); + continue; + } + } + return new NetworkFunctionDefinitionVersionUpdateState(Optional.ToNullable(versionState)); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkFunctionDefinitionVersionUpdateState.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkFunctionDefinitionVersionUpdateState.cs new file mode 100644 index 000000000000..c57987d178ea --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkFunctionDefinitionVersionUpdateState.cs @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// Publisher network function definition version update request definition. + public partial class NetworkFunctionDefinitionVersionUpdateState + { + /// Initializes a new instance of NetworkFunctionDefinitionVersionUpdateState. + public NetworkFunctionDefinitionVersionUpdateState() + { + } + + /// Initializes a new instance of NetworkFunctionDefinitionVersionUpdateState. + /// The network function definition version state. Only the 'Active' and 'Deprecated' states are allowed for updates. Other states are used for internal state transitioning. + internal NetworkFunctionDefinitionVersionUpdateState(VersionState? versionState) + { + VersionState = versionState; + } + + /// The network function definition version state. Only the 'Active' and 'Deprecated' states are allowed for updates. Other states are used for internal state transitioning. + public VersionState? VersionState { get; set; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkFunctionListResult.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkFunctionListResult.Serialization.cs new file mode 100644 index 000000000000..cd9a68e50fe2 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkFunctionListResult.Serialization.cs @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.HybridNetwork; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + internal partial class NetworkFunctionListResult + { + internal static NetworkFunctionListResult DeserializeNetworkFunctionListResult(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> value = default; + Optional nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(NetworkFunctionData.DeserializeNetworkFunctionData(item)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + } + return new NetworkFunctionListResult(Optional.ToList(value), nextLink.Value); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkFunctionListResult.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkFunctionListResult.cs new file mode 100644 index 000000000000..454a35d893d7 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkFunctionListResult.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.HybridNetwork; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// Response for network function API service call. + internal partial class NetworkFunctionListResult + { + /// Initializes a new instance of NetworkFunctionListResult. + internal NetworkFunctionListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of NetworkFunctionListResult. + /// A list of network function resources in a subscription or resource group. + /// The URL to get the next set of results. + internal NetworkFunctionListResult(IReadOnlyList value, string nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// A list of network function resources in a subscription or resource group. + public IReadOnlyList Value { get; } + /// The URL to get the next set of results. + public string NextLink { get; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkFunctionPropertiesFormat.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkFunctionPropertiesFormat.Serialization.cs new file mode 100644 index 000000000000..c1330298d410 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkFunctionPropertiesFormat.Serialization.cs @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class NetworkFunctionPropertiesFormat : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(NetworkFunctionDefinitionVersionResourceReference)) + { + writer.WritePropertyName("networkFunctionDefinitionVersionResourceReference"u8); + writer.WriteObjectValue(NetworkFunctionDefinitionVersionResourceReference); + } + if (Optional.IsDefined(NfviType)) + { + writer.WritePropertyName("nfviType"u8); + writer.WriteStringValue(NfviType.Value.ToString()); + } + if (Optional.IsDefined(NfviId)) + { + writer.WritePropertyName("nfviId"u8); + writer.WriteStringValue(NfviId); + } + if (Optional.IsDefined(AllowSoftwareUpdate)) + { + writer.WritePropertyName("allowSoftwareUpdate"u8); + writer.WriteBooleanValue(AllowSoftwareUpdate.Value); + } + writer.WritePropertyName("configurationType"u8); + writer.WriteStringValue(ConfigurationType.ToString()); + if (Optional.IsCollectionDefined(RoleOverrideValues)) + { + writer.WritePropertyName("roleOverrideValues"u8); + writer.WriteStartArray(); + foreach (var item in RoleOverrideValues) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + writer.WriteEndObject(); + } + + internal static NetworkFunctionPropertiesFormat DeserializeNetworkFunctionPropertiesFormat(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + if (element.TryGetProperty("configurationType", out JsonElement discriminator)) + { + switch (discriminator.GetString()) + { + case "Open": return NetworkFunctionValueWithoutSecrets.DeserializeNetworkFunctionValueWithoutSecrets(element); + case "Secret": return NetworkFunctionValueWithSecrets.DeserializeNetworkFunctionValueWithSecrets(element); + } + } + return UnknownNetworkFunctionPropertiesFormat.DeserializeUnknownNetworkFunctionPropertiesFormat(element); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkFunctionPropertiesFormat.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkFunctionPropertiesFormat.cs new file mode 100644 index 000000000000..9173e0acad67 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkFunctionPropertiesFormat.cs @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// + /// Network function properties. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include and . + /// + public abstract partial class NetworkFunctionPropertiesFormat + { + /// Initializes a new instance of NetworkFunctionPropertiesFormat. + protected NetworkFunctionPropertiesFormat() + { + RoleOverrideValues = new ChangeTrackingList(); + } + + /// Initializes a new instance of NetworkFunctionPropertiesFormat. + /// The provisioning state of the network function resource. + /// The publisher name for the network function. + /// The scope of the publisher. + /// The network function definition group name for the network function. + /// The network function definition version for the network function. + /// The location of the network function definition offering. + /// + /// The network function definition version resource reference. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include and . + /// + /// The nfvi type for the network function. + /// The nfviId for the network function. + /// Indicates if software updates are allowed during deployment. + /// The value which indicates if NF values are secrets. + /// The role configuration override values from the user. + internal NetworkFunctionPropertiesFormat(ProvisioningState? provisioningState, string publisherName, PublisherScope? publisherScope, string networkFunctionDefinitionGroupName, string networkFunctionDefinitionVersion, string networkFunctionDefinitionOfferingLocation, DeploymentResourceIdReference networkFunctionDefinitionVersionResourceReference, NfviType? nfviType, ResourceIdentifier nfviId, bool? allowSoftwareUpdate, NetworkFunctionConfigurationType configurationType, IList roleOverrideValues) + { + ProvisioningState = provisioningState; + PublisherName = publisherName; + PublisherScope = publisherScope; + NetworkFunctionDefinitionGroupName = networkFunctionDefinitionGroupName; + NetworkFunctionDefinitionVersion = networkFunctionDefinitionVersion; + NetworkFunctionDefinitionOfferingLocation = networkFunctionDefinitionOfferingLocation; + NetworkFunctionDefinitionVersionResourceReference = networkFunctionDefinitionVersionResourceReference; + NfviType = nfviType; + NfviId = nfviId; + AllowSoftwareUpdate = allowSoftwareUpdate; + ConfigurationType = configurationType; + RoleOverrideValues = roleOverrideValues; + } + + /// The provisioning state of the network function resource. + public ProvisioningState? ProvisioningState { get; } + /// The publisher name for the network function. + public string PublisherName { get; } + /// The scope of the publisher. + public PublisherScope? PublisherScope { get; } + /// The network function definition group name for the network function. + public string NetworkFunctionDefinitionGroupName { get; } + /// The network function definition version for the network function. + public string NetworkFunctionDefinitionVersion { get; } + /// The location of the network function definition offering. + public string NetworkFunctionDefinitionOfferingLocation { get; } + /// + /// The network function definition version resource reference. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include and . + /// + public DeploymentResourceIdReference NetworkFunctionDefinitionVersionResourceReference { get; set; } + /// The nfvi type for the network function. + public NfviType? NfviType { get; set; } + /// The nfviId for the network function. + public ResourceIdentifier NfviId { get; set; } + /// Indicates if software updates are allowed during deployment. + public bool? AllowSoftwareUpdate { get; set; } + /// The value which indicates if NF values are secrets. + internal NetworkFunctionConfigurationType ConfigurationType { get; set; } + /// The role configuration override values from the user. + public IList RoleOverrideValues { get; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkFunctionType.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkFunctionType.cs new file mode 100644 index 000000000000..896585ee058e --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkFunctionType.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.HybridNetwork.Models +{ + /// The network function type. + internal readonly partial struct NetworkFunctionType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public NetworkFunctionType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string UnknownValue = "Unknown"; + private const string VirtualNetworkFunctionValue = "VirtualNetworkFunction"; + private const string ContainerizedNetworkFunctionValue = "ContainerizedNetworkFunction"; + + /// Unknown. + public static NetworkFunctionType Unknown { get; } = new NetworkFunctionType(UnknownValue); + /// VirtualNetworkFunction. + public static NetworkFunctionType VirtualNetworkFunction { get; } = new NetworkFunctionType(VirtualNetworkFunctionValue); + /// ContainerizedNetworkFunction. + public static NetworkFunctionType ContainerizedNetworkFunction { get; } = new NetworkFunctionType(ContainerizedNetworkFunctionValue); + /// Determines if two values are the same. + public static bool operator ==(NetworkFunctionType left, NetworkFunctionType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(NetworkFunctionType left, NetworkFunctionType right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator NetworkFunctionType(string value) => new NetworkFunctionType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is NetworkFunctionType other && Equals(other); + /// + public bool Equals(NetworkFunctionType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkFunctionValueWithSecrets.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkFunctionValueWithSecrets.Serialization.cs new file mode 100644 index 000000000000..ef969d1b9d5d --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkFunctionValueWithSecrets.Serialization.cs @@ -0,0 +1,182 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class NetworkFunctionValueWithSecrets : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(SecretDeploymentValues)) + { + writer.WritePropertyName("secretDeploymentValues"u8); + writer.WriteStringValue(SecretDeploymentValues); + } + if (Optional.IsDefined(NetworkFunctionDefinitionVersionResourceReference)) + { + writer.WritePropertyName("networkFunctionDefinitionVersionResourceReference"u8); + writer.WriteObjectValue(NetworkFunctionDefinitionVersionResourceReference); + } + if (Optional.IsDefined(NfviType)) + { + writer.WritePropertyName("nfviType"u8); + writer.WriteStringValue(NfviType.Value.ToString()); + } + if (Optional.IsDefined(NfviId)) + { + writer.WritePropertyName("nfviId"u8); + writer.WriteStringValue(NfviId); + } + if (Optional.IsDefined(AllowSoftwareUpdate)) + { + writer.WritePropertyName("allowSoftwareUpdate"u8); + writer.WriteBooleanValue(AllowSoftwareUpdate.Value); + } + writer.WritePropertyName("configurationType"u8); + writer.WriteStringValue(ConfigurationType.ToString()); + if (Optional.IsCollectionDefined(RoleOverrideValues)) + { + writer.WritePropertyName("roleOverrideValues"u8); + writer.WriteStartArray(); + foreach (var item in RoleOverrideValues) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + writer.WriteEndObject(); + } + + internal static NetworkFunctionValueWithSecrets DeserializeNetworkFunctionValueWithSecrets(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional secretDeploymentValues = default; + Optional provisioningState = default; + Optional publisherName = default; + Optional publisherScope = default; + Optional networkFunctionDefinitionGroupName = default; + Optional networkFunctionDefinitionVersion = default; + Optional networkFunctionDefinitionOfferingLocation = default; + Optional networkFunctionDefinitionVersionResourceReference = default; + Optional nfviType = default; + Optional nfviId = default; + Optional allowSoftwareUpdate = default; + NetworkFunctionConfigurationType configurationType = default; + Optional> roleOverrideValues = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("secretDeploymentValues"u8)) + { + secretDeploymentValues = property.Value.GetString(); + continue; + } + if (property.NameEquals("provisioningState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new ProvisioningState(property.Value.GetString()); + continue; + } + if (property.NameEquals("publisherName"u8)) + { + publisherName = property.Value.GetString(); + continue; + } + if (property.NameEquals("publisherScope"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + publisherScope = new PublisherScope(property.Value.GetString()); + continue; + } + if (property.NameEquals("networkFunctionDefinitionGroupName"u8)) + { + networkFunctionDefinitionGroupName = property.Value.GetString(); + continue; + } + if (property.NameEquals("networkFunctionDefinitionVersion"u8)) + { + networkFunctionDefinitionVersion = property.Value.GetString(); + continue; + } + if (property.NameEquals("networkFunctionDefinitionOfferingLocation"u8)) + { + networkFunctionDefinitionOfferingLocation = property.Value.GetString(); + continue; + } + if (property.NameEquals("networkFunctionDefinitionVersionResourceReference"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + networkFunctionDefinitionVersionResourceReference = DeploymentResourceIdReference.DeserializeDeploymentResourceIdReference(property.Value); + continue; + } + if (property.NameEquals("nfviType"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nfviType = new NfviType(property.Value.GetString()); + continue; + } + if (property.NameEquals("nfviId"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nfviId = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("allowSoftwareUpdate"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + allowSoftwareUpdate = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("configurationType"u8)) + { + configurationType = new NetworkFunctionConfigurationType(property.Value.GetString()); + continue; + } + if (property.NameEquals("roleOverrideValues"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + roleOverrideValues = array; + continue; + } + } + return new NetworkFunctionValueWithSecrets(Optional.ToNullable(provisioningState), publisherName.Value, Optional.ToNullable(publisherScope), networkFunctionDefinitionGroupName.Value, networkFunctionDefinitionVersion.Value, networkFunctionDefinitionOfferingLocation.Value, networkFunctionDefinitionVersionResourceReference.Value, Optional.ToNullable(nfviType), nfviId.Value, Optional.ToNullable(allowSoftwareUpdate), configurationType, Optional.ToList(roleOverrideValues), secretDeploymentValues.Value); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkFunctionValueWithSecrets.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkFunctionValueWithSecrets.cs new file mode 100644 index 000000000000..be0d175ac944 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkFunctionValueWithSecrets.cs @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// NetworkFunction with secrets. + public partial class NetworkFunctionValueWithSecrets : NetworkFunctionPropertiesFormat + { + /// Initializes a new instance of NetworkFunctionValueWithSecrets. + public NetworkFunctionValueWithSecrets() + { + ConfigurationType = NetworkFunctionConfigurationType.Secret; + } + + /// Initializes a new instance of NetworkFunctionValueWithSecrets. + /// The provisioning state of the network function resource. + /// The publisher name for the network function. + /// The scope of the publisher. + /// The network function definition group name for the network function. + /// The network function definition version for the network function. + /// The location of the network function definition offering. + /// + /// The network function definition version resource reference. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include and . + /// + /// The nfvi type for the network function. + /// The nfviId for the network function. + /// Indicates if software updates are allowed during deployment. + /// The value which indicates if NF values are secrets. + /// The role configuration override values from the user. + /// The JSON-serialized secret deployment values from the user. This contains secrets like passwords,keys etc. + internal NetworkFunctionValueWithSecrets(ProvisioningState? provisioningState, string publisherName, PublisherScope? publisherScope, string networkFunctionDefinitionGroupName, string networkFunctionDefinitionVersion, string networkFunctionDefinitionOfferingLocation, DeploymentResourceIdReference networkFunctionDefinitionVersionResourceReference, NfviType? nfviType, ResourceIdentifier nfviId, bool? allowSoftwareUpdate, NetworkFunctionConfigurationType configurationType, IList roleOverrideValues, string secretDeploymentValues) : base(provisioningState, publisherName, publisherScope, networkFunctionDefinitionGroupName, networkFunctionDefinitionVersion, networkFunctionDefinitionOfferingLocation, networkFunctionDefinitionVersionResourceReference, nfviType, nfviId, allowSoftwareUpdate, configurationType, roleOverrideValues) + { + SecretDeploymentValues = secretDeploymentValues; + ConfigurationType = configurationType; + } + + /// The JSON-serialized secret deployment values from the user. This contains secrets like passwords,keys etc. + public string SecretDeploymentValues { get; set; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkFunctionValueWithoutSecrets.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkFunctionValueWithoutSecrets.Serialization.cs new file mode 100644 index 000000000000..e9802d70b20c --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkFunctionValueWithoutSecrets.Serialization.cs @@ -0,0 +1,182 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class NetworkFunctionValueWithoutSecrets : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(DeploymentValues)) + { + writer.WritePropertyName("deploymentValues"u8); + writer.WriteStringValue(DeploymentValues); + } + if (Optional.IsDefined(NetworkFunctionDefinitionVersionResourceReference)) + { + writer.WritePropertyName("networkFunctionDefinitionVersionResourceReference"u8); + writer.WriteObjectValue(NetworkFunctionDefinitionVersionResourceReference); + } + if (Optional.IsDefined(NfviType)) + { + writer.WritePropertyName("nfviType"u8); + writer.WriteStringValue(NfviType.Value.ToString()); + } + if (Optional.IsDefined(NfviId)) + { + writer.WritePropertyName("nfviId"u8); + writer.WriteStringValue(NfviId); + } + if (Optional.IsDefined(AllowSoftwareUpdate)) + { + writer.WritePropertyName("allowSoftwareUpdate"u8); + writer.WriteBooleanValue(AllowSoftwareUpdate.Value); + } + writer.WritePropertyName("configurationType"u8); + writer.WriteStringValue(ConfigurationType.ToString()); + if (Optional.IsCollectionDefined(RoleOverrideValues)) + { + writer.WritePropertyName("roleOverrideValues"u8); + writer.WriteStartArray(); + foreach (var item in RoleOverrideValues) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + writer.WriteEndObject(); + } + + internal static NetworkFunctionValueWithoutSecrets DeserializeNetworkFunctionValueWithoutSecrets(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional deploymentValues = default; + Optional provisioningState = default; + Optional publisherName = default; + Optional publisherScope = default; + Optional networkFunctionDefinitionGroupName = default; + Optional networkFunctionDefinitionVersion = default; + Optional networkFunctionDefinitionOfferingLocation = default; + Optional networkFunctionDefinitionVersionResourceReference = default; + Optional nfviType = default; + Optional nfviId = default; + Optional allowSoftwareUpdate = default; + NetworkFunctionConfigurationType configurationType = default; + Optional> roleOverrideValues = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("deploymentValues"u8)) + { + deploymentValues = property.Value.GetString(); + continue; + } + if (property.NameEquals("provisioningState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new ProvisioningState(property.Value.GetString()); + continue; + } + if (property.NameEquals("publisherName"u8)) + { + publisherName = property.Value.GetString(); + continue; + } + if (property.NameEquals("publisherScope"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + publisherScope = new PublisherScope(property.Value.GetString()); + continue; + } + if (property.NameEquals("networkFunctionDefinitionGroupName"u8)) + { + networkFunctionDefinitionGroupName = property.Value.GetString(); + continue; + } + if (property.NameEquals("networkFunctionDefinitionVersion"u8)) + { + networkFunctionDefinitionVersion = property.Value.GetString(); + continue; + } + if (property.NameEquals("networkFunctionDefinitionOfferingLocation"u8)) + { + networkFunctionDefinitionOfferingLocation = property.Value.GetString(); + continue; + } + if (property.NameEquals("networkFunctionDefinitionVersionResourceReference"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + networkFunctionDefinitionVersionResourceReference = DeploymentResourceIdReference.DeserializeDeploymentResourceIdReference(property.Value); + continue; + } + if (property.NameEquals("nfviType"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nfviType = new NfviType(property.Value.GetString()); + continue; + } + if (property.NameEquals("nfviId"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nfviId = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("allowSoftwareUpdate"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + allowSoftwareUpdate = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("configurationType"u8)) + { + configurationType = new NetworkFunctionConfigurationType(property.Value.GetString()); + continue; + } + if (property.NameEquals("roleOverrideValues"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + roleOverrideValues = array; + continue; + } + } + return new NetworkFunctionValueWithoutSecrets(Optional.ToNullable(provisioningState), publisherName.Value, Optional.ToNullable(publisherScope), networkFunctionDefinitionGroupName.Value, networkFunctionDefinitionVersion.Value, networkFunctionDefinitionOfferingLocation.Value, networkFunctionDefinitionVersionResourceReference.Value, Optional.ToNullable(nfviType), nfviId.Value, Optional.ToNullable(allowSoftwareUpdate), configurationType, Optional.ToList(roleOverrideValues), deploymentValues.Value); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkFunctionValueWithoutSecrets.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkFunctionValueWithoutSecrets.cs new file mode 100644 index 000000000000..e507614c18a2 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkFunctionValueWithoutSecrets.cs @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// NetworkFunction with no secrets. + public partial class NetworkFunctionValueWithoutSecrets : NetworkFunctionPropertiesFormat + { + /// Initializes a new instance of NetworkFunctionValueWithoutSecrets. + public NetworkFunctionValueWithoutSecrets() + { + ConfigurationType = NetworkFunctionConfigurationType.Open; + } + + /// Initializes a new instance of NetworkFunctionValueWithoutSecrets. + /// The provisioning state of the network function resource. + /// The publisher name for the network function. + /// The scope of the publisher. + /// The network function definition group name for the network function. + /// The network function definition version for the network function. + /// The location of the network function definition offering. + /// + /// The network function definition version resource reference. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include and . + /// + /// The nfvi type for the network function. + /// The nfviId for the network function. + /// Indicates if software updates are allowed during deployment. + /// The value which indicates if NF values are secrets. + /// The role configuration override values from the user. + /// The JSON-serialized deployment values from the user. + internal NetworkFunctionValueWithoutSecrets(ProvisioningState? provisioningState, string publisherName, PublisherScope? publisherScope, string networkFunctionDefinitionGroupName, string networkFunctionDefinitionVersion, string networkFunctionDefinitionOfferingLocation, DeploymentResourceIdReference networkFunctionDefinitionVersionResourceReference, NfviType? nfviType, ResourceIdentifier nfviId, bool? allowSoftwareUpdate, NetworkFunctionConfigurationType configurationType, IList roleOverrideValues, string deploymentValues) : base(provisioningState, publisherName, publisherScope, networkFunctionDefinitionGroupName, networkFunctionDefinitionVersion, networkFunctionDefinitionOfferingLocation, networkFunctionDefinitionVersionResourceReference, nfviType, nfviId, allowSoftwareUpdate, configurationType, roleOverrideValues) + { + DeploymentValues = deploymentValues; + ConfigurationType = configurationType; + } + + /// The JSON-serialized deployment values from the user. + public string DeploymentValues { get; set; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkServiceDesignGroupData.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkServiceDesignGroupData.Serialization.cs new file mode 100644 index 000000000000..3bfab6247a2f --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkServiceDesignGroupData.Serialization.cs @@ -0,0 +1,113 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.HybridNetwork.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.HybridNetwork +{ + public partial class NetworkServiceDesignGroupData : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties); + } + 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(); + } + writer.WritePropertyName("location"u8); + writer.WriteStringValue(Location); + writer.WriteEndObject(); + } + + internal static NetworkServiceDesignGroupData DeserializeNetworkServiceDesignGroupData(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional properties = default; + Optional> tags = default; + AzureLocation location = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + Optional systemData = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = NetworkServiceDesignGroupPropertiesFormat.DeserializeNetworkServiceDesignGroupPropertiesFormat(property.Value); + 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; + } + } + return new NetworkServiceDesignGroupData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, properties.Value); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkServiceDesignGroupListResult.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkServiceDesignGroupListResult.Serialization.cs new file mode 100644 index 000000000000..be91ce7b595d --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkServiceDesignGroupListResult.Serialization.cs @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.HybridNetwork; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + internal partial class NetworkServiceDesignGroupListResult + { + internal static NetworkServiceDesignGroupListResult DeserializeNetworkServiceDesignGroupListResult(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> value = default; + Optional nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(NetworkServiceDesignGroupData.DeserializeNetworkServiceDesignGroupData(item)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + } + return new NetworkServiceDesignGroupListResult(Optional.ToList(value), nextLink.Value); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkServiceDesignGroupListResult.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkServiceDesignGroupListResult.cs new file mode 100644 index 000000000000..fd8d409c368a --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkServiceDesignGroupListResult.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.HybridNetwork; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// A list of network service design group resources. + internal partial class NetworkServiceDesignGroupListResult + { + /// Initializes a new instance of NetworkServiceDesignGroupListResult. + internal NetworkServiceDesignGroupListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of NetworkServiceDesignGroupListResult. + /// A list of network service design group. + /// The URL to get the next set of results. + internal NetworkServiceDesignGroupListResult(IReadOnlyList value, string nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// A list of network service design group. + public IReadOnlyList Value { get; } + /// The URL to get the next set of results. + public string NextLink { get; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkServiceDesignGroupPropertiesFormat.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkServiceDesignGroupPropertiesFormat.Serialization.cs new file mode 100644 index 000000000000..b4f21212cdca --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkServiceDesignGroupPropertiesFormat.Serialization.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class NetworkServiceDesignGroupPropertiesFormat : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Description)) + { + writer.WritePropertyName("description"u8); + writer.WriteStringValue(Description); + } + writer.WriteEndObject(); + } + + internal static NetworkServiceDesignGroupPropertiesFormat DeserializeNetworkServiceDesignGroupPropertiesFormat(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional provisioningState = default; + Optional description = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("provisioningState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new ProvisioningState(property.Value.GetString()); + continue; + } + if (property.NameEquals("description"u8)) + { + description = property.Value.GetString(); + continue; + } + } + return new NetworkServiceDesignGroupPropertiesFormat(Optional.ToNullable(provisioningState), description.Value); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkServiceDesignGroupPropertiesFormat.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkServiceDesignGroupPropertiesFormat.cs new file mode 100644 index 000000000000..18e674c2aab3 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkServiceDesignGroupPropertiesFormat.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// network service design group properties. + public partial class NetworkServiceDesignGroupPropertiesFormat + { + /// Initializes a new instance of NetworkServiceDesignGroupPropertiesFormat. + public NetworkServiceDesignGroupPropertiesFormat() + { + } + + /// Initializes a new instance of NetworkServiceDesignGroupPropertiesFormat. + /// The provisioning state of the network service design groups resource. + /// The network service design group description. + internal NetworkServiceDesignGroupPropertiesFormat(ProvisioningState? provisioningState, string description) + { + ProvisioningState = provisioningState; + Description = description; + } + + /// The provisioning state of the network service design groups resource. + public ProvisioningState? ProvisioningState { get; } + /// The network service design group description. + public string Description { get; set; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkServiceDesignVersionData.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkServiceDesignVersionData.Serialization.cs new file mode 100644 index 000000000000..8e18ff7399c5 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkServiceDesignVersionData.Serialization.cs @@ -0,0 +1,113 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.HybridNetwork.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.HybridNetwork +{ + public partial class NetworkServiceDesignVersionData : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties); + } + 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(); + } + writer.WritePropertyName("location"u8); + writer.WriteStringValue(Location); + writer.WriteEndObject(); + } + + internal static NetworkServiceDesignVersionData DeserializeNetworkServiceDesignVersionData(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional properties = default; + Optional> tags = default; + AzureLocation location = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + Optional systemData = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = NetworkServiceDesignVersionPropertiesFormat.DeserializeNetworkServiceDesignVersionPropertiesFormat(property.Value); + 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; + } + } + return new NetworkServiceDesignVersionData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, properties.Value); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkServiceDesignVersionListResult.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkServiceDesignVersionListResult.Serialization.cs new file mode 100644 index 000000000000..864bbc04577f --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkServiceDesignVersionListResult.Serialization.cs @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.HybridNetwork; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + internal partial class NetworkServiceDesignVersionListResult + { + internal static NetworkServiceDesignVersionListResult DeserializeNetworkServiceDesignVersionListResult(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> value = default; + Optional nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(NetworkServiceDesignVersionData.DeserializeNetworkServiceDesignVersionData(item)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + } + return new NetworkServiceDesignVersionListResult(Optional.ToList(value), nextLink.Value); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkServiceDesignVersionListResult.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkServiceDesignVersionListResult.cs new file mode 100644 index 000000000000..140faf5f8faa --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkServiceDesignVersionListResult.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.HybridNetwork; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// A list of network service design versions. + internal partial class NetworkServiceDesignVersionListResult + { + /// Initializes a new instance of NetworkServiceDesignVersionListResult. + internal NetworkServiceDesignVersionListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of NetworkServiceDesignVersionListResult. + /// A list of network service design versions. + /// The URI to get the next set of results. + internal NetworkServiceDesignVersionListResult(IReadOnlyList value, string nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// A list of network service design versions. + public IReadOnlyList Value { get; } + /// The URI to get the next set of results. + public string NextLink { get; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkServiceDesignVersionPropertiesFormat.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkServiceDesignVersionPropertiesFormat.Serialization.cs new file mode 100644 index 000000000000..a360a7affbb7 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkServiceDesignVersionPropertiesFormat.Serialization.cs @@ -0,0 +1,143 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Resources.Models; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class NetworkServiceDesignVersionPropertiesFormat : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Description)) + { + writer.WritePropertyName("description"u8); + writer.WriteStringValue(Description); + } + if (Optional.IsCollectionDefined(ConfigurationGroupSchemaReferences)) + { + writer.WritePropertyName("configurationGroupSchemaReferences"u8); + writer.WriteStartObject(); + foreach (var item in ConfigurationGroupSchemaReferences) + { + writer.WritePropertyName(item.Key); + JsonSerializer.Serialize(writer, item.Value); + } + writer.WriteEndObject(); + } + if (Optional.IsCollectionDefined(NfvisFromSite)) + { + writer.WritePropertyName("nfvisFromSite"u8); + writer.WriteStartObject(); + foreach (var item in NfvisFromSite) + { + writer.WritePropertyName(item.Key); + writer.WriteObjectValue(item.Value); + } + writer.WriteEndObject(); + } + if (Optional.IsCollectionDefined(ResourceElementTemplates)) + { + writer.WritePropertyName("resourceElementTemplates"u8); + writer.WriteStartArray(); + foreach (var item in ResourceElementTemplates) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + writer.WriteEndObject(); + } + + internal static NetworkServiceDesignVersionPropertiesFormat DeserializeNetworkServiceDesignVersionPropertiesFormat(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional provisioningState = default; + Optional versionState = default; + Optional description = default; + Optional> configurationGroupSchemaReferences = default; + Optional> nfvisFromSite = default; + Optional> resourceElementTemplates = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("provisioningState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new ProvisioningState(property.Value.GetString()); + continue; + } + if (property.NameEquals("versionState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + versionState = new VersionState(property.Value.GetString()); + continue; + } + if (property.NameEquals("description"u8)) + { + description = property.Value.GetString(); + continue; + } + if (property.NameEquals("configurationGroupSchemaReferences"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, JsonSerializer.Deserialize(property0.Value.GetRawText())); + } + configurationGroupSchemaReferences = dictionary; + continue; + } + if (property.NameEquals("nfvisFromSite"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, NfviDetails.DeserializeNfviDetails(property0.Value)); + } + nfvisFromSite = dictionary; + continue; + } + if (property.NameEquals("resourceElementTemplates"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ResourceElementTemplate.DeserializeResourceElementTemplate(item)); + } + resourceElementTemplates = array; + continue; + } + } + return new NetworkServiceDesignVersionPropertiesFormat(Optional.ToNullable(provisioningState), Optional.ToNullable(versionState), description.Value, Optional.ToDictionary(configurationGroupSchemaReferences), Optional.ToDictionary(nfvisFromSite), Optional.ToList(resourceElementTemplates)); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkServiceDesignVersionPropertiesFormat.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkServiceDesignVersionPropertiesFormat.cs new file mode 100644 index 000000000000..a59c693fdf24 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkServiceDesignVersionPropertiesFormat.cs @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.Resources.Models; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// network service design version properties. + public partial class NetworkServiceDesignVersionPropertiesFormat + { + /// Initializes a new instance of NetworkServiceDesignVersionPropertiesFormat. + public NetworkServiceDesignVersionPropertiesFormat() + { + ConfigurationGroupSchemaReferences = new ChangeTrackingDictionary(); + NfvisFromSite = new ChangeTrackingDictionary(); + ResourceElementTemplates = new ChangeTrackingList(); + } + + /// Initializes a new instance of NetworkServiceDesignVersionPropertiesFormat. + /// The provisioning state of the network service design version resource. + /// The network service design version state. + /// The network service design version description. + /// The configuration schemas to used to define the values. + /// The nfvis from the site. + /// + /// List of resource element template + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include and . + /// + internal NetworkServiceDesignVersionPropertiesFormat(ProvisioningState? provisioningState, VersionState? versionState, string description, IDictionary configurationGroupSchemaReferences, IDictionary nfvisFromSite, IList resourceElementTemplates) + { + ProvisioningState = provisioningState; + VersionState = versionState; + Description = description; + ConfigurationGroupSchemaReferences = configurationGroupSchemaReferences; + NfvisFromSite = nfvisFromSite; + ResourceElementTemplates = resourceElementTemplates; + } + + /// The provisioning state of the network service design version resource. + public ProvisioningState? ProvisioningState { get; } + /// The network service design version state. + public VersionState? VersionState { get; } + /// The network service design version description. + public string Description { get; set; } + /// The configuration schemas to used to define the values. + public IDictionary ConfigurationGroupSchemaReferences { get; } + /// The nfvis from the site. + public IDictionary NfvisFromSite { get; } + /// + /// List of resource element template + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include and . + /// + public IList ResourceElementTemplates { get; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkServiceDesignVersionUpdateState.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkServiceDesignVersionUpdateState.Serialization.cs new file mode 100644 index 000000000000..0740839c2460 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkServiceDesignVersionUpdateState.Serialization.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class NetworkServiceDesignVersionUpdateState : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(VersionState)) + { + writer.WritePropertyName("versionState"u8); + writer.WriteStringValue(VersionState.Value.ToString()); + } + writer.WriteEndObject(); + } + + internal static NetworkServiceDesignVersionUpdateState DeserializeNetworkServiceDesignVersionUpdateState(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional versionState = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("versionState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + versionState = new VersionState(property.Value.GetString()); + continue; + } + } + return new NetworkServiceDesignVersionUpdateState(Optional.ToNullable(versionState)); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkServiceDesignVersionUpdateState.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkServiceDesignVersionUpdateState.cs new file mode 100644 index 000000000000..3c6520e8e390 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkServiceDesignVersionUpdateState.cs @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// Publisher network service design version update request definition. + public partial class NetworkServiceDesignVersionUpdateState + { + /// Initializes a new instance of NetworkServiceDesignVersionUpdateState. + public NetworkServiceDesignVersionUpdateState() + { + } + + /// Initializes a new instance of NetworkServiceDesignVersionUpdateState. + /// The network service design version state. + internal NetworkServiceDesignVersionUpdateState(VersionState? versionState) + { + VersionState = versionState; + } + + /// The network service design version state. + public VersionState? VersionState { get; set; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NfviDetails.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NfviDetails.Serialization.cs new file mode 100644 index 000000000000..4178fc737f29 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NfviDetails.Serialization.cs @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class NfviDetails : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (Optional.IsDefined(NfviDetailsType)) + { + writer.WritePropertyName("type"u8); + writer.WriteStringValue(NfviDetailsType); + } + writer.WriteEndObject(); + } + + internal static NfviDetails DeserializeNfviDetails(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional name = default; + Optional type = default; + 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; + } + } + return new NfviDetails(name.Value, type.Value); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NfviDetails.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NfviDetails.cs new file mode 100644 index 000000000000..1162b0bcdd73 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NfviDetails.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// The nfvi details. + public partial class NfviDetails + { + /// Initializes a new instance of NfviDetails. + public NfviDetails() + { + } + + /// Initializes a new instance of NfviDetails. + /// The nfvi name. + /// The nfvi type. + internal NfviDetails(string name, string nfviDetailsType) + { + Name = name; + NfviDetailsType = nfviDetailsType; + } + + /// The nfvi name. + public string Name { get; set; } + /// The nfvi type. + public string NfviDetailsType { get; set; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NfviType.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NfviType.cs new file mode 100644 index 000000000000..fd8e7c0b0cf0 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NfviType.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.HybridNetwork.Models +{ + /// The NFVI type. + public readonly partial struct NfviType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public NfviType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string UnknownValue = "Unknown"; + private const string AzureArcKubernetesValue = "AzureArcKubernetes"; + private const string AzureCoreValue = "AzureCore"; + private const string AzureOperatorNexusValue = "AzureOperatorNexus"; + + /// Unknown. + public static NfviType Unknown { get; } = new NfviType(UnknownValue); + /// AzureArcKubernetes. + public static NfviType AzureArcKubernetes { get; } = new NfviType(AzureArcKubernetesValue); + /// AzureCore. + public static NfviType AzureCore { get; } = new NfviType(AzureCoreValue); + /// AzureOperatorNexus. + public static NfviType AzureOperatorNexus { get; } = new NfviType(AzureOperatorNexusValue); + /// Determines if two values are the same. + public static bool operator ==(NfviType left, NfviType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(NfviType left, NfviType right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator NfviType(string value) => new NfviType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is NfviType other && Equals(other); + /// + public bool Equals(NfviType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/OpenDeploymentResourceReference.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/OpenDeploymentResourceReference.Serialization.cs new file mode 100644 index 000000000000..528a6c571d65 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/OpenDeploymentResourceReference.Serialization.cs @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class OpenDeploymentResourceReference : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + } + writer.WritePropertyName("idType"u8); + writer.WriteStringValue(IdType.ToString()); + writer.WriteEndObject(); + } + + internal static OpenDeploymentResourceReference DeserializeOpenDeploymentResourceReference(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional id = default; + IdType idType = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + id = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("idType"u8)) + { + idType = new IdType(property.Value.GetString()); + continue; + } + } + return new OpenDeploymentResourceReference(idType, id.Value); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/OpenDeploymentResourceReference.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/OpenDeploymentResourceReference.cs new file mode 100644 index 000000000000..26483943ed6b --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/OpenDeploymentResourceReference.cs @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// Non secret deployment resource id reference. + public partial class OpenDeploymentResourceReference : DeploymentResourceIdReference + { + /// Initializes a new instance of OpenDeploymentResourceReference. + public OpenDeploymentResourceReference() + { + IdType = IdType.Open; + } + + /// Initializes a new instance of OpenDeploymentResourceReference. + /// The resource reference arm id type. + /// Resource ID. + internal OpenDeploymentResourceReference(IdType idType, ResourceIdentifier id) : base(idType) + { + Id = id; + IdType = idType; + } + + /// Resource ID. + public ResourceIdentifier Id { get; set; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/PodEvent.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/PodEvent.Serialization.cs new file mode 100644 index 000000000000..ed9a93b0657a --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/PodEvent.Serialization.cs @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class PodEvent + { + internal static PodEvent DeserializePodEvent(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional type = default; + Optional reason = default; + Optional message = default; + Optional lastSeenTime = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("type"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + type = new PodEventType(property.Value.GetString()); + continue; + } + if (property.NameEquals("reason"u8)) + { + reason = property.Value.GetString(); + continue; + } + if (property.NameEquals("message"u8)) + { + message = property.Value.GetString(); + continue; + } + if (property.NameEquals("lastSeenTime"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + lastSeenTime = property.Value.GetDateTimeOffset("O"); + continue; + } + } + return new PodEvent(Optional.ToNullable(type), reason.Value, message.Value, Optional.ToNullable(lastSeenTime)); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/PodEvent.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/PodEvent.cs new file mode 100644 index 000000000000..79aff77232a1 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/PodEvent.cs @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// Pod Event properties. + public partial class PodEvent + { + /// Initializes a new instance of PodEvent. + internal PodEvent() + { + } + + /// Initializes a new instance of PodEvent. + /// The type of pod event. + /// Event reason. + /// Event message. + /// Event Last seen. + internal PodEvent(PodEventType? eventType, string reason, string message, DateTimeOffset? lastSeenOn) + { + EventType = eventType; + Reason = reason; + Message = message; + LastSeenOn = lastSeenOn; + } + + /// The type of pod event. + public PodEventType? EventType { get; } + /// Event reason. + public string Reason { get; } + /// Event message. + public string Message { get; } + /// Event Last seen. + public DateTimeOffset? LastSeenOn { get; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/PodEventType.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/PodEventType.cs new file mode 100644 index 000000000000..e1e6d39c4291 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/PodEventType.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.HybridNetwork.Models +{ + /// The type of pod event. + public readonly partial struct PodEventType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public PodEventType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string NormalValue = "Normal"; + private const string WarningValue = "Warning"; + + /// Normal. + public static PodEventType Normal { get; } = new PodEventType(NormalValue); + /// Warning. + public static PodEventType Warning { get; } = new PodEventType(WarningValue); + /// Determines if two values are the same. + public static bool operator ==(PodEventType left, PodEventType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(PodEventType left, PodEventType right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator PodEventType(string value) => new PodEventType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is PodEventType other && Equals(other); + /// + public bool Equals(PodEventType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/PodStatus.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/PodStatus.cs new file mode 100644 index 000000000000..8d4542e11257 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/PodStatus.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.HybridNetwork.Models +{ + /// The status of a Pod. + public readonly partial struct PodStatus : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public PodStatus(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string UnknownValue = "Unknown"; + private const string SucceededValue = "Succeeded"; + private const string FailedValue = "Failed"; + private const string RunningValue = "Running"; + private const string PendingValue = "Pending"; + private const string TerminatingValue = "Terminating"; + private const string NotReadyValue = "NotReady"; + + /// Unknown. + public static PodStatus Unknown { get; } = new PodStatus(UnknownValue); + /// Succeeded. + public static PodStatus Succeeded { get; } = new PodStatus(SucceededValue); + /// Failed. + public static PodStatus Failed { get; } = new PodStatus(FailedValue); + /// Running. + public static PodStatus Running { get; } = new PodStatus(RunningValue); + /// Pending. + public static PodStatus Pending { get; } = new PodStatus(PendingValue); + /// Terminating. + public static PodStatus Terminating { get; } = new PodStatus(TerminatingValue); + /// NotReady. + public static PodStatus NotReady { get; } = new PodStatus(NotReadyValue); + /// Determines if two values are the same. + public static bool operator ==(PodStatus left, PodStatus right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(PodStatus left, PodStatus right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator PodStatus(string value) => new PodStatus(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is PodStatus other && Equals(other); + /// + public bool Equals(PodStatus other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ProvisioningState.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ProvisioningState.cs new file mode 100644 index 000000000000..228b8c7d6c85 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ProvisioningState.cs @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// The current provisioning state. + public readonly partial struct ProvisioningState : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public ProvisioningState(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string UnknownValue = "Unknown"; + private const string SucceededValue = "Succeeded"; + private const string AcceptedValue = "Accepted"; + private const string DeletingValue = "Deleting"; + private const string FailedValue = "Failed"; + private const string CanceledValue = "Canceled"; + private const string DeletedValue = "Deleted"; + private const string ConvergingValue = "Converging"; + + /// Unknown. + public static ProvisioningState Unknown { get; } = new ProvisioningState(UnknownValue); + /// Succeeded. + public static ProvisioningState Succeeded { get; } = new ProvisioningState(SucceededValue); + /// Accepted. + public static ProvisioningState Accepted { get; } = new ProvisioningState(AcceptedValue); + /// Deleting. + public static ProvisioningState Deleting { get; } = new ProvisioningState(DeletingValue); + /// Failed. + public static ProvisioningState Failed { get; } = new ProvisioningState(FailedValue); + /// Canceled. + public static ProvisioningState Canceled { get; } = new ProvisioningState(CanceledValue); + /// Deleted. + public static ProvisioningState Deleted { get; } = new ProvisioningState(DeletedValue); + /// Converging. + public static ProvisioningState Converging { get; } = new ProvisioningState(ConvergingValue); + /// Determines if two values are the same. + public static bool operator ==(ProvisioningState left, ProvisioningState right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ProvisioningState left, ProvisioningState right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator ProvisioningState(string value) => new ProvisioningState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ProvisioningState other && Equals(other); + /// + public bool Equals(ProvisioningState other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ProxyArtifactListOverview.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ProxyArtifactListOverview.Serialization.cs new file mode 100644 index 000000000000..dbfc56099470 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ProxyArtifactListOverview.Serialization.cs @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class ProxyArtifactListOverview : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } + + internal static ProxyArtifactListOverview DeserializeProxyArtifactListOverview(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + Optional systemData = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id"u8)) + { + id = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new ResourceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("systemData"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + } + return new ProxyArtifactListOverview(id, name, type, systemData.Value); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ProxyArtifactListOverview.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ProxyArtifactListOverview.cs new file mode 100644 index 000000000000..df28a00eaea7 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ProxyArtifactListOverview.cs @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// The proxy artifact overview. + public partial class ProxyArtifactListOverview : ResourceData + { + /// Initializes a new instance of ProxyArtifactListOverview. + public ProxyArtifactListOverview() + { + } + + /// Initializes a new instance of ProxyArtifactListOverview. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + internal ProxyArtifactListOverview(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData) : base(id, name, resourceType, systemData) + { + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ProxyArtifactOverviewListResult.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ProxyArtifactOverviewListResult.Serialization.cs new file mode 100644 index 000000000000..744774ea1e54 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ProxyArtifactOverviewListResult.Serialization.cs @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + internal partial class ProxyArtifactOverviewListResult + { + internal static ProxyArtifactOverviewListResult DeserializeProxyArtifactOverviewListResult(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> value = default; + Optional nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ProxyArtifactListOverview.DeserializeProxyArtifactListOverview(item)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + } + return new ProxyArtifactOverviewListResult(Optional.ToList(value), nextLink.Value); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ProxyArtifactOverviewListResult.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ProxyArtifactOverviewListResult.cs new file mode 100644 index 000000000000..567b60bfcd84 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ProxyArtifactOverviewListResult.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// The proxy artifact list result. + internal partial class ProxyArtifactOverviewListResult + { + /// Initializes a new instance of ProxyArtifactOverviewListResult. + internal ProxyArtifactOverviewListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of ProxyArtifactOverviewListResult. + /// A list of available proxy artifacts. + /// The URL to get the next set of results. + internal ProxyArtifactOverviewListResult(IReadOnlyList value, string nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// A list of available proxy artifacts. + public IReadOnlyList Value { get; } + /// The URL to get the next set of results. + public string NextLink { get; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ProxyArtifactOverviewPropertiesValue.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ProxyArtifactOverviewPropertiesValue.Serialization.cs new file mode 100644 index 000000000000..c278acfbcce3 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ProxyArtifactOverviewPropertiesValue.Serialization.cs @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class ProxyArtifactOverviewPropertiesValue + { + internal static ProxyArtifactOverviewPropertiesValue DeserializeProxyArtifactOverviewPropertiesValue(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional artifactType = default; + Optional artifactVersion = default; + Optional artifactState = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("artifactType"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + artifactType = new ArtifactType(property.Value.GetString()); + continue; + } + if (property.NameEquals("artifactVersion"u8)) + { + artifactVersion = property.Value.GetString(); + continue; + } + if (property.NameEquals("artifactState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + artifactState = new ArtifactState(property.Value.GetString()); + continue; + } + } + return new ProxyArtifactOverviewPropertiesValue(Optional.ToNullable(artifactType), artifactVersion.Value, Optional.ToNullable(artifactState)); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ProxyArtifactOverviewPropertiesValue.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ProxyArtifactOverviewPropertiesValue.cs new file mode 100644 index 000000000000..a33efeda7e1e --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ProxyArtifactOverviewPropertiesValue.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// The ProxyArtifactOverviewPropertiesValue. + public partial class ProxyArtifactOverviewPropertiesValue + { + /// Initializes a new instance of ProxyArtifactOverviewPropertiesValue. + internal ProxyArtifactOverviewPropertiesValue() + { + } + + /// Initializes a new instance of ProxyArtifactOverviewPropertiesValue. + /// The artifact type. + /// The artifact version. + /// The artifact state. + internal ProxyArtifactOverviewPropertiesValue(ArtifactType? artifactType, string artifactVersion, ArtifactState? artifactState) + { + ArtifactType = artifactType; + ArtifactVersion = artifactVersion; + ArtifactState = artifactState; + } + + /// The artifact type. + public ArtifactType? ArtifactType { get; } + /// The artifact version. + public string ArtifactVersion { get; } + /// The artifact state. + public ArtifactState? ArtifactState { get; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ProxyArtifactVersionsListOverview.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ProxyArtifactVersionsListOverview.Serialization.cs new file mode 100644 index 000000000000..12e44af16f5d --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ProxyArtifactVersionsListOverview.Serialization.cs @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class ProxyArtifactVersionsListOverview : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } + + internal static ProxyArtifactVersionsListOverview DeserializeProxyArtifactVersionsListOverview(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional properties = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + Optional systemData = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = ProxyArtifactOverviewPropertiesValue.DeserializeProxyArtifactOverviewPropertiesValue(property.Value); + 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; + } + } + return new ProxyArtifactVersionsListOverview(id, name, type, systemData.Value, properties.Value); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ProxyArtifactVersionsListOverview.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ProxyArtifactVersionsListOverview.cs new file mode 100644 index 000000000000..fa78a94931ab --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ProxyArtifactVersionsListOverview.cs @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// The proxy artifact overview. + public partial class ProxyArtifactVersionsListOverview : ResourceData + { + /// Initializes a new instance of ProxyArtifactVersionsListOverview. + public ProxyArtifactVersionsListOverview() + { + } + + /// Initializes a new instance of ProxyArtifactVersionsListOverview. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Proxy Artifact overview properties. + internal ProxyArtifactVersionsListOverview(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ProxyArtifactOverviewPropertiesValue properties) : base(id, name, resourceType, systemData) + { + Properties = properties; + } + + /// Proxy Artifact overview properties. + public ProxyArtifactOverviewPropertiesValue Properties { get; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ProxyArtifactVersionsOverviewListResult.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ProxyArtifactVersionsOverviewListResult.Serialization.cs new file mode 100644 index 000000000000..db0b6c190c6a --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ProxyArtifactVersionsOverviewListResult.Serialization.cs @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + internal partial class ProxyArtifactVersionsOverviewListResult + { + internal static ProxyArtifactVersionsOverviewListResult DeserializeProxyArtifactVersionsOverviewListResult(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> value = default; + Optional nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ProxyArtifactVersionsListOverview.DeserializeProxyArtifactVersionsListOverview(item)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + } + return new ProxyArtifactVersionsOverviewListResult(Optional.ToList(value), nextLink.Value); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ProxyArtifactVersionsOverviewListResult.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ProxyArtifactVersionsOverviewListResult.cs new file mode 100644 index 000000000000..10bc8746295a --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ProxyArtifactVersionsOverviewListResult.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// The proxy artifact list result. + internal partial class ProxyArtifactVersionsOverviewListResult + { + /// Initializes a new instance of ProxyArtifactVersionsOverviewListResult. + internal ProxyArtifactVersionsOverviewListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of ProxyArtifactVersionsOverviewListResult. + /// A list of available proxy artifacts. + /// The URL to get the next set of results. + internal ProxyArtifactVersionsOverviewListResult(IReadOnlyList value, string nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// A list of available proxy artifacts. + public IReadOnlyList Value { get; } + /// The URL to get the next set of results. + public string NextLink { get; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/PublisherData.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/PublisherData.Serialization.cs new file mode 100644 index 000000000000..362d35897fd2 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/PublisherData.Serialization.cs @@ -0,0 +1,130 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.HybridNetwork.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.HybridNetwork +{ + public partial class PublisherData : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties); + } + if (Optional.IsDefined(Identity)) + { + writer.WritePropertyName("identity"u8); + var serializeOptions = new JsonSerializerOptions { Converters = { new ManagedServiceIdentityTypeV3Converter() } }; + JsonSerializer.Serialize(writer, Identity, serializeOptions); + } + 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(); + } + writer.WritePropertyName("location"u8); + writer.WriteStringValue(Location); + writer.WriteEndObject(); + } + + internal static PublisherData DeserializePublisherData(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional properties = default; + Optional identity = default; + Optional> tags = default; + AzureLocation location = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + Optional systemData = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = PublisherPropertiesFormat.DeserializePublisherPropertiesFormat(property.Value); + continue; + } + if (property.NameEquals("identity"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + var serializeOptions = new JsonSerializerOptions { Converters = { new ManagedServiceIdentityTypeV3Converter() } }; + identity = JsonSerializer.Deserialize(property.Value.GetRawText(), serializeOptions); + 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; + } + } + return new PublisherData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, properties.Value, identity); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/PublisherListResult.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/PublisherListResult.Serialization.cs new file mode 100644 index 000000000000..923aa159d9f6 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/PublisherListResult.Serialization.cs @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.HybridNetwork; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + internal partial class PublisherListResult + { + internal static PublisherListResult DeserializePublisherListResult(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> value = default; + Optional nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(PublisherData.DeserializePublisherData(item)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + } + return new PublisherListResult(Optional.ToList(value), nextLink.Value); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/PublisherListResult.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/PublisherListResult.cs new file mode 100644 index 000000000000..d48ee5e0e693 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/PublisherListResult.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.HybridNetwork; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// A list of publishers. + internal partial class PublisherListResult + { + /// Initializes a new instance of PublisherListResult. + internal PublisherListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of PublisherListResult. + /// A list of publishers. + /// The URL to get the next set of results. + internal PublisherListResult(IReadOnlyList value, string nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// A list of publishers. + public IReadOnlyList Value { get; } + /// The URL to get the next set of results. + public string NextLink { get; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/PublisherPropertiesFormat.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/PublisherPropertiesFormat.Serialization.cs new file mode 100644 index 000000000000..8bed86003f49 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/PublisherPropertiesFormat.Serialization.cs @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class PublisherPropertiesFormat : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Scope)) + { + writer.WritePropertyName("scope"u8); + writer.WriteStringValue(Scope.Value.ToString()); + } + writer.WriteEndObject(); + } + + internal static PublisherPropertiesFormat DeserializePublisherPropertiesFormat(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional provisioningState = default; + Optional scope = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("provisioningState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new ProvisioningState(property.Value.GetString()); + continue; + } + if (property.NameEquals("scope"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + scope = new PublisherScope(property.Value.GetString()); + continue; + } + } + return new PublisherPropertiesFormat(Optional.ToNullable(provisioningState), Optional.ToNullable(scope)); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/PublisherPropertiesFormat.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/PublisherPropertiesFormat.cs new file mode 100644 index 000000000000..b0a2191d879a --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/PublisherPropertiesFormat.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// publisher properties. + public partial class PublisherPropertiesFormat + { + /// Initializes a new instance of PublisherPropertiesFormat. + public PublisherPropertiesFormat() + { + } + + /// Initializes a new instance of PublisherPropertiesFormat. + /// The provisioning state of the publisher resource. + /// The publisher scope. + internal PublisherPropertiesFormat(ProvisioningState? provisioningState, PublisherScope? scope) + { + ProvisioningState = provisioningState; + Scope = scope; + } + + /// The provisioning state of the publisher resource. + public ProvisioningState? ProvisioningState { get; } + /// The publisher scope. + public PublisherScope? Scope { get; set; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/PublisherScope.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/PublisherScope.cs new file mode 100644 index 000000000000..2b1dc2a637f7 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/PublisherScope.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.HybridNetwork.Models +{ + /// Publisher Scope. + public readonly partial struct PublisherScope : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public PublisherScope(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string UnknownValue = "Unknown"; + private const string PrivateValue = "Private"; + + /// Unknown. + public static PublisherScope Unknown { get; } = new PublisherScope(UnknownValue); + /// Private. + public static PublisherScope Private { get; } = new PublisherScope(PrivateValue); + /// Determines if two values are the same. + public static bool operator ==(PublisherScope left, PublisherScope right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(PublisherScope left, PublisherScope right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator PublisherScope(string value) => new PublisherScope(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is PublisherScope other && Equals(other); + /// + public bool Equals(PublisherScope other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/RequestMetadata.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/RequestMetadata.Serialization.cs new file mode 100644 index 000000000000..2031a5ce0340 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/RequestMetadata.Serialization.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class RequestMetadata : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("relativePath"u8); + writer.WriteStringValue(RelativePath); + writer.WritePropertyName("httpMethod"u8); + writer.WriteStringValue(HttpMethod.ToString()); + writer.WritePropertyName("serializedBody"u8); + writer.WriteStringValue(SerializedBody); + if (Optional.IsDefined(ApiVersion)) + { + writer.WritePropertyName("apiVersion"u8); + writer.WriteStringValue(ApiVersion); + } + writer.WriteEndObject(); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/RequestMetadata.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/RequestMetadata.cs new file mode 100644 index 000000000000..6a9b51f751e7 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/RequestMetadata.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// Request metadata of execute request post call payload. + public partial class RequestMetadata + { + /// Initializes a new instance of RequestMetadata. + /// The relative path of the request. + /// The http method of the request. + /// The serialized body of the request. + /// or is null. + public RequestMetadata(string relativePath, HttpMethod httpMethod, string serializedBody) + { + Argument.AssertNotNull(relativePath, nameof(relativePath)); + Argument.AssertNotNull(serializedBody, nameof(serializedBody)); + + RelativePath = relativePath; + HttpMethod = httpMethod; + SerializedBody = serializedBody; + } + + /// The relative path of the request. + public string RelativePath { get; } + /// The http method of the request. + public HttpMethod HttpMethod { get; } + /// The serialized body of the request. + public string SerializedBody { get; } + /// The api version of the request. + public string ApiVersion { get; set; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ResourceElementTemplate.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ResourceElementTemplate.Serialization.cs new file mode 100644 index 000000000000..db00f56a915c --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ResourceElementTemplate.Serialization.cs @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class ResourceElementTemplate : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + writer.WritePropertyName("type"u8); + writer.WriteStringValue(ResourceElementType.ToString()); + if (Optional.IsDefined(DependsOnProfile)) + { + writer.WritePropertyName("dependsOnProfile"u8); + writer.WriteObjectValue(DependsOnProfile); + } + writer.WriteEndObject(); + } + + internal static ResourceElementTemplate DeserializeResourceElementTemplate(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + if (element.TryGetProperty("type", out JsonElement discriminator)) + { + switch (discriminator.GetString()) + { + case "ArmResourceDefinition": return ArmResourceDefinitionResourceElementTemplateDetails.DeserializeArmResourceDefinitionResourceElementTemplateDetails(element); + case "NetworkFunctionDefinition": return NetworkFunctionDefinitionResourceElementTemplateDetails.DeserializeNetworkFunctionDefinitionResourceElementTemplateDetails(element); + } + } + return UnknownResourceElementTemplate.DeserializeUnknownResourceElementTemplate(element); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ResourceElementTemplate.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ResourceElementTemplate.cs new file mode 100644 index 000000000000..a67ade822322 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ResourceElementTemplate.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// + /// The resource element template object. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include and . + /// + public abstract partial class ResourceElementTemplate + { + /// Initializes a new instance of ResourceElementTemplate. + protected ResourceElementTemplate() + { + } + + /// Initializes a new instance of ResourceElementTemplate. + /// Name of the resource element template. + /// The resource element template type. + /// The depends on profile. + internal ResourceElementTemplate(string name, Type resourceElementType, DependsOnProfile dependsOnProfile) + { + Name = name; + ResourceElementType = resourceElementType; + DependsOnProfile = dependsOnProfile; + } + + /// Name of the resource element template. + public string Name { get; set; } + /// The resource element template type. + internal Type ResourceElementType { get; set; } + /// The depends on profile. + public DependsOnProfile DependsOnProfile { get; set; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/SecretDeploymentResourceReference.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/SecretDeploymentResourceReference.Serialization.cs new file mode 100644 index 000000000000..94f7caf7b47e --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/SecretDeploymentResourceReference.Serialization.cs @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class SecretDeploymentResourceReference : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + } + writer.WritePropertyName("idType"u8); + writer.WriteStringValue(IdType.ToString()); + writer.WriteEndObject(); + } + + internal static SecretDeploymentResourceReference DeserializeSecretDeploymentResourceReference(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional id = default; + IdType idType = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + id = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("idType"u8)) + { + idType = new IdType(property.Value.GetString()); + continue; + } + } + return new SecretDeploymentResourceReference(idType, id.Value); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/SecretDeploymentResourceReference.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/SecretDeploymentResourceReference.cs new file mode 100644 index 000000000000..776c869e724b --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/SecretDeploymentResourceReference.cs @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// Secret deployment resource id reference. + public partial class SecretDeploymentResourceReference : DeploymentResourceIdReference + { + /// Initializes a new instance of SecretDeploymentResourceReference. + public SecretDeploymentResourceReference() + { + IdType = IdType.Secret; + } + + /// Initializes a new instance of SecretDeploymentResourceReference. + /// The resource reference arm id type. + /// Resource ID. + internal SecretDeploymentResourceReference(IdType idType, ResourceIdentifier id) : base(idType) + { + Id = id; + IdType = idType; + } + + /// Resource ID. + public ResourceIdentifier Id { get; set; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/SiteData.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/SiteData.Serialization.cs new file mode 100644 index 000000000000..3f3d10044c55 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/SiteData.Serialization.cs @@ -0,0 +1,113 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.HybridNetwork.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.HybridNetwork +{ + public partial class SiteData : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties); + } + 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(); + } + writer.WritePropertyName("location"u8); + writer.WriteStringValue(Location); + writer.WriteEndObject(); + } + + internal static SiteData DeserializeSiteData(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional properties = default; + Optional> tags = default; + AzureLocation location = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + Optional systemData = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = SitePropertiesFormat.DeserializeSitePropertiesFormat(property.Value); + 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; + } + } + return new SiteData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, properties.Value); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/SiteListResult.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/SiteListResult.Serialization.cs new file mode 100644 index 000000000000..b5e55b937089 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/SiteListResult.Serialization.cs @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.HybridNetwork; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + internal partial class SiteListResult + { + internal static SiteListResult DeserializeSiteListResult(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> value = default; + Optional nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(SiteData.DeserializeSiteData(item)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + } + return new SiteListResult(Optional.ToList(value), nextLink.Value); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/SiteListResult.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/SiteListResult.cs new file mode 100644 index 000000000000..573e1d3c21ff --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/SiteListResult.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.HybridNetwork; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// Response for sites API service call. + internal partial class SiteListResult + { + /// Initializes a new instance of SiteListResult. + internal SiteListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of SiteListResult. + /// A list of sites in a resource group. + /// The URL to get the next set of results. + internal SiteListResult(IReadOnlyList value, string nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// A list of sites in a resource group. + public IReadOnlyList Value { get; } + /// The URL to get the next set of results. + public string NextLink { get; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/SiteNetworkServiceData.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/SiteNetworkServiceData.Serialization.cs new file mode 100644 index 000000000000..92e7de9d2dec --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/SiteNetworkServiceData.Serialization.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.HybridNetwork.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.HybridNetwork +{ + public partial class SiteNetworkServiceData : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties); + } + if (Optional.IsDefined(Identity)) + { + writer.WritePropertyName("identity"u8); + var serializeOptions = new JsonSerializerOptions { Converters = { new ManagedServiceIdentityTypeV3Converter() } }; + JsonSerializer.Serialize(writer, Identity, serializeOptions); + } + if (Optional.IsDefined(Sku)) + { + writer.WritePropertyName("sku"u8); + writer.WriteObjectValue(Sku); + } + 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(); + } + writer.WritePropertyName("location"u8); + writer.WriteStringValue(Location); + writer.WriteEndObject(); + } + + internal static SiteNetworkServiceData DeserializeSiteNetworkServiceData(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional properties = default; + Optional identity = default; + Optional sku = default; + Optional> tags = default; + AzureLocation location = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + Optional systemData = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = SiteNetworkServicePropertiesFormat.DeserializeSiteNetworkServicePropertiesFormat(property.Value); + continue; + } + if (property.NameEquals("identity"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + var serializeOptions = new JsonSerializerOptions { Converters = { new ManagedServiceIdentityTypeV3Converter() } }; + identity = JsonSerializer.Deserialize(property.Value.GetRawText(), serializeOptions); + continue; + } + if (property.NameEquals("sku"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + sku = HybridNetworkSku.DeserializeHybridNetworkSku(property.Value); + 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; + } + } + return new SiteNetworkServiceData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, properties.Value, identity, sku.Value); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/SiteNetworkServiceListResult.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/SiteNetworkServiceListResult.Serialization.cs new file mode 100644 index 000000000000..e938f28b0f5c --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/SiteNetworkServiceListResult.Serialization.cs @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.HybridNetwork; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + internal partial class SiteNetworkServiceListResult + { + internal static SiteNetworkServiceListResult DeserializeSiteNetworkServiceListResult(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> value = default; + Optional nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(SiteNetworkServiceData.DeserializeSiteNetworkServiceData(item)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + } + return new SiteNetworkServiceListResult(Optional.ToList(value), nextLink.Value); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/SiteNetworkServiceListResult.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/SiteNetworkServiceListResult.cs new file mode 100644 index 000000000000..dcb062cb6823 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/SiteNetworkServiceListResult.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.HybridNetwork; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// Response for site network services API service call. + internal partial class SiteNetworkServiceListResult + { + /// Initializes a new instance of SiteNetworkServiceListResult. + internal SiteNetworkServiceListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of SiteNetworkServiceListResult. + /// A list of site network services in a resource group. + /// The URL to get the next set of results. + internal SiteNetworkServiceListResult(IReadOnlyList value, string nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// A list of site network services in a resource group. + public IReadOnlyList Value { get; } + /// The URL to get the next set of results. + public string NextLink { get; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/SiteNetworkServicePropertiesFormat.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/SiteNetworkServicePropertiesFormat.Serialization.cs new file mode 100644 index 000000000000..89b64fa071b5 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/SiteNetworkServicePropertiesFormat.Serialization.cs @@ -0,0 +1,171 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Resources.Models; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class SiteNetworkServicePropertiesFormat : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(ManagedResourceGroupConfiguration)) + { + writer.WritePropertyName("managedResourceGroupConfiguration"u8); + writer.WriteObjectValue(ManagedResourceGroupConfiguration); + } + if (Optional.IsDefined(SiteReference)) + { + writer.WritePropertyName("siteReference"u8); + JsonSerializer.Serialize(writer, SiteReference); + } + if (Optional.IsDefined(NetworkServiceDesignVersionResourceReference)) + { + writer.WritePropertyName("networkServiceDesignVersionResourceReference"u8); + writer.WriteObjectValue(NetworkServiceDesignVersionResourceReference); + } + if (Optional.IsCollectionDefined(DesiredStateConfigurationGroupValueReferences)) + { + writer.WritePropertyName("desiredStateConfigurationGroupValueReferences"u8); + writer.WriteStartObject(); + foreach (var item in DesiredStateConfigurationGroupValueReferences) + { + writer.WritePropertyName(item.Key); + JsonSerializer.Serialize(writer, item.Value); + } + writer.WriteEndObject(); + } + writer.WriteEndObject(); + } + + internal static SiteNetworkServicePropertiesFormat DeserializeSiteNetworkServicePropertiesFormat(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional provisioningState = default; + Optional managedResourceGroupConfiguration = default; + Optional siteReference = default; + Optional publisherName = default; + Optional publisherScope = default; + Optional networkServiceDesignGroupName = default; + Optional networkServiceDesignVersionName = default; + Optional networkServiceDesignVersionOfferingLocation = default; + Optional networkServiceDesignVersionResourceReference = default; + Optional> desiredStateConfigurationGroupValueReferences = default; + Optional lastStateNetworkServiceDesignVersionName = default; + Optional> lastStateConfigurationGroupValueReferences = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("provisioningState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new ProvisioningState(property.Value.GetString()); + continue; + } + if (property.NameEquals("managedResourceGroupConfiguration"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + managedResourceGroupConfiguration = ManagedResourceGroupConfiguration.DeserializeManagedResourceGroupConfiguration(property.Value); + continue; + } + if (property.NameEquals("siteReference"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + siteReference = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (property.NameEquals("publisherName"u8)) + { + publisherName = property.Value.GetString(); + continue; + } + if (property.NameEquals("publisherScope"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + publisherScope = new PublisherScope(property.Value.GetString()); + continue; + } + if (property.NameEquals("networkServiceDesignGroupName"u8)) + { + networkServiceDesignGroupName = property.Value.GetString(); + continue; + } + if (property.NameEquals("networkServiceDesignVersionName"u8)) + { + networkServiceDesignVersionName = property.Value.GetString(); + continue; + } + if (property.NameEquals("networkServiceDesignVersionOfferingLocation"u8)) + { + networkServiceDesignVersionOfferingLocation = property.Value.GetString(); + continue; + } + if (property.NameEquals("networkServiceDesignVersionResourceReference"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + networkServiceDesignVersionResourceReference = DeploymentResourceIdReference.DeserializeDeploymentResourceIdReference(property.Value); + continue; + } + if (property.NameEquals("desiredStateConfigurationGroupValueReferences"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, JsonSerializer.Deserialize(property0.Value.GetRawText())); + } + desiredStateConfigurationGroupValueReferences = dictionary; + continue; + } + if (property.NameEquals("lastStateNetworkServiceDesignVersionName"u8)) + { + lastStateNetworkServiceDesignVersionName = property.Value.GetString(); + continue; + } + if (property.NameEquals("lastStateConfigurationGroupValueReferences"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, JsonSerializer.Deserialize(property0.Value.GetRawText())); + } + lastStateConfigurationGroupValueReferences = dictionary; + continue; + } + } + return new SiteNetworkServicePropertiesFormat(Optional.ToNullable(provisioningState), managedResourceGroupConfiguration.Value, siteReference, publisherName.Value, Optional.ToNullable(publisherScope), networkServiceDesignGroupName.Value, networkServiceDesignVersionName.Value, networkServiceDesignVersionOfferingLocation.Value, networkServiceDesignVersionResourceReference.Value, Optional.ToDictionary(desiredStateConfigurationGroupValueReferences), lastStateNetworkServiceDesignVersionName.Value, Optional.ToDictionary(lastStateConfigurationGroupValueReferences)); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/SiteNetworkServicePropertiesFormat.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/SiteNetworkServicePropertiesFormat.cs new file mode 100644 index 000000000000..ea2e08a527a9 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/SiteNetworkServicePropertiesFormat.cs @@ -0,0 +1,98 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.Resources.Models; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// Site network service properties. + public partial class SiteNetworkServicePropertiesFormat + { + /// Initializes a new instance of SiteNetworkServicePropertiesFormat. + public SiteNetworkServicePropertiesFormat() + { + DesiredStateConfigurationGroupValueReferences = new ChangeTrackingDictionary(); + LastStateConfigurationGroupValueReferences = new ChangeTrackingDictionary(); + } + + /// Initializes a new instance of SiteNetworkServicePropertiesFormat. + /// The provisioning state of the site network service resource. + /// Managed resource group configuration. + /// The site details. + /// The publisher name for the site network service. + /// The scope of the publisher. + /// The network service design group name for the site network service. + /// The network service design version for the site network service. + /// The location of the network service design offering. + /// + /// The network service design version resource reference. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include and . + /// + /// The goal state of the site network service resource. This has references to the configuration group value objects that describe the desired state of the site network service. + /// The network service design version for the site network service. + /// The last state of the site network service resource. + internal SiteNetworkServicePropertiesFormat(ProvisioningState? provisioningState, ManagedResourceGroupConfiguration managedResourceGroupConfiguration, WritableSubResource siteReference, string publisherName, PublisherScope? publisherScope, string networkServiceDesignGroupName, string networkServiceDesignVersionName, string networkServiceDesignVersionOfferingLocation, DeploymentResourceIdReference networkServiceDesignVersionResourceReference, IDictionary desiredStateConfigurationGroupValueReferences, string lastStateNetworkServiceDesignVersionName, IReadOnlyDictionary lastStateConfigurationGroupValueReferences) + { + ProvisioningState = provisioningState; + ManagedResourceGroupConfiguration = managedResourceGroupConfiguration; + SiteReference = siteReference; + PublisherName = publisherName; + PublisherScope = publisherScope; + NetworkServiceDesignGroupName = networkServiceDesignGroupName; + NetworkServiceDesignVersionName = networkServiceDesignVersionName; + NetworkServiceDesignVersionOfferingLocation = networkServiceDesignVersionOfferingLocation; + NetworkServiceDesignVersionResourceReference = networkServiceDesignVersionResourceReference; + DesiredStateConfigurationGroupValueReferences = desiredStateConfigurationGroupValueReferences; + LastStateNetworkServiceDesignVersionName = lastStateNetworkServiceDesignVersionName; + LastStateConfigurationGroupValueReferences = lastStateConfigurationGroupValueReferences; + } + + /// The provisioning state of the site network service resource. + public ProvisioningState? ProvisioningState { get; } + /// Managed resource group configuration. + public ManagedResourceGroupConfiguration ManagedResourceGroupConfiguration { get; set; } + /// The site details. + internal WritableSubResource SiteReference { get; set; } + /// Gets or sets Id. + public ResourceIdentifier SiteReferenceId + { + get => SiteReference is null ? default : SiteReference.Id; + set + { + if (SiteReference is null) + SiteReference = new WritableSubResource(); + SiteReference.Id = value; + } + } + + /// The publisher name for the site network service. + public string PublisherName { get; } + /// The scope of the publisher. + public PublisherScope? PublisherScope { get; } + /// The network service design group name for the site network service. + public string NetworkServiceDesignGroupName { get; } + /// The network service design version for the site network service. + public string NetworkServiceDesignVersionName { get; } + /// The location of the network service design offering. + public string NetworkServiceDesignVersionOfferingLocation { get; } + /// + /// The network service design version resource reference. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include and . + /// + public DeploymentResourceIdReference NetworkServiceDesignVersionResourceReference { get; set; } + /// The goal state of the site network service resource. This has references to the configuration group value objects that describe the desired state of the site network service. + public IDictionary DesiredStateConfigurationGroupValueReferences { get; } + /// The network service design version for the site network service. + public string LastStateNetworkServiceDesignVersionName { get; } + /// The last state of the site network service resource. + public IReadOnlyDictionary LastStateConfigurationGroupValueReferences { get; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/SitePropertiesFormat.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/SitePropertiesFormat.Serialization.cs new file mode 100644 index 000000000000..2ee914e7af63 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/SitePropertiesFormat.Serialization.cs @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Resources.Models; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class SitePropertiesFormat : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Nfvis)) + { + writer.WritePropertyName("nfvis"u8); + writer.WriteStartArray(); + foreach (var item in Nfvis) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + writer.WriteEndObject(); + } + + internal static SitePropertiesFormat DeserializeSitePropertiesFormat(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional provisioningState = default; + Optional> nfvis = default; + Optional> siteNetworkServiceReferences = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("provisioningState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new ProvisioningState(property.Value.GetString()); + continue; + } + if (property.NameEquals("nfvis"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(NFVIs.DeserializeNFVIs(item)); + } + nfvis = array; + continue; + } + if (property.NameEquals("siteNetworkServiceReferences"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(JsonSerializer.Deserialize(item.GetRawText())); + } + siteNetworkServiceReferences = array; + continue; + } + } + return new SitePropertiesFormat(Optional.ToNullable(provisioningState), Optional.ToList(nfvis), Optional.ToList(siteNetworkServiceReferences)); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/SitePropertiesFormat.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/SitePropertiesFormat.cs new file mode 100644 index 000000000000..05d9b7705286 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/SitePropertiesFormat.cs @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.Resources.Models; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// Site properties. + public partial class SitePropertiesFormat + { + /// Initializes a new instance of SitePropertiesFormat. + public SitePropertiesFormat() + { + Nfvis = new ChangeTrackingList(); + SiteNetworkServiceReferences = new ChangeTrackingList(); + } + + /// Initializes a new instance of SitePropertiesFormat. + /// The provisioning state of the site resource. **TODO**: Confirm if this is needed. + /// + /// List of NFVIs + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , and . + /// + /// The list of site network services on the site. + internal SitePropertiesFormat(ProvisioningState? provisioningState, IList nfvis, IReadOnlyList siteNetworkServiceReferences) + { + ProvisioningState = provisioningState; + Nfvis = nfvis; + SiteNetworkServiceReferences = siteNetworkServiceReferences; + } + + /// The provisioning state of the site resource. **TODO**: Confirm if this is needed. + public ProvisioningState? ProvisioningState { get; } + /// + /// List of NFVIs + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , and . + /// + public IList Nfvis { get; } + /// The list of site network services on the site. + public IReadOnlyList SiteNetworkServiceReferences { get; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/TagsObject.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/TagsObject.Serialization.cs new file mode 100644 index 000000000000..1e9f0baf1fd5 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/TagsObject.Serialization.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class TagsObject : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + 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(); + } + writer.WriteEndObject(); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/TagsObject.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/TagsObject.cs new file mode 100644 index 000000000000..30fb888be37f --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/TagsObject.cs @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// Tags object for patch operations. + public partial class TagsObject + { + /// Initializes a new instance of TagsObject. + public TagsObject() + { + Tags = new ChangeTrackingDictionary(); + } + + /// Resource tags. + public IDictionary Tags { get; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/TemplateType.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/TemplateType.cs new file mode 100644 index 000000000000..994ad779f3a9 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/TemplateType.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.HybridNetwork.Models +{ + /// The template type. + public readonly partial struct TemplateType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public TemplateType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string UnknownValue = "Unknown"; + private const string ArmTemplateValue = "ArmTemplate"; + + /// Unknown. + public static TemplateType Unknown { get; } = new TemplateType(UnknownValue); + /// ArmTemplate. + public static TemplateType ArmTemplate { get; } = new TemplateType(ArmTemplateValue); + /// Determines if two values are the same. + public static bool operator ==(TemplateType left, TemplateType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(TemplateType left, TemplateType right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator TemplateType(string value) => new TemplateType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is TemplateType other && Equals(other); + /// + public bool Equals(TemplateType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/Type.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/Type.cs new file mode 100644 index 000000000000..8285ee1fb3fb --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/Type.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.HybridNetwork.Models +{ + /// The resource element template type. + internal readonly partial struct Type : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public Type(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string UnknownValue = "Unknown"; + private const string ArmResourceDefinitionValue = "ArmResourceDefinition"; + private const string NetworkFunctionDefinitionValue = "NetworkFunctionDefinition"; + + /// Unknown. + public static Type Unknown { get; } = new Type(UnknownValue); + /// ArmResourceDefinition. + public static Type ArmResourceDefinition { get; } = new Type(ArmResourceDefinitionValue); + /// NetworkFunctionDefinition. + public static Type NetworkFunctionDefinition { get; } = new Type(NetworkFunctionDefinitionValue); + /// Determines if two values are the same. + public static bool operator ==(Type left, Type right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(Type left, Type right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator Type(string value) => new Type(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is Type other && Equals(other); + /// + public bool Equals(Type other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/UnknownArtifactAccessCredential.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/UnknownArtifactAccessCredential.Serialization.cs new file mode 100644 index 000000000000..ec764cb5e135 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/UnknownArtifactAccessCredential.Serialization.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + internal partial class UnknownArtifactAccessCredential + { + internal static UnknownArtifactAccessCredential DeserializeUnknownArtifactAccessCredential(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + CredentialType credentialType = "AutoRest.CSharp.Output.Models.Types.EnumTypeValue"; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("credentialType"u8)) + { + credentialType = new CredentialType(property.Value.GetString()); + continue; + } + } + return new UnknownArtifactAccessCredential(credentialType); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/UnknownArtifactAccessCredential.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/UnknownArtifactAccessCredential.cs new file mode 100644 index 000000000000..c4d9fda01e4a --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/UnknownArtifactAccessCredential.cs @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// The UnknownArtifactAccessCredential. + internal partial class UnknownArtifactAccessCredential : ArtifactAccessCredential + { + /// Initializes a new instance of UnknownArtifactAccessCredential. + /// The credential type. + internal UnknownArtifactAccessCredential(CredentialType credentialType) : base(credentialType) + { + CredentialType = credentialType; + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/UnknownConfigurationGroupValuePropertiesFormat.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/UnknownConfigurationGroupValuePropertiesFormat.Serialization.cs new file mode 100644 index 000000000000..25486e750c0a --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/UnknownConfigurationGroupValuePropertiesFormat.Serialization.cs @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + internal partial class UnknownConfigurationGroupValuePropertiesFormat : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(ConfigurationGroupSchemaResourceReference)) + { + writer.WritePropertyName("configurationGroupSchemaResourceReference"u8); + writer.WriteObjectValue(ConfigurationGroupSchemaResourceReference); + } + writer.WritePropertyName("configurationType"u8); + writer.WriteStringValue(ConfigurationType.ToString()); + writer.WriteEndObject(); + } + + internal static UnknownConfigurationGroupValuePropertiesFormat DeserializeUnknownConfigurationGroupValuePropertiesFormat(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional provisioningState = default; + Optional publisherName = default; + Optional publisherScope = default; + Optional configurationGroupSchemaName = default; + Optional configurationGroupSchemaOfferingLocation = default; + Optional configurationGroupSchemaResourceReference = default; + ConfigurationGroupValueConfigurationType configurationType = "AutoRest.CSharp.Output.Models.Types.EnumTypeValue"; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("provisioningState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new ProvisioningState(property.Value.GetString()); + continue; + } + if (property.NameEquals("publisherName"u8)) + { + publisherName = property.Value.GetString(); + continue; + } + if (property.NameEquals("publisherScope"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + publisherScope = new PublisherScope(property.Value.GetString()); + continue; + } + if (property.NameEquals("configurationGroupSchemaName"u8)) + { + configurationGroupSchemaName = property.Value.GetString(); + continue; + } + if (property.NameEquals("configurationGroupSchemaOfferingLocation"u8)) + { + configurationGroupSchemaOfferingLocation = property.Value.GetString(); + continue; + } + if (property.NameEquals("configurationGroupSchemaResourceReference"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + configurationGroupSchemaResourceReference = DeploymentResourceIdReference.DeserializeDeploymentResourceIdReference(property.Value); + continue; + } + if (property.NameEquals("configurationType"u8)) + { + configurationType = new ConfigurationGroupValueConfigurationType(property.Value.GetString()); + continue; + } + } + return new UnknownConfigurationGroupValuePropertiesFormat(Optional.ToNullable(provisioningState), publisherName.Value, Optional.ToNullable(publisherScope), configurationGroupSchemaName.Value, configurationGroupSchemaOfferingLocation.Value, configurationGroupSchemaResourceReference.Value, configurationType); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/UnknownConfigurationGroupValuePropertiesFormat.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/UnknownConfigurationGroupValuePropertiesFormat.cs new file mode 100644 index 000000000000..bf4597da8bf8 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/UnknownConfigurationGroupValuePropertiesFormat.cs @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// The UnknownConfigurationGroupValuePropertiesFormat. + internal partial class UnknownConfigurationGroupValuePropertiesFormat : ConfigurationGroupValuePropertiesFormat + { + /// Initializes a new instance of UnknownConfigurationGroupValuePropertiesFormat. + /// The provisioning state of the site resource. + /// The publisher name for the configuration group schema. + /// The scope of the publisher. + /// The configuration group schema name. + /// The location of the configuration group schema offering. + /// + /// The configuration group schema resource reference. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include and . + /// + /// The value which indicates if configuration values are secrets. + internal UnknownConfigurationGroupValuePropertiesFormat(ProvisioningState? provisioningState, string publisherName, PublisherScope? publisherScope, string configurationGroupSchemaName, string configurationGroupSchemaOfferingLocation, DeploymentResourceIdReference configurationGroupSchemaResourceReference, ConfigurationGroupValueConfigurationType configurationType) : base(provisioningState, publisherName, publisherScope, configurationGroupSchemaName, configurationGroupSchemaOfferingLocation, configurationGroupSchemaResourceReference, configurationType) + { + ConfigurationType = configurationType; + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/UnknownContainerizedNetworkFunctionTemplate.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/UnknownContainerizedNetworkFunctionTemplate.Serialization.cs new file mode 100644 index 000000000000..fec27e5335eb --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/UnknownContainerizedNetworkFunctionTemplate.Serialization.cs @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + internal partial class UnknownContainerizedNetworkFunctionTemplate : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("nfviType"u8); + writer.WriteStringValue(NfviType.ToString()); + writer.WriteEndObject(); + } + + internal static UnknownContainerizedNetworkFunctionTemplate DeserializeUnknownContainerizedNetworkFunctionTemplate(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ContainerizedNetworkFunctionNfviType nfviType = "AutoRest.CSharp.Output.Models.Types.EnumTypeValue"; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("nfviType"u8)) + { + nfviType = new ContainerizedNetworkFunctionNfviType(property.Value.GetString()); + continue; + } + } + return new UnknownContainerizedNetworkFunctionTemplate(nfviType); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/UnknownContainerizedNetworkFunctionTemplate.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/UnknownContainerizedNetworkFunctionTemplate.cs new file mode 100644 index 000000000000..231f93837a07 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/UnknownContainerizedNetworkFunctionTemplate.cs @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// The UnknownContainerizedNetworkFunctionTemplate. + internal partial class UnknownContainerizedNetworkFunctionTemplate : ContainerizedNetworkFunctionTemplate + { + /// Initializes a new instance of UnknownContainerizedNetworkFunctionTemplate. + /// The network function type. + internal UnknownContainerizedNetworkFunctionTemplate(ContainerizedNetworkFunctionNfviType nfviType) : base(nfviType) + { + NfviType = nfviType; + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/UnknownDeploymentResourceIdReference.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/UnknownDeploymentResourceIdReference.Serialization.cs new file mode 100644 index 000000000000..29f0115e6755 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/UnknownDeploymentResourceIdReference.Serialization.cs @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + internal partial class UnknownDeploymentResourceIdReference : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("idType"u8); + writer.WriteStringValue(IdType.ToString()); + writer.WriteEndObject(); + } + + internal static UnknownDeploymentResourceIdReference DeserializeUnknownDeploymentResourceIdReference(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IdType idType = "AutoRest.CSharp.Output.Models.Types.EnumTypeValue"; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("idType"u8)) + { + idType = new IdType(property.Value.GetString()); + continue; + } + } + return new UnknownDeploymentResourceIdReference(idType); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/UnknownDeploymentResourceIdReference.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/UnknownDeploymentResourceIdReference.cs new file mode 100644 index 000000000000..8a66e2584d1c --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/UnknownDeploymentResourceIdReference.cs @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// The UnknownDeploymentResourceIdReference. + internal partial class UnknownDeploymentResourceIdReference : DeploymentResourceIdReference + { + /// Initializes a new instance of UnknownDeploymentResourceIdReference. + /// The resource reference arm id type. + internal UnknownDeploymentResourceIdReference(IdType idType) : base(idType) + { + IdType = idType; + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/UnknownNFVIs.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/UnknownNFVIs.Serialization.cs new file mode 100644 index 000000000000..ad3520038bd5 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/UnknownNFVIs.Serialization.cs @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + internal partial class UnknownNFVIs : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + writer.WritePropertyName("nfviType"u8); + writer.WriteStringValue(NfviType.ToString()); + writer.WriteEndObject(); + } + + internal static UnknownNFVIs DeserializeUnknownNFVIs(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional name = default; + NfviType nfviType = "AutoRest.CSharp.Output.Models.Types.EnumTypeValue"; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("nfviType"u8)) + { + nfviType = new NfviType(property.Value.GetString()); + continue; + } + } + return new UnknownNFVIs(name.Value, nfviType); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/UnknownNFVIs.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/UnknownNFVIs.cs new file mode 100644 index 000000000000..cc517de24a85 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/UnknownNFVIs.cs @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// The UnknownNFVIs. + internal partial class UnknownNFVIs : NFVIs + { + /// Initializes a new instance of UnknownNFVIs. + /// Name of the nfvi. + /// The NFVI type. + internal UnknownNFVIs(string name, NfviType nfviType) : base(name, nfviType) + { + NfviType = nfviType; + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/UnknownNetworkFunctionDefinitionVersionPropertiesFormat.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/UnknownNetworkFunctionDefinitionVersionPropertiesFormat.Serialization.cs new file mode 100644 index 000000000000..3b00c73f6e77 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/UnknownNetworkFunctionDefinitionVersionPropertiesFormat.Serialization.cs @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + internal partial class UnknownNetworkFunctionDefinitionVersionPropertiesFormat : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Description)) + { + writer.WritePropertyName("description"u8); + writer.WriteStringValue(Description); + } + if (Optional.IsDefined(DeployParameters)) + { + writer.WritePropertyName("deployParameters"u8); + writer.WriteStringValue(DeployParameters); + } + writer.WritePropertyName("networkFunctionType"u8); + writer.WriteStringValue(NetworkFunctionType.ToString()); + writer.WriteEndObject(); + } + + internal static UnknownNetworkFunctionDefinitionVersionPropertiesFormat DeserializeUnknownNetworkFunctionDefinitionVersionPropertiesFormat(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional provisioningState = default; + Optional versionState = default; + Optional description = default; + Optional deployParameters = default; + NetworkFunctionType networkFunctionType = "AutoRest.CSharp.Output.Models.Types.EnumTypeValue"; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("provisioningState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new ProvisioningState(property.Value.GetString()); + continue; + } + if (property.NameEquals("versionState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + versionState = new VersionState(property.Value.GetString()); + continue; + } + if (property.NameEquals("description"u8)) + { + description = property.Value.GetString(); + continue; + } + if (property.NameEquals("deployParameters"u8)) + { + deployParameters = property.Value.GetString(); + continue; + } + if (property.NameEquals("networkFunctionType"u8)) + { + networkFunctionType = new NetworkFunctionType(property.Value.GetString()); + continue; + } + } + return new UnknownNetworkFunctionDefinitionVersionPropertiesFormat(Optional.ToNullable(provisioningState), Optional.ToNullable(versionState), description.Value, deployParameters.Value, networkFunctionType); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/UnknownNetworkFunctionDefinitionVersionPropertiesFormat.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/UnknownNetworkFunctionDefinitionVersionPropertiesFormat.cs new file mode 100644 index 000000000000..1ef0f57cf413 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/UnknownNetworkFunctionDefinitionVersionPropertiesFormat.cs @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// The UnknownNetworkFunctionDefinitionVersionPropertiesFormat. + internal partial class UnknownNetworkFunctionDefinitionVersionPropertiesFormat : NetworkFunctionDefinitionVersionPropertiesFormat + { + /// Initializes a new instance of UnknownNetworkFunctionDefinitionVersionPropertiesFormat. + /// The provisioning state of the network function definition version resource. + /// The network function definition version state. + /// The network function definition version description. + /// The deployment parameters of the network function definition version. + /// The network function type. + internal UnknownNetworkFunctionDefinitionVersionPropertiesFormat(ProvisioningState? provisioningState, VersionState? versionState, string description, string deployParameters, NetworkFunctionType networkFunctionType) : base(provisioningState, versionState, description, deployParameters, networkFunctionType) + { + NetworkFunctionType = networkFunctionType; + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/UnknownNetworkFunctionPropertiesFormat.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/UnknownNetworkFunctionPropertiesFormat.Serialization.cs new file mode 100644 index 000000000000..0d72c42e216e --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/UnknownNetworkFunctionPropertiesFormat.Serialization.cs @@ -0,0 +1,171 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + internal partial class UnknownNetworkFunctionPropertiesFormat : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(NetworkFunctionDefinitionVersionResourceReference)) + { + writer.WritePropertyName("networkFunctionDefinitionVersionResourceReference"u8); + writer.WriteObjectValue(NetworkFunctionDefinitionVersionResourceReference); + } + if (Optional.IsDefined(NfviType)) + { + writer.WritePropertyName("nfviType"u8); + writer.WriteStringValue(NfviType.Value.ToString()); + } + if (Optional.IsDefined(NfviId)) + { + writer.WritePropertyName("nfviId"u8); + writer.WriteStringValue(NfviId); + } + if (Optional.IsDefined(AllowSoftwareUpdate)) + { + writer.WritePropertyName("allowSoftwareUpdate"u8); + writer.WriteBooleanValue(AllowSoftwareUpdate.Value); + } + writer.WritePropertyName("configurationType"u8); + writer.WriteStringValue(ConfigurationType.ToString()); + if (Optional.IsCollectionDefined(RoleOverrideValues)) + { + writer.WritePropertyName("roleOverrideValues"u8); + writer.WriteStartArray(); + foreach (var item in RoleOverrideValues) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + writer.WriteEndObject(); + } + + internal static UnknownNetworkFunctionPropertiesFormat DeserializeUnknownNetworkFunctionPropertiesFormat(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional provisioningState = default; + Optional publisherName = default; + Optional publisherScope = default; + Optional networkFunctionDefinitionGroupName = default; + Optional networkFunctionDefinitionVersion = default; + Optional networkFunctionDefinitionOfferingLocation = default; + Optional networkFunctionDefinitionVersionResourceReference = default; + Optional nfviType = default; + Optional nfviId = default; + Optional allowSoftwareUpdate = default; + NetworkFunctionConfigurationType configurationType = "AutoRest.CSharp.Output.Models.Types.EnumTypeValue"; + Optional> roleOverrideValues = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("provisioningState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new ProvisioningState(property.Value.GetString()); + continue; + } + if (property.NameEquals("publisherName"u8)) + { + publisherName = property.Value.GetString(); + continue; + } + if (property.NameEquals("publisherScope"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + publisherScope = new PublisherScope(property.Value.GetString()); + continue; + } + if (property.NameEquals("networkFunctionDefinitionGroupName"u8)) + { + networkFunctionDefinitionGroupName = property.Value.GetString(); + continue; + } + if (property.NameEquals("networkFunctionDefinitionVersion"u8)) + { + networkFunctionDefinitionVersion = property.Value.GetString(); + continue; + } + if (property.NameEquals("networkFunctionDefinitionOfferingLocation"u8)) + { + networkFunctionDefinitionOfferingLocation = property.Value.GetString(); + continue; + } + if (property.NameEquals("networkFunctionDefinitionVersionResourceReference"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + networkFunctionDefinitionVersionResourceReference = DeploymentResourceIdReference.DeserializeDeploymentResourceIdReference(property.Value); + continue; + } + if (property.NameEquals("nfviType"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nfviType = new NfviType(property.Value.GetString()); + continue; + } + if (property.NameEquals("nfviId"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nfviId = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("allowSoftwareUpdate"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + allowSoftwareUpdate = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("configurationType"u8)) + { + configurationType = new NetworkFunctionConfigurationType(property.Value.GetString()); + continue; + } + if (property.NameEquals("roleOverrideValues"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + roleOverrideValues = array; + continue; + } + } + return new UnknownNetworkFunctionPropertiesFormat(Optional.ToNullable(provisioningState), publisherName.Value, Optional.ToNullable(publisherScope), networkFunctionDefinitionGroupName.Value, networkFunctionDefinitionVersion.Value, networkFunctionDefinitionOfferingLocation.Value, networkFunctionDefinitionVersionResourceReference.Value, Optional.ToNullable(nfviType), nfviId.Value, Optional.ToNullable(allowSoftwareUpdate), configurationType, Optional.ToList(roleOverrideValues)); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/UnknownNetworkFunctionPropertiesFormat.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/UnknownNetworkFunctionPropertiesFormat.cs new file mode 100644 index 000000000000..a7277d6bc8c1 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/UnknownNetworkFunctionPropertiesFormat.cs @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// The UnknownNetworkFunctionPropertiesFormat. + internal partial class UnknownNetworkFunctionPropertiesFormat : NetworkFunctionPropertiesFormat + { + /// Initializes a new instance of UnknownNetworkFunctionPropertiesFormat. + /// The provisioning state of the network function resource. + /// The publisher name for the network function. + /// The scope of the publisher. + /// The network function definition group name for the network function. + /// The network function definition version for the network function. + /// The location of the network function definition offering. + /// + /// The network function definition version resource reference. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include and . + /// + /// The nfvi type for the network function. + /// The nfviId for the network function. + /// Indicates if software updates are allowed during deployment. + /// The value which indicates if NF values are secrets. + /// The role configuration override values from the user. + internal UnknownNetworkFunctionPropertiesFormat(ProvisioningState? provisioningState, string publisherName, PublisherScope? publisherScope, string networkFunctionDefinitionGroupName, string networkFunctionDefinitionVersion, string networkFunctionDefinitionOfferingLocation, DeploymentResourceIdReference networkFunctionDefinitionVersionResourceReference, NfviType? nfviType, ResourceIdentifier nfviId, bool? allowSoftwareUpdate, NetworkFunctionConfigurationType configurationType, IList roleOverrideValues) : base(provisioningState, publisherName, publisherScope, networkFunctionDefinitionGroupName, networkFunctionDefinitionVersion, networkFunctionDefinitionOfferingLocation, networkFunctionDefinitionVersionResourceReference, nfviType, nfviId, allowSoftwareUpdate, configurationType, roleOverrideValues) + { + ConfigurationType = configurationType; + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/UnknownResourceElementTemplate.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/UnknownResourceElementTemplate.Serialization.cs new file mode 100644 index 000000000000..df6caf9a7b0d --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/UnknownResourceElementTemplate.Serialization.cs @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + internal partial class UnknownResourceElementTemplate : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + writer.WritePropertyName("type"u8); + writer.WriteStringValue(ResourceElementType.ToString()); + if (Optional.IsDefined(DependsOnProfile)) + { + writer.WritePropertyName("dependsOnProfile"u8); + writer.WriteObjectValue(DependsOnProfile); + } + writer.WriteEndObject(); + } + + internal static UnknownResourceElementTemplate DeserializeUnknownResourceElementTemplate(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional name = default; + Type type = "AutoRest.CSharp.Output.Models.Types.EnumTypeValue"; + Optional dependsOnProfile = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new Type(property.Value.GetString()); + continue; + } + if (property.NameEquals("dependsOnProfile"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + dependsOnProfile = DependsOnProfile.DeserializeDependsOnProfile(property.Value); + continue; + } + } + return new UnknownResourceElementTemplate(name.Value, type, dependsOnProfile.Value); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/UnknownResourceElementTemplate.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/UnknownResourceElementTemplate.cs new file mode 100644 index 000000000000..e532a946be0d --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/UnknownResourceElementTemplate.cs @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// The UnknownResourceElementTemplate. + internal partial class UnknownResourceElementTemplate : ResourceElementTemplate + { + /// Initializes a new instance of UnknownResourceElementTemplate. + /// Name of the resource element template. + /// The resource element template type. + /// The depends on profile. + internal UnknownResourceElementTemplate(string name, Type resourceElementType, DependsOnProfile dependsOnProfile) : base(name, resourceElementType, dependsOnProfile) + { + ResourceElementType = resourceElementType; + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/UnknownVirtualNetworkFunctionTemplate.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/UnknownVirtualNetworkFunctionTemplate.Serialization.cs new file mode 100644 index 000000000000..4fe6b9ef886c --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/UnknownVirtualNetworkFunctionTemplate.Serialization.cs @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + internal partial class UnknownVirtualNetworkFunctionTemplate : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("nfviType"u8); + writer.WriteStringValue(NfviType.ToString()); + writer.WriteEndObject(); + } + + internal static UnknownVirtualNetworkFunctionTemplate DeserializeUnknownVirtualNetworkFunctionTemplate(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + VirtualNetworkFunctionNfviType nfviType = "AutoRest.CSharp.Output.Models.Types.EnumTypeValue"; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("nfviType"u8)) + { + nfviType = new VirtualNetworkFunctionNfviType(property.Value.GetString()); + continue; + } + } + return new UnknownVirtualNetworkFunctionTemplate(nfviType); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/UnknownVirtualNetworkFunctionTemplate.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/UnknownVirtualNetworkFunctionTemplate.cs new file mode 100644 index 000000000000..3553e98bcafb --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/UnknownVirtualNetworkFunctionTemplate.cs @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// The UnknownVirtualNetworkFunctionTemplate. + internal partial class UnknownVirtualNetworkFunctionTemplate : VirtualNetworkFunctionTemplate + { + /// Initializes a new instance of UnknownVirtualNetworkFunctionTemplate. + /// The network function type. + internal UnknownVirtualNetworkFunctionTemplate(VirtualNetworkFunctionNfviType nfviType) : base(nfviType) + { + NfviType = nfviType; + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/VersionState.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/VersionState.cs new file mode 100644 index 000000000000..9a7b88876eef --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/VersionState.cs @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// The configuration group schema state. + public readonly partial struct VersionState : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public VersionState(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string UnknownValue = "Unknown"; + private const string PreviewValue = "Preview"; + private const string ActiveValue = "Active"; + private const string DeprecatedValue = "Deprecated"; + private const string ValidatingValue = "Validating"; + private const string ValidationFailedValue = "ValidationFailed"; + + /// Unknown. + public static VersionState Unknown { get; } = new VersionState(UnknownValue); + /// Preview. + public static VersionState Preview { get; } = new VersionState(PreviewValue); + /// Active. + public static VersionState Active { get; } = new VersionState(ActiveValue); + /// Deprecated. + public static VersionState Deprecated { get; } = new VersionState(DeprecatedValue); + /// Validating. + public static VersionState Validating { get; } = new VersionState(ValidatingValue); + /// ValidationFailed. + public static VersionState ValidationFailed { get; } = new VersionState(ValidationFailedValue); + /// Determines if two values are the same. + public static bool operator ==(VersionState left, VersionState right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(VersionState left, VersionState right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator VersionState(string value) => new VersionState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is VersionState other && Equals(other); + /// + public bool Equals(VersionState other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/VhdImageArtifactProfile.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/VhdImageArtifactProfile.Serialization.cs new file mode 100644 index 000000000000..553438093dc1 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/VhdImageArtifactProfile.Serialization.cs @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class VhdImageArtifactProfile : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(VhdName)) + { + writer.WritePropertyName("vhdName"u8); + writer.WriteStringValue(VhdName); + } + if (Optional.IsDefined(VhdVersion)) + { + writer.WritePropertyName("vhdVersion"u8); + writer.WriteStringValue(VhdVersion); + } + writer.WriteEndObject(); + } + + internal static VhdImageArtifactProfile DeserializeVhdImageArtifactProfile(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional vhdName = default; + Optional vhdVersion = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("vhdName"u8)) + { + vhdName = property.Value.GetString(); + continue; + } + if (property.NameEquals("vhdVersion"u8)) + { + vhdVersion = property.Value.GetString(); + continue; + } + } + return new VhdImageArtifactProfile(vhdName.Value, vhdVersion.Value); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/VhdImageArtifactProfile.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/VhdImageArtifactProfile.cs new file mode 100644 index 000000000000..f5d9f369e8c7 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/VhdImageArtifactProfile.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// Vhd artifact profile. + public partial class VhdImageArtifactProfile + { + /// Initializes a new instance of VhdImageArtifactProfile. + public VhdImageArtifactProfile() + { + } + + /// Initializes a new instance of VhdImageArtifactProfile. + /// Vhd name. + /// Vhd version. + internal VhdImageArtifactProfile(string vhdName, string vhdVersion) + { + VhdName = vhdName; + VhdVersion = vhdVersion; + } + + /// Vhd name. + public string VhdName { get; set; } + /// Vhd version. + public string VhdVersion { get; set; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/VhdImageMappingRuleProfile.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/VhdImageMappingRuleProfile.Serialization.cs new file mode 100644 index 000000000000..02685fdb4f0f --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/VhdImageMappingRuleProfile.Serialization.cs @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + internal partial class VhdImageMappingRuleProfile : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(UserConfiguration)) + { + writer.WritePropertyName("userConfiguration"u8); + writer.WriteStringValue(UserConfiguration); + } + writer.WriteEndObject(); + } + + internal static VhdImageMappingRuleProfile DeserializeVhdImageMappingRuleProfile(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional userConfiguration = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("userConfiguration"u8)) + { + userConfiguration = property.Value.GetString(); + continue; + } + } + return new VhdImageMappingRuleProfile(userConfiguration.Value); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/VhdImageMappingRuleProfile.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/VhdImageMappingRuleProfile.cs new file mode 100644 index 000000000000..53e8f8e6a97e --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/VhdImageMappingRuleProfile.cs @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// Vhd mapping rule profile. + internal partial class VhdImageMappingRuleProfile + { + /// Initializes a new instance of VhdImageMappingRuleProfile. + public VhdImageMappingRuleProfile() + { + } + + /// Initializes a new instance of VhdImageMappingRuleProfile. + /// List of values. + internal VhdImageMappingRuleProfile(string userConfiguration) + { + UserConfiguration = userConfiguration; + } + + /// List of values. + public string UserConfiguration { get; set; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/VirtualNetworkFunctionDefinitionVersion.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/VirtualNetworkFunctionDefinitionVersion.Serialization.cs new file mode 100644 index 000000000000..e9b600614f2f --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/VirtualNetworkFunctionDefinitionVersion.Serialization.cs @@ -0,0 +1,98 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class VirtualNetworkFunctionDefinitionVersion : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(NetworkFunctionTemplate)) + { + writer.WritePropertyName("networkFunctionTemplate"u8); + writer.WriteObjectValue(NetworkFunctionTemplate); + } + if (Optional.IsDefined(Description)) + { + writer.WritePropertyName("description"u8); + writer.WriteStringValue(Description); + } + if (Optional.IsDefined(DeployParameters)) + { + writer.WritePropertyName("deployParameters"u8); + writer.WriteStringValue(DeployParameters); + } + writer.WritePropertyName("networkFunctionType"u8); + writer.WriteStringValue(NetworkFunctionType.ToString()); + writer.WriteEndObject(); + } + + internal static VirtualNetworkFunctionDefinitionVersion DeserializeVirtualNetworkFunctionDefinitionVersion(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional networkFunctionTemplate = default; + Optional provisioningState = default; + Optional versionState = default; + Optional description = default; + Optional deployParameters = default; + NetworkFunctionType networkFunctionType = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("networkFunctionTemplate"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + networkFunctionTemplate = VirtualNetworkFunctionTemplate.DeserializeVirtualNetworkFunctionTemplate(property.Value); + continue; + } + if (property.NameEquals("provisioningState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new ProvisioningState(property.Value.GetString()); + continue; + } + if (property.NameEquals("versionState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + versionState = new VersionState(property.Value.GetString()); + continue; + } + if (property.NameEquals("description"u8)) + { + description = property.Value.GetString(); + continue; + } + if (property.NameEquals("deployParameters"u8)) + { + deployParameters = property.Value.GetString(); + continue; + } + if (property.NameEquals("networkFunctionType"u8)) + { + networkFunctionType = new NetworkFunctionType(property.Value.GetString()); + continue; + } + } + return new VirtualNetworkFunctionDefinitionVersion(Optional.ToNullable(provisioningState), Optional.ToNullable(versionState), description.Value, deployParameters.Value, networkFunctionType, networkFunctionTemplate.Value); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/VirtualNetworkFunctionDefinitionVersion.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/VirtualNetworkFunctionDefinitionVersion.cs new file mode 100644 index 000000000000..6f31f3bfc647 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/VirtualNetworkFunctionDefinitionVersion.cs @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// Virtual network function network function definition version properties. + public partial class VirtualNetworkFunctionDefinitionVersion : NetworkFunctionDefinitionVersionPropertiesFormat + { + /// Initializes a new instance of VirtualNetworkFunctionDefinitionVersion. + public VirtualNetworkFunctionDefinitionVersion() + { + NetworkFunctionType = NetworkFunctionType.VirtualNetworkFunction; + } + + /// Initializes a new instance of VirtualNetworkFunctionDefinitionVersion. + /// The provisioning state of the network function definition version resource. + /// The network function definition version state. + /// The network function definition version description. + /// The deployment parameters of the network function definition version. + /// The network function type. + /// + /// Virtual network function template. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include and . + /// + internal VirtualNetworkFunctionDefinitionVersion(ProvisioningState? provisioningState, VersionState? versionState, string description, string deployParameters, NetworkFunctionType networkFunctionType, VirtualNetworkFunctionTemplate networkFunctionTemplate) : base(provisioningState, versionState, description, deployParameters, networkFunctionType) + { + NetworkFunctionTemplate = networkFunctionTemplate; + NetworkFunctionType = networkFunctionType; + } + + /// + /// Virtual network function template. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include and . + /// + public VirtualNetworkFunctionTemplate NetworkFunctionTemplate { get; set; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/VirtualNetworkFunctionNfviType.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/VirtualNetworkFunctionNfviType.cs new file mode 100644 index 000000000000..ac2183a73c7a --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/VirtualNetworkFunctionNfviType.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.HybridNetwork.Models +{ + /// The network function type. + internal readonly partial struct VirtualNetworkFunctionNfviType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public VirtualNetworkFunctionNfviType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string UnknownValue = "Unknown"; + private const string AzureCoreValue = "AzureCore"; + private const string AzureOperatorNexusValue = "AzureOperatorNexus"; + + /// Unknown. + public static VirtualNetworkFunctionNfviType Unknown { get; } = new VirtualNetworkFunctionNfviType(UnknownValue); + /// AzureCore. + public static VirtualNetworkFunctionNfviType AzureCore { get; } = new VirtualNetworkFunctionNfviType(AzureCoreValue); + /// AzureOperatorNexus. + public static VirtualNetworkFunctionNfviType AzureOperatorNexus { get; } = new VirtualNetworkFunctionNfviType(AzureOperatorNexusValue); + /// Determines if two values are the same. + public static bool operator ==(VirtualNetworkFunctionNfviType left, VirtualNetworkFunctionNfviType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(VirtualNetworkFunctionNfviType left, VirtualNetworkFunctionNfviType right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator VirtualNetworkFunctionNfviType(string value) => new VirtualNetworkFunctionNfviType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is VirtualNetworkFunctionNfviType other && Equals(other); + /// + public bool Equals(VirtualNetworkFunctionNfviType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/VirtualNetworkFunctionTemplate.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/VirtualNetworkFunctionTemplate.Serialization.cs new file mode 100644 index 000000000000..f9de401e736b --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/VirtualNetworkFunctionTemplate.Serialization.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class VirtualNetworkFunctionTemplate : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("nfviType"u8); + writer.WriteStringValue(NfviType.ToString()); + writer.WriteEndObject(); + } + + internal static VirtualNetworkFunctionTemplate DeserializeVirtualNetworkFunctionTemplate(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + if (element.TryGetProperty("nfviType", out JsonElement discriminator)) + { + switch (discriminator.GetString()) + { + case "AzureCore": return AzureCoreNetworkFunctionTemplate.DeserializeAzureCoreNetworkFunctionTemplate(element); + case "AzureOperatorNexus": return AzureOperatorNexusNetworkFunctionTemplate.DeserializeAzureOperatorNexusNetworkFunctionTemplate(element); + } + } + return UnknownVirtualNetworkFunctionTemplate.DeserializeUnknownVirtualNetworkFunctionTemplate(element); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/VirtualNetworkFunctionTemplate.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/VirtualNetworkFunctionTemplate.cs new file mode 100644 index 000000000000..2169f448afb4 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/VirtualNetworkFunctionTemplate.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// + /// Virtual network function template. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include and . + /// + public abstract partial class VirtualNetworkFunctionTemplate + { + /// Initializes a new instance of VirtualNetworkFunctionTemplate. + protected VirtualNetworkFunctionTemplate() + { + } + + /// Initializes a new instance of VirtualNetworkFunctionTemplate. + /// The network function type. + internal VirtualNetworkFunctionTemplate(VirtualNetworkFunctionNfviType nfviType) + { + NfviType = nfviType; + } + + /// The network function type. + internal VirtualNetworkFunctionNfviType NfviType { get; set; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/NetworkFunctionCollection.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/NetworkFunctionCollection.cs new file mode 100644 index 000000000000..3d86a609c20d --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/NetworkFunctionCollection.cs @@ -0,0 +1,416 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.HybridNetwork +{ + /// + /// 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 GetNetworkFunctions method from an instance of . + /// + public partial class NetworkFunctionCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _networkFunctionClientDiagnostics; + private readonly NetworkFunctionsRestOperations _networkFunctionRestClient; + + /// Initializes a new instance of the class for mocking. + protected NetworkFunctionCollection() + { + } + + /// 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 NetworkFunctionCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _networkFunctionClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.HybridNetwork", NetworkFunctionResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(NetworkFunctionResource.ResourceType, out string networkFunctionApiVersion); + _networkFunctionRestClient = new NetworkFunctionsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, networkFunctionApiVersion); +#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)); + } + + /// + /// Creates or updates a network function resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/networkFunctions/{networkFunctionName} + /// + /// + /// Operation Id + /// NetworkFunctions_CreateOrUpdate + /// + /// + /// + /// 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. + /// Resource name for the network function resource. + /// Parameters supplied in the body to the create or update network function operation. + /// 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 networkFunctionName, NetworkFunctionData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(networkFunctionName, nameof(networkFunctionName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _networkFunctionClientDiagnostics.CreateScope("NetworkFunctionCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _networkFunctionRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, networkFunctionName, data, cancellationToken).ConfigureAwait(false); + var operation = new HybridNetworkArmOperation(new NetworkFunctionOperationSource(Client), _networkFunctionClientDiagnostics, Pipeline, _networkFunctionRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, networkFunctionName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates or updates a network function resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/networkFunctions/{networkFunctionName} + /// + /// + /// Operation Id + /// NetworkFunctions_CreateOrUpdate + /// + /// + /// + /// 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. + /// Resource name for the network function resource. + /// Parameters supplied in the body to the create or update network function operation. + /// 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 networkFunctionName, NetworkFunctionData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(networkFunctionName, nameof(networkFunctionName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _networkFunctionClientDiagnostics.CreateScope("NetworkFunctionCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _networkFunctionRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, networkFunctionName, data, cancellationToken); + var operation = new HybridNetworkArmOperation(new NetworkFunctionOperationSource(Client), _networkFunctionClientDiagnostics, Pipeline, _networkFunctionRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, networkFunctionName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets information about the specified network function resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/networkFunctions/{networkFunctionName} + /// + /// + /// Operation Id + /// NetworkFunctions_Get + /// + /// + /// + /// The name of the network function resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string networkFunctionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(networkFunctionName, nameof(networkFunctionName)); + + using var scope = _networkFunctionClientDiagnostics.CreateScope("NetworkFunctionCollection.Get"); + scope.Start(); + try + { + var response = await _networkFunctionRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, networkFunctionName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new NetworkFunctionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets information about the specified network function resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/networkFunctions/{networkFunctionName} + /// + /// + /// Operation Id + /// NetworkFunctions_Get + /// + /// + /// + /// The name of the network function resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string networkFunctionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(networkFunctionName, nameof(networkFunctionName)); + + using var scope = _networkFunctionClientDiagnostics.CreateScope("NetworkFunctionCollection.Get"); + scope.Start(); + try + { + var response = _networkFunctionRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, networkFunctionName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new NetworkFunctionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Lists all the network function resources in a resource group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/networkFunctions + /// + /// + /// Operation Id + /// NetworkFunctions_ListByResourceGroup + /// + /// + /// + /// 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) => _networkFunctionRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _networkFunctionRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new NetworkFunctionResource(Client, NetworkFunctionData.DeserializeNetworkFunctionData(e)), _networkFunctionClientDiagnostics, Pipeline, "NetworkFunctionCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Lists all the network function resources in a resource group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/networkFunctions + /// + /// + /// Operation Id + /// NetworkFunctions_ListByResourceGroup + /// + /// + /// + /// 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) => _networkFunctionRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _networkFunctionRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new NetworkFunctionResource(Client, NetworkFunctionData.DeserializeNetworkFunctionData(e)), _networkFunctionClientDiagnostics, Pipeline, "NetworkFunctionCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/networkFunctions/{networkFunctionName} + /// + /// + /// Operation Id + /// NetworkFunctions_Get + /// + /// + /// + /// The name of the network function resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string networkFunctionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(networkFunctionName, nameof(networkFunctionName)); + + using var scope = _networkFunctionClientDiagnostics.CreateScope("NetworkFunctionCollection.Exists"); + scope.Start(); + try + { + var response = await _networkFunctionRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, networkFunctionName, 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.HybridNetwork/networkFunctions/{networkFunctionName} + /// + /// + /// Operation Id + /// NetworkFunctions_Get + /// + /// + /// + /// The name of the network function resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string networkFunctionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(networkFunctionName, nameof(networkFunctionName)); + + using var scope = _networkFunctionClientDiagnostics.CreateScope("NetworkFunctionCollection.Exists"); + scope.Start(); + try + { + var response = _networkFunctionRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, networkFunctionName, 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.HybridNetwork/networkFunctions/{networkFunctionName} + /// + /// + /// Operation Id + /// NetworkFunctions_Get + /// + /// + /// + /// The name of the network function resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string networkFunctionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(networkFunctionName, nameof(networkFunctionName)); + + using var scope = _networkFunctionClientDiagnostics.CreateScope("NetworkFunctionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _networkFunctionRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, networkFunctionName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NetworkFunctionResource(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.HybridNetwork/networkFunctions/{networkFunctionName} + /// + /// + /// Operation Id + /// NetworkFunctions_Get + /// + /// + /// + /// The name of the network function resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string networkFunctionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(networkFunctionName, nameof(networkFunctionName)); + + using var scope = _networkFunctionClientDiagnostics.CreateScope("NetworkFunctionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _networkFunctionRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, networkFunctionName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NetworkFunctionResource(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/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/NetworkFunctionData.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/NetworkFunctionData.cs new file mode 100644 index 000000000000..cd33fad0ca90 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/NetworkFunctionData.cs @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure; +using Azure.Core; +using Azure.ResourceManager.HybridNetwork.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.HybridNetwork +{ + /// + /// A class representing the NetworkFunction data model. + /// Network function resource response. + /// + public partial class NetworkFunctionData : TrackedResourceData + { + /// Initializes a new instance of NetworkFunctionData. + /// The location. + public NetworkFunctionData(AzureLocation location) : base(location) + { + } + + /// Initializes a new instance of NetworkFunctionData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The tags. + /// The location. + /// + /// Network function properties. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include and . + /// + /// A unique read-only string that changes whenever the resource is updated. + /// The managed identity of the network function. + internal NetworkFunctionData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, NetworkFunctionPropertiesFormat properties, ETag? etag, ManagedServiceIdentity identity) : base(id, name, resourceType, systemData, tags, location) + { + Properties = properties; + ETag = etag; + Identity = identity; + } + + /// + /// Network function properties. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include and . + /// + public NetworkFunctionPropertiesFormat Properties { get; set; } + /// A unique read-only string that changes whenever the resource is updated. + public ETag? ETag { get; set; } + /// The managed identity of the network function. + public ManagedServiceIdentity Identity { get; set; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/NetworkFunctionDefinitionGroupCollection.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/NetworkFunctionDefinitionGroupCollection.cs new file mode 100644 index 000000000000..32568353dd21 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/NetworkFunctionDefinitionGroupCollection.cs @@ -0,0 +1,415 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.HybridNetwork +{ + /// + /// 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 GetNetworkFunctionDefinitionGroups method from an instance of . + /// + public partial class NetworkFunctionDefinitionGroupCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _networkFunctionDefinitionGroupClientDiagnostics; + private readonly NetworkFunctionDefinitionGroupsRestOperations _networkFunctionDefinitionGroupRestClient; + + /// Initializes a new instance of the class for mocking. + protected NetworkFunctionDefinitionGroupCollection() + { + } + + /// 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 NetworkFunctionDefinitionGroupCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _networkFunctionDefinitionGroupClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.HybridNetwork", NetworkFunctionDefinitionGroupResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(NetworkFunctionDefinitionGroupResource.ResourceType, out string networkFunctionDefinitionGroupApiVersion); + _networkFunctionDefinitionGroupRestClient = new NetworkFunctionDefinitionGroupsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, networkFunctionDefinitionGroupApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != PublisherResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, PublisherResource.ResourceType), nameof(id)); + } + + /// + /// Creates or updates a network function definition group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName} + /// + /// + /// Operation Id + /// NetworkFunctionDefinitionGroups_CreateOrUpdate + /// + /// + /// + /// 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 network function definition group. + /// Parameters supplied to the create or update publisher network function definition group operation. + /// 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 networkFunctionDefinitionGroupName, NetworkFunctionDefinitionGroupData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(networkFunctionDefinitionGroupName, nameof(networkFunctionDefinitionGroupName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _networkFunctionDefinitionGroupClientDiagnostics.CreateScope("NetworkFunctionDefinitionGroupCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _networkFunctionDefinitionGroupRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, networkFunctionDefinitionGroupName, data, cancellationToken).ConfigureAwait(false); + var operation = new HybridNetworkArmOperation(new NetworkFunctionDefinitionGroupOperationSource(Client), _networkFunctionDefinitionGroupClientDiagnostics, Pipeline, _networkFunctionDefinitionGroupRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, networkFunctionDefinitionGroupName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates or updates a network function definition group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName} + /// + /// + /// Operation Id + /// NetworkFunctionDefinitionGroups_CreateOrUpdate + /// + /// + /// + /// 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 network function definition group. + /// Parameters supplied to the create or update publisher network function definition group operation. + /// 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 networkFunctionDefinitionGroupName, NetworkFunctionDefinitionGroupData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(networkFunctionDefinitionGroupName, nameof(networkFunctionDefinitionGroupName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _networkFunctionDefinitionGroupClientDiagnostics.CreateScope("NetworkFunctionDefinitionGroupCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _networkFunctionDefinitionGroupRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, networkFunctionDefinitionGroupName, data, cancellationToken); + var operation = new HybridNetworkArmOperation(new NetworkFunctionDefinitionGroupOperationSource(Client), _networkFunctionDefinitionGroupClientDiagnostics, Pipeline, _networkFunctionDefinitionGroupRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, networkFunctionDefinitionGroupName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets information about the specified networkFunctionDefinition group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName} + /// + /// + /// Operation Id + /// NetworkFunctionDefinitionGroups_Get + /// + /// + /// + /// The name of the network function definition group. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string networkFunctionDefinitionGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(networkFunctionDefinitionGroupName, nameof(networkFunctionDefinitionGroupName)); + + using var scope = _networkFunctionDefinitionGroupClientDiagnostics.CreateScope("NetworkFunctionDefinitionGroupCollection.Get"); + scope.Start(); + try + { + var response = await _networkFunctionDefinitionGroupRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, networkFunctionDefinitionGroupName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new NetworkFunctionDefinitionGroupResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets information about the specified networkFunctionDefinition group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName} + /// + /// + /// Operation Id + /// NetworkFunctionDefinitionGroups_Get + /// + /// + /// + /// The name of the network function definition group. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string networkFunctionDefinitionGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(networkFunctionDefinitionGroupName, nameof(networkFunctionDefinitionGroupName)); + + using var scope = _networkFunctionDefinitionGroupClientDiagnostics.CreateScope("NetworkFunctionDefinitionGroupCollection.Get"); + scope.Start(); + try + { + var response = _networkFunctionDefinitionGroupRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, networkFunctionDefinitionGroupName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new NetworkFunctionDefinitionGroupResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets information of the network function definition groups under a publisher. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups + /// + /// + /// Operation Id + /// NetworkFunctionDefinitionGroups_ListByPublisher + /// + /// + /// + /// 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) => _networkFunctionDefinitionGroupRestClient.CreateListByPublisherRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _networkFunctionDefinitionGroupRestClient.CreateListByPublisherNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new NetworkFunctionDefinitionGroupResource(Client, NetworkFunctionDefinitionGroupData.DeserializeNetworkFunctionDefinitionGroupData(e)), _networkFunctionDefinitionGroupClientDiagnostics, Pipeline, "NetworkFunctionDefinitionGroupCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Gets information of the network function definition groups under a publisher. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups + /// + /// + /// Operation Id + /// NetworkFunctionDefinitionGroups_ListByPublisher + /// + /// + /// + /// 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) => _networkFunctionDefinitionGroupRestClient.CreateListByPublisherRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _networkFunctionDefinitionGroupRestClient.CreateListByPublisherNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new NetworkFunctionDefinitionGroupResource(Client, NetworkFunctionDefinitionGroupData.DeserializeNetworkFunctionDefinitionGroupData(e)), _networkFunctionDefinitionGroupClientDiagnostics, Pipeline, "NetworkFunctionDefinitionGroupCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName} + /// + /// + /// Operation Id + /// NetworkFunctionDefinitionGroups_Get + /// + /// + /// + /// The name of the network function definition group. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string networkFunctionDefinitionGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(networkFunctionDefinitionGroupName, nameof(networkFunctionDefinitionGroupName)); + + using var scope = _networkFunctionDefinitionGroupClientDiagnostics.CreateScope("NetworkFunctionDefinitionGroupCollection.Exists"); + scope.Start(); + try + { + var response = await _networkFunctionDefinitionGroupRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, networkFunctionDefinitionGroupName, 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.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName} + /// + /// + /// Operation Id + /// NetworkFunctionDefinitionGroups_Get + /// + /// + /// + /// The name of the network function definition group. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string networkFunctionDefinitionGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(networkFunctionDefinitionGroupName, nameof(networkFunctionDefinitionGroupName)); + + using var scope = _networkFunctionDefinitionGroupClientDiagnostics.CreateScope("NetworkFunctionDefinitionGroupCollection.Exists"); + scope.Start(); + try + { + var response = _networkFunctionDefinitionGroupRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, networkFunctionDefinitionGroupName, 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.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName} + /// + /// + /// Operation Id + /// NetworkFunctionDefinitionGroups_Get + /// + /// + /// + /// The name of the network function definition group. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string networkFunctionDefinitionGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(networkFunctionDefinitionGroupName, nameof(networkFunctionDefinitionGroupName)); + + using var scope = _networkFunctionDefinitionGroupClientDiagnostics.CreateScope("NetworkFunctionDefinitionGroupCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _networkFunctionDefinitionGroupRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, networkFunctionDefinitionGroupName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NetworkFunctionDefinitionGroupResource(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.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName} + /// + /// + /// Operation Id + /// NetworkFunctionDefinitionGroups_Get + /// + /// + /// + /// The name of the network function definition group. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string networkFunctionDefinitionGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(networkFunctionDefinitionGroupName, nameof(networkFunctionDefinitionGroupName)); + + using var scope = _networkFunctionDefinitionGroupClientDiagnostics.CreateScope("NetworkFunctionDefinitionGroupCollection.GetIfExists"); + scope.Start(); + try + { + var response = _networkFunctionDefinitionGroupRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, networkFunctionDefinitionGroupName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NetworkFunctionDefinitionGroupResource(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/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/NetworkFunctionDefinitionGroupData.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/NetworkFunctionDefinitionGroupData.cs new file mode 100644 index 000000000000..2fc7b7ed0a4b --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/NetworkFunctionDefinitionGroupData.cs @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.HybridNetwork.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.HybridNetwork +{ + /// + /// A class representing the NetworkFunctionDefinitionGroup data model. + /// Network function definition group resource. + /// + public partial class NetworkFunctionDefinitionGroupData : TrackedResourceData + { + /// Initializes a new instance of NetworkFunctionDefinitionGroupData. + /// The location. + public NetworkFunctionDefinitionGroupData(AzureLocation location) : base(location) + { + } + + /// Initializes a new instance of NetworkFunctionDefinitionGroupData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The tags. + /// The location. + /// Network function definition group properties. + internal NetworkFunctionDefinitionGroupData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, NetworkFunctionDefinitionGroupPropertiesFormat properties) : base(id, name, resourceType, systemData, tags, location) + { + Properties = properties; + } + + /// Network function definition group properties. + public NetworkFunctionDefinitionGroupPropertiesFormat Properties { get; set; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/NetworkFunctionDefinitionGroupResource.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/NetworkFunctionDefinitionGroupResource.cs new file mode 100644 index 000000000000..b4d96a2c3297 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/NetworkFunctionDefinitionGroupResource.cs @@ -0,0 +1,654 @@ +// 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; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.HybridNetwork.Models; + +namespace Azure.ResourceManager.HybridNetwork +{ + /// + /// A Class representing a NetworkFunctionDefinitionGroup 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 GetNetworkFunctionDefinitionGroupResource method. + /// Otherwise you can get one from its parent resource using the GetNetworkFunctionDefinitionGroup method. + /// + public partial class NetworkFunctionDefinitionGroupResource : ArmResource + { + /// Generate the resource identifier of a instance. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string publisherName, string networkFunctionDefinitionGroupName) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _networkFunctionDefinitionGroupClientDiagnostics; + private readonly NetworkFunctionDefinitionGroupsRestOperations _networkFunctionDefinitionGroupRestClient; + private readonly NetworkFunctionDefinitionGroupData _data; + + /// Initializes a new instance of the class for mocking. + protected NetworkFunctionDefinitionGroupResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal NetworkFunctionDefinitionGroupResource(ArmClient client, NetworkFunctionDefinitionGroupData 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 NetworkFunctionDefinitionGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _networkFunctionDefinitionGroupClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.HybridNetwork", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string networkFunctionDefinitionGroupApiVersion); + _networkFunctionDefinitionGroupRestClient = new NetworkFunctionDefinitionGroupsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, networkFunctionDefinitionGroupApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.HybridNetwork/publishers/networkFunctionDefinitionGroups"; + + /// 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 NetworkFunctionDefinitionGroupData 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 NetworkFunctionDefinitionVersionResources in the NetworkFunctionDefinitionGroup. + /// An object representing collection of NetworkFunctionDefinitionVersionResources and their operations over a NetworkFunctionDefinitionVersionResource. + public virtual NetworkFunctionDefinitionVersionCollection GetNetworkFunctionDefinitionVersions() + { + return GetCachedClient(Client => new NetworkFunctionDefinitionVersionCollection(Client, Id)); + } + + /// + /// Gets information about a network function definition version. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName}/networkFunctionDefinitionVersions/{networkFunctionDefinitionVersionName} + /// + /// + /// Operation Id + /// NetworkFunctionDefinitionVersions_Get + /// + /// + /// + /// The name of the network function definition version. The name should conform to the SemVer 2.0.0 specification: https://semver.org/spec/v2.0.0.html. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public virtual async Task> GetNetworkFunctionDefinitionVersionAsync(string networkFunctionDefinitionVersionName, CancellationToken cancellationToken = default) + { + return await GetNetworkFunctionDefinitionVersions().GetAsync(networkFunctionDefinitionVersionName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets information about a network function definition version. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName}/networkFunctionDefinitionVersions/{networkFunctionDefinitionVersionName} + /// + /// + /// Operation Id + /// NetworkFunctionDefinitionVersions_Get + /// + /// + /// + /// The name of the network function definition version. The name should conform to the SemVer 2.0.0 specification: https://semver.org/spec/v2.0.0.html. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public virtual Response GetNetworkFunctionDefinitionVersion(string networkFunctionDefinitionVersionName, CancellationToken cancellationToken = default) + { + return GetNetworkFunctionDefinitionVersions().Get(networkFunctionDefinitionVersionName, cancellationToken); + } + + /// + /// Gets information about the specified networkFunctionDefinition group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName} + /// + /// + /// Operation Id + /// NetworkFunctionDefinitionGroups_Get + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _networkFunctionDefinitionGroupClientDiagnostics.CreateScope("NetworkFunctionDefinitionGroupResource.Get"); + scope.Start(); + try + { + var response = await _networkFunctionDefinitionGroupRestClient.GetAsync(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 NetworkFunctionDefinitionGroupResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets information about the specified networkFunctionDefinition group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName} + /// + /// + /// Operation Id + /// NetworkFunctionDefinitionGroups_Get + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _networkFunctionDefinitionGroupClientDiagnostics.CreateScope("NetworkFunctionDefinitionGroupResource.Get"); + scope.Start(); + try + { + var response = _networkFunctionDefinitionGroupRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new NetworkFunctionDefinitionGroupResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes a specified network function definition group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName} + /// + /// + /// Operation Id + /// NetworkFunctionDefinitionGroups_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _networkFunctionDefinitionGroupClientDiagnostics.CreateScope("NetworkFunctionDefinitionGroupResource.Delete"); + scope.Start(); + try + { + var response = await _networkFunctionDefinitionGroupRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new HybridNetworkArmOperation(_networkFunctionDefinitionGroupClientDiagnostics, Pipeline, _networkFunctionDefinitionGroupRestClient.CreateDeleteRequest(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; + } + } + + /// + /// Deletes a specified network function definition group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName} + /// + /// + /// Operation Id + /// NetworkFunctionDefinitionGroups_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _networkFunctionDefinitionGroupClientDiagnostics.CreateScope("NetworkFunctionDefinitionGroupResource.Delete"); + scope.Start(); + try + { + var response = _networkFunctionDefinitionGroupRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + var operation = new HybridNetworkArmOperation(_networkFunctionDefinitionGroupClientDiagnostics, Pipeline, _networkFunctionDefinitionGroupRestClient.CreateDeleteRequest(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; + } + } + + /// + /// Updates a network function definition group resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName} + /// + /// + /// Operation Id + /// NetworkFunctionDefinitionGroups_Update + /// + /// + /// + /// Parameters supplied to the create or update publisher network function definition group operation. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(TagsObject tagsObject, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tagsObject, nameof(tagsObject)); + + using var scope = _networkFunctionDefinitionGroupClientDiagnostics.CreateScope("NetworkFunctionDefinitionGroupResource.Update"); + scope.Start(); + try + { + var response = await _networkFunctionDefinitionGroupRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, tagsObject, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new NetworkFunctionDefinitionGroupResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Updates a network function definition group resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName} + /// + /// + /// Operation Id + /// NetworkFunctionDefinitionGroups_Update + /// + /// + /// + /// Parameters supplied to the create or update publisher network function definition group operation. + /// The cancellation token to use. + /// is null. + public virtual Response Update(TagsObject tagsObject, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tagsObject, nameof(tagsObject)); + + using var scope = _networkFunctionDefinitionGroupClientDiagnostics.CreateScope("NetworkFunctionDefinitionGroupResource.Update"); + scope.Start(); + try + { + var response = _networkFunctionDefinitionGroupRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, tagsObject, cancellationToken); + return Response.FromValue(new NetworkFunctionDefinitionGroupResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Add a tag to the current resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName} + /// + /// + /// Operation Id + /// NetworkFunctionDefinitionGroups_Get + /// + /// + /// + /// 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 = _networkFunctionDefinitionGroupClientDiagnostics.CreateScope("NetworkFunctionDefinitionGroupResource.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 _networkFunctionDefinitionGroupRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new NetworkFunctionDefinitionGroupResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new TagsObject(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags[key] = value; + var result = await UpdateAsync(patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return result; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Add a tag to the current resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName} + /// + /// + /// Operation Id + /// NetworkFunctionDefinitionGroups_Get + /// + /// + /// + /// 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 = _networkFunctionDefinitionGroupClientDiagnostics.CreateScope("NetworkFunctionDefinitionGroupResource.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 = _networkFunctionDefinitionGroupRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + return Response.FromValue(new NetworkFunctionDefinitionGroupResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new TagsObject(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags[key] = value; + var result = Update(patch, cancellationToken: cancellationToken); + return result; + } + } + 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.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName} + /// + /// + /// Operation Id + /// NetworkFunctionDefinitionGroups_Get + /// + /// + /// + /// 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 = _networkFunctionDefinitionGroupClientDiagnostics.CreateScope("NetworkFunctionDefinitionGroupResource.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 _networkFunctionDefinitionGroupRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new NetworkFunctionDefinitionGroupResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new TagsObject(); + patch.Tags.ReplaceWith(tags); + var result = await UpdateAsync(patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return result; + } + } + 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.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName} + /// + /// + /// Operation Id + /// NetworkFunctionDefinitionGroups_Get + /// + /// + /// + /// 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 = _networkFunctionDefinitionGroupClientDiagnostics.CreateScope("NetworkFunctionDefinitionGroupResource.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 = _networkFunctionDefinitionGroupRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + return Response.FromValue(new NetworkFunctionDefinitionGroupResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new TagsObject(); + patch.Tags.ReplaceWith(tags); + var result = Update(patch, cancellationToken: cancellationToken); + return result; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Removes a tag by key from the resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName} + /// + /// + /// Operation Id + /// NetworkFunctionDefinitionGroups_Get + /// + /// + /// + /// 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 = _networkFunctionDefinitionGroupClientDiagnostics.CreateScope("NetworkFunctionDefinitionGroupResource.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 _networkFunctionDefinitionGroupRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new NetworkFunctionDefinitionGroupResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new TagsObject(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags.Remove(key); + var result = await UpdateAsync(patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return result; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Removes a tag by key from the resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName} + /// + /// + /// Operation Id + /// NetworkFunctionDefinitionGroups_Get + /// + /// + /// + /// 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 = _networkFunctionDefinitionGroupClientDiagnostics.CreateScope("NetworkFunctionDefinitionGroupResource.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 = _networkFunctionDefinitionGroupRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + return Response.FromValue(new NetworkFunctionDefinitionGroupResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new TagsObject(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags.Remove(key); + var result = Update(patch, cancellationToken: cancellationToken); + return result; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/NetworkFunctionDefinitionVersionCollection.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/NetworkFunctionDefinitionVersionCollection.cs new file mode 100644 index 000000000000..4f95fae581b3 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/NetworkFunctionDefinitionVersionCollection.cs @@ -0,0 +1,415 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.HybridNetwork +{ + /// + /// 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 GetNetworkFunctionDefinitionVersions method from an instance of . + /// + public partial class NetworkFunctionDefinitionVersionCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _networkFunctionDefinitionVersionClientDiagnostics; + private readonly NetworkFunctionDefinitionVersionsRestOperations _networkFunctionDefinitionVersionRestClient; + + /// Initializes a new instance of the class for mocking. + protected NetworkFunctionDefinitionVersionCollection() + { + } + + /// 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 NetworkFunctionDefinitionVersionCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _networkFunctionDefinitionVersionClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.HybridNetwork", NetworkFunctionDefinitionVersionResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(NetworkFunctionDefinitionVersionResource.ResourceType, out string networkFunctionDefinitionVersionApiVersion); + _networkFunctionDefinitionVersionRestClient = new NetworkFunctionDefinitionVersionsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, networkFunctionDefinitionVersionApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != NetworkFunctionDefinitionGroupResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, NetworkFunctionDefinitionGroupResource.ResourceType), nameof(id)); + } + + /// + /// Creates or updates a network function definition version. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName}/networkFunctionDefinitionVersions/{networkFunctionDefinitionVersionName} + /// + /// + /// Operation Id + /// NetworkFunctionDefinitionVersions_CreateOrUpdate + /// + /// + /// + /// 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 network function definition version. The name should conform to the SemVer 2.0.0 specification: https://semver.org/spec/v2.0.0.html. + /// Parameters supplied to the create or update network function definition version operation. + /// 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 networkFunctionDefinitionVersionName, NetworkFunctionDefinitionVersionData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(networkFunctionDefinitionVersionName, nameof(networkFunctionDefinitionVersionName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _networkFunctionDefinitionVersionClientDiagnostics.CreateScope("NetworkFunctionDefinitionVersionCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _networkFunctionDefinitionVersionRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, networkFunctionDefinitionVersionName, data, cancellationToken).ConfigureAwait(false); + var operation = new HybridNetworkArmOperation(new NetworkFunctionDefinitionVersionOperationSource(Client), _networkFunctionDefinitionVersionClientDiagnostics, Pipeline, _networkFunctionDefinitionVersionRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, networkFunctionDefinitionVersionName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates or updates a network function definition version. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName}/networkFunctionDefinitionVersions/{networkFunctionDefinitionVersionName} + /// + /// + /// Operation Id + /// NetworkFunctionDefinitionVersions_CreateOrUpdate + /// + /// + /// + /// 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 network function definition version. The name should conform to the SemVer 2.0.0 specification: https://semver.org/spec/v2.0.0.html. + /// Parameters supplied to the create or update network function definition version operation. + /// 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 networkFunctionDefinitionVersionName, NetworkFunctionDefinitionVersionData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(networkFunctionDefinitionVersionName, nameof(networkFunctionDefinitionVersionName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _networkFunctionDefinitionVersionClientDiagnostics.CreateScope("NetworkFunctionDefinitionVersionCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _networkFunctionDefinitionVersionRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, networkFunctionDefinitionVersionName, data, cancellationToken); + var operation = new HybridNetworkArmOperation(new NetworkFunctionDefinitionVersionOperationSource(Client), _networkFunctionDefinitionVersionClientDiagnostics, Pipeline, _networkFunctionDefinitionVersionRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, networkFunctionDefinitionVersionName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets information about a network function definition version. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName}/networkFunctionDefinitionVersions/{networkFunctionDefinitionVersionName} + /// + /// + /// Operation Id + /// NetworkFunctionDefinitionVersions_Get + /// + /// + /// + /// The name of the network function definition version. The name should conform to the SemVer 2.0.0 specification: https://semver.org/spec/v2.0.0.html. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string networkFunctionDefinitionVersionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(networkFunctionDefinitionVersionName, nameof(networkFunctionDefinitionVersionName)); + + using var scope = _networkFunctionDefinitionVersionClientDiagnostics.CreateScope("NetworkFunctionDefinitionVersionCollection.Get"); + scope.Start(); + try + { + var response = await _networkFunctionDefinitionVersionRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, networkFunctionDefinitionVersionName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new NetworkFunctionDefinitionVersionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets information about a network function definition version. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName}/networkFunctionDefinitionVersions/{networkFunctionDefinitionVersionName} + /// + /// + /// Operation Id + /// NetworkFunctionDefinitionVersions_Get + /// + /// + /// + /// The name of the network function definition version. The name should conform to the SemVer 2.0.0 specification: https://semver.org/spec/v2.0.0.html. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string networkFunctionDefinitionVersionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(networkFunctionDefinitionVersionName, nameof(networkFunctionDefinitionVersionName)); + + using var scope = _networkFunctionDefinitionVersionClientDiagnostics.CreateScope("NetworkFunctionDefinitionVersionCollection.Get"); + scope.Start(); + try + { + var response = _networkFunctionDefinitionVersionRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, networkFunctionDefinitionVersionName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new NetworkFunctionDefinitionVersionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets information about a list of network function definition versions under a network function definition group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName}/networkFunctionDefinitionVersions + /// + /// + /// Operation Id + /// NetworkFunctionDefinitionVersions_ListByNetworkFunctionDefinitionGroup + /// + /// + /// + /// 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) => _networkFunctionDefinitionVersionRestClient.CreateListByNetworkFunctionDefinitionGroupRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _networkFunctionDefinitionVersionRestClient.CreateListByNetworkFunctionDefinitionGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new NetworkFunctionDefinitionVersionResource(Client, NetworkFunctionDefinitionVersionData.DeserializeNetworkFunctionDefinitionVersionData(e)), _networkFunctionDefinitionVersionClientDiagnostics, Pipeline, "NetworkFunctionDefinitionVersionCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Gets information about a list of network function definition versions under a network function definition group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName}/networkFunctionDefinitionVersions + /// + /// + /// Operation Id + /// NetworkFunctionDefinitionVersions_ListByNetworkFunctionDefinitionGroup + /// + /// + /// + /// 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) => _networkFunctionDefinitionVersionRestClient.CreateListByNetworkFunctionDefinitionGroupRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _networkFunctionDefinitionVersionRestClient.CreateListByNetworkFunctionDefinitionGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new NetworkFunctionDefinitionVersionResource(Client, NetworkFunctionDefinitionVersionData.DeserializeNetworkFunctionDefinitionVersionData(e)), _networkFunctionDefinitionVersionClientDiagnostics, Pipeline, "NetworkFunctionDefinitionVersionCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName}/networkFunctionDefinitionVersions/{networkFunctionDefinitionVersionName} + /// + /// + /// Operation Id + /// NetworkFunctionDefinitionVersions_Get + /// + /// + /// + /// The name of the network function definition version. The name should conform to the SemVer 2.0.0 specification: https://semver.org/spec/v2.0.0.html. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string networkFunctionDefinitionVersionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(networkFunctionDefinitionVersionName, nameof(networkFunctionDefinitionVersionName)); + + using var scope = _networkFunctionDefinitionVersionClientDiagnostics.CreateScope("NetworkFunctionDefinitionVersionCollection.Exists"); + scope.Start(); + try + { + var response = await _networkFunctionDefinitionVersionRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, networkFunctionDefinitionVersionName, 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.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName}/networkFunctionDefinitionVersions/{networkFunctionDefinitionVersionName} + /// + /// + /// Operation Id + /// NetworkFunctionDefinitionVersions_Get + /// + /// + /// + /// The name of the network function definition version. The name should conform to the SemVer 2.0.0 specification: https://semver.org/spec/v2.0.0.html. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string networkFunctionDefinitionVersionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(networkFunctionDefinitionVersionName, nameof(networkFunctionDefinitionVersionName)); + + using var scope = _networkFunctionDefinitionVersionClientDiagnostics.CreateScope("NetworkFunctionDefinitionVersionCollection.Exists"); + scope.Start(); + try + { + var response = _networkFunctionDefinitionVersionRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, networkFunctionDefinitionVersionName, 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.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName}/networkFunctionDefinitionVersions/{networkFunctionDefinitionVersionName} + /// + /// + /// Operation Id + /// NetworkFunctionDefinitionVersions_Get + /// + /// + /// + /// The name of the network function definition version. The name should conform to the SemVer 2.0.0 specification: https://semver.org/spec/v2.0.0.html. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string networkFunctionDefinitionVersionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(networkFunctionDefinitionVersionName, nameof(networkFunctionDefinitionVersionName)); + + using var scope = _networkFunctionDefinitionVersionClientDiagnostics.CreateScope("NetworkFunctionDefinitionVersionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _networkFunctionDefinitionVersionRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, networkFunctionDefinitionVersionName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NetworkFunctionDefinitionVersionResource(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.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName}/networkFunctionDefinitionVersions/{networkFunctionDefinitionVersionName} + /// + /// + /// Operation Id + /// NetworkFunctionDefinitionVersions_Get + /// + /// + /// + /// The name of the network function definition version. The name should conform to the SemVer 2.0.0 specification: https://semver.org/spec/v2.0.0.html. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string networkFunctionDefinitionVersionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(networkFunctionDefinitionVersionName, nameof(networkFunctionDefinitionVersionName)); + + using var scope = _networkFunctionDefinitionVersionClientDiagnostics.CreateScope("NetworkFunctionDefinitionVersionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _networkFunctionDefinitionVersionRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, networkFunctionDefinitionVersionName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NetworkFunctionDefinitionVersionResource(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/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/NetworkFunctionDefinitionVersionData.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/NetworkFunctionDefinitionVersionData.cs new file mode 100644 index 000000000000..b0f0ffbf5747 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/NetworkFunctionDefinitionVersionData.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.HybridNetwork.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.HybridNetwork +{ + /// + /// A class representing the NetworkFunctionDefinitionVersion data model. + /// Network function definition version. + /// + public partial class NetworkFunctionDefinitionVersionData : TrackedResourceData + { + /// Initializes a new instance of NetworkFunctionDefinitionVersionData. + /// The location. + public NetworkFunctionDefinitionVersionData(AzureLocation location) : base(location) + { + } + + /// Initializes a new instance of NetworkFunctionDefinitionVersionData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The tags. + /// The location. + /// + /// Network function definition version properties. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include and . + /// + internal NetworkFunctionDefinitionVersionData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, NetworkFunctionDefinitionVersionPropertiesFormat properties) : base(id, name, resourceType, systemData, tags, location) + { + Properties = properties; + } + + /// + /// Network function definition version properties. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include and . + /// + public NetworkFunctionDefinitionVersionPropertiesFormat Properties { get; set; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/NetworkFunctionDefinitionVersionResource.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/NetworkFunctionDefinitionVersionResource.cs new file mode 100644 index 000000000000..0a3ed123e1af --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/NetworkFunctionDefinitionVersionResource.cs @@ -0,0 +1,677 @@ +// 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; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.HybridNetwork.Models; + +namespace Azure.ResourceManager.HybridNetwork +{ + /// + /// A Class representing a NetworkFunctionDefinitionVersion 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 GetNetworkFunctionDefinitionVersionResource method. + /// Otherwise you can get one from its parent resource using the GetNetworkFunctionDefinitionVersion method. + /// + public partial class NetworkFunctionDefinitionVersionResource : ArmResource + { + /// Generate the resource identifier of a instance. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string publisherName, string networkFunctionDefinitionGroupName, string networkFunctionDefinitionVersionName) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName}/networkFunctionDefinitionVersions/{networkFunctionDefinitionVersionName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _networkFunctionDefinitionVersionClientDiagnostics; + private readonly NetworkFunctionDefinitionVersionsRestOperations _networkFunctionDefinitionVersionRestClient; + private readonly NetworkFunctionDefinitionVersionData _data; + + /// Initializes a new instance of the class for mocking. + protected NetworkFunctionDefinitionVersionResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal NetworkFunctionDefinitionVersionResource(ArmClient client, NetworkFunctionDefinitionVersionData 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 NetworkFunctionDefinitionVersionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _networkFunctionDefinitionVersionClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.HybridNetwork", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string networkFunctionDefinitionVersionApiVersion); + _networkFunctionDefinitionVersionRestClient = new NetworkFunctionDefinitionVersionsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, networkFunctionDefinitionVersionApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.HybridNetwork/publishers/networkFunctionDefinitionGroups/networkFunctionDefinitionVersions"; + + /// 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 NetworkFunctionDefinitionVersionData 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 information about a network function definition version. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName}/networkFunctionDefinitionVersions/{networkFunctionDefinitionVersionName} + /// + /// + /// Operation Id + /// NetworkFunctionDefinitionVersions_Get + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _networkFunctionDefinitionVersionClientDiagnostics.CreateScope("NetworkFunctionDefinitionVersionResource.Get"); + scope.Start(); + try + { + var response = await _networkFunctionDefinitionVersionRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new NetworkFunctionDefinitionVersionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets information about a network function definition version. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName}/networkFunctionDefinitionVersions/{networkFunctionDefinitionVersionName} + /// + /// + /// Operation Id + /// NetworkFunctionDefinitionVersions_Get + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _networkFunctionDefinitionVersionClientDiagnostics.CreateScope("NetworkFunctionDefinitionVersionResource.Get"); + scope.Start(); + try + { + var response = _networkFunctionDefinitionVersionRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new NetworkFunctionDefinitionVersionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes the specified network function definition version. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName}/networkFunctionDefinitionVersions/{networkFunctionDefinitionVersionName} + /// + /// + /// Operation Id + /// NetworkFunctionDefinitionVersions_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _networkFunctionDefinitionVersionClientDiagnostics.CreateScope("NetworkFunctionDefinitionVersionResource.Delete"); + scope.Start(); + try + { + var response = await _networkFunctionDefinitionVersionRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new HybridNetworkArmOperation(_networkFunctionDefinitionVersionClientDiagnostics, Pipeline, _networkFunctionDefinitionVersionRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes the specified network function definition version. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName}/networkFunctionDefinitionVersions/{networkFunctionDefinitionVersionName} + /// + /// + /// Operation Id + /// NetworkFunctionDefinitionVersions_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _networkFunctionDefinitionVersionClientDiagnostics.CreateScope("NetworkFunctionDefinitionVersionResource.Delete"); + scope.Start(); + try + { + var response = _networkFunctionDefinitionVersionRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + var operation = new HybridNetworkArmOperation(_networkFunctionDefinitionVersionClientDiagnostics, Pipeline, _networkFunctionDefinitionVersionRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Updates a network function definition version resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName}/networkFunctionDefinitionVersions/{networkFunctionDefinitionVersionName} + /// + /// + /// Operation Id + /// NetworkFunctionDefinitionVersions_Update + /// + /// + /// + /// Parameters supplied to the create or update network function definition version operation. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(TagsObject tagsObject, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tagsObject, nameof(tagsObject)); + + using var scope = _networkFunctionDefinitionVersionClientDiagnostics.CreateScope("NetworkFunctionDefinitionVersionResource.Update"); + scope.Start(); + try + { + var response = await _networkFunctionDefinitionVersionRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, tagsObject, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new NetworkFunctionDefinitionVersionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Updates a network function definition version resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName}/networkFunctionDefinitionVersions/{networkFunctionDefinitionVersionName} + /// + /// + /// Operation Id + /// NetworkFunctionDefinitionVersions_Update + /// + /// + /// + /// Parameters supplied to the create or update network function definition version operation. + /// The cancellation token to use. + /// is null. + public virtual Response Update(TagsObject tagsObject, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tagsObject, nameof(tagsObject)); + + using var scope = _networkFunctionDefinitionVersionClientDiagnostics.CreateScope("NetworkFunctionDefinitionVersionResource.Update"); + scope.Start(); + try + { + var response = _networkFunctionDefinitionVersionRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, tagsObject, cancellationToken); + return Response.FromValue(new NetworkFunctionDefinitionVersionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Update network function definition version state. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName}/networkFunctionDefinitionVersions/{networkFunctionDefinitionVersionName}/updateState + /// + /// + /// Operation Id + /// NetworkFunctionDefinitionVersions_updateState + /// + /// + /// + /// 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. + /// Parameters supplied to update the state of network function definition version. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateStateAsync(WaitUntil waitUntil, NetworkFunctionDefinitionVersionUpdateState networkFunctionDefinitionVersionUpdateState, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(networkFunctionDefinitionVersionUpdateState, nameof(networkFunctionDefinitionVersionUpdateState)); + + using var scope = _networkFunctionDefinitionVersionClientDiagnostics.CreateScope("NetworkFunctionDefinitionVersionResource.UpdateState"); + scope.Start(); + try + { + var response = await _networkFunctionDefinitionVersionRestClient.UpdateStateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, networkFunctionDefinitionVersionUpdateState, cancellationToken).ConfigureAwait(false); + var operation = new HybridNetworkArmOperation(new NetworkFunctionDefinitionVersionUpdateStateOperationSource(), _networkFunctionDefinitionVersionClientDiagnostics, Pipeline, _networkFunctionDefinitionVersionRestClient.CreateUpdateStateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, networkFunctionDefinitionVersionUpdateState).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Update network function definition version state. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName}/networkFunctionDefinitionVersions/{networkFunctionDefinitionVersionName}/updateState + /// + /// + /// Operation Id + /// NetworkFunctionDefinitionVersions_updateState + /// + /// + /// + /// 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. + /// Parameters supplied to update the state of network function definition version. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation UpdateState(WaitUntil waitUntil, NetworkFunctionDefinitionVersionUpdateState networkFunctionDefinitionVersionUpdateState, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(networkFunctionDefinitionVersionUpdateState, nameof(networkFunctionDefinitionVersionUpdateState)); + + using var scope = _networkFunctionDefinitionVersionClientDiagnostics.CreateScope("NetworkFunctionDefinitionVersionResource.UpdateState"); + scope.Start(); + try + { + var response = _networkFunctionDefinitionVersionRestClient.UpdateState(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, networkFunctionDefinitionVersionUpdateState, cancellationToken); + var operation = new HybridNetworkArmOperation(new NetworkFunctionDefinitionVersionUpdateStateOperationSource(), _networkFunctionDefinitionVersionClientDiagnostics, Pipeline, _networkFunctionDefinitionVersionRestClient.CreateUpdateStateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, networkFunctionDefinitionVersionUpdateState).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.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName}/networkFunctionDefinitionVersions/{networkFunctionDefinitionVersionName} + /// + /// + /// Operation Id + /// NetworkFunctionDefinitionVersions_Get + /// + /// + /// + /// 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 = _networkFunctionDefinitionVersionClientDiagnostics.CreateScope("NetworkFunctionDefinitionVersionResource.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 _networkFunctionDefinitionVersionRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new NetworkFunctionDefinitionVersionResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new TagsObject(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags[key] = value; + var result = await UpdateAsync(patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return result; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Add a tag to the current resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName}/networkFunctionDefinitionVersions/{networkFunctionDefinitionVersionName} + /// + /// + /// Operation Id + /// NetworkFunctionDefinitionVersions_Get + /// + /// + /// + /// 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 = _networkFunctionDefinitionVersionClientDiagnostics.CreateScope("NetworkFunctionDefinitionVersionResource.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 = _networkFunctionDefinitionVersionRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + return Response.FromValue(new NetworkFunctionDefinitionVersionResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new TagsObject(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags[key] = value; + var result = Update(patch, cancellationToken: cancellationToken); + return result; + } + } + 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.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName}/networkFunctionDefinitionVersions/{networkFunctionDefinitionVersionName} + /// + /// + /// Operation Id + /// NetworkFunctionDefinitionVersions_Get + /// + /// + /// + /// 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 = _networkFunctionDefinitionVersionClientDiagnostics.CreateScope("NetworkFunctionDefinitionVersionResource.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 _networkFunctionDefinitionVersionRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new NetworkFunctionDefinitionVersionResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new TagsObject(); + patch.Tags.ReplaceWith(tags); + var result = await UpdateAsync(patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return result; + } + } + 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.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName}/networkFunctionDefinitionVersions/{networkFunctionDefinitionVersionName} + /// + /// + /// Operation Id + /// NetworkFunctionDefinitionVersions_Get + /// + /// + /// + /// 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 = _networkFunctionDefinitionVersionClientDiagnostics.CreateScope("NetworkFunctionDefinitionVersionResource.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 = _networkFunctionDefinitionVersionRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + return Response.FromValue(new NetworkFunctionDefinitionVersionResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new TagsObject(); + patch.Tags.ReplaceWith(tags); + var result = Update(patch, cancellationToken: cancellationToken); + return result; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Removes a tag by key from the resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName}/networkFunctionDefinitionVersions/{networkFunctionDefinitionVersionName} + /// + /// + /// Operation Id + /// NetworkFunctionDefinitionVersions_Get + /// + /// + /// + /// 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 = _networkFunctionDefinitionVersionClientDiagnostics.CreateScope("NetworkFunctionDefinitionVersionResource.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 _networkFunctionDefinitionVersionRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new NetworkFunctionDefinitionVersionResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new TagsObject(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags.Remove(key); + var result = await UpdateAsync(patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return result; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Removes a tag by key from the resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName}/networkFunctionDefinitionVersions/{networkFunctionDefinitionVersionName} + /// + /// + /// Operation Id + /// NetworkFunctionDefinitionVersions_Get + /// + /// + /// + /// 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 = _networkFunctionDefinitionVersionClientDiagnostics.CreateScope("NetworkFunctionDefinitionVersionResource.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 = _networkFunctionDefinitionVersionRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + return Response.FromValue(new NetworkFunctionDefinitionVersionResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new TagsObject(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags.Remove(key); + var result = Update(patch, cancellationToken: cancellationToken); + return result; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/NetworkFunctionResource.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/NetworkFunctionResource.cs new file mode 100644 index 000000000000..a2411a452a5d --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/NetworkFunctionResource.cs @@ -0,0 +1,731 @@ +// 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; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.HybridNetwork.Models; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.HybridNetwork +{ + /// + /// A Class representing a NetworkFunction 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 GetNetworkFunctionResource method. + /// Otherwise you can get one from its parent resource using the GetNetworkFunction method. + /// + public partial class NetworkFunctionResource : ArmResource + { + /// Generate the resource identifier of a instance. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string networkFunctionName) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/networkFunctions/{networkFunctionName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _networkFunctionClientDiagnostics; + private readonly NetworkFunctionsRestOperations _networkFunctionRestClient; + private readonly NetworkFunctionData _data; + + /// Initializes a new instance of the class for mocking. + protected NetworkFunctionResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal NetworkFunctionResource(ArmClient client, NetworkFunctionData 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 NetworkFunctionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _networkFunctionClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.HybridNetwork", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string networkFunctionApiVersion); + _networkFunctionRestClient = new NetworkFunctionsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, networkFunctionApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.HybridNetwork/networkFunctions"; + + /// 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 NetworkFunctionData 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 ComponentResources in the NetworkFunction. + /// An object representing collection of ComponentResources and their operations over a ComponentResource. + public virtual ComponentCollection GetComponents() + { + return GetCachedClient(Client => new ComponentCollection(Client, Id)); + } + + /// + /// Gets information about the specified application instance resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/networkFunctions/{networkFunctionName}/components/{componentName} + /// + /// + /// Operation Id + /// Components_Get + /// + /// + /// + /// The name of the component. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public virtual async Task> GetComponentAsync(string componentName, CancellationToken cancellationToken = default) + { + return await GetComponents().GetAsync(componentName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets information about the specified application instance resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/networkFunctions/{networkFunctionName}/components/{componentName} + /// + /// + /// Operation Id + /// Components_Get + /// + /// + /// + /// The name of the component. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public virtual Response GetComponent(string componentName, CancellationToken cancellationToken = default) + { + return GetComponents().Get(componentName, cancellationToken); + } + + /// + /// Gets information about the specified network function resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/networkFunctions/{networkFunctionName} + /// + /// + /// Operation Id + /// NetworkFunctions_Get + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _networkFunctionClientDiagnostics.CreateScope("NetworkFunctionResource.Get"); + scope.Start(); + try + { + var response = await _networkFunctionRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new NetworkFunctionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets information about the specified network function resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/networkFunctions/{networkFunctionName} + /// + /// + /// Operation Id + /// NetworkFunctions_Get + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _networkFunctionClientDiagnostics.CreateScope("NetworkFunctionResource.Get"); + scope.Start(); + try + { + var response = _networkFunctionRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new NetworkFunctionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes the specified network function resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/networkFunctions/{networkFunctionName} + /// + /// + /// Operation Id + /// NetworkFunctions_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _networkFunctionClientDiagnostics.CreateScope("NetworkFunctionResource.Delete"); + scope.Start(); + try + { + var response = await _networkFunctionRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new HybridNetworkArmOperation(_networkFunctionClientDiagnostics, Pipeline, _networkFunctionRestClient.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; + } + } + + /// + /// Deletes the specified network function resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/networkFunctions/{networkFunctionName} + /// + /// + /// Operation Id + /// NetworkFunctions_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _networkFunctionClientDiagnostics.CreateScope("NetworkFunctionResource.Delete"); + scope.Start(); + try + { + var response = _networkFunctionRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + var operation = new HybridNetworkArmOperation(_networkFunctionClientDiagnostics, Pipeline, _networkFunctionRestClient.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; + } + } + + /// + /// Updates the tags for the network function resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/networkFunctions/{networkFunctionName} + /// + /// + /// Operation Id + /// NetworkFunctions_UpdateTags + /// + /// + /// + /// Parameters supplied to the update network function tags operation. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(TagsObject tagsObject, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tagsObject, nameof(tagsObject)); + + using var scope = _networkFunctionClientDiagnostics.CreateScope("NetworkFunctionResource.Update"); + scope.Start(); + try + { + var response = await _networkFunctionRestClient.UpdateTagsAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, tagsObject, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new NetworkFunctionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Updates the tags for the network function resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/networkFunctions/{networkFunctionName} + /// + /// + /// Operation Id + /// NetworkFunctions_UpdateTags + /// + /// + /// + /// Parameters supplied to the update network function tags operation. + /// The cancellation token to use. + /// is null. + public virtual Response Update(TagsObject tagsObject, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tagsObject, nameof(tagsObject)); + + using var scope = _networkFunctionClientDiagnostics.CreateScope("NetworkFunctionResource.Update"); + scope.Start(); + try + { + var response = _networkFunctionRestClient.UpdateTags(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, tagsObject, cancellationToken); + return Response.FromValue(new NetworkFunctionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Execute a request to services on a containerized network function. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/networkFunctions/{networkFunctionName}/executeRequest + /// + /// + /// Operation Id + /// NetworkFunctions_ExecuteRequest + /// + /// + /// + /// 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. + /// Payload for execute request post call. + /// The cancellation token to use. + /// is null. + public virtual async Task ExecuteRequestAsync(WaitUntil waitUntil, ExecuteRequestContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = _networkFunctionClientDiagnostics.CreateScope("NetworkFunctionResource.ExecuteRequest"); + scope.Start(); + try + { + var response = await _networkFunctionRestClient.ExecuteRequestAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, content, cancellationToken).ConfigureAwait(false); + var operation = new HybridNetworkArmOperation(_networkFunctionClientDiagnostics, Pipeline, _networkFunctionRestClient.CreateExecuteRequestRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, content).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Execute a request to services on a containerized network function. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/networkFunctions/{networkFunctionName}/executeRequest + /// + /// + /// Operation Id + /// NetworkFunctions_ExecuteRequest + /// + /// + /// + /// 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. + /// Payload for execute request post call. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation ExecuteRequest(WaitUntil waitUntil, ExecuteRequestContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = _networkFunctionClientDiagnostics.CreateScope("NetworkFunctionResource.ExecuteRequest"); + scope.Start(); + try + { + var response = _networkFunctionRestClient.ExecuteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, content, cancellationToken); + var operation = new HybridNetworkArmOperation(_networkFunctionClientDiagnostics, Pipeline, _networkFunctionRestClient.CreateExecuteRequestRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, content).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(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.HybridNetwork/networkFunctions/{networkFunctionName} + /// + /// + /// Operation Id + /// NetworkFunctions_Get + /// + /// + /// + /// 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 = _networkFunctionClientDiagnostics.CreateScope("NetworkFunctionResource.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 _networkFunctionRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new NetworkFunctionResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new TagsObject(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags[key] = value; + var result = await UpdateAsync(patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return result; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Add a tag to the current resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/networkFunctions/{networkFunctionName} + /// + /// + /// Operation Id + /// NetworkFunctions_Get + /// + /// + /// + /// 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 = _networkFunctionClientDiagnostics.CreateScope("NetworkFunctionResource.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 = _networkFunctionRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + return Response.FromValue(new NetworkFunctionResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new TagsObject(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags[key] = value; + var result = Update(patch, cancellationToken: cancellationToken); + return result; + } + } + 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.HybridNetwork/networkFunctions/{networkFunctionName} + /// + /// + /// Operation Id + /// NetworkFunctions_Get + /// + /// + /// + /// 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 = _networkFunctionClientDiagnostics.CreateScope("NetworkFunctionResource.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 _networkFunctionRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new NetworkFunctionResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new TagsObject(); + patch.Tags.ReplaceWith(tags); + var result = await UpdateAsync(patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return result; + } + } + 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.HybridNetwork/networkFunctions/{networkFunctionName} + /// + /// + /// Operation Id + /// NetworkFunctions_Get + /// + /// + /// + /// 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 = _networkFunctionClientDiagnostics.CreateScope("NetworkFunctionResource.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 = _networkFunctionRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + return Response.FromValue(new NetworkFunctionResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new TagsObject(); + patch.Tags.ReplaceWith(tags); + var result = Update(patch, cancellationToken: cancellationToken); + return result; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Removes a tag by key from the resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/networkFunctions/{networkFunctionName} + /// + /// + /// Operation Id + /// NetworkFunctions_Get + /// + /// + /// + /// 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 = _networkFunctionClientDiagnostics.CreateScope("NetworkFunctionResource.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 _networkFunctionRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new NetworkFunctionResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new TagsObject(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags.Remove(key); + var result = await UpdateAsync(patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return result; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Removes a tag by key from the resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/networkFunctions/{networkFunctionName} + /// + /// + /// Operation Id + /// NetworkFunctions_Get + /// + /// + /// + /// 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 = _networkFunctionClientDiagnostics.CreateScope("NetworkFunctionResource.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 = _networkFunctionRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + return Response.FromValue(new NetworkFunctionResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new TagsObject(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags.Remove(key); + var result = Update(patch, cancellationToken: cancellationToken); + return result; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/NetworkServiceDesignGroupCollection.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/NetworkServiceDesignGroupCollection.cs new file mode 100644 index 000000000000..8c27cb5c1cec --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/NetworkServiceDesignGroupCollection.cs @@ -0,0 +1,415 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.HybridNetwork +{ + /// + /// 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 GetNetworkServiceDesignGroups method from an instance of . + /// + public partial class NetworkServiceDesignGroupCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _networkServiceDesignGroupClientDiagnostics; + private readonly NetworkServiceDesignGroupsRestOperations _networkServiceDesignGroupRestClient; + + /// Initializes a new instance of the class for mocking. + protected NetworkServiceDesignGroupCollection() + { + } + + /// 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 NetworkServiceDesignGroupCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _networkServiceDesignGroupClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.HybridNetwork", NetworkServiceDesignGroupResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(NetworkServiceDesignGroupResource.ResourceType, out string networkServiceDesignGroupApiVersion); + _networkServiceDesignGroupRestClient = new NetworkServiceDesignGroupsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, networkServiceDesignGroupApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != PublisherResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, PublisherResource.ResourceType), nameof(id)); + } + + /// + /// Creates or updates a network service design group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName} + /// + /// + /// Operation Id + /// NetworkServiceDesignGroups_CreateOrUpdate + /// + /// + /// + /// 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 network service design group. + /// Parameters supplied to the create or update publisher network service design group operation. + /// 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 networkServiceDesignGroupName, NetworkServiceDesignGroupData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(networkServiceDesignGroupName, nameof(networkServiceDesignGroupName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _networkServiceDesignGroupClientDiagnostics.CreateScope("NetworkServiceDesignGroupCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _networkServiceDesignGroupRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, networkServiceDesignGroupName, data, cancellationToken).ConfigureAwait(false); + var operation = new HybridNetworkArmOperation(new NetworkServiceDesignGroupOperationSource(Client), _networkServiceDesignGroupClientDiagnostics, Pipeline, _networkServiceDesignGroupRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, networkServiceDesignGroupName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates or updates a network service design group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName} + /// + /// + /// Operation Id + /// NetworkServiceDesignGroups_CreateOrUpdate + /// + /// + /// + /// 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 network service design group. + /// Parameters supplied to the create or update publisher network service design group operation. + /// 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 networkServiceDesignGroupName, NetworkServiceDesignGroupData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(networkServiceDesignGroupName, nameof(networkServiceDesignGroupName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _networkServiceDesignGroupClientDiagnostics.CreateScope("NetworkServiceDesignGroupCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _networkServiceDesignGroupRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, networkServiceDesignGroupName, data, cancellationToken); + var operation = new HybridNetworkArmOperation(new NetworkServiceDesignGroupOperationSource(Client), _networkServiceDesignGroupClientDiagnostics, Pipeline, _networkServiceDesignGroupRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, networkServiceDesignGroupName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets information about the specified networkServiceDesign group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName} + /// + /// + /// Operation Id + /// NetworkServiceDesignGroups_Get + /// + /// + /// + /// The name of the network service design group. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string networkServiceDesignGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(networkServiceDesignGroupName, nameof(networkServiceDesignGroupName)); + + using var scope = _networkServiceDesignGroupClientDiagnostics.CreateScope("NetworkServiceDesignGroupCollection.Get"); + scope.Start(); + try + { + var response = await _networkServiceDesignGroupRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, networkServiceDesignGroupName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new NetworkServiceDesignGroupResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets information about the specified networkServiceDesign group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName} + /// + /// + /// Operation Id + /// NetworkServiceDesignGroups_Get + /// + /// + /// + /// The name of the network service design group. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string networkServiceDesignGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(networkServiceDesignGroupName, nameof(networkServiceDesignGroupName)); + + using var scope = _networkServiceDesignGroupClientDiagnostics.CreateScope("NetworkServiceDesignGroupCollection.Get"); + scope.Start(); + try + { + var response = _networkServiceDesignGroupRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, networkServiceDesignGroupName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new NetworkServiceDesignGroupResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets information of the network service design groups under a publisher. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups + /// + /// + /// Operation Id + /// NetworkServiceDesignGroups_ListByPublisher + /// + /// + /// + /// 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) => _networkServiceDesignGroupRestClient.CreateListByPublisherRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _networkServiceDesignGroupRestClient.CreateListByPublisherNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new NetworkServiceDesignGroupResource(Client, NetworkServiceDesignGroupData.DeserializeNetworkServiceDesignGroupData(e)), _networkServiceDesignGroupClientDiagnostics, Pipeline, "NetworkServiceDesignGroupCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Gets information of the network service design groups under a publisher. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups + /// + /// + /// Operation Id + /// NetworkServiceDesignGroups_ListByPublisher + /// + /// + /// + /// 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) => _networkServiceDesignGroupRestClient.CreateListByPublisherRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _networkServiceDesignGroupRestClient.CreateListByPublisherNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new NetworkServiceDesignGroupResource(Client, NetworkServiceDesignGroupData.DeserializeNetworkServiceDesignGroupData(e)), _networkServiceDesignGroupClientDiagnostics, Pipeline, "NetworkServiceDesignGroupCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName} + /// + /// + /// Operation Id + /// NetworkServiceDesignGroups_Get + /// + /// + /// + /// The name of the network service design group. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string networkServiceDesignGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(networkServiceDesignGroupName, nameof(networkServiceDesignGroupName)); + + using var scope = _networkServiceDesignGroupClientDiagnostics.CreateScope("NetworkServiceDesignGroupCollection.Exists"); + scope.Start(); + try + { + var response = await _networkServiceDesignGroupRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, networkServiceDesignGroupName, 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.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName} + /// + /// + /// Operation Id + /// NetworkServiceDesignGroups_Get + /// + /// + /// + /// The name of the network service design group. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string networkServiceDesignGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(networkServiceDesignGroupName, nameof(networkServiceDesignGroupName)); + + using var scope = _networkServiceDesignGroupClientDiagnostics.CreateScope("NetworkServiceDesignGroupCollection.Exists"); + scope.Start(); + try + { + var response = _networkServiceDesignGroupRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, networkServiceDesignGroupName, 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.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName} + /// + /// + /// Operation Id + /// NetworkServiceDesignGroups_Get + /// + /// + /// + /// The name of the network service design group. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string networkServiceDesignGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(networkServiceDesignGroupName, nameof(networkServiceDesignGroupName)); + + using var scope = _networkServiceDesignGroupClientDiagnostics.CreateScope("NetworkServiceDesignGroupCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _networkServiceDesignGroupRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, networkServiceDesignGroupName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NetworkServiceDesignGroupResource(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.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName} + /// + /// + /// Operation Id + /// NetworkServiceDesignGroups_Get + /// + /// + /// + /// The name of the network service design group. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string networkServiceDesignGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(networkServiceDesignGroupName, nameof(networkServiceDesignGroupName)); + + using var scope = _networkServiceDesignGroupClientDiagnostics.CreateScope("NetworkServiceDesignGroupCollection.GetIfExists"); + scope.Start(); + try + { + var response = _networkServiceDesignGroupRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, networkServiceDesignGroupName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NetworkServiceDesignGroupResource(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/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/NetworkServiceDesignGroupData.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/NetworkServiceDesignGroupData.cs new file mode 100644 index 000000000000..b42fb333333d --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/NetworkServiceDesignGroupData.cs @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.HybridNetwork.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.HybridNetwork +{ + /// + /// A class representing the NetworkServiceDesignGroup data model. + /// network service design group resource. + /// + public partial class NetworkServiceDesignGroupData : TrackedResourceData + { + /// Initializes a new instance of NetworkServiceDesignGroupData. + /// The location. + public NetworkServiceDesignGroupData(AzureLocation location) : base(location) + { + } + + /// Initializes a new instance of NetworkServiceDesignGroupData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The tags. + /// The location. + /// network service design group properties. + internal NetworkServiceDesignGroupData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, NetworkServiceDesignGroupPropertiesFormat properties) : base(id, name, resourceType, systemData, tags, location) + { + Properties = properties; + } + + /// network service design group properties. + public NetworkServiceDesignGroupPropertiesFormat Properties { get; set; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/NetworkServiceDesignGroupResource.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/NetworkServiceDesignGroupResource.cs new file mode 100644 index 000000000000..9503f9c44b3d --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/NetworkServiceDesignGroupResource.cs @@ -0,0 +1,654 @@ +// 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; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.HybridNetwork.Models; + +namespace Azure.ResourceManager.HybridNetwork +{ + /// + /// A Class representing a NetworkServiceDesignGroup 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 GetNetworkServiceDesignGroupResource method. + /// Otherwise you can get one from its parent resource using the GetNetworkServiceDesignGroup method. + /// + public partial class NetworkServiceDesignGroupResource : ArmResource + { + /// Generate the resource identifier of a instance. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string publisherName, string networkServiceDesignGroupName) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _networkServiceDesignGroupClientDiagnostics; + private readonly NetworkServiceDesignGroupsRestOperations _networkServiceDesignGroupRestClient; + private readonly NetworkServiceDesignGroupData _data; + + /// Initializes a new instance of the class for mocking. + protected NetworkServiceDesignGroupResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal NetworkServiceDesignGroupResource(ArmClient client, NetworkServiceDesignGroupData 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 NetworkServiceDesignGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _networkServiceDesignGroupClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.HybridNetwork", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string networkServiceDesignGroupApiVersion); + _networkServiceDesignGroupRestClient = new NetworkServiceDesignGroupsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, networkServiceDesignGroupApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.HybridNetwork/publishers/networkServiceDesignGroups"; + + /// 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 NetworkServiceDesignGroupData 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 NetworkServiceDesignVersionResources in the NetworkServiceDesignGroup. + /// An object representing collection of NetworkServiceDesignVersionResources and their operations over a NetworkServiceDesignVersionResource. + public virtual NetworkServiceDesignVersionCollection GetNetworkServiceDesignVersions() + { + return GetCachedClient(Client => new NetworkServiceDesignVersionCollection(Client, Id)); + } + + /// + /// Gets information about a network service design version. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName}/networkServiceDesignVersions/{networkServiceDesignVersionName} + /// + /// + /// Operation Id + /// NetworkServiceDesignVersions_Get + /// + /// + /// + /// The name of the network service design version. The name should conform to the SemVer 2.0.0 specification: https://semver.org/spec/v2.0.0.html. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public virtual async Task> GetNetworkServiceDesignVersionAsync(string networkServiceDesignVersionName, CancellationToken cancellationToken = default) + { + return await GetNetworkServiceDesignVersions().GetAsync(networkServiceDesignVersionName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets information about a network service design version. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName}/networkServiceDesignVersions/{networkServiceDesignVersionName} + /// + /// + /// Operation Id + /// NetworkServiceDesignVersions_Get + /// + /// + /// + /// The name of the network service design version. The name should conform to the SemVer 2.0.0 specification: https://semver.org/spec/v2.0.0.html. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public virtual Response GetNetworkServiceDesignVersion(string networkServiceDesignVersionName, CancellationToken cancellationToken = default) + { + return GetNetworkServiceDesignVersions().Get(networkServiceDesignVersionName, cancellationToken); + } + + /// + /// Gets information about the specified networkServiceDesign group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName} + /// + /// + /// Operation Id + /// NetworkServiceDesignGroups_Get + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _networkServiceDesignGroupClientDiagnostics.CreateScope("NetworkServiceDesignGroupResource.Get"); + scope.Start(); + try + { + var response = await _networkServiceDesignGroupRestClient.GetAsync(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 NetworkServiceDesignGroupResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets information about the specified networkServiceDesign group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName} + /// + /// + /// Operation Id + /// NetworkServiceDesignGroups_Get + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _networkServiceDesignGroupClientDiagnostics.CreateScope("NetworkServiceDesignGroupResource.Get"); + scope.Start(); + try + { + var response = _networkServiceDesignGroupRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new NetworkServiceDesignGroupResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes a specified network service design group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName} + /// + /// + /// Operation Id + /// NetworkServiceDesignGroups_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _networkServiceDesignGroupClientDiagnostics.CreateScope("NetworkServiceDesignGroupResource.Delete"); + scope.Start(); + try + { + var response = await _networkServiceDesignGroupRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new HybridNetworkArmOperation(_networkServiceDesignGroupClientDiagnostics, Pipeline, _networkServiceDesignGroupRestClient.CreateDeleteRequest(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; + } + } + + /// + /// Deletes a specified network service design group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName} + /// + /// + /// Operation Id + /// NetworkServiceDesignGroups_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _networkServiceDesignGroupClientDiagnostics.CreateScope("NetworkServiceDesignGroupResource.Delete"); + scope.Start(); + try + { + var response = _networkServiceDesignGroupRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + var operation = new HybridNetworkArmOperation(_networkServiceDesignGroupClientDiagnostics, Pipeline, _networkServiceDesignGroupRestClient.CreateDeleteRequest(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; + } + } + + /// + /// Updates a network service design groups resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName} + /// + /// + /// Operation Id + /// NetworkServiceDesignGroups_Update + /// + /// + /// + /// Parameters supplied to the create or update publisher network service design group operation. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(TagsObject tagsObject, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tagsObject, nameof(tagsObject)); + + using var scope = _networkServiceDesignGroupClientDiagnostics.CreateScope("NetworkServiceDesignGroupResource.Update"); + scope.Start(); + try + { + var response = await _networkServiceDesignGroupRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, tagsObject, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new NetworkServiceDesignGroupResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Updates a network service design groups resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName} + /// + /// + /// Operation Id + /// NetworkServiceDesignGroups_Update + /// + /// + /// + /// Parameters supplied to the create or update publisher network service design group operation. + /// The cancellation token to use. + /// is null. + public virtual Response Update(TagsObject tagsObject, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tagsObject, nameof(tagsObject)); + + using var scope = _networkServiceDesignGroupClientDiagnostics.CreateScope("NetworkServiceDesignGroupResource.Update"); + scope.Start(); + try + { + var response = _networkServiceDesignGroupRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, tagsObject, cancellationToken); + return Response.FromValue(new NetworkServiceDesignGroupResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Add a tag to the current resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName} + /// + /// + /// Operation Id + /// NetworkServiceDesignGroups_Get + /// + /// + /// + /// 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 = _networkServiceDesignGroupClientDiagnostics.CreateScope("NetworkServiceDesignGroupResource.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 _networkServiceDesignGroupRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new NetworkServiceDesignGroupResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new TagsObject(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags[key] = value; + var result = await UpdateAsync(patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return result; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Add a tag to the current resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName} + /// + /// + /// Operation Id + /// NetworkServiceDesignGroups_Get + /// + /// + /// + /// 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 = _networkServiceDesignGroupClientDiagnostics.CreateScope("NetworkServiceDesignGroupResource.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 = _networkServiceDesignGroupRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + return Response.FromValue(new NetworkServiceDesignGroupResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new TagsObject(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags[key] = value; + var result = Update(patch, cancellationToken: cancellationToken); + return result; + } + } + 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.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName} + /// + /// + /// Operation Id + /// NetworkServiceDesignGroups_Get + /// + /// + /// + /// 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 = _networkServiceDesignGroupClientDiagnostics.CreateScope("NetworkServiceDesignGroupResource.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 _networkServiceDesignGroupRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new NetworkServiceDesignGroupResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new TagsObject(); + patch.Tags.ReplaceWith(tags); + var result = await UpdateAsync(patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return result; + } + } + 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.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName} + /// + /// + /// Operation Id + /// NetworkServiceDesignGroups_Get + /// + /// + /// + /// 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 = _networkServiceDesignGroupClientDiagnostics.CreateScope("NetworkServiceDesignGroupResource.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 = _networkServiceDesignGroupRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + return Response.FromValue(new NetworkServiceDesignGroupResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new TagsObject(); + patch.Tags.ReplaceWith(tags); + var result = Update(patch, cancellationToken: cancellationToken); + return result; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Removes a tag by key from the resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName} + /// + /// + /// Operation Id + /// NetworkServiceDesignGroups_Get + /// + /// + /// + /// 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 = _networkServiceDesignGroupClientDiagnostics.CreateScope("NetworkServiceDesignGroupResource.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 _networkServiceDesignGroupRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new NetworkServiceDesignGroupResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new TagsObject(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags.Remove(key); + var result = await UpdateAsync(patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return result; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Removes a tag by key from the resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName} + /// + /// + /// Operation Id + /// NetworkServiceDesignGroups_Get + /// + /// + /// + /// 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 = _networkServiceDesignGroupClientDiagnostics.CreateScope("NetworkServiceDesignGroupResource.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 = _networkServiceDesignGroupRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + return Response.FromValue(new NetworkServiceDesignGroupResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new TagsObject(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags.Remove(key); + var result = Update(patch, cancellationToken: cancellationToken); + return result; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/NetworkServiceDesignVersionCollection.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/NetworkServiceDesignVersionCollection.cs new file mode 100644 index 000000000000..085d42a6af74 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/NetworkServiceDesignVersionCollection.cs @@ -0,0 +1,415 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.HybridNetwork +{ + /// + /// 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 GetNetworkServiceDesignVersions method from an instance of . + /// + public partial class NetworkServiceDesignVersionCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _networkServiceDesignVersionClientDiagnostics; + private readonly NetworkServiceDesignVersionsRestOperations _networkServiceDesignVersionRestClient; + + /// Initializes a new instance of the class for mocking. + protected NetworkServiceDesignVersionCollection() + { + } + + /// 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 NetworkServiceDesignVersionCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _networkServiceDesignVersionClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.HybridNetwork", NetworkServiceDesignVersionResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(NetworkServiceDesignVersionResource.ResourceType, out string networkServiceDesignVersionApiVersion); + _networkServiceDesignVersionRestClient = new NetworkServiceDesignVersionsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, networkServiceDesignVersionApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != NetworkServiceDesignGroupResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, NetworkServiceDesignGroupResource.ResourceType), nameof(id)); + } + + /// + /// Creates or updates a network service design version. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName}/networkServiceDesignVersions/{networkServiceDesignVersionName} + /// + /// + /// Operation Id + /// NetworkServiceDesignVersions_CreateOrUpdate + /// + /// + /// + /// 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 network service design version. The name should conform to the SemVer 2.0.0 specification: https://semver.org/spec/v2.0.0.html. + /// Parameters supplied to the create or update network service design version operation. + /// 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 networkServiceDesignVersionName, NetworkServiceDesignVersionData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(networkServiceDesignVersionName, nameof(networkServiceDesignVersionName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _networkServiceDesignVersionClientDiagnostics.CreateScope("NetworkServiceDesignVersionCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _networkServiceDesignVersionRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, networkServiceDesignVersionName, data, cancellationToken).ConfigureAwait(false); + var operation = new HybridNetworkArmOperation(new NetworkServiceDesignVersionOperationSource(Client), _networkServiceDesignVersionClientDiagnostics, Pipeline, _networkServiceDesignVersionRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, networkServiceDesignVersionName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates or updates a network service design version. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName}/networkServiceDesignVersions/{networkServiceDesignVersionName} + /// + /// + /// Operation Id + /// NetworkServiceDesignVersions_CreateOrUpdate + /// + /// + /// + /// 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 network service design version. The name should conform to the SemVer 2.0.0 specification: https://semver.org/spec/v2.0.0.html. + /// Parameters supplied to the create or update network service design version operation. + /// 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 networkServiceDesignVersionName, NetworkServiceDesignVersionData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(networkServiceDesignVersionName, nameof(networkServiceDesignVersionName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _networkServiceDesignVersionClientDiagnostics.CreateScope("NetworkServiceDesignVersionCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _networkServiceDesignVersionRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, networkServiceDesignVersionName, data, cancellationToken); + var operation = new HybridNetworkArmOperation(new NetworkServiceDesignVersionOperationSource(Client), _networkServiceDesignVersionClientDiagnostics, Pipeline, _networkServiceDesignVersionRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, networkServiceDesignVersionName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets information about a network service design version. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName}/networkServiceDesignVersions/{networkServiceDesignVersionName} + /// + /// + /// Operation Id + /// NetworkServiceDesignVersions_Get + /// + /// + /// + /// The name of the network service design version. The name should conform to the SemVer 2.0.0 specification: https://semver.org/spec/v2.0.0.html. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string networkServiceDesignVersionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(networkServiceDesignVersionName, nameof(networkServiceDesignVersionName)); + + using var scope = _networkServiceDesignVersionClientDiagnostics.CreateScope("NetworkServiceDesignVersionCollection.Get"); + scope.Start(); + try + { + var response = await _networkServiceDesignVersionRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, networkServiceDesignVersionName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new NetworkServiceDesignVersionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets information about a network service design version. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName}/networkServiceDesignVersions/{networkServiceDesignVersionName} + /// + /// + /// Operation Id + /// NetworkServiceDesignVersions_Get + /// + /// + /// + /// The name of the network service design version. The name should conform to the SemVer 2.0.0 specification: https://semver.org/spec/v2.0.0.html. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string networkServiceDesignVersionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(networkServiceDesignVersionName, nameof(networkServiceDesignVersionName)); + + using var scope = _networkServiceDesignVersionClientDiagnostics.CreateScope("NetworkServiceDesignVersionCollection.Get"); + scope.Start(); + try + { + var response = _networkServiceDesignVersionRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, networkServiceDesignVersionName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new NetworkServiceDesignVersionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets information about a list of network service design versions under a network service design group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName}/networkServiceDesignVersions + /// + /// + /// Operation Id + /// NetworkServiceDesignVersions_ListByNetworkServiceDesignGroup + /// + /// + /// + /// 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) => _networkServiceDesignVersionRestClient.CreateListByNetworkServiceDesignGroupRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _networkServiceDesignVersionRestClient.CreateListByNetworkServiceDesignGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new NetworkServiceDesignVersionResource(Client, NetworkServiceDesignVersionData.DeserializeNetworkServiceDesignVersionData(e)), _networkServiceDesignVersionClientDiagnostics, Pipeline, "NetworkServiceDesignVersionCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Gets information about a list of network service design versions under a network service design group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName}/networkServiceDesignVersions + /// + /// + /// Operation Id + /// NetworkServiceDesignVersions_ListByNetworkServiceDesignGroup + /// + /// + /// + /// 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) => _networkServiceDesignVersionRestClient.CreateListByNetworkServiceDesignGroupRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _networkServiceDesignVersionRestClient.CreateListByNetworkServiceDesignGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new NetworkServiceDesignVersionResource(Client, NetworkServiceDesignVersionData.DeserializeNetworkServiceDesignVersionData(e)), _networkServiceDesignVersionClientDiagnostics, Pipeline, "NetworkServiceDesignVersionCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName}/networkServiceDesignVersions/{networkServiceDesignVersionName} + /// + /// + /// Operation Id + /// NetworkServiceDesignVersions_Get + /// + /// + /// + /// The name of the network service design version. The name should conform to the SemVer 2.0.0 specification: https://semver.org/spec/v2.0.0.html. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string networkServiceDesignVersionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(networkServiceDesignVersionName, nameof(networkServiceDesignVersionName)); + + using var scope = _networkServiceDesignVersionClientDiagnostics.CreateScope("NetworkServiceDesignVersionCollection.Exists"); + scope.Start(); + try + { + var response = await _networkServiceDesignVersionRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, networkServiceDesignVersionName, 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.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName}/networkServiceDesignVersions/{networkServiceDesignVersionName} + /// + /// + /// Operation Id + /// NetworkServiceDesignVersions_Get + /// + /// + /// + /// The name of the network service design version. The name should conform to the SemVer 2.0.0 specification: https://semver.org/spec/v2.0.0.html. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string networkServiceDesignVersionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(networkServiceDesignVersionName, nameof(networkServiceDesignVersionName)); + + using var scope = _networkServiceDesignVersionClientDiagnostics.CreateScope("NetworkServiceDesignVersionCollection.Exists"); + scope.Start(); + try + { + var response = _networkServiceDesignVersionRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, networkServiceDesignVersionName, 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.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName}/networkServiceDesignVersions/{networkServiceDesignVersionName} + /// + /// + /// Operation Id + /// NetworkServiceDesignVersions_Get + /// + /// + /// + /// The name of the network service design version. The name should conform to the SemVer 2.0.0 specification: https://semver.org/spec/v2.0.0.html. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string networkServiceDesignVersionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(networkServiceDesignVersionName, nameof(networkServiceDesignVersionName)); + + using var scope = _networkServiceDesignVersionClientDiagnostics.CreateScope("NetworkServiceDesignVersionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _networkServiceDesignVersionRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, networkServiceDesignVersionName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NetworkServiceDesignVersionResource(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.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName}/networkServiceDesignVersions/{networkServiceDesignVersionName} + /// + /// + /// Operation Id + /// NetworkServiceDesignVersions_Get + /// + /// + /// + /// The name of the network service design version. The name should conform to the SemVer 2.0.0 specification: https://semver.org/spec/v2.0.0.html. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string networkServiceDesignVersionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(networkServiceDesignVersionName, nameof(networkServiceDesignVersionName)); + + using var scope = _networkServiceDesignVersionClientDiagnostics.CreateScope("NetworkServiceDesignVersionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _networkServiceDesignVersionRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, networkServiceDesignVersionName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NetworkServiceDesignVersionResource(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/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/NetworkServiceDesignVersionData.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/NetworkServiceDesignVersionData.cs new file mode 100644 index 000000000000..ace444421b90 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/NetworkServiceDesignVersionData.cs @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.HybridNetwork.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.HybridNetwork +{ + /// + /// A class representing the NetworkServiceDesignVersion data model. + /// network service design version. + /// + public partial class NetworkServiceDesignVersionData : TrackedResourceData + { + /// Initializes a new instance of NetworkServiceDesignVersionData. + /// The location. + public NetworkServiceDesignVersionData(AzureLocation location) : base(location) + { + } + + /// Initializes a new instance of NetworkServiceDesignVersionData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The tags. + /// The location. + /// network service design version properties. + internal NetworkServiceDesignVersionData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, NetworkServiceDesignVersionPropertiesFormat properties) : base(id, name, resourceType, systemData, tags, location) + { + Properties = properties; + } + + /// network service design version properties. + public NetworkServiceDesignVersionPropertiesFormat Properties { get; set; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/NetworkServiceDesignVersionResource.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/NetworkServiceDesignVersionResource.cs new file mode 100644 index 000000000000..cb9787f9ac88 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/NetworkServiceDesignVersionResource.cs @@ -0,0 +1,677 @@ +// 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; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.HybridNetwork.Models; + +namespace Azure.ResourceManager.HybridNetwork +{ + /// + /// A Class representing a NetworkServiceDesignVersion 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 GetNetworkServiceDesignVersionResource method. + /// Otherwise you can get one from its parent resource using the GetNetworkServiceDesignVersion method. + /// + public partial class NetworkServiceDesignVersionResource : ArmResource + { + /// Generate the resource identifier of a instance. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string publisherName, string networkServiceDesignGroupName, string networkServiceDesignVersionName) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName}/networkServiceDesignVersions/{networkServiceDesignVersionName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _networkServiceDesignVersionClientDiagnostics; + private readonly NetworkServiceDesignVersionsRestOperations _networkServiceDesignVersionRestClient; + private readonly NetworkServiceDesignVersionData _data; + + /// Initializes a new instance of the class for mocking. + protected NetworkServiceDesignVersionResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal NetworkServiceDesignVersionResource(ArmClient client, NetworkServiceDesignVersionData 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 NetworkServiceDesignVersionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _networkServiceDesignVersionClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.HybridNetwork", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string networkServiceDesignVersionApiVersion); + _networkServiceDesignVersionRestClient = new NetworkServiceDesignVersionsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, networkServiceDesignVersionApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.HybridNetwork/publishers/networkServiceDesignGroups/networkServiceDesignVersions"; + + /// 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 NetworkServiceDesignVersionData 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 information about a network service design version. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName}/networkServiceDesignVersions/{networkServiceDesignVersionName} + /// + /// + /// Operation Id + /// NetworkServiceDesignVersions_Get + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _networkServiceDesignVersionClientDiagnostics.CreateScope("NetworkServiceDesignVersionResource.Get"); + scope.Start(); + try + { + var response = await _networkServiceDesignVersionRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new NetworkServiceDesignVersionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets information about a network service design version. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName}/networkServiceDesignVersions/{networkServiceDesignVersionName} + /// + /// + /// Operation Id + /// NetworkServiceDesignVersions_Get + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _networkServiceDesignVersionClientDiagnostics.CreateScope("NetworkServiceDesignVersionResource.Get"); + scope.Start(); + try + { + var response = _networkServiceDesignVersionRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new NetworkServiceDesignVersionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes the specified network service design version. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName}/networkServiceDesignVersions/{networkServiceDesignVersionName} + /// + /// + /// Operation Id + /// NetworkServiceDesignVersions_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _networkServiceDesignVersionClientDiagnostics.CreateScope("NetworkServiceDesignVersionResource.Delete"); + scope.Start(); + try + { + var response = await _networkServiceDesignVersionRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new HybridNetworkArmOperation(_networkServiceDesignVersionClientDiagnostics, Pipeline, _networkServiceDesignVersionRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes the specified network service design version. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName}/networkServiceDesignVersions/{networkServiceDesignVersionName} + /// + /// + /// Operation Id + /// NetworkServiceDesignVersions_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _networkServiceDesignVersionClientDiagnostics.CreateScope("NetworkServiceDesignVersionResource.Delete"); + scope.Start(); + try + { + var response = _networkServiceDesignVersionRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + var operation = new HybridNetworkArmOperation(_networkServiceDesignVersionClientDiagnostics, Pipeline, _networkServiceDesignVersionRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Updates a network service design version resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName}/networkServiceDesignVersions/{networkServiceDesignVersionName} + /// + /// + /// Operation Id + /// NetworkServiceDesignVersions_Update + /// + /// + /// + /// Parameters supplied to the create or update network service design version operation. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(TagsObject tagsObject, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tagsObject, nameof(tagsObject)); + + using var scope = _networkServiceDesignVersionClientDiagnostics.CreateScope("NetworkServiceDesignVersionResource.Update"); + scope.Start(); + try + { + var response = await _networkServiceDesignVersionRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, tagsObject, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new NetworkServiceDesignVersionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Updates a network service design version resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName}/networkServiceDesignVersions/{networkServiceDesignVersionName} + /// + /// + /// Operation Id + /// NetworkServiceDesignVersions_Update + /// + /// + /// + /// Parameters supplied to the create or update network service design version operation. + /// The cancellation token to use. + /// is null. + public virtual Response Update(TagsObject tagsObject, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tagsObject, nameof(tagsObject)); + + using var scope = _networkServiceDesignVersionClientDiagnostics.CreateScope("NetworkServiceDesignVersionResource.Update"); + scope.Start(); + try + { + var response = _networkServiceDesignVersionRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, tagsObject, cancellationToken); + return Response.FromValue(new NetworkServiceDesignVersionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Update network service design version state. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName}/networkServiceDesignVersions/{networkServiceDesignVersionName}/updateState + /// + /// + /// Operation Id + /// NetworkServiceDesignVersions_updateState + /// + /// + /// + /// 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. + /// Parameters supplied to update the state of network service design version. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateStateAsync(WaitUntil waitUntil, NetworkServiceDesignVersionUpdateState networkServiceDesignVersionUpdateState, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(networkServiceDesignVersionUpdateState, nameof(networkServiceDesignVersionUpdateState)); + + using var scope = _networkServiceDesignVersionClientDiagnostics.CreateScope("NetworkServiceDesignVersionResource.UpdateState"); + scope.Start(); + try + { + var response = await _networkServiceDesignVersionRestClient.UpdateStateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, networkServiceDesignVersionUpdateState, cancellationToken).ConfigureAwait(false); + var operation = new HybridNetworkArmOperation(new NetworkServiceDesignVersionUpdateStateOperationSource(), _networkServiceDesignVersionClientDiagnostics, Pipeline, _networkServiceDesignVersionRestClient.CreateUpdateStateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, networkServiceDesignVersionUpdateState).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Update network service design version state. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName}/networkServiceDesignVersions/{networkServiceDesignVersionName}/updateState + /// + /// + /// Operation Id + /// NetworkServiceDesignVersions_updateState + /// + /// + /// + /// 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. + /// Parameters supplied to update the state of network service design version. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation UpdateState(WaitUntil waitUntil, NetworkServiceDesignVersionUpdateState networkServiceDesignVersionUpdateState, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(networkServiceDesignVersionUpdateState, nameof(networkServiceDesignVersionUpdateState)); + + using var scope = _networkServiceDesignVersionClientDiagnostics.CreateScope("NetworkServiceDesignVersionResource.UpdateState"); + scope.Start(); + try + { + var response = _networkServiceDesignVersionRestClient.UpdateState(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, networkServiceDesignVersionUpdateState, cancellationToken); + var operation = new HybridNetworkArmOperation(new NetworkServiceDesignVersionUpdateStateOperationSource(), _networkServiceDesignVersionClientDiagnostics, Pipeline, _networkServiceDesignVersionRestClient.CreateUpdateStateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, networkServiceDesignVersionUpdateState).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.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName}/networkServiceDesignVersions/{networkServiceDesignVersionName} + /// + /// + /// Operation Id + /// NetworkServiceDesignVersions_Get + /// + /// + /// + /// 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 = _networkServiceDesignVersionClientDiagnostics.CreateScope("NetworkServiceDesignVersionResource.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 _networkServiceDesignVersionRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new NetworkServiceDesignVersionResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new TagsObject(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags[key] = value; + var result = await UpdateAsync(patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return result; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Add a tag to the current resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName}/networkServiceDesignVersions/{networkServiceDesignVersionName} + /// + /// + /// Operation Id + /// NetworkServiceDesignVersions_Get + /// + /// + /// + /// 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 = _networkServiceDesignVersionClientDiagnostics.CreateScope("NetworkServiceDesignVersionResource.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 = _networkServiceDesignVersionRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + return Response.FromValue(new NetworkServiceDesignVersionResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new TagsObject(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags[key] = value; + var result = Update(patch, cancellationToken: cancellationToken); + return result; + } + } + 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.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName}/networkServiceDesignVersions/{networkServiceDesignVersionName} + /// + /// + /// Operation Id + /// NetworkServiceDesignVersions_Get + /// + /// + /// + /// 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 = _networkServiceDesignVersionClientDiagnostics.CreateScope("NetworkServiceDesignVersionResource.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 _networkServiceDesignVersionRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new NetworkServiceDesignVersionResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new TagsObject(); + patch.Tags.ReplaceWith(tags); + var result = await UpdateAsync(patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return result; + } + } + 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.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName}/networkServiceDesignVersions/{networkServiceDesignVersionName} + /// + /// + /// Operation Id + /// NetworkServiceDesignVersions_Get + /// + /// + /// + /// 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 = _networkServiceDesignVersionClientDiagnostics.CreateScope("NetworkServiceDesignVersionResource.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 = _networkServiceDesignVersionRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + return Response.FromValue(new NetworkServiceDesignVersionResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new TagsObject(); + patch.Tags.ReplaceWith(tags); + var result = Update(patch, cancellationToken: cancellationToken); + return result; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Removes a tag by key from the resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName}/networkServiceDesignVersions/{networkServiceDesignVersionName} + /// + /// + /// Operation Id + /// NetworkServiceDesignVersions_Get + /// + /// + /// + /// 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 = _networkServiceDesignVersionClientDiagnostics.CreateScope("NetworkServiceDesignVersionResource.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 _networkServiceDesignVersionRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new NetworkServiceDesignVersionResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new TagsObject(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags.Remove(key); + var result = await UpdateAsync(patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return result; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Removes a tag by key from the resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName}/networkServiceDesignVersions/{networkServiceDesignVersionName} + /// + /// + /// Operation Id + /// NetworkServiceDesignVersions_Get + /// + /// + /// + /// 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 = _networkServiceDesignVersionClientDiagnostics.CreateScope("NetworkServiceDesignVersionResource.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 = _networkServiceDesignVersionRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + return Response.FromValue(new NetworkServiceDesignVersionResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new TagsObject(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags.Remove(key); + var result = Update(patch, cancellationToken: cancellationToken); + return result; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/ProviderConstants.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/ProviderConstants.cs new file mode 100644 index 000000000000..abc9b5a94350 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/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.HybridNetwork +{ + internal static class ProviderConstants + { + public static string DefaultProviderNamespace { get; } = ClientDiagnostics.GetResourceProviderNamespace(typeof(ProviderConstants).Assembly); + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/PublisherCollection.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/PublisherCollection.cs new file mode 100644 index 000000000000..0a774b33f3fe --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/PublisherCollection.cs @@ -0,0 +1,416 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.HybridNetwork +{ + /// + /// 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 GetPublishers method from an instance of . + /// + public partial class PublisherCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _publisherClientDiagnostics; + private readonly PublishersRestOperations _publisherRestClient; + + /// Initializes a new instance of the class for mocking. + protected PublisherCollection() + { + } + + /// 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 PublisherCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _publisherClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.HybridNetwork", PublisherResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(PublisherResource.ResourceType, out string publisherApiVersion); + _publisherRestClient = new PublishersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, publisherApiVersion); +#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)); + } + + /// + /// Creates or updates a publisher. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName} + /// + /// + /// Operation Id + /// Publishers_CreateOrUpdate + /// + /// + /// + /// 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 publisher. + /// Parameters supplied to the create publisher operation. + /// 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 publisherName, PublisherData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _publisherClientDiagnostics.CreateScope("PublisherCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _publisherRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, publisherName, data, cancellationToken).ConfigureAwait(false); + var operation = new HybridNetworkArmOperation(new PublisherOperationSource(Client), _publisherClientDiagnostics, Pipeline, _publisherRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, publisherName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates or updates a publisher. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName} + /// + /// + /// Operation Id + /// Publishers_CreateOrUpdate + /// + /// + /// + /// 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 publisher. + /// Parameters supplied to the create publisher operation. + /// 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 publisherName, PublisherData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _publisherClientDiagnostics.CreateScope("PublisherCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _publisherRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, publisherName, data, cancellationToken); + var operation = new HybridNetworkArmOperation(new PublisherOperationSource(Client), _publisherClientDiagnostics, Pipeline, _publisherRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, publisherName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets information about the specified publisher. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName} + /// + /// + /// Operation Id + /// Publishers_Get + /// + /// + /// + /// The name of the publisher. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string publisherName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + + using var scope = _publisherClientDiagnostics.CreateScope("PublisherCollection.Get"); + scope.Start(); + try + { + var response = await _publisherRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, publisherName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new PublisherResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets information about the specified publisher. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName} + /// + /// + /// Operation Id + /// Publishers_Get + /// + /// + /// + /// The name of the publisher. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string publisherName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + + using var scope = _publisherClientDiagnostics.CreateScope("PublisherCollection.Get"); + scope.Start(); + try + { + var response = _publisherRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, publisherName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new PublisherResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Lists all the publishers in a resource group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers + /// + /// + /// Operation Id + /// Publishers_ListByResourceGroup + /// + /// + /// + /// 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) => _publisherRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _publisherRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new PublisherResource(Client, PublisherData.DeserializePublisherData(e)), _publisherClientDiagnostics, Pipeline, "PublisherCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Lists all the publishers in a resource group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers + /// + /// + /// Operation Id + /// Publishers_ListByResourceGroup + /// + /// + /// + /// 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) => _publisherRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _publisherRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new PublisherResource(Client, PublisherData.DeserializePublisherData(e)), _publisherClientDiagnostics, Pipeline, "PublisherCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName} + /// + /// + /// Operation Id + /// Publishers_Get + /// + /// + /// + /// The name of the publisher. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string publisherName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + + using var scope = _publisherClientDiagnostics.CreateScope("PublisherCollection.Exists"); + scope.Start(); + try + { + var response = await _publisherRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, publisherName, 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.HybridNetwork/publishers/{publisherName} + /// + /// + /// Operation Id + /// Publishers_Get + /// + /// + /// + /// The name of the publisher. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string publisherName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + + using var scope = _publisherClientDiagnostics.CreateScope("PublisherCollection.Exists"); + scope.Start(); + try + { + var response = _publisherRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, publisherName, 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.HybridNetwork/publishers/{publisherName} + /// + /// + /// Operation Id + /// Publishers_Get + /// + /// + /// + /// The name of the publisher. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string publisherName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + + using var scope = _publisherClientDiagnostics.CreateScope("PublisherCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _publisherRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, publisherName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new PublisherResource(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.HybridNetwork/publishers/{publisherName} + /// + /// + /// Operation Id + /// Publishers_Get + /// + /// + /// + /// The name of the publisher. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string publisherName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + + using var scope = _publisherClientDiagnostics.CreateScope("PublisherCollection.GetIfExists"); + scope.Start(); + try + { + var response = _publisherRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, publisherName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new PublisherResource(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/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/PublisherData.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/PublisherData.cs new file mode 100644 index 000000000000..5055d8f17468 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/PublisherData.cs @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.HybridNetwork.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.HybridNetwork +{ + /// + /// A class representing the Publisher data model. + /// publisher resource. + /// + public partial class PublisherData : TrackedResourceData + { + /// Initializes a new instance of PublisherData. + /// The location. + public PublisherData(AzureLocation location) : base(location) + { + } + + /// Initializes a new instance of PublisherData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The tags. + /// The location. + /// Publisher properties. + /// The managed identity of the publisher, if configured. + internal PublisherData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, PublisherPropertiesFormat properties, ManagedServiceIdentity identity) : base(id, name, resourceType, systemData, tags, location) + { + Properties = properties; + Identity = identity; + } + + /// Publisher properties. + public PublisherPropertiesFormat Properties { get; set; } + /// The managed identity of the publisher, if configured. + public ManagedServiceIdentity Identity { get; set; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/PublisherResource.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/PublisherResource.cs new file mode 100644 index 000000000000..69cf79e9a4c2 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/PublisherResource.cs @@ -0,0 +1,814 @@ +// 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; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.HybridNetwork.Models; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.HybridNetwork +{ + /// + /// A Class representing a Publisher 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 GetPublisherResource method. + /// Otherwise you can get one from its parent resource using the GetPublisher method. + /// + public partial class PublisherResource : ArmResource + { + /// Generate the resource identifier of a instance. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string publisherName) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _publisherClientDiagnostics; + private readonly PublishersRestOperations _publisherRestClient; + private readonly PublisherData _data; + + /// Initializes a new instance of the class for mocking. + protected PublisherResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal PublisherResource(ArmClient client, PublisherData 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 PublisherResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _publisherClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.HybridNetwork", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string publisherApiVersion); + _publisherRestClient = new PublishersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, publisherApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.HybridNetwork/publishers"; + + /// 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 PublisherData 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 ConfigurationGroupSchemaResources in the Publisher. + /// An object representing collection of ConfigurationGroupSchemaResources and their operations over a ConfigurationGroupSchemaResource. + public virtual ConfigurationGroupSchemaCollection GetConfigurationGroupSchemas() + { + return GetCachedClient(Client => new ConfigurationGroupSchemaCollection(Client, Id)); + } + + /// + /// Gets information about the specified configuration group schema. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/configurationGroupSchemas/{configurationGroupSchemaName} + /// + /// + /// Operation Id + /// ConfigurationGroupSchemas_Get + /// + /// + /// + /// The name of the configuration group schema. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public virtual async Task> GetConfigurationGroupSchemaAsync(string configurationGroupSchemaName, CancellationToken cancellationToken = default) + { + return await GetConfigurationGroupSchemas().GetAsync(configurationGroupSchemaName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets information about the specified configuration group schema. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/configurationGroupSchemas/{configurationGroupSchemaName} + /// + /// + /// Operation Id + /// ConfigurationGroupSchemas_Get + /// + /// + /// + /// The name of the configuration group schema. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public virtual Response GetConfigurationGroupSchema(string configurationGroupSchemaName, CancellationToken cancellationToken = default) + { + return GetConfigurationGroupSchemas().Get(configurationGroupSchemaName, cancellationToken); + } + + /// Gets a collection of NetworkFunctionDefinitionGroupResources in the Publisher. + /// An object representing collection of NetworkFunctionDefinitionGroupResources and their operations over a NetworkFunctionDefinitionGroupResource. + public virtual NetworkFunctionDefinitionGroupCollection GetNetworkFunctionDefinitionGroups() + { + return GetCachedClient(Client => new NetworkFunctionDefinitionGroupCollection(Client, Id)); + } + + /// + /// Gets information about the specified networkFunctionDefinition group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName} + /// + /// + /// Operation Id + /// NetworkFunctionDefinitionGroups_Get + /// + /// + /// + /// The name of the network function definition group. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public virtual async Task> GetNetworkFunctionDefinitionGroupAsync(string networkFunctionDefinitionGroupName, CancellationToken cancellationToken = default) + { + return await GetNetworkFunctionDefinitionGroups().GetAsync(networkFunctionDefinitionGroupName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets information about the specified networkFunctionDefinition group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName} + /// + /// + /// Operation Id + /// NetworkFunctionDefinitionGroups_Get + /// + /// + /// + /// The name of the network function definition group. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public virtual Response GetNetworkFunctionDefinitionGroup(string networkFunctionDefinitionGroupName, CancellationToken cancellationToken = default) + { + return GetNetworkFunctionDefinitionGroups().Get(networkFunctionDefinitionGroupName, cancellationToken); + } + + /// Gets a collection of NetworkServiceDesignGroupResources in the Publisher. + /// An object representing collection of NetworkServiceDesignGroupResources and their operations over a NetworkServiceDesignGroupResource. + public virtual NetworkServiceDesignGroupCollection GetNetworkServiceDesignGroups() + { + return GetCachedClient(Client => new NetworkServiceDesignGroupCollection(Client, Id)); + } + + /// + /// Gets information about the specified networkServiceDesign group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName} + /// + /// + /// Operation Id + /// NetworkServiceDesignGroups_Get + /// + /// + /// + /// The name of the network service design group. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public virtual async Task> GetNetworkServiceDesignGroupAsync(string networkServiceDesignGroupName, CancellationToken cancellationToken = default) + { + return await GetNetworkServiceDesignGroups().GetAsync(networkServiceDesignGroupName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets information about the specified networkServiceDesign group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName} + /// + /// + /// Operation Id + /// NetworkServiceDesignGroups_Get + /// + /// + /// + /// The name of the network service design group. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public virtual Response GetNetworkServiceDesignGroup(string networkServiceDesignGroupName, CancellationToken cancellationToken = default) + { + return GetNetworkServiceDesignGroups().Get(networkServiceDesignGroupName, cancellationToken); + } + + /// Gets a collection of ArtifactStoreResources in the Publisher. + /// An object representing collection of ArtifactStoreResources and their operations over a ArtifactStoreResource. + public virtual ArtifactStoreCollection GetArtifactStores() + { + return GetCachedClient(Client => new ArtifactStoreCollection(Client, Id)); + } + + /// + /// Gets information about the specified artifact store. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName} + /// + /// + /// Operation Id + /// ArtifactStores_Get + /// + /// + /// + /// The name of the artifact store. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public virtual async Task> GetArtifactStoreAsync(string artifactStoreName, CancellationToken cancellationToken = default) + { + return await GetArtifactStores().GetAsync(artifactStoreName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets information about the specified artifact store. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName} + /// + /// + /// Operation Id + /// ArtifactStores_Get + /// + /// + /// + /// The name of the artifact store. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public virtual Response GetArtifactStore(string artifactStoreName, CancellationToken cancellationToken = default) + { + return GetArtifactStores().Get(artifactStoreName, cancellationToken); + } + + /// + /// Gets information about the specified publisher. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName} + /// + /// + /// Operation Id + /// Publishers_Get + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _publisherClientDiagnostics.CreateScope("PublisherResource.Get"); + scope.Start(); + try + { + var response = await _publisherRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new PublisherResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets information about the specified publisher. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName} + /// + /// + /// Operation Id + /// Publishers_Get + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _publisherClientDiagnostics.CreateScope("PublisherResource.Get"); + scope.Start(); + try + { + var response = _publisherRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new PublisherResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes the specified publisher. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName} + /// + /// + /// Operation Id + /// Publishers_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _publisherClientDiagnostics.CreateScope("PublisherResource.Delete"); + scope.Start(); + try + { + var response = await _publisherRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new HybridNetworkArmOperation(_publisherClientDiagnostics, Pipeline, _publisherRestClient.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; + } + } + + /// + /// Deletes the specified publisher. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName} + /// + /// + /// Operation Id + /// Publishers_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _publisherClientDiagnostics.CreateScope("PublisherResource.Delete"); + scope.Start(); + try + { + var response = _publisherRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + var operation = new HybridNetworkArmOperation(_publisherClientDiagnostics, Pipeline, _publisherRestClient.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 publisher resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName} + /// + /// + /// Operation Id + /// Publishers_Update + /// + /// + /// + /// Parameters supplied to the create publisher operation. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(TagsObject tagsObject, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tagsObject, nameof(tagsObject)); + + using var scope = _publisherClientDiagnostics.CreateScope("PublisherResource.Update"); + scope.Start(); + try + { + var response = await _publisherRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, tagsObject, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new PublisherResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Update a publisher resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName} + /// + /// + /// Operation Id + /// Publishers_Update + /// + /// + /// + /// Parameters supplied to the create publisher operation. + /// The cancellation token to use. + /// is null. + public virtual Response Update(TagsObject tagsObject, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tagsObject, nameof(tagsObject)); + + using var scope = _publisherClientDiagnostics.CreateScope("PublisherResource.Update"); + scope.Start(); + try + { + var response = _publisherRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, tagsObject, cancellationToken); + return Response.FromValue(new PublisherResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Add a tag to the current resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName} + /// + /// + /// Operation Id + /// Publishers_Get + /// + /// + /// + /// 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 = _publisherClientDiagnostics.CreateScope("PublisherResource.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 _publisherRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new PublisherResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new TagsObject(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags[key] = value; + var result = await UpdateAsync(patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return result; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Add a tag to the current resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName} + /// + /// + /// Operation Id + /// Publishers_Get + /// + /// + /// + /// 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 = _publisherClientDiagnostics.CreateScope("PublisherResource.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 = _publisherRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + return Response.FromValue(new PublisherResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new TagsObject(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags[key] = value; + var result = Update(patch, cancellationToken: cancellationToken); + return result; + } + } + 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.HybridNetwork/publishers/{publisherName} + /// + /// + /// Operation Id + /// Publishers_Get + /// + /// + /// + /// 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 = _publisherClientDiagnostics.CreateScope("PublisherResource.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 _publisherRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new PublisherResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new TagsObject(); + patch.Tags.ReplaceWith(tags); + var result = await UpdateAsync(patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return result; + } + } + 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.HybridNetwork/publishers/{publisherName} + /// + /// + /// Operation Id + /// Publishers_Get + /// + /// + /// + /// 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 = _publisherClientDiagnostics.CreateScope("PublisherResource.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 = _publisherRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + return Response.FromValue(new PublisherResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new TagsObject(); + patch.Tags.ReplaceWith(tags); + var result = Update(patch, cancellationToken: cancellationToken); + return result; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Removes a tag by key from the resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName} + /// + /// + /// Operation Id + /// Publishers_Get + /// + /// + /// + /// 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 = _publisherClientDiagnostics.CreateScope("PublisherResource.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 _publisherRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new PublisherResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new TagsObject(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags.Remove(key); + var result = await UpdateAsync(patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return result; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Removes a tag by key from the resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName} + /// + /// + /// Operation Id + /// Publishers_Get + /// + /// + /// + /// 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 = _publisherClientDiagnostics.CreateScope("PublisherResource.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 = _publisherRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + return Response.FromValue(new PublisherResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new TagsObject(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags.Remove(key); + var result = Update(patch, cancellationToken: cancellationToken); + return result; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/RestOperations/ArtifactManifestsRestOperations.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/RestOperations/ArtifactManifestsRestOperations.cs new file mode 100644 index 000000000000..2dda76dd9641 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/RestOperations/ArtifactManifestsRestOperations.cs @@ -0,0 +1,751 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.HybridNetwork.Models; + +namespace Azure.ResourceManager.HybridNetwork +{ + internal partial class ArtifactManifestsRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of ArtifactManifestsRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public ArtifactManifestsRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2023-09-01"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateListByArtifactStoreRequest(string subscriptionId, string resourceGroupName, string publisherName, string artifactStoreName) + { + 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.HybridNetwork/publishers/", false); + uri.AppendPath(publisherName, true); + uri.AppendPath("/artifactStores/", false); + uri.AppendPath(artifactStoreName, true); + uri.AppendPath("/artifactManifests", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets information about the artifact manifest. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the artifact store. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> ListByArtifactStoreAsync(string subscriptionId, string resourceGroupName, string publisherName, string artifactStoreName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(artifactStoreName, nameof(artifactStoreName)); + + using var message = CreateListByArtifactStoreRequest(subscriptionId, resourceGroupName, publisherName, artifactStoreName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ArtifactManifestListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ArtifactManifestListResult.DeserializeArtifactManifestListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets information about the artifact manifest. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the artifact store. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response ListByArtifactStore(string subscriptionId, string resourceGroupName, string publisherName, string artifactStoreName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(artifactStoreName, nameof(artifactStoreName)); + + using var message = CreateListByArtifactStoreRequest(subscriptionId, resourceGroupName, publisherName, artifactStoreName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ArtifactManifestListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ArtifactManifestListResult.DeserializeArtifactManifestListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string publisherName, string artifactStoreName, string artifactManifestName) + { + 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.HybridNetwork/publishers/", false); + uri.AppendPath(publisherName, true); + uri.AppendPath("/artifactStores/", false); + uri.AppendPath(artifactStoreName, true); + uri.AppendPath("/artifactManifests/", false); + uri.AppendPath(artifactManifestName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Deletes the specified artifact manifest. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the artifact store. + /// The name of the artifact manifest. + /// 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 publisherName, string artifactStoreName, string artifactManifestName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(artifactStoreName, nameof(artifactStoreName)); + Argument.AssertNotNullOrEmpty(artifactManifestName, nameof(artifactManifestName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, publisherName, artifactStoreName, artifactManifestName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Deletes the specified artifact manifest. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the artifact store. + /// The name of the artifact manifest. + /// 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 publisherName, string artifactStoreName, string artifactManifestName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(artifactStoreName, nameof(artifactStoreName)); + Argument.AssertNotNullOrEmpty(artifactManifestName, nameof(artifactManifestName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, publisherName, artifactStoreName, artifactManifestName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string publisherName, string artifactStoreName, string artifactManifestName, ArtifactManifestData 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.HybridNetwork/publishers/", false); + uri.AppendPath(publisherName, true); + uri.AppendPath("/artifactStores/", false); + uri.AppendPath(artifactStoreName, true); + uri.AppendPath("/artifactManifests/", false); + uri.AppendPath(artifactManifestName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Creates or updates a artifact manifest. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the artifact store. + /// The name of the artifact manifest. + /// Parameters supplied to the create or update artifact manifest operation. + /// 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 publisherName, string artifactStoreName, string artifactManifestName, ArtifactManifestData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(artifactStoreName, nameof(artifactStoreName)); + Argument.AssertNotNullOrEmpty(artifactManifestName, nameof(artifactManifestName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, publisherName, artifactStoreName, artifactManifestName, 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); + } + } + + /// Creates or updates a artifact manifest. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the artifact store. + /// The name of the artifact manifest. + /// Parameters supplied to the create or update artifact manifest operation. + /// 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 publisherName, string artifactStoreName, string artifactManifestName, ArtifactManifestData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(artifactStoreName, nameof(artifactStoreName)); + Argument.AssertNotNullOrEmpty(artifactManifestName, nameof(artifactManifestName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, publisherName, artifactStoreName, artifactManifestName, data); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string publisherName, string artifactStoreName, string artifactManifestName) + { + 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.HybridNetwork/publishers/", false); + uri.AppendPath(publisherName, true); + uri.AppendPath("/artifactStores/", false); + uri.AppendPath(artifactStoreName, true); + uri.AppendPath("/artifactManifests/", false); + uri.AppendPath(artifactManifestName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets information about a artifact manifest resource. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the artifact store. + /// The name of the artifact manifest. + /// 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 publisherName, string artifactStoreName, string artifactManifestName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(artifactStoreName, nameof(artifactStoreName)); + Argument.AssertNotNullOrEmpty(artifactManifestName, nameof(artifactManifestName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, publisherName, artifactStoreName, artifactManifestName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ArtifactManifestData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ArtifactManifestData.DeserializeArtifactManifestData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((ArtifactManifestData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets information about a artifact manifest resource. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the artifact store. + /// The name of the artifact manifest. + /// 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 publisherName, string artifactStoreName, string artifactManifestName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(artifactStoreName, nameof(artifactStoreName)); + Argument.AssertNotNullOrEmpty(artifactManifestName, nameof(artifactManifestName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, publisherName, artifactStoreName, artifactManifestName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ArtifactManifestData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ArtifactManifestData.DeserializeArtifactManifestData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((ArtifactManifestData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string publisherName, string artifactStoreName, string artifactManifestName, TagsObject tagsObject) + { + 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.HybridNetwork/publishers/", false); + uri.AppendPath(publisherName, true); + uri.AppendPath("/artifactStores/", false); + uri.AppendPath(artifactStoreName, true); + uri.AppendPath("/artifactManifests/", false); + uri.AppendPath(artifactManifestName, 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(tagsObject); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Updates a artifact manifest resource. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the artifact store. + /// The name of the artifact manifest. + /// Parameters supplied to the create or update artifact manifest operation. + /// 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 publisherName, string artifactStoreName, string artifactManifestName, TagsObject tagsObject, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(artifactStoreName, nameof(artifactStoreName)); + Argument.AssertNotNullOrEmpty(artifactManifestName, nameof(artifactManifestName)); + Argument.AssertNotNull(tagsObject, nameof(tagsObject)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, publisherName, artifactStoreName, artifactManifestName, tagsObject); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ArtifactManifestData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ArtifactManifestData.DeserializeArtifactManifestData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Updates a artifact manifest resource. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the artifact store. + /// The name of the artifact manifest. + /// Parameters supplied to the create or update artifact manifest operation. + /// 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 publisherName, string artifactStoreName, string artifactManifestName, TagsObject tagsObject, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(artifactStoreName, nameof(artifactStoreName)); + Argument.AssertNotNullOrEmpty(artifactManifestName, nameof(artifactManifestName)); + Argument.AssertNotNull(tagsObject, nameof(tagsObject)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, publisherName, artifactStoreName, artifactManifestName, tagsObject); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ArtifactManifestData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ArtifactManifestData.DeserializeArtifactManifestData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListCredentialRequest(string subscriptionId, string resourceGroupName, string publisherName, string artifactStoreName, string artifactManifestName) + { + 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("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.HybridNetwork/publishers/", false); + uri.AppendPath(publisherName, true); + uri.AppendPath("/artifactStores/", false); + uri.AppendPath(artifactStoreName, true); + uri.AppendPath("/artifactManifests/", false); + uri.AppendPath(artifactManifestName, true); + uri.AppendPath("/listCredential", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List credential for publishing artifacts defined in artifact manifest. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the artifact store. + /// The name of the artifact manifest. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> ListCredentialAsync(string subscriptionId, string resourceGroupName, string publisherName, string artifactStoreName, string artifactManifestName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(artifactStoreName, nameof(artifactStoreName)); + Argument.AssertNotNullOrEmpty(artifactManifestName, nameof(artifactManifestName)); + + using var message = CreateListCredentialRequest(subscriptionId, resourceGroupName, publisherName, artifactStoreName, artifactManifestName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ArtifactAccessCredential value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ArtifactAccessCredential.DeserializeArtifactAccessCredential(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List credential for publishing artifacts defined in artifact manifest. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the artifact store. + /// The name of the artifact manifest. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response ListCredential(string subscriptionId, string resourceGroupName, string publisherName, string artifactStoreName, string artifactManifestName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(artifactStoreName, nameof(artifactStoreName)); + Argument.AssertNotNullOrEmpty(artifactManifestName, nameof(artifactManifestName)); + + using var message = CreateListCredentialRequest(subscriptionId, resourceGroupName, publisherName, artifactStoreName, artifactManifestName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ArtifactAccessCredential value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ArtifactAccessCredential.DeserializeArtifactAccessCredential(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateUpdateStateRequest(string subscriptionId, string resourceGroupName, string publisherName, string artifactStoreName, string artifactManifestName, ArtifactManifestUpdateState artifactManifestUpdateState) + { + 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("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.HybridNetwork/publishers/", false); + uri.AppendPath(publisherName, true); + uri.AppendPath("/artifactStores/", false); + uri.AppendPath(artifactStoreName, true); + uri.AppendPath("/artifactManifests/", false); + uri.AppendPath(artifactManifestName, true); + uri.AppendPath("/updateState", false); + 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(artifactManifestUpdateState); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Update state for artifact manifest. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the artifact store. + /// The name of the artifact manifest. + /// Parameters supplied to update the state of artifact manifest. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task UpdateStateAsync(string subscriptionId, string resourceGroupName, string publisherName, string artifactStoreName, string artifactManifestName, ArtifactManifestUpdateState artifactManifestUpdateState, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(artifactStoreName, nameof(artifactStoreName)); + Argument.AssertNotNullOrEmpty(artifactManifestName, nameof(artifactManifestName)); + Argument.AssertNotNull(artifactManifestUpdateState, nameof(artifactManifestUpdateState)); + + using var message = CreateUpdateStateRequest(subscriptionId, resourceGroupName, publisherName, artifactStoreName, artifactManifestName, artifactManifestUpdateState); + 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 state for artifact manifest. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the artifact store. + /// The name of the artifact manifest. + /// Parameters supplied to update the state of artifact manifest. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response UpdateState(string subscriptionId, string resourceGroupName, string publisherName, string artifactStoreName, string artifactManifestName, ArtifactManifestUpdateState artifactManifestUpdateState, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(artifactStoreName, nameof(artifactStoreName)); + Argument.AssertNotNullOrEmpty(artifactManifestName, nameof(artifactManifestName)); + Argument.AssertNotNull(artifactManifestUpdateState, nameof(artifactManifestUpdateState)); + + using var message = CreateUpdateStateRequest(subscriptionId, resourceGroupName, publisherName, artifactStoreName, artifactManifestName, artifactManifestUpdateState); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByArtifactStoreNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string publisherName, string artifactStoreName) + { + 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; + } + + /// Gets information about the artifact manifest. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the artifact store. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> ListByArtifactStoreNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string publisherName, string artifactStoreName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(artifactStoreName, nameof(artifactStoreName)); + + using var message = CreateListByArtifactStoreNextPageRequest(nextLink, subscriptionId, resourceGroupName, publisherName, artifactStoreName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ArtifactManifestListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ArtifactManifestListResult.DeserializeArtifactManifestListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets information about the artifact manifest. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the artifact store. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response ListByArtifactStoreNextPage(string nextLink, string subscriptionId, string resourceGroupName, string publisherName, string artifactStoreName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(artifactStoreName, nameof(artifactStoreName)); + + using var message = CreateListByArtifactStoreNextPageRequest(nextLink, subscriptionId, resourceGroupName, publisherName, artifactStoreName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ArtifactManifestListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ArtifactManifestListResult.DeserializeArtifactManifestListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/RestOperations/ArtifactStoresRestOperations.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/RestOperations/ArtifactStoresRestOperations.cs new file mode 100644 index 000000000000..b2ff512d641d --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/RestOperations/ArtifactStoresRestOperations.cs @@ -0,0 +1,535 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.HybridNetwork.Models; + +namespace Azure.ResourceManager.HybridNetwork +{ + internal partial class ArtifactStoresRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of ArtifactStoresRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public ArtifactStoresRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2023-09-01"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateListByPublisherRequest(string subscriptionId, string resourceGroupName, string publisherName) + { + 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.HybridNetwork/publishers/", false); + uri.AppendPath(publisherName, true); + uri.AppendPath("/artifactStores", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets information of the ArtifactStores under publisher. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListByPublisherAsync(string subscriptionId, string resourceGroupName, string publisherName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + + using var message = CreateListByPublisherRequest(subscriptionId, resourceGroupName, publisherName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ArtifactStoreListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ArtifactStoreListResult.DeserializeArtifactStoreListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets information of the ArtifactStores under publisher. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListByPublisher(string subscriptionId, string resourceGroupName, string publisherName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + + using var message = CreateListByPublisherRequest(subscriptionId, resourceGroupName, publisherName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ArtifactStoreListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ArtifactStoreListResult.DeserializeArtifactStoreListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string publisherName, string artifactStoreName) + { + 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.HybridNetwork/publishers/", false); + uri.AppendPath(publisherName, true); + uri.AppendPath("/artifactStores/", false); + uri.AppendPath(artifactStoreName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Deletes the specified artifact store. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the artifact store. + /// 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 publisherName, string artifactStoreName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(artifactStoreName, nameof(artifactStoreName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, publisherName, artifactStoreName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Deletes the specified artifact store. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the artifact store. + /// 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 publisherName, string artifactStoreName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(artifactStoreName, nameof(artifactStoreName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, publisherName, artifactStoreName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string publisherName, string artifactStoreName, ArtifactStoreData 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.HybridNetwork/publishers/", false); + uri.AppendPath(publisherName, true); + uri.AppendPath("/artifactStores/", false); + uri.AppendPath(artifactStoreName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Creates or updates a artifact store. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the artifact store. + /// Parameters supplied to the create or update application group operation. + /// 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 publisherName, string artifactStoreName, ArtifactStoreData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(artifactStoreName, nameof(artifactStoreName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, publisherName, artifactStoreName, 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); + } + } + + /// Creates or updates a artifact store. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the artifact store. + /// Parameters supplied to the create or update application group operation. + /// 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 publisherName, string artifactStoreName, ArtifactStoreData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(artifactStoreName, nameof(artifactStoreName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, publisherName, artifactStoreName, data); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string publisherName, string artifactStoreName) + { + 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.HybridNetwork/publishers/", false); + uri.AppendPath(publisherName, true); + uri.AppendPath("/artifactStores/", false); + uri.AppendPath(artifactStoreName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets information about the specified artifact store. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the artifact store. + /// 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 publisherName, string artifactStoreName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(artifactStoreName, nameof(artifactStoreName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, publisherName, artifactStoreName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ArtifactStoreData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ArtifactStoreData.DeserializeArtifactStoreData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((ArtifactStoreData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets information about the specified artifact store. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the artifact store. + /// 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 publisherName, string artifactStoreName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(artifactStoreName, nameof(artifactStoreName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, publisherName, artifactStoreName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ArtifactStoreData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ArtifactStoreData.DeserializeArtifactStoreData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((ArtifactStoreData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string publisherName, string artifactStoreName, TagsObject tagsObject) + { + 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.HybridNetwork/publishers/", false); + uri.AppendPath(publisherName, true); + uri.AppendPath("/artifactStores/", false); + uri.AppendPath(artifactStoreName, 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(tagsObject); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Update artifact store resource. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the artifact store. + /// Parameters supplied to the create or update application group operation. + /// 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 publisherName, string artifactStoreName, TagsObject tagsObject, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(artifactStoreName, nameof(artifactStoreName)); + Argument.AssertNotNull(tagsObject, nameof(tagsObject)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, publisherName, artifactStoreName, tagsObject); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ArtifactStoreData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ArtifactStoreData.DeserializeArtifactStoreData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Update artifact store resource. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the artifact store. + /// Parameters supplied to the create or update application group operation. + /// 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 publisherName, string artifactStoreName, TagsObject tagsObject, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(artifactStoreName, nameof(artifactStoreName)); + Argument.AssertNotNull(tagsObject, nameof(tagsObject)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, publisherName, artifactStoreName, tagsObject); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ArtifactStoreData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ArtifactStoreData.DeserializeArtifactStoreData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByPublisherNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string publisherName) + { + 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; + } + + /// Gets information of the ArtifactStores under publisher. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListByPublisherNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string publisherName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + + using var message = CreateListByPublisherNextPageRequest(nextLink, subscriptionId, resourceGroupName, publisherName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ArtifactStoreListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ArtifactStoreListResult.DeserializeArtifactStoreListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets information of the ArtifactStores under publisher. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListByPublisherNextPage(string nextLink, string subscriptionId, string resourceGroupName, string publisherName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + + using var message = CreateListByPublisherNextPageRequest(nextLink, subscriptionId, resourceGroupName, publisherName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ArtifactStoreListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ArtifactStoreListResult.DeserializeArtifactStoreListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/RestOperations/ComponentsRestOperations.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/RestOperations/ComponentsRestOperations.cs new file mode 100644 index 000000000000..54943cb4e055 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/RestOperations/ComponentsRestOperations.cs @@ -0,0 +1,283 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.HybridNetwork.Models; + +namespace Azure.ResourceManager.HybridNetwork +{ + internal partial class ComponentsRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of ComponentsRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public ComponentsRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2023-09-01"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string networkFunctionName, string componentName) + { + 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.HybridNetwork/networkFunctions/", false); + uri.AppendPath(networkFunctionName, true); + uri.AppendPath("/components/", false); + uri.AppendPath(componentName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets information about the specified application instance resource. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the network function. + /// The name of the component. + /// 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 networkFunctionName, string componentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(networkFunctionName, nameof(networkFunctionName)); + Argument.AssertNotNullOrEmpty(componentName, nameof(componentName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, networkFunctionName, componentName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ComponentData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ComponentData.DeserializeComponentData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((ComponentData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets information about the specified application instance resource. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the network function. + /// The name of the component. + /// 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 networkFunctionName, string componentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(networkFunctionName, nameof(networkFunctionName)); + Argument.AssertNotNullOrEmpty(componentName, nameof(componentName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, networkFunctionName, componentName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ComponentData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ComponentData.DeserializeComponentData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((ComponentData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByNetworkFunctionRequest(string subscriptionId, string resourceGroupName, string networkFunctionName) + { + 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.HybridNetwork/networkFunctions/", false); + uri.AppendPath(networkFunctionName, true); + uri.AppendPath("/components", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists all the component resources in a network function. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the network function. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListByNetworkFunctionAsync(string subscriptionId, string resourceGroupName, string networkFunctionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(networkFunctionName, nameof(networkFunctionName)); + + using var message = CreateListByNetworkFunctionRequest(subscriptionId, resourceGroupName, networkFunctionName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ComponentListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ComponentListResult.DeserializeComponentListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists all the component resources in a network function. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the network function. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListByNetworkFunction(string subscriptionId, string resourceGroupName, string networkFunctionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(networkFunctionName, nameof(networkFunctionName)); + + using var message = CreateListByNetworkFunctionRequest(subscriptionId, resourceGroupName, networkFunctionName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ComponentListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ComponentListResult.DeserializeComponentListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByNetworkFunctionNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string networkFunctionName) + { + 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; + } + + /// Lists all the component resources in a network function. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the network function. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListByNetworkFunctionNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string networkFunctionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(networkFunctionName, nameof(networkFunctionName)); + + using var message = CreateListByNetworkFunctionNextPageRequest(nextLink, subscriptionId, resourceGroupName, networkFunctionName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ComponentListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ComponentListResult.DeserializeComponentListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists all the component resources in a network function. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the network function. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListByNetworkFunctionNextPage(string nextLink, string subscriptionId, string resourceGroupName, string networkFunctionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(networkFunctionName, nameof(networkFunctionName)); + + using var message = CreateListByNetworkFunctionNextPageRequest(nextLink, subscriptionId, resourceGroupName, networkFunctionName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ComponentListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ComponentListResult.DeserializeComponentListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/RestOperations/ConfigurationGroupSchemasRestOperations.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/RestOperations/ConfigurationGroupSchemasRestOperations.cs new file mode 100644 index 000000000000..528cbc63ecf6 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/RestOperations/ConfigurationGroupSchemasRestOperations.cs @@ -0,0 +1,620 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.HybridNetwork.Models; + +namespace Azure.ResourceManager.HybridNetwork +{ + internal partial class ConfigurationGroupSchemasRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of ConfigurationGroupSchemasRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public ConfigurationGroupSchemasRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2023-09-01"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateListByPublisherRequest(string subscriptionId, string resourceGroupName, string publisherName) + { + 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.HybridNetwork/publishers/", false); + uri.AppendPath(publisherName, true); + uri.AppendPath("/configurationGroupSchemas", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets information of the configuration group schemas under a publisher. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListByPublisherAsync(string subscriptionId, string resourceGroupName, string publisherName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + + using var message = CreateListByPublisherRequest(subscriptionId, resourceGroupName, publisherName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ConfigurationGroupSchemaListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ConfigurationGroupSchemaListResult.DeserializeConfigurationGroupSchemaListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets information of the configuration group schemas under a publisher. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListByPublisher(string subscriptionId, string resourceGroupName, string publisherName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + + using var message = CreateListByPublisherRequest(subscriptionId, resourceGroupName, publisherName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ConfigurationGroupSchemaListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ConfigurationGroupSchemaListResult.DeserializeConfigurationGroupSchemaListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string publisherName, string configurationGroupSchemaName) + { + 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.HybridNetwork/publishers/", false); + uri.AppendPath(publisherName, true); + uri.AppendPath("/configurationGroupSchemas/", false); + uri.AppendPath(configurationGroupSchemaName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Deletes a specified configuration group schema. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the configuration group schema. + /// 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 publisherName, string configurationGroupSchemaName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(configurationGroupSchemaName, nameof(configurationGroupSchemaName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, publisherName, configurationGroupSchemaName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Deletes a specified configuration group schema. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the configuration group schema. + /// 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 publisherName, string configurationGroupSchemaName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(configurationGroupSchemaName, nameof(configurationGroupSchemaName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, publisherName, configurationGroupSchemaName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string publisherName, string configurationGroupSchemaName, ConfigurationGroupSchemaData 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.HybridNetwork/publishers/", false); + uri.AppendPath(publisherName, true); + uri.AppendPath("/configurationGroupSchemas/", false); + uri.AppendPath(configurationGroupSchemaName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Creates or updates a configuration group schema. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the configuration group schema. + /// Parameters supplied to the create or update configuration group schema resource. + /// 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 publisherName, string configurationGroupSchemaName, ConfigurationGroupSchemaData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(configurationGroupSchemaName, nameof(configurationGroupSchemaName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, publisherName, configurationGroupSchemaName, 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); + } + } + + /// Creates or updates a configuration group schema. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the configuration group schema. + /// Parameters supplied to the create or update configuration group schema resource. + /// 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 publisherName, string configurationGroupSchemaName, ConfigurationGroupSchemaData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(configurationGroupSchemaName, nameof(configurationGroupSchemaName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, publisherName, configurationGroupSchemaName, data); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string publisherName, string configurationGroupSchemaName) + { + 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.HybridNetwork/publishers/", false); + uri.AppendPath(publisherName, true); + uri.AppendPath("/configurationGroupSchemas/", false); + uri.AppendPath(configurationGroupSchemaName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets information about the specified configuration group schema. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the configuration group schema. + /// 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 publisherName, string configurationGroupSchemaName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(configurationGroupSchemaName, nameof(configurationGroupSchemaName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, publisherName, configurationGroupSchemaName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ConfigurationGroupSchemaData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ConfigurationGroupSchemaData.DeserializeConfigurationGroupSchemaData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((ConfigurationGroupSchemaData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets information about the specified configuration group schema. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the configuration group schema. + /// 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 publisherName, string configurationGroupSchemaName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(configurationGroupSchemaName, nameof(configurationGroupSchemaName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, publisherName, configurationGroupSchemaName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ConfigurationGroupSchemaData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ConfigurationGroupSchemaData.DeserializeConfigurationGroupSchemaData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((ConfigurationGroupSchemaData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string publisherName, string configurationGroupSchemaName, TagsObject tagsObject) + { + 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.HybridNetwork/publishers/", false); + uri.AppendPath(publisherName, true); + uri.AppendPath("/configurationGroupSchemas/", false); + uri.AppendPath(configurationGroupSchemaName, 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(tagsObject); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Updates a configuration group schema resource. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the configuration group schema. + /// Parameters supplied to the create or update network service design version operation. + /// 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 publisherName, string configurationGroupSchemaName, TagsObject tagsObject, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(configurationGroupSchemaName, nameof(configurationGroupSchemaName)); + Argument.AssertNotNull(tagsObject, nameof(tagsObject)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, publisherName, configurationGroupSchemaName, tagsObject); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ConfigurationGroupSchemaData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ConfigurationGroupSchemaData.DeserializeConfigurationGroupSchemaData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Updates a configuration group schema resource. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the configuration group schema. + /// Parameters supplied to the create or update network service design version operation. + /// 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 publisherName, string configurationGroupSchemaName, TagsObject tagsObject, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(configurationGroupSchemaName, nameof(configurationGroupSchemaName)); + Argument.AssertNotNull(tagsObject, nameof(tagsObject)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, publisherName, configurationGroupSchemaName, tagsObject); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ConfigurationGroupSchemaData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ConfigurationGroupSchemaData.DeserializeConfigurationGroupSchemaData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateUpdateStateRequest(string subscriptionId, string resourceGroupName, string publisherName, string configurationGroupSchemaName, ConfigurationGroupSchemaVersionUpdateState configurationGroupSchemaVersionUpdateState) + { + 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("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.HybridNetwork/publishers/", false); + uri.AppendPath(publisherName, true); + uri.AppendPath("/configurationGroupSchemas/", false); + uri.AppendPath(configurationGroupSchemaName, true); + uri.AppendPath("/updateState", false); + 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(configurationGroupSchemaVersionUpdateState); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Update configuration group schema state. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the configuration group schema. + /// Parameters supplied to update the state of configuration group schema. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task UpdateStateAsync(string subscriptionId, string resourceGroupName, string publisherName, string configurationGroupSchemaName, ConfigurationGroupSchemaVersionUpdateState configurationGroupSchemaVersionUpdateState, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(configurationGroupSchemaName, nameof(configurationGroupSchemaName)); + Argument.AssertNotNull(configurationGroupSchemaVersionUpdateState, nameof(configurationGroupSchemaVersionUpdateState)); + + using var message = CreateUpdateStateRequest(subscriptionId, resourceGroupName, publisherName, configurationGroupSchemaName, configurationGroupSchemaVersionUpdateState); + 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 configuration group schema state. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the configuration group schema. + /// Parameters supplied to update the state of configuration group schema. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response UpdateState(string subscriptionId, string resourceGroupName, string publisherName, string configurationGroupSchemaName, ConfigurationGroupSchemaVersionUpdateState configurationGroupSchemaVersionUpdateState, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(configurationGroupSchemaName, nameof(configurationGroupSchemaName)); + Argument.AssertNotNull(configurationGroupSchemaVersionUpdateState, nameof(configurationGroupSchemaVersionUpdateState)); + + using var message = CreateUpdateStateRequest(subscriptionId, resourceGroupName, publisherName, configurationGroupSchemaName, configurationGroupSchemaVersionUpdateState); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByPublisherNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string publisherName) + { + 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; + } + + /// Gets information of the configuration group schemas under a publisher. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListByPublisherNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string publisherName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + + using var message = CreateListByPublisherNextPageRequest(nextLink, subscriptionId, resourceGroupName, publisherName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ConfigurationGroupSchemaListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ConfigurationGroupSchemaListResult.DeserializeConfigurationGroupSchemaListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets information of the configuration group schemas under a publisher. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListByPublisherNextPage(string nextLink, string subscriptionId, string resourceGroupName, string publisherName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + + using var message = CreateListByPublisherNextPageRequest(nextLink, subscriptionId, resourceGroupName, publisherName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ConfigurationGroupSchemaListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ConfigurationGroupSchemaListResult.DeserializeConfigurationGroupSchemaListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/RestOperations/ConfigurationGroupValuesRestOperations.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/RestOperations/ConfigurationGroupValuesRestOperations.cs new file mode 100644 index 000000000000..72330943abc0 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/RestOperations/ConfigurationGroupValuesRestOperations.cs @@ -0,0 +1,636 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.HybridNetwork.Models; + +namespace Azure.ResourceManager.HybridNetwork +{ + internal partial class ConfigurationGroupValuesRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of ConfigurationGroupValuesRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public ConfigurationGroupValuesRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2023-09-01"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string configurationGroupValueName) + { + 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.HybridNetwork/configurationGroupValues/", false); + uri.AppendPath(configurationGroupValueName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Deletes the specified hybrid configuration group value. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the configuration group value. + /// 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 configurationGroupValueName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(configurationGroupValueName, nameof(configurationGroupValueName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, configurationGroupValueName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Deletes the specified hybrid configuration group value. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the configuration group value. + /// 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 configurationGroupValueName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(configurationGroupValueName, nameof(configurationGroupValueName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, configurationGroupValueName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string configurationGroupValueName) + { + 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.HybridNetwork/configurationGroupValues/", false); + uri.AppendPath(configurationGroupValueName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets information about the specified hybrid configuration group values. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the configuration group value. + /// 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 configurationGroupValueName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(configurationGroupValueName, nameof(configurationGroupValueName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, configurationGroupValueName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ConfigurationGroupValueData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ConfigurationGroupValueData.DeserializeConfigurationGroupValueData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((ConfigurationGroupValueData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets information about the specified hybrid configuration group values. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the configuration group value. + /// 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 configurationGroupValueName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(configurationGroupValueName, nameof(configurationGroupValueName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, configurationGroupValueName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ConfigurationGroupValueData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ConfigurationGroupValueData.DeserializeConfigurationGroupValueData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((ConfigurationGroupValueData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string configurationGroupValueName, ConfigurationGroupValueData 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.HybridNetwork/configurationGroupValues/", false); + uri.AppendPath(configurationGroupValueName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Creates or updates a hybrid configuration group value. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the configuration group value. + /// Parameters supplied to the create or update configuration group value resource. + /// 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 configurationGroupValueName, ConfigurationGroupValueData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(configurationGroupValueName, nameof(configurationGroupValueName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, configurationGroupValueName, 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); + } + } + + /// Creates or updates a hybrid configuration group value. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the configuration group value. + /// Parameters supplied to the create or update configuration group value resource. + /// 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 configurationGroupValueName, ConfigurationGroupValueData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(configurationGroupValueName, nameof(configurationGroupValueName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, configurationGroupValueName, data); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateUpdateTagsRequest(string subscriptionId, string resourceGroupName, string configurationGroupValueName, TagsObject tagsObject) + { + 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.HybridNetwork/configurationGroupValues/", false); + uri.AppendPath(configurationGroupValueName, 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(tagsObject); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Updates a hybrid configuration group tags. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the configuration group value. + /// Parameters supplied to update configuration group values tags. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> UpdateTagsAsync(string subscriptionId, string resourceGroupName, string configurationGroupValueName, TagsObject tagsObject, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(configurationGroupValueName, nameof(configurationGroupValueName)); + Argument.AssertNotNull(tagsObject, nameof(tagsObject)); + + using var message = CreateUpdateTagsRequest(subscriptionId, resourceGroupName, configurationGroupValueName, tagsObject); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ConfigurationGroupValueData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ConfigurationGroupValueData.DeserializeConfigurationGroupValueData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Updates a hybrid configuration group tags. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the configuration group value. + /// Parameters supplied to update configuration group values tags. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response UpdateTags(string subscriptionId, string resourceGroupName, string configurationGroupValueName, TagsObject tagsObject, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(configurationGroupValueName, nameof(configurationGroupValueName)); + Argument.AssertNotNull(tagsObject, nameof(tagsObject)); + + using var message = CreateUpdateTagsRequest(subscriptionId, resourceGroupName, configurationGroupValueName, tagsObject); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ConfigurationGroupValueData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ConfigurationGroupValueData.DeserializeConfigurationGroupValueData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + 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.HybridNetwork/configurationGroupValues", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists all sites in the configuration group value in a subscription. + /// The ID of the target subscription. + /// 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: + { + ConfigurationGroupValueListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ConfigurationGroupValueListResult.DeserializeConfigurationGroupValueListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists all sites in the configuration group value in a subscription. + /// The ID of the target subscription. + /// 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: + { + ConfigurationGroupValueListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ConfigurationGroupValueListResult.DeserializeConfigurationGroupValueListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByResourceGroupRequest(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.HybridNetwork/configurationGroupValues", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists all the hybrid network configurationGroupValues in a resource group. + /// The ID of the target subscription. + /// 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> ListByResourceGroupAsync(string subscriptionId, string resourceGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + + using var message = CreateListByResourceGroupRequest(subscriptionId, resourceGroupName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ConfigurationGroupValueListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ConfigurationGroupValueListResult.DeserializeConfigurationGroupValueListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists all the hybrid network configurationGroupValues in a resource group. + /// The ID of the target subscription. + /// 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 ListByResourceGroup(string subscriptionId, string resourceGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + + using var message = CreateListByResourceGroupRequest(subscriptionId, resourceGroupName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ConfigurationGroupValueListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ConfigurationGroupValueListResult.DeserializeConfigurationGroupValueListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + 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; + } + + /// Lists all sites in the configuration group value in a subscription. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// 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: + { + ConfigurationGroupValueListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ConfigurationGroupValueListResult.DeserializeConfigurationGroupValueListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists all sites in the configuration group value in a subscription. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// 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: + { + ConfigurationGroupValueListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ConfigurationGroupValueListResult.DeserializeConfigurationGroupValueListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByResourceGroupNextPageRequest(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; + } + + /// Lists all the hybrid network configurationGroupValues in a resource group. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The cancellation token to use. + /// , or is null. + /// or is an empty string, and was expected to be non-empty. + public async Task> ListByResourceGroupNextPageAsync(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 = CreateListByResourceGroupNextPageRequest(nextLink, subscriptionId, resourceGroupName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ConfigurationGroupValueListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ConfigurationGroupValueListResult.DeserializeConfigurationGroupValueListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists all the hybrid network configurationGroupValues in a resource group. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The cancellation token to use. + /// , or is null. + /// or is an empty string, and was expected to be non-empty. + public Response ListByResourceGroupNextPage(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 = CreateListByResourceGroupNextPageRequest(nextLink, subscriptionId, resourceGroupName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ConfigurationGroupValueListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ConfigurationGroupValueListResult.DeserializeConfigurationGroupValueListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/RestOperations/NetworkFunctionDefinitionGroupsRestOperations.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/RestOperations/NetworkFunctionDefinitionGroupsRestOperations.cs new file mode 100644 index 000000000000..2d22b832557b --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/RestOperations/NetworkFunctionDefinitionGroupsRestOperations.cs @@ -0,0 +1,535 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.HybridNetwork.Models; + +namespace Azure.ResourceManager.HybridNetwork +{ + internal partial class NetworkFunctionDefinitionGroupsRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of NetworkFunctionDefinitionGroupsRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public NetworkFunctionDefinitionGroupsRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2023-09-01"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateListByPublisherRequest(string subscriptionId, string resourceGroupName, string publisherName) + { + 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.HybridNetwork/publishers/", false); + uri.AppendPath(publisherName, true); + uri.AppendPath("/networkFunctionDefinitionGroups", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets information of the network function definition groups under a publisher. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListByPublisherAsync(string subscriptionId, string resourceGroupName, string publisherName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + + using var message = CreateListByPublisherRequest(subscriptionId, resourceGroupName, publisherName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + NetworkFunctionDefinitionGroupListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = NetworkFunctionDefinitionGroupListResult.DeserializeNetworkFunctionDefinitionGroupListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets information of the network function definition groups under a publisher. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListByPublisher(string subscriptionId, string resourceGroupName, string publisherName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + + using var message = CreateListByPublisherRequest(subscriptionId, resourceGroupName, publisherName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + NetworkFunctionDefinitionGroupListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = NetworkFunctionDefinitionGroupListResult.DeserializeNetworkFunctionDefinitionGroupListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string publisherName, string networkFunctionDefinitionGroupName) + { + 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.HybridNetwork/publishers/", false); + uri.AppendPath(publisherName, true); + uri.AppendPath("/networkFunctionDefinitionGroups/", false); + uri.AppendPath(networkFunctionDefinitionGroupName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Deletes a specified network function definition group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the network function definition group. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string publisherName, string networkFunctionDefinitionGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(networkFunctionDefinitionGroupName, nameof(networkFunctionDefinitionGroupName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, publisherName, networkFunctionDefinitionGroupName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Deletes a specified network function definition group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the network function definition group. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Delete(string subscriptionId, string resourceGroupName, string publisherName, string networkFunctionDefinitionGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(networkFunctionDefinitionGroupName, nameof(networkFunctionDefinitionGroupName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, publisherName, networkFunctionDefinitionGroupName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string publisherName, string networkFunctionDefinitionGroupName, NetworkFunctionDefinitionGroupData 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.HybridNetwork/publishers/", false); + uri.AppendPath(publisherName, true); + uri.AppendPath("/networkFunctionDefinitionGroups/", false); + uri.AppendPath(networkFunctionDefinitionGroupName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Creates or updates a network function definition group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the network function definition group. + /// Parameters supplied to the create or update publisher network function definition group operation. + /// 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 publisherName, string networkFunctionDefinitionGroupName, NetworkFunctionDefinitionGroupData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(networkFunctionDefinitionGroupName, nameof(networkFunctionDefinitionGroupName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, publisherName, networkFunctionDefinitionGroupName, 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); + } + } + + /// Creates or updates a network function definition group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the network function definition group. + /// Parameters supplied to the create or update publisher network function definition group operation. + /// 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 publisherName, string networkFunctionDefinitionGroupName, NetworkFunctionDefinitionGroupData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(networkFunctionDefinitionGroupName, nameof(networkFunctionDefinitionGroupName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, publisherName, networkFunctionDefinitionGroupName, data); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string publisherName, string networkFunctionDefinitionGroupName) + { + 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.HybridNetwork/publishers/", false); + uri.AppendPath(publisherName, true); + uri.AppendPath("/networkFunctionDefinitionGroups/", false); + uri.AppendPath(networkFunctionDefinitionGroupName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets information about the specified networkFunctionDefinition group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the network function definition group. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string publisherName, string networkFunctionDefinitionGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(networkFunctionDefinitionGroupName, nameof(networkFunctionDefinitionGroupName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, publisherName, networkFunctionDefinitionGroupName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + NetworkFunctionDefinitionGroupData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = NetworkFunctionDefinitionGroupData.DeserializeNetworkFunctionDefinitionGroupData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((NetworkFunctionDefinitionGroupData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets information about the specified networkFunctionDefinition group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the network function definition group. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string resourceGroupName, string publisherName, string networkFunctionDefinitionGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(networkFunctionDefinitionGroupName, nameof(networkFunctionDefinitionGroupName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, publisherName, networkFunctionDefinitionGroupName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + NetworkFunctionDefinitionGroupData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = NetworkFunctionDefinitionGroupData.DeserializeNetworkFunctionDefinitionGroupData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((NetworkFunctionDefinitionGroupData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string publisherName, string networkFunctionDefinitionGroupName, TagsObject tagsObject) + { + 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.HybridNetwork/publishers/", false); + uri.AppendPath(publisherName, true); + uri.AppendPath("/networkFunctionDefinitionGroups/", false); + uri.AppendPath(networkFunctionDefinitionGroupName, 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(tagsObject); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Updates a network function definition group resource. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the network function definition group. + /// Parameters supplied to the create or update publisher network function definition group operation. + /// 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 publisherName, string networkFunctionDefinitionGroupName, TagsObject tagsObject, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(networkFunctionDefinitionGroupName, nameof(networkFunctionDefinitionGroupName)); + Argument.AssertNotNull(tagsObject, nameof(tagsObject)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, publisherName, networkFunctionDefinitionGroupName, tagsObject); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + NetworkFunctionDefinitionGroupData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = NetworkFunctionDefinitionGroupData.DeserializeNetworkFunctionDefinitionGroupData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Updates a network function definition group resource. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the network function definition group. + /// Parameters supplied to the create or update publisher network function definition group operation. + /// 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 publisherName, string networkFunctionDefinitionGroupName, TagsObject tagsObject, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(networkFunctionDefinitionGroupName, nameof(networkFunctionDefinitionGroupName)); + Argument.AssertNotNull(tagsObject, nameof(tagsObject)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, publisherName, networkFunctionDefinitionGroupName, tagsObject); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + NetworkFunctionDefinitionGroupData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = NetworkFunctionDefinitionGroupData.DeserializeNetworkFunctionDefinitionGroupData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByPublisherNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string publisherName) + { + 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; + } + + /// Gets information of the network function definition groups under a publisher. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListByPublisherNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string publisherName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + + using var message = CreateListByPublisherNextPageRequest(nextLink, subscriptionId, resourceGroupName, publisherName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + NetworkFunctionDefinitionGroupListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = NetworkFunctionDefinitionGroupListResult.DeserializeNetworkFunctionDefinitionGroupListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets information of the network function definition groups under a publisher. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListByPublisherNextPage(string nextLink, string subscriptionId, string resourceGroupName, string publisherName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + + using var message = CreateListByPublisherNextPageRequest(nextLink, subscriptionId, resourceGroupName, publisherName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + NetworkFunctionDefinitionGroupListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = NetworkFunctionDefinitionGroupListResult.DeserializeNetworkFunctionDefinitionGroupListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/RestOperations/NetworkFunctionDefinitionVersionsRestOperations.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/RestOperations/NetworkFunctionDefinitionVersionsRestOperations.cs new file mode 100644 index 000000000000..ec9a998eb7d5 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/RestOperations/NetworkFunctionDefinitionVersionsRestOperations.cs @@ -0,0 +1,660 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.HybridNetwork.Models; + +namespace Azure.ResourceManager.HybridNetwork +{ + internal partial class NetworkFunctionDefinitionVersionsRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of NetworkFunctionDefinitionVersionsRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public NetworkFunctionDefinitionVersionsRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2023-09-01"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string publisherName, string networkFunctionDefinitionGroupName, string networkFunctionDefinitionVersionName) + { + 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.HybridNetwork/publishers/", false); + uri.AppendPath(publisherName, true); + uri.AppendPath("/networkFunctionDefinitionGroups/", false); + uri.AppendPath(networkFunctionDefinitionGroupName, true); + uri.AppendPath("/networkFunctionDefinitionVersions/", false); + uri.AppendPath(networkFunctionDefinitionVersionName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Deletes the specified network function definition version. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the network function definition group. + /// The name of the network function definition version. The name should conform to the SemVer 2.0.0 specification: https://semver.org/spec/v2.0.0.html. + /// 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 publisherName, string networkFunctionDefinitionGroupName, string networkFunctionDefinitionVersionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(networkFunctionDefinitionGroupName, nameof(networkFunctionDefinitionGroupName)); + Argument.AssertNotNullOrEmpty(networkFunctionDefinitionVersionName, nameof(networkFunctionDefinitionVersionName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, publisherName, networkFunctionDefinitionGroupName, networkFunctionDefinitionVersionName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Deletes the specified network function definition version. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the network function definition group. + /// The name of the network function definition version. The name should conform to the SemVer 2.0.0 specification: https://semver.org/spec/v2.0.0.html. + /// 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 publisherName, string networkFunctionDefinitionGroupName, string networkFunctionDefinitionVersionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(networkFunctionDefinitionGroupName, nameof(networkFunctionDefinitionGroupName)); + Argument.AssertNotNullOrEmpty(networkFunctionDefinitionVersionName, nameof(networkFunctionDefinitionVersionName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, publisherName, networkFunctionDefinitionGroupName, networkFunctionDefinitionVersionName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string publisherName, string networkFunctionDefinitionGroupName, string networkFunctionDefinitionVersionName, NetworkFunctionDefinitionVersionData 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.HybridNetwork/publishers/", false); + uri.AppendPath(publisherName, true); + uri.AppendPath("/networkFunctionDefinitionGroups/", false); + uri.AppendPath(networkFunctionDefinitionGroupName, true); + uri.AppendPath("/networkFunctionDefinitionVersions/", false); + uri.AppendPath(networkFunctionDefinitionVersionName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Creates or updates a network function definition version. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the network function definition group. + /// The name of the network function definition version. The name should conform to the SemVer 2.0.0 specification: https://semver.org/spec/v2.0.0.html. + /// Parameters supplied to the create or update network function definition version operation. + /// 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 publisherName, string networkFunctionDefinitionGroupName, string networkFunctionDefinitionVersionName, NetworkFunctionDefinitionVersionData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(networkFunctionDefinitionGroupName, nameof(networkFunctionDefinitionGroupName)); + Argument.AssertNotNullOrEmpty(networkFunctionDefinitionVersionName, nameof(networkFunctionDefinitionVersionName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, publisherName, networkFunctionDefinitionGroupName, networkFunctionDefinitionVersionName, 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); + } + } + + /// Creates or updates a network function definition version. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the network function definition group. + /// The name of the network function definition version. The name should conform to the SemVer 2.0.0 specification: https://semver.org/spec/v2.0.0.html. + /// Parameters supplied to the create or update network function definition version operation. + /// 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 publisherName, string networkFunctionDefinitionGroupName, string networkFunctionDefinitionVersionName, NetworkFunctionDefinitionVersionData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(networkFunctionDefinitionGroupName, nameof(networkFunctionDefinitionGroupName)); + Argument.AssertNotNullOrEmpty(networkFunctionDefinitionVersionName, nameof(networkFunctionDefinitionVersionName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, publisherName, networkFunctionDefinitionGroupName, networkFunctionDefinitionVersionName, data); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string publisherName, string networkFunctionDefinitionGroupName, string networkFunctionDefinitionVersionName) + { + 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.HybridNetwork/publishers/", false); + uri.AppendPath(publisherName, true); + uri.AppendPath("/networkFunctionDefinitionGroups/", false); + uri.AppendPath(networkFunctionDefinitionGroupName, true); + uri.AppendPath("/networkFunctionDefinitionVersions/", false); + uri.AppendPath(networkFunctionDefinitionVersionName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets information about a network function definition version. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the network function definition group. + /// The name of the network function definition version. The name should conform to the SemVer 2.0.0 specification: https://semver.org/spec/v2.0.0.html. + /// 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 publisherName, string networkFunctionDefinitionGroupName, string networkFunctionDefinitionVersionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(networkFunctionDefinitionGroupName, nameof(networkFunctionDefinitionGroupName)); + Argument.AssertNotNullOrEmpty(networkFunctionDefinitionVersionName, nameof(networkFunctionDefinitionVersionName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, publisherName, networkFunctionDefinitionGroupName, networkFunctionDefinitionVersionName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + NetworkFunctionDefinitionVersionData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = NetworkFunctionDefinitionVersionData.DeserializeNetworkFunctionDefinitionVersionData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((NetworkFunctionDefinitionVersionData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets information about a network function definition version. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the network function definition group. + /// The name of the network function definition version. The name should conform to the SemVer 2.0.0 specification: https://semver.org/spec/v2.0.0.html. + /// 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 publisherName, string networkFunctionDefinitionGroupName, string networkFunctionDefinitionVersionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(networkFunctionDefinitionGroupName, nameof(networkFunctionDefinitionGroupName)); + Argument.AssertNotNullOrEmpty(networkFunctionDefinitionVersionName, nameof(networkFunctionDefinitionVersionName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, publisherName, networkFunctionDefinitionGroupName, networkFunctionDefinitionVersionName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + NetworkFunctionDefinitionVersionData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = NetworkFunctionDefinitionVersionData.DeserializeNetworkFunctionDefinitionVersionData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((NetworkFunctionDefinitionVersionData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string publisherName, string networkFunctionDefinitionGroupName, string networkFunctionDefinitionVersionName, TagsObject tagsObject) + { + 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.HybridNetwork/publishers/", false); + uri.AppendPath(publisherName, true); + uri.AppendPath("/networkFunctionDefinitionGroups/", false); + uri.AppendPath(networkFunctionDefinitionGroupName, true); + uri.AppendPath("/networkFunctionDefinitionVersions/", false); + uri.AppendPath(networkFunctionDefinitionVersionName, 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(tagsObject); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Updates a network function definition version resource. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the network function definition group. + /// The name of the network function definition version. The name should conform to the SemVer 2.0.0 specification: https://semver.org/spec/v2.0.0.html. + /// Parameters supplied to the create or update network function definition version operation. + /// 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 publisherName, string networkFunctionDefinitionGroupName, string networkFunctionDefinitionVersionName, TagsObject tagsObject, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(networkFunctionDefinitionGroupName, nameof(networkFunctionDefinitionGroupName)); + Argument.AssertNotNullOrEmpty(networkFunctionDefinitionVersionName, nameof(networkFunctionDefinitionVersionName)); + Argument.AssertNotNull(tagsObject, nameof(tagsObject)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, publisherName, networkFunctionDefinitionGroupName, networkFunctionDefinitionVersionName, tagsObject); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + NetworkFunctionDefinitionVersionData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = NetworkFunctionDefinitionVersionData.DeserializeNetworkFunctionDefinitionVersionData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Updates a network function definition version resource. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the network function definition group. + /// The name of the network function definition version. The name should conform to the SemVer 2.0.0 specification: https://semver.org/spec/v2.0.0.html. + /// Parameters supplied to the create or update network function definition version operation. + /// 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 publisherName, string networkFunctionDefinitionGroupName, string networkFunctionDefinitionVersionName, TagsObject tagsObject, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(networkFunctionDefinitionGroupName, nameof(networkFunctionDefinitionGroupName)); + Argument.AssertNotNullOrEmpty(networkFunctionDefinitionVersionName, nameof(networkFunctionDefinitionVersionName)); + Argument.AssertNotNull(tagsObject, nameof(tagsObject)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, publisherName, networkFunctionDefinitionGroupName, networkFunctionDefinitionVersionName, tagsObject); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + NetworkFunctionDefinitionVersionData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = NetworkFunctionDefinitionVersionData.DeserializeNetworkFunctionDefinitionVersionData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByNetworkFunctionDefinitionGroupRequest(string subscriptionId, string resourceGroupName, string publisherName, string networkFunctionDefinitionGroupName) + { + 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.HybridNetwork/publishers/", false); + uri.AppendPath(publisherName, true); + uri.AppendPath("/networkFunctionDefinitionGroups/", false); + uri.AppendPath(networkFunctionDefinitionGroupName, true); + uri.AppendPath("/networkFunctionDefinitionVersions", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets information about a list of network function definition versions under a network function definition group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the network function definition group. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> ListByNetworkFunctionDefinitionGroupAsync(string subscriptionId, string resourceGroupName, string publisherName, string networkFunctionDefinitionGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(networkFunctionDefinitionGroupName, nameof(networkFunctionDefinitionGroupName)); + + using var message = CreateListByNetworkFunctionDefinitionGroupRequest(subscriptionId, resourceGroupName, publisherName, networkFunctionDefinitionGroupName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + NetworkFunctionDefinitionVersionListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = NetworkFunctionDefinitionVersionListResult.DeserializeNetworkFunctionDefinitionVersionListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets information about a list of network function definition versions under a network function definition group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the network function definition group. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response ListByNetworkFunctionDefinitionGroup(string subscriptionId, string resourceGroupName, string publisherName, string networkFunctionDefinitionGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(networkFunctionDefinitionGroupName, nameof(networkFunctionDefinitionGroupName)); + + using var message = CreateListByNetworkFunctionDefinitionGroupRequest(subscriptionId, resourceGroupName, publisherName, networkFunctionDefinitionGroupName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + NetworkFunctionDefinitionVersionListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = NetworkFunctionDefinitionVersionListResult.DeserializeNetworkFunctionDefinitionVersionListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateUpdateStateRequest(string subscriptionId, string resourceGroupName, string publisherName, string networkFunctionDefinitionGroupName, string networkFunctionDefinitionVersionName, NetworkFunctionDefinitionVersionUpdateState networkFunctionDefinitionVersionUpdateState) + { + 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("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.HybridNetwork/publishers/", false); + uri.AppendPath(publisherName, true); + uri.AppendPath("/networkFunctionDefinitionGroups/", false); + uri.AppendPath(networkFunctionDefinitionGroupName, true); + uri.AppendPath("/networkFunctionDefinitionVersions/", false); + uri.AppendPath(networkFunctionDefinitionVersionName, true); + uri.AppendPath("/updateState", false); + 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(networkFunctionDefinitionVersionUpdateState); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Update network function definition version state. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the network function definition group. + /// The name of the network function definition version. The name should conform to the SemVer 2.0.0 specification: https://semver.org/spec/v2.0.0.html. + /// Parameters supplied to update the state of network function definition version. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task UpdateStateAsync(string subscriptionId, string resourceGroupName, string publisherName, string networkFunctionDefinitionGroupName, string networkFunctionDefinitionVersionName, NetworkFunctionDefinitionVersionUpdateState networkFunctionDefinitionVersionUpdateState, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(networkFunctionDefinitionGroupName, nameof(networkFunctionDefinitionGroupName)); + Argument.AssertNotNullOrEmpty(networkFunctionDefinitionVersionName, nameof(networkFunctionDefinitionVersionName)); + Argument.AssertNotNull(networkFunctionDefinitionVersionUpdateState, nameof(networkFunctionDefinitionVersionUpdateState)); + + using var message = CreateUpdateStateRequest(subscriptionId, resourceGroupName, publisherName, networkFunctionDefinitionGroupName, networkFunctionDefinitionVersionName, networkFunctionDefinitionVersionUpdateState); + 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 network function definition version state. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the network function definition group. + /// The name of the network function definition version. The name should conform to the SemVer 2.0.0 specification: https://semver.org/spec/v2.0.0.html. + /// Parameters supplied to update the state of network function definition version. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response UpdateState(string subscriptionId, string resourceGroupName, string publisherName, string networkFunctionDefinitionGroupName, string networkFunctionDefinitionVersionName, NetworkFunctionDefinitionVersionUpdateState networkFunctionDefinitionVersionUpdateState, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(networkFunctionDefinitionGroupName, nameof(networkFunctionDefinitionGroupName)); + Argument.AssertNotNullOrEmpty(networkFunctionDefinitionVersionName, nameof(networkFunctionDefinitionVersionName)); + Argument.AssertNotNull(networkFunctionDefinitionVersionUpdateState, nameof(networkFunctionDefinitionVersionUpdateState)); + + using var message = CreateUpdateStateRequest(subscriptionId, resourceGroupName, publisherName, networkFunctionDefinitionGroupName, networkFunctionDefinitionVersionName, networkFunctionDefinitionVersionUpdateState); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByNetworkFunctionDefinitionGroupNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string publisherName, string networkFunctionDefinitionGroupName) + { + 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; + } + + /// Gets information about a list of network function definition versions under a network function definition group. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the network function definition group. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> ListByNetworkFunctionDefinitionGroupNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string publisherName, string networkFunctionDefinitionGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(networkFunctionDefinitionGroupName, nameof(networkFunctionDefinitionGroupName)); + + using var message = CreateListByNetworkFunctionDefinitionGroupNextPageRequest(nextLink, subscriptionId, resourceGroupName, publisherName, networkFunctionDefinitionGroupName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + NetworkFunctionDefinitionVersionListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = NetworkFunctionDefinitionVersionListResult.DeserializeNetworkFunctionDefinitionVersionListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets information about a list of network function definition versions under a network function definition group. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the network function definition group. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response ListByNetworkFunctionDefinitionGroupNextPage(string nextLink, string subscriptionId, string resourceGroupName, string publisherName, string networkFunctionDefinitionGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(networkFunctionDefinitionGroupName, nameof(networkFunctionDefinitionGroupName)); + + using var message = CreateListByNetworkFunctionDefinitionGroupNextPageRequest(nextLink, subscriptionId, resourceGroupName, publisherName, networkFunctionDefinitionGroupName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + NetworkFunctionDefinitionVersionListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = NetworkFunctionDefinitionVersionListResult.DeserializeNetworkFunctionDefinitionVersionListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/RestOperations/NetworkFunctionsRestOperations.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/RestOperations/NetworkFunctionsRestOperations.cs new file mode 100644 index 000000000000..dfe4c57e8ef1 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/RestOperations/NetworkFunctionsRestOperations.cs @@ -0,0 +1,717 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.HybridNetwork.Models; + +namespace Azure.ResourceManager.HybridNetwork +{ + internal partial class NetworkFunctionsRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of NetworkFunctionsRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public NetworkFunctionsRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2023-09-01"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string networkFunctionName) + { + 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.HybridNetwork/networkFunctions/", false); + uri.AppendPath(networkFunctionName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Deletes the specified network function resource. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the network function. + /// 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 networkFunctionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(networkFunctionName, nameof(networkFunctionName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, networkFunctionName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Deletes the specified network function resource. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the network function. + /// 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 networkFunctionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(networkFunctionName, nameof(networkFunctionName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, networkFunctionName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string networkFunctionName) + { + 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.HybridNetwork/networkFunctions/", false); + uri.AppendPath(networkFunctionName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets information about the specified network function resource. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the network function resource. + /// 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 networkFunctionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(networkFunctionName, nameof(networkFunctionName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, networkFunctionName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + NetworkFunctionData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = NetworkFunctionData.DeserializeNetworkFunctionData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((NetworkFunctionData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets information about the specified network function resource. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the network function resource. + /// 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 networkFunctionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(networkFunctionName, nameof(networkFunctionName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, networkFunctionName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + NetworkFunctionData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = NetworkFunctionData.DeserializeNetworkFunctionData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((NetworkFunctionData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string networkFunctionName, NetworkFunctionData 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.HybridNetwork/networkFunctions/", false); + uri.AppendPath(networkFunctionName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Creates or updates a network function resource. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Resource name for the network function resource. + /// Parameters supplied in the body to the create or update network function operation. + /// 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 networkFunctionName, NetworkFunctionData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(networkFunctionName, nameof(networkFunctionName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, networkFunctionName, 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); + } + } + + /// Creates or updates a network function resource. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Resource name for the network function resource. + /// Parameters supplied in the body to the create or update network function operation. + /// 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 networkFunctionName, NetworkFunctionData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(networkFunctionName, nameof(networkFunctionName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, networkFunctionName, data); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateUpdateTagsRequest(string subscriptionId, string resourceGroupName, string networkFunctionName, TagsObject tagsObject) + { + 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.HybridNetwork/networkFunctions/", false); + uri.AppendPath(networkFunctionName, 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(tagsObject); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Updates the tags for the network function resource. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Resource name for the network function resource. + /// Parameters supplied to the update network function tags operation. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> UpdateTagsAsync(string subscriptionId, string resourceGroupName, string networkFunctionName, TagsObject tagsObject, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(networkFunctionName, nameof(networkFunctionName)); + Argument.AssertNotNull(tagsObject, nameof(tagsObject)); + + using var message = CreateUpdateTagsRequest(subscriptionId, resourceGroupName, networkFunctionName, tagsObject); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + NetworkFunctionData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = NetworkFunctionData.DeserializeNetworkFunctionData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Updates the tags for the network function resource. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Resource name for the network function resource. + /// Parameters supplied to the update network function tags operation. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response UpdateTags(string subscriptionId, string resourceGroupName, string networkFunctionName, TagsObject tagsObject, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(networkFunctionName, nameof(networkFunctionName)); + Argument.AssertNotNull(tagsObject, nameof(tagsObject)); + + using var message = CreateUpdateTagsRequest(subscriptionId, resourceGroupName, networkFunctionName, tagsObject); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + NetworkFunctionData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = NetworkFunctionData.DeserializeNetworkFunctionData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + 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.HybridNetwork/networkFunctions", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists all the network functions in a subscription. + /// The ID of the target subscription. + /// 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: + { + NetworkFunctionListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = NetworkFunctionListResult.DeserializeNetworkFunctionListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists all the network functions in a subscription. + /// The ID of the target subscription. + /// 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: + { + NetworkFunctionListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = NetworkFunctionListResult.DeserializeNetworkFunctionListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByResourceGroupRequest(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.HybridNetwork/networkFunctions", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists all the network function resources in a resource group. + /// The ID of the target subscription. + /// 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> ListByResourceGroupAsync(string subscriptionId, string resourceGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + + using var message = CreateListByResourceGroupRequest(subscriptionId, resourceGroupName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + NetworkFunctionListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = NetworkFunctionListResult.DeserializeNetworkFunctionListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists all the network function resources in a resource group. + /// The ID of the target subscription. + /// 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 ListByResourceGroup(string subscriptionId, string resourceGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + + using var message = CreateListByResourceGroupRequest(subscriptionId, resourceGroupName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + NetworkFunctionListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = NetworkFunctionListResult.DeserializeNetworkFunctionListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateExecuteRequestRequest(string subscriptionId, string resourceGroupName, string networkFunctionName, ExecuteRequestContent 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("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.HybridNetwork/networkFunctions/", false); + uri.AppendPath(networkFunctionName, true); + uri.AppendPath("/executeRequest", 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); + request.Content = content0; + _userAgent.Apply(message); + return message; + } + + /// Execute a request to services on a containerized network function. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the network function. + /// Payload for execute request post call. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task ExecuteRequestAsync(string subscriptionId, string resourceGroupName, string networkFunctionName, ExecuteRequestContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(networkFunctionName, nameof(networkFunctionName)); + Argument.AssertNotNull(content, nameof(content)); + + using var message = CreateExecuteRequestRequest(subscriptionId, resourceGroupName, networkFunctionName, content); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Execute a request to services on a containerized network function. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the network function. + /// Payload for execute request post call. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ExecuteRequest(string subscriptionId, string resourceGroupName, string networkFunctionName, ExecuteRequestContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(networkFunctionName, nameof(networkFunctionName)); + Argument.AssertNotNull(content, nameof(content)); + + using var message = CreateExecuteRequestRequest(subscriptionId, resourceGroupName, networkFunctionName, content); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + 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; + } + + /// Lists all the network functions in a subscription. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// 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: + { + NetworkFunctionListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = NetworkFunctionListResult.DeserializeNetworkFunctionListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists all the network functions in a subscription. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// 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: + { + NetworkFunctionListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = NetworkFunctionListResult.DeserializeNetworkFunctionListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByResourceGroupNextPageRequest(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; + } + + /// Lists all the network function resources in a resource group. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The cancellation token to use. + /// , or is null. + /// or is an empty string, and was expected to be non-empty. + public async Task> ListByResourceGroupNextPageAsync(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 = CreateListByResourceGroupNextPageRequest(nextLink, subscriptionId, resourceGroupName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + NetworkFunctionListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = NetworkFunctionListResult.DeserializeNetworkFunctionListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists all the network function resources in a resource group. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The cancellation token to use. + /// , or is null. + /// or is an empty string, and was expected to be non-empty. + public Response ListByResourceGroupNextPage(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 = CreateListByResourceGroupNextPageRequest(nextLink, subscriptionId, resourceGroupName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + NetworkFunctionListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = NetworkFunctionListResult.DeserializeNetworkFunctionListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/RestOperations/NetworkServiceDesignGroupsRestOperations.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/RestOperations/NetworkServiceDesignGroupsRestOperations.cs new file mode 100644 index 000000000000..0a8e620dd2e3 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/RestOperations/NetworkServiceDesignGroupsRestOperations.cs @@ -0,0 +1,535 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.HybridNetwork.Models; + +namespace Azure.ResourceManager.HybridNetwork +{ + internal partial class NetworkServiceDesignGroupsRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of NetworkServiceDesignGroupsRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public NetworkServiceDesignGroupsRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2023-09-01"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateListByPublisherRequest(string subscriptionId, string resourceGroupName, string publisherName) + { + 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.HybridNetwork/publishers/", false); + uri.AppendPath(publisherName, true); + uri.AppendPath("/networkServiceDesignGroups", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets information of the network service design groups under a publisher. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListByPublisherAsync(string subscriptionId, string resourceGroupName, string publisherName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + + using var message = CreateListByPublisherRequest(subscriptionId, resourceGroupName, publisherName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + NetworkServiceDesignGroupListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = NetworkServiceDesignGroupListResult.DeserializeNetworkServiceDesignGroupListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets information of the network service design groups under a publisher. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListByPublisher(string subscriptionId, string resourceGroupName, string publisherName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + + using var message = CreateListByPublisherRequest(subscriptionId, resourceGroupName, publisherName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + NetworkServiceDesignGroupListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = NetworkServiceDesignGroupListResult.DeserializeNetworkServiceDesignGroupListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string publisherName, string networkServiceDesignGroupName) + { + 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.HybridNetwork/publishers/", false); + uri.AppendPath(publisherName, true); + uri.AppendPath("/networkServiceDesignGroups/", false); + uri.AppendPath(networkServiceDesignGroupName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Deletes a specified network service design group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the network service design group. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string publisherName, string networkServiceDesignGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(networkServiceDesignGroupName, nameof(networkServiceDesignGroupName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, publisherName, networkServiceDesignGroupName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Deletes a specified network service design group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the network service design group. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Delete(string subscriptionId, string resourceGroupName, string publisherName, string networkServiceDesignGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(networkServiceDesignGroupName, nameof(networkServiceDesignGroupName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, publisherName, networkServiceDesignGroupName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string publisherName, string networkServiceDesignGroupName, NetworkServiceDesignGroupData 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.HybridNetwork/publishers/", false); + uri.AppendPath(publisherName, true); + uri.AppendPath("/networkServiceDesignGroups/", false); + uri.AppendPath(networkServiceDesignGroupName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Creates or updates a network service design group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the network service design group. + /// Parameters supplied to the create or update publisher network service design group operation. + /// 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 publisherName, string networkServiceDesignGroupName, NetworkServiceDesignGroupData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(networkServiceDesignGroupName, nameof(networkServiceDesignGroupName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, publisherName, networkServiceDesignGroupName, 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); + } + } + + /// Creates or updates a network service design group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the network service design group. + /// Parameters supplied to the create or update publisher network service design group operation. + /// 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 publisherName, string networkServiceDesignGroupName, NetworkServiceDesignGroupData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(networkServiceDesignGroupName, nameof(networkServiceDesignGroupName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, publisherName, networkServiceDesignGroupName, data); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string publisherName, string networkServiceDesignGroupName) + { + 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.HybridNetwork/publishers/", false); + uri.AppendPath(publisherName, true); + uri.AppendPath("/networkServiceDesignGroups/", false); + uri.AppendPath(networkServiceDesignGroupName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets information about the specified networkServiceDesign group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the network service design group. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string publisherName, string networkServiceDesignGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(networkServiceDesignGroupName, nameof(networkServiceDesignGroupName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, publisherName, networkServiceDesignGroupName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + NetworkServiceDesignGroupData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = NetworkServiceDesignGroupData.DeserializeNetworkServiceDesignGroupData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((NetworkServiceDesignGroupData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets information about the specified networkServiceDesign group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the network service design group. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string resourceGroupName, string publisherName, string networkServiceDesignGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(networkServiceDesignGroupName, nameof(networkServiceDesignGroupName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, publisherName, networkServiceDesignGroupName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + NetworkServiceDesignGroupData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = NetworkServiceDesignGroupData.DeserializeNetworkServiceDesignGroupData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((NetworkServiceDesignGroupData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string publisherName, string networkServiceDesignGroupName, TagsObject tagsObject) + { + 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.HybridNetwork/publishers/", false); + uri.AppendPath(publisherName, true); + uri.AppendPath("/networkServiceDesignGroups/", false); + uri.AppendPath(networkServiceDesignGroupName, 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(tagsObject); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Updates a network service design groups resource. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the network service design group. + /// Parameters supplied to the create or update publisher network service design group operation. + /// 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 publisherName, string networkServiceDesignGroupName, TagsObject tagsObject, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(networkServiceDesignGroupName, nameof(networkServiceDesignGroupName)); + Argument.AssertNotNull(tagsObject, nameof(tagsObject)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, publisherName, networkServiceDesignGroupName, tagsObject); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + NetworkServiceDesignGroupData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = NetworkServiceDesignGroupData.DeserializeNetworkServiceDesignGroupData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Updates a network service design groups resource. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the network service design group. + /// Parameters supplied to the create or update publisher network service design group operation. + /// 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 publisherName, string networkServiceDesignGroupName, TagsObject tagsObject, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(networkServiceDesignGroupName, nameof(networkServiceDesignGroupName)); + Argument.AssertNotNull(tagsObject, nameof(tagsObject)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, publisherName, networkServiceDesignGroupName, tagsObject); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + NetworkServiceDesignGroupData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = NetworkServiceDesignGroupData.DeserializeNetworkServiceDesignGroupData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByPublisherNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string publisherName) + { + 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; + } + + /// Gets information of the network service design groups under a publisher. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListByPublisherNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string publisherName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + + using var message = CreateListByPublisherNextPageRequest(nextLink, subscriptionId, resourceGroupName, publisherName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + NetworkServiceDesignGroupListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = NetworkServiceDesignGroupListResult.DeserializeNetworkServiceDesignGroupListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets information of the network service design groups under a publisher. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListByPublisherNextPage(string nextLink, string subscriptionId, string resourceGroupName, string publisherName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + + using var message = CreateListByPublisherNextPageRequest(nextLink, subscriptionId, resourceGroupName, publisherName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + NetworkServiceDesignGroupListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = NetworkServiceDesignGroupListResult.DeserializeNetworkServiceDesignGroupListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/RestOperations/NetworkServiceDesignVersionsRestOperations.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/RestOperations/NetworkServiceDesignVersionsRestOperations.cs new file mode 100644 index 000000000000..c046c6ccd4d3 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/RestOperations/NetworkServiceDesignVersionsRestOperations.cs @@ -0,0 +1,660 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.HybridNetwork.Models; + +namespace Azure.ResourceManager.HybridNetwork +{ + internal partial class NetworkServiceDesignVersionsRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of NetworkServiceDesignVersionsRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public NetworkServiceDesignVersionsRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2023-09-01"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string publisherName, string networkServiceDesignGroupName, string networkServiceDesignVersionName) + { + 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.HybridNetwork/publishers/", false); + uri.AppendPath(publisherName, true); + uri.AppendPath("/networkServiceDesignGroups/", false); + uri.AppendPath(networkServiceDesignGroupName, true); + uri.AppendPath("/networkServiceDesignVersions/", false); + uri.AppendPath(networkServiceDesignVersionName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Deletes the specified network service design version. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the network service design group. + /// The name of the network service design version. The name should conform to the SemVer 2.0.0 specification: https://semver.org/spec/v2.0.0.html. + /// 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 publisherName, string networkServiceDesignGroupName, string networkServiceDesignVersionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(networkServiceDesignGroupName, nameof(networkServiceDesignGroupName)); + Argument.AssertNotNullOrEmpty(networkServiceDesignVersionName, nameof(networkServiceDesignVersionName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, publisherName, networkServiceDesignGroupName, networkServiceDesignVersionName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Deletes the specified network service design version. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the network service design group. + /// The name of the network service design version. The name should conform to the SemVer 2.0.0 specification: https://semver.org/spec/v2.0.0.html. + /// 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 publisherName, string networkServiceDesignGroupName, string networkServiceDesignVersionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(networkServiceDesignGroupName, nameof(networkServiceDesignGroupName)); + Argument.AssertNotNullOrEmpty(networkServiceDesignVersionName, nameof(networkServiceDesignVersionName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, publisherName, networkServiceDesignGroupName, networkServiceDesignVersionName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string publisherName, string networkServiceDesignGroupName, string networkServiceDesignVersionName, NetworkServiceDesignVersionData 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.HybridNetwork/publishers/", false); + uri.AppendPath(publisherName, true); + uri.AppendPath("/networkServiceDesignGroups/", false); + uri.AppendPath(networkServiceDesignGroupName, true); + uri.AppendPath("/networkServiceDesignVersions/", false); + uri.AppendPath(networkServiceDesignVersionName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Creates or updates a network service design version. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the network service design group. + /// The name of the network service design version. The name should conform to the SemVer 2.0.0 specification: https://semver.org/spec/v2.0.0.html. + /// Parameters supplied to the create or update network service design version operation. + /// 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 publisherName, string networkServiceDesignGroupName, string networkServiceDesignVersionName, NetworkServiceDesignVersionData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(networkServiceDesignGroupName, nameof(networkServiceDesignGroupName)); + Argument.AssertNotNullOrEmpty(networkServiceDesignVersionName, nameof(networkServiceDesignVersionName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, publisherName, networkServiceDesignGroupName, networkServiceDesignVersionName, 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); + } + } + + /// Creates or updates a network service design version. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the network service design group. + /// The name of the network service design version. The name should conform to the SemVer 2.0.0 specification: https://semver.org/spec/v2.0.0.html. + /// Parameters supplied to the create or update network service design version operation. + /// 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 publisherName, string networkServiceDesignGroupName, string networkServiceDesignVersionName, NetworkServiceDesignVersionData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(networkServiceDesignGroupName, nameof(networkServiceDesignGroupName)); + Argument.AssertNotNullOrEmpty(networkServiceDesignVersionName, nameof(networkServiceDesignVersionName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, publisherName, networkServiceDesignGroupName, networkServiceDesignVersionName, data); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string publisherName, string networkServiceDesignGroupName, string networkServiceDesignVersionName) + { + 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.HybridNetwork/publishers/", false); + uri.AppendPath(publisherName, true); + uri.AppendPath("/networkServiceDesignGroups/", false); + uri.AppendPath(networkServiceDesignGroupName, true); + uri.AppendPath("/networkServiceDesignVersions/", false); + uri.AppendPath(networkServiceDesignVersionName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets information about a network service design version. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the network service design group. + /// The name of the network service design version. The name should conform to the SemVer 2.0.0 specification: https://semver.org/spec/v2.0.0.html. + /// 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 publisherName, string networkServiceDesignGroupName, string networkServiceDesignVersionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(networkServiceDesignGroupName, nameof(networkServiceDesignGroupName)); + Argument.AssertNotNullOrEmpty(networkServiceDesignVersionName, nameof(networkServiceDesignVersionName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, publisherName, networkServiceDesignGroupName, networkServiceDesignVersionName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + NetworkServiceDesignVersionData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = NetworkServiceDesignVersionData.DeserializeNetworkServiceDesignVersionData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((NetworkServiceDesignVersionData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets information about a network service design version. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the network service design group. + /// The name of the network service design version. The name should conform to the SemVer 2.0.0 specification: https://semver.org/spec/v2.0.0.html. + /// 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 publisherName, string networkServiceDesignGroupName, string networkServiceDesignVersionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(networkServiceDesignGroupName, nameof(networkServiceDesignGroupName)); + Argument.AssertNotNullOrEmpty(networkServiceDesignVersionName, nameof(networkServiceDesignVersionName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, publisherName, networkServiceDesignGroupName, networkServiceDesignVersionName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + NetworkServiceDesignVersionData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = NetworkServiceDesignVersionData.DeserializeNetworkServiceDesignVersionData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((NetworkServiceDesignVersionData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string publisherName, string networkServiceDesignGroupName, string networkServiceDesignVersionName, TagsObject tagsObject) + { + 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.HybridNetwork/publishers/", false); + uri.AppendPath(publisherName, true); + uri.AppendPath("/networkServiceDesignGroups/", false); + uri.AppendPath(networkServiceDesignGroupName, true); + uri.AppendPath("/networkServiceDesignVersions/", false); + uri.AppendPath(networkServiceDesignVersionName, 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(tagsObject); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Updates a network service design version resource. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the network service design group. + /// The name of the network service design version. The name should conform to the SemVer 2.0.0 specification: https://semver.org/spec/v2.0.0.html. + /// Parameters supplied to the create or update network service design version operation. + /// 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 publisherName, string networkServiceDesignGroupName, string networkServiceDesignVersionName, TagsObject tagsObject, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(networkServiceDesignGroupName, nameof(networkServiceDesignGroupName)); + Argument.AssertNotNullOrEmpty(networkServiceDesignVersionName, nameof(networkServiceDesignVersionName)); + Argument.AssertNotNull(tagsObject, nameof(tagsObject)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, publisherName, networkServiceDesignGroupName, networkServiceDesignVersionName, tagsObject); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + NetworkServiceDesignVersionData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = NetworkServiceDesignVersionData.DeserializeNetworkServiceDesignVersionData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Updates a network service design version resource. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the network service design group. + /// The name of the network service design version. The name should conform to the SemVer 2.0.0 specification: https://semver.org/spec/v2.0.0.html. + /// Parameters supplied to the create or update network service design version operation. + /// 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 publisherName, string networkServiceDesignGroupName, string networkServiceDesignVersionName, TagsObject tagsObject, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(networkServiceDesignGroupName, nameof(networkServiceDesignGroupName)); + Argument.AssertNotNullOrEmpty(networkServiceDesignVersionName, nameof(networkServiceDesignVersionName)); + Argument.AssertNotNull(tagsObject, nameof(tagsObject)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, publisherName, networkServiceDesignGroupName, networkServiceDesignVersionName, tagsObject); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + NetworkServiceDesignVersionData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = NetworkServiceDesignVersionData.DeserializeNetworkServiceDesignVersionData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByNetworkServiceDesignGroupRequest(string subscriptionId, string resourceGroupName, string publisherName, string networkServiceDesignGroupName) + { + 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.HybridNetwork/publishers/", false); + uri.AppendPath(publisherName, true); + uri.AppendPath("/networkServiceDesignGroups/", false); + uri.AppendPath(networkServiceDesignGroupName, true); + uri.AppendPath("/networkServiceDesignVersions", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets information about a list of network service design versions under a network service design group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the network service design group. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> ListByNetworkServiceDesignGroupAsync(string subscriptionId, string resourceGroupName, string publisherName, string networkServiceDesignGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(networkServiceDesignGroupName, nameof(networkServiceDesignGroupName)); + + using var message = CreateListByNetworkServiceDesignGroupRequest(subscriptionId, resourceGroupName, publisherName, networkServiceDesignGroupName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + NetworkServiceDesignVersionListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = NetworkServiceDesignVersionListResult.DeserializeNetworkServiceDesignVersionListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets information about a list of network service design versions under a network service design group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the network service design group. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response ListByNetworkServiceDesignGroup(string subscriptionId, string resourceGroupName, string publisherName, string networkServiceDesignGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(networkServiceDesignGroupName, nameof(networkServiceDesignGroupName)); + + using var message = CreateListByNetworkServiceDesignGroupRequest(subscriptionId, resourceGroupName, publisherName, networkServiceDesignGroupName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + NetworkServiceDesignVersionListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = NetworkServiceDesignVersionListResult.DeserializeNetworkServiceDesignVersionListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateUpdateStateRequest(string subscriptionId, string resourceGroupName, string publisherName, string networkServiceDesignGroupName, string networkServiceDesignVersionName, NetworkServiceDesignVersionUpdateState networkServiceDesignVersionUpdateState) + { + 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("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.HybridNetwork/publishers/", false); + uri.AppendPath(publisherName, true); + uri.AppendPath("/networkServiceDesignGroups/", false); + uri.AppendPath(networkServiceDesignGroupName, true); + uri.AppendPath("/networkServiceDesignVersions/", false); + uri.AppendPath(networkServiceDesignVersionName, true); + uri.AppendPath("/updateState", false); + 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(networkServiceDesignVersionUpdateState); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Update network service design version state. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the network service design group. + /// The name of the network service design version. The name should conform to the SemVer 2.0.0 specification: https://semver.org/spec/v2.0.0.html. + /// Parameters supplied to update the state of network service design version. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task UpdateStateAsync(string subscriptionId, string resourceGroupName, string publisherName, string networkServiceDesignGroupName, string networkServiceDesignVersionName, NetworkServiceDesignVersionUpdateState networkServiceDesignVersionUpdateState, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(networkServiceDesignGroupName, nameof(networkServiceDesignGroupName)); + Argument.AssertNotNullOrEmpty(networkServiceDesignVersionName, nameof(networkServiceDesignVersionName)); + Argument.AssertNotNull(networkServiceDesignVersionUpdateState, nameof(networkServiceDesignVersionUpdateState)); + + using var message = CreateUpdateStateRequest(subscriptionId, resourceGroupName, publisherName, networkServiceDesignGroupName, networkServiceDesignVersionName, networkServiceDesignVersionUpdateState); + 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 network service design version state. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the network service design group. + /// The name of the network service design version. The name should conform to the SemVer 2.0.0 specification: https://semver.org/spec/v2.0.0.html. + /// Parameters supplied to update the state of network service design version. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response UpdateState(string subscriptionId, string resourceGroupName, string publisherName, string networkServiceDesignGroupName, string networkServiceDesignVersionName, NetworkServiceDesignVersionUpdateState networkServiceDesignVersionUpdateState, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(networkServiceDesignGroupName, nameof(networkServiceDesignGroupName)); + Argument.AssertNotNullOrEmpty(networkServiceDesignVersionName, nameof(networkServiceDesignVersionName)); + Argument.AssertNotNull(networkServiceDesignVersionUpdateState, nameof(networkServiceDesignVersionUpdateState)); + + using var message = CreateUpdateStateRequest(subscriptionId, resourceGroupName, publisherName, networkServiceDesignGroupName, networkServiceDesignVersionName, networkServiceDesignVersionUpdateState); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByNetworkServiceDesignGroupNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string publisherName, string networkServiceDesignGroupName) + { + 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; + } + + /// Gets information about a list of network service design versions under a network service design group. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the network service design group. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> ListByNetworkServiceDesignGroupNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string publisherName, string networkServiceDesignGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(networkServiceDesignGroupName, nameof(networkServiceDesignGroupName)); + + using var message = CreateListByNetworkServiceDesignGroupNextPageRequest(nextLink, subscriptionId, resourceGroupName, publisherName, networkServiceDesignGroupName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + NetworkServiceDesignVersionListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = NetworkServiceDesignVersionListResult.DeserializeNetworkServiceDesignVersionListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets information about a list of network service design versions under a network service design group. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the network service design group. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response ListByNetworkServiceDesignGroupNextPage(string nextLink, string subscriptionId, string resourceGroupName, string publisherName, string networkServiceDesignGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(networkServiceDesignGroupName, nameof(networkServiceDesignGroupName)); + + using var message = CreateListByNetworkServiceDesignGroupNextPageRequest(nextLink, subscriptionId, resourceGroupName, publisherName, networkServiceDesignGroupName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + NetworkServiceDesignVersionListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = NetworkServiceDesignVersionListResult.DeserializeNetworkServiceDesignVersionListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/RestOperations/ProxyArtifactRestOperations.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/RestOperations/ProxyArtifactRestOperations.cs new file mode 100644 index 000000000000..139d3dd38c2a --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/RestOperations/ProxyArtifactRestOperations.cs @@ -0,0 +1,474 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.HybridNetwork.Models; + +namespace Azure.ResourceManager.HybridNetwork +{ + internal partial class ProxyArtifactRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of ProxyArtifactRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public ProxyArtifactRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2023-09-01"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateListRequest(string subscriptionId, string resourceGroupName, string publisherName, string artifactStoreName) + { + 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.HybridNetwork/publishers/", false); + uri.AppendPath(publisherName, true); + uri.AppendPath("/artifactStores/", false); + uri.AppendPath(artifactStoreName, true); + uri.AppendPath("/artifacts", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists all the available artifacts in the parent Artifact Store. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the artifact store. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> ListAsync(string subscriptionId, string resourceGroupName, string publisherName, string artifactStoreName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(artifactStoreName, nameof(artifactStoreName)); + + using var message = CreateListRequest(subscriptionId, resourceGroupName, publisherName, artifactStoreName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ProxyArtifactOverviewListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ProxyArtifactOverviewListResult.DeserializeProxyArtifactOverviewListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists all the available artifacts in the parent Artifact Store. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the artifact store. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response List(string subscriptionId, string resourceGroupName, string publisherName, string artifactStoreName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(artifactStoreName, nameof(artifactStoreName)); + + using var message = CreateListRequest(subscriptionId, resourceGroupName, publisherName, artifactStoreName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ProxyArtifactOverviewListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ProxyArtifactOverviewListResult.DeserializeProxyArtifactOverviewListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string publisherName, string artifactStoreName, string artifactName) + { + 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.HybridNetwork/publishers/", false); + uri.AppendPath(publisherName, true); + uri.AppendPath("/artifactStores/", false); + uri.AppendPath(artifactStoreName, true); + uri.AppendPath("/artifactVersions", false); + uri.AppendQuery("artifactName", artifactName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get a Artifact overview information. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the artifact store. + /// The name of the artifact. + /// 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 publisherName, string artifactStoreName, string artifactName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(artifactStoreName, nameof(artifactStoreName)); + Argument.AssertNotNull(artifactName, nameof(artifactName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, publisherName, artifactStoreName, artifactName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ProxyArtifactVersionsOverviewListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ProxyArtifactVersionsOverviewListResult.DeserializeProxyArtifactVersionsOverviewListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get a Artifact overview information. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the artifact store. + /// The name of the artifact. + /// 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 publisherName, string artifactStoreName, string artifactName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(artifactStoreName, nameof(artifactStoreName)); + Argument.AssertNotNull(artifactName, nameof(artifactName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, publisherName, artifactStoreName, artifactName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ProxyArtifactVersionsOverviewListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ProxyArtifactVersionsOverviewListResult.DeserializeProxyArtifactVersionsOverviewListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateUpdateStateRequest(string subscriptionId, string resourceGroupName, string publisherName, string artifactStoreName, string artifactVersionName, string artifactName, ArtifactChangeState artifactChangeState) + { + 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.HybridNetwork/publishers/", false); + uri.AppendPath(publisherName, true); + uri.AppendPath("/artifactStores/", false); + uri.AppendPath(artifactStoreName, true); + uri.AppendPath("/artifactVersions/", false); + uri.AppendPath(artifactVersionName, true); + uri.AppendQuery("artifactName", artifactName, 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(artifactChangeState); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Change artifact state defined in artifact store. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the artifact store. + /// The name of the artifact version. + /// The name of the artifact. + /// Parameters supplied to update the state of artifact manifest. + /// The cancellation token to use. + /// , , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task UpdateStateAsync(string subscriptionId, string resourceGroupName, string publisherName, string artifactStoreName, string artifactVersionName, string artifactName, ArtifactChangeState artifactChangeState, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(artifactStoreName, nameof(artifactStoreName)); + Argument.AssertNotNullOrEmpty(artifactVersionName, nameof(artifactVersionName)); + Argument.AssertNotNull(artifactName, nameof(artifactName)); + Argument.AssertNotNull(artifactChangeState, nameof(artifactChangeState)); + + using var message = CreateUpdateStateRequest(subscriptionId, resourceGroupName, publisherName, artifactStoreName, artifactVersionName, artifactName, artifactChangeState); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Change artifact state defined in artifact store. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the artifact store. + /// The name of the artifact version. + /// The name of the artifact. + /// Parameters supplied to update the state of artifact manifest. + /// The cancellation token to use. + /// , , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response UpdateState(string subscriptionId, string resourceGroupName, string publisherName, string artifactStoreName, string artifactVersionName, string artifactName, ArtifactChangeState artifactChangeState, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(artifactStoreName, nameof(artifactStoreName)); + Argument.AssertNotNullOrEmpty(artifactVersionName, nameof(artifactVersionName)); + Argument.AssertNotNull(artifactName, nameof(artifactName)); + Argument.AssertNotNull(artifactChangeState, nameof(artifactChangeState)); + + using var message = CreateUpdateStateRequest(subscriptionId, resourceGroupName, publisherName, artifactStoreName, artifactVersionName, artifactName, artifactChangeState); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string publisherName, string artifactStoreName) + { + 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; + } + + /// Lists all the available artifacts in the parent Artifact Store. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the artifact store. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> ListNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string publisherName, string artifactStoreName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(artifactStoreName, nameof(artifactStoreName)); + + using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, publisherName, artifactStoreName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ProxyArtifactOverviewListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ProxyArtifactOverviewListResult.DeserializeProxyArtifactOverviewListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists all the available artifacts in the parent Artifact Store. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the artifact store. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response ListNextPage(string nextLink, string subscriptionId, string resourceGroupName, string publisherName, string artifactStoreName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(artifactStoreName, nameof(artifactStoreName)); + + using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, publisherName, artifactStoreName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ProxyArtifactOverviewListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ProxyArtifactOverviewListResult.DeserializeProxyArtifactOverviewListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string publisherName, string artifactStoreName, string artifactName) + { + 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; + } + + /// Get a Artifact overview information. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the artifact store. + /// The name of the artifact. + /// The cancellation token to use. + /// , , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> GetNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string publisherName, string artifactStoreName, string artifactName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(artifactStoreName, nameof(artifactStoreName)); + Argument.AssertNotNull(artifactName, nameof(artifactName)); + + using var message = CreateGetNextPageRequest(nextLink, subscriptionId, resourceGroupName, publisherName, artifactStoreName, artifactName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ProxyArtifactVersionsOverviewListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ProxyArtifactVersionsOverviewListResult.DeserializeProxyArtifactVersionsOverviewListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get a Artifact overview information. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the artifact store. + /// The name of the artifact. + /// The cancellation token to use. + /// , , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response GetNextPage(string nextLink, string subscriptionId, string resourceGroupName, string publisherName, string artifactStoreName, string artifactName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(artifactStoreName, nameof(artifactStoreName)); + Argument.AssertNotNull(artifactName, nameof(artifactName)); + + using var message = CreateGetNextPageRequest(nextLink, subscriptionId, resourceGroupName, publisherName, artifactStoreName, artifactName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ProxyArtifactVersionsOverviewListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ProxyArtifactVersionsOverviewListResult.DeserializeProxyArtifactVersionsOverviewListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/RestOperations/PublishersRestOperations.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/RestOperations/PublishersRestOperations.cs new file mode 100644 index 000000000000..f64b44171432 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/RestOperations/PublishersRestOperations.cs @@ -0,0 +1,636 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.HybridNetwork.Models; + +namespace Azure.ResourceManager.HybridNetwork +{ + internal partial class PublishersRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of PublishersRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public PublishersRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2023-09-01"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + 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.HybridNetwork/publishers", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists all the publishers in a subscription. + /// The ID of the target subscription. + /// 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: + { + PublisherListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = PublisherListResult.DeserializePublisherListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists all the publishers in a subscription. + /// The ID of the target subscription. + /// 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: + { + PublisherListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = PublisherListResult.DeserializePublisherListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByResourceGroupRequest(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.HybridNetwork/publishers", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists all the publishers in a resource group. + /// The ID of the target subscription. + /// 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> ListByResourceGroupAsync(string subscriptionId, string resourceGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + + using var message = CreateListByResourceGroupRequest(subscriptionId, resourceGroupName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + PublisherListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = PublisherListResult.DeserializePublisherListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists all the publishers in a resource group. + /// The ID of the target subscription. + /// 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 ListByResourceGroup(string subscriptionId, string resourceGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + + using var message = CreateListByResourceGroupRequest(subscriptionId, resourceGroupName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + PublisherListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = PublisherListResult.DeserializePublisherListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string publisherName) + { + 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.HybridNetwork/publishers/", false); + uri.AppendPath(publisherName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Deletes the specified publisher. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// 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 publisherName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, publisherName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Deletes the specified publisher. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// 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 publisherName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, publisherName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string publisherName) + { + 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.HybridNetwork/publishers/", false); + uri.AppendPath(publisherName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets information about the specified publisher. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// 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 publisherName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, publisherName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + PublisherData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = PublisherData.DeserializePublisherData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((PublisherData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets information about the specified publisher. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// 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 publisherName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, publisherName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + PublisherData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = PublisherData.DeserializePublisherData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((PublisherData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string publisherName, PublisherData 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.HybridNetwork/publishers/", false); + uri.AppendPath(publisherName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Creates or updates a publisher. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// Parameters supplied to the create publisher operation. + /// 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 publisherName, PublisherData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, publisherName, 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); + } + } + + /// Creates or updates a publisher. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// Parameters supplied to the create publisher operation. + /// 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 publisherName, PublisherData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, publisherName, data); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string publisherName, TagsObject tagsObject) + { + 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.HybridNetwork/publishers/", false); + uri.AppendPath(publisherName, 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(tagsObject); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Update a publisher resource. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// Parameters supplied to the create publisher operation. + /// 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 publisherName, TagsObject tagsObject, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNull(tagsObject, nameof(tagsObject)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, publisherName, tagsObject); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + PublisherData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = PublisherData.DeserializePublisherData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Update a publisher resource. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// Parameters supplied to the create publisher operation. + /// 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 publisherName, TagsObject tagsObject, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNull(tagsObject, nameof(tagsObject)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, publisherName, tagsObject); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + PublisherData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = PublisherData.DeserializePublisherData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + 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; + } + + /// Lists all the publishers in a subscription. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// 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: + { + PublisherListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = PublisherListResult.DeserializePublisherListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists all the publishers in a subscription. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// 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: + { + PublisherListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = PublisherListResult.DeserializePublisherListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByResourceGroupNextPageRequest(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; + } + + /// Lists all the publishers in a resource group. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The cancellation token to use. + /// , or is null. + /// or is an empty string, and was expected to be non-empty. + public async Task> ListByResourceGroupNextPageAsync(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 = CreateListByResourceGroupNextPageRequest(nextLink, subscriptionId, resourceGroupName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + PublisherListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = PublisherListResult.DeserializePublisherListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists all the publishers in a resource group. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The cancellation token to use. + /// , or is null. + /// or is an empty string, and was expected to be non-empty. + public Response ListByResourceGroupNextPage(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 = CreateListByResourceGroupNextPageRequest(nextLink, subscriptionId, resourceGroupName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + PublisherListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = PublisherListResult.DeserializePublisherListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/RestOperations/SiteNetworkServicesRestOperations.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/RestOperations/SiteNetworkServicesRestOperations.cs new file mode 100644 index 000000000000..68d76d178b58 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/RestOperations/SiteNetworkServicesRestOperations.cs @@ -0,0 +1,636 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.HybridNetwork.Models; + +namespace Azure.ResourceManager.HybridNetwork +{ + internal partial class SiteNetworkServicesRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of SiteNetworkServicesRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public SiteNetworkServicesRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2023-09-01"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string siteNetworkServiceName) + { + 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.HybridNetwork/siteNetworkServices/", false); + uri.AppendPath(siteNetworkServiceName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Deletes the specified site network service. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the site network service. + /// 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 siteNetworkServiceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(siteNetworkServiceName, nameof(siteNetworkServiceName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, siteNetworkServiceName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Deletes the specified site network service. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the site network service. + /// 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 siteNetworkServiceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(siteNetworkServiceName, nameof(siteNetworkServiceName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, siteNetworkServiceName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string siteNetworkServiceName) + { + 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.HybridNetwork/siteNetworkServices/", false); + uri.AppendPath(siteNetworkServiceName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets information about the specified site network service. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the site network service. + /// 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 siteNetworkServiceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(siteNetworkServiceName, nameof(siteNetworkServiceName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, siteNetworkServiceName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + SiteNetworkServiceData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = SiteNetworkServiceData.DeserializeSiteNetworkServiceData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((SiteNetworkServiceData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets information about the specified site network service. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the site network service. + /// 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 siteNetworkServiceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(siteNetworkServiceName, nameof(siteNetworkServiceName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, siteNetworkServiceName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + SiteNetworkServiceData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = SiteNetworkServiceData.DeserializeSiteNetworkServiceData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((SiteNetworkServiceData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string siteNetworkServiceName, SiteNetworkServiceData 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.HybridNetwork/siteNetworkServices/", false); + uri.AppendPath(siteNetworkServiceName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Creates or updates a network site. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the site network service. + /// Parameters supplied to the create or update site network service operation. + /// 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 siteNetworkServiceName, SiteNetworkServiceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(siteNetworkServiceName, nameof(siteNetworkServiceName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, siteNetworkServiceName, 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); + } + } + + /// Creates or updates a network site. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the site network service. + /// Parameters supplied to the create or update site network service operation. + /// 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 siteNetworkServiceName, SiteNetworkServiceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(siteNetworkServiceName, nameof(siteNetworkServiceName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, siteNetworkServiceName, data); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateUpdateTagsRequest(string subscriptionId, string resourceGroupName, string siteNetworkServiceName, TagsObject tagsObject) + { + 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.HybridNetwork/siteNetworkServices/", false); + uri.AppendPath(siteNetworkServiceName, 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(tagsObject); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Updates a site update tags. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the site network service. + /// Parameters supplied to update network site tags. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> UpdateTagsAsync(string subscriptionId, string resourceGroupName, string siteNetworkServiceName, TagsObject tagsObject, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(siteNetworkServiceName, nameof(siteNetworkServiceName)); + Argument.AssertNotNull(tagsObject, nameof(tagsObject)); + + using var message = CreateUpdateTagsRequest(subscriptionId, resourceGroupName, siteNetworkServiceName, tagsObject); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + SiteNetworkServiceData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = SiteNetworkServiceData.DeserializeSiteNetworkServiceData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Updates a site update tags. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the site network service. + /// Parameters supplied to update network site tags. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response UpdateTags(string subscriptionId, string resourceGroupName, string siteNetworkServiceName, TagsObject tagsObject, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(siteNetworkServiceName, nameof(siteNetworkServiceName)); + Argument.AssertNotNull(tagsObject, nameof(tagsObject)); + + using var message = CreateUpdateTagsRequest(subscriptionId, resourceGroupName, siteNetworkServiceName, tagsObject); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + SiteNetworkServiceData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = SiteNetworkServiceData.DeserializeSiteNetworkServiceData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + 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.HybridNetwork/siteNetworkServices", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists all sites in the network service in a subscription. + /// The ID of the target subscription. + /// 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: + { + SiteNetworkServiceListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = SiteNetworkServiceListResult.DeserializeSiteNetworkServiceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists all sites in the network service in a subscription. + /// The ID of the target subscription. + /// 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: + { + SiteNetworkServiceListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = SiteNetworkServiceListResult.DeserializeSiteNetworkServiceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByResourceGroupRequest(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.HybridNetwork/siteNetworkServices", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists all site network services. + /// The ID of the target subscription. + /// 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> ListByResourceGroupAsync(string subscriptionId, string resourceGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + + using var message = CreateListByResourceGroupRequest(subscriptionId, resourceGroupName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + SiteNetworkServiceListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = SiteNetworkServiceListResult.DeserializeSiteNetworkServiceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists all site network services. + /// The ID of the target subscription. + /// 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 ListByResourceGroup(string subscriptionId, string resourceGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + + using var message = CreateListByResourceGroupRequest(subscriptionId, resourceGroupName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + SiteNetworkServiceListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = SiteNetworkServiceListResult.DeserializeSiteNetworkServiceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + 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; + } + + /// Lists all sites in the network service in a subscription. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// 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: + { + SiteNetworkServiceListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = SiteNetworkServiceListResult.DeserializeSiteNetworkServiceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists all sites in the network service in a subscription. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// 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: + { + SiteNetworkServiceListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = SiteNetworkServiceListResult.DeserializeSiteNetworkServiceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByResourceGroupNextPageRequest(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; + } + + /// Lists all site network services. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The cancellation token to use. + /// , or is null. + /// or is an empty string, and was expected to be non-empty. + public async Task> ListByResourceGroupNextPageAsync(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 = CreateListByResourceGroupNextPageRequest(nextLink, subscriptionId, resourceGroupName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + SiteNetworkServiceListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = SiteNetworkServiceListResult.DeserializeSiteNetworkServiceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists all site network services. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The cancellation token to use. + /// , or is null. + /// or is an empty string, and was expected to be non-empty. + public Response ListByResourceGroupNextPage(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 = CreateListByResourceGroupNextPageRequest(nextLink, subscriptionId, resourceGroupName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + SiteNetworkServiceListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = SiteNetworkServiceListResult.DeserializeSiteNetworkServiceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/RestOperations/SitesRestOperations.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/RestOperations/SitesRestOperations.cs new file mode 100644 index 000000000000..4d431ea381cb --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/RestOperations/SitesRestOperations.cs @@ -0,0 +1,636 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.HybridNetwork.Models; + +namespace Azure.ResourceManager.HybridNetwork +{ + internal partial class SitesRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of SitesRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public SitesRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2023-09-01"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string siteName) + { + 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.HybridNetwork/sites/", false); + uri.AppendPath(siteName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Deletes the specified network site. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the network service site. + /// 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 siteName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(siteName, nameof(siteName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, siteName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Deletes the specified network site. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the network service site. + /// 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 siteName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(siteName, nameof(siteName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, siteName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string siteName) + { + 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.HybridNetwork/sites/", false); + uri.AppendPath(siteName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets information about the specified network site. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the network service site. + /// 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 siteName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(siteName, nameof(siteName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, siteName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + SiteData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = SiteData.DeserializeSiteData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((SiteData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets information about the specified network site. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the network service site. + /// 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 siteName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(siteName, nameof(siteName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, siteName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + SiteData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = SiteData.DeserializeSiteData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((SiteData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string siteName, SiteData 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.HybridNetwork/sites/", false); + uri.AppendPath(siteName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Creates or updates a network site. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the network service site. + /// Parameters supplied to the create or update network site operation. + /// 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 siteName, SiteData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(siteName, nameof(siteName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, siteName, 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); + } + } + + /// Creates or updates a network site. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the network service site. + /// Parameters supplied to the create or update network site operation. + /// 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 siteName, SiteData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(siteName, nameof(siteName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, siteName, data); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateUpdateTagsRequest(string subscriptionId, string resourceGroupName, string siteName, TagsObject tagsObject) + { + 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.HybridNetwork/sites/", false); + uri.AppendPath(siteName, 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(tagsObject); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Updates a site update tags. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the network service site. + /// Parameters supplied to update network site tags. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> UpdateTagsAsync(string subscriptionId, string resourceGroupName, string siteName, TagsObject tagsObject, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(siteName, nameof(siteName)); + Argument.AssertNotNull(tagsObject, nameof(tagsObject)); + + using var message = CreateUpdateTagsRequest(subscriptionId, resourceGroupName, siteName, tagsObject); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + SiteData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = SiteData.DeserializeSiteData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Updates a site update tags. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the network service site. + /// Parameters supplied to update network site tags. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response UpdateTags(string subscriptionId, string resourceGroupName, string siteName, TagsObject tagsObject, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(siteName, nameof(siteName)); + Argument.AssertNotNull(tagsObject, nameof(tagsObject)); + + using var message = CreateUpdateTagsRequest(subscriptionId, resourceGroupName, siteName, tagsObject); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + SiteData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = SiteData.DeserializeSiteData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + 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.HybridNetwork/sites", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists all sites in the network service in a subscription. + /// The ID of the target subscription. + /// 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: + { + SiteListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = SiteListResult.DeserializeSiteListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists all sites in the network service in a subscription. + /// The ID of the target subscription. + /// 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: + { + SiteListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = SiteListResult.DeserializeSiteListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByResourceGroupRequest(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.HybridNetwork/sites", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists all sites in the network service. + /// The ID of the target subscription. + /// 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> ListByResourceGroupAsync(string subscriptionId, string resourceGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + + using var message = CreateListByResourceGroupRequest(subscriptionId, resourceGroupName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + SiteListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = SiteListResult.DeserializeSiteListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists all sites in the network service. + /// The ID of the target subscription. + /// 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 ListByResourceGroup(string subscriptionId, string resourceGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + + using var message = CreateListByResourceGroupRequest(subscriptionId, resourceGroupName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + SiteListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = SiteListResult.DeserializeSiteListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + 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; + } + + /// Lists all sites in the network service in a subscription. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// 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: + { + SiteListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = SiteListResult.DeserializeSiteListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists all sites in the network service in a subscription. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// 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: + { + SiteListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = SiteListResult.DeserializeSiteListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByResourceGroupNextPageRequest(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; + } + + /// Lists all sites in the network service. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The cancellation token to use. + /// , or is null. + /// or is an empty string, and was expected to be non-empty. + public async Task> ListByResourceGroupNextPageAsync(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 = CreateListByResourceGroupNextPageRequest(nextLink, subscriptionId, resourceGroupName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + SiteListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = SiteListResult.DeserializeSiteListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists all sites in the network service. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The cancellation token to use. + /// , or is null. + /// or is an empty string, and was expected to be non-empty. + public Response ListByResourceGroupNextPage(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 = CreateListByResourceGroupNextPageRequest(nextLink, subscriptionId, resourceGroupName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + SiteListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = SiteListResult.DeserializeSiteListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/SiteCollection.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/SiteCollection.cs new file mode 100644 index 000000000000..6f7747026ede --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/SiteCollection.cs @@ -0,0 +1,416 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.HybridNetwork +{ + /// + /// 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 GetSites method from an instance of . + /// + public partial class SiteCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _siteClientDiagnostics; + private readonly SitesRestOperations _siteRestClient; + + /// Initializes a new instance of the class for mocking. + protected SiteCollection() + { + } + + /// 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 SiteCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _siteClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.HybridNetwork", SiteResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(SiteResource.ResourceType, out string siteApiVersion); + _siteRestClient = new SitesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, siteApiVersion); +#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)); + } + + /// + /// Creates or updates a network site. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/sites/{siteName} + /// + /// + /// Operation Id + /// Sites_CreateOrUpdate + /// + /// + /// + /// 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 network service site. + /// Parameters supplied to the create or update network site operation. + /// 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 siteName, SiteData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(siteName, nameof(siteName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _siteClientDiagnostics.CreateScope("SiteCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _siteRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, siteName, data, cancellationToken).ConfigureAwait(false); + var operation = new HybridNetworkArmOperation(new SiteOperationSource(Client), _siteClientDiagnostics, Pipeline, _siteRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, siteName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates or updates a network site. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/sites/{siteName} + /// + /// + /// Operation Id + /// Sites_CreateOrUpdate + /// + /// + /// + /// 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 network service site. + /// Parameters supplied to the create or update network site operation. + /// 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 siteName, SiteData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(siteName, nameof(siteName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _siteClientDiagnostics.CreateScope("SiteCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _siteRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, siteName, data, cancellationToken); + var operation = new HybridNetworkArmOperation(new SiteOperationSource(Client), _siteClientDiagnostics, Pipeline, _siteRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, siteName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets information about the specified network site. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/sites/{siteName} + /// + /// + /// Operation Id + /// Sites_Get + /// + /// + /// + /// The name of the network service site. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string siteName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(siteName, nameof(siteName)); + + using var scope = _siteClientDiagnostics.CreateScope("SiteCollection.Get"); + scope.Start(); + try + { + var response = await _siteRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, siteName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new SiteResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets information about the specified network site. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/sites/{siteName} + /// + /// + /// Operation Id + /// Sites_Get + /// + /// + /// + /// The name of the network service site. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string siteName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(siteName, nameof(siteName)); + + using var scope = _siteClientDiagnostics.CreateScope("SiteCollection.Get"); + scope.Start(); + try + { + var response = _siteRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, siteName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new SiteResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Lists all sites in the network service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/sites + /// + /// + /// Operation Id + /// Sites_ListByResourceGroup + /// + /// + /// + /// 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) => _siteRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _siteRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new SiteResource(Client, SiteData.DeserializeSiteData(e)), _siteClientDiagnostics, Pipeline, "SiteCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Lists all sites in the network service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/sites + /// + /// + /// Operation Id + /// Sites_ListByResourceGroup + /// + /// + /// + /// 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) => _siteRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _siteRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new SiteResource(Client, SiteData.DeserializeSiteData(e)), _siteClientDiagnostics, Pipeline, "SiteCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/sites/{siteName} + /// + /// + /// Operation Id + /// Sites_Get + /// + /// + /// + /// The name of the network service site. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string siteName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(siteName, nameof(siteName)); + + using var scope = _siteClientDiagnostics.CreateScope("SiteCollection.Exists"); + scope.Start(); + try + { + var response = await _siteRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, siteName, 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.HybridNetwork/sites/{siteName} + /// + /// + /// Operation Id + /// Sites_Get + /// + /// + /// + /// The name of the network service site. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string siteName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(siteName, nameof(siteName)); + + using var scope = _siteClientDiagnostics.CreateScope("SiteCollection.Exists"); + scope.Start(); + try + { + var response = _siteRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, siteName, 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.HybridNetwork/sites/{siteName} + /// + /// + /// Operation Id + /// Sites_Get + /// + /// + /// + /// The name of the network service site. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string siteName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(siteName, nameof(siteName)); + + using var scope = _siteClientDiagnostics.CreateScope("SiteCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _siteRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, siteName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SiteResource(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.HybridNetwork/sites/{siteName} + /// + /// + /// Operation Id + /// Sites_Get + /// + /// + /// + /// The name of the network service site. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string siteName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(siteName, nameof(siteName)); + + using var scope = _siteClientDiagnostics.CreateScope("SiteCollection.GetIfExists"); + scope.Start(); + try + { + var response = _siteRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, siteName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SiteResource(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/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/SiteData.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/SiteData.cs new file mode 100644 index 000000000000..4209cbd229fc --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/SiteData.cs @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.HybridNetwork.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.HybridNetwork +{ + /// + /// A class representing the Site data model. + /// Site resource. + /// + public partial class SiteData : TrackedResourceData + { + /// Initializes a new instance of SiteData. + /// The location. + public SiteData(AzureLocation location) : base(location) + { + } + + /// Initializes a new instance of SiteData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The tags. + /// The location. + /// Site properties. + internal SiteData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, SitePropertiesFormat properties) : base(id, name, resourceType, systemData, tags, location) + { + Properties = properties; + } + + /// Site properties. + public SitePropertiesFormat Properties { get; set; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/SiteNetworkServiceCollection.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/SiteNetworkServiceCollection.cs new file mode 100644 index 000000000000..849638fa9ee4 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/SiteNetworkServiceCollection.cs @@ -0,0 +1,416 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.HybridNetwork +{ + /// + /// 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 GetSiteNetworkServices method from an instance of . + /// + public partial class SiteNetworkServiceCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _siteNetworkServiceClientDiagnostics; + private readonly SiteNetworkServicesRestOperations _siteNetworkServiceRestClient; + + /// Initializes a new instance of the class for mocking. + protected SiteNetworkServiceCollection() + { + } + + /// 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 SiteNetworkServiceCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _siteNetworkServiceClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.HybridNetwork", SiteNetworkServiceResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(SiteNetworkServiceResource.ResourceType, out string siteNetworkServiceApiVersion); + _siteNetworkServiceRestClient = new SiteNetworkServicesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, siteNetworkServiceApiVersion); +#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)); + } + + /// + /// Creates or updates a network site. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/siteNetworkServices/{siteNetworkServiceName} + /// + /// + /// Operation Id + /// SiteNetworkServices_CreateOrUpdate + /// + /// + /// + /// 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 site network service. + /// Parameters supplied to the create or update site network service operation. + /// 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 siteNetworkServiceName, SiteNetworkServiceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(siteNetworkServiceName, nameof(siteNetworkServiceName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _siteNetworkServiceClientDiagnostics.CreateScope("SiteNetworkServiceCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _siteNetworkServiceRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, siteNetworkServiceName, data, cancellationToken).ConfigureAwait(false); + var operation = new HybridNetworkArmOperation(new SiteNetworkServiceOperationSource(Client), _siteNetworkServiceClientDiagnostics, Pipeline, _siteNetworkServiceRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, siteNetworkServiceName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates or updates a network site. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/siteNetworkServices/{siteNetworkServiceName} + /// + /// + /// Operation Id + /// SiteNetworkServices_CreateOrUpdate + /// + /// + /// + /// 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 site network service. + /// Parameters supplied to the create or update site network service operation. + /// 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 siteNetworkServiceName, SiteNetworkServiceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(siteNetworkServiceName, nameof(siteNetworkServiceName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _siteNetworkServiceClientDiagnostics.CreateScope("SiteNetworkServiceCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _siteNetworkServiceRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, siteNetworkServiceName, data, cancellationToken); + var operation = new HybridNetworkArmOperation(new SiteNetworkServiceOperationSource(Client), _siteNetworkServiceClientDiagnostics, Pipeline, _siteNetworkServiceRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, siteNetworkServiceName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets information about the specified site network service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/siteNetworkServices/{siteNetworkServiceName} + /// + /// + /// Operation Id + /// SiteNetworkServices_Get + /// + /// + /// + /// The name of the site network service. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string siteNetworkServiceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(siteNetworkServiceName, nameof(siteNetworkServiceName)); + + using var scope = _siteNetworkServiceClientDiagnostics.CreateScope("SiteNetworkServiceCollection.Get"); + scope.Start(); + try + { + var response = await _siteNetworkServiceRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, siteNetworkServiceName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new SiteNetworkServiceResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets information about the specified site network service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/siteNetworkServices/{siteNetworkServiceName} + /// + /// + /// Operation Id + /// SiteNetworkServices_Get + /// + /// + /// + /// The name of the site network service. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string siteNetworkServiceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(siteNetworkServiceName, nameof(siteNetworkServiceName)); + + using var scope = _siteNetworkServiceClientDiagnostics.CreateScope("SiteNetworkServiceCollection.Get"); + scope.Start(); + try + { + var response = _siteNetworkServiceRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, siteNetworkServiceName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new SiteNetworkServiceResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Lists all site network services. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/siteNetworkServices + /// + /// + /// Operation Id + /// SiteNetworkServices_ListByResourceGroup + /// + /// + /// + /// 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) => _siteNetworkServiceRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _siteNetworkServiceRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new SiteNetworkServiceResource(Client, SiteNetworkServiceData.DeserializeSiteNetworkServiceData(e)), _siteNetworkServiceClientDiagnostics, Pipeline, "SiteNetworkServiceCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Lists all site network services. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/siteNetworkServices + /// + /// + /// Operation Id + /// SiteNetworkServices_ListByResourceGroup + /// + /// + /// + /// 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) => _siteNetworkServiceRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _siteNetworkServiceRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new SiteNetworkServiceResource(Client, SiteNetworkServiceData.DeserializeSiteNetworkServiceData(e)), _siteNetworkServiceClientDiagnostics, Pipeline, "SiteNetworkServiceCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/siteNetworkServices/{siteNetworkServiceName} + /// + /// + /// Operation Id + /// SiteNetworkServices_Get + /// + /// + /// + /// The name of the site network service. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string siteNetworkServiceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(siteNetworkServiceName, nameof(siteNetworkServiceName)); + + using var scope = _siteNetworkServiceClientDiagnostics.CreateScope("SiteNetworkServiceCollection.Exists"); + scope.Start(); + try + { + var response = await _siteNetworkServiceRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, siteNetworkServiceName, 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.HybridNetwork/siteNetworkServices/{siteNetworkServiceName} + /// + /// + /// Operation Id + /// SiteNetworkServices_Get + /// + /// + /// + /// The name of the site network service. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string siteNetworkServiceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(siteNetworkServiceName, nameof(siteNetworkServiceName)); + + using var scope = _siteNetworkServiceClientDiagnostics.CreateScope("SiteNetworkServiceCollection.Exists"); + scope.Start(); + try + { + var response = _siteNetworkServiceRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, siteNetworkServiceName, 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.HybridNetwork/siteNetworkServices/{siteNetworkServiceName} + /// + /// + /// Operation Id + /// SiteNetworkServices_Get + /// + /// + /// + /// The name of the site network service. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string siteNetworkServiceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(siteNetworkServiceName, nameof(siteNetworkServiceName)); + + using var scope = _siteNetworkServiceClientDiagnostics.CreateScope("SiteNetworkServiceCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _siteNetworkServiceRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, siteNetworkServiceName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SiteNetworkServiceResource(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.HybridNetwork/siteNetworkServices/{siteNetworkServiceName} + /// + /// + /// Operation Id + /// SiteNetworkServices_Get + /// + /// + /// + /// The name of the site network service. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string siteNetworkServiceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(siteNetworkServiceName, nameof(siteNetworkServiceName)); + + using var scope = _siteNetworkServiceClientDiagnostics.CreateScope("SiteNetworkServiceCollection.GetIfExists"); + scope.Start(); + try + { + var response = _siteNetworkServiceRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, siteNetworkServiceName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SiteNetworkServiceResource(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/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/SiteNetworkServiceData.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/SiteNetworkServiceData.cs new file mode 100644 index 000000000000..52b7473740a2 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/SiteNetworkServiceData.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.HybridNetwork.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.HybridNetwork +{ + /// + /// A class representing the SiteNetworkService data model. + /// Site network service resource. + /// + public partial class SiteNetworkServiceData : TrackedResourceData + { + /// Initializes a new instance of SiteNetworkServiceData. + /// The location. + public SiteNetworkServiceData(AzureLocation location) : base(location) + { + } + + /// Initializes a new instance of SiteNetworkServiceData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The tags. + /// The location. + /// Site network service properties. + /// The managed identity of the Site network service, if configured. + /// Sku of the site network service. + internal SiteNetworkServiceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, SiteNetworkServicePropertiesFormat properties, ManagedServiceIdentity identity, HybridNetworkSku sku) : base(id, name, resourceType, systemData, tags, location) + { + Properties = properties; + Identity = identity; + Sku = sku; + } + + /// Site network service properties. + public SiteNetworkServicePropertiesFormat Properties { get; set; } + /// The managed identity of the Site network service, if configured. + public ManagedServiceIdentity Identity { get; set; } + /// Sku of the site network service. + public HybridNetworkSku Sku { get; set; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/SiteNetworkServiceResource.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/SiteNetworkServiceResource.cs new file mode 100644 index 000000000000..c05381ad2669 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/SiteNetworkServiceResource.cs @@ -0,0 +1,602 @@ +// 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; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.HybridNetwork.Models; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.HybridNetwork +{ + /// + /// A Class representing a SiteNetworkService 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 GetSiteNetworkServiceResource method. + /// Otherwise you can get one from its parent resource using the GetSiteNetworkService method. + /// + public partial class SiteNetworkServiceResource : ArmResource + { + /// Generate the resource identifier of a instance. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string siteNetworkServiceName) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/siteNetworkServices/{siteNetworkServiceName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _siteNetworkServiceClientDiagnostics; + private readonly SiteNetworkServicesRestOperations _siteNetworkServiceRestClient; + private readonly SiteNetworkServiceData _data; + + /// Initializes a new instance of the class for mocking. + protected SiteNetworkServiceResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal SiteNetworkServiceResource(ArmClient client, SiteNetworkServiceData 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 SiteNetworkServiceResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _siteNetworkServiceClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.HybridNetwork", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string siteNetworkServiceApiVersion); + _siteNetworkServiceRestClient = new SiteNetworkServicesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, siteNetworkServiceApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.HybridNetwork/siteNetworkServices"; + + /// 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 SiteNetworkServiceData 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 information about the specified site network service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/siteNetworkServices/{siteNetworkServiceName} + /// + /// + /// Operation Id + /// SiteNetworkServices_Get + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _siteNetworkServiceClientDiagnostics.CreateScope("SiteNetworkServiceResource.Get"); + scope.Start(); + try + { + var response = await _siteNetworkServiceRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new SiteNetworkServiceResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets information about the specified site network service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/siteNetworkServices/{siteNetworkServiceName} + /// + /// + /// Operation Id + /// SiteNetworkServices_Get + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _siteNetworkServiceClientDiagnostics.CreateScope("SiteNetworkServiceResource.Get"); + scope.Start(); + try + { + var response = _siteNetworkServiceRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new SiteNetworkServiceResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes the specified site network service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/siteNetworkServices/{siteNetworkServiceName} + /// + /// + /// Operation Id + /// SiteNetworkServices_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _siteNetworkServiceClientDiagnostics.CreateScope("SiteNetworkServiceResource.Delete"); + scope.Start(); + try + { + var response = await _siteNetworkServiceRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new HybridNetworkArmOperation(_siteNetworkServiceClientDiagnostics, Pipeline, _siteNetworkServiceRestClient.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; + } + } + + /// + /// Deletes the specified site network service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/siteNetworkServices/{siteNetworkServiceName} + /// + /// + /// Operation Id + /// SiteNetworkServices_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _siteNetworkServiceClientDiagnostics.CreateScope("SiteNetworkServiceResource.Delete"); + scope.Start(); + try + { + var response = _siteNetworkServiceRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + var operation = new HybridNetworkArmOperation(_siteNetworkServiceClientDiagnostics, Pipeline, _siteNetworkServiceRestClient.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; + } + } + + /// + /// Updates a site update tags. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/siteNetworkServices/{siteNetworkServiceName} + /// + /// + /// Operation Id + /// SiteNetworkServices_UpdateTags + /// + /// + /// + /// Parameters supplied to update network site tags. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(TagsObject tagsObject, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tagsObject, nameof(tagsObject)); + + using var scope = _siteNetworkServiceClientDiagnostics.CreateScope("SiteNetworkServiceResource.Update"); + scope.Start(); + try + { + var response = await _siteNetworkServiceRestClient.UpdateTagsAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, tagsObject, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new SiteNetworkServiceResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Updates a site update tags. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/siteNetworkServices/{siteNetworkServiceName} + /// + /// + /// Operation Id + /// SiteNetworkServices_UpdateTags + /// + /// + /// + /// Parameters supplied to update network site tags. + /// The cancellation token to use. + /// is null. + public virtual Response Update(TagsObject tagsObject, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tagsObject, nameof(tagsObject)); + + using var scope = _siteNetworkServiceClientDiagnostics.CreateScope("SiteNetworkServiceResource.Update"); + scope.Start(); + try + { + var response = _siteNetworkServiceRestClient.UpdateTags(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, tagsObject, cancellationToken); + return Response.FromValue(new SiteNetworkServiceResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Add a tag to the current resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/siteNetworkServices/{siteNetworkServiceName} + /// + /// + /// Operation Id + /// SiteNetworkServices_Get + /// + /// + /// + /// 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 = _siteNetworkServiceClientDiagnostics.CreateScope("SiteNetworkServiceResource.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 _siteNetworkServiceRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new SiteNetworkServiceResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new TagsObject(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags[key] = value; + var result = await UpdateAsync(patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return result; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Add a tag to the current resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/siteNetworkServices/{siteNetworkServiceName} + /// + /// + /// Operation Id + /// SiteNetworkServices_Get + /// + /// + /// + /// 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 = _siteNetworkServiceClientDiagnostics.CreateScope("SiteNetworkServiceResource.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 = _siteNetworkServiceRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + return Response.FromValue(new SiteNetworkServiceResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new TagsObject(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags[key] = value; + var result = Update(patch, cancellationToken: cancellationToken); + return result; + } + } + 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.HybridNetwork/siteNetworkServices/{siteNetworkServiceName} + /// + /// + /// Operation Id + /// SiteNetworkServices_Get + /// + /// + /// + /// 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 = _siteNetworkServiceClientDiagnostics.CreateScope("SiteNetworkServiceResource.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 _siteNetworkServiceRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new SiteNetworkServiceResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new TagsObject(); + patch.Tags.ReplaceWith(tags); + var result = await UpdateAsync(patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return result; + } + } + 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.HybridNetwork/siteNetworkServices/{siteNetworkServiceName} + /// + /// + /// Operation Id + /// SiteNetworkServices_Get + /// + /// + /// + /// 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 = _siteNetworkServiceClientDiagnostics.CreateScope("SiteNetworkServiceResource.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 = _siteNetworkServiceRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + return Response.FromValue(new SiteNetworkServiceResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new TagsObject(); + patch.Tags.ReplaceWith(tags); + var result = Update(patch, cancellationToken: cancellationToken); + return result; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Removes a tag by key from the resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/siteNetworkServices/{siteNetworkServiceName} + /// + /// + /// Operation Id + /// SiteNetworkServices_Get + /// + /// + /// + /// 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 = _siteNetworkServiceClientDiagnostics.CreateScope("SiteNetworkServiceResource.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 _siteNetworkServiceRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new SiteNetworkServiceResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new TagsObject(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags.Remove(key); + var result = await UpdateAsync(patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return result; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Removes a tag by key from the resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/siteNetworkServices/{siteNetworkServiceName} + /// + /// + /// Operation Id + /// SiteNetworkServices_Get + /// + /// + /// + /// 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 = _siteNetworkServiceClientDiagnostics.CreateScope("SiteNetworkServiceResource.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 = _siteNetworkServiceRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + return Response.FromValue(new SiteNetworkServiceResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new TagsObject(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags.Remove(key); + var result = Update(patch, cancellationToken: cancellationToken); + return result; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/SiteResource.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/SiteResource.cs new file mode 100644 index 000000000000..5f5044a0ad67 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/SiteResource.cs @@ -0,0 +1,602 @@ +// 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; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.HybridNetwork.Models; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.HybridNetwork +{ + /// + /// A Class representing a Site 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 GetSiteResource method. + /// Otherwise you can get one from its parent resource using the GetSite method. + /// + public partial class SiteResource : ArmResource + { + /// Generate the resource identifier of a instance. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string siteName) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/sites/{siteName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _siteClientDiagnostics; + private readonly SitesRestOperations _siteRestClient; + private readonly SiteData _data; + + /// Initializes a new instance of the class for mocking. + protected SiteResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal SiteResource(ArmClient client, SiteData 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 SiteResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _siteClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.HybridNetwork", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string siteApiVersion); + _siteRestClient = new SitesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, siteApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.HybridNetwork/sites"; + + /// 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 SiteData 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 information about the specified network site. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/sites/{siteName} + /// + /// + /// Operation Id + /// Sites_Get + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _siteClientDiagnostics.CreateScope("SiteResource.Get"); + scope.Start(); + try + { + var response = await _siteRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new SiteResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets information about the specified network site. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/sites/{siteName} + /// + /// + /// Operation Id + /// Sites_Get + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _siteClientDiagnostics.CreateScope("SiteResource.Get"); + scope.Start(); + try + { + var response = _siteRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new SiteResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes the specified network site. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/sites/{siteName} + /// + /// + /// Operation Id + /// Sites_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _siteClientDiagnostics.CreateScope("SiteResource.Delete"); + scope.Start(); + try + { + var response = await _siteRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new HybridNetworkArmOperation(_siteClientDiagnostics, Pipeline, _siteRestClient.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; + } + } + + /// + /// Deletes the specified network site. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/sites/{siteName} + /// + /// + /// Operation Id + /// Sites_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _siteClientDiagnostics.CreateScope("SiteResource.Delete"); + scope.Start(); + try + { + var response = _siteRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + var operation = new HybridNetworkArmOperation(_siteClientDiagnostics, Pipeline, _siteRestClient.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; + } + } + + /// + /// Updates a site update tags. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/sites/{siteName} + /// + /// + /// Operation Id + /// Sites_UpdateTags + /// + /// + /// + /// Parameters supplied to update network site tags. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(TagsObject tagsObject, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tagsObject, nameof(tagsObject)); + + using var scope = _siteClientDiagnostics.CreateScope("SiteResource.Update"); + scope.Start(); + try + { + var response = await _siteRestClient.UpdateTagsAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, tagsObject, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new SiteResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Updates a site update tags. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/sites/{siteName} + /// + /// + /// Operation Id + /// Sites_UpdateTags + /// + /// + /// + /// Parameters supplied to update network site tags. + /// The cancellation token to use. + /// is null. + public virtual Response Update(TagsObject tagsObject, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tagsObject, nameof(tagsObject)); + + using var scope = _siteClientDiagnostics.CreateScope("SiteResource.Update"); + scope.Start(); + try + { + var response = _siteRestClient.UpdateTags(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, tagsObject, cancellationToken); + return Response.FromValue(new SiteResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Add a tag to the current resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/sites/{siteName} + /// + /// + /// Operation Id + /// Sites_Get + /// + /// + /// + /// 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 = _siteClientDiagnostics.CreateScope("SiteResource.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 _siteRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new SiteResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new TagsObject(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags[key] = value; + var result = await UpdateAsync(patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return result; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Add a tag to the current resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/sites/{siteName} + /// + /// + /// Operation Id + /// Sites_Get + /// + /// + /// + /// 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 = _siteClientDiagnostics.CreateScope("SiteResource.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 = _siteRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + return Response.FromValue(new SiteResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new TagsObject(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags[key] = value; + var result = Update(patch, cancellationToken: cancellationToken); + return result; + } + } + 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.HybridNetwork/sites/{siteName} + /// + /// + /// Operation Id + /// Sites_Get + /// + /// + /// + /// 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 = _siteClientDiagnostics.CreateScope("SiteResource.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 _siteRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new SiteResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new TagsObject(); + patch.Tags.ReplaceWith(tags); + var result = await UpdateAsync(patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return result; + } + } + 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.HybridNetwork/sites/{siteName} + /// + /// + /// Operation Id + /// Sites_Get + /// + /// + /// + /// 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 = _siteClientDiagnostics.CreateScope("SiteResource.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 = _siteRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + return Response.FromValue(new SiteResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new TagsObject(); + patch.Tags.ReplaceWith(tags); + var result = Update(patch, cancellationToken: cancellationToken); + return result; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Removes a tag by key from the resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/sites/{siteName} + /// + /// + /// Operation Id + /// Sites_Get + /// + /// + /// + /// 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 = _siteClientDiagnostics.CreateScope("SiteResource.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 _siteRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new SiteResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new TagsObject(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags.Remove(key); + var result = await UpdateAsync(patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return result; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Removes a tag by key from the resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/sites/{siteName} + /// + /// + /// Operation Id + /// Sites_Get + /// + /// + /// + /// 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 = _siteClientDiagnostics.CreateScope("SiteResource.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 = _siteRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + return Response.FromValue(new SiteResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new TagsObject(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags.Remove(key); + var result = Update(patch, cancellationToken: cancellationToken); + return result; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Properties/AssemblyInfo.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Properties/AssemblyInfo.cs new file mode 100644 index 000000000000..4a2ad91cf3cc --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Properties/AssemblyInfo.cs @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System.Runtime.CompilerServices; + +[assembly: Azure.Core.AzureResourceProviderNamespace("HybridNetwork")] + +[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2, PublicKey=0024000004800000940000000602000000240000525341310004000001000100c547cac37abd99c8db225ef2f6c8a3602f3b3606cc9891605d02baa56104f4cfc0734aa39b93bf7852f7d9266654753cc297e7d2edfe0bac1cdcf9f717241550e0a7b191195b7667bb4f64bcb8e2121380fd1d9d46ad2d92d2d15605093924cceaf74c4861eff62abf69b9291ed0a340e113be11e6a7d3113e92484cf7045cc7")] +[assembly: InternalsVisibleTo("Azure.ResourceManager.HybridNetwork.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100d15ddcb29688295338af4b7686603fe614abd555e09efba8fb88ee09e1f7b1ccaeed2e8f823fa9eef3fdd60217fc012ea67d2479751a0b8c087a4185541b851bd8b16f8d91b840e51b1cb0ba6fe647997e57429265e85ef62d565db50a69ae1647d54d7bd855e4db3d8a91510e5bcbd0edfbbecaa20a7bd9ae74593daa7b11b4")] diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/autorest.md b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/autorest.md new file mode 100644 index 000000000000..f1af0f3e1c32 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/autorest.md @@ -0,0 +1,101 @@ +# Generated code configuration + +Run `dotnet build /t:GenerateCode` to generate code. + +``` yaml +azure-arm: true +csharp: true +library-name: HybridNetwork +namespace: Azure.ResourceManager.HybridNetwork +require: https://github.com/Azure/azure-rest-api-specs/blob/eccca594dd50892ada8220fe7b1587c12cc5c871/specification/hybridnetwork/resource-manager/readme.md +output-folder: $(this-folder)/Generated +clear-output-folder: true +sample-gen: + output-folder: $(this-folder)/../samples/Generated + clear-output-folder: true +skip-csproj: true +modelerfour: + flatten-payloads: false + +#mgmt-debug: +# show-serialized-names: true + + + +format-by-name-rules: + 'tenantId': 'uuid' + 'ETag': 'etag' + 'location': 'azure-location' + '*Uri': 'Uri' + '*Uris': 'Uri' + +acronym-mapping: + CPU: Cpu + CPUs: Cpus + Os: OS + Ip: IP + Ips: IPs|ips + ID: Id + IDs: Ids + VM: Vm + VMs: Vms + Vmos: VmOS + VMScaleSet: VmScaleSet + DNS: Dns + VPN: Vpn + NAT: Nat + WAN: Wan + Ipv4: IPv4|ipv4 + Ipv6: IPv6|ipv6 + Ipsec: IPsec|ipsec + SSO: Sso + URI: Uri + Etag: ETag|etag + +rename-mapping: + HelmInstallOptions: HelmInstallConfig + HelmUpgradeOptions: HelmUpgradeConfig + HelmMappingRuleProfileOptions: HelmMappingRuleProfileConfig + Resources: ComponentKubernetesResources + Status: ComponentStatus + DaemonSet: KubernetesDaemonSet + DaemonSet.desired: DesiredNumberOfPods + DaemonSet.ready: ReadyNumberOfPods + DaemonSet.current: CurrentNumberOfPods + DaemonSet.upToDate: UpToDateNumberOfPods + DaemonSet.available: AvailableNumberOfPods + Deployment: KubernetesDeployment + Deployment.desired: DesiredNumberOfPods + Deployment.ready: ReadyNumberOfPods + Deployment.current: CurrentNumberOfPods + Deployment.upToDate: UpToDateNumberOfPods + Deployment.available: AvailableNumberOfPods + Pod: KubernetesPod + Pod.desired: DesiredNumberOfContainers + Pod.ready: ReadyNumberOfContainers + ReplicaSet: KubernetesReplicaSet + ReplicaSet.desired: DesiredNumberOfPods + ReplicaSet.ready: ReadyNumberOfPods + ReplicaSet.current: CurrentNumberOfPods + StatefulSet: KubernetesStatefulSet + StatefulSet.desired: DesiredNumberOfPods + StatefulSet.ready: ReadyNumberOfPods + +directive: +- from: publisher.json + where: $.definitions.ArtifactStorePropertiesFormat.properties.storageResourceId + transform: $["x-ms-format"] = "arm-id"; +- from: common.json + where: $.definitions.AzureStorageAccountCredential.properties.storageAccountId + transform: $["x-ms-format"] = "arm-id"; +- from: common.json + where: $.definitions.SecretDeploymentResourceReference.properties.id + transform: $["x-ms-format"] = "arm-id"; +- from: common.json + where: $.definitions.OpenDeploymentResourceReference.properties.id + transform: $["x-ms-format"] = "arm-id"; +- from: networkFunction.json + where: $.definitions.NetworkFunctionPropertiesFormat.properties.nfviId + transform: $["x-ms-format"] = "arm-id"; + +``` diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/tests/Azure.ResourceManager.HybridNetwork.Tests.csproj b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/tests/Azure.ResourceManager.HybridNetwork.Tests.csproj new file mode 100644 index 000000000000..4073905dd14b --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/tests/Azure.ResourceManager.HybridNetwork.Tests.csproj @@ -0,0 +1,17 @@ + + + $(RequiredTargetFrameworks) + + + + + + + + + + + Always + + + diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/tests/HybridNetworkManagementTestBase.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/tests/HybridNetworkManagementTestBase.cs new file mode 100644 index 000000000000..6a8cccd98392 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/tests/HybridNetworkManagementTestBase.cs @@ -0,0 +1,391 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using Azure.Core; +using Azure.Core.TestFramework; +using Azure.ResourceManager.HybridNetwork.Models; +using Azure.ResourceManager.Resources; +using Azure.ResourceManager.Models; +using Azure.ResourceManager.TestFramework; +using NUnit.Framework; +using Newtonsoft.Json.Linq; +using System.Diagnostics; +using System.Threading.Tasks; +using System.IO; + +namespace Azure.ResourceManager.HybridNetwork.Tests +{ + public class HybridNetworkManagementTestBase : ManagementRecordedTestBase + { + protected ArmClient Client { get; set; } + protected SubscriptionResource DefaultSubscription { get; private set; } + private readonly string TestAssetPath = Path.Combine(TestContext.CurrentContext.TestDirectory, "Scenario", "TestAssets"); + protected readonly string VnetArmTemplateArtifactName = "vnet-arm-template"; + protected readonly string VnetArmTemplateFileName = "VnetArmTemplate.json"; + protected readonly string VnetArmTemplateMappingFileName = "VnetArmTemplateMappings.json"; + protected readonly string NfArmTemplateArtifactName = "nf-arm-template"; + protected readonly string NfArmTemplateFileName = "NfArmTemplate.json"; + protected readonly string NfArmTemplateMappingFileName = "NfArmTemplateMappings.json"; + protected readonly string DeployParametersFileName = "DeployParameters.json"; + protected readonly string DeployValuesFileName = "DeploymentValues.json"; + protected readonly string NfviName = "exampleNFVI"; + protected readonly string CGSchemaFileName = "CGSchema.json"; + + protected HybridNetworkManagementTestBase(bool isAsync, RecordedTestMode mode) + : base(isAsync, mode) + { + JsonPathSanitizers.Add("$..acrToken"); + } + + protected HybridNetworkManagementTestBase(bool isAsync) + : base(isAsync) + { + JsonPathSanitizers.Add("$..acrToken"); + } + + protected void UploadArmTemplate( + string fileName, + string artifactName, + string artifactVersion, + AzureContainerRegistryScopedTokenCredential creds) + { + string templateFilePath = Path.Combine(TestAssetPath, fileName); + string acrName = creds.AcrServerUri.ToString().Replace("https://", "").TrimEnd('/'); + + if (File.Exists(templateFilePath)) + { + // Create a process to run the oras commands + Process process = new Process(); + process.StartInfo.FileName = "oras"; + + // Run login command + process.StartInfo.Arguments = $"login {acrName} --username {creds.Username} --password {creds.AcrToken}"; + process.Start(); + process.WaitForExit(); + + // Run push command + process.StartInfo.Arguments = $"push {acrName}/{artifactName}:{artifactVersion} {templateFilePath}:application/vnd.microsoft.azure.resource+json --disable-path-validation"; + process.Start(); + process.WaitForExit(); + } + else + { + throw new FileNotFoundException(); + } + } + + protected JObject ReadJsonFile(string filePath) + { + var json = File.ReadAllText(Path.Combine(TestAssetPath, filePath)); + return JObject.Parse(json); + } + + protected async Task CreatePublisherResource( + ResourceGroupResource resourceGroup, + string publisherName, + AzureLocation location) + { + var publisherData = new PublisherData(location) + { + Properties = new PublisherPropertiesFormat() + { + Scope = PublisherScope.Private + } + }; + var lro = await resourceGroup + .GetPublishers() + .CreateOrUpdateAsync(WaitUntil.Completed, publisherName, publisherData); + + return lro.Value; + } + + protected async Task CreateConfigGroupSchemaResource( + PublisherResource publisher, + string cgSchemaName, + AzureLocation location) + { + var cgSchemaData = new ConfigurationGroupSchemaData(location) + { + Properties = new ConfigurationGroupSchemaPropertiesFormat() + { + SchemaDefinition = ReadJsonFile(CGSchemaFileName).ToString(Newtonsoft.Json.Formatting.None), + } + }; + var lro = await publisher + .GetConfigurationGroupSchemas() + .CreateOrUpdateAsync(WaitUntil.Completed, cgSchemaName, cgSchemaData); + + return lro.Value; + } + + protected async Task CreateArtifactStoreResource( + PublisherResource publisher, + string artifactStoreName, + AzureLocation location) + { + var artifactStoreData = new ArtifactStoreData(location) + { + Properties = new ArtifactStorePropertiesFormat() + { + StoreType = ArtifactStoreType.AzureContainerRegistry, + ReplicationStrategy = ArtifactReplicationStrategy.SingleReplication, + } + }; + var lro = await publisher + .GetArtifactStores() + .CreateOrUpdateAsync(WaitUntil.Completed, artifactStoreName, artifactStoreData); + + return lro.Value; + } + + protected async Task CreateNFDGResource( + PublisherResource publisher, + string nfdgName, + AzureLocation location) + { + var nfdgData = new NetworkFunctionDefinitionGroupData(location) + { + Properties = new NetworkFunctionDefinitionGroupPropertiesFormat() + { + Description = "NFD for .NET SDK UTs." + } + }; + var lro = await publisher + .GetNetworkFunctionDefinitionGroups() + .CreateOrUpdateAsync(WaitUntil.Completed, nfdgName, nfdgData); + + return lro.Value; + } + + protected async Task CreateNSDGResource( + PublisherResource publisher, + string nsdgName, + AzureLocation location) + { + var nsdgData = new NetworkServiceDesignGroupData(location) + { + Properties = new NetworkServiceDesignGroupPropertiesFormat() + { + Description = "NSD for .NET SDK UTs." + } + }; + var lro = await publisher + .GetNetworkServiceDesignGroups() + .CreateOrUpdateAsync(WaitUntil.Completed, nsdgName, nsdgData); + + return lro.Value; + } + + protected async Task CreateArtifactManifestResource( + ArtifactStoreResource artifactStore, + string artifactManifestName, + AzureLocation location) + { + var vnetArtifact = new ManifestArtifactFormat() + { + ArtifactName = VnetArmTemplateArtifactName, + ArtifactType = ArtifactType.OCIArtifact, + ArtifactVersion = "1.0.0", + }; + var nfArtifact = new ManifestArtifactFormat() + { + ArtifactName = NfArmTemplateArtifactName, + ArtifactType = ArtifactType.OCIArtifact, + ArtifactVersion = "1.0.0", + }; + var artifactManifestData = new ArtifactManifestData(location) + { + Properties = new ArtifactManifestPropertiesFormat(), + }; + + artifactManifestData.Properties.Artifacts.Add(vnetArtifact); + artifactManifestData.Properties.Artifacts.Add(nfArtifact); + var lro = await artifactStore + .GetArtifactManifests() + .CreateOrUpdateAsync(WaitUntil.Completed, artifactManifestName, artifactManifestData); + + return lro.Value; + } + + protected async Task CreateNFDVResource( + NetworkFunctionDefinitionGroupResource nfdg, + ArtifactStoreResource artifactStore, + string nfdvName, + AzureLocation location) + { + var vnetArmApp = new AzureCoreNetworkFunctionArmTemplateApplication() + { + Name = "vnetArmApp", + DeployParametersMappingRuleProfile = new AzureCoreArmTemplateDeployMappingRuleProfile() + { + ApplicationEnablement = ApplicationEnablement.Unknown, + TemplateParameters = ReadJsonFile(VnetArmTemplateMappingFileName).ToString(Newtonsoft.Json.Formatting.None) + }, + ArtifactProfile = new AzureCoreArmTemplateArtifactProfile() + { + ArtifactStoreId = artifactStore.Id, + TemplateArtifactProfile = new ArmTemplateArtifactProfile() + { + TemplateName = VnetArmTemplateArtifactName, + TemplateVersion = "1.0.0", + } + } + }; + + AzureCoreNetworkFunctionTemplate nfTemplate = new AzureCoreNetworkFunctionTemplate() + { + NfviType = VirtualNetworkFunctionNfviType.AzureCore, + }; + + nfTemplate.NetworkFunctionApplications.Add(vnetArmApp); + + VirtualNetworkFunctionDefinitionVersion vnfProps = new VirtualNetworkFunctionDefinitionVersion() + { + NetworkFunctionType = NetworkFunctionType.VirtualNetworkFunction, + NetworkFunctionTemplate = nfTemplate, + DeployParameters = ReadJsonFile(DeployParametersFileName).ToString(Newtonsoft.Json.Formatting.None) + }; + + var nfdvData = new NetworkFunctionDefinitionVersionData(location) + { + Properties = vnfProps + }; + + var lro = await nfdg + .GetNetworkFunctionDefinitionVersions() + .CreateOrUpdateAsync(WaitUntil.Completed, nfdvName, nfdvData); + + return lro.Value; + } + + protected async Task CreateNSDVResource( + NetworkServiceDesignGroupResource nsdg, + ConfigurationGroupSchemaResource cgs, + ArtifactStoreResource artifactStore, + string nsdvName, + AzureLocation location) + { + var nsdvData = new NetworkServiceDesignVersionData(location) + { + Properties = new NetworkServiceDesignVersionPropertiesFormat() + { + Description = "An SNS that defploys an NF that deploys a VNET." + } + }; + + nsdvData.Properties.NfvisFromSite.Add("nfvi1", new NfviDetails() + { + Name = NfviName, + NfviDetailsType = "AzureCore" + }); + + nsdvData.Properties.ConfigurationGroupSchemaReferences.Add("vnet_ConfigGroupSchema", new Resources.Models.WritableSubResource() { Id = cgs.Id }); + + var vnetResourceElementTemplate = new NetworkFunctionDefinitionResourceElementTemplateDetails() + { + Name = "VnetRET", + DependsOnProfile = new DependsOnProfile(), + Configuration = new ArmResourceDefinitionResourceElementTemplate() + { + ArtifactProfile = new NSDArtifactProfile() + { + ArtifactName = NfArmTemplateArtifactName, + ArtifactVersion = "1.0.0", + ArtifactStoreReferenceId = artifactStore.Id, + }, + ParameterValues = ReadJsonFile(NfArmTemplateMappingFileName).ToString(Newtonsoft.Json.Formatting.None), + TemplateType = TemplateType.ArmTemplate + } + }; + + nsdvData.Properties.ResourceElementTemplates.Add(vnetResourceElementTemplate); + + var lro = await nsdg + .GetNetworkServiceDesignVersions() + .CreateOrUpdateAsync(WaitUntil.Completed, nsdvName, nsdvData); + + return lro.Value; + } + + protected async Task CreateSiteResource( + ResourceGroupResource resourceGroup, + string siteName, + AzureLocation location) + { + var nfvi = new AzureCoreNfviDetails() { Name = NfviName, Location = location }; + + var siteData = new SiteData(location) + { + Properties = new SitePropertiesFormat() + }; + + siteData.Properties.Nfvis.Add(nfvi); + + var lro = await resourceGroup + .GetSites() + .CreateOrUpdateAsync(WaitUntil.Completed, siteName, siteData); + + return lro.Value; + } + + protected async Task CreateCGVResource( + ResourceGroupResource resourceGroup, + ConfigurationGroupSchemaResource cgs, + string cgvName, + ResourceIdentifier nfdvId, + AzureLocation location) + { + var deploymentValues = ReadJsonFile(DeployValuesFileName); + deploymentValues["nfdvId"] = nfdvId.ToString(); + + var cgvData = new ConfigurationGroupValueData(location) + { + Properties = new ConfigurationValueWithoutSecrets() + { + ConfigurationGroupSchemaResourceReference = new OpenDeploymentResourceReference() + { + Id = cgs.Id + }, + ConfigurationValue = deploymentValues.ToString(Newtonsoft.Json.Formatting.None) + } + }; + + var lro = await resourceGroup + .GetConfigurationGroupValues() + .CreateOrUpdateAsync(WaitUntil.Completed, cgvName, cgvData); + + return lro.Value; + } + + protected async Task CreateSNSResource( + ResourceGroupResource resourceGroup, + SiteResource site, + NetworkServiceDesignVersionResource nsdv, + ConfigurationGroupValueResource cgv, + string snsName, + AzureLocation location) + { + var snsData = new SiteNetworkServiceData(location) + { + Properties = new SiteNetworkServicePropertiesFormat() + { + SiteReferenceId = site.Id, + NetworkServiceDesignVersionResourceReference = new OpenDeploymentResourceReference() + { + Id = nsdv.Id + } + }, + Identity = new ManagedServiceIdentity(ManagedServiceIdentityType.SystemAssigned), + Sku = new HybridNetworkSku(HybridNetworkSkuName.Standard) + }; + + snsData.Properties.DesiredStateConfigurationGroupValueReferences.Add("vnet_ConfigGroupSchema", new Resources.Models.WritableSubResource() { Id = cgv.Id }); + + var lro = await resourceGroup + .GetSiteNetworkServices() + .CreateOrUpdateAsync(WaitUntil.Completed, snsName, snsData); + + return lro.Value; + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/tests/HybridNetworkManagementTestEnvironment.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/tests/HybridNetworkManagementTestEnvironment.cs new file mode 100644 index 000000000000..cd2835805b4e --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/tests/HybridNetworkManagementTestEnvironment.cs @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using Azure.Core.TestFramework; + +namespace Azure.ResourceManager.HybridNetwork.Tests +{ + public class HybridNetworkManagementTestEnvironment : TestEnvironment + { + } +} \ No newline at end of file diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/tests/Scenario/HybridNetworkTests.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/tests/Scenario/HybridNetworkTests.cs new file mode 100644 index 000000000000..007bfd454c76 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/tests/Scenario/HybridNetworkTests.cs @@ -0,0 +1,327 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System.Runtime.CompilerServices; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.TestFramework; +using Azure.ResourceManager.HybridNetwork.Models; +using Azure.ResourceManager.Resources; +using NUnit.Framework; + +namespace Azure.ResourceManager.HybridNetwork.Tests.Scenario +{ + internal class HybridNetworkTests : HybridNetworkManagementTestBase + { + public HybridNetworkTests(bool isAsync) : base(isAsync) + { + } + + [OneTimeSetUp] + public async Task GlobalSetUp() + { + DefaultResourceGroupName = SessionRecording.GenerateAssetName("HybridNetworkUTRG"); + DefaultResourceLocation = new AzureLocation("eastus2euap"); + + ResourceGroupData rgData = new ResourceGroupData(DefaultResourceLocation); + var rgLro = await GlobalClient + .GetDefaultSubscriptionAsync().Result + .GetResourceGroups() + .CreateOrUpdateAsync(WaitUntil.Completed, DefaultResourceGroupName, rgData); + ResourceGroupResource rg = rgLro.Value; + ResourceGroupId = rg.Id; + + await StopSessionRecordingAsync(); + } + + [SetUp] + public async Task SetUp() + { + Client = GetArmClient(); + + ResourceGroup = await Client.GetResourceGroupResource(ResourceGroupId).GetAsync(); + } + + [OneTimeTearDown] + public void CleanUp() + { + CleanupResourceGroups(); + } + + [TestCase] + [Order(0)] + [RecordedTest] + public async Task CanCreateGetPublisher() + { + var publisherName = Recording.GenerateAssetName("publisher"); + + // Create Publisher + PublisherResource publisher = await CreatePublisherResource(ResourceGroup, publisherName, DefaultResourceLocation); + PublisherId = publisher.Id; + + // Get Publisher + Response getPublisherResponse = await publisher.GetAsync(); + PublisherResource publisherResourceRetrieved = getPublisherResponse.Value; + Assert.IsNotNull(publisherResourceRetrieved); + Assert.AreEqual(publisher.Data.Location, publisherResourceRetrieved.Data.Location); + Assert.AreEqual(PublisherScope.Private, publisherResourceRetrieved.Data.Properties.Scope); + } + + [TestCase] + [Order(0)] + [RecordedTest] + public async Task CanCreateGetSite() + { + var siteName = Recording.GenerateAssetName("site"); + + // Create Publisher + SiteResource site = await CreateSiteResource(ResourceGroup, siteName, DefaultResourceLocation); + SiteId = site.Id; + + // Get Publisher + Response getSiteResponse = await site.GetAsync(); + SiteResource siteResourceRetrieved = getSiteResponse.Value; + Assert.IsNotNull(siteResourceRetrieved); + Assert.AreEqual(site.Data.Location, siteResourceRetrieved.Data.Location); + Assert.AreEqual(NfviName, siteResourceRetrieved.Data.Properties.Nfvis[0].Name); + Assert.AreEqual(NfviType.AzureCore, siteResourceRetrieved.Data.Properties.Nfvis[0].NfviType); + } + + [TestCase] + [Order(1)] + [RecordedTest] + public async Task CanCreateGetConfigGroupSchema() + { + var cgSchemaName = Recording.GenerateAssetName("cgSchema"); + + // Create Artifact Store + PublisherResource publisher = Client.GetPublisherResource(PublisherId); + ConfigurationGroupSchemaResource cgSchema = await CreateConfigGroupSchemaResource(publisher, cgSchemaName, DefaultResourceLocation); + CGSchemaId = cgSchema.Id; + + // Get Artifact Store + Response getArtifactStoreResponse = await cgSchema.GetAsync(); + ConfigurationGroupSchemaResource cgSchemaResourceRetrieved = getArtifactStoreResponse.Value; + ConfigurationGroupSchemaData retrievedData = cgSchemaResourceRetrieved.Data; + Assert.IsNotNull(cgSchemaResourceRetrieved); + var schema = ReadJsonFile(CGSchemaFileName).ToString(Newtonsoft.Json.Formatting.None); + Assert.AreEqual(cgSchema.Data.Location, retrievedData.Location); + Assert.AreEqual(schema, retrievedData.Properties.SchemaDefinition); + } + + [TestCase] + [Order(1)] + [RecordedTest] + public async Task CanCreateGetArtifactStore() + { + var artifactStoreName = Recording.GenerateAssetName("artifactStore"); + + // Create Artifact Store + PublisherResource publisher = Client.GetPublisherResource(PublisherId); + ArtifactStoreResource artifactStore = await CreateArtifactStoreResource(publisher, artifactStoreName, DefaultResourceLocation); + ArtifactStoreId = artifactStore.Id; + + // Get Artifact Store + Response getArtifactStoreResponse = await artifactStore.GetAsync(); + ArtifactStoreResource artifactStoreResourceRetrieved = getArtifactStoreResponse.Value; + ArtifactStoreData retrievedData = artifactStoreResourceRetrieved.Data; + Assert.IsNotNull(artifactStoreResourceRetrieved); + Assert.AreEqual(artifactStore.Data.Location, retrievedData.Location); + Assert.AreEqual(ArtifactStoreType.AzureContainerRegistry, retrievedData.Properties.StoreType); + Assert.AreEqual(ArtifactReplicationStrategy.SingleReplication, retrievedData.Properties.ReplicationStrategy); + } + + [TestCase] + [Order(1)] + [RecordedTest] + public async Task CanCreateGetNFDG() + { + var nfdgName = Recording.GenerateAssetName("nfdg"); + + // Create NFDG + PublisherResource publisher = Client.GetPublisherResource(PublisherId); + NetworkFunctionDefinitionGroupResource nfdg = await CreateNFDGResource(publisher, nfdgName, DefaultResourceLocation); + NFDGId = nfdg.Id; + + // Get NFDG + Response getNfdgResponse = await nfdg.GetAsync(); + NetworkFunctionDefinitionGroupResource nfdgResourceRetrieved = getNfdgResponse.Value; + NetworkFunctionDefinitionGroupData retrievedData = nfdgResourceRetrieved.Data; + Assert.IsNotNull(nfdgResourceRetrieved); + Assert.AreEqual(nfdg.Data.Location, retrievedData.Location); + Assert.AreEqual("NFD for .NET SDK UTs.", retrievedData.Properties.Description); + } + + [TestCase] + [Order(1)] + [RecordedTest] + public async Task CanCreateGetNSDG() + { + var nsdgName = Recording.GenerateAssetName("nsdg"); + + // Create NSDG + PublisherResource publisher = Client.GetPublisherResource(PublisherId); + NetworkServiceDesignGroupResource nsdg = await CreateNSDGResource(publisher, nsdgName, DefaultResourceLocation); + NSDGId = nsdg.Id; + + // Get NSDG + Response getNsdgResponse = await nsdg.GetAsync(); + NetworkServiceDesignGroupResource nsdgResourceRetrieved = getNsdgResponse.Value; + NetworkServiceDesignGroupData retrievedData = nsdgResourceRetrieved.Data; + Assert.IsNotNull(nsdgResourceRetrieved); + Assert.AreEqual(nsdg.Data.Location, retrievedData.Location); + Assert.AreEqual("NSD for .NET SDK UTs.", retrievedData.Properties.Description); + } + + [TestCase] + [Order(2)] + [RecordedTest] + public async Task CanCreateGetArtifactManifest() + { + string artifactManifestName = Recording.GenerateAssetName("artifactManifest"); + + // Create Artifact Manifest + ArtifactStoreResource artifactStore = Client.GetArtifactStoreResource(ArtifactStoreId); + ArtifactManifestResource artifactManifest = await CreateArtifactManifestResource(artifactStore, artifactManifestName, DefaultResourceLocation); + + // Get credential and upload artifact if we are recording. + if (Mode == RecordedTestMode.Record) + { + AzureContainerRegistryScopedTokenCredential creds = (AzureContainerRegistryScopedTokenCredential)await artifactManifest.GetCredentialAsync(); + UploadArmTemplate(VnetArmTemplateFileName, VnetArmTemplateArtifactName, "1.0.0", creds); + UploadArmTemplate(NfArmTemplateFileName, NfArmTemplateArtifactName, "1.0.0", creds); + } + + // Get Artifact Manifest + Response getArtifactManifestResponse = await artifactManifest.GetAsync(); + ArtifactManifestResource artifactManifestResourceRetrieved = getArtifactManifestResponse.Value; + ArtifactManifestData retrievedData = artifactManifestResourceRetrieved.Data; + Assert.IsNotNull(artifactManifestResourceRetrieved); + Assert.AreEqual(artifactManifest.Data.Location, retrievedData.Location); + Assert.AreEqual(VnetArmTemplateArtifactName, retrievedData.Properties.Artifacts[0].ArtifactName); + Assert.AreEqual(ArtifactType.OCIArtifact, retrievedData.Properties.Artifacts[0].ArtifactType); + Assert.AreEqual("1.0.0", retrievedData.Properties.Artifacts[0].ArtifactVersion); + Assert.AreEqual(NfArmTemplateArtifactName, retrievedData.Properties.Artifacts[1].ArtifactName); + Assert.AreEqual(ArtifactType.OCIArtifact, retrievedData.Properties.Artifacts[1].ArtifactType); + Assert.AreEqual("1.0.0", retrievedData.Properties.Artifacts[1].ArtifactVersion); + } + + [TestCase] + [Order(3)] + [RecordedTest] + public async Task CanCreateGetNFDV() + { + string nfdvName = "1.0.0"; + + // Create NFDV + NetworkFunctionDefinitionGroupResource nfdg = Client.GetNetworkFunctionDefinitionGroupResource(NFDGId); + ArtifactStoreResource artifactStore = Client.GetArtifactStoreResource(ArtifactStoreId); + NetworkFunctionDefinitionVersionResource nfdv = await CreateNFDVResource(nfdg, artifactStore, nfdvName, DefaultResourceLocation); + NFDVId = nfdv.Id; + + // Get NFDV + Response getNfdvResponse = await nfdv.GetAsync(); + NetworkFunctionDefinitionVersionResource nfdvResourceRetrieved = getNfdvResponse.Value; + NetworkFunctionDefinitionVersionData retrievedData = nfdvResourceRetrieved.Data; + VirtualNetworkFunctionDefinitionVersion properties = (VirtualNetworkFunctionDefinitionVersion)retrievedData.Properties; + Assert.IsNotNull(nfdvResourceRetrieved); + Assert.AreEqual(nfdv.Data.Location, retrievedData.Location); + var deployParams = ReadJsonFile(DeployParametersFileName).ToString(Newtonsoft.Json.Formatting.None); + Assert.AreEqual(deployParams, properties.DeployParameters); + var nfTemplate = (AzureCoreNetworkFunctionTemplate)properties.NetworkFunctionTemplate; + var armAplication = (AzureCoreNetworkFunctionArmTemplateApplication)nfTemplate.NetworkFunctionApplications[0]; + Assert.AreEqual(ArtifactStoreId, armAplication.ArtifactProfile.ArtifactStoreId); + } + + [TestCase] + [Order(3)] + [RecordedTest] + public async Task CanCreateGetNSDV() + { + string nsdvName = "1.0.0"; + + // Create NSDV + var nsdg = Client.GetNetworkServiceDesignGroupResource(NSDGId); + var cgSchema = Client.GetConfigurationGroupSchemaResource(CGSchemaId); + var artifactStore = Client.GetArtifactStoreResource(ArtifactStoreId); + NetworkServiceDesignVersionResource nsdv = await CreateNSDVResource(nsdg, cgSchema, artifactStore, nsdvName, DefaultResourceLocation); + NSDVId = nsdv.Id; + + // Get NSDV + Response getNsdvResponse = await nsdv.GetAsync(); + NetworkServiceDesignVersionResource nsdvResourceRetrieved = getNsdvResponse.Value; + NetworkServiceDesignVersionData retrievedData = nsdvResourceRetrieved.Data; + Assert.IsNotNull(nsdvResourceRetrieved); + Assert.AreEqual(nsdv.Data.Location, retrievedData.Location); + Assert.AreEqual(CGSchemaId, retrievedData.Properties.ConfigurationGroupSchemaReferences["vnet_ConfigGroupSchema"].Id); + var ret = (NetworkFunctionDefinitionResourceElementTemplateDetails)retrievedData.Properties.ResourceElementTemplates[0]; + Assert.AreEqual(ArtifactStoreId, ret.Configuration.ArtifactProfile.ArtifactStoreReferenceId); + } + + [TestCase] + [Order(4)] + [RecordedTest] + public async Task CanCreateGetConfigGroupValues() + { + var cgvName = Recording.GenerateAssetName("cgValues"); + + // Create Artifact Manifest + var cgSchema = Client.GetConfigurationGroupSchemaResource(CGSchemaId); + ConfigurationGroupValueResource cgValues = await CreateCGVResource(ResourceGroup, cgSchema, cgvName, NFDVId, DefaultResourceLocation); + CGValueId = cgValues.Id; + + // Get Artifact Manifest + Response getCgvResponse = await cgValues.GetAsync(); + ConfigurationGroupValueResource cgvResourceRetrieved = getCgvResponse.Value; + ConfigurationGroupValueData retrievedData = cgvResourceRetrieved.Data; + ConfigurationValueWithoutSecrets properties = (ConfigurationValueWithoutSecrets)retrievedData.Properties; + Assert.IsNotNull(cgvResourceRetrieved); + Assert.AreEqual(cgValues.Data.Location, retrievedData.Location); + Assert.AreEqual(ConfigurationGroupValueConfigurationType.Open, properties.ConfigurationType); + var cgSchemaRef = (OpenDeploymentResourceReference)properties.ConfigurationGroupSchemaResourceReference; + Assert.AreEqual(CGSchemaId, cgSchemaRef.Id); + var values = ReadJsonFile(DeployValuesFileName); + values["nfdvId"] = NFDVId.ToString(); + Assert.AreEqual(properties.ConfigurationValue, values.ToString(Newtonsoft.Json.Formatting.None)); + } + + [TestCase] + [Order(5)] + [RecordedTest] + public async Task CanCreateGetSNS() + { + string snsName = Recording.GenerateAssetName("sns"); + + // Create Site Network Service. + var site = Client.GetSiteResource(SiteId); + var nsdv = Client.GetNetworkServiceDesignVersionResource(NSDVId); + var cgValue = Client.GetConfigurationGroupValueResource(CGValueId); + SiteNetworkServiceResource sns = await CreateSNSResource(ResourceGroup, site, nsdv, cgValue, snsName, DefaultResourceLocation); + + // Get Network Function + Response getSnsResponse = await sns.GetAsync(); + SiteNetworkServiceResource snsResourceRetrieved = getSnsResponse.Value; + SiteNetworkServiceData retrievedData = snsResourceRetrieved.Data; + Assert.IsNotNull(snsResourceRetrieved); + Assert.AreEqual(sns.Data.Location, retrievedData.Location); + Assert.AreEqual(SiteId, retrievedData.Properties.SiteReferenceId); + Assert.AreEqual(CGValueId, retrievedData.Properties.DesiredStateConfigurationGroupValueReferences["vnet_ConfigGroupSchema"].Id); + var nsdvRef = (OpenDeploymentResourceReference)retrievedData.Properties.NetworkServiceDesignVersionResourceReference; + Assert.AreEqual(NSDVId, nsdvRef.Id); + } + + private string DefaultResourceGroupName; + private ResourceIdentifier PublisherId; + private ResourceIdentifier SiteId; + private ResourceIdentifier ArtifactStoreId; + private ResourceIdentifier CGSchemaId; + private ResourceIdentifier CGValueId; + private ResourceIdentifier NFDGId; + private ResourceIdentifier NFDVId; + private ResourceIdentifier NSDGId; + private ResourceIdentifier NSDVId; + private ResourceIdentifier ResourceGroupId; + private AzureLocation DefaultResourceLocation; + private ResourceGroupResource ResourceGroup; + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/tests/Scenario/TestAssets/CGSchema.json b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/tests/Scenario/TestAssets/CGSchema.json new file mode 100644 index 000000000000..c7fb53911a25 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/tests/Scenario/TestAssets/CGSchema.json @@ -0,0 +1,38 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "vnet_ConfigGroupSchema", + "type": "object", + "properties": { + "nfdvId": { + "description": "The ID of the VNET NFDV resource.", + "type": "string" + }, + "vnetName": { + "description": "The name of the VNET you want to deploy", + "type": "string" + }, + "vnetAddressPrefixes": { + "description": "An array of VNET address prefixes, e.g. [\"10.0.0.0/16\",\"11.0.0.0/16\"]", + "type": "array" + }, + "subnets": { + "description": "Array of subnet objects to create under the vnet", + "type": "array", + "items": { + "type": "object", + "properties": { + "name": { + "description": "Name for the subnet", + "type": "string" + }, + "addressPrefix": { + "description": "addressPrefix for the subnet, must exist within one of the VNET address prefixes.", + "type": "string" + } + }, + "required": [ "name", "addressPrefix" ] + } + } + }, + "required": [ "nfdvId", "vnetName", "vnetAddressPrefixes", "subnets" ] +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/tests/Scenario/TestAssets/DeployParameters.json b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/tests/Scenario/TestAssets/DeployParameters.json new file mode 100644 index 000000000000..7b369acffa1c --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/tests/Scenario/TestAssets/DeployParameters.json @@ -0,0 +1,34 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "vnet_deployParams", + "type": "object", + "properties": { + "vnetName": { + "description": "The name of the VNET you want to deploy", + "type": "string" + }, + "vnetAddressPrefixes": { + "description": "An array of VNET address prefixes, e.g. [\"10.0.0.0/16\",\"11.0.0.0/16\"]", + "type": "array" + }, + "subnets": { + "description": "Array of subnet objects to create under the vnet", + "type": "array", + "items": { + "type": "object", + "properties": { + "name": { + "description": "Name for the subnet", + "type": "string" + }, + "addressPrefix": { + "description": "addressPrefix for the subnet, must exist within one of the VNET address prefixes.", + "type": "string" + } + }, + "required": [ "name", "addressPrefix" ] + } + } + }, + "required": [ "vnetName", "vnetAddressPrefixes", "subnets" ] +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/tests/Scenario/TestAssets/DeploymentValues.json b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/tests/Scenario/TestAssets/DeploymentValues.json new file mode 100644 index 000000000000..2b6fab078be7 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/tests/Scenario/TestAssets/DeploymentValues.json @@ -0,0 +1,16 @@ +{ + "vnetName": "DotnetSDKUTVnet", + "vnetAddressPrefixes": [ + "10.0.0.0/16" + ], + "subnets": [ + { + "name": "subnet1", + "addressPrefix": "10.0.1.0/24" + }, + { + "name": "subnet2", + "addressPrefix": "10.0.2.0/24" + } + ] +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/tests/Scenario/TestAssets/NfArmTemplate.json b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/tests/Scenario/TestAssets/NfArmTemplate.json new file mode 100644 index 000000000000..c33359f0bec3 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/tests/Scenario/TestAssets/NfArmTemplate.json @@ -0,0 +1,59 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "metadata": { + "_generator": { + "name": "bicep", + "version": "0.22.6.54827", + "templateHash": "4204644297979192959" + } + }, + "parameters": { + "location": { + "type": "string", + "defaultValue": "[resourceGroup().location]" + }, + "nfdvId": { + "type": "string" + }, + "vnetName": { + "type": "string" + }, + "vnetAddressPrefixes": { + "type": "array" + }, + "subnets": { + "type": "array" + } + }, + "variables": { + "nfName": "[format('nf-{0}', uniqueString(resourceGroup().id))]", + "values": { + "vnetName": "[parameters('vnetName')]", + "vnetAddressPrefixes": "[parameters('vnetAddressPrefixes')]", + "subnets": "[parameters('subnets')]" + } + }, + "resources": [ + { + "type": "Microsoft.HybridNetwork/networkFunctions", + "apiVersion": "2023-09-01", + "name": "[variables('nfName')]", + "location": "[parameters('location')]", + "identity": { + "type": "SystemAssigned" + }, + "properties": { + "networkFunctionDefinitionVersionResourceReference": { + "id": "[parameters('nfdvId')]", + "idType": "Open" + }, + "nfviType": "AzureCore", + "nfviId": "[resourceGroup().id]", + "allowSoftwareUpdate": true, + "configurationType": "Open", + "deploymentValues": "[string(variables('values'))]" + } + } + ] +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/tests/Scenario/TestAssets/NfArmTemplateMappings.json b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/tests/Scenario/TestAssets/NfArmTemplateMappings.json new file mode 100644 index 000000000000..23b2124b6717 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/tests/Scenario/TestAssets/NfArmTemplateMappings.json @@ -0,0 +1,6 @@ +{ + "nfdvId": "{configurationparameters('vnet_ConfigGroupSchema').nfdvId}", + "vnetName": "{configurationparameters('vnet_ConfigGroupSchema').vnetName}", + "vnetAddressPrefixes": "{configurationparameters('vnet_ConfigGroupSchema').vnetAddressPrefixes}", + "subnets": "{configurationparameters('vnet_ConfigGroupSchema').subnets}" +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/tests/Scenario/TestAssets/VnetArmTemplate.json b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/tests/Scenario/TestAssets/VnetArmTemplate.json new file mode 100644 index 000000000000..75c5c8b31b96 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/tests/Scenario/TestAssets/VnetArmTemplate.json @@ -0,0 +1,54 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "metadata": { + "_generator": { + "name": "bicep", + "version": "0.19.5.34762", + "templateHash": "9984318979316552194" + } + }, + "parameters": { + "location": { + "type": "string", + "defaultValue": "[resourceGroup().location]" + }, + "vnetName": { + "type": "string" + }, + "vnetAddressPrefixes": { + "type": "array" + }, + "subnets": { + "type": "array" + } + }, + "variables": { + "copy": [ + { + "name": "formattedSubnets", + "count": "[length(parameters('subnets'))]", + "input": { + "name": "[parameters('subnets')[copyIndex('formattedSubnets')].name]", + "properties": { + "addressPrefix": "[parameters('subnets')[copyIndex('formattedSubnets')].addressPrefix]" + } + } + } + ] + }, + "resources": [ + { + "type": "Microsoft.Network/virtualNetworks", + "apiVersion": "2019-11-01", + "name": "[parameters('vnetName')]", + "location": "[parameters('location')]", + "properties": { + "addressSpace": { + "addressPrefixes": "[parameters('vnetAddressPrefixes')]" + }, + "subnets": "[variables('formattedSubnets')]" + } + } + ] +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/tests/Scenario/TestAssets/VnetArmTemplateMappings.json b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/tests/Scenario/TestAssets/VnetArmTemplateMappings.json new file mode 100644 index 000000000000..aa60a26c649c --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/tests/Scenario/TestAssets/VnetArmTemplateMappings.json @@ -0,0 +1,5 @@ +{ + "vnetName": "{deployParameters.vnetName}", + "vnetAddressPrefixes": "{deployParameters.vnetAddressPrefixes}", + "subnets": "{deployParameters.subnets}" +} diff --git a/sdk/hybridnetwork/ci.mgmt.yml b/sdk/hybridnetwork/ci.mgmt.yml new file mode 100644 index 000000000000..35f71f8ae870 --- /dev/null +++ b/sdk/hybridnetwork/ci.mgmt.yml @@ -0,0 +1,23 @@ +# 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/hybridnetwork/ci.mgmt.yml + - sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/ + +extends: + template: /eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: hybridnetwork + LimitForPullRequest: true + Artifacts: + - name: Azure.ResourceManager.HybridNetwork + safeName: AzureResourceManagerHybridNetwork diff --git a/sdk/resourcemanager/ci.mgmt.yml b/sdk/resourcemanager/ci.mgmt.yml index a50e6a3462dd..1dd599d92dc3 100644 --- a/sdk/resourcemanager/ci.mgmt.yml +++ b/sdk/resourcemanager/ci.mgmt.yml @@ -92,6 +92,7 @@ trigger: - sdk/hybridcompute/Azure.ResourceManager.HybridCompute - sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity - sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes + - sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork - sdk/iot/Azure.ResourceManager.IotFirmwareDefense - sdk/iotcentral/Azure.ResourceManager.IotCentral - sdk/iothub/Azure.ResourceManager.IotHub @@ -274,6 +275,7 @@ pr: - sdk/hybridcompute/Azure.ResourceManager.HybridCompute - sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity - sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes + - sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork - sdk/iot/Azure.ResourceManager.IotFirmwareDefense - sdk/iotcentral/Azure.ResourceManager.IotCentral - sdk/iothub/Azure.ResourceManager.IotHub