diff --git a/sdk/dependencymap/Azure.ResourceManager.DependencyMap/Azure.ResourceManager.DependencyMap.sln b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/Azure.ResourceManager.DependencyMap.sln new file mode 100644 index 000000000000..fedbc9737960 --- /dev/null +++ b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/Azure.ResourceManager.DependencyMap.sln @@ -0,0 +1,56 @@ +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.29709.97 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.ResourceManager.DependencyMap.Samples", "samples\Azure.ResourceManager.DependencyMap.Samples.csproj", "{7A2DFF15-5746-49F4-BD0F-C6C35337088A}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Azure.ResourceManager.DependencyMap", "src\Azure.ResourceManager.DependencyMap.csproj", "{28FF4005-4467-4E36-92E7-DEA27DEB1519}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Azure.ResourceManager.DependencyMap.Tests", "tests\Azure.ResourceManager.DependencyMap.Tests.csproj", "{1F1CD1D4-9932-4B73-99D8-C252A67D4B46}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {B0C276D1-2930-4887-B29A-D1A33E7009A2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B0C276D1-2930-4887-B29A-D1A33E7009A2}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B0C276D1-2930-4887-B29A-D1A33E7009A2}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B0C276D1-2930-4887-B29A-D1A33E7009A2}.Release|Any CPU.Build.0 = Release|Any CPU + {8E9A77AC-792A-4432-8320-ACFD46730401}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8E9A77AC-792A-4432-8320-ACFD46730401}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8E9A77AC-792A-4432-8320-ACFD46730401}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8E9A77AC-792A-4432-8320-ACFD46730401}.Release|Any CPU.Build.0 = Release|Any CPU + {7A2DFF15-5746-49F4-BD0F-C6C35337088A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {7A2DFF15-5746-49F4-BD0F-C6C35337088A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7A2DFF15-5746-49F4-BD0F-C6C35337088A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {7A2DFF15-5746-49F4-BD0F-C6C35337088A}.Release|Any CPU.Build.0 = Release|Any CPU + {A4241C1F-A53D-474C-9E4E-075054407E74}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A4241C1F-A53D-474C-9E4E-075054407E74}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A4241C1F-A53D-474C-9E4E-075054407E74}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A4241C1F-A53D-474C-9E4E-075054407E74}.Release|Any CPU.Build.0 = Release|Any CPU + {FA8BD3F1-8616-47B6-974C-7576CDF4717E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {FA8BD3F1-8616-47B6-974C-7576CDF4717E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {FA8BD3F1-8616-47B6-974C-7576CDF4717E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {FA8BD3F1-8616-47B6-974C-7576CDF4717E}.Release|Any CPU.Build.0 = Release|Any CPU + {85677AD3-C214-42FA-AE6E-49B956CAC8DC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {85677AD3-C214-42FA-AE6E-49B956CAC8DC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {85677AD3-C214-42FA-AE6E-49B956CAC8DC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {85677AD3-C214-42FA-AE6E-49B956CAC8DC}.Release|Any CPU.Build.0 = Release|Any CPU + {28FF4005-4467-4E36-92E7-DEA27DEB1519}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {28FF4005-4467-4E36-92E7-DEA27DEB1519}.Debug|Any CPU.Build.0 = Debug|Any CPU + {28FF4005-4467-4E36-92E7-DEA27DEB1519}.Release|Any CPU.ActiveCfg = Release|Any CPU + {28FF4005-4467-4E36-92E7-DEA27DEB1519}.Release|Any CPU.Build.0 = Release|Any CPU + {1F1CD1D4-9932-4B73-99D8-C252A67D4B46}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1F1CD1D4-9932-4B73-99D8-C252A67D4B46}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1F1CD1D4-9932-4B73-99D8-C252A67D4B46}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1F1CD1D4-9932-4B73-99D8-C252A67D4B46}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {A97F4B90-2591-4689-B1F8-5F21FE6D6CAE} + EndGlobalSection +EndGlobal diff --git a/sdk/dependencymap/Azure.ResourceManager.DependencyMap/CHANGELOG.md b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/CHANGELOG.md new file mode 100644 index 000000000000..8b33f0fedccc --- /dev/null +++ b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/CHANGELOG.md @@ -0,0 +1,11 @@ +# Release History + +## 1.0.0-beta.1 (Unreleased) + +### Features Added + +### Breaking Changes + +### Bugs Fixed + +### Other Changes \ No newline at end of file diff --git a/sdk/dependencymap/Azure.ResourceManager.DependencyMap/Directory.Build.props b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/Directory.Build.props new file mode 100644 index 000000000000..63bd836ad44b --- /dev/null +++ b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/Directory.Build.props @@ -0,0 +1,6 @@ + + + + diff --git a/sdk/dependencymap/Azure.ResourceManager.DependencyMap/README.md b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/README.md new file mode 100644 index 000000000000..810ba32e80f7 --- /dev/null +++ b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/README.md @@ -0,0 +1,80 @@ +# Microsoft Azure DependencyMap 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 DependencyMap management library for .NET with [NuGet](https://www.nuget.org/): + +```dotnetcli +dotnet add package Azure.ResourceManager.DependencyMap --prerelease +``` + +### Prerequisites + +* You must have an [Microsoft Azure subscription](https://azure.microsoft.com/free/dotnet/). + +### Authenticate the Client + +To create an authenticated client and start interacting with Microsoft Azure resources, see the [quickstart guide here](https://github.com/Azure/azure-sdk-for-net/blob/main/doc/dev/mgmt_quickstart.md). + +## Key concepts + +Key concepts of the Microsoft Azure SDK for .NET can be found [here](https://azure.github.io/azure-sdk/dotnet_introduction.html) + +## Documentation + +Documentation is available to help you learn how to use this package: + +- [Quickstart](https://github.com/Azure/azure-sdk-for-net/blob/main/doc/dev/mgmt_quickstart.md). +- [API References](https://learn.microsoft.com/dotnet/api/?view=azure-dotnet). +- [Authentication](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/identity/Azure.Identity/README.md). + +## Examples + +Code samples for using the management library for .NET can be found in the following locations +- [.NET Management Library Code Samples](https://aka.ms/azuresdk-net-mgmt-samples) + +## Troubleshooting + +- File an issue via [GitHub Issues](https://github.com/Azure/azure-sdk-for-net/issues). +- Check [previous questions](https://stackoverflow.com/questions/tagged/azure+.net) or ask new ones on Stack Overflow using Azure and .NET tags. + +## Next steps + +For more information about Microsoft Azure SDK, see [this website](https://azure.github.io/azure-sdk/). + +## Contributing + +For details on contributing to this repository, see the [contributing +guide][cg]. + +This project welcomes contributions and suggestions. Most contributions +require you to agree to a Contributor License Agreement (CLA) declaring +that you have the right to, and actually do, grant us the rights to use +your contribution. For details, visit . + +When you submit a pull request, a CLA-bot will automatically determine +whether you need to provide a CLA and decorate the PR appropriately +(for example, label, comment). Follow the instructions provided by the +bot. You'll only need to do this action once across all repositories +using our CLA. + +This project has adopted the [Microsoft Open Source Code of Conduct][coc]. For +more information, see the [Code of Conduct FAQ][coc_faq] or contact + with any other questions or comments. + + +[cg]: https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/resourcemanager/Azure.ResourceManager/docs/CONTRIBUTING.md +[coc]: https://opensource.microsoft.com/codeofconduct/ +[coc_faq]: https://opensource.microsoft.com/codeofconduct/faq/ \ No newline at end of file diff --git a/sdk/dependencymap/Azure.ResourceManager.DependencyMap/api/Azure.ResourceManager.DependencyMap.net8.0.cs b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/api/Azure.ResourceManager.DependencyMap.net8.0.cs new file mode 100644 index 000000000000..0f010d919fd5 --- /dev/null +++ b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/api/Azure.ResourceManager.DependencyMap.net8.0.cs @@ -0,0 +1,343 @@ +namespace Azure.ResourceManager.DependencyMap +{ + public partial class AzureResourceManagerDependencyMapContext : System.ClientModel.Primitives.ModelReaderWriterContext + { + internal AzureResourceManagerDependencyMapContext() { } + public static Azure.ResourceManager.DependencyMap.AzureResourceManagerDependencyMapContext Default { get { throw null; } } + protected override bool TryGetTypeBuilderCore(System.Type type, out System.ClientModel.Primitives.ModelReaderWriterTypeBuilder builder) { throw null; } + } + public partial class DependencyMapCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected DependencyMapCollection() { } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string mapName, Azure.ResourceManager.DependencyMap.DependencyMapData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(Azure.WaitUntil waitUntil, string mapName, Azure.ResourceManager.DependencyMap.DependencyMapData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Exists(string mapName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string mapName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string mapName, 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 mapName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.NullableResponse GetIfExists(string mapName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string mapName, 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 DependencyMapData : Azure.ResourceManager.Models.TrackedResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public DependencyMapData(Azure.Core.AzureLocation location) { } + public Azure.ResourceManager.DependencyMap.Models.DependencyMapProvisioningState? DependencyMapProvisioningState { get { throw null; } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DependencyMap.DependencyMapData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DependencyMap.DependencyMapData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class DependencyMapDiscoverySourceCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected DependencyMapDiscoverySourceCollection() { } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string sourceName, Azure.ResourceManager.DependencyMap.DependencyMapDiscoverySourceData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(Azure.WaitUntil waitUntil, string sourceName, Azure.ResourceManager.DependencyMap.DependencyMapDiscoverySourceData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Exists(string sourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string sourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string sourceName, 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 sourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.NullableResponse GetIfExists(string sourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string sourceName, 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 DependencyMapDiscoverySourceData : Azure.ResourceManager.Models.TrackedResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public DependencyMapDiscoverySourceData(Azure.Core.AzureLocation location) { } + public Azure.ResourceManager.DependencyMap.Models.DependencyMapDiscoverySourceProperties Properties { get { throw null; } set { } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DependencyMap.DependencyMapDiscoverySourceData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DependencyMap.DependencyMapDiscoverySourceData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class DependencyMapDiscoverySourceResource : Azure.ResourceManager.ArmResource, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public static readonly Azure.Core.ResourceType ResourceType; + protected DependencyMapDiscoverySourceResource() { } + public virtual Azure.ResourceManager.DependencyMap.DependencyMapDiscoverySourceData 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 mapName, string sourceName) { 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; } + Azure.ResourceManager.DependencyMap.DependencyMapDiscoverySourceData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DependencyMap.DependencyMapDiscoverySourceData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + public virtual Azure.ResourceManager.ArmOperation Update(Azure.WaitUntil waitUntil, Azure.ResourceManager.DependencyMap.Models.DependencyMapDiscoverySourcePatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.DependencyMap.Models.DependencyMapDiscoverySourcePatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public static partial class DependencyMapExtensions + { + public static Azure.Response GetDependencyMap(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string mapName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static System.Threading.Tasks.Task> GetDependencyMapAsync(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string mapName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.ResourceManager.DependencyMap.DependencyMapDiscoverySourceResource GetDependencyMapDiscoverySourceResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.ResourceManager.DependencyMap.DependencyMapResource GetDependencyMapResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.ResourceManager.DependencyMap.DependencyMapCollection GetDependencyMaps(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource) { throw null; } + public static Azure.Pageable GetDependencyMaps(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.AsyncPageable GetDependencyMapsAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class DependencyMapResource : Azure.ResourceManager.ArmResource, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public static readonly Azure.Core.ResourceType ResourceType; + protected DependencyMapResource() { } + public virtual Azure.ResourceManager.DependencyMap.DependencyMapData 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 mapName) { 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 ExportDependencies(Azure.WaitUntil waitUntil, Azure.ResourceManager.DependencyMap.Models.ExportDependenciesContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task ExportDependenciesAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.DependencyMap.Models.ExportDependenciesContent 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.ResourceManager.ArmOperation GetConnectionsForProcessOnFocusedMachine(Azure.WaitUntil waitUntil, Azure.ResourceManager.DependencyMap.Models.GetConnectionsForProcessOnFocusedMachineContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task GetConnectionsForProcessOnFocusedMachineAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.DependencyMap.Models.GetConnectionsForProcessOnFocusedMachineContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.ArmOperation GetConnectionsWithConnectedMachineForFocusedMachine(Azure.WaitUntil waitUntil, Azure.ResourceManager.DependencyMap.Models.GetConnectionsWithConnectedMachineForFocusedMachineContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task GetConnectionsWithConnectedMachineForFocusedMachineAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.DependencyMap.Models.GetConnectionsWithConnectedMachineForFocusedMachineContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetDependencyMapDiscoverySource(string sourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetDependencyMapDiscoverySourceAsync(string sourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.DependencyMap.DependencyMapDiscoverySourceCollection GetDependencyMapDiscoverySources() { throw null; } + public virtual Azure.ResourceManager.ArmOperation GetDependencyViewForFocusedMachine(Azure.WaitUntil waitUntil, Azure.ResourceManager.DependencyMap.Models.GetDependencyViewForFocusedMachineContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task GetDependencyViewForFocusedMachineAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.DependencyMap.Models.GetDependencyViewForFocusedMachineContent content, 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; } + Azure.ResourceManager.DependencyMap.DependencyMapData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DependencyMap.DependencyMapData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + public virtual Azure.ResourceManager.ArmOperation Update(Azure.WaitUntil waitUntil, Azure.ResourceManager.DependencyMap.Models.DependencyMapPatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.DependencyMap.Models.DependencyMapPatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} +namespace Azure.ResourceManager.DependencyMap.Mocking +{ + public partial class MockableDependencyMapArmClient : Azure.ResourceManager.ArmResource + { + protected MockableDependencyMapArmClient() { } + public virtual Azure.ResourceManager.DependencyMap.DependencyMapDiscoverySourceResource GetDependencyMapDiscoverySourceResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DependencyMap.DependencyMapResource GetDependencyMapResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableDependencyMapResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableDependencyMapResourceGroupResource() { } + public virtual Azure.Response GetDependencyMap(string mapName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetDependencyMapAsync(string mapName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.DependencyMap.DependencyMapCollection GetDependencyMaps() { throw null; } + } + public partial class MockableDependencyMapSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableDependencyMapSubscriptionResource() { } + public virtual Azure.Pageable GetDependencyMaps(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetDependencyMapsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} +namespace Azure.ResourceManager.DependencyMap.Models +{ + public static partial class ArmDependencyMapModelFactory + { + public static Azure.ResourceManager.DependencyMap.DependencyMapData DependencyMapData(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.DependencyMap.Models.DependencyMapProvisioningState? dependencyMapProvisioningState = default(Azure.ResourceManager.DependencyMap.Models.DependencyMapProvisioningState?)) { throw null; } + public static Azure.ResourceManager.DependencyMap.DependencyMapDiscoverySourceData DependencyMapDiscoverySourceData(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.DependencyMap.Models.DependencyMapDiscoverySourceProperties properties = null) { throw null; } + public static Azure.ResourceManager.DependencyMap.Models.DependencyMapDiscoverySourceProperties DependencyMapDiscoverySourceProperties(Azure.ResourceManager.DependencyMap.Models.DependencyMapProvisioningState? provisioningState = default(Azure.ResourceManager.DependencyMap.Models.DependencyMapProvisioningState?), string sourceType = null, Azure.Core.ResourceIdentifier sourceId = null) { throw null; } + public static Azure.ResourceManager.DependencyMap.Models.ExportDependenciesContent ExportDependenciesContent(Azure.Core.ResourceIdentifier focusedMachineId = null, Azure.ResourceManager.DependencyMap.Models.DependencyMapVisualizationFilter filters = null) { throw null; } + public static Azure.ResourceManager.DependencyMap.Models.GetConnectionsForProcessOnFocusedMachineContent GetConnectionsForProcessOnFocusedMachineContent(Azure.Core.ResourceIdentifier focusedMachineId = null, string processIdOnFocusedMachine = null, Azure.ResourceManager.DependencyMap.Models.DependencyMapVisualizationFilter filters = null) { throw null; } + public static Azure.ResourceManager.DependencyMap.Models.GetConnectionsWithConnectedMachineForFocusedMachineContent GetConnectionsWithConnectedMachineForFocusedMachineContent(Azure.Core.ResourceIdentifier focusedMachineId = null, Azure.Core.ResourceIdentifier connectedMachineId = null, Azure.ResourceManager.DependencyMap.Models.DependencyMapVisualizationFilter filters = null) { throw null; } + public static Azure.ResourceManager.DependencyMap.Models.GetDependencyViewForFocusedMachineContent GetDependencyViewForFocusedMachineContent(Azure.Core.ResourceIdentifier focusedMachineId = null, Azure.ResourceManager.DependencyMap.Models.DependencyMapVisualizationFilter filters = null) { throw null; } + public static Azure.ResourceManager.DependencyMap.Models.OffAzureDiscoverySourceProperties OffAzureDiscoverySourceProperties(Azure.ResourceManager.DependencyMap.Models.DependencyMapProvisioningState? provisioningState = default(Azure.ResourceManager.DependencyMap.Models.DependencyMapProvisioningState?), Azure.Core.ResourceIdentifier sourceId = null) { throw null; } + } + public partial class DependencyMapDateTimeFilter : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public DependencyMapDateTimeFilter() { } + public System.DateTimeOffset? EndOn { get { throw null; } set { } } + public System.DateTimeOffset? StartOn { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DependencyMap.Models.DependencyMapDateTimeFilter System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DependencyMap.Models.DependencyMapDateTimeFilter System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class DependencyMapDiscoverySourcePatch : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public DependencyMapDiscoverySourcePatch() { } + public System.Collections.Generic.IDictionary Tags { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DependencyMap.Models.DependencyMapDiscoverySourcePatch System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DependencyMap.Models.DependencyMapDiscoverySourcePatch System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public abstract partial class DependencyMapDiscoverySourceProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + protected DependencyMapDiscoverySourceProperties(Azure.Core.ResourceIdentifier sourceId) { } + public Azure.ResourceManager.DependencyMap.Models.DependencyMapProvisioningState? ProvisioningState { get { throw null; } } + public Azure.Core.ResourceIdentifier SourceId { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DependencyMap.Models.DependencyMapDiscoverySourceProperties System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DependencyMap.Models.DependencyMapDiscoverySourceProperties System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class DependencyMapPatch : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public DependencyMapPatch() { } + public System.Collections.Generic.IDictionary Tags { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DependencyMap.Models.DependencyMapPatch System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DependencyMap.Models.DependencyMapPatch System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class DependencyMapProcessNameFilter : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public DependencyMapProcessNameFilter(Azure.ResourceManager.DependencyMap.Models.DependencyMapProcessNameFilterOperator @operator, System.Collections.Generic.IEnumerable processNames) { } + public Azure.ResourceManager.DependencyMap.Models.DependencyMapProcessNameFilterOperator Operator { get { throw null; } } + public System.Collections.Generic.IList ProcessNames { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DependencyMap.Models.DependencyMapProcessNameFilter System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DependencyMap.Models.DependencyMapProcessNameFilter System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct DependencyMapProcessNameFilterOperator : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public DependencyMapProcessNameFilterOperator(string value) { throw null; } + public static Azure.ResourceManager.DependencyMap.Models.DependencyMapProcessNameFilterOperator Contains { get { throw null; } } + public static Azure.ResourceManager.DependencyMap.Models.DependencyMapProcessNameFilterOperator NotContains { get { throw null; } } + public bool Equals(Azure.ResourceManager.DependencyMap.Models.DependencyMapProcessNameFilterOperator 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.DependencyMap.Models.DependencyMapProcessNameFilterOperator left, Azure.ResourceManager.DependencyMap.Models.DependencyMapProcessNameFilterOperator right) { throw null; } + public static implicit operator Azure.ResourceManager.DependencyMap.Models.DependencyMapProcessNameFilterOperator (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.DependencyMap.Models.DependencyMapProcessNameFilterOperator left, Azure.ResourceManager.DependencyMap.Models.DependencyMapProcessNameFilterOperator right) { throw null; } + public override string ToString() { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct DependencyMapProvisioningState : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public DependencyMapProvisioningState(string value) { throw null; } + public static Azure.ResourceManager.DependencyMap.Models.DependencyMapProvisioningState Accepted { get { throw null; } } + public static Azure.ResourceManager.DependencyMap.Models.DependencyMapProvisioningState Canceled { get { throw null; } } + public static Azure.ResourceManager.DependencyMap.Models.DependencyMapProvisioningState Deleting { get { throw null; } } + public static Azure.ResourceManager.DependencyMap.Models.DependencyMapProvisioningState Failed { get { throw null; } } + public static Azure.ResourceManager.DependencyMap.Models.DependencyMapProvisioningState Provisioning { get { throw null; } } + public static Azure.ResourceManager.DependencyMap.Models.DependencyMapProvisioningState Succeeded { get { throw null; } } + public static Azure.ResourceManager.DependencyMap.Models.DependencyMapProvisioningState Updating { get { throw null; } } + public bool Equals(Azure.ResourceManager.DependencyMap.Models.DependencyMapProvisioningState 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.DependencyMap.Models.DependencyMapProvisioningState left, Azure.ResourceManager.DependencyMap.Models.DependencyMapProvisioningState right) { throw null; } + public static implicit operator Azure.ResourceManager.DependencyMap.Models.DependencyMapProvisioningState (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.DependencyMap.Models.DependencyMapProvisioningState left, Azure.ResourceManager.DependencyMap.Models.DependencyMapProvisioningState right) { throw null; } + public override string ToString() { throw null; } + } + public partial class DependencyMapVisualizationFilter : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public DependencyMapVisualizationFilter() { } + public Azure.ResourceManager.DependencyMap.Models.DependencyMapDateTimeFilter DateTime { get { throw null; } set { } } + public Azure.ResourceManager.DependencyMap.Models.DependencyMapProcessNameFilter ProcessNameFilter { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DependencyMap.Models.DependencyMapVisualizationFilter System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DependencyMap.Models.DependencyMapVisualizationFilter System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class ExportDependenciesContent : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public ExportDependenciesContent(Azure.Core.ResourceIdentifier focusedMachineId) { } + public Azure.ResourceManager.DependencyMap.Models.DependencyMapVisualizationFilter Filters { get { throw null; } set { } } + public Azure.Core.ResourceIdentifier FocusedMachineId { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DependencyMap.Models.ExportDependenciesContent System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DependencyMap.Models.ExportDependenciesContent System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class GetConnectionsForProcessOnFocusedMachineContent : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public GetConnectionsForProcessOnFocusedMachineContent(Azure.Core.ResourceIdentifier focusedMachineId, string processIdOnFocusedMachine) { } + public Azure.ResourceManager.DependencyMap.Models.DependencyMapVisualizationFilter Filters { get { throw null; } set { } } + public Azure.Core.ResourceIdentifier FocusedMachineId { get { throw null; } } + public string ProcessIdOnFocusedMachine { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DependencyMap.Models.GetConnectionsForProcessOnFocusedMachineContent System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DependencyMap.Models.GetConnectionsForProcessOnFocusedMachineContent System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class GetConnectionsWithConnectedMachineForFocusedMachineContent : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public GetConnectionsWithConnectedMachineForFocusedMachineContent(Azure.Core.ResourceIdentifier focusedMachineId, Azure.Core.ResourceIdentifier connectedMachineId) { } + public Azure.Core.ResourceIdentifier ConnectedMachineId { get { throw null; } } + public Azure.ResourceManager.DependencyMap.Models.DependencyMapVisualizationFilter Filters { get { throw null; } set { } } + public Azure.Core.ResourceIdentifier FocusedMachineId { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DependencyMap.Models.GetConnectionsWithConnectedMachineForFocusedMachineContent System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DependencyMap.Models.GetConnectionsWithConnectedMachineForFocusedMachineContent System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class GetDependencyViewForFocusedMachineContent : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public GetDependencyViewForFocusedMachineContent(Azure.Core.ResourceIdentifier focusedMachineId) { } + public Azure.ResourceManager.DependencyMap.Models.DependencyMapVisualizationFilter Filters { get { throw null; } set { } } + public Azure.Core.ResourceIdentifier FocusedMachineId { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DependencyMap.Models.GetDependencyViewForFocusedMachineContent System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DependencyMap.Models.GetDependencyViewForFocusedMachineContent System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class OffAzureDiscoverySourceProperties : Azure.ResourceManager.DependencyMap.Models.DependencyMapDiscoverySourceProperties, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public OffAzureDiscoverySourceProperties(Azure.Core.ResourceIdentifier sourceId) : base (default(Azure.Core.ResourceIdentifier)) { } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DependencyMap.Models.OffAzureDiscoverySourceProperties System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DependencyMap.Models.OffAzureDiscoverySourceProperties System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } +} diff --git a/sdk/dependencymap/Azure.ResourceManager.DependencyMap/api/Azure.ResourceManager.DependencyMap.netstandard2.0.cs b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/api/Azure.ResourceManager.DependencyMap.netstandard2.0.cs new file mode 100644 index 000000000000..0f010d919fd5 --- /dev/null +++ b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/api/Azure.ResourceManager.DependencyMap.netstandard2.0.cs @@ -0,0 +1,343 @@ +namespace Azure.ResourceManager.DependencyMap +{ + public partial class AzureResourceManagerDependencyMapContext : System.ClientModel.Primitives.ModelReaderWriterContext + { + internal AzureResourceManagerDependencyMapContext() { } + public static Azure.ResourceManager.DependencyMap.AzureResourceManagerDependencyMapContext Default { get { throw null; } } + protected override bool TryGetTypeBuilderCore(System.Type type, out System.ClientModel.Primitives.ModelReaderWriterTypeBuilder builder) { throw null; } + } + public partial class DependencyMapCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected DependencyMapCollection() { } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string mapName, Azure.ResourceManager.DependencyMap.DependencyMapData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(Azure.WaitUntil waitUntil, string mapName, Azure.ResourceManager.DependencyMap.DependencyMapData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Exists(string mapName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string mapName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string mapName, 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 mapName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.NullableResponse GetIfExists(string mapName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string mapName, 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 DependencyMapData : Azure.ResourceManager.Models.TrackedResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public DependencyMapData(Azure.Core.AzureLocation location) { } + public Azure.ResourceManager.DependencyMap.Models.DependencyMapProvisioningState? DependencyMapProvisioningState { get { throw null; } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DependencyMap.DependencyMapData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DependencyMap.DependencyMapData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class DependencyMapDiscoverySourceCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected DependencyMapDiscoverySourceCollection() { } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string sourceName, Azure.ResourceManager.DependencyMap.DependencyMapDiscoverySourceData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(Azure.WaitUntil waitUntil, string sourceName, Azure.ResourceManager.DependencyMap.DependencyMapDiscoverySourceData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Exists(string sourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string sourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string sourceName, 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 sourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.NullableResponse GetIfExists(string sourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string sourceName, 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 DependencyMapDiscoverySourceData : Azure.ResourceManager.Models.TrackedResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public DependencyMapDiscoverySourceData(Azure.Core.AzureLocation location) { } + public Azure.ResourceManager.DependencyMap.Models.DependencyMapDiscoverySourceProperties Properties { get { throw null; } set { } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DependencyMap.DependencyMapDiscoverySourceData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DependencyMap.DependencyMapDiscoverySourceData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class DependencyMapDiscoverySourceResource : Azure.ResourceManager.ArmResource, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public static readonly Azure.Core.ResourceType ResourceType; + protected DependencyMapDiscoverySourceResource() { } + public virtual Azure.ResourceManager.DependencyMap.DependencyMapDiscoverySourceData 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 mapName, string sourceName) { 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; } + Azure.ResourceManager.DependencyMap.DependencyMapDiscoverySourceData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DependencyMap.DependencyMapDiscoverySourceData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + public virtual Azure.ResourceManager.ArmOperation Update(Azure.WaitUntil waitUntil, Azure.ResourceManager.DependencyMap.Models.DependencyMapDiscoverySourcePatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.DependencyMap.Models.DependencyMapDiscoverySourcePatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public static partial class DependencyMapExtensions + { + public static Azure.Response GetDependencyMap(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string mapName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static System.Threading.Tasks.Task> GetDependencyMapAsync(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string mapName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.ResourceManager.DependencyMap.DependencyMapDiscoverySourceResource GetDependencyMapDiscoverySourceResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.ResourceManager.DependencyMap.DependencyMapResource GetDependencyMapResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.ResourceManager.DependencyMap.DependencyMapCollection GetDependencyMaps(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource) { throw null; } + public static Azure.Pageable GetDependencyMaps(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.AsyncPageable GetDependencyMapsAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class DependencyMapResource : Azure.ResourceManager.ArmResource, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public static readonly Azure.Core.ResourceType ResourceType; + protected DependencyMapResource() { } + public virtual Azure.ResourceManager.DependencyMap.DependencyMapData 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 mapName) { 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 ExportDependencies(Azure.WaitUntil waitUntil, Azure.ResourceManager.DependencyMap.Models.ExportDependenciesContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task ExportDependenciesAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.DependencyMap.Models.ExportDependenciesContent 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.ResourceManager.ArmOperation GetConnectionsForProcessOnFocusedMachine(Azure.WaitUntil waitUntil, Azure.ResourceManager.DependencyMap.Models.GetConnectionsForProcessOnFocusedMachineContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task GetConnectionsForProcessOnFocusedMachineAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.DependencyMap.Models.GetConnectionsForProcessOnFocusedMachineContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.ArmOperation GetConnectionsWithConnectedMachineForFocusedMachine(Azure.WaitUntil waitUntil, Azure.ResourceManager.DependencyMap.Models.GetConnectionsWithConnectedMachineForFocusedMachineContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task GetConnectionsWithConnectedMachineForFocusedMachineAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.DependencyMap.Models.GetConnectionsWithConnectedMachineForFocusedMachineContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetDependencyMapDiscoverySource(string sourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetDependencyMapDiscoverySourceAsync(string sourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.DependencyMap.DependencyMapDiscoverySourceCollection GetDependencyMapDiscoverySources() { throw null; } + public virtual Azure.ResourceManager.ArmOperation GetDependencyViewForFocusedMachine(Azure.WaitUntil waitUntil, Azure.ResourceManager.DependencyMap.Models.GetDependencyViewForFocusedMachineContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task GetDependencyViewForFocusedMachineAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.DependencyMap.Models.GetDependencyViewForFocusedMachineContent content, 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; } + Azure.ResourceManager.DependencyMap.DependencyMapData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DependencyMap.DependencyMapData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + public virtual Azure.ResourceManager.ArmOperation Update(Azure.WaitUntil waitUntil, Azure.ResourceManager.DependencyMap.Models.DependencyMapPatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.DependencyMap.Models.DependencyMapPatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} +namespace Azure.ResourceManager.DependencyMap.Mocking +{ + public partial class MockableDependencyMapArmClient : Azure.ResourceManager.ArmResource + { + protected MockableDependencyMapArmClient() { } + public virtual Azure.ResourceManager.DependencyMap.DependencyMapDiscoverySourceResource GetDependencyMapDiscoverySourceResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DependencyMap.DependencyMapResource GetDependencyMapResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableDependencyMapResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableDependencyMapResourceGroupResource() { } + public virtual Azure.Response GetDependencyMap(string mapName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetDependencyMapAsync(string mapName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.DependencyMap.DependencyMapCollection GetDependencyMaps() { throw null; } + } + public partial class MockableDependencyMapSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableDependencyMapSubscriptionResource() { } + public virtual Azure.Pageable GetDependencyMaps(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetDependencyMapsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} +namespace Azure.ResourceManager.DependencyMap.Models +{ + public static partial class ArmDependencyMapModelFactory + { + public static Azure.ResourceManager.DependencyMap.DependencyMapData DependencyMapData(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.DependencyMap.Models.DependencyMapProvisioningState? dependencyMapProvisioningState = default(Azure.ResourceManager.DependencyMap.Models.DependencyMapProvisioningState?)) { throw null; } + public static Azure.ResourceManager.DependencyMap.DependencyMapDiscoverySourceData DependencyMapDiscoverySourceData(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.DependencyMap.Models.DependencyMapDiscoverySourceProperties properties = null) { throw null; } + public static Azure.ResourceManager.DependencyMap.Models.DependencyMapDiscoverySourceProperties DependencyMapDiscoverySourceProperties(Azure.ResourceManager.DependencyMap.Models.DependencyMapProvisioningState? provisioningState = default(Azure.ResourceManager.DependencyMap.Models.DependencyMapProvisioningState?), string sourceType = null, Azure.Core.ResourceIdentifier sourceId = null) { throw null; } + public static Azure.ResourceManager.DependencyMap.Models.ExportDependenciesContent ExportDependenciesContent(Azure.Core.ResourceIdentifier focusedMachineId = null, Azure.ResourceManager.DependencyMap.Models.DependencyMapVisualizationFilter filters = null) { throw null; } + public static Azure.ResourceManager.DependencyMap.Models.GetConnectionsForProcessOnFocusedMachineContent GetConnectionsForProcessOnFocusedMachineContent(Azure.Core.ResourceIdentifier focusedMachineId = null, string processIdOnFocusedMachine = null, Azure.ResourceManager.DependencyMap.Models.DependencyMapVisualizationFilter filters = null) { throw null; } + public static Azure.ResourceManager.DependencyMap.Models.GetConnectionsWithConnectedMachineForFocusedMachineContent GetConnectionsWithConnectedMachineForFocusedMachineContent(Azure.Core.ResourceIdentifier focusedMachineId = null, Azure.Core.ResourceIdentifier connectedMachineId = null, Azure.ResourceManager.DependencyMap.Models.DependencyMapVisualizationFilter filters = null) { throw null; } + public static Azure.ResourceManager.DependencyMap.Models.GetDependencyViewForFocusedMachineContent GetDependencyViewForFocusedMachineContent(Azure.Core.ResourceIdentifier focusedMachineId = null, Azure.ResourceManager.DependencyMap.Models.DependencyMapVisualizationFilter filters = null) { throw null; } + public static Azure.ResourceManager.DependencyMap.Models.OffAzureDiscoverySourceProperties OffAzureDiscoverySourceProperties(Azure.ResourceManager.DependencyMap.Models.DependencyMapProvisioningState? provisioningState = default(Azure.ResourceManager.DependencyMap.Models.DependencyMapProvisioningState?), Azure.Core.ResourceIdentifier sourceId = null) { throw null; } + } + public partial class DependencyMapDateTimeFilter : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public DependencyMapDateTimeFilter() { } + public System.DateTimeOffset? EndOn { get { throw null; } set { } } + public System.DateTimeOffset? StartOn { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DependencyMap.Models.DependencyMapDateTimeFilter System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DependencyMap.Models.DependencyMapDateTimeFilter System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class DependencyMapDiscoverySourcePatch : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public DependencyMapDiscoverySourcePatch() { } + public System.Collections.Generic.IDictionary Tags { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DependencyMap.Models.DependencyMapDiscoverySourcePatch System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DependencyMap.Models.DependencyMapDiscoverySourcePatch System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public abstract partial class DependencyMapDiscoverySourceProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + protected DependencyMapDiscoverySourceProperties(Azure.Core.ResourceIdentifier sourceId) { } + public Azure.ResourceManager.DependencyMap.Models.DependencyMapProvisioningState? ProvisioningState { get { throw null; } } + public Azure.Core.ResourceIdentifier SourceId { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DependencyMap.Models.DependencyMapDiscoverySourceProperties System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DependencyMap.Models.DependencyMapDiscoverySourceProperties System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class DependencyMapPatch : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public DependencyMapPatch() { } + public System.Collections.Generic.IDictionary Tags { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DependencyMap.Models.DependencyMapPatch System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DependencyMap.Models.DependencyMapPatch System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class DependencyMapProcessNameFilter : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public DependencyMapProcessNameFilter(Azure.ResourceManager.DependencyMap.Models.DependencyMapProcessNameFilterOperator @operator, System.Collections.Generic.IEnumerable processNames) { } + public Azure.ResourceManager.DependencyMap.Models.DependencyMapProcessNameFilterOperator Operator { get { throw null; } } + public System.Collections.Generic.IList ProcessNames { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DependencyMap.Models.DependencyMapProcessNameFilter System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DependencyMap.Models.DependencyMapProcessNameFilter System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct DependencyMapProcessNameFilterOperator : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public DependencyMapProcessNameFilterOperator(string value) { throw null; } + public static Azure.ResourceManager.DependencyMap.Models.DependencyMapProcessNameFilterOperator Contains { get { throw null; } } + public static Azure.ResourceManager.DependencyMap.Models.DependencyMapProcessNameFilterOperator NotContains { get { throw null; } } + public bool Equals(Azure.ResourceManager.DependencyMap.Models.DependencyMapProcessNameFilterOperator 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.DependencyMap.Models.DependencyMapProcessNameFilterOperator left, Azure.ResourceManager.DependencyMap.Models.DependencyMapProcessNameFilterOperator right) { throw null; } + public static implicit operator Azure.ResourceManager.DependencyMap.Models.DependencyMapProcessNameFilterOperator (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.DependencyMap.Models.DependencyMapProcessNameFilterOperator left, Azure.ResourceManager.DependencyMap.Models.DependencyMapProcessNameFilterOperator right) { throw null; } + public override string ToString() { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct DependencyMapProvisioningState : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public DependencyMapProvisioningState(string value) { throw null; } + public static Azure.ResourceManager.DependencyMap.Models.DependencyMapProvisioningState Accepted { get { throw null; } } + public static Azure.ResourceManager.DependencyMap.Models.DependencyMapProvisioningState Canceled { get { throw null; } } + public static Azure.ResourceManager.DependencyMap.Models.DependencyMapProvisioningState Deleting { get { throw null; } } + public static Azure.ResourceManager.DependencyMap.Models.DependencyMapProvisioningState Failed { get { throw null; } } + public static Azure.ResourceManager.DependencyMap.Models.DependencyMapProvisioningState Provisioning { get { throw null; } } + public static Azure.ResourceManager.DependencyMap.Models.DependencyMapProvisioningState Succeeded { get { throw null; } } + public static Azure.ResourceManager.DependencyMap.Models.DependencyMapProvisioningState Updating { get { throw null; } } + public bool Equals(Azure.ResourceManager.DependencyMap.Models.DependencyMapProvisioningState 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.DependencyMap.Models.DependencyMapProvisioningState left, Azure.ResourceManager.DependencyMap.Models.DependencyMapProvisioningState right) { throw null; } + public static implicit operator Azure.ResourceManager.DependencyMap.Models.DependencyMapProvisioningState (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.DependencyMap.Models.DependencyMapProvisioningState left, Azure.ResourceManager.DependencyMap.Models.DependencyMapProvisioningState right) { throw null; } + public override string ToString() { throw null; } + } + public partial class DependencyMapVisualizationFilter : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public DependencyMapVisualizationFilter() { } + public Azure.ResourceManager.DependencyMap.Models.DependencyMapDateTimeFilter DateTime { get { throw null; } set { } } + public Azure.ResourceManager.DependencyMap.Models.DependencyMapProcessNameFilter ProcessNameFilter { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DependencyMap.Models.DependencyMapVisualizationFilter System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DependencyMap.Models.DependencyMapVisualizationFilter System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class ExportDependenciesContent : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public ExportDependenciesContent(Azure.Core.ResourceIdentifier focusedMachineId) { } + public Azure.ResourceManager.DependencyMap.Models.DependencyMapVisualizationFilter Filters { get { throw null; } set { } } + public Azure.Core.ResourceIdentifier FocusedMachineId { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DependencyMap.Models.ExportDependenciesContent System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DependencyMap.Models.ExportDependenciesContent System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class GetConnectionsForProcessOnFocusedMachineContent : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public GetConnectionsForProcessOnFocusedMachineContent(Azure.Core.ResourceIdentifier focusedMachineId, string processIdOnFocusedMachine) { } + public Azure.ResourceManager.DependencyMap.Models.DependencyMapVisualizationFilter Filters { get { throw null; } set { } } + public Azure.Core.ResourceIdentifier FocusedMachineId { get { throw null; } } + public string ProcessIdOnFocusedMachine { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DependencyMap.Models.GetConnectionsForProcessOnFocusedMachineContent System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DependencyMap.Models.GetConnectionsForProcessOnFocusedMachineContent System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class GetConnectionsWithConnectedMachineForFocusedMachineContent : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public GetConnectionsWithConnectedMachineForFocusedMachineContent(Azure.Core.ResourceIdentifier focusedMachineId, Azure.Core.ResourceIdentifier connectedMachineId) { } + public Azure.Core.ResourceIdentifier ConnectedMachineId { get { throw null; } } + public Azure.ResourceManager.DependencyMap.Models.DependencyMapVisualizationFilter Filters { get { throw null; } set { } } + public Azure.Core.ResourceIdentifier FocusedMachineId { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DependencyMap.Models.GetConnectionsWithConnectedMachineForFocusedMachineContent System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DependencyMap.Models.GetConnectionsWithConnectedMachineForFocusedMachineContent System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class GetDependencyViewForFocusedMachineContent : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public GetDependencyViewForFocusedMachineContent(Azure.Core.ResourceIdentifier focusedMachineId) { } + public Azure.ResourceManager.DependencyMap.Models.DependencyMapVisualizationFilter Filters { get { throw null; } set { } } + public Azure.Core.ResourceIdentifier FocusedMachineId { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DependencyMap.Models.GetDependencyViewForFocusedMachineContent System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DependencyMap.Models.GetDependencyViewForFocusedMachineContent System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class OffAzureDiscoverySourceProperties : Azure.ResourceManager.DependencyMap.Models.DependencyMapDiscoverySourceProperties, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public OffAzureDiscoverySourceProperties(Azure.Core.ResourceIdentifier sourceId) : base (default(Azure.Core.ResourceIdentifier)) { } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DependencyMap.Models.OffAzureDiscoverySourceProperties System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DependencyMap.Models.OffAzureDiscoverySourceProperties System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } +} diff --git a/sdk/dependencymap/Azure.ResourceManager.DependencyMap/assets.json b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/assets.json new file mode 100644 index 000000000000..729d19b6092d --- /dev/null +++ b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/assets.json @@ -0,0 +1,7 @@ + +{ + "AssetsRepo": "Azure/azure-sdk-assets", + "AssetsRepoPrefixPath": "net", + "TagPrefix": "net/dependencymap/Azure.ResourceManager.DependencyMap", + "Tag": "" +} diff --git a/sdk/dependencymap/Azure.ResourceManager.DependencyMap/samples/Azure.ResourceManager.DependencyMap.Samples.csproj b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/samples/Azure.ResourceManager.DependencyMap.Samples.csproj new file mode 100644 index 000000000000..3222b11d1d1d --- /dev/null +++ b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/samples/Azure.ResourceManager.DependencyMap.Samples.csproj @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/sdk/dependencymap/Azure.ResourceManager.DependencyMap/samples/Generated/Samples/Sample_DependencyMapCollection.cs b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/samples/Generated/Samples/Sample_DependencyMapCollection.cs new file mode 100644 index 000000000000..1ca98274bf10 --- /dev/null +++ b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/samples/Generated/Samples/Sample_DependencyMapCollection.cs @@ -0,0 +1,195 @@ +// 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.Resources; +using NUnit.Framework; + +namespace Azure.ResourceManager.DependencyMap.Samples +{ + public partial class Sample_DependencyMapCollection + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task CreateOrUpdate_MapsCreateOrUpdateGeneratedByMaximumSetRule() + { + // Generated from example definition: 2025-01-31-preview/Maps_CreateOrUpdate.json + // this example is just showing the usage of "MapsResource_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 = "D6E58BDB-45F1-41EC-A884-1FC945058848"; + string resourceGroupName = "rgdependencyMap"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this DependencyMapResource + DependencyMapCollection collection = resourceGroupResource.GetDependencyMaps(); + + // invoke the operation + string mapName = "mapsTest1"; + DependencyMapData data = new DependencyMapData(new AzureLocation("wjtzelgfcmswfeflfltwxqveo")) + { + Tags = { }, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, mapName, data); + DependencyMapResource 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 + DependencyMapData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Get_MapsGetGeneratedByMaximumSetRule() + { + // Generated from example definition: 2025-01-31-preview/Maps_Get.json + // this example is just showing the usage of "MapsResource_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 = "D6E58BDB-45F1-41EC-A884-1FC945058848"; + string resourceGroupName = "rgdependencyMap"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this DependencyMapResource + DependencyMapCollection collection = resourceGroupResource.GetDependencyMaps(); + + // invoke the operation + string mapName = "mapsTest1"; + DependencyMapResource result = await collection.GetAsync(mapName); + + // 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 + DependencyMapData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetAll_MapsListByResourceGroupGeneratedByMaximumSetRule() + { + // Generated from example definition: 2025-01-31-preview/Maps_ListByResourceGroup.json + // this example is just showing the usage of "MapsResource_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 = "D6E58BDB-45F1-41EC-A884-1FC945058848"; + string resourceGroupName = "rgdependencyMap"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this DependencyMapResource + DependencyMapCollection collection = resourceGroupResource.GetDependencyMaps(); + + // invoke the operation and iterate over the result + await foreach (DependencyMapResource 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 + DependencyMapData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Exists_MapsGetGeneratedByMaximumSetRule() + { + // Generated from example definition: 2025-01-31-preview/Maps_Get.json + // this example is just showing the usage of "MapsResource_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 = "D6E58BDB-45F1-41EC-A884-1FC945058848"; + string resourceGroupName = "rgdependencyMap"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this DependencyMapResource + DependencyMapCollection collection = resourceGroupResource.GetDependencyMaps(); + + // invoke the operation + string mapName = "mapsTest1"; + bool result = await collection.ExistsAsync(mapName); + + Console.WriteLine($"Succeeded: {result}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetIfExists_MapsGetGeneratedByMaximumSetRule() + { + // Generated from example definition: 2025-01-31-preview/Maps_Get.json + // this example is just showing the usage of "MapsResource_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 = "D6E58BDB-45F1-41EC-A884-1FC945058848"; + string resourceGroupName = "rgdependencyMap"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this DependencyMapResource + DependencyMapCollection collection = resourceGroupResource.GetDependencyMaps(); + + // invoke the operation + string mapName = "mapsTest1"; + NullableResponse response = await collection.GetIfExistsAsync(mapName); + DependencyMapResource 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 + DependencyMapData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + } +} diff --git a/sdk/dependencymap/Azure.ResourceManager.DependencyMap/samples/Generated/Samples/Sample_DependencyMapDiscoverySourceCollection.cs b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/samples/Generated/Samples/Sample_DependencyMapDiscoverySourceCollection.cs new file mode 100644 index 000000000000..6d0b6aa42c93 --- /dev/null +++ b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/samples/Generated/Samples/Sample_DependencyMapDiscoverySourceCollection.cs @@ -0,0 +1,199 @@ +// 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 NUnit.Framework; + +namespace Azure.ResourceManager.DependencyMap.Samples +{ + public partial class Sample_DependencyMapDiscoverySourceCollection + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task CreateOrUpdate_DiscoverySourcesCreateOrUpdateGeneratedByMaximumSetRule() + { + // Generated from example definition: 2025-01-31-preview/DiscoverySources_CreateOrUpdate.json + // this example is just showing the usage of "DiscoverySourceResource_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 DependencyMapResource created on azure + // for more information of creating DependencyMapResource, please refer to the document of DependencyMapResource + string subscriptionId = "D6E58BDB-45F1-41EC-A884-1FC945058848"; + string resourceGroupName = "rgdependencyMap"; + string mapName = "mapsTest1"; + ResourceIdentifier dependencyMapResourceId = DependencyMapResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, mapName); + DependencyMapResource dependencyMap = client.GetDependencyMapResource(dependencyMapResourceId); + + // get the collection of this DependencyMapDiscoverySourceResource + DependencyMapDiscoverySourceCollection collection = dependencyMap.GetDependencyMapDiscoverySources(); + + // invoke the operation + string sourceName = "sourceTest1"; + DependencyMapDiscoverySourceData data = new DependencyMapDiscoverySourceData(new AzureLocation("y")) + { + Tags = { }, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, sourceName, data); + DependencyMapDiscoverySourceResource 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 + DependencyMapDiscoverySourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Get_DiscoverySourcesGetGeneratedByMaximumSetRule() + { + // Generated from example definition: 2025-01-31-preview/DiscoverySources_Get.json + // this example is just showing the usage of "DiscoverySourceResource_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 DependencyMapResource created on azure + // for more information of creating DependencyMapResource, please refer to the document of DependencyMapResource + string subscriptionId = "D6E58BDB-45F1-41EC-A884-1FC945058848"; + string resourceGroupName = "rgdependencyMap"; + string mapName = "mapsTest1"; + ResourceIdentifier dependencyMapResourceId = DependencyMapResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, mapName); + DependencyMapResource dependencyMap = client.GetDependencyMapResource(dependencyMapResourceId); + + // get the collection of this DependencyMapDiscoverySourceResource + DependencyMapDiscoverySourceCollection collection = dependencyMap.GetDependencyMapDiscoverySources(); + + // invoke the operation + string sourceName = "sourceTest1"; + DependencyMapDiscoverySourceResource result = await collection.GetAsync(sourceName); + + // 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 + DependencyMapDiscoverySourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetAll_DiscoverySourcesListByMapsResourceGeneratedByMaximumSetRule() + { + // Generated from example definition: 2025-01-31-preview/DiscoverySources_ListByMapsResource.json + // this example is just showing the usage of "DiscoverySourceResource_ListByMapsResource" 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 DependencyMapResource created on azure + // for more information of creating DependencyMapResource, please refer to the document of DependencyMapResource + string subscriptionId = "D6E58BDB-45F1-41EC-A884-1FC945058848"; + string resourceGroupName = "rgdependencyMap"; + string mapName = "mapsTest1"; + ResourceIdentifier dependencyMapResourceId = DependencyMapResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, mapName); + DependencyMapResource dependencyMap = client.GetDependencyMapResource(dependencyMapResourceId); + + // get the collection of this DependencyMapDiscoverySourceResource + DependencyMapDiscoverySourceCollection collection = dependencyMap.GetDependencyMapDiscoverySources(); + + // invoke the operation and iterate over the result + await foreach (DependencyMapDiscoverySourceResource 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 + DependencyMapDiscoverySourceData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Exists_DiscoverySourcesGetGeneratedByMaximumSetRule() + { + // Generated from example definition: 2025-01-31-preview/DiscoverySources_Get.json + // this example is just showing the usage of "DiscoverySourceResource_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 DependencyMapResource created on azure + // for more information of creating DependencyMapResource, please refer to the document of DependencyMapResource + string subscriptionId = "D6E58BDB-45F1-41EC-A884-1FC945058848"; + string resourceGroupName = "rgdependencyMap"; + string mapName = "mapsTest1"; + ResourceIdentifier dependencyMapResourceId = DependencyMapResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, mapName); + DependencyMapResource dependencyMap = client.GetDependencyMapResource(dependencyMapResourceId); + + // get the collection of this DependencyMapDiscoverySourceResource + DependencyMapDiscoverySourceCollection collection = dependencyMap.GetDependencyMapDiscoverySources(); + + // invoke the operation + string sourceName = "sourceTest1"; + bool result = await collection.ExistsAsync(sourceName); + + Console.WriteLine($"Succeeded: {result}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetIfExists_DiscoverySourcesGetGeneratedByMaximumSetRule() + { + // Generated from example definition: 2025-01-31-preview/DiscoverySources_Get.json + // this example is just showing the usage of "DiscoverySourceResource_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 DependencyMapResource created on azure + // for more information of creating DependencyMapResource, please refer to the document of DependencyMapResource + string subscriptionId = "D6E58BDB-45F1-41EC-A884-1FC945058848"; + string resourceGroupName = "rgdependencyMap"; + string mapName = "mapsTest1"; + ResourceIdentifier dependencyMapResourceId = DependencyMapResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, mapName); + DependencyMapResource dependencyMap = client.GetDependencyMapResource(dependencyMapResourceId); + + // get the collection of this DependencyMapDiscoverySourceResource + DependencyMapDiscoverySourceCollection collection = dependencyMap.GetDependencyMapDiscoverySources(); + + // invoke the operation + string sourceName = "sourceTest1"; + NullableResponse response = await collection.GetIfExistsAsync(sourceName); + DependencyMapDiscoverySourceResource 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 + DependencyMapDiscoverySourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + } +} diff --git a/sdk/dependencymap/Azure.ResourceManager.DependencyMap/samples/Generated/Samples/Sample_DependencyMapDiscoverySourceResource.cs b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/samples/Generated/Samples/Sample_DependencyMapDiscoverySourceResource.cs new file mode 100644 index 000000000000..8bdbe18c88bf --- /dev/null +++ b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/samples/Generated/Samples/Sample_DependencyMapDiscoverySourceResource.cs @@ -0,0 +1,113 @@ +// 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.DependencyMap.Models; +using NUnit.Framework; + +namespace Azure.ResourceManager.DependencyMap.Samples +{ + public partial class Sample_DependencyMapDiscoverySourceResource + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Get_DiscoverySourcesGetGeneratedByMaximumSetRule() + { + // Generated from example definition: 2025-01-31-preview/DiscoverySources_Get.json + // this example is just showing the usage of "DiscoverySourceResource_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 DependencyMapDiscoverySourceResource created on azure + // for more information of creating DependencyMapDiscoverySourceResource, please refer to the document of DependencyMapDiscoverySourceResource + string subscriptionId = "D6E58BDB-45F1-41EC-A884-1FC945058848"; + string resourceGroupName = "rgdependencyMap"; + string mapName = "mapsTest1"; + string sourceName = "sourceTest1"; + ResourceIdentifier dependencyMapDiscoverySourceResourceId = DependencyMapDiscoverySourceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, mapName, sourceName); + DependencyMapDiscoverySourceResource dependencyMapDiscoverySource = client.GetDependencyMapDiscoverySourceResource(dependencyMapDiscoverySourceResourceId); + + // invoke the operation + DependencyMapDiscoverySourceResource result = await dependencyMapDiscoverySource.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 + DependencyMapDiscoverySourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Delete_DiscoverySourcesDeleteGeneratedByMaximumSetRule() + { + // Generated from example definition: 2025-01-31-preview/DiscoverySources_Delete.json + // this example is just showing the usage of "DiscoverySourceResource_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 DependencyMapDiscoverySourceResource created on azure + // for more information of creating DependencyMapDiscoverySourceResource, please refer to the document of DependencyMapDiscoverySourceResource + string subscriptionId = "D6E58BDB-45F1-41EC-A884-1FC945058848"; + string resourceGroupName = "rgdependencyMap"; + string mapName = "mapsTest1"; + string sourceName = "sourceTest1"; + ResourceIdentifier dependencyMapDiscoverySourceResourceId = DependencyMapDiscoverySourceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, mapName, sourceName); + DependencyMapDiscoverySourceResource dependencyMapDiscoverySource = client.GetDependencyMapDiscoverySourceResource(dependencyMapDiscoverySourceResourceId); + + // invoke the operation + await dependencyMapDiscoverySource.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Update_DiscoverySourcesUpdateGeneratedByMaximumSetRule() + { + // Generated from example definition: 2025-01-31-preview/DiscoverySources_Update.json + // this example is just showing the usage of "DiscoverySourceResource_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 DependencyMapDiscoverySourceResource created on azure + // for more information of creating DependencyMapDiscoverySourceResource, please refer to the document of DependencyMapDiscoverySourceResource + string subscriptionId = "D6E58BDB-45F1-41EC-A884-1FC945058848"; + string resourceGroupName = "rgdependencyMap"; + string mapName = "mapsTest1"; + string sourceName = "sourceTest1"; + ResourceIdentifier dependencyMapDiscoverySourceResourceId = DependencyMapDiscoverySourceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, mapName, sourceName); + DependencyMapDiscoverySourceResource dependencyMapDiscoverySource = client.GetDependencyMapDiscoverySourceResource(dependencyMapDiscoverySourceResourceId); + + // invoke the operation + DependencyMapDiscoverySourcePatch patch = new DependencyMapDiscoverySourcePatch + { + Tags = { }, + }; + ArmOperation lro = await dependencyMapDiscoverySource.UpdateAsync(WaitUntil.Completed, patch); + DependencyMapDiscoverySourceResource 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 + DependencyMapDiscoverySourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/dependencymap/Azure.ResourceManager.DependencyMap/samples/Generated/Samples/Sample_DependencyMapResource.cs b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/samples/Generated/Samples/Sample_DependencyMapResource.cs new file mode 100644 index 000000000000..60b26934f3b6 --- /dev/null +++ b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/samples/Generated/Samples/Sample_DependencyMapResource.cs @@ -0,0 +1,262 @@ +// 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.DependencyMap.Models; +using NUnit.Framework; + +namespace Azure.ResourceManager.DependencyMap.Samples +{ + public partial class Sample_DependencyMapResource + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Get_MapsGetGeneratedByMaximumSetRule() + { + // Generated from example definition: 2025-01-31-preview/Maps_Get.json + // this example is just showing the usage of "MapsResource_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 DependencyMapResource created on azure + // for more information of creating DependencyMapResource, please refer to the document of DependencyMapResource + string subscriptionId = "D6E58BDB-45F1-41EC-A884-1FC945058848"; + string resourceGroupName = "rgdependencyMap"; + string mapName = "mapsTest1"; + ResourceIdentifier dependencyMapResourceId = DependencyMapResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, mapName); + DependencyMapResource dependencyMap = client.GetDependencyMapResource(dependencyMapResourceId); + + // invoke the operation + DependencyMapResource result = await dependencyMap.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 + DependencyMapData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Delete_MapsDeleteGeneratedByMaximumSetRule() + { + // Generated from example definition: 2025-01-31-preview/Maps_Delete.json + // this example is just showing the usage of "MapsResource_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 DependencyMapResource created on azure + // for more information of creating DependencyMapResource, please refer to the document of DependencyMapResource + string subscriptionId = "D6E58BDB-45F1-41EC-A884-1FC945058848"; + string resourceGroupName = "rgdependencyMap"; + string mapName = "mapsTest1"; + ResourceIdentifier dependencyMapResourceId = DependencyMapResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, mapName); + DependencyMapResource dependencyMap = client.GetDependencyMapResource(dependencyMapResourceId); + + // invoke the operation + await dependencyMap.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Update_MapsUpdateGeneratedByMaximumSetRule() + { + // Generated from example definition: 2025-01-31-preview/Maps_Update.json + // this example is just showing the usage of "MapsResource_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 DependencyMapResource created on azure + // for more information of creating DependencyMapResource, please refer to the document of DependencyMapResource + string subscriptionId = "D6E58BDB-45F1-41EC-A884-1FC945058848"; + string resourceGroupName = "rgdependencyMap"; + string mapName = "mapsTest1"; + ResourceIdentifier dependencyMapResourceId = DependencyMapResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, mapName); + DependencyMapResource dependencyMap = client.GetDependencyMapResource(dependencyMapResourceId); + + // invoke the operation + DependencyMapPatch patch = new DependencyMapPatch + { + Tags = { }, + }; + ArmOperation lro = await dependencyMap.UpdateAsync(WaitUntil.Completed, patch); + DependencyMapResource 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 + DependencyMapData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetDependencyViewForFocusedMachine_MapsGetDependencyViewForFocusedMachineGeneratedByMaximumSetRule() + { + // Generated from example definition: 2025-01-31-preview/Maps_GetDependencyViewForFocusedMachine.json + // this example is just showing the usage of "Maps_GetDependencyViewForFocusedMachine" 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 DependencyMapResource created on azure + // for more information of creating DependencyMapResource, please refer to the document of DependencyMapResource + string subscriptionId = "D6E58BDB-45F1-41EC-A884-1FC945058848"; + string resourceGroupName = "rgdependencyMap"; + string mapName = "mapsTest1"; + ResourceIdentifier dependencyMapResourceId = DependencyMapResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, mapName); + DependencyMapResource dependencyMap = client.GetDependencyMapResource(dependencyMapResourceId); + + // invoke the operation + GetDependencyViewForFocusedMachineContent content = new GetDependencyViewForFocusedMachineContent(new ResourceIdentifier("imzykeisagngrnfinbqtu")) + { + Filters = new DependencyMapVisualizationFilter + { + DateTime = new DependencyMapDateTimeFilter + { + StartOn = DateTimeOffset.Parse("2024-03-29T07:35:15.336Z"), + EndOn = DateTimeOffset.Parse("2024-03-29T07:35:15.336Z"), + }, + ProcessNameFilter = new DependencyMapProcessNameFilter(DependencyMapProcessNameFilterOperator.Contains, new string[] { "mnqtvduwzemjcvvmnnoqvcuemwhnz" }), + }, + }; + await dependencyMap.GetDependencyViewForFocusedMachineAsync(WaitUntil.Completed, content); + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetConnectionsWithConnectedMachineForFocusedMachine_MapsGetConnectionsWithConnectedMachineForFocusedMachineGeneratedByMaximumSetRule() + { + // Generated from example definition: 2025-01-31-preview/Maps_GetConnectionsWithConnectedMachineForFocusedMachine.json + // this example is just showing the usage of "Maps_GetConnectionsWithConnectedMachineForFocusedMachine" 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 DependencyMapResource created on azure + // for more information of creating DependencyMapResource, please refer to the document of DependencyMapResource + string subscriptionId = "D6E58BDB-45F1-41EC-A884-1FC945058848"; + string resourceGroupName = "rgdependencyMap"; + string mapName = "mapsTest1"; + ResourceIdentifier dependencyMapResourceId = DependencyMapResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, mapName); + DependencyMapResource dependencyMap = client.GetDependencyMapResource(dependencyMapResourceId); + + // invoke the operation + GetConnectionsWithConnectedMachineForFocusedMachineContent content = new GetConnectionsWithConnectedMachineForFocusedMachineContent(new ResourceIdentifier("gagovctcfgocievqwq"), new ResourceIdentifier("enaieiloylabljxzvmyrshp")) + { + Filters = new DependencyMapVisualizationFilter + { + DateTime = new DependencyMapDateTimeFilter + { + StartOn = DateTimeOffset.Parse("2024-03-29T07:35:15.336Z"), + EndOn = DateTimeOffset.Parse("2024-03-29T07:35:15.336Z"), + }, + ProcessNameFilter = new DependencyMapProcessNameFilter(DependencyMapProcessNameFilterOperator.Contains, new string[] { "mnqtvduwzemjcvvmnnoqvcuemwhnz" }), + }, + }; + await dependencyMap.GetConnectionsWithConnectedMachineForFocusedMachineAsync(WaitUntil.Completed, content); + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetConnectionsForProcessOnFocusedMachine_MapsGetConnectionsForProcessOnFocusedMachineGeneratedByMaximumSetRule() + { + // Generated from example definition: 2025-01-31-preview/Maps_GetConnectionsForProcessOnFocusedMachine.json + // this example is just showing the usage of "Maps_GetConnectionsForProcessOnFocusedMachine" 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 DependencyMapResource created on azure + // for more information of creating DependencyMapResource, please refer to the document of DependencyMapResource + string subscriptionId = "D6E58BDB-45F1-41EC-A884-1FC945058848"; + string resourceGroupName = "rgdependencyMap"; + string mapName = "mapsTest1"; + ResourceIdentifier dependencyMapResourceId = DependencyMapResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, mapName); + DependencyMapResource dependencyMap = client.GetDependencyMapResource(dependencyMapResourceId); + + // invoke the operation + GetConnectionsForProcessOnFocusedMachineContent content = new GetConnectionsForProcessOnFocusedMachineContent(new ResourceIdentifier("abjy"), "yzldgsfupsfvzlztqoqpiv") + { + Filters = new DependencyMapVisualizationFilter + { + DateTime = new DependencyMapDateTimeFilter + { + StartOn = DateTimeOffset.Parse("2024-03-29T07:35:15.336Z"), + EndOn = DateTimeOffset.Parse("2024-03-29T07:35:15.336Z"), + }, + ProcessNameFilter = new DependencyMapProcessNameFilter(DependencyMapProcessNameFilterOperator.Contains, new string[] { "mnqtvduwzemjcvvmnnoqvcuemwhnz" }), + }, + }; + await dependencyMap.GetConnectionsForProcessOnFocusedMachineAsync(WaitUntil.Completed, content); + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task ExportDependencies_MapsExportDependenciesGeneratedByMaximumSetRule() + { + // Generated from example definition: 2025-01-31-preview/Maps_ExportDependencies.json + // this example is just showing the usage of "Maps_ExportDependencies" 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 DependencyMapResource created on azure + // for more information of creating DependencyMapResource, please refer to the document of DependencyMapResource + string subscriptionId = "D6E58BDB-45F1-41EC-A884-1FC945058848"; + string resourceGroupName = "rgdependencyMap"; + string mapName = "mapsTest1"; + ResourceIdentifier dependencyMapResourceId = DependencyMapResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, mapName); + DependencyMapResource dependencyMap = client.GetDependencyMapResource(dependencyMapResourceId); + + // invoke the operation + ExportDependenciesContent content = new ExportDependenciesContent(new ResourceIdentifier("qzjpilzxpurauwfwwanpiiafvz")) + { + Filters = new DependencyMapVisualizationFilter + { + DateTime = new DependencyMapDateTimeFilter + { + StartOn = DateTimeOffset.Parse("2024-03-29T07:35:15.336Z"), + EndOn = DateTimeOffset.Parse("2024-03-29T07:35:15.336Z"), + }, + ProcessNameFilter = new DependencyMapProcessNameFilter(DependencyMapProcessNameFilterOperator.Contains, new string[] { "mnqtvduwzemjcvvmnnoqvcuemwhnz" }), + }, + }; + await dependencyMap.ExportDependenciesAsync(WaitUntil.Completed, content); + + Console.WriteLine("Succeeded"); + } + } +} diff --git a/sdk/dependencymap/Azure.ResourceManager.DependencyMap/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs new file mode 100644 index 000000000000..f48aaa22a3b0 --- /dev/null +++ b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs @@ -0,0 +1,50 @@ +// 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.Resources; +using NUnit.Framework; + +namespace Azure.ResourceManager.DependencyMap.Samples +{ + public partial class Sample_SubscriptionResourceExtensions + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetDependencyMaps_MapsListBySubscriptionGeneratedByMaximumSetRule() + { + // Generated from example definition: 2025-01-31-preview/Maps_ListBySubscription.json + // this example is just showing the usage of "MapsResource_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 = "D6E58BDB-45F1-41EC-A884-1FC945058848"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // invoke the operation and iterate over the result + await foreach (DependencyMapResource item in subscriptionResource.GetDependencyMapsAsync()) + { + // 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 + DependencyMapData 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/dependencymap/Azure.ResourceManager.DependencyMap/src/Azure.ResourceManager.DependencyMap.csproj b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Azure.ResourceManager.DependencyMap.csproj new file mode 100644 index 000000000000..1101056c65ac --- /dev/null +++ b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Azure.ResourceManager.DependencyMap.csproj @@ -0,0 +1,8 @@ + + + Azure Resource Manager client SDK for Azure resource provider DependencyMap. + 1.0.0-beta.1 + azure;management;arm;resource manager;dependencymap + Azure.ResourceManager.DependencyMap + + diff --git a/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/ArmDependencyMapModelFactory.cs b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/ArmDependencyMapModelFactory.cs new file mode 100644 index 000000000000..06cad37f43a7 --- /dev/null +++ b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/ArmDependencyMapModelFactory.cs @@ -0,0 +1,128 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; +using Azure.Core; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.DependencyMap.Models +{ + /// Model factory for models. + public static partial class ArmDependencyMapModelFactory + { + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The tags. + /// The location. + /// The resource-specific properties for this resource. + /// A new instance for mocking. + public static DependencyMapData DependencyMapData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, DependencyMapProvisioningState? dependencyMapProvisioningState = null) + { + tags ??= new Dictionary(); + + return new DependencyMapData( + id, + name, + resourceType, + systemData, + tags, + location, + dependencyMapProvisioningState != null ? new DependencyMapProperties(dependencyMapProvisioningState, serializedAdditionalRawData: null) : null, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Machine arm id. + /// Filters for GetSingleMachineDependencyView. + /// A new instance for mocking. + public static GetDependencyViewForFocusedMachineContent GetDependencyViewForFocusedMachineContent(ResourceIdentifier focusedMachineId = null, DependencyMapVisualizationFilter filters = null) + { + return new GetDependencyViewForFocusedMachineContent(focusedMachineId, filters, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Source machine arm id. + /// Destination machine arm id. + /// Filters for GetNetworkConnectionsBetweenMachines. + /// A new instance for mocking. + public static GetConnectionsWithConnectedMachineForFocusedMachineContent GetConnectionsWithConnectedMachineForFocusedMachineContent(ResourceIdentifier focusedMachineId = null, ResourceIdentifier connectedMachineId = null, DependencyMapVisualizationFilter filters = null) + { + return new GetConnectionsWithConnectedMachineForFocusedMachineContent(focusedMachineId, connectedMachineId, filters, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Machine arm id. + /// Process id. + /// Filters for GetProcessNetworkConnections. + /// A new instance for mocking. + public static GetConnectionsForProcessOnFocusedMachineContent GetConnectionsForProcessOnFocusedMachineContent(ResourceIdentifier focusedMachineId = null, string processIdOnFocusedMachine = null, DependencyMapVisualizationFilter filters = null) + { + return new GetConnectionsForProcessOnFocusedMachineContent(focusedMachineId, processIdOnFocusedMachine, filters, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Machine arm id. + /// Filters for ExportDependencies. + /// A new instance for mocking. + public static ExportDependenciesContent ExportDependenciesContent(ResourceIdentifier focusedMachineId = null, DependencyMapVisualizationFilter filters = null) + { + return new ExportDependenciesContent(focusedMachineId, filters, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The tags. + /// The location. + /// + /// The resource-specific properties for this resource. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include . + /// + /// A new instance for mocking. + public static DependencyMapDiscoverySourceData DependencyMapDiscoverySourceData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, DependencyMapDiscoverySourceProperties properties = null) + { + tags ??= new Dictionary(); + + return new DependencyMapDiscoverySourceData( + id, + name, + resourceType, + systemData, + tags, + location, + properties, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Provisioning state of Discovery Source resource. + /// Source type of Discovery Source resource. + /// Source ArmId of Discovery Source resource. + /// A new instance for mocking. + public static DependencyMapDiscoverySourceProperties DependencyMapDiscoverySourceProperties(DependencyMapProvisioningState? provisioningState = null, string sourceType = null, ResourceIdentifier sourceId = null) + { + return new UnknownDependencyMapDiscoverySourceProperties(provisioningState, sourceType == null ? default : new SourceType(sourceType), sourceId, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Provisioning state of Discovery Source resource. + /// Source ArmId of Discovery Source resource. + /// A new instance for mocking. + public static OffAzureDiscoverySourceProperties OffAzureDiscoverySourceProperties(DependencyMapProvisioningState? provisioningState = null, ResourceIdentifier sourceId = null) + { + return new OffAzureDiscoverySourceProperties(provisioningState, SourceType.OffAzure, sourceId, serializedAdditionalRawData: null); + } + } +} diff --git a/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/DependencyMapCollection.cs b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/DependencyMapCollection.cs new file mode 100644 index 000000000000..7584d19fab44 --- /dev/null +++ b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/DependencyMapCollection.cs @@ -0,0 +1,494 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.DependencyMap +{ + /// + /// 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 GetDependencyMaps method from an instance of . + /// + public partial class DependencyMapCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _dependencyMapMapsClientDiagnostics; + private readonly MapsRestOperations _dependencyMapMapsRestClient; + + /// Initializes a new instance of the class for mocking. + protected DependencyMapCollection() + { + } + + /// 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 DependencyMapCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _dependencyMapMapsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DependencyMap", DependencyMapResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(DependencyMapResource.ResourceType, out string dependencyMapMapsApiVersion); + _dependencyMapMapsRestClient = new MapsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, dependencyMapMapsApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceGroupResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceGroupResource.ResourceType), nameof(id)); + } + + /// + /// Create a MapsResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DependencyMap/maps/{mapName} + /// + /// + /// Operation Id + /// MapsResource_CreateOrUpdate + /// + /// + /// Default Api Version + /// 2025-01-31-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Maps resource name. + /// Resource create parameters. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string mapName, DependencyMapData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(mapName, nameof(mapName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _dependencyMapMapsClientDiagnostics.CreateScope("DependencyMapCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _dependencyMapMapsRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, mapName, data, cancellationToken).ConfigureAwait(false); + var operation = new DependencyMapArmOperation(new DependencyMapOperationSource(Client), _dependencyMapMapsClientDiagnostics, Pipeline, _dependencyMapMapsRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, mapName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Create a MapsResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DependencyMap/maps/{mapName} + /// + /// + /// Operation Id + /// MapsResource_CreateOrUpdate + /// + /// + /// Default Api Version + /// 2025-01-31-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Maps resource name. + /// Resource create parameters. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string mapName, DependencyMapData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(mapName, nameof(mapName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _dependencyMapMapsClientDiagnostics.CreateScope("DependencyMapCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _dependencyMapMapsRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, mapName, data, cancellationToken); + var operation = new DependencyMapArmOperation(new DependencyMapOperationSource(Client), _dependencyMapMapsClientDiagnostics, Pipeline, _dependencyMapMapsRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, mapName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a MapsResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DependencyMap/maps/{mapName} + /// + /// + /// Operation Id + /// MapsResource_Get + /// + /// + /// Default Api Version + /// 2025-01-31-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Maps resource name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string mapName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(mapName, nameof(mapName)); + + using var scope = _dependencyMapMapsClientDiagnostics.CreateScope("DependencyMapCollection.Get"); + scope.Start(); + try + { + var response = await _dependencyMapMapsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, mapName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DependencyMapResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a MapsResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DependencyMap/maps/{mapName} + /// + /// + /// Operation Id + /// MapsResource_Get + /// + /// + /// Default Api Version + /// 2025-01-31-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Maps resource name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string mapName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(mapName, nameof(mapName)); + + using var scope = _dependencyMapMapsClientDiagnostics.CreateScope("DependencyMapCollection.Get"); + scope.Start(); + try + { + var response = _dependencyMapMapsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, mapName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DependencyMapResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// List MapsResource resources by resource group + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DependencyMap/maps + /// + /// + /// Operation Id + /// MapsResource_ListByResourceGroup + /// + /// + /// Default Api Version + /// 2025-01-31-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _dependencyMapMapsRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _dependencyMapMapsRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DependencyMapResource(Client, DependencyMapData.DeserializeDependencyMapData(e)), _dependencyMapMapsClientDiagnostics, Pipeline, "DependencyMapCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// List MapsResource resources by resource group + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DependencyMap/maps + /// + /// + /// Operation Id + /// MapsResource_ListByResourceGroup + /// + /// + /// Default Api Version + /// 2025-01-31-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _dependencyMapMapsRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _dependencyMapMapsRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DependencyMapResource(Client, DependencyMapData.DeserializeDependencyMapData(e)), _dependencyMapMapsClientDiagnostics, Pipeline, "DependencyMapCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DependencyMap/maps/{mapName} + /// + /// + /// Operation Id + /// MapsResource_Get + /// + /// + /// Default Api Version + /// 2025-01-31-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Maps resource name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string mapName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(mapName, nameof(mapName)); + + using var scope = _dependencyMapMapsClientDiagnostics.CreateScope("DependencyMapCollection.Exists"); + scope.Start(); + try + { + var response = await _dependencyMapMapsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, mapName, 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.DependencyMap/maps/{mapName} + /// + /// + /// Operation Id + /// MapsResource_Get + /// + /// + /// Default Api Version + /// 2025-01-31-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Maps resource name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string mapName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(mapName, nameof(mapName)); + + using var scope = _dependencyMapMapsClientDiagnostics.CreateScope("DependencyMapCollection.Exists"); + scope.Start(); + try + { + var response = _dependencyMapMapsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, mapName, 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.DependencyMap/maps/{mapName} + /// + /// + /// Operation Id + /// MapsResource_Get + /// + /// + /// Default Api Version + /// 2025-01-31-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Maps resource name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string mapName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(mapName, nameof(mapName)); + + using var scope = _dependencyMapMapsClientDiagnostics.CreateScope("DependencyMapCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _dependencyMapMapsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, mapName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DependencyMapResource(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.DependencyMap/maps/{mapName} + /// + /// + /// Operation Id + /// MapsResource_Get + /// + /// + /// Default Api Version + /// 2025-01-31-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Maps resource name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string mapName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(mapName, nameof(mapName)); + + using var scope = _dependencyMapMapsClientDiagnostics.CreateScope("DependencyMapCollection.GetIfExists"); + scope.Start(); + try + { + var response = _dependencyMapMapsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, mapName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DependencyMapResource(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/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/DependencyMapData.Serialization.cs b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/DependencyMapData.Serialization.cs new file mode 100644 index 000000000000..cdfcc6ce6e7e --- /dev/null +++ b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/DependencyMapData.Serialization.cs @@ -0,0 +1,178 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.DependencyMap.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.DependencyMap +{ + public partial class DependencyMapData : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DependencyMapData)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); + } + } + + DependencyMapData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DependencyMapData)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDependencyMapData(document.RootElement, options); + } + + internal static DependencyMapData DeserializeDependencyMapData(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + DependencyMapProperties properties = default; + IDictionary tags = default; + AzureLocation location = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + SystemData systemData = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = DependencyMapProperties.DeserializeDependencyMapProperties(property.Value, options); + continue; + } + if (property.NameEquals("tags"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (property.NameEquals("location"u8)) + { + location = new AzureLocation(property.Value.GetString()); + continue; + } + if (property.NameEquals("id"u8)) + { + id = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new ResourceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("systemData"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DependencyMapData( + id, + name, + type, + systemData, + tags ?? new ChangeTrackingDictionary(), + location, + properties, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerDependencyMapContext.Default); + default: + throw new FormatException($"The model {nameof(DependencyMapData)} does not support writing '{options.Format}' format."); + } + } + + DependencyMapData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeDependencyMapData(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DependencyMapData)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/DependencyMapData.cs b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/DependencyMapData.cs new file mode 100644 index 000000000000..0244b57213e8 --- /dev/null +++ b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/DependencyMapData.cs @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.DependencyMap.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.DependencyMap +{ + /// + /// A class representing the DependencyMap data model. + /// A Maps resource + /// + public partial class DependencyMapData : TrackedResourceData + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The location. + public DependencyMapData(AzureLocation location) : base(location) + { + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The tags. + /// The location. + /// The resource-specific properties for this resource. + /// Keeps track of any properties unknown to the library. + internal DependencyMapData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, DependencyMapProperties properties, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) + { + Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DependencyMapData() + { + } + + /// The resource-specific properties for this resource. + internal DependencyMapProperties Properties { get; set; } + /// Provisioning state of Maps resource. + public DependencyMapProvisioningState? DependencyMapProvisioningState + { + get => Properties is null ? default : Properties.ProvisioningState; + } + } +} diff --git a/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/DependencyMapDiscoverySourceCollection.cs b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/DependencyMapDiscoverySourceCollection.cs new file mode 100644 index 000000000000..40a9499f83e8 --- /dev/null +++ b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/DependencyMapDiscoverySourceCollection.cs @@ -0,0 +1,493 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.DependencyMap +{ + /// + /// 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 GetDependencyMapDiscoverySources method from an instance of . + /// + public partial class DependencyMapDiscoverySourceCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _dependencyMapDiscoverySourceDiscoverySourcesClientDiagnostics; + private readonly DiscoverySourcesRestOperations _dependencyMapDiscoverySourceDiscoverySourcesRestClient; + + /// Initializes a new instance of the class for mocking. + protected DependencyMapDiscoverySourceCollection() + { + } + + /// 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 DependencyMapDiscoverySourceCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _dependencyMapDiscoverySourceDiscoverySourcesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DependencyMap", DependencyMapDiscoverySourceResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(DependencyMapDiscoverySourceResource.ResourceType, out string dependencyMapDiscoverySourceDiscoverySourcesApiVersion); + _dependencyMapDiscoverySourceDiscoverySourcesRestClient = new DiscoverySourcesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, dependencyMapDiscoverySourceDiscoverySourcesApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != DependencyMapResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, DependencyMapResource.ResourceType), nameof(id)); + } + + /// + /// Create a DiscoverySourceResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DependencyMap/maps/{mapName}/discoverySources/{sourceName} + /// + /// + /// Operation Id + /// DiscoverySourceResource_CreateOrUpdate + /// + /// + /// Default Api Version + /// 2025-01-31-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// discovery source resource. + /// Resource create parameters. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string sourceName, DependencyMapDiscoverySourceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(sourceName, nameof(sourceName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _dependencyMapDiscoverySourceDiscoverySourcesClientDiagnostics.CreateScope("DependencyMapDiscoverySourceCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _dependencyMapDiscoverySourceDiscoverySourcesRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, sourceName, data, cancellationToken).ConfigureAwait(false); + var operation = new DependencyMapArmOperation(new DependencyMapDiscoverySourceOperationSource(Client), _dependencyMapDiscoverySourceDiscoverySourcesClientDiagnostics, Pipeline, _dependencyMapDiscoverySourceDiscoverySourcesRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, sourceName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Create a DiscoverySourceResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DependencyMap/maps/{mapName}/discoverySources/{sourceName} + /// + /// + /// Operation Id + /// DiscoverySourceResource_CreateOrUpdate + /// + /// + /// Default Api Version + /// 2025-01-31-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// discovery source resource. + /// Resource create parameters. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string sourceName, DependencyMapDiscoverySourceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(sourceName, nameof(sourceName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _dependencyMapDiscoverySourceDiscoverySourcesClientDiagnostics.CreateScope("DependencyMapDiscoverySourceCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _dependencyMapDiscoverySourceDiscoverySourcesRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, sourceName, data, cancellationToken); + var operation = new DependencyMapArmOperation(new DependencyMapDiscoverySourceOperationSource(Client), _dependencyMapDiscoverySourceDiscoverySourcesClientDiagnostics, Pipeline, _dependencyMapDiscoverySourceDiscoverySourcesRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, sourceName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a DiscoverySourceResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DependencyMap/maps/{mapName}/discoverySources/{sourceName} + /// + /// + /// Operation Id + /// DiscoverySourceResource_Get + /// + /// + /// Default Api Version + /// 2025-01-31-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// discovery source 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 sourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(sourceName, nameof(sourceName)); + + using var scope = _dependencyMapDiscoverySourceDiscoverySourcesClientDiagnostics.CreateScope("DependencyMapDiscoverySourceCollection.Get"); + scope.Start(); + try + { + var response = await _dependencyMapDiscoverySourceDiscoverySourcesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, sourceName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DependencyMapDiscoverySourceResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a DiscoverySourceResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DependencyMap/maps/{mapName}/discoverySources/{sourceName} + /// + /// + /// Operation Id + /// DiscoverySourceResource_Get + /// + /// + /// Default Api Version + /// 2025-01-31-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// discovery source resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string sourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(sourceName, nameof(sourceName)); + + using var scope = _dependencyMapDiscoverySourceDiscoverySourcesClientDiagnostics.CreateScope("DependencyMapDiscoverySourceCollection.Get"); + scope.Start(); + try + { + var response = _dependencyMapDiscoverySourceDiscoverySourcesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, sourceName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DependencyMapDiscoverySourceResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// List DiscoverySourceResource resources by MapsResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DependencyMap/maps/{mapName}/discoverySources + /// + /// + /// Operation Id + /// DiscoverySourceResource_ListByMapsResource + /// + /// + /// Default Api Version + /// 2025-01-31-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _dependencyMapDiscoverySourceDiscoverySourcesRestClient.CreateListByMapsResourceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _dependencyMapDiscoverySourceDiscoverySourcesRestClient.CreateListByMapsResourceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DependencyMapDiscoverySourceResource(Client, DependencyMapDiscoverySourceData.DeserializeDependencyMapDiscoverySourceData(e)), _dependencyMapDiscoverySourceDiscoverySourcesClientDiagnostics, Pipeline, "DependencyMapDiscoverySourceCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// List DiscoverySourceResource resources by MapsResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DependencyMap/maps/{mapName}/discoverySources + /// + /// + /// Operation Id + /// DiscoverySourceResource_ListByMapsResource + /// + /// + /// Default Api Version + /// 2025-01-31-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _dependencyMapDiscoverySourceDiscoverySourcesRestClient.CreateListByMapsResourceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _dependencyMapDiscoverySourceDiscoverySourcesRestClient.CreateListByMapsResourceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DependencyMapDiscoverySourceResource(Client, DependencyMapDiscoverySourceData.DeserializeDependencyMapDiscoverySourceData(e)), _dependencyMapDiscoverySourceDiscoverySourcesClientDiagnostics, Pipeline, "DependencyMapDiscoverySourceCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DependencyMap/maps/{mapName}/discoverySources/{sourceName} + /// + /// + /// Operation Id + /// DiscoverySourceResource_Get + /// + /// + /// Default Api Version + /// 2025-01-31-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// discovery source 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 sourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(sourceName, nameof(sourceName)); + + using var scope = _dependencyMapDiscoverySourceDiscoverySourcesClientDiagnostics.CreateScope("DependencyMapDiscoverySourceCollection.Exists"); + scope.Start(); + try + { + var response = await _dependencyMapDiscoverySourceDiscoverySourcesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, sourceName, 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.DependencyMap/maps/{mapName}/discoverySources/{sourceName} + /// + /// + /// Operation Id + /// DiscoverySourceResource_Get + /// + /// + /// Default Api Version + /// 2025-01-31-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// discovery source resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string sourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(sourceName, nameof(sourceName)); + + using var scope = _dependencyMapDiscoverySourceDiscoverySourcesClientDiagnostics.CreateScope("DependencyMapDiscoverySourceCollection.Exists"); + scope.Start(); + try + { + var response = _dependencyMapDiscoverySourceDiscoverySourcesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, sourceName, 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.DependencyMap/maps/{mapName}/discoverySources/{sourceName} + /// + /// + /// Operation Id + /// DiscoverySourceResource_Get + /// + /// + /// Default Api Version + /// 2025-01-31-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// discovery source 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 sourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(sourceName, nameof(sourceName)); + + using var scope = _dependencyMapDiscoverySourceDiscoverySourcesClientDiagnostics.CreateScope("DependencyMapDiscoverySourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _dependencyMapDiscoverySourceDiscoverySourcesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, sourceName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DependencyMapDiscoverySourceResource(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.DependencyMap/maps/{mapName}/discoverySources/{sourceName} + /// + /// + /// Operation Id + /// DiscoverySourceResource_Get + /// + /// + /// Default Api Version + /// 2025-01-31-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// discovery source resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string sourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(sourceName, nameof(sourceName)); + + using var scope = _dependencyMapDiscoverySourceDiscoverySourcesClientDiagnostics.CreateScope("DependencyMapDiscoverySourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = _dependencyMapDiscoverySourceDiscoverySourcesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, sourceName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DependencyMapDiscoverySourceResource(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/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/DependencyMapDiscoverySourceData.Serialization.cs b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/DependencyMapDiscoverySourceData.Serialization.cs new file mode 100644 index 000000000000..66bafb289c19 --- /dev/null +++ b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/DependencyMapDiscoverySourceData.Serialization.cs @@ -0,0 +1,178 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.DependencyMap.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.DependencyMap +{ + public partial class DependencyMapDiscoverySourceData : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DependencyMapDiscoverySourceData)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); + } + } + + DependencyMapDiscoverySourceData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DependencyMapDiscoverySourceData)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDependencyMapDiscoverySourceData(document.RootElement, options); + } + + internal static DependencyMapDiscoverySourceData DeserializeDependencyMapDiscoverySourceData(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + DependencyMapDiscoverySourceProperties properties = default; + IDictionary tags = default; + AzureLocation location = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + SystemData systemData = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = DependencyMapDiscoverySourceProperties.DeserializeDependencyMapDiscoverySourceProperties(property.Value, options); + continue; + } + if (property.NameEquals("tags"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (property.NameEquals("location"u8)) + { + location = new AzureLocation(property.Value.GetString()); + continue; + } + if (property.NameEquals("id"u8)) + { + id = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new ResourceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("systemData"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DependencyMapDiscoverySourceData( + id, + name, + type, + systemData, + tags ?? new ChangeTrackingDictionary(), + location, + properties, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerDependencyMapContext.Default); + default: + throw new FormatException($"The model {nameof(DependencyMapDiscoverySourceData)} does not support writing '{options.Format}' format."); + } + } + + DependencyMapDiscoverySourceData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeDependencyMapDiscoverySourceData(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DependencyMapDiscoverySourceData)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/DependencyMapDiscoverySourceData.cs b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/DependencyMapDiscoverySourceData.cs new file mode 100644 index 000000000000..610fdccec3e7 --- /dev/null +++ b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/DependencyMapDiscoverySourceData.cs @@ -0,0 +1,91 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.DependencyMap.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.DependencyMap +{ + /// + /// A class representing the DependencyMapDiscoverySource data model. + /// A Discovery Source resource + /// + public partial class DependencyMapDiscoverySourceData : TrackedResourceData + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The location. + public DependencyMapDiscoverySourceData(AzureLocation location) : base(location) + { + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The tags. + /// The location. + /// + /// The resource-specific properties for this resource. + /// 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 . + /// + /// Keeps track of any properties unknown to the library. + internal DependencyMapDiscoverySourceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, DependencyMapDiscoverySourceProperties properties, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) + { + Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DependencyMapDiscoverySourceData() + { + } + + /// + /// The resource-specific properties for this resource. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include . + /// + public DependencyMapDiscoverySourceProperties Properties { get; set; } + } +} diff --git a/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/DependencyMapDiscoverySourceResource.Serialization.cs b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/DependencyMapDiscoverySourceResource.Serialization.cs new file mode 100644 index 000000000000..4254cf8bf7c4 --- /dev/null +++ b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/DependencyMapDiscoverySourceResource.Serialization.cs @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Text.Json; + +namespace Azure.ResourceManager.DependencyMap +{ + public partial class DependencyMapDiscoverySourceResource : IJsonModel + { + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); + + DependencyMapDiscoverySourceData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)Data).Create(ref reader, options); + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options, AzureResourceManagerDependencyMapContext.Default); + + DependencyMapDiscoverySourceData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options, AzureResourceManagerDependencyMapContext.Default); + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)Data).GetFormatFromOptions(options); + } +} diff --git a/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/DependencyMapDiscoverySourceResource.cs b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/DependencyMapDiscoverySourceResource.cs new file mode 100644 index 000000000000..6f6c4ffc323a --- /dev/null +++ b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/DependencyMapDiscoverySourceResource.cs @@ -0,0 +1,707 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.DependencyMap.Models; + +namespace Azure.ResourceManager.DependencyMap +{ + /// + /// A Class representing a DependencyMapDiscoverySource 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 GetDependencyMapDiscoverySourceResource method. + /// Otherwise you can get one from its parent resource using the GetDependencyMapDiscoverySource method. + /// + public partial class DependencyMapDiscoverySourceResource : ArmResource + { + /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The mapName. + /// The sourceName. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string mapName, string sourceName) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DependencyMap/maps/{mapName}/discoverySources/{sourceName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _dependencyMapDiscoverySourceDiscoverySourcesClientDiagnostics; + private readonly DiscoverySourcesRestOperations _dependencyMapDiscoverySourceDiscoverySourcesRestClient; + private readonly DependencyMapDiscoverySourceData _data; + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.DependencyMap/maps/discoverySources"; + + /// Initializes a new instance of the class for mocking. + protected DependencyMapDiscoverySourceResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal DependencyMapDiscoverySourceResource(ArmClient client, DependencyMapDiscoverySourceData 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 DependencyMapDiscoverySourceResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _dependencyMapDiscoverySourceDiscoverySourcesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DependencyMap", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string dependencyMapDiscoverySourceDiscoverySourcesApiVersion); + _dependencyMapDiscoverySourceDiscoverySourcesRestClient = new DiscoverySourcesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, dependencyMapDiscoverySourceDiscoverySourcesApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual DependencyMapDiscoverySourceData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// + /// Get a DiscoverySourceResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DependencyMap/maps/{mapName}/discoverySources/{sourceName} + /// + /// + /// Operation Id + /// DiscoverySourceResource_Get + /// + /// + /// Default Api Version + /// 2025-01-31-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _dependencyMapDiscoverySourceDiscoverySourcesClientDiagnostics.CreateScope("DependencyMapDiscoverySourceResource.Get"); + scope.Start(); + try + { + var response = await _dependencyMapDiscoverySourceDiscoverySourcesRestClient.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 DependencyMapDiscoverySourceResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a DiscoverySourceResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DependencyMap/maps/{mapName}/discoverySources/{sourceName} + /// + /// + /// Operation Id + /// DiscoverySourceResource_Get + /// + /// + /// Default Api Version + /// 2025-01-31-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _dependencyMapDiscoverySourceDiscoverySourcesClientDiagnostics.CreateScope("DependencyMapDiscoverySourceResource.Get"); + scope.Start(); + try + { + var response = _dependencyMapDiscoverySourceDiscoverySourcesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DependencyMapDiscoverySourceResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete a DiscoverySourceResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DependencyMap/maps/{mapName}/discoverySources/{sourceName} + /// + /// + /// Operation Id + /// DiscoverySourceResource_Delete + /// + /// + /// Default Api Version + /// 2025-01-31-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _dependencyMapDiscoverySourceDiscoverySourcesClientDiagnostics.CreateScope("DependencyMapDiscoverySourceResource.Delete"); + scope.Start(); + try + { + var response = await _dependencyMapDiscoverySourceDiscoverySourcesRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new DependencyMapArmOperation(_dependencyMapDiscoverySourceDiscoverySourcesClientDiagnostics, Pipeline, _dependencyMapDiscoverySourceDiscoverySourcesRestClient.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; + } + } + + /// + /// Delete a DiscoverySourceResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DependencyMap/maps/{mapName}/discoverySources/{sourceName} + /// + /// + /// Operation Id + /// DiscoverySourceResource_Delete + /// + /// + /// Default Api Version + /// 2025-01-31-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _dependencyMapDiscoverySourceDiscoverySourcesClientDiagnostics.CreateScope("DependencyMapDiscoverySourceResource.Delete"); + scope.Start(); + try + { + var response = _dependencyMapDiscoverySourceDiscoverySourcesRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + var operation = new DependencyMapArmOperation(_dependencyMapDiscoverySourceDiscoverySourcesClientDiagnostics, Pipeline, _dependencyMapDiscoverySourceDiscoverySourcesRestClient.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 a DiscoverySourceResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DependencyMap/maps/{mapName}/discoverySources/{sourceName} + /// + /// + /// Operation Id + /// DiscoverySourceResource_Update + /// + /// + /// Default Api Version + /// 2025-01-31-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The resource properties to be updated. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, DependencyMapDiscoverySourcePatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(patch, nameof(patch)); + + using var scope = _dependencyMapDiscoverySourceDiscoverySourcesClientDiagnostics.CreateScope("DependencyMapDiscoverySourceResource.Update"); + scope.Start(); + try + { + var response = await _dependencyMapDiscoverySourceDiscoverySourcesRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, patch, cancellationToken).ConfigureAwait(false); + var operation = new DependencyMapArmOperation(new DependencyMapDiscoverySourceOperationSource(Client), _dependencyMapDiscoverySourceDiscoverySourcesClientDiagnostics, Pipeline, _dependencyMapDiscoverySourceDiscoverySourcesRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, patch).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Update a DiscoverySourceResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DependencyMap/maps/{mapName}/discoverySources/{sourceName} + /// + /// + /// Operation Id + /// DiscoverySourceResource_Update + /// + /// + /// Default Api Version + /// 2025-01-31-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The resource properties to be updated. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, DependencyMapDiscoverySourcePatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(patch, nameof(patch)); + + using var scope = _dependencyMapDiscoverySourceDiscoverySourcesClientDiagnostics.CreateScope("DependencyMapDiscoverySourceResource.Update"); + scope.Start(); + try + { + var response = _dependencyMapDiscoverySourceDiscoverySourcesRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, patch, cancellationToken); + var operation = new DependencyMapArmOperation(new DependencyMapDiscoverySourceOperationSource(Client), _dependencyMapDiscoverySourceDiscoverySourcesClientDiagnostics, Pipeline, _dependencyMapDiscoverySourceDiscoverySourcesRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, patch).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Add a tag to the current resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DependencyMap/maps/{mapName}/discoverySources/{sourceName} + /// + /// + /// Operation Id + /// DiscoverySourceResource_Get + /// + /// + /// Default Api Version + /// 2025-01-31-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The key for the tag. + /// The value for the tag. + /// The cancellation token to use. + /// or is null. + public virtual async Task> AddTagAsync(string key, string value, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + Argument.AssertNotNull(value, nameof(value)); + + using var scope = _dependencyMapDiscoverySourceDiscoverySourcesClientDiagnostics.CreateScope("DependencyMapDiscoverySourceResource.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 _dependencyMapDiscoverySourceDiscoverySourcesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new DependencyMapDiscoverySourceResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new DependencyMapDiscoverySourcePatch(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags[key] = value; + var result = await UpdateAsync(WaitUntil.Completed, patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Add a tag to the current resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DependencyMap/maps/{mapName}/discoverySources/{sourceName} + /// + /// + /// Operation Id + /// DiscoverySourceResource_Get + /// + /// + /// Default Api Version + /// 2025-01-31-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The key for the tag. + /// The value for the tag. + /// The cancellation token to use. + /// or is null. + public virtual Response AddTag(string key, string value, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + Argument.AssertNotNull(value, nameof(value)); + + using var scope = _dependencyMapDiscoverySourceDiscoverySourcesClientDiagnostics.CreateScope("DependencyMapDiscoverySourceResource.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 = _dependencyMapDiscoverySourceDiscoverySourcesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + return Response.FromValue(new DependencyMapDiscoverySourceResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new DependencyMapDiscoverySourcePatch(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags[key] = value; + var result = Update(WaitUntil.Completed, patch, cancellationToken: cancellationToken); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Replace the tags on the resource with the given set. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DependencyMap/maps/{mapName}/discoverySources/{sourceName} + /// + /// + /// Operation Id + /// DiscoverySourceResource_Get + /// + /// + /// Default Api Version + /// 2025-01-31-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The set of tags to use as replacement. + /// The cancellation token to use. + /// is null. + public virtual async Task> SetTagsAsync(IDictionary tags, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tags, nameof(tags)); + + using var scope = _dependencyMapDiscoverySourceDiscoverySourcesClientDiagnostics.CreateScope("DependencyMapDiscoverySourceResource.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 _dependencyMapDiscoverySourceDiscoverySourcesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new DependencyMapDiscoverySourceResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new DependencyMapDiscoverySourcePatch(); + patch.Tags.ReplaceWith(tags); + var result = await UpdateAsync(WaitUntil.Completed, patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Replace the tags on the resource with the given set. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DependencyMap/maps/{mapName}/discoverySources/{sourceName} + /// + /// + /// Operation Id + /// DiscoverySourceResource_Get + /// + /// + /// Default Api Version + /// 2025-01-31-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The set of tags to use as replacement. + /// The cancellation token to use. + /// is null. + public virtual Response SetTags(IDictionary tags, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tags, nameof(tags)); + + using var scope = _dependencyMapDiscoverySourceDiscoverySourcesClientDiagnostics.CreateScope("DependencyMapDiscoverySourceResource.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 = _dependencyMapDiscoverySourceDiscoverySourcesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + return Response.FromValue(new DependencyMapDiscoverySourceResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new DependencyMapDiscoverySourcePatch(); + patch.Tags.ReplaceWith(tags); + var result = Update(WaitUntil.Completed, patch, cancellationToken: cancellationToken); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Removes a tag by key from the resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DependencyMap/maps/{mapName}/discoverySources/{sourceName} + /// + /// + /// Operation Id + /// DiscoverySourceResource_Get + /// + /// + /// Default Api Version + /// 2025-01-31-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The key for the tag. + /// The cancellation token to use. + /// is null. + public virtual async Task> RemoveTagAsync(string key, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + + using var scope = _dependencyMapDiscoverySourceDiscoverySourcesClientDiagnostics.CreateScope("DependencyMapDiscoverySourceResource.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 _dependencyMapDiscoverySourceDiscoverySourcesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new DependencyMapDiscoverySourceResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new DependencyMapDiscoverySourcePatch(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags.Remove(key); + var result = await UpdateAsync(WaitUntil.Completed, patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Removes a tag by key from the resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DependencyMap/maps/{mapName}/discoverySources/{sourceName} + /// + /// + /// Operation Id + /// DiscoverySourceResource_Get + /// + /// + /// Default Api Version + /// 2025-01-31-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The key for the tag. + /// The cancellation token to use. + /// is null. + public virtual Response RemoveTag(string key, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + + using var scope = _dependencyMapDiscoverySourceDiscoverySourcesClientDiagnostics.CreateScope("DependencyMapDiscoverySourceResource.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 = _dependencyMapDiscoverySourceDiscoverySourcesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + return Response.FromValue(new DependencyMapDiscoverySourceResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new DependencyMapDiscoverySourcePatch(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags.Remove(key); + var result = Update(WaitUntil.Completed, patch, cancellationToken: cancellationToken); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/DependencyMapResource.Serialization.cs b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/DependencyMapResource.Serialization.cs new file mode 100644 index 000000000000..595495995b3d --- /dev/null +++ b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/DependencyMapResource.Serialization.cs @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Text.Json; + +namespace Azure.ResourceManager.DependencyMap +{ + public partial class DependencyMapResource : IJsonModel + { + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); + + DependencyMapData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)Data).Create(ref reader, options); + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options, AzureResourceManagerDependencyMapContext.Default); + + DependencyMapData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options, AzureResourceManagerDependencyMapContext.Default); + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)Data).GetFormatFromOptions(options); + } +} diff --git a/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/DependencyMapResource.cs b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/DependencyMapResource.cs new file mode 100644 index 000000000000..3aee1592c5e1 --- /dev/null +++ b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/DependencyMapResource.cs @@ -0,0 +1,1144 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.DependencyMap.Models; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.DependencyMap +{ + /// + /// A Class representing a DependencyMap 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 GetDependencyMapResource method. + /// Otherwise you can get one from its parent resource using the GetDependencyMap method. + /// + public partial class DependencyMapResource : ArmResource + { + /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The mapName. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string mapName) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DependencyMap/maps/{mapName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _dependencyMapMapsClientDiagnostics; + private readonly MapsRestOperations _dependencyMapMapsRestClient; + private readonly DependencyMapData _data; + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.DependencyMap/maps"; + + /// Initializes a new instance of the class for mocking. + protected DependencyMapResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal DependencyMapResource(ArmClient client, DependencyMapData 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 DependencyMapResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _dependencyMapMapsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DependencyMap", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string dependencyMapMapsApiVersion); + _dependencyMapMapsRestClient = new MapsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, dependencyMapMapsApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual DependencyMapData 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 DependencyMapDiscoverySourceResources in the DependencyMap. + /// An object representing collection of DependencyMapDiscoverySourceResources and their operations over a DependencyMapDiscoverySourceResource. + public virtual DependencyMapDiscoverySourceCollection GetDependencyMapDiscoverySources() + { + return GetCachedClient(client => new DependencyMapDiscoverySourceCollection(client, Id)); + } + + /// + /// Get a DiscoverySourceResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DependencyMap/maps/{mapName}/discoverySources/{sourceName} + /// + /// + /// Operation Id + /// DiscoverySourceResource_Get + /// + /// + /// Default Api Version + /// 2025-01-31-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// discovery source resource. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetDependencyMapDiscoverySourceAsync(string sourceName, CancellationToken cancellationToken = default) + { + return await GetDependencyMapDiscoverySources().GetAsync(sourceName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get a DiscoverySourceResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DependencyMap/maps/{mapName}/discoverySources/{sourceName} + /// + /// + /// Operation Id + /// DiscoverySourceResource_Get + /// + /// + /// Default Api Version + /// 2025-01-31-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// discovery source resource. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetDependencyMapDiscoverySource(string sourceName, CancellationToken cancellationToken = default) + { + return GetDependencyMapDiscoverySources().Get(sourceName, cancellationToken); + } + + /// + /// Get a MapsResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DependencyMap/maps/{mapName} + /// + /// + /// Operation Id + /// MapsResource_Get + /// + /// + /// Default Api Version + /// 2025-01-31-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _dependencyMapMapsClientDiagnostics.CreateScope("DependencyMapResource.Get"); + scope.Start(); + try + { + var response = await _dependencyMapMapsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DependencyMapResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a MapsResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DependencyMap/maps/{mapName} + /// + /// + /// Operation Id + /// MapsResource_Get + /// + /// + /// Default Api Version + /// 2025-01-31-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _dependencyMapMapsClientDiagnostics.CreateScope("DependencyMapResource.Get"); + scope.Start(); + try + { + var response = _dependencyMapMapsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DependencyMapResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete a MapsResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DependencyMap/maps/{mapName} + /// + /// + /// Operation Id + /// MapsResource_Delete + /// + /// + /// Default Api Version + /// 2025-01-31-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _dependencyMapMapsClientDiagnostics.CreateScope("DependencyMapResource.Delete"); + scope.Start(); + try + { + var response = await _dependencyMapMapsRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new DependencyMapArmOperation(_dependencyMapMapsClientDiagnostics, Pipeline, _dependencyMapMapsRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete a MapsResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DependencyMap/maps/{mapName} + /// + /// + /// Operation Id + /// MapsResource_Delete + /// + /// + /// Default Api Version + /// 2025-01-31-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _dependencyMapMapsClientDiagnostics.CreateScope("DependencyMapResource.Delete"); + scope.Start(); + try + { + var response = _dependencyMapMapsRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + var operation = new DependencyMapArmOperation(_dependencyMapMapsClientDiagnostics, Pipeline, _dependencyMapMapsRestClient.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 MapsResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DependencyMap/maps/{mapName} + /// + /// + /// Operation Id + /// MapsResource_Update + /// + /// + /// Default Api Version + /// 2025-01-31-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The resource properties to be updated. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, DependencyMapPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(patch, nameof(patch)); + + using var scope = _dependencyMapMapsClientDiagnostics.CreateScope("DependencyMapResource.Update"); + scope.Start(); + try + { + var response = await _dependencyMapMapsRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch, cancellationToken).ConfigureAwait(false); + var operation = new DependencyMapArmOperation(new DependencyMapOperationSource(Client), _dependencyMapMapsClientDiagnostics, Pipeline, _dependencyMapMapsRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Update a MapsResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DependencyMap/maps/{mapName} + /// + /// + /// Operation Id + /// MapsResource_Update + /// + /// + /// Default Api Version + /// 2025-01-31-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The resource properties to be updated. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, DependencyMapPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(patch, nameof(patch)); + + using var scope = _dependencyMapMapsClientDiagnostics.CreateScope("DependencyMapResource.Update"); + scope.Start(); + try + { + var response = _dependencyMapMapsRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch, cancellationToken); + var operation = new DependencyMapArmOperation(new DependencyMapOperationSource(Client), _dependencyMapMapsClientDiagnostics, Pipeline, _dependencyMapMapsRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get dependency map of single machine + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DependencyMap/maps/{mapName}/getDependencyViewForFocusedMachine + /// + /// + /// Operation Id + /// Maps_GetDependencyViewForFocusedMachine + /// + /// + /// Default Api Version + /// 2025-01-31-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The content of the action request. + /// The cancellation token to use. + /// is null. + public virtual async Task GetDependencyViewForFocusedMachineAsync(WaitUntil waitUntil, GetDependencyViewForFocusedMachineContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = _dependencyMapMapsClientDiagnostics.CreateScope("DependencyMapResource.GetDependencyViewForFocusedMachine"); + scope.Start(); + try + { + var response = await _dependencyMapMapsRestClient.GetDependencyViewForFocusedMachineAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, content, cancellationToken).ConfigureAwait(false); + var operation = new DependencyMapArmOperation(_dependencyMapMapsClientDiagnostics, Pipeline, _dependencyMapMapsRestClient.CreateGetDependencyViewForFocusedMachineRequest(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; + } + } + + /// + /// Get dependency map of single machine + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DependencyMap/maps/{mapName}/getDependencyViewForFocusedMachine + /// + /// + /// Operation Id + /// Maps_GetDependencyViewForFocusedMachine + /// + /// + /// Default Api Version + /// 2025-01-31-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The content of the action request. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation GetDependencyViewForFocusedMachine(WaitUntil waitUntil, GetDependencyViewForFocusedMachineContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = _dependencyMapMapsClientDiagnostics.CreateScope("DependencyMapResource.GetDependencyViewForFocusedMachine"); + scope.Start(); + try + { + var response = _dependencyMapMapsRestClient.GetDependencyViewForFocusedMachine(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, content, cancellationToken); + var operation = new DependencyMapArmOperation(_dependencyMapMapsClientDiagnostics, Pipeline, _dependencyMapMapsRestClient.CreateGetDependencyViewForFocusedMachineRequest(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; + } + } + + /// + /// Get network connections between machines + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DependencyMap/maps/{mapName}/getConnectionsWithConnectedMachineForFocusedMachine + /// + /// + /// Operation Id + /// Maps_GetConnectionsWithConnectedMachineForFocusedMachine + /// + /// + /// Default Api Version + /// 2025-01-31-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The content of the action request. + /// The cancellation token to use. + /// is null. + public virtual async Task GetConnectionsWithConnectedMachineForFocusedMachineAsync(WaitUntil waitUntil, GetConnectionsWithConnectedMachineForFocusedMachineContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = _dependencyMapMapsClientDiagnostics.CreateScope("DependencyMapResource.GetConnectionsWithConnectedMachineForFocusedMachine"); + scope.Start(); + try + { + var response = await _dependencyMapMapsRestClient.GetConnectionsWithConnectedMachineForFocusedMachineAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, content, cancellationToken).ConfigureAwait(false); + var operation = new DependencyMapArmOperation(_dependencyMapMapsClientDiagnostics, Pipeline, _dependencyMapMapsRestClient.CreateGetConnectionsWithConnectedMachineForFocusedMachineRequest(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; + } + } + + /// + /// Get network connections between machines + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DependencyMap/maps/{mapName}/getConnectionsWithConnectedMachineForFocusedMachine + /// + /// + /// Operation Id + /// Maps_GetConnectionsWithConnectedMachineForFocusedMachine + /// + /// + /// Default Api Version + /// 2025-01-31-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The content of the action request. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation GetConnectionsWithConnectedMachineForFocusedMachine(WaitUntil waitUntil, GetConnectionsWithConnectedMachineForFocusedMachineContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = _dependencyMapMapsClientDiagnostics.CreateScope("DependencyMapResource.GetConnectionsWithConnectedMachineForFocusedMachine"); + scope.Start(); + try + { + var response = _dependencyMapMapsRestClient.GetConnectionsWithConnectedMachineForFocusedMachine(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, content, cancellationToken); + var operation = new DependencyMapArmOperation(_dependencyMapMapsClientDiagnostics, Pipeline, _dependencyMapMapsRestClient.CreateGetConnectionsWithConnectedMachineForFocusedMachineRequest(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; + } + } + + /// + /// Get network connections of a process + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DependencyMap/maps/{mapName}/getConnectionsForProcessOnFocusedMachine + /// + /// + /// Operation Id + /// Maps_GetConnectionsForProcessOnFocusedMachine + /// + /// + /// Default Api Version + /// 2025-01-31-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The content of the action request. + /// The cancellation token to use. + /// is null. + public virtual async Task GetConnectionsForProcessOnFocusedMachineAsync(WaitUntil waitUntil, GetConnectionsForProcessOnFocusedMachineContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = _dependencyMapMapsClientDiagnostics.CreateScope("DependencyMapResource.GetConnectionsForProcessOnFocusedMachine"); + scope.Start(); + try + { + var response = await _dependencyMapMapsRestClient.GetConnectionsForProcessOnFocusedMachineAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, content, cancellationToken).ConfigureAwait(false); + var operation = new DependencyMapArmOperation(_dependencyMapMapsClientDiagnostics, Pipeline, _dependencyMapMapsRestClient.CreateGetConnectionsForProcessOnFocusedMachineRequest(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; + } + } + + /// + /// Get network connections of a process + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DependencyMap/maps/{mapName}/getConnectionsForProcessOnFocusedMachine + /// + /// + /// Operation Id + /// Maps_GetConnectionsForProcessOnFocusedMachine + /// + /// + /// Default Api Version + /// 2025-01-31-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The content of the action request. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation GetConnectionsForProcessOnFocusedMachine(WaitUntil waitUntil, GetConnectionsForProcessOnFocusedMachineContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = _dependencyMapMapsClientDiagnostics.CreateScope("DependencyMapResource.GetConnectionsForProcessOnFocusedMachine"); + scope.Start(); + try + { + var response = _dependencyMapMapsRestClient.GetConnectionsForProcessOnFocusedMachine(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, content, cancellationToken); + var operation = new DependencyMapArmOperation(_dependencyMapMapsClientDiagnostics, Pipeline, _dependencyMapMapsRestClient.CreateGetConnectionsForProcessOnFocusedMachineRequest(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; + } + } + + /// + /// Export dependencies + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DependencyMap/maps/{mapName}/exportDependencies + /// + /// + /// Operation Id + /// Maps_ExportDependencies + /// + /// + /// Default Api Version + /// 2025-01-31-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The content of the action request. + /// The cancellation token to use. + /// is null. + public virtual async Task ExportDependenciesAsync(WaitUntil waitUntil, ExportDependenciesContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = _dependencyMapMapsClientDiagnostics.CreateScope("DependencyMapResource.ExportDependencies"); + scope.Start(); + try + { + var response = await _dependencyMapMapsRestClient.ExportDependenciesAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, content, cancellationToken).ConfigureAwait(false); + var operation = new DependencyMapArmOperation(_dependencyMapMapsClientDiagnostics, Pipeline, _dependencyMapMapsRestClient.CreateExportDependenciesRequest(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; + } + } + + /// + /// Export dependencies + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DependencyMap/maps/{mapName}/exportDependencies + /// + /// + /// Operation Id + /// Maps_ExportDependencies + /// + /// + /// Default Api Version + /// 2025-01-31-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The content of the action request. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation ExportDependencies(WaitUntil waitUntil, ExportDependenciesContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = _dependencyMapMapsClientDiagnostics.CreateScope("DependencyMapResource.ExportDependencies"); + scope.Start(); + try + { + var response = _dependencyMapMapsRestClient.ExportDependencies(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, content, cancellationToken); + var operation = new DependencyMapArmOperation(_dependencyMapMapsClientDiagnostics, Pipeline, _dependencyMapMapsRestClient.CreateExportDependenciesRequest(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.DependencyMap/maps/{mapName} + /// + /// + /// Operation Id + /// MapsResource_Get + /// + /// + /// Default Api Version + /// 2025-01-31-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The key for the tag. + /// The value for the tag. + /// The cancellation token to use. + /// or is null. + public virtual async Task> AddTagAsync(string key, string value, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + Argument.AssertNotNull(value, nameof(value)); + + using var scope = _dependencyMapMapsClientDiagnostics.CreateScope("DependencyMapResource.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 _dependencyMapMapsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new DependencyMapResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new DependencyMapPatch(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags[key] = value; + var result = await UpdateAsync(WaitUntil.Completed, patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Add a tag to the current resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DependencyMap/maps/{mapName} + /// + /// + /// Operation Id + /// MapsResource_Get + /// + /// + /// Default Api Version + /// 2025-01-31-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The key for the tag. + /// The value for the tag. + /// The cancellation token to use. + /// or is null. + public virtual Response AddTag(string key, string value, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + Argument.AssertNotNull(value, nameof(value)); + + using var scope = _dependencyMapMapsClientDiagnostics.CreateScope("DependencyMapResource.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 = _dependencyMapMapsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + return Response.FromValue(new DependencyMapResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new DependencyMapPatch(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags[key] = value; + var result = Update(WaitUntil.Completed, patch, cancellationToken: cancellationToken); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Replace the tags on the resource with the given set. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DependencyMap/maps/{mapName} + /// + /// + /// Operation Id + /// MapsResource_Get + /// + /// + /// Default Api Version + /// 2025-01-31-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The set of tags to use as replacement. + /// The cancellation token to use. + /// is null. + public virtual async Task> SetTagsAsync(IDictionary tags, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tags, nameof(tags)); + + using var scope = _dependencyMapMapsClientDiagnostics.CreateScope("DependencyMapResource.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 _dependencyMapMapsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new DependencyMapResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new DependencyMapPatch(); + patch.Tags.ReplaceWith(tags); + var result = await UpdateAsync(WaitUntil.Completed, patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Replace the tags on the resource with the given set. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DependencyMap/maps/{mapName} + /// + /// + /// Operation Id + /// MapsResource_Get + /// + /// + /// Default Api Version + /// 2025-01-31-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The set of tags to use as replacement. + /// The cancellation token to use. + /// is null. + public virtual Response SetTags(IDictionary tags, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tags, nameof(tags)); + + using var scope = _dependencyMapMapsClientDiagnostics.CreateScope("DependencyMapResource.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 = _dependencyMapMapsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + return Response.FromValue(new DependencyMapResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new DependencyMapPatch(); + patch.Tags.ReplaceWith(tags); + var result = Update(WaitUntil.Completed, patch, cancellationToken: cancellationToken); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Removes a tag by key from the resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DependencyMap/maps/{mapName} + /// + /// + /// Operation Id + /// MapsResource_Get + /// + /// + /// Default Api Version + /// 2025-01-31-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The key for the tag. + /// The cancellation token to use. + /// is null. + public virtual async Task> RemoveTagAsync(string key, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + + using var scope = _dependencyMapMapsClientDiagnostics.CreateScope("DependencyMapResource.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 _dependencyMapMapsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new DependencyMapResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new DependencyMapPatch(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags.Remove(key); + var result = await UpdateAsync(WaitUntil.Completed, patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Removes a tag by key from the resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DependencyMap/maps/{mapName} + /// + /// + /// Operation Id + /// MapsResource_Get + /// + /// + /// Default Api Version + /// 2025-01-31-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The key for the tag. + /// The cancellation token to use. + /// is null. + public virtual Response RemoveTag(string key, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + + using var scope = _dependencyMapMapsClientDiagnostics.CreateScope("DependencyMapResource.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 = _dependencyMapMapsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + return Response.FromValue(new DependencyMapResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new DependencyMapPatch(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags.Remove(key); + var result = Update(WaitUntil.Completed, patch, cancellationToken: cancellationToken); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Extensions/DependencyMapExtensions.cs b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Extensions/DependencyMapExtensions.cs new file mode 100644 index 000000000000..17b77ccac8b2 --- /dev/null +++ b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Extensions/DependencyMapExtensions.cs @@ -0,0 +1,238 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.ResourceManager.DependencyMap.Mocking; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.DependencyMap +{ + /// A class to add extension methods to Azure.ResourceManager.DependencyMap. + public static partial class DependencyMapExtensions + { + private static MockableDependencyMapArmClient GetMockableDependencyMapArmClient(ArmClient client) + { + return client.GetCachedClient(client0 => new MockableDependencyMapArmClient(client0)); + } + + private static MockableDependencyMapResourceGroupResource GetMockableDependencyMapResourceGroupResource(ArmResource resource) + { + return resource.GetCachedClient(client => new MockableDependencyMapResourceGroupResource(client, resource.Id)); + } + + private static MockableDependencyMapSubscriptionResource GetMockableDependencyMapSubscriptionResource(ArmResource resource) + { + return resource.GetCachedClient(client => new MockableDependencyMapSubscriptionResource(client, resource.Id)); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static DependencyMapResource GetDependencyMapResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableDependencyMapArmClient(client).GetDependencyMapResource(id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static DependencyMapDiscoverySourceResource GetDependencyMapDiscoverySourceResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableDependencyMapArmClient(client).GetDependencyMapDiscoverySourceResource(id); + } + + /// + /// Gets a collection of DependencyMapResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// is null. + /// An object representing collection of DependencyMapResources and their operations over a DependencyMapResource. + public static DependencyMapCollection GetDependencyMaps(this ResourceGroupResource resourceGroupResource) + { + Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); + + return GetMockableDependencyMapResourceGroupResource(resourceGroupResource).GetDependencyMaps(); + } + + /// + /// Get a MapsResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DependencyMap/maps/{mapName} + /// + /// + /// Operation Id + /// MapsResource_Get + /// + /// + /// Default Api Version + /// 2025-01-31-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// Maps resource name. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static async Task> GetDependencyMapAsync(this ResourceGroupResource resourceGroupResource, string mapName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); + + return await GetMockableDependencyMapResourceGroupResource(resourceGroupResource).GetDependencyMapAsync(mapName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get a MapsResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DependencyMap/maps/{mapName} + /// + /// + /// Operation Id + /// MapsResource_Get + /// + /// + /// Default Api Version + /// 2025-01-31-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// Maps resource name. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static Response GetDependencyMap(this ResourceGroupResource resourceGroupResource, string mapName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); + + return GetMockableDependencyMapResourceGroupResource(resourceGroupResource).GetDependencyMap(mapName, cancellationToken); + } + + /// + /// List MapsResource resources by subscription ID + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DependencyMap/maps + /// + /// + /// Operation Id + /// MapsResource_ListBySubscription + /// + /// + /// Default Api Version + /// 2025-01-31-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The cancellation token to use. + /// is null. + /// An async collection of that may take multiple service requests to iterate over. + public static AsyncPageable GetDependencyMapsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); + + return GetMockableDependencyMapSubscriptionResource(subscriptionResource).GetDependencyMapsAsync(cancellationToken); + } + + /// + /// List MapsResource resources by subscription ID + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DependencyMap/maps + /// + /// + /// Operation Id + /// MapsResource_ListBySubscription + /// + /// + /// Default Api Version + /// 2025-01-31-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The cancellation token to use. + /// is null. + /// A collection of that may take multiple service requests to iterate over. + public static Pageable GetDependencyMaps(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); + + return GetMockableDependencyMapSubscriptionResource(subscriptionResource).GetDependencyMaps(cancellationToken); + } + } +} diff --git a/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Extensions/MockableDependencyMapArmClient.cs b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Extensions/MockableDependencyMapArmClient.cs new file mode 100644 index 000000000000..cf5790cc1e1c --- /dev/null +++ b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Extensions/MockableDependencyMapArmClient.cs @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; + +namespace Azure.ResourceManager.DependencyMap.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableDependencyMapArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableDependencyMapArmClient() + { + } + + /// 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 MockableDependencyMapArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableDependencyMapArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DependencyMapResource GetDependencyMapResource(ResourceIdentifier id) + { + DependencyMapResource.ValidateResourceId(id); + return new DependencyMapResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DependencyMapDiscoverySourceResource GetDependencyMapDiscoverySourceResource(ResourceIdentifier id) + { + DependencyMapDiscoverySourceResource.ValidateResourceId(id); + return new DependencyMapDiscoverySourceResource(Client, id); + } + } +} diff --git a/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Extensions/MockableDependencyMapResourceGroupResource.cs b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Extensions/MockableDependencyMapResourceGroupResource.cs new file mode 100644 index 000000000000..8bdf33980b52 --- /dev/null +++ b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Extensions/MockableDependencyMapResourceGroupResource.cs @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; + +namespace Azure.ResourceManager.DependencyMap.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableDependencyMapResourceGroupResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableDependencyMapResourceGroupResource() + { + } + + /// 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 MockableDependencyMapResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of DependencyMapResources in the ResourceGroupResource. + /// An object representing collection of DependencyMapResources and their operations over a DependencyMapResource. + public virtual DependencyMapCollection GetDependencyMaps() + { + return GetCachedClient(client => new DependencyMapCollection(client, Id)); + } + + /// + /// Get a MapsResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DependencyMap/maps/{mapName} + /// + /// + /// Operation Id + /// MapsResource_Get + /// + /// + /// Default Api Version + /// 2025-01-31-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Maps resource name. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetDependencyMapAsync(string mapName, CancellationToken cancellationToken = default) + { + return await GetDependencyMaps().GetAsync(mapName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get a MapsResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DependencyMap/maps/{mapName} + /// + /// + /// Operation Id + /// MapsResource_Get + /// + /// + /// Default Api Version + /// 2025-01-31-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Maps resource name. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetDependencyMap(string mapName, CancellationToken cancellationToken = default) + { + return GetDependencyMaps().Get(mapName, cancellationToken); + } + } +} diff --git a/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Extensions/MockableDependencyMapSubscriptionResource.cs b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Extensions/MockableDependencyMapSubscriptionResource.cs new file mode 100644 index 000000000000..17343508042c --- /dev/null +++ b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Extensions/MockableDependencyMapSubscriptionResource.cs @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Threading; +using Autorest.CSharp.Core; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.DependencyMap.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableDependencyMapSubscriptionResource : ArmResource + { + private ClientDiagnostics _dependencyMapMapsClientDiagnostics; + private MapsRestOperations _dependencyMapMapsRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableDependencyMapSubscriptionResource() + { + } + + /// 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 MockableDependencyMapSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics DependencyMapMapsClientDiagnostics => _dependencyMapMapsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.DependencyMap", DependencyMapResource.ResourceType.Namespace, Diagnostics); + private MapsRestOperations DependencyMapMapsRestClient => _dependencyMapMapsRestClient ??= new MapsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(DependencyMapResource.ResourceType)); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// List MapsResource resources by subscription ID + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DependencyMap/maps + /// + /// + /// Operation Id + /// MapsResource_ListBySubscription + /// + /// + /// Default Api Version + /// 2025-01-31-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetDependencyMapsAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => DependencyMapMapsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DependencyMapMapsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DependencyMapResource(Client, DependencyMapData.DeserializeDependencyMapData(e)), DependencyMapMapsClientDiagnostics, Pipeline, "MockableDependencyMapSubscriptionResource.GetDependencyMaps", "value", "nextLink", cancellationToken); + } + + /// + /// List MapsResource resources by subscription ID + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DependencyMap/maps + /// + /// + /// Operation Id + /// MapsResource_ListBySubscription + /// + /// + /// Default Api Version + /// 2025-01-31-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetDependencyMaps(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => DependencyMapMapsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DependencyMapMapsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DependencyMapResource(Client, DependencyMapData.DeserializeDependencyMapData(e)), DependencyMapMapsClientDiagnostics, Pipeline, "MockableDependencyMapSubscriptionResource.GetDependencyMaps", "value", "nextLink", cancellationToken); + } + } +} diff --git a/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Internal/Argument.cs b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Internal/Argument.cs new file mode 100644 index 000000000000..a9994a6d0534 --- /dev/null +++ b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Internal/Argument.cs @@ -0,0 +1,129 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; + +namespace Azure.ResourceManager.DependencyMap +{ + internal static class Argument + { + public static void AssertNotNull(T value, string name) + { + if (value is null) + { + throw new ArgumentNullException(name); + } + } + + public static void AssertNotNull(T? value, string name) + where T : struct + { + if (!value.HasValue) + { + throw new ArgumentNullException(name); + } + } + + public static void AssertNotNullOrEmpty(IEnumerable value, string name) + { + if (value is null) + { + throw new ArgumentNullException(name); + } + if (value is ICollection collectionOfT && collectionOfT.Count == 0) + { + throw new ArgumentException("Value cannot be an empty collection.", name); + } + if (value is ICollection collection && collection.Count == 0) + { + throw new ArgumentException("Value cannot be an empty collection.", name); + } + using IEnumerator e = value.GetEnumerator(); + if (!e.MoveNext()) + { + throw new ArgumentException("Value cannot be an empty collection.", name); + } + } + + public static void AssertNotNullOrEmpty(string value, string name) + { + if (value is null) + { + throw new ArgumentNullException(name); + } + if (value.Length == 0) + { + throw new ArgumentException("Value cannot be an empty string.", name); + } + } + + public static void AssertNotNullOrWhiteSpace(string value, string name) + { + if (value is null) + { + throw new ArgumentNullException(name); + } + if (string.IsNullOrWhiteSpace(value)) + { + throw new ArgumentException("Value cannot be empty or contain only white-space characters.", name); + } + } + + public static void AssertNotDefault(ref T value, string name) + where T : struct, IEquatable + { + if (value.Equals(default)) + { + throw new ArgumentException("Value cannot be empty.", name); + } + } + + public static void AssertInRange(T value, T minimum, T maximum, string name) + where T : notnull, IComparable + { + if (minimum.CompareTo(value) > 0) + { + throw new ArgumentOutOfRangeException(name, "Value is less than the minimum allowed."); + } + if (maximum.CompareTo(value) < 0) + { + throw new ArgumentOutOfRangeException(name, "Value is greater than the maximum allowed."); + } + } + + public static void AssertEnumDefined(Type enumType, object value, string name) + { + if (!Enum.IsDefined(enumType, value)) + { + throw new ArgumentException($"Value not defined for {enumType.FullName}.", name); + } + } + + public static T CheckNotNull(T value, string name) + where T : class + { + AssertNotNull(value, name); + return value; + } + + public static string CheckNotNullOrEmpty(string value, string name) + { + AssertNotNullOrEmpty(value, name); + return value; + } + + public static void AssertNull(T value, string name, string message = null) + { + if (value != null) + { + throw new ArgumentException(message ?? "Value must be null.", name); + } + } + } +} diff --git a/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Internal/ChangeTrackingDictionary.cs b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Internal/ChangeTrackingDictionary.cs new file mode 100644 index 000000000000..9c7da1d4c95d --- /dev/null +++ b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Internal/ChangeTrackingDictionary.cs @@ -0,0 +1,167 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; + +namespace Azure.ResourceManager.DependencyMap +{ + internal class ChangeTrackingDictionary : IDictionary, IReadOnlyDictionary where TKey : notnull + { + private IDictionary _innerDictionary; + + public ChangeTrackingDictionary() + { + } + + public ChangeTrackingDictionary(IDictionary dictionary) + { + if (dictionary == null) + { + return; + } + _innerDictionary = new Dictionary(dictionary); + } + + public ChangeTrackingDictionary(IReadOnlyDictionary dictionary) + { + if (dictionary == null) + { + return; + } + _innerDictionary = new Dictionary(); + foreach (var pair in dictionary) + { + _innerDictionary.Add(pair); + } + } + + public bool IsUndefined => _innerDictionary == null; + + public int Count => IsUndefined ? 0 : EnsureDictionary().Count; + + public bool IsReadOnly => IsUndefined ? false : EnsureDictionary().IsReadOnly; + + public ICollection Keys => IsUndefined ? Array.Empty() : EnsureDictionary().Keys; + + public ICollection Values => IsUndefined ? Array.Empty() : EnsureDictionary().Values; + + public TValue this[TKey key] + { + get + { + if (IsUndefined) + { + throw new KeyNotFoundException(nameof(key)); + } + return EnsureDictionary()[key]; + } + set + { + EnsureDictionary()[key] = value; + } + } + + IEnumerable IReadOnlyDictionary.Keys => Keys; + + IEnumerable IReadOnlyDictionary.Values => Values; + + public IEnumerator> GetEnumerator() + { + if (IsUndefined) + { + IEnumerator> enumerateEmpty() + { + yield break; + } + return enumerateEmpty(); + } + return EnsureDictionary().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } + + public void Add(KeyValuePair item) + { + EnsureDictionary().Add(item); + } + + public void Clear() + { + EnsureDictionary().Clear(); + } + + public bool Contains(KeyValuePair item) + { + if (IsUndefined) + { + return false; + } + return EnsureDictionary().Contains(item); + } + + public void CopyTo(KeyValuePair[] array, int index) + { + if (IsUndefined) + { + return; + } + EnsureDictionary().CopyTo(array, index); + } + + public bool Remove(KeyValuePair item) + { + if (IsUndefined) + { + return false; + } + return EnsureDictionary().Remove(item); + } + + public void Add(TKey key, TValue value) + { + EnsureDictionary().Add(key, value); + } + + public bool ContainsKey(TKey key) + { + if (IsUndefined) + { + return false; + } + return EnsureDictionary().ContainsKey(key); + } + + public bool Remove(TKey key) + { + if (IsUndefined) + { + return false; + } + return EnsureDictionary().Remove(key); + } + + public bool TryGetValue(TKey key, out TValue value) + { + if (IsUndefined) + { + value = default; + return false; + } + return EnsureDictionary().TryGetValue(key, out value); + } + + public IDictionary EnsureDictionary() + { + return _innerDictionary ??= new Dictionary(); + } + } +} diff --git a/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Internal/ChangeTrackingList.cs b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Internal/ChangeTrackingList.cs new file mode 100644 index 000000000000..288d4d1bae98 --- /dev/null +++ b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Internal/ChangeTrackingList.cs @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.ResourceManager.DependencyMap +{ + internal class ChangeTrackingList : IList, IReadOnlyList + { + private IList _innerList; + + public ChangeTrackingList() + { + } + + public ChangeTrackingList(IList innerList) + { + if (innerList != null) + { + _innerList = innerList; + } + } + + public ChangeTrackingList(IReadOnlyList innerList) + { + if (innerList != null) + { + _innerList = innerList.ToList(); + } + } + + public bool IsUndefined => _innerList == null; + + public int Count => IsUndefined ? 0 : EnsureList().Count; + + public bool IsReadOnly => IsUndefined ? false : EnsureList().IsReadOnly; + + public T this[int index] + { + get + { + if (IsUndefined) + { + throw new ArgumentOutOfRangeException(nameof(index)); + } + return EnsureList()[index]; + } + set + { + if (IsUndefined) + { + throw new ArgumentOutOfRangeException(nameof(index)); + } + EnsureList()[index] = value; + } + } + + public void Reset() + { + _innerList = null; + } + + public IEnumerator GetEnumerator() + { + if (IsUndefined) + { + IEnumerator enumerateEmpty() + { + yield break; + } + return enumerateEmpty(); + } + return EnsureList().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } + + public void Add(T item) + { + EnsureList().Add(item); + } + + public void Clear() + { + EnsureList().Clear(); + } + + public bool Contains(T item) + { + if (IsUndefined) + { + return false; + } + return EnsureList().Contains(item); + } + + public void CopyTo(T[] array, int arrayIndex) + { + if (IsUndefined) + { + return; + } + EnsureList().CopyTo(array, arrayIndex); + } + + public bool Remove(T item) + { + if (IsUndefined) + { + return false; + } + return EnsureList().Remove(item); + } + + public int IndexOf(T item) + { + if (IsUndefined) + { + return -1; + } + return EnsureList().IndexOf(item); + } + + public void Insert(int index, T item) + { + EnsureList().Insert(index, item); + } + + public void RemoveAt(int index) + { + if (IsUndefined) + { + throw new ArgumentOutOfRangeException(nameof(index)); + } + EnsureList().RemoveAt(index); + } + + public IList EnsureList() + { + return _innerList ??= new List(); + } + } +} diff --git a/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Internal/ModelSerializationExtensions.cs b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Internal/ModelSerializationExtensions.cs new file mode 100644 index 000000000000..a3d130055a18 --- /dev/null +++ b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Internal/ModelSerializationExtensions.cs @@ -0,0 +1,407 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Diagnostics; +using System.Globalization; +using System.Text.Json; +using System.Xml; +using Azure.Core; + +namespace Azure.ResourceManager.DependencyMap +{ + internal static class ModelSerializationExtensions + { + internal static readonly JsonDocumentOptions JsonDocumentOptions = new JsonDocumentOptions { MaxDepth = 256 }; + internal static readonly ModelReaderWriterOptions WireOptions = new ModelReaderWriterOptions("W"); + internal static readonly BinaryData SentinelValue = BinaryData.FromBytes("\"__EMPTY__\""u8.ToArray()); + + public static object GetObject(this JsonElement element) + { + switch (element.ValueKind) + { + case JsonValueKind.String: + return element.GetString(); + case JsonValueKind.Number: + if (element.TryGetInt32(out int intValue)) + { + return intValue; + } + if (element.TryGetInt64(out long longValue)) + { + return longValue; + } + return element.GetDouble(); + case JsonValueKind.True: + return true; + case JsonValueKind.False: + return false; + case JsonValueKind.Undefined: + case JsonValueKind.Null: + return null; + case JsonValueKind.Object: + var dictionary = new Dictionary(); + foreach (var jsonProperty in element.EnumerateObject()) + { + dictionary.Add(jsonProperty.Name, jsonProperty.Value.GetObject()); + } + return dictionary; + case JsonValueKind.Array: + var list = new List(); + foreach (var item in element.EnumerateArray()) + { + list.Add(item.GetObject()); + } + return list.ToArray(); + default: + throw new NotSupportedException($"Not supported value kind {element.ValueKind}"); + } + } + + public static byte[] GetBytesFromBase64(this JsonElement element, string format) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + + return format switch + { + "U" => TypeFormatters.FromBase64UrlString(element.GetRequiredString()), + "D" => element.GetBytesFromBase64(), + _ => throw new ArgumentException($"Format is not supported: '{format}'", nameof(format)) + }; + } + + public static DateTimeOffset GetDateTimeOffset(this JsonElement element, string format) => format switch + { + "U" when element.ValueKind == JsonValueKind.Number => DateTimeOffset.FromUnixTimeSeconds(element.GetInt64()), + _ => TypeFormatters.ParseDateTimeOffset(element.GetString(), format) + }; + + public static TimeSpan GetTimeSpan(this JsonElement element, string format) => TypeFormatters.ParseTimeSpan(element.GetString(), format); + + public static char GetChar(this JsonElement element) + { + if (element.ValueKind == JsonValueKind.String) + { + var text = element.GetString(); + if (text == null || text.Length != 1) + { + throw new NotSupportedException($"Cannot convert \"{text}\" to a char"); + } + return text[0]; + } + else + { + throw new NotSupportedException($"Cannot convert {element.ValueKind} to a char"); + } + } + + [Conditional("DEBUG")] + public static void ThrowNonNullablePropertyIsNull(this JsonProperty property) + { + throw new JsonException($"A property '{property.Name}' defined as non-nullable but received as null from the service. This exception only happens in DEBUG builds of the library and would be ignored in the release build"); + } + + public static string GetRequiredString(this JsonElement element) + { + var value = element.GetString(); + if (value == null) + { + throw new InvalidOperationException($"The requested operation requires an element of type 'String', but the target element has type '{element.ValueKind}'."); + } + return value; + } + + public static void WriteStringValue(this Utf8JsonWriter writer, DateTimeOffset value, string format) + { + writer.WriteStringValue(TypeFormatters.ToString(value, format)); + } + + public static void WriteStringValue(this Utf8JsonWriter writer, DateTime value, string format) + { + writer.WriteStringValue(TypeFormatters.ToString(value, format)); + } + + public static void WriteStringValue(this Utf8JsonWriter writer, TimeSpan value, string format) + { + writer.WriteStringValue(TypeFormatters.ToString(value, format)); + } + + public static void WriteStringValue(this Utf8JsonWriter writer, char value) + { + writer.WriteStringValue(value.ToString(CultureInfo.InvariantCulture)); + } + + public static void WriteBase64StringValue(this Utf8JsonWriter writer, byte[] value, string format) + { + if (value == null) + { + writer.WriteNullValue(); + return; + } + switch (format) + { + case "U": + writer.WriteStringValue(TypeFormatters.ToBase64UrlString(value)); + break; + case "D": + writer.WriteBase64StringValue(value); + break; + default: + throw new ArgumentException($"Format is not supported: '{format}'", nameof(format)); + } + } + + public static void WriteNumberValue(this Utf8JsonWriter writer, DateTimeOffset value, string format) + { + if (format != "U") + { + throw new ArgumentOutOfRangeException(nameof(format), "Only 'U' format is supported when writing a DateTimeOffset as a Number."); + } + writer.WriteNumberValue(value.ToUnixTimeSeconds()); + } + + public static void WriteObjectValue(this Utf8JsonWriter writer, T value, ModelReaderWriterOptions options = null) + { + switch (value) + { + case null: + writer.WriteNullValue(); + break; + case IJsonModel jsonModel: + jsonModel.Write(writer, options ?? WireOptions); + break; + case IUtf8JsonSerializable serializable: + serializable.Write(writer); + break; + case byte[] bytes: + writer.WriteBase64StringValue(bytes); + break; + case BinaryData bytes0: + writer.WriteBase64StringValue(bytes0); + break; + case JsonElement json: + json.WriteTo(writer); + break; + case int i: + writer.WriteNumberValue(i); + break; + case decimal d: + writer.WriteNumberValue(d); + break; + case double d0: + if (double.IsNaN(d0)) + { + writer.WriteStringValue("NaN"); + } + else + { + writer.WriteNumberValue(d0); + } + break; + case float f: + writer.WriteNumberValue(f); + break; + case long l: + writer.WriteNumberValue(l); + break; + case string s: + writer.WriteStringValue(s); + break; + case bool b: + writer.WriteBooleanValue(b); + break; + case Guid g: + writer.WriteStringValue(g); + break; + case DateTimeOffset dateTimeOffset: + writer.WriteStringValue(dateTimeOffset, "O"); + break; + case DateTime dateTime: + writer.WriteStringValue(dateTime, "O"); + break; + case IEnumerable> enumerable: + writer.WriteStartObject(); + foreach (var pair in enumerable) + { + writer.WritePropertyName(pair.Key); + writer.WriteObjectValue(pair.Value, options); + } + writer.WriteEndObject(); + break; + case IEnumerable objectEnumerable: + writer.WriteStartArray(); + foreach (var item in objectEnumerable) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + break; + case TimeSpan timeSpan: + writer.WriteStringValue(timeSpan, "P"); + break; + default: + throw new NotSupportedException($"Not supported type {value.GetType()}"); + } + } + + public static void WriteObjectValue(this Utf8JsonWriter writer, object value, ModelReaderWriterOptions options = null) + { + writer.WriteObjectValue(value, options); + } + + internal static bool IsSentinelValue(BinaryData value) + { + ReadOnlySpan sentinelSpan = SentinelValue.ToMemory().Span; + ReadOnlySpan valueSpan = value.ToMemory().Span; + return sentinelSpan.SequenceEqual(valueSpan); + } + + internal static class TypeFormatters + { + private const string RoundtripZFormat = "yyyy-MM-ddTHH:mm:ss.fffffffZ"; + public const string DefaultNumberFormat = "G"; + + public static string ToString(bool value) => value ? "true" : "false"; + + public static string ToString(DateTime value, string format) => value.Kind switch + { + DateTimeKind.Utc => ToString((DateTimeOffset)value, format), + _ => throw new NotSupportedException($"DateTime {value} has a Kind of {value.Kind}. Azure SDK requires it to be UTC. You can call DateTime.SpecifyKind to change Kind property value to DateTimeKind.Utc.") + }; + + public static string ToString(DateTimeOffset value, string format) => format switch + { + "D" => value.ToString("yyyy-MM-dd", CultureInfo.InvariantCulture), + "U" => value.ToUnixTimeSeconds().ToString(CultureInfo.InvariantCulture), + "O" => value.ToUniversalTime().ToString(RoundtripZFormat, CultureInfo.InvariantCulture), + "o" => value.ToUniversalTime().ToString(RoundtripZFormat, CultureInfo.InvariantCulture), + "R" => value.ToString("r", CultureInfo.InvariantCulture), + _ => value.ToString(format, CultureInfo.InvariantCulture) + }; + + public static string ToString(TimeSpan value, string format) => format switch + { + "P" => XmlConvert.ToString(value), + _ => value.ToString(format, CultureInfo.InvariantCulture) + }; + + public static string ToString(byte[] value, string format) => format switch + { + "U" => ToBase64UrlString(value), + "D" => Convert.ToBase64String(value), + _ => throw new ArgumentException($"Format is not supported: '{format}'", nameof(format)) + }; + + public static string ToBase64UrlString(byte[] value) + { + int numWholeOrPartialInputBlocks = checked(value.Length + 2) / 3; + int size = checked(numWholeOrPartialInputBlocks * 4); + char[] output = new char[size]; + + int numBase64Chars = Convert.ToBase64CharArray(value, 0, value.Length, output, 0); + + int i = 0; + for (; i < numBase64Chars; i++) + { + char ch = output[i]; + if (ch == '+') + { + output[i] = '-'; + } + else + { + if (ch == '/') + { + output[i] = '_'; + } + else + { + if (ch == '=') + { + break; + } + } + } + } + + return new string(output, 0, i); + } + + public static byte[] FromBase64UrlString(string value) + { + int paddingCharsToAdd = (value.Length % 4) switch + { + 0 => 0, + 2 => 2, + 3 => 1, + _ => throw new InvalidOperationException("Malformed input") + }; + char[] output = new char[(value.Length + paddingCharsToAdd)]; + int i = 0; + for (; i < value.Length; i++) + { + char ch = value[i]; + if (ch == '-') + { + output[i] = '+'; + } + else + { + if (ch == '_') + { + output[i] = '/'; + } + else + { + output[i] = ch; + } + } + } + + for (; i < output.Length; i++) + { + output[i] = '='; + } + + return Convert.FromBase64CharArray(output, 0, output.Length); + } + + public static DateTimeOffset ParseDateTimeOffset(string value, string format) => format switch + { + "U" => DateTimeOffset.FromUnixTimeSeconds(long.Parse(value, CultureInfo.InvariantCulture)), + _ => DateTimeOffset.Parse(value, CultureInfo.InvariantCulture, DateTimeStyles.AssumeUniversal) + }; + + public static TimeSpan ParseTimeSpan(string value, string format) => format switch + { + "P" => XmlConvert.ToTimeSpan(value), + _ => TimeSpan.ParseExact(value, format, CultureInfo.InvariantCulture) + }; + + public static string ConvertToString(object value, string format = null) => value switch + { + null => "null", + string s => s, + bool b => ToString(b), + int or float or double or long or decimal => ((IFormattable)value).ToString(DefaultNumberFormat, CultureInfo.InvariantCulture), + byte[] b0 when format != null => ToString(b0, format), + IEnumerable s0 => string.Join(",", s0), + DateTimeOffset dateTime when format != null => ToString(dateTime, format), + TimeSpan timeSpan when format != null => ToString(timeSpan, format), + TimeSpan timeSpan0 => XmlConvert.ToString(timeSpan0), + Guid guid => guid.ToString(), + BinaryData binaryData => ConvertToString(binaryData.ToArray(), format), + _ => value.ToString() + }; + } + } +} diff --git a/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Internal/Optional.cs b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Internal/Optional.cs new file mode 100644 index 000000000000..d1f550245273 --- /dev/null +++ b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Internal/Optional.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; + +namespace Azure.ResourceManager.DependencyMap +{ + internal static class Optional + { + public static bool IsCollectionDefined(IEnumerable collection) + { + return !(collection is ChangeTrackingList changeTrackingList && changeTrackingList.IsUndefined); + } + + public static bool IsCollectionDefined(IDictionary collection) + { + return !(collection is ChangeTrackingDictionary changeTrackingDictionary && changeTrackingDictionary.IsUndefined); + } + + public static bool IsCollectionDefined(IReadOnlyDictionary collection) + { + return !(collection is ChangeTrackingDictionary changeTrackingDictionary && changeTrackingDictionary.IsUndefined); + } + + public static bool IsDefined(T? value) + where T : struct + { + return value.HasValue; + } + + public static bool IsDefined(object value) + { + return value != null; + } + + public static bool IsDefined(JsonElement value) + { + return value.ValueKind != JsonValueKind.Undefined; + } + + public static bool IsDefined(string value) + { + return value != null; + } + } +} diff --git a/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Internal/Utf8JsonRequestContent.cs b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Internal/Utf8JsonRequestContent.cs new file mode 100644 index 000000000000..ba336e222cdc --- /dev/null +++ b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Internal/Utf8JsonRequestContent.cs @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.IO; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; + +namespace Azure.ResourceManager.DependencyMap +{ + internal class Utf8JsonRequestContent : RequestContent + { + private readonly MemoryStream _stream; + private readonly RequestContent _content; + + public Utf8JsonRequestContent() + { + _stream = new MemoryStream(); + _content = Create(_stream); + JsonWriter = new Utf8JsonWriter(_stream); + } + + public Utf8JsonWriter JsonWriter { get; } + + public override async Task WriteToAsync(Stream stream, CancellationToken cancellationToken = default) + { + await JsonWriter.FlushAsync().ConfigureAwait(false); + await _content.WriteToAsync(stream, cancellationToken).ConfigureAwait(false); + } + + public override void WriteTo(Stream stream, CancellationToken cancellationToken = default) + { + JsonWriter.Flush(); + _content.WriteTo(stream, cancellationToken); + } + + public override bool TryComputeLength(out long length) + { + length = JsonWriter.BytesCommitted + JsonWriter.BytesPending; + return true; + } + + public override void Dispose() + { + JsonWriter.Dispose(); + _content.Dispose(); + _stream.Dispose(); + } + } +} diff --git a/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/LongRunningOperation/DependencyMapArmOperation.cs b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/LongRunningOperation/DependencyMapArmOperation.cs new file mode 100644 index 000000000000..aecf9e564b04 --- /dev/null +++ b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/LongRunningOperation/DependencyMapArmOperation.cs @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.DependencyMap +{ +#pragma warning disable SA1649 // File name should match first type name + internal class DependencyMapArmOperation : ArmOperation +#pragma warning restore SA1649 // File name should match first type name + { + private readonly OperationInternal _operation; + private readonly RehydrationToken? _completeRehydrationToken; + private readonly NextLinkOperationImplementation _nextLinkOperation; + private readonly string _operationId; + + /// Initializes a new instance of DependencyMapArmOperation for mocking. + protected DependencyMapArmOperation() + { + } + + internal DependencyMapArmOperation(Response response, RehydrationToken? rehydrationToken = null) + { + _operation = OperationInternal.Succeeded(response); + _completeRehydrationToken = rehydrationToken; + _operationId = GetOperationId(rehydrationToken); + } + + internal DependencyMapArmOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response, OperationFinalStateVia finalStateVia, bool skipApiVersionOverride = false, string apiVersionOverrideValue = null) + { + var nextLinkOperation = NextLinkOperationImplementation.Create(pipeline, request.Method, request.Uri.ToUri(), response, finalStateVia, skipApiVersionOverride, apiVersionOverrideValue); + if (nextLinkOperation is NextLinkOperationImplementation nextLinkOperationValue) + { + _nextLinkOperation = nextLinkOperationValue; + _operationId = _nextLinkOperation.OperationId; + } + else + { + _completeRehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(request.Method, request.Uri.ToUri(), response, finalStateVia); + _operationId = GetOperationId(_completeRehydrationToken); + } + _operation = new OperationInternal(nextLinkOperation, clientDiagnostics, response, "DependencyMapArmOperation", fallbackStrategy: new SequentialDelayStrategy()); + } + + private string GetOperationId(RehydrationToken? rehydrationToken) + { + if (rehydrationToken is null) + { + return null; + } + var lroDetails = ModelReaderWriter.Write(rehydrationToken, ModelReaderWriterOptions.Json, AzureResourceManagerDependencyMapContext.Default).ToObjectFromJson>(); + return lroDetails["id"]; + } + /// + public override string Id => _operationId ?? NextLinkOperationImplementation.NotSet; + + /// + public override RehydrationToken? GetRehydrationToken() => _nextLinkOperation?.GetRehydrationToken() ?? _completeRehydrationToken; + + /// + public override bool HasCompleted => _operation.HasCompleted; + + /// + public override Response GetRawResponse() => _operation.RawResponse; + + /// + public override Response UpdateStatus(CancellationToken cancellationToken = default) => _operation.UpdateStatus(cancellationToken); + + /// + public override ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) => _operation.UpdateStatusAsync(cancellationToken); + + /// + public override Response WaitForCompletionResponse(CancellationToken cancellationToken = default) => _operation.WaitForCompletionResponse(cancellationToken); + + /// + public override Response WaitForCompletionResponse(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionResponse(pollingInterval, cancellationToken); + + /// + public override ValueTask WaitForCompletionResponseAsync(CancellationToken cancellationToken = default) => _operation.WaitForCompletionResponseAsync(cancellationToken); + + /// + public override ValueTask WaitForCompletionResponseAsync(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionResponseAsync(pollingInterval, cancellationToken); + } +} diff --git a/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/LongRunningOperation/DependencyMapArmOperationOfT.cs b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/LongRunningOperation/DependencyMapArmOperationOfT.cs new file mode 100644 index 000000000000..228e2c309d5d --- /dev/null +++ b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/LongRunningOperation/DependencyMapArmOperationOfT.cs @@ -0,0 +1,100 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.DependencyMap +{ +#pragma warning disable SA1649 // File name should match first type name + internal class DependencyMapArmOperation : ArmOperation +#pragma warning restore SA1649 // File name should match first type name + { + private readonly OperationInternal _operation; + private readonly RehydrationToken? _completeRehydrationToken; + private readonly NextLinkOperationImplementation _nextLinkOperation; + private readonly string _operationId; + + /// Initializes a new instance of DependencyMapArmOperation for mocking. + protected DependencyMapArmOperation() + { + } + + internal DependencyMapArmOperation(Response response, RehydrationToken? rehydrationToken = null) + { + _operation = OperationInternal.Succeeded(response.GetRawResponse(), response.Value); + _completeRehydrationToken = rehydrationToken; + _operationId = GetOperationId(rehydrationToken); + } + + internal DependencyMapArmOperation(IOperationSource source, ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response, OperationFinalStateVia finalStateVia, bool skipApiVersionOverride = false, string apiVersionOverrideValue = null) + { + var nextLinkOperation = NextLinkOperationImplementation.Create(pipeline, request.Method, request.Uri.ToUri(), response, finalStateVia, skipApiVersionOverride, apiVersionOverrideValue); + if (nextLinkOperation is NextLinkOperationImplementation nextLinkOperationValue) + { + _nextLinkOperation = nextLinkOperationValue; + _operationId = _nextLinkOperation.OperationId; + } + else + { + _completeRehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(request.Method, request.Uri.ToUri(), response, finalStateVia); + _operationId = GetOperationId(_completeRehydrationToken); + } + _operation = new OperationInternal(NextLinkOperationImplementation.Create(source, nextLinkOperation), clientDiagnostics, response, "DependencyMapArmOperation", fallbackStrategy: new SequentialDelayStrategy()); + } + + private string GetOperationId(RehydrationToken? rehydrationToken) + { + if (rehydrationToken is null) + { + return null; + } + var lroDetails = ModelReaderWriter.Write(rehydrationToken, ModelReaderWriterOptions.Json, AzureResourceManagerDependencyMapContext.Default).ToObjectFromJson>(); + return lroDetails["id"]; + } + /// + public override string Id => _operationId ?? NextLinkOperationImplementation.NotSet; + + /// + public override RehydrationToken? GetRehydrationToken() => _nextLinkOperation?.GetRehydrationToken() ?? _completeRehydrationToken; + + /// + public override T Value => _operation.Value; + + /// + public override bool HasValue => _operation.HasValue; + + /// + public override bool HasCompleted => _operation.HasCompleted; + + /// + public override Response GetRawResponse() => _operation.RawResponse; + + /// + public override Response UpdateStatus(CancellationToken cancellationToken = default) => _operation.UpdateStatus(cancellationToken); + + /// + public override ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) => _operation.UpdateStatusAsync(cancellationToken); + + /// + public override Response WaitForCompletion(CancellationToken cancellationToken = default) => _operation.WaitForCompletion(cancellationToken); + + /// + public override Response WaitForCompletion(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletion(pollingInterval, cancellationToken); + + /// + public override ValueTask> WaitForCompletionAsync(CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(cancellationToken); + + /// + public override ValueTask> WaitForCompletionAsync(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(pollingInterval, cancellationToken); + } +} diff --git a/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/LongRunningOperation/DependencyMapDiscoverySourceOperationSource.cs b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/LongRunningOperation/DependencyMapDiscoverySourceOperationSource.cs new file mode 100644 index 000000000000..b85b7d78d434 --- /dev/null +++ b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/LongRunningOperation/DependencyMapDiscoverySourceOperationSource.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.ClientModel.Primitives; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; + +namespace Azure.ResourceManager.DependencyMap +{ + internal class DependencyMapDiscoverySourceOperationSource : IOperationSource + { + private readonly ArmClient _client; + + internal DependencyMapDiscoverySourceOperationSource(ArmClient client) + { + _client = client; + } + + DependencyMapDiscoverySourceResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + var data = ModelReaderWriter.Read(response.Content, ModelReaderWriterOptions.Json, AzureResourceManagerDependencyMapContext.Default); + return new DependencyMapDiscoverySourceResource(_client, data); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + var data = ModelReaderWriter.Read(response.Content, ModelReaderWriterOptions.Json, AzureResourceManagerDependencyMapContext.Default); + return await Task.FromResult(new DependencyMapDiscoverySourceResource(_client, data)).ConfigureAwait(false); + } + } +} diff --git a/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/LongRunningOperation/DependencyMapOperationSource.cs b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/LongRunningOperation/DependencyMapOperationSource.cs new file mode 100644 index 000000000000..b7acf3111a78 --- /dev/null +++ b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/LongRunningOperation/DependencyMapOperationSource.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.ClientModel.Primitives; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; + +namespace Azure.ResourceManager.DependencyMap +{ + internal class DependencyMapOperationSource : IOperationSource + { + private readonly ArmClient _client; + + internal DependencyMapOperationSource(ArmClient client) + { + _client = client; + } + + DependencyMapResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + var data = ModelReaderWriter.Read(response.Content, ModelReaderWriterOptions.Json, AzureResourceManagerDependencyMapContext.Default); + return new DependencyMapResource(_client, data); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + var data = ModelReaderWriter.Read(response.Content, ModelReaderWriterOptions.Json, AzureResourceManagerDependencyMapContext.Default); + return await Task.FromResult(new DependencyMapResource(_client, data)).ConfigureAwait(false); + } + } +} diff --git a/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Models/AzureResourceManagerDependencyMapContext.cs b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Models/AzureResourceManagerDependencyMapContext.cs new file mode 100644 index 000000000000..2bf6cf60247f --- /dev/null +++ b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Models/AzureResourceManagerDependencyMapContext.cs @@ -0,0 +1,19 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.ClientModel.Primitives; + +namespace Azure.ResourceManager.DependencyMap +{ + /// + /// Context class which will be filled in by the System.ClientModel.SourceGeneration. + /// For more information see 'https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/core/System.ClientModel/src/docs/ModelReaderWriterContext.md' + /// + public partial class AzureResourceManagerDependencyMapContext : ModelReaderWriterContext + { + } +} diff --git a/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Models/DependencyMapDateTimeFilter.Serialization.cs b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Models/DependencyMapDateTimeFilter.Serialization.cs new file mode 100644 index 000000000000..d7eb9f04ca70 --- /dev/null +++ b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Models/DependencyMapDateTimeFilter.Serialization.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.DependencyMap.Models +{ + public partial class DependencyMapDateTimeFilter : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DependencyMapDateTimeFilter)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(StartOn)) + { + writer.WritePropertyName("startDateTimeUtc"u8); + writer.WriteStringValue(StartOn.Value, "O"); + } + if (Optional.IsDefined(EndOn)) + { + writer.WritePropertyName("endDateTimeUtc"u8); + writer.WriteStringValue(EndOn.Value, "O"); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + DependencyMapDateTimeFilter IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DependencyMapDateTimeFilter)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDependencyMapDateTimeFilter(document.RootElement, options); + } + + internal static DependencyMapDateTimeFilter DeserializeDependencyMapDateTimeFilter(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + DateTimeOffset? startDateTimeUtc = default; + DateTimeOffset? endDateTimeUtc = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("startDateTimeUtc"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + startDateTimeUtc = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("endDateTimeUtc"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + endDateTimeUtc = property.Value.GetDateTimeOffset("O"); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DependencyMapDateTimeFilter(startDateTimeUtc, endDateTimeUtc, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerDependencyMapContext.Default); + default: + throw new FormatException($"The model {nameof(DependencyMapDateTimeFilter)} does not support writing '{options.Format}' format."); + } + } + + DependencyMapDateTimeFilter IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeDependencyMapDateTimeFilter(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DependencyMapDateTimeFilter)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Models/DependencyMapDateTimeFilter.cs b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Models/DependencyMapDateTimeFilter.cs new file mode 100644 index 000000000000..25756f8884af --- /dev/null +++ b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Models/DependencyMapDateTimeFilter.cs @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.DependencyMap.Models +{ + /// UTC DateTime filter for dependency map visualization apis. + public partial class DependencyMapDateTimeFilter + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public DependencyMapDateTimeFilter() + { + } + + /// Initializes a new instance of . + /// Start date time for dependency map visualization query. + /// End date time for dependency map visualization query. + /// Keeps track of any properties unknown to the library. + internal DependencyMapDateTimeFilter(DateTimeOffset? startOn, DateTimeOffset? endOn, IDictionary serializedAdditionalRawData) + { + StartOn = startOn; + EndOn = endOn; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Start date time for dependency map visualization query. + public DateTimeOffset? StartOn { get; set; } + /// End date time for dependency map visualization query. + public DateTimeOffset? EndOn { get; set; } + } +} diff --git a/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Models/DependencyMapDiscoverySourcePatch.Serialization.cs b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Models/DependencyMapDiscoverySourcePatch.Serialization.cs new file mode 100644 index 000000000000..3ab884b1f1d1 --- /dev/null +++ b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Models/DependencyMapDiscoverySourcePatch.Serialization.cs @@ -0,0 +1,144 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.DependencyMap.Models +{ + public partial class DependencyMapDiscoverySourcePatch : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DependencyMapDiscoverySourcePatch)} does not support writing '{format}' format."); + } + + if (Optional.IsCollectionDefined(Tags)) + { + writer.WritePropertyName("tags"u8); + writer.WriteStartObject(); + foreach (var item in Tags) + { + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + DependencyMapDiscoverySourcePatch IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DependencyMapDiscoverySourcePatch)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDependencyMapDiscoverySourcePatch(document.RootElement, options); + } + + internal static DependencyMapDiscoverySourcePatch DeserializeDependencyMapDiscoverySourcePatch(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IDictionary tags = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("tags"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DependencyMapDiscoverySourcePatch(tags ?? new ChangeTrackingDictionary(), serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerDependencyMapContext.Default); + default: + throw new FormatException($"The model {nameof(DependencyMapDiscoverySourcePatch)} does not support writing '{options.Format}' format."); + } + } + + DependencyMapDiscoverySourcePatch IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeDependencyMapDiscoverySourcePatch(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DependencyMapDiscoverySourcePatch)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Models/DependencyMapDiscoverySourcePatch.cs b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Models/DependencyMapDiscoverySourcePatch.cs new file mode 100644 index 000000000000..38c3db5ef1d6 --- /dev/null +++ b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Models/DependencyMapDiscoverySourcePatch.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.DependencyMap.Models +{ + /// The type used for updating tags in DiscoverySourceResource resources. + public partial class DependencyMapDiscoverySourcePatch + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public DependencyMapDiscoverySourcePatch() + { + Tags = new ChangeTrackingDictionary(); + } + + /// Initializes a new instance of . + /// Resource tags. + /// Keeps track of any properties unknown to the library. + internal DependencyMapDiscoverySourcePatch(IDictionary tags, IDictionary serializedAdditionalRawData) + { + Tags = tags; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Resource tags. + public IDictionary Tags { get; } + } +} diff --git a/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Models/DependencyMapDiscoverySourceProperties.Serialization.cs b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Models/DependencyMapDiscoverySourceProperties.Serialization.cs new file mode 100644 index 000000000000..6d0f32535036 --- /dev/null +++ b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Models/DependencyMapDiscoverySourceProperties.Serialization.cs @@ -0,0 +1,124 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.DependencyMap.Models +{ + [PersistableModelProxy(typeof(UnknownDependencyMapDiscoverySourceProperties))] + public partial class DependencyMapDiscoverySourceProperties : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DependencyMapDiscoverySourceProperties)} does not support writing '{format}' format."); + } + + if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState.Value.ToString()); + } + writer.WritePropertyName("sourceType"u8); + writer.WriteStringValue(SourceType.ToString()); + writer.WritePropertyName("sourceId"u8); + writer.WriteStringValue(SourceId); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + DependencyMapDiscoverySourceProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DependencyMapDiscoverySourceProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDependencyMapDiscoverySourceProperties(document.RootElement, options); + } + + internal static DependencyMapDiscoverySourceProperties DeserializeDependencyMapDiscoverySourceProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + if (element.TryGetProperty("sourceType", out JsonElement discriminator)) + { + switch (discriminator.GetString()) + { + case "OffAzure": return OffAzureDiscoverySourceProperties.DeserializeOffAzureDiscoverySourceProperties(element, options); + } + } + return UnknownDependencyMapDiscoverySourceProperties.DeserializeUnknownDependencyMapDiscoverySourceProperties(element, options); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerDependencyMapContext.Default); + default: + throw new FormatException($"The model {nameof(DependencyMapDiscoverySourceProperties)} does not support writing '{options.Format}' format."); + } + } + + DependencyMapDiscoverySourceProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeDependencyMapDiscoverySourceProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DependencyMapDiscoverySourceProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Models/DependencyMapDiscoverySourceProperties.cs b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Models/DependencyMapDiscoverySourceProperties.cs new file mode 100644 index 000000000000..8a52e0e0653f --- /dev/null +++ b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Models/DependencyMapDiscoverySourceProperties.cs @@ -0,0 +1,88 @@ +// 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.DependencyMap.Models +{ + /// + /// The properties of Discovery Source resource + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include . + /// + public abstract partial class DependencyMapDiscoverySourceProperties + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private protected IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Source ArmId of Discovery Source resource. + /// is null. + protected DependencyMapDiscoverySourceProperties(ResourceIdentifier sourceId) + { + Argument.AssertNotNull(sourceId, nameof(sourceId)); + + SourceId = sourceId; + } + + /// Initializes a new instance of . + /// Provisioning state of Discovery Source resource. + /// Source type of Discovery Source resource. + /// Source ArmId of Discovery Source resource. + /// Keeps track of any properties unknown to the library. + internal DependencyMapDiscoverySourceProperties(DependencyMapProvisioningState? provisioningState, SourceType sourceType, ResourceIdentifier sourceId, IDictionary serializedAdditionalRawData) + { + ProvisioningState = provisioningState; + SourceType = sourceType; + SourceId = sourceId; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DependencyMapDiscoverySourceProperties() + { + } + + /// Provisioning state of Discovery Source resource. + public DependencyMapProvisioningState? ProvisioningState { get; } + /// Source type of Discovery Source resource. + internal SourceType SourceType { get; set; } + /// Source ArmId of Discovery Source resource. + public ResourceIdentifier SourceId { get; set; } + } +} diff --git a/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Models/DependencyMapPatch.Serialization.cs b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Models/DependencyMapPatch.Serialization.cs new file mode 100644 index 000000000000..4e00c33db12b --- /dev/null +++ b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Models/DependencyMapPatch.Serialization.cs @@ -0,0 +1,144 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.DependencyMap.Models +{ + public partial class DependencyMapPatch : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DependencyMapPatch)} does not support writing '{format}' format."); + } + + if (Optional.IsCollectionDefined(Tags)) + { + writer.WritePropertyName("tags"u8); + writer.WriteStartObject(); + foreach (var item in Tags) + { + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + DependencyMapPatch IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DependencyMapPatch)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDependencyMapPatch(document.RootElement, options); + } + + internal static DependencyMapPatch DeserializeDependencyMapPatch(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IDictionary tags = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("tags"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DependencyMapPatch(tags ?? new ChangeTrackingDictionary(), serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerDependencyMapContext.Default); + default: + throw new FormatException($"The model {nameof(DependencyMapPatch)} does not support writing '{options.Format}' format."); + } + } + + DependencyMapPatch IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeDependencyMapPatch(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DependencyMapPatch)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Models/DependencyMapPatch.cs b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Models/DependencyMapPatch.cs new file mode 100644 index 000000000000..16e83927dbce --- /dev/null +++ b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Models/DependencyMapPatch.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.DependencyMap.Models +{ + /// The type used for updating tags in MapsResource resources. + public partial class DependencyMapPatch + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public DependencyMapPatch() + { + Tags = new ChangeTrackingDictionary(); + } + + /// Initializes a new instance of . + /// Resource tags. + /// Keeps track of any properties unknown to the library. + internal DependencyMapPatch(IDictionary tags, IDictionary serializedAdditionalRawData) + { + Tags = tags; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Resource tags. + public IDictionary Tags { get; } + } +} diff --git a/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Models/DependencyMapProcessNameFilter.Serialization.cs b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Models/DependencyMapProcessNameFilter.Serialization.cs new file mode 100644 index 000000000000..5f09c79bcf9e --- /dev/null +++ b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Models/DependencyMapProcessNameFilter.Serialization.cs @@ -0,0 +1,144 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.DependencyMap.Models +{ + public partial class DependencyMapProcessNameFilter : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DependencyMapProcessNameFilter)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("operator"u8); + writer.WriteStringValue(Operator.ToString()); + writer.WritePropertyName("processNames"u8); + writer.WriteStartArray(); + foreach (var item in ProcessNames) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + DependencyMapProcessNameFilter IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DependencyMapProcessNameFilter)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDependencyMapProcessNameFilter(document.RootElement, options); + } + + internal static DependencyMapProcessNameFilter DeserializeDependencyMapProcessNameFilter(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + DependencyMapProcessNameFilterOperator @operator = default; + IList processNames = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("operator"u8)) + { + @operator = new DependencyMapProcessNameFilterOperator(property.Value.GetString()); + continue; + } + if (property.NameEquals("processNames"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + processNames = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DependencyMapProcessNameFilter(@operator, processNames, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerDependencyMapContext.Default); + default: + throw new FormatException($"The model {nameof(DependencyMapProcessNameFilter)} does not support writing '{options.Format}' format."); + } + } + + DependencyMapProcessNameFilter IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeDependencyMapProcessNameFilter(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DependencyMapProcessNameFilter)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Models/DependencyMapProcessNameFilter.cs b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Models/DependencyMapProcessNameFilter.cs new file mode 100644 index 000000000000..3dafc7efc4ae --- /dev/null +++ b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Models/DependencyMapProcessNameFilter.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.Linq; + +namespace Azure.ResourceManager.DependencyMap.Models +{ + /// Process name filter for dependency map visualization apis. + public partial class DependencyMapProcessNameFilter + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Operator for process name filter. + /// List of process names on which the operator should be applied. + /// is null. + public DependencyMapProcessNameFilter(DependencyMapProcessNameFilterOperator @operator, IEnumerable processNames) + { + Argument.AssertNotNull(processNames, nameof(processNames)); + + Operator = @operator; + ProcessNames = processNames.ToList(); + } + + /// Initializes a new instance of . + /// Operator for process name filter. + /// List of process names on which the operator should be applied. + /// Keeps track of any properties unknown to the library. + internal DependencyMapProcessNameFilter(DependencyMapProcessNameFilterOperator @operator, IList processNames, IDictionary serializedAdditionalRawData) + { + Operator = @operator; + ProcessNames = processNames; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DependencyMapProcessNameFilter() + { + } + + /// Operator for process name filter. + public DependencyMapProcessNameFilterOperator Operator { get; } + /// List of process names on which the operator should be applied. + public IList ProcessNames { get; } + } +} diff --git a/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Models/DependencyMapProcessNameFilterOperator.cs b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Models/DependencyMapProcessNameFilterOperator.cs new file mode 100644 index 000000000000..56f9a57463e9 --- /dev/null +++ b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Models/DependencyMapProcessNameFilterOperator.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.DependencyMap.Models +{ + /// Operator enum for process name filter. + public readonly partial struct DependencyMapProcessNameFilterOperator : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public DependencyMapProcessNameFilterOperator(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string ContainsValue = "contains"; + private const string NotContainsValue = "notContains"; + + /// Operator to include items in the result. + public static DependencyMapProcessNameFilterOperator Contains { get; } = new DependencyMapProcessNameFilterOperator(ContainsValue); + /// Operator to exclude items in the result. + public static DependencyMapProcessNameFilterOperator NotContains { get; } = new DependencyMapProcessNameFilterOperator(NotContainsValue); + /// Determines if two values are the same. + public static bool operator ==(DependencyMapProcessNameFilterOperator left, DependencyMapProcessNameFilterOperator right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(DependencyMapProcessNameFilterOperator left, DependencyMapProcessNameFilterOperator right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator DependencyMapProcessNameFilterOperator(string value) => new DependencyMapProcessNameFilterOperator(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is DependencyMapProcessNameFilterOperator other && Equals(other); + /// + public bool Equals(DependencyMapProcessNameFilterOperator other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Models/DependencyMapProperties.Serialization.cs b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Models/DependencyMapProperties.Serialization.cs new file mode 100644 index 000000000000..e4d5d0410f30 --- /dev/null +++ b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Models/DependencyMapProperties.Serialization.cs @@ -0,0 +1,133 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.DependencyMap.Models +{ + internal partial class DependencyMapProperties : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DependencyMapProperties)} does not support writing '{format}' format."); + } + + if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState.Value.ToString()); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + DependencyMapProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DependencyMapProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDependencyMapProperties(document.RootElement, options); + } + + internal static DependencyMapProperties DeserializeDependencyMapProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + DependencyMapProvisioningState? provisioningState = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("provisioningState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new DependencyMapProvisioningState(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DependencyMapProperties(provisioningState, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerDependencyMapContext.Default); + default: + throw new FormatException($"The model {nameof(DependencyMapProperties)} does not support writing '{options.Format}' format."); + } + } + + DependencyMapProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeDependencyMapProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DependencyMapProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Models/DependencyMapProperties.cs b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Models/DependencyMapProperties.cs new file mode 100644 index 000000000000..730c5a2b7f63 --- /dev/null +++ b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Models/DependencyMapProperties.cs @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.DependencyMap.Models +{ + /// The properties of Maps resource. + internal partial class DependencyMapProperties + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public DependencyMapProperties() + { + } + + /// Initializes a new instance of . + /// Provisioning state of Maps resource. + /// Keeps track of any properties unknown to the library. + internal DependencyMapProperties(DependencyMapProvisioningState? provisioningState, IDictionary serializedAdditionalRawData) + { + ProvisioningState = provisioningState; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Provisioning state of Maps resource. + public DependencyMapProvisioningState? ProvisioningState { get; } + } +} diff --git a/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Models/DependencyMapProvisioningState.cs b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Models/DependencyMapProvisioningState.cs new file mode 100644 index 000000000000..eb0fed29c44d --- /dev/null +++ b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Models/DependencyMapProvisioningState.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.DependencyMap.Models +{ + /// Provisioning state of the resource. + public readonly partial struct DependencyMapProvisioningState : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public DependencyMapProvisioningState(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string SucceededValue = "Succeeded"; + private const string FailedValue = "Failed"; + private const string CanceledValue = "Canceled"; + private const string ProvisioningValue = "Provisioning"; + private const string UpdatingValue = "Updating"; + private const string DeletingValue = "Deleting"; + private const string AcceptedValue = "Accepted"; + + /// Resource has been created. + public static DependencyMapProvisioningState Succeeded { get; } = new DependencyMapProvisioningState(SucceededValue); + /// Resource creation failed. + public static DependencyMapProvisioningState Failed { get; } = new DependencyMapProvisioningState(FailedValue); + /// Resource creation was canceled. + public static DependencyMapProvisioningState Canceled { get; } = new DependencyMapProvisioningState(CanceledValue); + /// This state indicates that the resource is being provisioned. + public static DependencyMapProvisioningState Provisioning { get; } = new DependencyMapProvisioningState(ProvisioningValue); + /// This state indicates that the resource is being updated. + public static DependencyMapProvisioningState Updating { get; } = new DependencyMapProvisioningState(UpdatingValue); + /// This state indicates that the resource is being deleted. + public static DependencyMapProvisioningState Deleting { get; } = new DependencyMapProvisioningState(DeletingValue); + /// This state indicates that the operation on the resource has been accepted. + public static DependencyMapProvisioningState Accepted { get; } = new DependencyMapProvisioningState(AcceptedValue); + /// Determines if two values are the same. + public static bool operator ==(DependencyMapProvisioningState left, DependencyMapProvisioningState right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(DependencyMapProvisioningState left, DependencyMapProvisioningState right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator DependencyMapProvisioningState(string value) => new DependencyMapProvisioningState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is DependencyMapProvisioningState other && Equals(other); + /// + public bool Equals(DependencyMapProvisioningState other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Models/DependencyMapVisualizationFilter.Serialization.cs b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Models/DependencyMapVisualizationFilter.Serialization.cs new file mode 100644 index 000000000000..128e1dd1eb61 --- /dev/null +++ b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Models/DependencyMapVisualizationFilter.Serialization.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.DependencyMap.Models +{ + public partial class DependencyMapVisualizationFilter : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DependencyMapVisualizationFilter)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(DateTime)) + { + writer.WritePropertyName("dateTime"u8); + writer.WriteObjectValue(DateTime, options); + } + if (Optional.IsDefined(ProcessNameFilter)) + { + writer.WritePropertyName("processNameFilter"u8); + writer.WriteObjectValue(ProcessNameFilter, options); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + DependencyMapVisualizationFilter IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DependencyMapVisualizationFilter)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDependencyMapVisualizationFilter(document.RootElement, options); + } + + internal static DependencyMapVisualizationFilter DeserializeDependencyMapVisualizationFilter(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + DependencyMapDateTimeFilter dateTime = default; + DependencyMapProcessNameFilter processNameFilter = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("dateTime"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + dateTime = DependencyMapDateTimeFilter.DeserializeDependencyMapDateTimeFilter(property.Value, options); + continue; + } + if (property.NameEquals("processNameFilter"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + processNameFilter = DependencyMapProcessNameFilter.DeserializeDependencyMapProcessNameFilter(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DependencyMapVisualizationFilter(dateTime, processNameFilter, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerDependencyMapContext.Default); + default: + throw new FormatException($"The model {nameof(DependencyMapVisualizationFilter)} does not support writing '{options.Format}' format."); + } + } + + DependencyMapVisualizationFilter IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeDependencyMapVisualizationFilter(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DependencyMapVisualizationFilter)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Models/DependencyMapVisualizationFilter.cs b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Models/DependencyMapVisualizationFilter.cs new file mode 100644 index 000000000000..e5f628f5e581 --- /dev/null +++ b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Models/DependencyMapVisualizationFilter.cs @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.DependencyMap.Models +{ + /// Filters for dependency map visualization apis. + public partial class DependencyMapVisualizationFilter + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public DependencyMapVisualizationFilter() + { + } + + /// Initializes a new instance of . + /// DateTime filter. + /// Process name filter. + /// Keeps track of any properties unknown to the library. + internal DependencyMapVisualizationFilter(DependencyMapDateTimeFilter dateTime, DependencyMapProcessNameFilter processNameFilter, IDictionary serializedAdditionalRawData) + { + DateTime = dateTime; + ProcessNameFilter = processNameFilter; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// DateTime filter. + public DependencyMapDateTimeFilter DateTime { get; set; } + /// Process name filter. + public DependencyMapProcessNameFilter ProcessNameFilter { get; set; } + } +} diff --git a/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Models/DiscoverySourceResourceListResult.Serialization.cs b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Models/DiscoverySourceResourceListResult.Serialization.cs new file mode 100644 index 000000000000..adce4050b2cd --- /dev/null +++ b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Models/DiscoverySourceResourceListResult.Serialization.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.DependencyMap.Models +{ + internal partial class DiscoverySourceResourceListResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DiscoverySourceResourceListResult)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink.AbsoluteUri); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + DiscoverySourceResourceListResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DiscoverySourceResourceListResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDiscoverySourceResourceListResult(document.RootElement, options); + } + + internal static DiscoverySourceResourceListResult DeserializeDiscoverySourceResourceListResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList value = default; + Uri nextLink = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DependencyMapDiscoverySourceData.DeserializeDependencyMapDiscoverySourceData(item, options)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = new Uri(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DiscoverySourceResourceListResult(value, nextLink, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerDependencyMapContext.Default); + default: + throw new FormatException($"The model {nameof(DiscoverySourceResourceListResult)} does not support writing '{options.Format}' format."); + } + } + + DiscoverySourceResourceListResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeDiscoverySourceResourceListResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DiscoverySourceResourceListResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Models/DiscoverySourceResourceListResult.cs b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Models/DiscoverySourceResourceListResult.cs new file mode 100644 index 000000000000..2a18905d8b4c --- /dev/null +++ b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Models/DiscoverySourceResourceListResult.cs @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.ResourceManager.DependencyMap.Models +{ + /// The response of a DiscoverySourceResource list operation. + internal partial class DiscoverySourceResourceListResult + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The DiscoverySourceResource items on this page. + /// is null. + internal DiscoverySourceResourceListResult(IEnumerable value) + { + Argument.AssertNotNull(value, nameof(value)); + + Value = value.ToList(); + } + + /// Initializes a new instance of . + /// The DiscoverySourceResource items on this page. + /// The link to the next page of items. + /// Keeps track of any properties unknown to the library. + internal DiscoverySourceResourceListResult(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) + { + Value = value; + NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DiscoverySourceResourceListResult() + { + } + + /// The DiscoverySourceResource items on this page. + public IReadOnlyList Value { get; } + /// The link to the next page of items. + public Uri NextLink { get; } + } +} diff --git a/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Models/ExportDependenciesContent.Serialization.cs b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Models/ExportDependenciesContent.Serialization.cs new file mode 100644 index 000000000000..2815c552a08a --- /dev/null +++ b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Models/ExportDependenciesContent.Serialization.cs @@ -0,0 +1,141 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.DependencyMap.Models +{ + public partial class ExportDependenciesContent : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ExportDependenciesContent)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("focusedMachineId"u8); + writer.WriteStringValue(FocusedMachineId); + if (Optional.IsDefined(Filters)) + { + writer.WritePropertyName("filters"u8); + writer.WriteObjectValue(Filters, options); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + ExportDependenciesContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ExportDependenciesContent)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeExportDependenciesContent(document.RootElement, options); + } + + internal static ExportDependenciesContent DeserializeExportDependenciesContent(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ResourceIdentifier focusedMachineId = default; + DependencyMapVisualizationFilter filters = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("focusedMachineId"u8)) + { + focusedMachineId = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("filters"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + filters = DependencyMapVisualizationFilter.DeserializeDependencyMapVisualizationFilter(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ExportDependenciesContent(focusedMachineId, filters, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerDependencyMapContext.Default); + default: + throw new FormatException($"The model {nameof(ExportDependenciesContent)} does not support writing '{options.Format}' format."); + } + } + + ExportDependenciesContent IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeExportDependenciesContent(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ExportDependenciesContent)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Models/ExportDependenciesContent.cs b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Models/ExportDependenciesContent.cs new file mode 100644 index 000000000000..2558a78c93d3 --- /dev/null +++ b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Models/ExportDependenciesContent.cs @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.DependencyMap.Models +{ + /// ExportDependencies request model. + public partial class ExportDependenciesContent + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Machine arm id. + /// is null. + public ExportDependenciesContent(ResourceIdentifier focusedMachineId) + { + Argument.AssertNotNull(focusedMachineId, nameof(focusedMachineId)); + + FocusedMachineId = focusedMachineId; + } + + /// Initializes a new instance of . + /// Machine arm id. + /// Filters for ExportDependencies. + /// Keeps track of any properties unknown to the library. + internal ExportDependenciesContent(ResourceIdentifier focusedMachineId, DependencyMapVisualizationFilter filters, IDictionary serializedAdditionalRawData) + { + FocusedMachineId = focusedMachineId; + Filters = filters; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ExportDependenciesContent() + { + } + + /// Machine arm id. + public ResourceIdentifier FocusedMachineId { get; } + /// Filters for ExportDependencies. + public DependencyMapVisualizationFilter Filters { get; set; } + } +} diff --git a/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Models/GetConnectionsForProcessOnFocusedMachineContent.Serialization.cs b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Models/GetConnectionsForProcessOnFocusedMachineContent.Serialization.cs new file mode 100644 index 000000000000..8f85fbd325ae --- /dev/null +++ b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Models/GetConnectionsForProcessOnFocusedMachineContent.Serialization.cs @@ -0,0 +1,149 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.DependencyMap.Models +{ + public partial class GetConnectionsForProcessOnFocusedMachineContent : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(GetConnectionsForProcessOnFocusedMachineContent)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("focusedMachineId"u8); + writer.WriteStringValue(FocusedMachineId); + writer.WritePropertyName("processIdOnFocusedMachine"u8); + writer.WriteStringValue(ProcessIdOnFocusedMachine); + if (Optional.IsDefined(Filters)) + { + writer.WritePropertyName("filters"u8); + writer.WriteObjectValue(Filters, options); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + GetConnectionsForProcessOnFocusedMachineContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(GetConnectionsForProcessOnFocusedMachineContent)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeGetConnectionsForProcessOnFocusedMachineContent(document.RootElement, options); + } + + internal static GetConnectionsForProcessOnFocusedMachineContent DeserializeGetConnectionsForProcessOnFocusedMachineContent(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ResourceIdentifier focusedMachineId = default; + string processIdOnFocusedMachine = default; + DependencyMapVisualizationFilter filters = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("focusedMachineId"u8)) + { + focusedMachineId = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("processIdOnFocusedMachine"u8)) + { + processIdOnFocusedMachine = property.Value.GetString(); + continue; + } + if (property.NameEquals("filters"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + filters = DependencyMapVisualizationFilter.DeserializeDependencyMapVisualizationFilter(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new GetConnectionsForProcessOnFocusedMachineContent(focusedMachineId, processIdOnFocusedMachine, filters, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerDependencyMapContext.Default); + default: + throw new FormatException($"The model {nameof(GetConnectionsForProcessOnFocusedMachineContent)} does not support writing '{options.Format}' format."); + } + } + + GetConnectionsForProcessOnFocusedMachineContent IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeGetConnectionsForProcessOnFocusedMachineContent(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(GetConnectionsForProcessOnFocusedMachineContent)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Models/GetConnectionsForProcessOnFocusedMachineContent.cs b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Models/GetConnectionsForProcessOnFocusedMachineContent.cs new file mode 100644 index 000000000000..5cb48b81fc4b --- /dev/null +++ b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Models/GetConnectionsForProcessOnFocusedMachineContent.cs @@ -0,0 +1,87 @@ +// 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.DependencyMap.Models +{ + /// GetConnectionsForProcessOnFocusedMachine request model. + public partial class GetConnectionsForProcessOnFocusedMachineContent + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Machine arm id. + /// Process id. + /// or is null. + public GetConnectionsForProcessOnFocusedMachineContent(ResourceIdentifier focusedMachineId, string processIdOnFocusedMachine) + { + Argument.AssertNotNull(focusedMachineId, nameof(focusedMachineId)); + Argument.AssertNotNull(processIdOnFocusedMachine, nameof(processIdOnFocusedMachine)); + + FocusedMachineId = focusedMachineId; + ProcessIdOnFocusedMachine = processIdOnFocusedMachine; + } + + /// Initializes a new instance of . + /// Machine arm id. + /// Process id. + /// Filters for GetProcessNetworkConnections. + /// Keeps track of any properties unknown to the library. + internal GetConnectionsForProcessOnFocusedMachineContent(ResourceIdentifier focusedMachineId, string processIdOnFocusedMachine, DependencyMapVisualizationFilter filters, IDictionary serializedAdditionalRawData) + { + FocusedMachineId = focusedMachineId; + ProcessIdOnFocusedMachine = processIdOnFocusedMachine; + Filters = filters; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal GetConnectionsForProcessOnFocusedMachineContent() + { + } + + /// Machine arm id. + public ResourceIdentifier FocusedMachineId { get; } + /// Process id. + public string ProcessIdOnFocusedMachine { get; } + /// Filters for GetProcessNetworkConnections. + public DependencyMapVisualizationFilter Filters { get; set; } + } +} diff --git a/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Models/GetConnectionsWithConnectedMachineForFocusedMachineContent.Serialization.cs b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Models/GetConnectionsWithConnectedMachineForFocusedMachineContent.Serialization.cs new file mode 100644 index 000000000000..bc70be278af1 --- /dev/null +++ b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Models/GetConnectionsWithConnectedMachineForFocusedMachineContent.Serialization.cs @@ -0,0 +1,149 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.DependencyMap.Models +{ + public partial class GetConnectionsWithConnectedMachineForFocusedMachineContent : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(GetConnectionsWithConnectedMachineForFocusedMachineContent)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("focusedMachineId"u8); + writer.WriteStringValue(FocusedMachineId); + writer.WritePropertyName("connectedMachineId"u8); + writer.WriteStringValue(ConnectedMachineId); + if (Optional.IsDefined(Filters)) + { + writer.WritePropertyName("filters"u8); + writer.WriteObjectValue(Filters, options); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + GetConnectionsWithConnectedMachineForFocusedMachineContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(GetConnectionsWithConnectedMachineForFocusedMachineContent)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeGetConnectionsWithConnectedMachineForFocusedMachineContent(document.RootElement, options); + } + + internal static GetConnectionsWithConnectedMachineForFocusedMachineContent DeserializeGetConnectionsWithConnectedMachineForFocusedMachineContent(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ResourceIdentifier focusedMachineId = default; + ResourceIdentifier connectedMachineId = default; + DependencyMapVisualizationFilter filters = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("focusedMachineId"u8)) + { + focusedMachineId = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("connectedMachineId"u8)) + { + connectedMachineId = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("filters"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + filters = DependencyMapVisualizationFilter.DeserializeDependencyMapVisualizationFilter(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new GetConnectionsWithConnectedMachineForFocusedMachineContent(focusedMachineId, connectedMachineId, filters, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerDependencyMapContext.Default); + default: + throw new FormatException($"The model {nameof(GetConnectionsWithConnectedMachineForFocusedMachineContent)} does not support writing '{options.Format}' format."); + } + } + + GetConnectionsWithConnectedMachineForFocusedMachineContent IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeGetConnectionsWithConnectedMachineForFocusedMachineContent(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(GetConnectionsWithConnectedMachineForFocusedMachineContent)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Models/GetConnectionsWithConnectedMachineForFocusedMachineContent.cs b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Models/GetConnectionsWithConnectedMachineForFocusedMachineContent.cs new file mode 100644 index 000000000000..a6c066c17a88 --- /dev/null +++ b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Models/GetConnectionsWithConnectedMachineForFocusedMachineContent.cs @@ -0,0 +1,87 @@ +// 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.DependencyMap.Models +{ + /// GetConnectionsWithConnectedMachineForFocusedMachine request model. + public partial class GetConnectionsWithConnectedMachineForFocusedMachineContent + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Source machine arm id. + /// Destination machine arm id. + /// or is null. + public GetConnectionsWithConnectedMachineForFocusedMachineContent(ResourceIdentifier focusedMachineId, ResourceIdentifier connectedMachineId) + { + Argument.AssertNotNull(focusedMachineId, nameof(focusedMachineId)); + Argument.AssertNotNull(connectedMachineId, nameof(connectedMachineId)); + + FocusedMachineId = focusedMachineId; + ConnectedMachineId = connectedMachineId; + } + + /// Initializes a new instance of . + /// Source machine arm id. + /// Destination machine arm id. + /// Filters for GetNetworkConnectionsBetweenMachines. + /// Keeps track of any properties unknown to the library. + internal GetConnectionsWithConnectedMachineForFocusedMachineContent(ResourceIdentifier focusedMachineId, ResourceIdentifier connectedMachineId, DependencyMapVisualizationFilter filters, IDictionary serializedAdditionalRawData) + { + FocusedMachineId = focusedMachineId; + ConnectedMachineId = connectedMachineId; + Filters = filters; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal GetConnectionsWithConnectedMachineForFocusedMachineContent() + { + } + + /// Source machine arm id. + public ResourceIdentifier FocusedMachineId { get; } + /// Destination machine arm id. + public ResourceIdentifier ConnectedMachineId { get; } + /// Filters for GetNetworkConnectionsBetweenMachines. + public DependencyMapVisualizationFilter Filters { get; set; } + } +} diff --git a/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Models/GetDependencyViewForFocusedMachineContent.Serialization.cs b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Models/GetDependencyViewForFocusedMachineContent.Serialization.cs new file mode 100644 index 000000000000..c56cb49aa277 --- /dev/null +++ b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Models/GetDependencyViewForFocusedMachineContent.Serialization.cs @@ -0,0 +1,141 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.DependencyMap.Models +{ + public partial class GetDependencyViewForFocusedMachineContent : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(GetDependencyViewForFocusedMachineContent)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("focusedMachineId"u8); + writer.WriteStringValue(FocusedMachineId); + if (Optional.IsDefined(Filters)) + { + writer.WritePropertyName("filters"u8); + writer.WriteObjectValue(Filters, options); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + GetDependencyViewForFocusedMachineContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(GetDependencyViewForFocusedMachineContent)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeGetDependencyViewForFocusedMachineContent(document.RootElement, options); + } + + internal static GetDependencyViewForFocusedMachineContent DeserializeGetDependencyViewForFocusedMachineContent(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ResourceIdentifier focusedMachineId = default; + DependencyMapVisualizationFilter filters = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("focusedMachineId"u8)) + { + focusedMachineId = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("filters"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + filters = DependencyMapVisualizationFilter.DeserializeDependencyMapVisualizationFilter(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new GetDependencyViewForFocusedMachineContent(focusedMachineId, filters, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerDependencyMapContext.Default); + default: + throw new FormatException($"The model {nameof(GetDependencyViewForFocusedMachineContent)} does not support writing '{options.Format}' format."); + } + } + + GetDependencyViewForFocusedMachineContent IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeGetDependencyViewForFocusedMachineContent(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(GetDependencyViewForFocusedMachineContent)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Models/GetDependencyViewForFocusedMachineContent.cs b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Models/GetDependencyViewForFocusedMachineContent.cs new file mode 100644 index 000000000000..91b8318c3ee0 --- /dev/null +++ b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Models/GetDependencyViewForFocusedMachineContent.cs @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.DependencyMap.Models +{ + /// GetDependencyViewForFocusedMachine request model. + public partial class GetDependencyViewForFocusedMachineContent + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Machine arm id. + /// is null. + public GetDependencyViewForFocusedMachineContent(ResourceIdentifier focusedMachineId) + { + Argument.AssertNotNull(focusedMachineId, nameof(focusedMachineId)); + + FocusedMachineId = focusedMachineId; + } + + /// Initializes a new instance of . + /// Machine arm id. + /// Filters for GetSingleMachineDependencyView. + /// Keeps track of any properties unknown to the library. + internal GetDependencyViewForFocusedMachineContent(ResourceIdentifier focusedMachineId, DependencyMapVisualizationFilter filters, IDictionary serializedAdditionalRawData) + { + FocusedMachineId = focusedMachineId; + Filters = filters; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal GetDependencyViewForFocusedMachineContent() + { + } + + /// Machine arm id. + public ResourceIdentifier FocusedMachineId { get; } + /// Filters for GetSingleMachineDependencyView. + public DependencyMapVisualizationFilter Filters { get; set; } + } +} diff --git a/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Models/MapsResourceListResult.Serialization.cs b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Models/MapsResourceListResult.Serialization.cs new file mode 100644 index 000000000000..2c84e8f3b8f7 --- /dev/null +++ b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Models/MapsResourceListResult.Serialization.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.DependencyMap.Models +{ + internal partial class MapsResourceListResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(MapsResourceListResult)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink.AbsoluteUri); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + MapsResourceListResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(MapsResourceListResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeMapsResourceListResult(document.RootElement, options); + } + + internal static MapsResourceListResult DeserializeMapsResourceListResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList value = default; + Uri nextLink = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DependencyMapData.DeserializeDependencyMapData(item, options)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = new Uri(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new MapsResourceListResult(value, nextLink, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerDependencyMapContext.Default); + default: + throw new FormatException($"The model {nameof(MapsResourceListResult)} does not support writing '{options.Format}' format."); + } + } + + MapsResourceListResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeMapsResourceListResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(MapsResourceListResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Models/MapsResourceListResult.cs b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Models/MapsResourceListResult.cs new file mode 100644 index 000000000000..aceec270ff82 --- /dev/null +++ b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Models/MapsResourceListResult.cs @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.ResourceManager.DependencyMap.Models +{ + /// The response of a MapsResource list operation. + internal partial class MapsResourceListResult + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The MapsResource items on this page. + /// is null. + internal MapsResourceListResult(IEnumerable value) + { + Argument.AssertNotNull(value, nameof(value)); + + Value = value.ToList(); + } + + /// Initializes a new instance of . + /// The MapsResource items on this page. + /// The link to the next page of items. + /// Keeps track of any properties unknown to the library. + internal MapsResourceListResult(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) + { + Value = value; + NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal MapsResourceListResult() + { + } + + /// The MapsResource items on this page. + public IReadOnlyList Value { get; } + /// The link to the next page of items. + public Uri NextLink { get; } + } +} diff --git a/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Models/OffAzureDiscoverySourceProperties.Serialization.cs b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Models/OffAzureDiscoverySourceProperties.Serialization.cs new file mode 100644 index 000000000000..ed4ecceaba85 --- /dev/null +++ b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Models/OffAzureDiscoverySourceProperties.Serialization.cs @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.DependencyMap.Models +{ + public partial class OffAzureDiscoverySourceProperties : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(OffAzureDiscoverySourceProperties)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + } + + OffAzureDiscoverySourceProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(OffAzureDiscoverySourceProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeOffAzureDiscoverySourceProperties(document.RootElement, options); + } + + internal static OffAzureDiscoverySourceProperties DeserializeOffAzureDiscoverySourceProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + DependencyMapProvisioningState? provisioningState = default; + SourceType sourceType = default; + ResourceIdentifier sourceId = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("provisioningState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new DependencyMapProvisioningState(property.Value.GetString()); + continue; + } + if (property.NameEquals("sourceType"u8)) + { + sourceType = new SourceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("sourceId"u8)) + { + sourceId = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new OffAzureDiscoverySourceProperties(provisioningState, sourceType, sourceId, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerDependencyMapContext.Default); + default: + throw new FormatException($"The model {nameof(OffAzureDiscoverySourceProperties)} does not support writing '{options.Format}' format."); + } + } + + OffAzureDiscoverySourceProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeOffAzureDiscoverySourceProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(OffAzureDiscoverySourceProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Models/OffAzureDiscoverySourceProperties.cs b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Models/OffAzureDiscoverySourceProperties.cs new file mode 100644 index 000000000000..a54245ffc737 --- /dev/null +++ b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Models/OffAzureDiscoverySourceProperties.cs @@ -0,0 +1,42 @@ +// 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.DependencyMap.Models +{ + /// OffAzure discovery source resource properties. + public partial class OffAzureDiscoverySourceProperties : DependencyMapDiscoverySourceProperties + { + /// Initializes a new instance of . + /// Source ArmId of Discovery Source resource. + /// is null. + public OffAzureDiscoverySourceProperties(ResourceIdentifier sourceId) : base(sourceId) + { + Argument.AssertNotNull(sourceId, nameof(sourceId)); + + SourceType = SourceType.OffAzure; + } + + /// Initializes a new instance of . + /// Provisioning state of Discovery Source resource. + /// Source type of Discovery Source resource. + /// Source ArmId of Discovery Source resource. + /// Keeps track of any properties unknown to the library. + internal OffAzureDiscoverySourceProperties(DependencyMapProvisioningState? provisioningState, SourceType sourceType, ResourceIdentifier sourceId, IDictionary serializedAdditionalRawData) : base(provisioningState, sourceType, sourceId, serializedAdditionalRawData) + { + SourceType = sourceType; + } + + /// Initializes a new instance of for deserialization. + internal OffAzureDiscoverySourceProperties() + { + } + } +} diff --git a/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Models/SourceType.cs b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Models/SourceType.cs new file mode 100644 index 000000000000..6e1732d5abca --- /dev/null +++ b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Models/SourceType.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.DependencyMap.Models +{ + /// Source type of the discoverySource. + internal readonly partial struct SourceType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public SourceType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string OffAzureValue = "OffAzure"; + + /// OffAzure source type. + public static SourceType OffAzure { get; } = new SourceType(OffAzureValue); + /// Determines if two values are the same. + public static bool operator ==(SourceType left, SourceType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(SourceType left, SourceType right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator SourceType(string value) => new SourceType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is SourceType other && Equals(other); + /// + public bool Equals(SourceType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Models/UnknownDependencyMapDiscoverySourceProperties.Serialization.cs b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Models/UnknownDependencyMapDiscoverySourceProperties.Serialization.cs new file mode 100644 index 000000000000..11b36fe54923 --- /dev/null +++ b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Models/UnknownDependencyMapDiscoverySourceProperties.Serialization.cs @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.DependencyMap.Models +{ + internal partial class UnknownDependencyMapDiscoverySourceProperties : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DependencyMapDiscoverySourceProperties)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + } + + DependencyMapDiscoverySourceProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DependencyMapDiscoverySourceProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDependencyMapDiscoverySourceProperties(document.RootElement, options); + } + + internal static UnknownDependencyMapDiscoverySourceProperties DeserializeUnknownDependencyMapDiscoverySourceProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + DependencyMapProvisioningState? provisioningState = default; + SourceType sourceType = "Unknown"; + ResourceIdentifier sourceId = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("provisioningState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new DependencyMapProvisioningState(property.Value.GetString()); + continue; + } + if (property.NameEquals("sourceType"u8)) + { + sourceType = new SourceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("sourceId"u8)) + { + sourceId = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new UnknownDependencyMapDiscoverySourceProperties(provisioningState, sourceType, sourceId, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerDependencyMapContext.Default); + default: + throw new FormatException($"The model {nameof(DependencyMapDiscoverySourceProperties)} does not support writing '{options.Format}' format."); + } + } + + DependencyMapDiscoverySourceProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeDependencyMapDiscoverySourceProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DependencyMapDiscoverySourceProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Models/UnknownDependencyMapDiscoverySourceProperties.cs b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Models/UnknownDependencyMapDiscoverySourceProperties.cs new file mode 100644 index 000000000000..28c559728f84 --- /dev/null +++ b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Models/UnknownDependencyMapDiscoverySourceProperties.cs @@ -0,0 +1,32 @@ +// 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.DependencyMap.Models +{ + /// Unknown version of DependencyMapDiscoverySourceProperties. + internal partial class UnknownDependencyMapDiscoverySourceProperties : DependencyMapDiscoverySourceProperties + { + /// Initializes a new instance of . + /// Provisioning state of Discovery Source resource. + /// Source type of Discovery Source resource. + /// Source ArmId of Discovery Source resource. + /// Keeps track of any properties unknown to the library. + internal UnknownDependencyMapDiscoverySourceProperties(DependencyMapProvisioningState? provisioningState, SourceType sourceType, ResourceIdentifier sourceId, IDictionary serializedAdditionalRawData) : base(provisioningState, sourceType, sourceId, serializedAdditionalRawData) + { + SourceType = sourceType; + } + + /// Initializes a new instance of for deserialization. + internal UnknownDependencyMapDiscoverySourceProperties() + { + } + } +} diff --git a/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/ProviderConstants.cs b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/ProviderConstants.cs new file mode 100644 index 000000000000..24660c191602 --- /dev/null +++ b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/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.DependencyMap +{ + internal static class ProviderConstants + { + public static string DefaultProviderNamespace { get; } = ClientDiagnostics.GetResourceProviderNamespace(typeof(ProviderConstants).Assembly); + } +} diff --git a/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/RestOperations/DiscoverySourcesRestOperations.cs b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/RestOperations/DiscoverySourcesRestOperations.cs new file mode 100644 index 000000000000..24713c3bfaa6 --- /dev/null +++ b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/RestOperations/DiscoverySourcesRestOperations.cs @@ -0,0 +1,613 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.DependencyMap.Models; + +namespace Azure.ResourceManager.DependencyMap +{ + internal partial class DiscoverySourcesRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of DiscoverySourcesRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// Service host. + /// The API version to use for this operation. + /// or is null. + public DiscoverySourcesRestOperations(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 ?? "2025-01-31-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string mapName, string sourceName) + { + 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.DependencyMap/maps/", false); + uri.AppendPath(mapName, true); + uri.AppendPath("/discoverySources/", false); + uri.AppendPath(sourceName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string mapName, string sourceName) + { + 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.DependencyMap/maps/", false); + uri.AppendPath(mapName, true); + uri.AppendPath("/discoverySources/", false); + uri.AppendPath(sourceName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get a DiscoverySourceResource. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Maps resource name. + /// discovery source 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 mapName, string sourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(mapName, nameof(mapName)); + Argument.AssertNotNullOrEmpty(sourceName, nameof(sourceName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, mapName, sourceName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DependencyMapDiscoverySourceData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = DependencyMapDiscoverySourceData.DeserializeDependencyMapDiscoverySourceData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((DependencyMapDiscoverySourceData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get a DiscoverySourceResource. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Maps resource name. + /// discovery source 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 mapName, string sourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(mapName, nameof(mapName)); + Argument.AssertNotNullOrEmpty(sourceName, nameof(sourceName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, mapName, sourceName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DependencyMapDiscoverySourceData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = DependencyMapDiscoverySourceData.DeserializeDependencyMapDiscoverySourceData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((DependencyMapDiscoverySourceData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, string resourceGroupName, string mapName, string sourceName, DependencyMapDiscoverySourceData data) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DependencyMap/maps/", false); + uri.AppendPath(mapName, true); + uri.AppendPath("/discoverySources/", false); + uri.AppendPath(sourceName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string mapName, string sourceName, DependencyMapDiscoverySourceData 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.DependencyMap/maps/", false); + uri.AppendPath(mapName, true); + uri.AppendPath("/discoverySources/", false); + uri.AppendPath(sourceName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data, ModelSerializationExtensions.WireOptions); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Create a DiscoverySourceResource. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Maps resource name. + /// discovery source resource. + /// Resource create parameters. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string mapName, string sourceName, DependencyMapDiscoverySourceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(mapName, nameof(mapName)); + Argument.AssertNotNullOrEmpty(sourceName, nameof(sourceName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, mapName, sourceName, data); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Create a DiscoverySourceResource. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Maps resource name. + /// discovery source resource. + /// Resource create parameters. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string mapName, string sourceName, DependencyMapDiscoverySourceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(mapName, nameof(mapName)); + Argument.AssertNotNullOrEmpty(sourceName, nameof(sourceName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, mapName, sourceName, data); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateUpdateRequestUri(string subscriptionId, string resourceGroupName, string mapName, string sourceName, DependencyMapDiscoverySourcePatch 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.DependencyMap/maps/", false); + uri.AppendPath(mapName, true); + uri.AppendPath("/discoverySources/", false); + uri.AppendPath(sourceName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string mapName, string sourceName, DependencyMapDiscoverySourcePatch patch) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Patch; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DependencyMap/maps/", false); + uri.AppendPath(mapName, true); + uri.AppendPath("/discoverySources/", false); + uri.AppendPath(sourceName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(patch, ModelSerializationExtensions.WireOptions); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Update a DiscoverySourceResource. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Maps resource name. + /// discovery source resource. + /// The resource properties to be updated. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task UpdateAsync(string subscriptionId, string resourceGroupName, string mapName, string sourceName, DependencyMapDiscoverySourcePatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(mapName, nameof(mapName)); + Argument.AssertNotNullOrEmpty(sourceName, nameof(sourceName)); + Argument.AssertNotNull(patch, nameof(patch)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, mapName, sourceName, patch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Update a DiscoverySourceResource. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Maps resource name. + /// discovery source resource. + /// The resource properties to be updated. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Update(string subscriptionId, string resourceGroupName, string mapName, string sourceName, DependencyMapDiscoverySourcePatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(mapName, nameof(mapName)); + Argument.AssertNotNullOrEmpty(sourceName, nameof(sourceName)); + Argument.AssertNotNull(patch, nameof(patch)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, mapName, sourceName, patch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string resourceGroupName, string mapName, string sourceName) + { + 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.DependencyMap/maps/", false); + uri.AppendPath(mapName, true); + uri.AppendPath("/discoverySources/", false); + uri.AppendPath(sourceName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string mapName, string sourceName) + { + 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.DependencyMap/maps/", false); + uri.AppendPath(mapName, true); + uri.AppendPath("/discoverySources/", false); + uri.AppendPath(sourceName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Delete a DiscoverySourceResource. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Maps resource name. + /// discovery source resource. + /// 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 mapName, string sourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(mapName, nameof(mapName)); + Argument.AssertNotNullOrEmpty(sourceName, nameof(sourceName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, mapName, sourceName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Delete a DiscoverySourceResource. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Maps resource name. + /// discovery source resource. + /// 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 mapName, string sourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(mapName, nameof(mapName)); + Argument.AssertNotNullOrEmpty(sourceName, nameof(sourceName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, mapName, sourceName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListByMapsResourceRequestUri(string subscriptionId, string resourceGroupName, string mapName) + { + 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.DependencyMap/maps/", false); + uri.AppendPath(mapName, true); + uri.AppendPath("/discoverySources", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateListByMapsResourceRequest(string subscriptionId, string resourceGroupName, string mapName) + { + 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.DependencyMap/maps/", false); + uri.AppendPath(mapName, true); + uri.AppendPath("/discoverySources", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List DiscoverySourceResource resources by MapsResource. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Maps resource name. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListByMapsResourceAsync(string subscriptionId, string resourceGroupName, string mapName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(mapName, nameof(mapName)); + + using var message = CreateListByMapsResourceRequest(subscriptionId, resourceGroupName, mapName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DiscoverySourceResourceListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = DiscoverySourceResourceListResult.DeserializeDiscoverySourceResourceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List DiscoverySourceResource resources by MapsResource. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Maps resource name. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListByMapsResource(string subscriptionId, string resourceGroupName, string mapName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(mapName, nameof(mapName)); + + using var message = CreateListByMapsResourceRequest(subscriptionId, resourceGroupName, mapName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DiscoverySourceResourceListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = DiscoverySourceResourceListResult.DeserializeDiscoverySourceResourceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListByMapsResourceNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, string mapName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + return uri; + } + + internal HttpMessage CreateListByMapsResourceNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string mapName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List DiscoverySourceResource resources by MapsResource. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Maps resource name. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListByMapsResourceNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string mapName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(mapName, nameof(mapName)); + + using var message = CreateListByMapsResourceNextPageRequest(nextLink, subscriptionId, resourceGroupName, mapName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DiscoverySourceResourceListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = DiscoverySourceResourceListResult.DeserializeDiscoverySourceResourceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List DiscoverySourceResource resources by MapsResource. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Maps resource name. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListByMapsResourceNextPage(string nextLink, string subscriptionId, string resourceGroupName, string mapName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(mapName, nameof(mapName)); + + using var message = CreateListByMapsResourceNextPageRequest(nextLink, subscriptionId, resourceGroupName, mapName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DiscoverySourceResourceListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = DiscoverySourceResourceListResult.DeserializeDiscoverySourceResourceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/RestOperations/MapsRestOperations.cs b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/RestOperations/MapsRestOperations.cs new file mode 100644 index 000000000000..e0d57f79ed10 --- /dev/null +++ b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/RestOperations/MapsRestOperations.cs @@ -0,0 +1,1091 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.DependencyMap.Models; + +namespace Azure.ResourceManager.DependencyMap +{ + internal partial class MapsRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of MapsRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// Service host. + /// The API version to use for this operation. + /// or is null. + public MapsRestOperations(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 ?? "2025-01-31-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string mapName) + { + 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.DependencyMap/maps/", false); + uri.AppendPath(mapName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string mapName) + { + 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.DependencyMap/maps/", false); + uri.AppendPath(mapName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get a MapsResource. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Maps resource name. + /// 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 mapName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(mapName, nameof(mapName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, mapName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DependencyMapData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = DependencyMapData.DeserializeDependencyMapData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((DependencyMapData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get a MapsResource. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Maps resource name. + /// 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 mapName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(mapName, nameof(mapName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, mapName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DependencyMapData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = DependencyMapData.DeserializeDependencyMapData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((DependencyMapData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, string resourceGroupName, string mapName, DependencyMapData data) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DependencyMap/maps/", false); + uri.AppendPath(mapName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string mapName, DependencyMapData 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.DependencyMap/maps/", false); + uri.AppendPath(mapName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data, ModelSerializationExtensions.WireOptions); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Create a MapsResource. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Maps resource name. + /// Resource create parameters. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string mapName, DependencyMapData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(mapName, nameof(mapName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, mapName, data); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Create a MapsResource. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Maps resource name. + /// Resource create parameters. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string mapName, DependencyMapData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(mapName, nameof(mapName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, mapName, data); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateUpdateRequestUri(string subscriptionId, string resourceGroupName, string mapName, DependencyMapPatch 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.DependencyMap/maps/", false); + uri.AppendPath(mapName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string mapName, DependencyMapPatch patch) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Patch; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DependencyMap/maps/", false); + uri.AppendPath(mapName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(patch, ModelSerializationExtensions.WireOptions); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Update a MapsResource. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Maps resource name. + /// The resource properties to be updated. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task UpdateAsync(string subscriptionId, string resourceGroupName, string mapName, DependencyMapPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(mapName, nameof(mapName)); + Argument.AssertNotNull(patch, nameof(patch)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, mapName, patch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Update a MapsResource. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Maps resource name. + /// The resource properties to be updated. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response Update(string subscriptionId, string resourceGroupName, string mapName, DependencyMapPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(mapName, nameof(mapName)); + Argument.AssertNotNull(patch, nameof(patch)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, mapName, patch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string resourceGroupName, string mapName) + { + 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.DependencyMap/maps/", false); + uri.AppendPath(mapName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string mapName) + { + 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.DependencyMap/maps/", false); + uri.AppendPath(mapName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Delete a MapsResource. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Maps resource name. + /// 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 mapName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(mapName, nameof(mapName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, mapName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Delete a MapsResource. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Maps resource name. + /// 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 mapName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(mapName, nameof(mapName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, mapName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListByResourceGroupRequestUri(string subscriptionId, string resourceGroupName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DependencyMap/maps", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + 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.DependencyMap/maps", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List MapsResource resources by resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public async Task> 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: + { + MapsResourceListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = MapsResourceListResult.DeserializeMapsResourceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List MapsResource resources by resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public Response 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: + { + MapsResourceListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = MapsResourceListResult.DeserializeMapsResourceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListBySubscriptionRequestUri(string subscriptionId) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.DependencyMap/maps", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateListBySubscriptionRequest(string subscriptionId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.DependencyMap/maps", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List MapsResource resources by subscription ID. + /// The ID of the target subscription. The value must be an UUID. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public async Task> ListBySubscriptionAsync(string subscriptionId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListBySubscriptionRequest(subscriptionId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + MapsResourceListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = MapsResourceListResult.DeserializeMapsResourceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List MapsResource resources by subscription ID. + /// The ID of the target subscription. The value must be an UUID. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public Response ListBySubscription(string subscriptionId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListBySubscriptionRequest(subscriptionId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + MapsResourceListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = MapsResourceListResult.DeserializeMapsResourceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateGetDependencyViewForFocusedMachineRequestUri(string subscriptionId, string resourceGroupName, string mapName, GetDependencyViewForFocusedMachineContent content) + { + 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.DependencyMap/maps/", false); + uri.AppendPath(mapName, true); + uri.AppendPath("/getDependencyViewForFocusedMachine", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateGetDependencyViewForFocusedMachineRequest(string subscriptionId, string resourceGroupName, string mapName, GetDependencyViewForFocusedMachineContent 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.DependencyMap/maps/", false); + uri.AppendPath(mapName, true); + uri.AppendPath("/getDependencyViewForFocusedMachine", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content0 = new Utf8JsonRequestContent(); + content0.JsonWriter.WriteObjectValue(content, ModelSerializationExtensions.WireOptions); + request.Content = content0; + _userAgent.Apply(message); + return message; + } + + /// Get dependency map of single machine. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Maps resource name. + /// The content of the action request. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task GetDependencyViewForFocusedMachineAsync(string subscriptionId, string resourceGroupName, string mapName, GetDependencyViewForFocusedMachineContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(mapName, nameof(mapName)); + Argument.AssertNotNull(content, nameof(content)); + + using var message = CreateGetDependencyViewForFocusedMachineRequest(subscriptionId, resourceGroupName, mapName, content); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get dependency map of single machine. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Maps resource name. + /// The content of the action request. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response GetDependencyViewForFocusedMachine(string subscriptionId, string resourceGroupName, string mapName, GetDependencyViewForFocusedMachineContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(mapName, nameof(mapName)); + Argument.AssertNotNull(content, nameof(content)); + + using var message = CreateGetDependencyViewForFocusedMachineRequest(subscriptionId, resourceGroupName, mapName, content); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateGetConnectionsWithConnectedMachineForFocusedMachineRequestUri(string subscriptionId, string resourceGroupName, string mapName, GetConnectionsWithConnectedMachineForFocusedMachineContent content) + { + 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.DependencyMap/maps/", false); + uri.AppendPath(mapName, true); + uri.AppendPath("/getConnectionsWithConnectedMachineForFocusedMachine", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateGetConnectionsWithConnectedMachineForFocusedMachineRequest(string subscriptionId, string resourceGroupName, string mapName, GetConnectionsWithConnectedMachineForFocusedMachineContent 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.DependencyMap/maps/", false); + uri.AppendPath(mapName, true); + uri.AppendPath("/getConnectionsWithConnectedMachineForFocusedMachine", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content0 = new Utf8JsonRequestContent(); + content0.JsonWriter.WriteObjectValue(content, ModelSerializationExtensions.WireOptions); + request.Content = content0; + _userAgent.Apply(message); + return message; + } + + /// Get network connections between machines. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Maps resource name. + /// The content of the action request. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task GetConnectionsWithConnectedMachineForFocusedMachineAsync(string subscriptionId, string resourceGroupName, string mapName, GetConnectionsWithConnectedMachineForFocusedMachineContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(mapName, nameof(mapName)); + Argument.AssertNotNull(content, nameof(content)); + + using var message = CreateGetConnectionsWithConnectedMachineForFocusedMachineRequest(subscriptionId, resourceGroupName, mapName, content); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get network connections between machines. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Maps resource name. + /// The content of the action request. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response GetConnectionsWithConnectedMachineForFocusedMachine(string subscriptionId, string resourceGroupName, string mapName, GetConnectionsWithConnectedMachineForFocusedMachineContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(mapName, nameof(mapName)); + Argument.AssertNotNull(content, nameof(content)); + + using var message = CreateGetConnectionsWithConnectedMachineForFocusedMachineRequest(subscriptionId, resourceGroupName, mapName, content); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateGetConnectionsForProcessOnFocusedMachineRequestUri(string subscriptionId, string resourceGroupName, string mapName, GetConnectionsForProcessOnFocusedMachineContent content) + { + 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.DependencyMap/maps/", false); + uri.AppendPath(mapName, true); + uri.AppendPath("/getConnectionsForProcessOnFocusedMachine", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateGetConnectionsForProcessOnFocusedMachineRequest(string subscriptionId, string resourceGroupName, string mapName, GetConnectionsForProcessOnFocusedMachineContent 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.DependencyMap/maps/", false); + uri.AppendPath(mapName, true); + uri.AppendPath("/getConnectionsForProcessOnFocusedMachine", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content0 = new Utf8JsonRequestContent(); + content0.JsonWriter.WriteObjectValue(content, ModelSerializationExtensions.WireOptions); + request.Content = content0; + _userAgent.Apply(message); + return message; + } + + /// Get network connections of a process. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Maps resource name. + /// The content of the action request. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task GetConnectionsForProcessOnFocusedMachineAsync(string subscriptionId, string resourceGroupName, string mapName, GetConnectionsForProcessOnFocusedMachineContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(mapName, nameof(mapName)); + Argument.AssertNotNull(content, nameof(content)); + + using var message = CreateGetConnectionsForProcessOnFocusedMachineRequest(subscriptionId, resourceGroupName, mapName, content); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get network connections of a process. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Maps resource name. + /// The content of the action request. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response GetConnectionsForProcessOnFocusedMachine(string subscriptionId, string resourceGroupName, string mapName, GetConnectionsForProcessOnFocusedMachineContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(mapName, nameof(mapName)); + Argument.AssertNotNull(content, nameof(content)); + + using var message = CreateGetConnectionsForProcessOnFocusedMachineRequest(subscriptionId, resourceGroupName, mapName, content); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateExportDependenciesRequestUri(string subscriptionId, string resourceGroupName, string mapName, ExportDependenciesContent content) + { + 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.DependencyMap/maps/", false); + uri.AppendPath(mapName, true); + uri.AppendPath("/exportDependencies", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateExportDependenciesRequest(string subscriptionId, string resourceGroupName, string mapName, ExportDependenciesContent 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.DependencyMap/maps/", false); + uri.AppendPath(mapName, true); + uri.AppendPath("/exportDependencies", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content0 = new Utf8JsonRequestContent(); + content0.JsonWriter.WriteObjectValue(content, ModelSerializationExtensions.WireOptions); + request.Content = content0; + _userAgent.Apply(message); + return message; + } + + /// Export dependencies. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Maps resource name. + /// The content of the action request. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task ExportDependenciesAsync(string subscriptionId, string resourceGroupName, string mapName, ExportDependenciesContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(mapName, nameof(mapName)); + Argument.AssertNotNull(content, nameof(content)); + + using var message = CreateExportDependenciesRequest(subscriptionId, resourceGroupName, mapName, content); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Export dependencies. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Maps resource name. + /// The content of the action request. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ExportDependencies(string subscriptionId, string resourceGroupName, string mapName, ExportDependenciesContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(mapName, nameof(mapName)); + Argument.AssertNotNull(content, nameof(content)); + + using var message = CreateExportDependenciesRequest(subscriptionId, resourceGroupName, mapName, content); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListByResourceGroupNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + return uri; + } + + 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; + } + + /// List MapsResource resources by resource group. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The cancellation token to use. + /// , or is null. + /// or is an empty string, and was expected to be non-empty. + public async Task> 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: + { + MapsResourceListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = MapsResourceListResult.DeserializeMapsResourceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List MapsResource resources by resource group. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The cancellation token to use. + /// , or is null. + /// or is an empty string, and was expected to be non-empty. + public Response 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: + { + MapsResourceListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = MapsResourceListResult.DeserializeMapsResourceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListBySubscriptionNextPageRequestUri(string nextLink, string subscriptionId) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + return uri; + } + + internal HttpMessage CreateListBySubscriptionNextPageRequest(string nextLink, string subscriptionId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List MapsResource resources by subscription ID. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public async Task> ListBySubscriptionNextPageAsync(string nextLink, string subscriptionId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListBySubscriptionNextPageRequest(nextLink, subscriptionId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + MapsResourceListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = MapsResourceListResult.DeserializeMapsResourceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List MapsResource resources by subscription ID. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public Response ListBySubscriptionNextPage(string nextLink, string subscriptionId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListBySubscriptionNextPageRequest(nextLink, subscriptionId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + MapsResourceListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = MapsResourceListResult.DeserializeMapsResourceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Properties/AssemblyInfo.cs b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Properties/AssemblyInfo.cs new file mode 100644 index 000000000000..76da9bae4e8d --- /dev/null +++ b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Properties/AssemblyInfo.cs @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System.Runtime.CompilerServices; + +[assembly: InternalsVisibleTo("Azure.ResourceManager.DependencyMap.Tests, PublicKey = 0024000004800000940000000602000000240000525341310004000001000100d15ddcb29688295338af4b7686603fe614abd555e09efba8fb88ee09e1f7b1ccaeed2e8f823fa9eef3fdd60217fc012ea67d2479751a0b8c087a4185541b851bd8b16f8d91b840e51b1cb0ba6fe647997e57429265e85ef62d565db50a69ae1647d54d7bd855e4db3d8a91510e5bcbd0edfbbecaa20a7bd9ae74593daa7b11b4")] + +// Replace Microsoft.Test with the correct resource provider namepace for your service and uncomment. +// See https://docs.microsoft.com/en-us/azure/azure-resource-manager/management/azure-services-resource-providers +// for the list of possible values. +[assembly: Azure.Core.AzureResourceProviderNamespace("DependencyMap")] diff --git a/sdk/dependencymap/Azure.ResourceManager.DependencyMap/tests/Azure.ResourceManager.DependencyMap.Tests.csproj b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/tests/Azure.ResourceManager.DependencyMap.Tests.csproj new file mode 100644 index 000000000000..11a53c99de60 --- /dev/null +++ b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/tests/Azure.ResourceManager.DependencyMap.Tests.csproj @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/sdk/dependencymap/Azure.ResourceManager.DependencyMap/tests/DependencyMapManagementTestBase.cs b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/tests/DependencyMapManagementTestBase.cs new file mode 100644 index 000000000000..6d7ae4763bd4 --- /dev/null +++ b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/tests/DependencyMapManagementTestBase.cs @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using Azure; +using Azure.Core; +using Azure.Core.TestFramework; +using Azure.ResourceManager; +using Azure.ResourceManager.Resources; +using Azure.ResourceManager.TestFramework; +using NUnit.Framework; +using System.Threading.Tasks; + +namespace Azure.ResourceManager.DependencyMap.Tests +{ + public class DependencyMapManagementTestBase : ManagementRecordedTestBase + { + protected ArmClient Client { get; private set; } + protected SubscriptionResource DefaultSubscription { get; private set; } + + protected DependencyMapManagementTestBase(bool isAsync, RecordedTestMode mode) + : base(isAsync, mode) + { + } + + protected DependencyMapManagementTestBase(bool isAsync) + : base(isAsync) + { + } + + [SetUp] + public async Task CreateCommonClient() + { + Client = GetArmClient(); + DefaultSubscription = await Client.GetDefaultSubscriptionAsync().ConfigureAwait(false); + } + + protected async Task CreateResourceGroup(SubscriptionResource subscription, string rgNamePrefix, AzureLocation location) + { + string rgName = Recording.GenerateAssetName(rgNamePrefix); + ResourceGroupData input = new ResourceGroupData(location); + var lro = await subscription.GetResourceGroups().CreateOrUpdateAsync(WaitUntil.Completed, rgName, input); + return lro.Value; + } + } +} diff --git a/sdk/dependencymap/Azure.ResourceManager.DependencyMap/tests/DependencyMapManagementTestEnvironment.cs b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/tests/DependencyMapManagementTestEnvironment.cs new file mode 100644 index 000000000000..6121eda4251a --- /dev/null +++ b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/tests/DependencyMapManagementTestEnvironment.cs @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using Azure.Core.TestFramework; + +namespace Azure.ResourceManager.DependencyMap.Tests +{ + public class DependencyMapManagementTestEnvironment : TestEnvironment + { + } +} diff --git a/sdk/dependencymap/Azure.ResourceManager.DependencyMap/tsp-location.yaml b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/tsp-location.yaml new file mode 100644 index 000000000000..27f501953343 --- /dev/null +++ b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/tsp-location.yaml @@ -0,0 +1,4 @@ +directory: specification/azuredependencymap/DependencyMap.Management +commit: c8294111be770343690a652c4a6d381dce297712 +repo: Azure/azure-rest-api-specs +additionalDirectories: diff --git a/sdk/dependencymap/ci.mgmt.yml b/sdk/dependencymap/ci.mgmt.yml new file mode 100644 index 000000000000..8a338eb1f795 --- /dev/null +++ b/sdk/dependencymap/ci.mgmt.yml @@ -0,0 +1,26 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. + +trigger: none + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/dependencymap /ci.mgmt.yml + - sdk/dependencymap /Azure.ResourceManager.DependencyMap / + + +extends: + template: /eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: dependencymap + ArtifactName: packages + LimitForPullRequest: true + Artifacts: + - name: Azure.ResourceManager.DependencyMap + safeName: AzureResourceManagerDependencyMap diff --git a/sdk/resourcemanager/ci.mgmt.yml b/sdk/resourcemanager/ci.mgmt.yml index d084cd6ecbb7..48f5ec6af73e 100644 --- a/sdk/resourcemanager/ci.mgmt.yml +++ b/sdk/resourcemanager/ci.mgmt.yml @@ -70,6 +70,7 @@ trigger: - sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup - sdk/datashare/Azure.ResourceManager.DataShare - sdk/defendereasm/Azure.ResourceManager.DefenderEasm + - sdk/dependencymap/Azure.ResourceManager.DependencyMap - sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization - sdk/devcenter/Azure.ResourceManager.DevCenter - sdk/deviceprovisioningservices/Azure.ResourceManager.DeviceProvisioningServices @@ -287,6 +288,7 @@ pr: - sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup - sdk/datashare/Azure.ResourceManager.DataShare - sdk/defendereasm/Azure.ResourceManager.DefenderEasm + - sdk/dependencymap/Azure.ResourceManager.DependencyMap - sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization - sdk/devcenter/Azure.ResourceManager.DevCenter - sdk/deviceprovisioningservices/Azure.ResourceManager.DeviceProvisioningServices diff --git a/sdk/storage/ci.yml b/sdk/storage/ci.yml index 2ca0501b60bd..4e749e6b85b1 100644 --- a/sdk/storage/ci.yml +++ b/sdk/storage/ci.yml @@ -12,6 +12,8 @@ trigger: - sdk/storage/Azure.Storage.DataMovement/ - sdk/storage/Azure.Storage.DataMovement.Blobs/ - sdk/storage/Azure.Storage.DataMovement.Files/ + exclude: + - sdk/storage/Azure.ResourceManager.Storage/ - sdk/storage/Azure.Storage.DataMovement.Blobs.Files.Shares/ exclude: - sdk/storage/Azure.ResourceManager.Storage/