diff --git a/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/Azure.ResourceManager.CarbonOptimization.sln b/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/Azure.ResourceManager.CarbonOptimization.sln new file mode 100644 index 000000000000..0e635ab65ef3 --- /dev/null +++ b/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/Azure.ResourceManager.CarbonOptimization.sln @@ -0,0 +1,54 @@ +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.CarbonOptimization.Samples", "samples\Azure.ResourceManager.CarbonOptimization.Samples.csproj", "{7A2DFF15-5746-49F4-BD0F-C6C35337088A}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Azure.ResourceManager.CarbonOptimization", "src\Azure.ResourceManager.CarbonOptimization.csproj", "{28FF4005-4467-4E36-92E7-DEA27DEB1519}" +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/carbonoptimization/Azure.ResourceManager.CarbonOptimization/CHANGELOG.md b/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/CHANGELOG.md new file mode 100644 index 000000000000..8b33f0fedccc --- /dev/null +++ b/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/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/carbonoptimization/Azure.ResourceManager.CarbonOptimization/Directory.Build.props b/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/Directory.Build.props new file mode 100644 index 000000000000..63bd836ad44b --- /dev/null +++ b/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/Directory.Build.props @@ -0,0 +1,6 @@ + + + + diff --git a/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/README.md b/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/README.md new file mode 100644 index 000000000000..3b923fdb5722 --- /dev/null +++ b/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/README.md @@ -0,0 +1,80 @@ +# Microsoft Azure CarbonOptimization 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 CarbonOptimization management library for .NET with [NuGet](https://www.nuget.org/): + +```dotnetcli +dotnet add package Azure.ResourceManager.CarbonOptimization --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/carbonoptimization/Azure.ResourceManager.CarbonOptimization/api/Azure.ResourceManager.CarbonOptimization.net8.0.cs b/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/api/Azure.ResourceManager.CarbonOptimization.net8.0.cs new file mode 100644 index 000000000000..570e3a19a904 --- /dev/null +++ b/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/api/Azure.ResourceManager.CarbonOptimization.net8.0.cs @@ -0,0 +1,395 @@ +namespace Azure.ResourceManager.CarbonOptimization +{ + public partial class AzureResourceManagerCarbonOptimizationContext : System.ClientModel.Primitives.ModelReaderWriterContext + { + internal AzureResourceManagerCarbonOptimizationContext() { } + public static Azure.ResourceManager.CarbonOptimization.AzureResourceManagerCarbonOptimizationContext Default { get { throw null; } } + protected override bool TryGetTypeBuilderCore(System.Type type, out System.ClientModel.Primitives.ModelReaderWriterTypeBuilder builder) { throw null; } + } + public static partial class CarbonOptimizationExtensions + { + public static Azure.Response QueryCarbonEmissionAvailableDateRange(this Azure.ResourceManager.Resources.TenantResource tenantResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static System.Threading.Tasks.Task> QueryCarbonEmissionAvailableDateRangeAsync(this Azure.ResourceManager.Resources.TenantResource tenantResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.Pageable QueryCarbonEmissionReports(this Azure.ResourceManager.Resources.TenantResource tenantResource, Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionQueryFilter queryParameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.AsyncPageable QueryCarbonEmissionReportsAsync(this Azure.ResourceManager.Resources.TenantResource tenantResource, Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionQueryFilter queryParameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} +namespace Azure.ResourceManager.CarbonOptimization.Mocking +{ + public partial class MockableCarbonOptimizationTenantResource : Azure.ResourceManager.ArmResource + { + protected MockableCarbonOptimizationTenantResource() { } + public virtual Azure.Response QueryCarbonEmissionAvailableDateRange(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> QueryCarbonEmissionAvailableDateRangeAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable QueryCarbonEmissionReports(Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionQueryFilter queryParameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable QueryCarbonEmissionReportsAsync(Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionQueryFilter queryParameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} +namespace Azure.ResourceManager.CarbonOptimization.Models +{ + public static partial class ArmCarbonOptimizationModelFactory + { + public static Azure.ResourceManager.CarbonOptimization.Models.CarbonEmission CarbonEmission(string dataType = null, double latestMonthEmissions = 0, double previousMonthEmissions = 0, double? monthOverMonthEmissionsChangeRatio = default(double?), double? monthlyEmissionsChangeValue = default(double?)) { throw null; } + public static Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionAvailableDateRange CarbonEmissionAvailableDateRange(System.DateTimeOffset startOn = default(System.DateTimeOffset), System.DateTimeOffset endOn = default(System.DateTimeOffset)) { throw null; } + public static Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionItemDetail CarbonEmissionItemDetail(double latestMonthEmissions = 0, double previousMonthEmissions = 0, double? monthOverMonthEmissionsChangeRatio = default(double?), double? monthlyEmissionsChangeValue = default(double?), string itemName = null, Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionCategoryType categoryType = default(Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionCategoryType)) { throw null; } + public static Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionMonthlySummary CarbonEmissionMonthlySummary(double latestMonthEmissions = 0, double previousMonthEmissions = 0, double? monthOverMonthEmissionsChangeRatio = default(double?), double? monthlyEmissionsChangeValue = default(double?), string date = null, double carbonIntensity = 0) { throw null; } + public static Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionOverallSummary CarbonEmissionOverallSummary(double latestMonthEmissions = 0, double previousMonthEmissions = 0, double? monthOverMonthEmissionsChangeRatio = default(double?), double? monthlyEmissionsChangeValue = default(double?)) { throw null; } + public static Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionQueryFilter CarbonEmissionQueryFilter(string reportType = null, Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionQueryDateRange dateRange = null, System.Collections.Generic.IEnumerable subscriptionList = null, System.Collections.Generic.IEnumerable resourceGroupUrlList = null, System.Collections.Generic.IEnumerable resourceTypeList = null, System.Collections.Generic.IEnumerable locationList = null, System.Collections.Generic.IEnumerable carbonScopeList = null) { throw null; } + public static Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionTopItemMonthlySummary CarbonEmissionTopItemMonthlySummary(double latestMonthEmissions = 0, double previousMonthEmissions = 0, double? monthOverMonthEmissionsChangeRatio = default(double?), double? monthlyEmissionsChangeValue = default(double?), string itemName = null, Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionCategoryType categoryType = default(Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionCategoryType), string date = null) { throw null; } + public static Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionTopItemsSummary CarbonEmissionTopItemsSummary(double latestMonthEmissions = 0, double previousMonthEmissions = 0, double? monthOverMonthEmissionsChangeRatio = default(double?), double? monthlyEmissionsChangeValue = default(double?), string itemName = null, Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionCategoryType categoryType = default(Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionCategoryType)) { throw null; } + public static Azure.ResourceManager.CarbonOptimization.Models.ItemDetailsQueryFilter ItemDetailsQueryFilter(Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionQueryDateRange dateRange = null, System.Collections.Generic.IEnumerable subscriptionList = null, System.Collections.Generic.IEnumerable resourceGroupUrlList = null, System.Collections.Generic.IEnumerable resourceTypeList = null, System.Collections.Generic.IEnumerable locationList = null, System.Collections.Generic.IEnumerable carbonScopeList = null, Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionCategoryType categoryType = default(Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionCategoryType), Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionQueryOrderByColumn orderBy = default(Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionQueryOrderByColumn), Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionQuerySortDirection sortDirection = default(Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionQuerySortDirection), int pageSize = 0, string skipToken = null) { throw null; } + public static Azure.ResourceManager.CarbonOptimization.Models.MonthlySummaryReportQueryFilter MonthlySummaryReportQueryFilter(Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionQueryDateRange dateRange = null, System.Collections.Generic.IEnumerable subscriptionList = null, System.Collections.Generic.IEnumerable resourceGroupUrlList = null, System.Collections.Generic.IEnumerable resourceTypeList = null, System.Collections.Generic.IEnumerable locationList = null, System.Collections.Generic.IEnumerable carbonScopeList = null) { throw null; } + public static Azure.ResourceManager.CarbonOptimization.Models.OverallSummaryReportQueryFilter OverallSummaryReportQueryFilter(Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionQueryDateRange dateRange = null, System.Collections.Generic.IEnumerable subscriptionList = null, System.Collections.Generic.IEnumerable resourceGroupUrlList = null, System.Collections.Generic.IEnumerable resourceTypeList = null, System.Collections.Generic.IEnumerable locationList = null, System.Collections.Generic.IEnumerable carbonScopeList = null) { throw null; } + public static Azure.ResourceManager.CarbonOptimization.Models.ResourceCarbonEmissionItemDetail ResourceCarbonEmissionItemDetail(double latestMonthEmissions = 0, double previousMonthEmissions = 0, double? monthOverMonthEmissionsChangeRatio = default(double?), double? monthlyEmissionsChangeValue = default(double?), string itemName = null, Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionCategoryType categoryType = default(Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionCategoryType), string subscriptionId = null, string resourceGroup = null, Azure.Core.ResourceIdentifier resourceId = null, Azure.Core.AzureLocation? location = default(Azure.Core.AzureLocation?), Azure.Core.ResourceType? resourceType = default(Azure.Core.ResourceType?)) { throw null; } + public static Azure.ResourceManager.CarbonOptimization.Models.ResourceCarbonEmissionTopItemMonthlySummary ResourceCarbonEmissionTopItemMonthlySummary(double latestMonthEmissions = 0, double previousMonthEmissions = 0, double? monthOverMonthEmissionsChangeRatio = default(double?), double? monthlyEmissionsChangeValue = default(double?), string itemName = null, Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionCategoryType categoryType = default(Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionCategoryType), string date = null, string subscriptionId = null, string resourceGroup = null, Azure.Core.ResourceIdentifier resourceId = null) { throw null; } + public static Azure.ResourceManager.CarbonOptimization.Models.ResourceCarbonEmissionTopItemsSummary ResourceCarbonEmissionTopItemsSummary(double latestMonthEmissions = 0, double previousMonthEmissions = 0, double? monthOverMonthEmissionsChangeRatio = default(double?), double? monthlyEmissionsChangeValue = default(double?), string itemName = null, Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionCategoryType categoryType = default(Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionCategoryType), string subscriptionId = null, string resourceGroup = null, Azure.Core.ResourceIdentifier resourceId = null) { throw null; } + public static Azure.ResourceManager.CarbonOptimization.Models.ResourceGroupCarbonEmissionItemDetail ResourceGroupCarbonEmissionItemDetail(double latestMonthEmissions = 0, double previousMonthEmissions = 0, double? monthOverMonthEmissionsChangeRatio = default(double?), double? monthlyEmissionsChangeValue = default(double?), string itemName = null, Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionCategoryType categoryType = default(Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionCategoryType), string subscriptionId = null, Azure.Core.ResourceIdentifier resourceGroupId = null) { throw null; } + public static Azure.ResourceManager.CarbonOptimization.Models.ResourceGroupCarbonEmissionTopItemMonthlySummary ResourceGroupCarbonEmissionTopItemMonthlySummary(double latestMonthEmissions = 0, double previousMonthEmissions = 0, double? monthOverMonthEmissionsChangeRatio = default(double?), double? monthlyEmissionsChangeValue = default(double?), string itemName = null, Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionCategoryType categoryType = default(Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionCategoryType), string date = null, string subscriptionId = null, Azure.Core.ResourceIdentifier resourceGroupId = null) { throw null; } + public static Azure.ResourceManager.CarbonOptimization.Models.ResourceGroupCarbonEmissionTopItemsSummary ResourceGroupCarbonEmissionTopItemsSummary(double latestMonthEmissions = 0, double previousMonthEmissions = 0, double? monthOverMonthEmissionsChangeRatio = default(double?), double? monthlyEmissionsChangeValue = default(double?), string itemName = null, Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionCategoryType categoryType = default(Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionCategoryType), string subscriptionId = null, Azure.Core.ResourceIdentifier resourceGroupId = null) { throw null; } + public static Azure.ResourceManager.CarbonOptimization.Models.TopItemsMonthlySummaryReportQueryFilter TopItemsMonthlySummaryReportQueryFilter(Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionQueryDateRange dateRange = null, System.Collections.Generic.IEnumerable subscriptionList = null, System.Collections.Generic.IEnumerable resourceGroupUrlList = null, System.Collections.Generic.IEnumerable resourceTypeList = null, System.Collections.Generic.IEnumerable locationList = null, System.Collections.Generic.IEnumerable carbonScopeList = null, Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionCategoryType categoryType = default(Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionCategoryType), int topItems = 0) { throw null; } + public static Azure.ResourceManager.CarbonOptimization.Models.TopItemsSummaryReportQueryFilter TopItemsSummaryReportQueryFilter(Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionQueryDateRange dateRange = null, System.Collections.Generic.IEnumerable subscriptionList = null, System.Collections.Generic.IEnumerable resourceGroupUrlList = null, System.Collections.Generic.IEnumerable resourceTypeList = null, System.Collections.Generic.IEnumerable locationList = null, System.Collections.Generic.IEnumerable carbonScopeList = null, Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionCategoryType categoryType = default(Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionCategoryType), int topItems = 0) { throw null; } + } + public abstract partial class CarbonEmission : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + protected CarbonEmission(double latestMonthEmissions, double previousMonthEmissions) { } + public double LatestMonthEmissions { get { throw null; } } + public double? MonthlyEmissionsChangeValue { get { throw null; } } + public double? MonthOverMonthEmissionsChangeRatio { get { throw null; } } + public double PreviousMonthEmissions { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.CarbonOptimization.Models.CarbonEmission 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.CarbonOptimization.Models.CarbonEmission 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 CarbonEmissionAvailableDateRange : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal CarbonEmissionAvailableDateRange() { } + public System.DateTimeOffset EndOn { get { throw null; } } + public System.DateTimeOffset StartOn { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionAvailableDateRange 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.CarbonOptimization.Models.CarbonEmissionAvailableDateRange 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 CarbonEmissionCategoryType : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public CarbonEmissionCategoryType(string value) { throw null; } + public static Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionCategoryType Location { get { throw null; } } + public static Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionCategoryType Resource { get { throw null; } } + public static Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionCategoryType ResourceGroup { get { throw null; } } + public static Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionCategoryType ResourceType { get { throw null; } } + public static Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionCategoryType Subscription { get { throw null; } } + public bool Equals(Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionCategoryType 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.CarbonOptimization.Models.CarbonEmissionCategoryType left, Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionCategoryType right) { throw null; } + public static implicit operator Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionCategoryType (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionCategoryType left, Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionCategoryType right) { throw null; } + public override string ToString() { throw null; } + } + public partial class CarbonEmissionItemDetail : Azure.ResourceManager.CarbonOptimization.Models.CarbonEmission, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal CarbonEmissionItemDetail() : base (default(double), default(double)) { } + public Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionCategoryType CategoryType { get { throw null; } } + public string ItemName { get { throw null; } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionItemDetail 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.CarbonOptimization.Models.CarbonEmissionItemDetail 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 CarbonEmissionMonthlySummary : Azure.ResourceManager.CarbonOptimization.Models.CarbonEmission, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal CarbonEmissionMonthlySummary() : base (default(double), default(double)) { } + public double CarbonIntensity { get { throw null; } } + public string Date { get { throw null; } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionMonthlySummary 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.CarbonOptimization.Models.CarbonEmissionMonthlySummary 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 CarbonEmissionOverallSummary : Azure.ResourceManager.CarbonOptimization.Models.CarbonEmission, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal CarbonEmissionOverallSummary() : base (default(double), default(double)) { } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionOverallSummary 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.CarbonOptimization.Models.CarbonEmissionOverallSummary 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 CarbonEmissionQueryDateRange : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public CarbonEmissionQueryDateRange(System.DateTimeOffset startOn, System.DateTimeOffset endOn) { } + public System.DateTimeOffset EndOn { get { throw null; } } + public System.DateTimeOffset StartOn { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionQueryDateRange 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.CarbonOptimization.Models.CarbonEmissionQueryDateRange 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 CarbonEmissionQueryFilter : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + protected CarbonEmissionQueryFilter(Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionQueryDateRange dateRange, System.Collections.Generic.IEnumerable subscriptionList, System.Collections.Generic.IEnumerable carbonScopeList) { } + public System.Collections.Generic.IList CarbonScopeList { get { throw null; } } + public Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionQueryDateRange DateRange { get { throw null; } } + public System.Collections.Generic.IList LocationList { get { throw null; } } + public System.Collections.Generic.IList ResourceGroupUrlList { get { throw null; } } + public System.Collections.Generic.IList ResourceTypeList { get { throw null; } } + public System.Collections.Generic.IList SubscriptionList { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionQueryFilter 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.CarbonOptimization.Models.CarbonEmissionQueryFilter 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 CarbonEmissionQueryOrderByColumn : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public CarbonEmissionQueryOrderByColumn(string value) { throw null; } + public static Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionQueryOrderByColumn ItemName { get { throw null; } } + public static Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionQueryOrderByColumn LatestMonthEmissions { get { throw null; } } + public static Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionQueryOrderByColumn MonthlyEmissionsChangeValue { get { throw null; } } + public static Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionQueryOrderByColumn MonthOverMonthEmissionsChangeRatio { get { throw null; } } + public static Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionQueryOrderByColumn PreviousMonthEmissions { get { throw null; } } + public static Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionQueryOrderByColumn ResourceGroup { get { throw null; } } + public bool Equals(Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionQueryOrderByColumn 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.CarbonOptimization.Models.CarbonEmissionQueryOrderByColumn left, Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionQueryOrderByColumn right) { throw null; } + public static implicit operator Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionQueryOrderByColumn (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionQueryOrderByColumn left, Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionQueryOrderByColumn right) { throw null; } + public override string ToString() { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct CarbonEmissionQuerySortDirection : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public CarbonEmissionQuerySortDirection(string value) { throw null; } + public static Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionQuerySortDirection Asc { get { throw null; } } + public static Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionQuerySortDirection Desc { get { throw null; } } + public bool Equals(Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionQuerySortDirection 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.CarbonOptimization.Models.CarbonEmissionQuerySortDirection left, Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionQuerySortDirection right) { throw null; } + public static implicit operator Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionQuerySortDirection (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionQuerySortDirection left, Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionQuerySortDirection right) { throw null; } + public override string ToString() { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct CarbonEmissionScope : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public CarbonEmissionScope(string value) { throw null; } + public static Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionScope Scope1 { get { throw null; } } + public static Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionScope Scope2 { get { throw null; } } + public static Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionScope Scope3 { get { throw null; } } + public bool Equals(Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionScope 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.CarbonOptimization.Models.CarbonEmissionScope left, Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionScope right) { throw null; } + public static implicit operator Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionScope (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionScope left, Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionScope right) { throw null; } + public override string ToString() { throw null; } + } + public partial class CarbonEmissionTopItemMonthlySummary : Azure.ResourceManager.CarbonOptimization.Models.CarbonEmission, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal CarbonEmissionTopItemMonthlySummary() : base (default(double), default(double)) { } + public Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionCategoryType CategoryType { get { throw null; } } + public string Date { get { throw null; } } + public string ItemName { get { throw null; } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionTopItemMonthlySummary 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.CarbonOptimization.Models.CarbonEmissionTopItemMonthlySummary 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 CarbonEmissionTopItemsSummary : Azure.ResourceManager.CarbonOptimization.Models.CarbonEmission, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal CarbonEmissionTopItemsSummary() : base (default(double), default(double)) { } + public Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionCategoryType CategoryType { get { throw null; } } + public string ItemName { get { throw null; } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionTopItemsSummary 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.CarbonOptimization.Models.CarbonEmissionTopItemsSummary 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 ItemDetailsQueryFilter : Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionQueryFilter, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public ItemDetailsQueryFilter(Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionQueryDateRange dateRange, System.Collections.Generic.IEnumerable subscriptionList, System.Collections.Generic.IEnumerable carbonScopeList, Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionCategoryType categoryType, Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionQueryOrderByColumn orderBy, Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionQuerySortDirection sortDirection, int pageSize) : base (default(Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionQueryDateRange), default(System.Collections.Generic.IEnumerable), default(System.Collections.Generic.IEnumerable)) { } + public Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionCategoryType CategoryType { get { throw null; } } + public Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionQueryOrderByColumn OrderBy { get { throw null; } } + public int PageSize { get { throw null; } } + public string SkipToken { get { throw null; } set { } } + public Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionQuerySortDirection SortDirection { get { throw null; } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.CarbonOptimization.Models.ItemDetailsQueryFilter 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.CarbonOptimization.Models.ItemDetailsQueryFilter 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 MonthlySummaryReportQueryFilter : Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionQueryFilter, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public MonthlySummaryReportQueryFilter(Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionQueryDateRange dateRange, System.Collections.Generic.IEnumerable subscriptionList, System.Collections.Generic.IEnumerable carbonScopeList) : base (default(Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionQueryDateRange), default(System.Collections.Generic.IEnumerable), default(System.Collections.Generic.IEnumerable)) { } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.CarbonOptimization.Models.MonthlySummaryReportQueryFilter 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.CarbonOptimization.Models.MonthlySummaryReportQueryFilter 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 OverallSummaryReportQueryFilter : Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionQueryFilter, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public OverallSummaryReportQueryFilter(Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionQueryDateRange dateRange, System.Collections.Generic.IEnumerable subscriptionList, System.Collections.Generic.IEnumerable carbonScopeList) : base (default(Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionQueryDateRange), default(System.Collections.Generic.IEnumerable), default(System.Collections.Generic.IEnumerable)) { } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.CarbonOptimization.Models.OverallSummaryReportQueryFilter 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.CarbonOptimization.Models.OverallSummaryReportQueryFilter 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 ResourceCarbonEmissionItemDetail : Azure.ResourceManager.CarbonOptimization.Models.CarbonEmission, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal ResourceCarbonEmissionItemDetail() : base (default(double), default(double)) { } + public Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionCategoryType CategoryType { get { throw null; } } + public string ItemName { get { throw null; } } + public Azure.Core.AzureLocation? Location { get { throw null; } } + public string ResourceGroup { get { throw null; } } + public Azure.Core.ResourceIdentifier ResourceId { get { throw null; } } + public Azure.Core.ResourceType? ResourceType { get { throw null; } } + public string SubscriptionId { get { throw null; } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.CarbonOptimization.Models.ResourceCarbonEmissionItemDetail 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.CarbonOptimization.Models.ResourceCarbonEmissionItemDetail 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 ResourceCarbonEmissionTopItemMonthlySummary : Azure.ResourceManager.CarbonOptimization.Models.CarbonEmission, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal ResourceCarbonEmissionTopItemMonthlySummary() : base (default(double), default(double)) { } + public Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionCategoryType CategoryType { get { throw null; } } + public string Date { get { throw null; } } + public string ItemName { get { throw null; } } + public string ResourceGroup { get { throw null; } } + public Azure.Core.ResourceIdentifier ResourceId { get { throw null; } } + public string SubscriptionId { get { throw null; } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.CarbonOptimization.Models.ResourceCarbonEmissionTopItemMonthlySummary 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.CarbonOptimization.Models.ResourceCarbonEmissionTopItemMonthlySummary 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 ResourceCarbonEmissionTopItemsSummary : Azure.ResourceManager.CarbonOptimization.Models.CarbonEmission, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal ResourceCarbonEmissionTopItemsSummary() : base (default(double), default(double)) { } + public Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionCategoryType CategoryType { get { throw null; } } + public string ItemName { get { throw null; } } + public string ResourceGroup { get { throw null; } } + public Azure.Core.ResourceIdentifier ResourceId { get { throw null; } } + public string SubscriptionId { get { throw null; } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.CarbonOptimization.Models.ResourceCarbonEmissionTopItemsSummary 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.CarbonOptimization.Models.ResourceCarbonEmissionTopItemsSummary 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 ResourceGroupCarbonEmissionItemDetail : Azure.ResourceManager.CarbonOptimization.Models.CarbonEmission, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal ResourceGroupCarbonEmissionItemDetail() : base (default(double), default(double)) { } + public Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionCategoryType CategoryType { get { throw null; } } + public string ItemName { get { throw null; } } + public Azure.Core.ResourceIdentifier ResourceGroupId { get { throw null; } } + public string SubscriptionId { get { throw null; } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.CarbonOptimization.Models.ResourceGroupCarbonEmissionItemDetail 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.CarbonOptimization.Models.ResourceGroupCarbonEmissionItemDetail 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 ResourceGroupCarbonEmissionTopItemMonthlySummary : Azure.ResourceManager.CarbonOptimization.Models.CarbonEmission, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal ResourceGroupCarbonEmissionTopItemMonthlySummary() : base (default(double), default(double)) { } + public Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionCategoryType CategoryType { get { throw null; } } + public string Date { get { throw null; } } + public string ItemName { get { throw null; } } + public Azure.Core.ResourceIdentifier ResourceGroupId { get { throw null; } } + public string SubscriptionId { get { throw null; } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.CarbonOptimization.Models.ResourceGroupCarbonEmissionTopItemMonthlySummary 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.CarbonOptimization.Models.ResourceGroupCarbonEmissionTopItemMonthlySummary 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 ResourceGroupCarbonEmissionTopItemsSummary : Azure.ResourceManager.CarbonOptimization.Models.CarbonEmission, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal ResourceGroupCarbonEmissionTopItemsSummary() : base (default(double), default(double)) { } + public Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionCategoryType CategoryType { get { throw null; } } + public string ItemName { get { throw null; } } + public Azure.Core.ResourceIdentifier ResourceGroupId { get { throw null; } } + public string SubscriptionId { get { throw null; } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.CarbonOptimization.Models.ResourceGroupCarbonEmissionTopItemsSummary 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.CarbonOptimization.Models.ResourceGroupCarbonEmissionTopItemsSummary 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 TopItemsMonthlySummaryReportQueryFilter : Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionQueryFilter, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public TopItemsMonthlySummaryReportQueryFilter(Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionQueryDateRange dateRange, System.Collections.Generic.IEnumerable subscriptionList, System.Collections.Generic.IEnumerable carbonScopeList, Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionCategoryType categoryType, int topItems) : base (default(Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionQueryDateRange), default(System.Collections.Generic.IEnumerable), default(System.Collections.Generic.IEnumerable)) { } + public Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionCategoryType CategoryType { get { throw null; } } + public int TopItems { get { throw null; } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.CarbonOptimization.Models.TopItemsMonthlySummaryReportQueryFilter 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.CarbonOptimization.Models.TopItemsMonthlySummaryReportQueryFilter 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 TopItemsSummaryReportQueryFilter : Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionQueryFilter, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public TopItemsSummaryReportQueryFilter(Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionQueryDateRange dateRange, System.Collections.Generic.IEnumerable subscriptionList, System.Collections.Generic.IEnumerable carbonScopeList, Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionCategoryType categoryType, int topItems) : base (default(Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionQueryDateRange), default(System.Collections.Generic.IEnumerable), default(System.Collections.Generic.IEnumerable)) { } + public Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionCategoryType CategoryType { get { throw null; } } + public int TopItems { get { throw null; } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.CarbonOptimization.Models.TopItemsSummaryReportQueryFilter 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.CarbonOptimization.Models.TopItemsSummaryReportQueryFilter 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/carbonoptimization/Azure.ResourceManager.CarbonOptimization/api/Azure.ResourceManager.CarbonOptimization.netstandard2.0.cs b/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/api/Azure.ResourceManager.CarbonOptimization.netstandard2.0.cs new file mode 100644 index 000000000000..570e3a19a904 --- /dev/null +++ b/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/api/Azure.ResourceManager.CarbonOptimization.netstandard2.0.cs @@ -0,0 +1,395 @@ +namespace Azure.ResourceManager.CarbonOptimization +{ + public partial class AzureResourceManagerCarbonOptimizationContext : System.ClientModel.Primitives.ModelReaderWriterContext + { + internal AzureResourceManagerCarbonOptimizationContext() { } + public static Azure.ResourceManager.CarbonOptimization.AzureResourceManagerCarbonOptimizationContext Default { get { throw null; } } + protected override bool TryGetTypeBuilderCore(System.Type type, out System.ClientModel.Primitives.ModelReaderWriterTypeBuilder builder) { throw null; } + } + public static partial class CarbonOptimizationExtensions + { + public static Azure.Response QueryCarbonEmissionAvailableDateRange(this Azure.ResourceManager.Resources.TenantResource tenantResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static System.Threading.Tasks.Task> QueryCarbonEmissionAvailableDateRangeAsync(this Azure.ResourceManager.Resources.TenantResource tenantResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.Pageable QueryCarbonEmissionReports(this Azure.ResourceManager.Resources.TenantResource tenantResource, Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionQueryFilter queryParameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.AsyncPageable QueryCarbonEmissionReportsAsync(this Azure.ResourceManager.Resources.TenantResource tenantResource, Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionQueryFilter queryParameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} +namespace Azure.ResourceManager.CarbonOptimization.Mocking +{ + public partial class MockableCarbonOptimizationTenantResource : Azure.ResourceManager.ArmResource + { + protected MockableCarbonOptimizationTenantResource() { } + public virtual Azure.Response QueryCarbonEmissionAvailableDateRange(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> QueryCarbonEmissionAvailableDateRangeAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable QueryCarbonEmissionReports(Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionQueryFilter queryParameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable QueryCarbonEmissionReportsAsync(Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionQueryFilter queryParameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} +namespace Azure.ResourceManager.CarbonOptimization.Models +{ + public static partial class ArmCarbonOptimizationModelFactory + { + public static Azure.ResourceManager.CarbonOptimization.Models.CarbonEmission CarbonEmission(string dataType = null, double latestMonthEmissions = 0, double previousMonthEmissions = 0, double? monthOverMonthEmissionsChangeRatio = default(double?), double? monthlyEmissionsChangeValue = default(double?)) { throw null; } + public static Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionAvailableDateRange CarbonEmissionAvailableDateRange(System.DateTimeOffset startOn = default(System.DateTimeOffset), System.DateTimeOffset endOn = default(System.DateTimeOffset)) { throw null; } + public static Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionItemDetail CarbonEmissionItemDetail(double latestMonthEmissions = 0, double previousMonthEmissions = 0, double? monthOverMonthEmissionsChangeRatio = default(double?), double? monthlyEmissionsChangeValue = default(double?), string itemName = null, Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionCategoryType categoryType = default(Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionCategoryType)) { throw null; } + public static Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionMonthlySummary CarbonEmissionMonthlySummary(double latestMonthEmissions = 0, double previousMonthEmissions = 0, double? monthOverMonthEmissionsChangeRatio = default(double?), double? monthlyEmissionsChangeValue = default(double?), string date = null, double carbonIntensity = 0) { throw null; } + public static Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionOverallSummary CarbonEmissionOverallSummary(double latestMonthEmissions = 0, double previousMonthEmissions = 0, double? monthOverMonthEmissionsChangeRatio = default(double?), double? monthlyEmissionsChangeValue = default(double?)) { throw null; } + public static Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionQueryFilter CarbonEmissionQueryFilter(string reportType = null, Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionQueryDateRange dateRange = null, System.Collections.Generic.IEnumerable subscriptionList = null, System.Collections.Generic.IEnumerable resourceGroupUrlList = null, System.Collections.Generic.IEnumerable resourceTypeList = null, System.Collections.Generic.IEnumerable locationList = null, System.Collections.Generic.IEnumerable carbonScopeList = null) { throw null; } + public static Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionTopItemMonthlySummary CarbonEmissionTopItemMonthlySummary(double latestMonthEmissions = 0, double previousMonthEmissions = 0, double? monthOverMonthEmissionsChangeRatio = default(double?), double? monthlyEmissionsChangeValue = default(double?), string itemName = null, Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionCategoryType categoryType = default(Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionCategoryType), string date = null) { throw null; } + public static Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionTopItemsSummary CarbonEmissionTopItemsSummary(double latestMonthEmissions = 0, double previousMonthEmissions = 0, double? monthOverMonthEmissionsChangeRatio = default(double?), double? monthlyEmissionsChangeValue = default(double?), string itemName = null, Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionCategoryType categoryType = default(Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionCategoryType)) { throw null; } + public static Azure.ResourceManager.CarbonOptimization.Models.ItemDetailsQueryFilter ItemDetailsQueryFilter(Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionQueryDateRange dateRange = null, System.Collections.Generic.IEnumerable subscriptionList = null, System.Collections.Generic.IEnumerable resourceGroupUrlList = null, System.Collections.Generic.IEnumerable resourceTypeList = null, System.Collections.Generic.IEnumerable locationList = null, System.Collections.Generic.IEnumerable carbonScopeList = null, Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionCategoryType categoryType = default(Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionCategoryType), Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionQueryOrderByColumn orderBy = default(Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionQueryOrderByColumn), Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionQuerySortDirection sortDirection = default(Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionQuerySortDirection), int pageSize = 0, string skipToken = null) { throw null; } + public static Azure.ResourceManager.CarbonOptimization.Models.MonthlySummaryReportQueryFilter MonthlySummaryReportQueryFilter(Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionQueryDateRange dateRange = null, System.Collections.Generic.IEnumerable subscriptionList = null, System.Collections.Generic.IEnumerable resourceGroupUrlList = null, System.Collections.Generic.IEnumerable resourceTypeList = null, System.Collections.Generic.IEnumerable locationList = null, System.Collections.Generic.IEnumerable carbonScopeList = null) { throw null; } + public static Azure.ResourceManager.CarbonOptimization.Models.OverallSummaryReportQueryFilter OverallSummaryReportQueryFilter(Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionQueryDateRange dateRange = null, System.Collections.Generic.IEnumerable subscriptionList = null, System.Collections.Generic.IEnumerable resourceGroupUrlList = null, System.Collections.Generic.IEnumerable resourceTypeList = null, System.Collections.Generic.IEnumerable locationList = null, System.Collections.Generic.IEnumerable carbonScopeList = null) { throw null; } + public static Azure.ResourceManager.CarbonOptimization.Models.ResourceCarbonEmissionItemDetail ResourceCarbonEmissionItemDetail(double latestMonthEmissions = 0, double previousMonthEmissions = 0, double? monthOverMonthEmissionsChangeRatio = default(double?), double? monthlyEmissionsChangeValue = default(double?), string itemName = null, Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionCategoryType categoryType = default(Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionCategoryType), string subscriptionId = null, string resourceGroup = null, Azure.Core.ResourceIdentifier resourceId = null, Azure.Core.AzureLocation? location = default(Azure.Core.AzureLocation?), Azure.Core.ResourceType? resourceType = default(Azure.Core.ResourceType?)) { throw null; } + public static Azure.ResourceManager.CarbonOptimization.Models.ResourceCarbonEmissionTopItemMonthlySummary ResourceCarbonEmissionTopItemMonthlySummary(double latestMonthEmissions = 0, double previousMonthEmissions = 0, double? monthOverMonthEmissionsChangeRatio = default(double?), double? monthlyEmissionsChangeValue = default(double?), string itemName = null, Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionCategoryType categoryType = default(Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionCategoryType), string date = null, string subscriptionId = null, string resourceGroup = null, Azure.Core.ResourceIdentifier resourceId = null) { throw null; } + public static Azure.ResourceManager.CarbonOptimization.Models.ResourceCarbonEmissionTopItemsSummary ResourceCarbonEmissionTopItemsSummary(double latestMonthEmissions = 0, double previousMonthEmissions = 0, double? monthOverMonthEmissionsChangeRatio = default(double?), double? monthlyEmissionsChangeValue = default(double?), string itemName = null, Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionCategoryType categoryType = default(Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionCategoryType), string subscriptionId = null, string resourceGroup = null, Azure.Core.ResourceIdentifier resourceId = null) { throw null; } + public static Azure.ResourceManager.CarbonOptimization.Models.ResourceGroupCarbonEmissionItemDetail ResourceGroupCarbonEmissionItemDetail(double latestMonthEmissions = 0, double previousMonthEmissions = 0, double? monthOverMonthEmissionsChangeRatio = default(double?), double? monthlyEmissionsChangeValue = default(double?), string itemName = null, Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionCategoryType categoryType = default(Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionCategoryType), string subscriptionId = null, Azure.Core.ResourceIdentifier resourceGroupId = null) { throw null; } + public static Azure.ResourceManager.CarbonOptimization.Models.ResourceGroupCarbonEmissionTopItemMonthlySummary ResourceGroupCarbonEmissionTopItemMonthlySummary(double latestMonthEmissions = 0, double previousMonthEmissions = 0, double? monthOverMonthEmissionsChangeRatio = default(double?), double? monthlyEmissionsChangeValue = default(double?), string itemName = null, Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionCategoryType categoryType = default(Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionCategoryType), string date = null, string subscriptionId = null, Azure.Core.ResourceIdentifier resourceGroupId = null) { throw null; } + public static Azure.ResourceManager.CarbonOptimization.Models.ResourceGroupCarbonEmissionTopItemsSummary ResourceGroupCarbonEmissionTopItemsSummary(double latestMonthEmissions = 0, double previousMonthEmissions = 0, double? monthOverMonthEmissionsChangeRatio = default(double?), double? monthlyEmissionsChangeValue = default(double?), string itemName = null, Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionCategoryType categoryType = default(Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionCategoryType), string subscriptionId = null, Azure.Core.ResourceIdentifier resourceGroupId = null) { throw null; } + public static Azure.ResourceManager.CarbonOptimization.Models.TopItemsMonthlySummaryReportQueryFilter TopItemsMonthlySummaryReportQueryFilter(Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionQueryDateRange dateRange = null, System.Collections.Generic.IEnumerable subscriptionList = null, System.Collections.Generic.IEnumerable resourceGroupUrlList = null, System.Collections.Generic.IEnumerable resourceTypeList = null, System.Collections.Generic.IEnumerable locationList = null, System.Collections.Generic.IEnumerable carbonScopeList = null, Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionCategoryType categoryType = default(Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionCategoryType), int topItems = 0) { throw null; } + public static Azure.ResourceManager.CarbonOptimization.Models.TopItemsSummaryReportQueryFilter TopItemsSummaryReportQueryFilter(Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionQueryDateRange dateRange = null, System.Collections.Generic.IEnumerable subscriptionList = null, System.Collections.Generic.IEnumerable resourceGroupUrlList = null, System.Collections.Generic.IEnumerable resourceTypeList = null, System.Collections.Generic.IEnumerable locationList = null, System.Collections.Generic.IEnumerable carbonScopeList = null, Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionCategoryType categoryType = default(Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionCategoryType), int topItems = 0) { throw null; } + } + public abstract partial class CarbonEmission : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + protected CarbonEmission(double latestMonthEmissions, double previousMonthEmissions) { } + public double LatestMonthEmissions { get { throw null; } } + public double? MonthlyEmissionsChangeValue { get { throw null; } } + public double? MonthOverMonthEmissionsChangeRatio { get { throw null; } } + public double PreviousMonthEmissions { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.CarbonOptimization.Models.CarbonEmission 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.CarbonOptimization.Models.CarbonEmission 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 CarbonEmissionAvailableDateRange : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal CarbonEmissionAvailableDateRange() { } + public System.DateTimeOffset EndOn { get { throw null; } } + public System.DateTimeOffset StartOn { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionAvailableDateRange 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.CarbonOptimization.Models.CarbonEmissionAvailableDateRange 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 CarbonEmissionCategoryType : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public CarbonEmissionCategoryType(string value) { throw null; } + public static Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionCategoryType Location { get { throw null; } } + public static Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionCategoryType Resource { get { throw null; } } + public static Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionCategoryType ResourceGroup { get { throw null; } } + public static Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionCategoryType ResourceType { get { throw null; } } + public static Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionCategoryType Subscription { get { throw null; } } + public bool Equals(Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionCategoryType 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.CarbonOptimization.Models.CarbonEmissionCategoryType left, Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionCategoryType right) { throw null; } + public static implicit operator Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionCategoryType (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionCategoryType left, Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionCategoryType right) { throw null; } + public override string ToString() { throw null; } + } + public partial class CarbonEmissionItemDetail : Azure.ResourceManager.CarbonOptimization.Models.CarbonEmission, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal CarbonEmissionItemDetail() : base (default(double), default(double)) { } + public Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionCategoryType CategoryType { get { throw null; } } + public string ItemName { get { throw null; } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionItemDetail 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.CarbonOptimization.Models.CarbonEmissionItemDetail 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 CarbonEmissionMonthlySummary : Azure.ResourceManager.CarbonOptimization.Models.CarbonEmission, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal CarbonEmissionMonthlySummary() : base (default(double), default(double)) { } + public double CarbonIntensity { get { throw null; } } + public string Date { get { throw null; } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionMonthlySummary 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.CarbonOptimization.Models.CarbonEmissionMonthlySummary 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 CarbonEmissionOverallSummary : Azure.ResourceManager.CarbonOptimization.Models.CarbonEmission, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal CarbonEmissionOverallSummary() : base (default(double), default(double)) { } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionOverallSummary 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.CarbonOptimization.Models.CarbonEmissionOverallSummary 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 CarbonEmissionQueryDateRange : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public CarbonEmissionQueryDateRange(System.DateTimeOffset startOn, System.DateTimeOffset endOn) { } + public System.DateTimeOffset EndOn { get { throw null; } } + public System.DateTimeOffset StartOn { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionQueryDateRange 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.CarbonOptimization.Models.CarbonEmissionQueryDateRange 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 CarbonEmissionQueryFilter : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + protected CarbonEmissionQueryFilter(Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionQueryDateRange dateRange, System.Collections.Generic.IEnumerable subscriptionList, System.Collections.Generic.IEnumerable carbonScopeList) { } + public System.Collections.Generic.IList CarbonScopeList { get { throw null; } } + public Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionQueryDateRange DateRange { get { throw null; } } + public System.Collections.Generic.IList LocationList { get { throw null; } } + public System.Collections.Generic.IList ResourceGroupUrlList { get { throw null; } } + public System.Collections.Generic.IList ResourceTypeList { get { throw null; } } + public System.Collections.Generic.IList SubscriptionList { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionQueryFilter 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.CarbonOptimization.Models.CarbonEmissionQueryFilter 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 CarbonEmissionQueryOrderByColumn : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public CarbonEmissionQueryOrderByColumn(string value) { throw null; } + public static Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionQueryOrderByColumn ItemName { get { throw null; } } + public static Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionQueryOrderByColumn LatestMonthEmissions { get { throw null; } } + public static Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionQueryOrderByColumn MonthlyEmissionsChangeValue { get { throw null; } } + public static Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionQueryOrderByColumn MonthOverMonthEmissionsChangeRatio { get { throw null; } } + public static Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionQueryOrderByColumn PreviousMonthEmissions { get { throw null; } } + public static Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionQueryOrderByColumn ResourceGroup { get { throw null; } } + public bool Equals(Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionQueryOrderByColumn 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.CarbonOptimization.Models.CarbonEmissionQueryOrderByColumn left, Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionQueryOrderByColumn right) { throw null; } + public static implicit operator Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionQueryOrderByColumn (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionQueryOrderByColumn left, Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionQueryOrderByColumn right) { throw null; } + public override string ToString() { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct CarbonEmissionQuerySortDirection : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public CarbonEmissionQuerySortDirection(string value) { throw null; } + public static Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionQuerySortDirection Asc { get { throw null; } } + public static Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionQuerySortDirection Desc { get { throw null; } } + public bool Equals(Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionQuerySortDirection 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.CarbonOptimization.Models.CarbonEmissionQuerySortDirection left, Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionQuerySortDirection right) { throw null; } + public static implicit operator Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionQuerySortDirection (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionQuerySortDirection left, Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionQuerySortDirection right) { throw null; } + public override string ToString() { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct CarbonEmissionScope : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public CarbonEmissionScope(string value) { throw null; } + public static Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionScope Scope1 { get { throw null; } } + public static Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionScope Scope2 { get { throw null; } } + public static Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionScope Scope3 { get { throw null; } } + public bool Equals(Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionScope 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.CarbonOptimization.Models.CarbonEmissionScope left, Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionScope right) { throw null; } + public static implicit operator Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionScope (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionScope left, Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionScope right) { throw null; } + public override string ToString() { throw null; } + } + public partial class CarbonEmissionTopItemMonthlySummary : Azure.ResourceManager.CarbonOptimization.Models.CarbonEmission, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal CarbonEmissionTopItemMonthlySummary() : base (default(double), default(double)) { } + public Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionCategoryType CategoryType { get { throw null; } } + public string Date { get { throw null; } } + public string ItemName { get { throw null; } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionTopItemMonthlySummary 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.CarbonOptimization.Models.CarbonEmissionTopItemMonthlySummary 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 CarbonEmissionTopItemsSummary : Azure.ResourceManager.CarbonOptimization.Models.CarbonEmission, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal CarbonEmissionTopItemsSummary() : base (default(double), default(double)) { } + public Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionCategoryType CategoryType { get { throw null; } } + public string ItemName { get { throw null; } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionTopItemsSummary 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.CarbonOptimization.Models.CarbonEmissionTopItemsSummary 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 ItemDetailsQueryFilter : Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionQueryFilter, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public ItemDetailsQueryFilter(Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionQueryDateRange dateRange, System.Collections.Generic.IEnumerable subscriptionList, System.Collections.Generic.IEnumerable carbonScopeList, Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionCategoryType categoryType, Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionQueryOrderByColumn orderBy, Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionQuerySortDirection sortDirection, int pageSize) : base (default(Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionQueryDateRange), default(System.Collections.Generic.IEnumerable), default(System.Collections.Generic.IEnumerable)) { } + public Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionCategoryType CategoryType { get { throw null; } } + public Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionQueryOrderByColumn OrderBy { get { throw null; } } + public int PageSize { get { throw null; } } + public string SkipToken { get { throw null; } set { } } + public Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionQuerySortDirection SortDirection { get { throw null; } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.CarbonOptimization.Models.ItemDetailsQueryFilter 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.CarbonOptimization.Models.ItemDetailsQueryFilter 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 MonthlySummaryReportQueryFilter : Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionQueryFilter, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public MonthlySummaryReportQueryFilter(Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionQueryDateRange dateRange, System.Collections.Generic.IEnumerable subscriptionList, System.Collections.Generic.IEnumerable carbonScopeList) : base (default(Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionQueryDateRange), default(System.Collections.Generic.IEnumerable), default(System.Collections.Generic.IEnumerable)) { } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.CarbonOptimization.Models.MonthlySummaryReportQueryFilter 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.CarbonOptimization.Models.MonthlySummaryReportQueryFilter 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 OverallSummaryReportQueryFilter : Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionQueryFilter, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public OverallSummaryReportQueryFilter(Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionQueryDateRange dateRange, System.Collections.Generic.IEnumerable subscriptionList, System.Collections.Generic.IEnumerable carbonScopeList) : base (default(Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionQueryDateRange), default(System.Collections.Generic.IEnumerable), default(System.Collections.Generic.IEnumerable)) { } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.CarbonOptimization.Models.OverallSummaryReportQueryFilter 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.CarbonOptimization.Models.OverallSummaryReportQueryFilter 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 ResourceCarbonEmissionItemDetail : Azure.ResourceManager.CarbonOptimization.Models.CarbonEmission, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal ResourceCarbonEmissionItemDetail() : base (default(double), default(double)) { } + public Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionCategoryType CategoryType { get { throw null; } } + public string ItemName { get { throw null; } } + public Azure.Core.AzureLocation? Location { get { throw null; } } + public string ResourceGroup { get { throw null; } } + public Azure.Core.ResourceIdentifier ResourceId { get { throw null; } } + public Azure.Core.ResourceType? ResourceType { get { throw null; } } + public string SubscriptionId { get { throw null; } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.CarbonOptimization.Models.ResourceCarbonEmissionItemDetail 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.CarbonOptimization.Models.ResourceCarbonEmissionItemDetail 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 ResourceCarbonEmissionTopItemMonthlySummary : Azure.ResourceManager.CarbonOptimization.Models.CarbonEmission, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal ResourceCarbonEmissionTopItemMonthlySummary() : base (default(double), default(double)) { } + public Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionCategoryType CategoryType { get { throw null; } } + public string Date { get { throw null; } } + public string ItemName { get { throw null; } } + public string ResourceGroup { get { throw null; } } + public Azure.Core.ResourceIdentifier ResourceId { get { throw null; } } + public string SubscriptionId { get { throw null; } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.CarbonOptimization.Models.ResourceCarbonEmissionTopItemMonthlySummary 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.CarbonOptimization.Models.ResourceCarbonEmissionTopItemMonthlySummary 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 ResourceCarbonEmissionTopItemsSummary : Azure.ResourceManager.CarbonOptimization.Models.CarbonEmission, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal ResourceCarbonEmissionTopItemsSummary() : base (default(double), default(double)) { } + public Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionCategoryType CategoryType { get { throw null; } } + public string ItemName { get { throw null; } } + public string ResourceGroup { get { throw null; } } + public Azure.Core.ResourceIdentifier ResourceId { get { throw null; } } + public string SubscriptionId { get { throw null; } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.CarbonOptimization.Models.ResourceCarbonEmissionTopItemsSummary 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.CarbonOptimization.Models.ResourceCarbonEmissionTopItemsSummary 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 ResourceGroupCarbonEmissionItemDetail : Azure.ResourceManager.CarbonOptimization.Models.CarbonEmission, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal ResourceGroupCarbonEmissionItemDetail() : base (default(double), default(double)) { } + public Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionCategoryType CategoryType { get { throw null; } } + public string ItemName { get { throw null; } } + public Azure.Core.ResourceIdentifier ResourceGroupId { get { throw null; } } + public string SubscriptionId { get { throw null; } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.CarbonOptimization.Models.ResourceGroupCarbonEmissionItemDetail 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.CarbonOptimization.Models.ResourceGroupCarbonEmissionItemDetail 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 ResourceGroupCarbonEmissionTopItemMonthlySummary : Azure.ResourceManager.CarbonOptimization.Models.CarbonEmission, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal ResourceGroupCarbonEmissionTopItemMonthlySummary() : base (default(double), default(double)) { } + public Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionCategoryType CategoryType { get { throw null; } } + public string Date { get { throw null; } } + public string ItemName { get { throw null; } } + public Azure.Core.ResourceIdentifier ResourceGroupId { get { throw null; } } + public string SubscriptionId { get { throw null; } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.CarbonOptimization.Models.ResourceGroupCarbonEmissionTopItemMonthlySummary 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.CarbonOptimization.Models.ResourceGroupCarbonEmissionTopItemMonthlySummary 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 ResourceGroupCarbonEmissionTopItemsSummary : Azure.ResourceManager.CarbonOptimization.Models.CarbonEmission, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal ResourceGroupCarbonEmissionTopItemsSummary() : base (default(double), default(double)) { } + public Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionCategoryType CategoryType { get { throw null; } } + public string ItemName { get { throw null; } } + public Azure.Core.ResourceIdentifier ResourceGroupId { get { throw null; } } + public string SubscriptionId { get { throw null; } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.CarbonOptimization.Models.ResourceGroupCarbonEmissionTopItemsSummary 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.CarbonOptimization.Models.ResourceGroupCarbonEmissionTopItemsSummary 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 TopItemsMonthlySummaryReportQueryFilter : Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionQueryFilter, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public TopItemsMonthlySummaryReportQueryFilter(Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionQueryDateRange dateRange, System.Collections.Generic.IEnumerable subscriptionList, System.Collections.Generic.IEnumerable carbonScopeList, Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionCategoryType categoryType, int topItems) : base (default(Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionQueryDateRange), default(System.Collections.Generic.IEnumerable), default(System.Collections.Generic.IEnumerable)) { } + public Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionCategoryType CategoryType { get { throw null; } } + public int TopItems { get { throw null; } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.CarbonOptimization.Models.TopItemsMonthlySummaryReportQueryFilter 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.CarbonOptimization.Models.TopItemsMonthlySummaryReportQueryFilter 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 TopItemsSummaryReportQueryFilter : Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionQueryFilter, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public TopItemsSummaryReportQueryFilter(Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionQueryDateRange dateRange, System.Collections.Generic.IEnumerable subscriptionList, System.Collections.Generic.IEnumerable carbonScopeList, Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionCategoryType categoryType, int topItems) : base (default(Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionQueryDateRange), default(System.Collections.Generic.IEnumerable), default(System.Collections.Generic.IEnumerable)) { } + public Azure.ResourceManager.CarbonOptimization.Models.CarbonEmissionCategoryType CategoryType { get { throw null; } } + public int TopItems { get { throw null; } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.CarbonOptimization.Models.TopItemsSummaryReportQueryFilter 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.CarbonOptimization.Models.TopItemsSummaryReportQueryFilter 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/carbonoptimization/Azure.ResourceManager.CarbonOptimization/assets.json b/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/assets.json new file mode 100644 index 000000000000..1666f2353a3d --- /dev/null +++ b/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/assets.json @@ -0,0 +1,7 @@ + +{ + "AssetsRepo": "Azure/azure-sdk-assets", + "AssetsRepoPrefixPath": "net", + "TagPrefix": "net/carbonoptimization/Azure.ResourceManager.CarbonOptimization", + "Tag": "" +} diff --git a/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/samples/Azure.ResourceManager.CarbonOptimization.Samples.csproj b/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/samples/Azure.ResourceManager.CarbonOptimization.Samples.csproj new file mode 100644 index 000000000000..7f297a3f03f9 --- /dev/null +++ b/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/samples/Azure.ResourceManager.CarbonOptimization.Samples.csproj @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Azure.ResourceManager.CarbonOptimization.csproj b/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Azure.ResourceManager.CarbonOptimization.csproj new file mode 100644 index 000000000000..11e74eb2756a --- /dev/null +++ b/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Azure.ResourceManager.CarbonOptimization.csproj @@ -0,0 +1,8 @@ + + + Azure Resource Manager client SDK for Azure resource provider CarbonOptimization. + 1.0.0-beta.1 + azure;management;arm;resource manager;carbonoptimization + Azure.ResourceManager.CarbonOptimization + + diff --git a/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/ArmCarbonOptimizationModelFactory.cs b/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/ArmCarbonOptimizationModelFactory.cs new file mode 100644 index 000000000000..5fea394a7090 --- /dev/null +++ b/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/ArmCarbonOptimizationModelFactory.cs @@ -0,0 +1,493 @@ +// 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; + +namespace Azure.ResourceManager.CarbonOptimization.Models +{ + /// Model factory for models. + public static partial class ArmCarbonOptimizationModelFactory + { + /// Initializes a new instance of . + /// The ReportType requested for carbon emissions data. Required. Specifies how data is aggregated and displayed in the output, as explained in the ReportTypeEnum. + /// The start and end dates for carbon emissions data. Required. For ItemDetailsReport and TopItemsSummaryReport, only one month of data is supported at a time, so start and end dates should be equal within DateRange (e.g., start: 2024-06-01 and end: 2024-06-01). + /// List of subscription IDs for which carbon emissions data is requested. Required. Each subscription ID should be in lowercase format. The max length of list is 100. + /// List of resource group URLs for carbon emissions data. Optional. Each URL must follow the format '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroup}', and should be in all lowercase. + /// List of resource types for carbon emissions data. Optional. Each resource type should be specified in lowercase, following the format 'microsoft.{service}/{resourceType}', e.g., 'microsoft.storage/storageaccounts'. + /// List of locations(Azure Region Display Name) for carbon emissions data, with each location specified in lowercase (e.g., 'east us'). Optional. You can use the command 'az account list-locations -o table' to find Azure Region Display Names. + /// List of carbon emission scopes. Required. Accepts one or more values from EmissionScopeEnum (e.g., Scope1, Scope2, Scope3) in list form. The output will include the total emissions for the specified scopes. + /// A new instance for mocking. + public static CarbonEmissionQueryFilter CarbonEmissionQueryFilter(string reportType = null, CarbonEmissionQueryDateRange dateRange = null, IEnumerable subscriptionList = null, IEnumerable resourceGroupUrlList = null, IEnumerable resourceTypeList = null, IEnumerable locationList = null, IEnumerable carbonScopeList = null) + { + subscriptionList ??= new List(); + resourceGroupUrlList ??= new List(); + resourceTypeList ??= new List(); + locationList ??= new List(); + carbonScopeList ??= new List(); + + return new UnknownCarbonEmissionQueryFilter( + reportType == null ? default : new CarbonEmissionQueryReportType(reportType), + dateRange, + subscriptionList?.ToList(), + resourceGroupUrlList?.ToList(), + resourceTypeList?.ToList(), + locationList?.ToList(), + carbonScopeList?.ToList(), + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The start and end dates for carbon emissions data. Required. For ItemDetailsReport and TopItemsSummaryReport, only one month of data is supported at a time, so start and end dates should be equal within DateRange (e.g., start: 2024-06-01 and end: 2024-06-01). + /// List of subscription IDs for which carbon emissions data is requested. Required. Each subscription ID should be in lowercase format. The max length of list is 100. + /// List of resource group URLs for carbon emissions data. Optional. Each URL must follow the format '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroup}', and should be in all lowercase. + /// List of resource types for carbon emissions data. Optional. Each resource type should be specified in lowercase, following the format 'microsoft.{service}/{resourceType}', e.g., 'microsoft.storage/storageaccounts'. + /// List of locations(Azure Region Display Name) for carbon emissions data, with each location specified in lowercase (e.g., 'east us'). Optional. You can use the command 'az account list-locations -o table' to find Azure Region Display Names. + /// List of carbon emission scopes. Required. Accepts one or more values from EmissionScopeEnum (e.g., Scope1, Scope2, Scope3) in list form. The output will include the total emissions for the specified scopes. + /// A new instance for mocking. + public static OverallSummaryReportQueryFilter OverallSummaryReportQueryFilter(CarbonEmissionQueryDateRange dateRange = null, IEnumerable subscriptionList = null, IEnumerable resourceGroupUrlList = null, IEnumerable resourceTypeList = null, IEnumerable locationList = null, IEnumerable carbonScopeList = null) + { + subscriptionList ??= new List(); + resourceGroupUrlList ??= new List(); + resourceTypeList ??= new List(); + locationList ??= new List(); + carbonScopeList ??= new List(); + + return new OverallSummaryReportQueryFilter( + CarbonEmissionQueryReportType.OverallSummaryReport, + dateRange, + subscriptionList?.ToList(), + resourceGroupUrlList?.ToList(), + resourceTypeList?.ToList(), + locationList?.ToList(), + carbonScopeList?.ToList(), + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The start and end dates for carbon emissions data. Required. For ItemDetailsReport and TopItemsSummaryReport, only one month of data is supported at a time, so start and end dates should be equal within DateRange (e.g., start: 2024-06-01 and end: 2024-06-01). + /// List of subscription IDs for which carbon emissions data is requested. Required. Each subscription ID should be in lowercase format. The max length of list is 100. + /// List of resource group URLs for carbon emissions data. Optional. Each URL must follow the format '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroup}', and should be in all lowercase. + /// List of resource types for carbon emissions data. Optional. Each resource type should be specified in lowercase, following the format 'microsoft.{service}/{resourceType}', e.g., 'microsoft.storage/storageaccounts'. + /// List of locations(Azure Region Display Name) for carbon emissions data, with each location specified in lowercase (e.g., 'east us'). Optional. You can use the command 'az account list-locations -o table' to find Azure Region Display Names. + /// List of carbon emission scopes. Required. Accepts one or more values from EmissionScopeEnum (e.g., Scope1, Scope2, Scope3) in list form. The output will include the total emissions for the specified scopes. + /// A new instance for mocking. + public static MonthlySummaryReportQueryFilter MonthlySummaryReportQueryFilter(CarbonEmissionQueryDateRange dateRange = null, IEnumerable subscriptionList = null, IEnumerable resourceGroupUrlList = null, IEnumerable resourceTypeList = null, IEnumerable locationList = null, IEnumerable carbonScopeList = null) + { + subscriptionList ??= new List(); + resourceGroupUrlList ??= new List(); + resourceTypeList ??= new List(); + locationList ??= new List(); + carbonScopeList ??= new List(); + + return new MonthlySummaryReportQueryFilter( + CarbonEmissionQueryReportType.MonthlySummaryReport, + dateRange, + subscriptionList?.ToList(), + resourceGroupUrlList?.ToList(), + resourceTypeList?.ToList(), + locationList?.ToList(), + carbonScopeList?.ToList(), + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The start and end dates for carbon emissions data. Required. For ItemDetailsReport and TopItemsSummaryReport, only one month of data is supported at a time, so start and end dates should be equal within DateRange (e.g., start: 2024-06-01 and end: 2024-06-01). + /// List of subscription IDs for which carbon emissions data is requested. Required. Each subscription ID should be in lowercase format. The max length of list is 100. + /// List of resource group URLs for carbon emissions data. Optional. Each URL must follow the format '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroup}', and should be in all lowercase. + /// List of resource types for carbon emissions data. Optional. Each resource type should be specified in lowercase, following the format 'microsoft.{service}/{resourceType}', e.g., 'microsoft.storage/storageaccounts'. + /// List of locations(Azure Region Display Name) for carbon emissions data, with each location specified in lowercase (e.g., 'east us'). Optional. You can use the command 'az account list-locations -o table' to find Azure Region Display Names. + /// List of carbon emission scopes. Required. Accepts one or more values from EmissionScopeEnum (e.g., Scope1, Scope2, Scope3) in list form. The output will include the total emissions for the specified scopes. + /// Specifies the category type for which to retrieve top-emitting items. See supported values defined in CategoryTypeEnum. + /// The number of top items to return, based on emissions. This value must be between 1 and 10. + /// A new instance for mocking. + public static TopItemsSummaryReportQueryFilter TopItemsSummaryReportQueryFilter(CarbonEmissionQueryDateRange dateRange = null, IEnumerable subscriptionList = null, IEnumerable resourceGroupUrlList = null, IEnumerable resourceTypeList = null, IEnumerable locationList = null, IEnumerable carbonScopeList = null, CarbonEmissionCategoryType categoryType = default, int topItems = default) + { + subscriptionList ??= new List(); + resourceGroupUrlList ??= new List(); + resourceTypeList ??= new List(); + locationList ??= new List(); + carbonScopeList ??= new List(); + + return new TopItemsSummaryReportQueryFilter( + CarbonEmissionQueryReportType.TopItemsSummaryReport, + dateRange, + subscriptionList?.ToList(), + resourceGroupUrlList?.ToList(), + resourceTypeList?.ToList(), + locationList?.ToList(), + carbonScopeList?.ToList(), + serializedAdditionalRawData: null, + categoryType, + topItems); + } + + /// Initializes a new instance of . + /// The start and end dates for carbon emissions data. Required. For ItemDetailsReport and TopItemsSummaryReport, only one month of data is supported at a time, so start and end dates should be equal within DateRange (e.g., start: 2024-06-01 and end: 2024-06-01). + /// List of subscription IDs for which carbon emissions data is requested. Required. Each subscription ID should be in lowercase format. The max length of list is 100. + /// List of resource group URLs for carbon emissions data. Optional. Each URL must follow the format '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroup}', and should be in all lowercase. + /// List of resource types for carbon emissions data. Optional. Each resource type should be specified in lowercase, following the format 'microsoft.{service}/{resourceType}', e.g., 'microsoft.storage/storageaccounts'. + /// List of locations(Azure Region Display Name) for carbon emissions data, with each location specified in lowercase (e.g., 'east us'). Optional. You can use the command 'az account list-locations -o table' to find Azure Region Display Names. + /// List of carbon emission scopes. Required. Accepts one or more values from EmissionScopeEnum (e.g., Scope1, Scope2, Scope3) in list form. The output will include the total emissions for the specified scopes. + /// Specifies the category type to retrieve top-emitting items, aggregated by month. See supported types in CategoryTypeEnum. + /// The number of top items to return, based on emissions. Must be between 1 and 10. + /// A new instance for mocking. + public static TopItemsMonthlySummaryReportQueryFilter TopItemsMonthlySummaryReportQueryFilter(CarbonEmissionQueryDateRange dateRange = null, IEnumerable subscriptionList = null, IEnumerable resourceGroupUrlList = null, IEnumerable resourceTypeList = null, IEnumerable locationList = null, IEnumerable carbonScopeList = null, CarbonEmissionCategoryType categoryType = default, int topItems = default) + { + subscriptionList ??= new List(); + resourceGroupUrlList ??= new List(); + resourceTypeList ??= new List(); + locationList ??= new List(); + carbonScopeList ??= new List(); + + return new TopItemsMonthlySummaryReportQueryFilter( + CarbonEmissionQueryReportType.TopItemsMonthlySummaryReport, + dateRange, + subscriptionList?.ToList(), + resourceGroupUrlList?.ToList(), + resourceTypeList?.ToList(), + locationList?.ToList(), + carbonScopeList?.ToList(), + serializedAdditionalRawData: null, + categoryType, + topItems); + } + + /// Initializes a new instance of . + /// The start and end dates for carbon emissions data. Required. For ItemDetailsReport and TopItemsSummaryReport, only one month of data is supported at a time, so start and end dates should be equal within DateRange (e.g., start: 2024-06-01 and end: 2024-06-01). + /// List of subscription IDs for which carbon emissions data is requested. Required. Each subscription ID should be in lowercase format. The max length of list is 100. + /// List of resource group URLs for carbon emissions data. Optional. Each URL must follow the format '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroup}', and should be in all lowercase. + /// List of resource types for carbon emissions data. Optional. Each resource type should be specified in lowercase, following the format 'microsoft.{service}/{resourceType}', e.g., 'microsoft.storage/storageaccounts'. + /// List of locations(Azure Region Display Name) for carbon emissions data, with each location specified in lowercase (e.g., 'east us'). Optional. You can use the command 'az account list-locations -o table' to find Azure Region Display Names. + /// List of carbon emission scopes. Required. Accepts one or more values from EmissionScopeEnum (e.g., Scope1, Scope2, Scope3) in list form. The output will include the total emissions for the specified scopes. + /// Specifies the category type for detailed emissions data, such as Resource, ResourceGroup, ResourceType, Location, or Subscription. See supported types in CategoryTypeEnum. + /// The column name to order the results by. See supported values in OrderByColumnEnum. + /// Direction for sorting results. See supported values in SortDirectionEnum. + /// Number of items to return in one request, max value is 5000. + /// Pagination token for fetching the next page of data. This token is nullable and will be returned in the previous response if additional data pages are available. + /// A new instance for mocking. + public static ItemDetailsQueryFilter ItemDetailsQueryFilter(CarbonEmissionQueryDateRange dateRange = null, IEnumerable subscriptionList = null, IEnumerable resourceGroupUrlList = null, IEnumerable resourceTypeList = null, IEnumerable locationList = null, IEnumerable carbonScopeList = null, CarbonEmissionCategoryType categoryType = default, CarbonEmissionQueryOrderByColumn orderBy = default, CarbonEmissionQuerySortDirection sortDirection = default, int pageSize = default, string skipToken = null) + { + subscriptionList ??= new List(); + resourceGroupUrlList ??= new List(); + resourceTypeList ??= new List(); + locationList ??= new List(); + carbonScopeList ??= new List(); + + return new ItemDetailsQueryFilter( + CarbonEmissionQueryReportType.ItemDetailsReport, + dateRange, + subscriptionList?.ToList(), + resourceGroupUrlList?.ToList(), + resourceTypeList?.ToList(), + locationList?.ToList(), + carbonScopeList?.ToList(), + serializedAdditionalRawData: null, + categoryType, + orderBy, + sortDirection, + pageSize, + skipToken); + } + + /// Initializes a new instance of . + /// The data type of the query result, indicating the format of the returned response. + /// Total carbon emissions for the specified query parameters, measured in kgCO2E. This value represents total emissions over the specified date range (e.g., March-June). + /// Total carbon emissions for the previous month’s date range, which is the same period as the specified date range but shifted left by one month (e.g., if the specified range is March - June, the previous month’s range will be Feb - May). The value is measured in kgCO2E. + /// The percentage change in carbon emissions between the current and previous DateRange. This is calculated as: (latestMonthEmissions - previousMonthEmissions) / previousMonthEmissions. + /// The change in carbon emissions between the current and previous period, calculated as: latestMonthEmissions - previousMonthEmissions. + /// A new instance for mocking. + public static CarbonEmission CarbonEmission(string dataType = null, double latestMonthEmissions = default, double previousMonthEmissions = default, double? monthOverMonthEmissionsChangeRatio = null, double? monthlyEmissionsChangeValue = null) + { + return new UnknownCarbonEmission( + dataType == null ? default : new CarbonEmissionDataType(dataType), + latestMonthEmissions, + previousMonthEmissions, + monthOverMonthEmissionsChangeRatio, + monthlyEmissionsChangeValue, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Total carbon emissions for the specified query parameters, measured in kgCO2E. This value represents total emissions over the specified date range (e.g., March-June). + /// Total carbon emissions for the previous month’s date range, which is the same period as the specified date range but shifted left by one month (e.g., if the specified range is March - June, the previous month’s range will be Feb - May). The value is measured in kgCO2E. + /// The percentage change in carbon emissions between the current and previous DateRange. This is calculated as: (latestMonthEmissions - previousMonthEmissions) / previousMonthEmissions. + /// The change in carbon emissions between the current and previous period, calculated as: latestMonthEmissions - previousMonthEmissions. + /// A new instance for mocking. + public static CarbonEmissionOverallSummary CarbonEmissionOverallSummary(double latestMonthEmissions = default, double previousMonthEmissions = default, double? monthOverMonthEmissionsChangeRatio = null, double? monthlyEmissionsChangeValue = null) + { + return new CarbonEmissionOverallSummary( + CarbonEmissionDataType.OverallSummaryData, + latestMonthEmissions, + previousMonthEmissions, + monthOverMonthEmissionsChangeRatio, + monthlyEmissionsChangeValue, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Total carbon emissions for the specified query parameters, measured in kgCO2E. This value represents total emissions over the specified date range (e.g., March-June). + /// Total carbon emissions for the previous month’s date range, which is the same period as the specified date range but shifted left by one month (e.g., if the specified range is March - June, the previous month’s range will be Feb - May). The value is measured in kgCO2E. + /// The percentage change in carbon emissions between the current and previous DateRange. This is calculated as: (latestMonthEmissions - previousMonthEmissions) / previousMonthEmissions. + /// The change in carbon emissions between the current and previous period, calculated as: latestMonthEmissions - previousMonthEmissions. + /// The date, representing the month, for which the emissions data is reported, formatted as yyyy-MM-dd (e.g., 2024-03-01). + /// Carbon intensity for the specified month, typically in units of kgCO2E per unit of normalized usage. + /// A new instance for mocking. + public static CarbonEmissionMonthlySummary CarbonEmissionMonthlySummary(double latestMonthEmissions = default, double previousMonthEmissions = default, double? monthOverMonthEmissionsChangeRatio = null, double? monthlyEmissionsChangeValue = null, string date = null, double carbonIntensity = default) + { + return new CarbonEmissionMonthlySummary( + CarbonEmissionDataType.MonthlySummaryData, + latestMonthEmissions, + previousMonthEmissions, + monthOverMonthEmissionsChangeRatio, + monthlyEmissionsChangeValue, + serializedAdditionalRawData: null, + date, + carbonIntensity); + } + + /// Initializes a new instance of . + /// Total carbon emissions for the specified query parameters, measured in kgCO2E. This value represents total emissions over the specified date range (e.g., March-June). + /// Total carbon emissions for the previous month’s date range, which is the same period as the specified date range but shifted left by one month (e.g., if the specified range is March - June, the previous month’s range will be Feb - May). The value is measured in kgCO2E. + /// The percentage change in carbon emissions between the current and previous DateRange. This is calculated as: (latestMonthEmissions - previousMonthEmissions) / previousMonthEmissions. + /// The change in carbon emissions between the current and previous period, calculated as: latestMonthEmissions - previousMonthEmissions. + /// The identifier of the item being reported on, which could refer to the resource name, resource type name, location, resource group name, or subscription ID, depending on the specified category type. + /// The category type of the item. This defines which dimension the emissions are aggregated by, and the supported values are defined in CategoryTypeEnum (e.g., Subscription, ResourceGroup, Resource, etc.). + /// A new instance for mocking. + public static CarbonEmissionTopItemsSummary CarbonEmissionTopItemsSummary(double latestMonthEmissions = default, double previousMonthEmissions = default, double? monthOverMonthEmissionsChangeRatio = null, double? monthlyEmissionsChangeValue = null, string itemName = null, CarbonEmissionCategoryType categoryType = default) + { + return new CarbonEmissionTopItemsSummary( + CarbonEmissionDataType.TopItemsSummaryData, + latestMonthEmissions, + previousMonthEmissions, + monthOverMonthEmissionsChangeRatio, + monthlyEmissionsChangeValue, + serializedAdditionalRawData: null, + itemName, + categoryType); + } + + /// Initializes a new instance of . + /// Total carbon emissions for the specified query parameters, measured in kgCO2E. This value represents total emissions over the specified date range (e.g., March-June). + /// Total carbon emissions for the previous month’s date range, which is the same period as the specified date range but shifted left by one month (e.g., if the specified range is March - June, the previous month’s range will be Feb - May). The value is measured in kgCO2E. + /// The percentage change in carbon emissions between the current and previous DateRange. This is calculated as: (latestMonthEmissions - previousMonthEmissions) / previousMonthEmissions. + /// The change in carbon emissions between the current and previous period, calculated as: latestMonthEmissions - previousMonthEmissions. + /// The resource name of the resource for the Resource Category. + /// The category type of the item. This defines which dimension the emissions are aggregated by, and the supported values are defined in CategoryTypeEnum (e.g., Subscription, ResourceGroup, Resource, etc.). + /// Subscription Id. + /// Resource group name. + /// Resource Id, The URI of the resource for the Resource Category. This identifies the resource being reported. + /// A new instance for mocking. + public static ResourceCarbonEmissionTopItemsSummary ResourceCarbonEmissionTopItemsSummary(double latestMonthEmissions = default, double previousMonthEmissions = default, double? monthOverMonthEmissionsChangeRatio = null, double? monthlyEmissionsChangeValue = null, string itemName = null, CarbonEmissionCategoryType categoryType = default, string subscriptionId = null, string resourceGroup = null, ResourceIdentifier resourceId = null) + { + return new ResourceCarbonEmissionTopItemsSummary( + CarbonEmissionDataType.ResourceTopItemsSummaryData, + latestMonthEmissions, + previousMonthEmissions, + monthOverMonthEmissionsChangeRatio, + monthlyEmissionsChangeValue, + serializedAdditionalRawData: null, + itemName, + categoryType, + subscriptionId, + resourceGroup, + resourceId); + } + + /// Initializes a new instance of . + /// Total carbon emissions for the specified query parameters, measured in kgCO2E. This value represents total emissions over the specified date range (e.g., March-June). + /// Total carbon emissions for the previous month’s date range, which is the same period as the specified date range but shifted left by one month (e.g., if the specified range is March - June, the previous month’s range will be Feb - May). The value is measured in kgCO2E. + /// The percentage change in carbon emissions between the current and previous DateRange. This is calculated as: (latestMonthEmissions - previousMonthEmissions) / previousMonthEmissions. + /// The change in carbon emissions between the current and previous period, calculated as: latestMonthEmissions - previousMonthEmissions. + /// The resourceGroup name of the resource for ResourceGroup Category. + /// ResourceGroup Item category. + /// Subscription Id. + /// Resource Group url, value format is '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroup}'. + /// A new instance for mocking. + public static ResourceGroupCarbonEmissionTopItemsSummary ResourceGroupCarbonEmissionTopItemsSummary(double latestMonthEmissions = default, double previousMonthEmissions = default, double? monthOverMonthEmissionsChangeRatio = null, double? monthlyEmissionsChangeValue = null, string itemName = null, CarbonEmissionCategoryType categoryType = default, string subscriptionId = null, ResourceIdentifier resourceGroupId = null) + { + return new ResourceGroupCarbonEmissionTopItemsSummary( + CarbonEmissionDataType.ResourceGroupTopItemsSummaryData, + latestMonthEmissions, + previousMonthEmissions, + monthOverMonthEmissionsChangeRatio, + monthlyEmissionsChangeValue, + serializedAdditionalRawData: null, + itemName, + categoryType, + subscriptionId, + resourceGroupId); + } + + /// Initializes a new instance of . + /// Total carbon emissions for the specified query parameters, measured in kgCO2E. This value represents total emissions over the specified date range (e.g., March-June). + /// Total carbon emissions for the previous month’s date range, which is the same period as the specified date range but shifted left by one month (e.g., if the specified range is March - June, the previous month’s range will be Feb - May). The value is measured in kgCO2E. + /// The percentage change in carbon emissions between the current and previous DateRange. This is calculated as: (latestMonthEmissions - previousMonthEmissions) / previousMonthEmissions. + /// The change in carbon emissions between the current and previous period, calculated as: latestMonthEmissions - previousMonthEmissions. + /// Item name, it can be resource name, resource type name, location, resource group name or subscriptionId. It depends on category type. + /// Item category, see supported type value defined in CategoryTypeEnum. + /// The date, representing the month, for which the emissions data is reported, formatted as yyyy-MM-dd (e.g., 2024-03-01). + /// A new instance for mocking. + public static CarbonEmissionTopItemMonthlySummary CarbonEmissionTopItemMonthlySummary(double latestMonthEmissions = default, double previousMonthEmissions = default, double? monthOverMonthEmissionsChangeRatio = null, double? monthlyEmissionsChangeValue = null, string itemName = null, CarbonEmissionCategoryType categoryType = default, string date = null) + { + return new CarbonEmissionTopItemMonthlySummary( + CarbonEmissionDataType.TopItemsMonthlySummaryData, + latestMonthEmissions, + previousMonthEmissions, + monthOverMonthEmissionsChangeRatio, + monthlyEmissionsChangeValue, + serializedAdditionalRawData: null, + itemName, + categoryType, + date); + } + + /// Initializes a new instance of . + /// Total carbon emissions for the specified query parameters, measured in kgCO2E. This value represents total emissions over the specified date range (e.g., March-June). + /// Total carbon emissions for the previous month’s date range, which is the same period as the specified date range but shifted left by one month (e.g., if the specified range is March - June, the previous month’s range will be Feb - May). The value is measured in kgCO2E. + /// The percentage change in carbon emissions between the current and previous DateRange. This is calculated as: (latestMonthEmissions - previousMonthEmissions) / previousMonthEmissions. + /// The change in carbon emissions between the current and previous period, calculated as: latestMonthEmissions - previousMonthEmissions. + /// The resource name of resource for Resource Category. + /// Resource Item category. + /// Monthly date string, format is yyyy-MM-dd. + /// Subscription Id. + /// Resource Group. + /// The fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /// A new instance for mocking. + public static ResourceCarbonEmissionTopItemMonthlySummary ResourceCarbonEmissionTopItemMonthlySummary(double latestMonthEmissions = default, double previousMonthEmissions = default, double? monthOverMonthEmissionsChangeRatio = null, double? monthlyEmissionsChangeValue = null, string itemName = null, CarbonEmissionCategoryType categoryType = default, string date = null, string subscriptionId = null, string resourceGroup = null, ResourceIdentifier resourceId = null) + { + return new ResourceCarbonEmissionTopItemMonthlySummary( + CarbonEmissionDataType.ResourceTopItemsMonthlySummaryData, + latestMonthEmissions, + previousMonthEmissions, + monthOverMonthEmissionsChangeRatio, + monthlyEmissionsChangeValue, + serializedAdditionalRawData: null, + itemName, + categoryType, + date, + subscriptionId, + resourceGroup, + resourceId); + } + + /// Initializes a new instance of . + /// Total carbon emissions for the specified query parameters, measured in kgCO2E. This value represents total emissions over the specified date range (e.g., March-June). + /// Total carbon emissions for the previous month’s date range, which is the same period as the specified date range but shifted left by one month (e.g., if the specified range is March - June, the previous month’s range will be Feb - May). The value is measured in kgCO2E. + /// The percentage change in carbon emissions between the current and previous DateRange. This is calculated as: (latestMonthEmissions - previousMonthEmissions) / previousMonthEmissions. + /// The change in carbon emissions between the current and previous period, calculated as: latestMonthEmissions - previousMonthEmissions. + /// It's resource group name for ResourceGroup category. + /// ResourceGroup Item category. + /// Monthly date string, format is yyyy-MM-dd. + /// Subscription Id. + /// Resource Group url, the format is '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroup}'. + /// A new instance for mocking. + public static ResourceGroupCarbonEmissionTopItemMonthlySummary ResourceGroupCarbonEmissionTopItemMonthlySummary(double latestMonthEmissions = default, double previousMonthEmissions = default, double? monthOverMonthEmissionsChangeRatio = null, double? monthlyEmissionsChangeValue = null, string itemName = null, CarbonEmissionCategoryType categoryType = default, string date = null, string subscriptionId = null, ResourceIdentifier resourceGroupId = null) + { + return new ResourceGroupCarbonEmissionTopItemMonthlySummary( + CarbonEmissionDataType.ResourceGroupTopItemsMonthlySummaryData, + latestMonthEmissions, + previousMonthEmissions, + monthOverMonthEmissionsChangeRatio, + monthlyEmissionsChangeValue, + serializedAdditionalRawData: null, + itemName, + categoryType, + date, + subscriptionId, + resourceGroupId); + } + + /// Initializes a new instance of . + /// Total carbon emissions for the specified query parameters, measured in kgCO2E. This value represents total emissions over the specified date range (e.g., March-June). + /// Total carbon emissions for the previous month’s date range, which is the same period as the specified date range but shifted left by one month (e.g., if the specified range is March - June, the previous month’s range will be Feb - May). The value is measured in kgCO2E. + /// The percentage change in carbon emissions between the current and previous DateRange. This is calculated as: (latestMonthEmissions - previousMonthEmissions) / previousMonthEmissions. + /// The change in carbon emissions between the current and previous period, calculated as: latestMonthEmissions - previousMonthEmissions. + /// Item name, it can be resource name, resource type name, location, resource group name or subscriptionId. It depends on category type. + /// Item category, see supported type value defined in CategoryTypeEnum. + /// A new instance for mocking. + public static CarbonEmissionItemDetail CarbonEmissionItemDetail(double latestMonthEmissions = default, double previousMonthEmissions = default, double? monthOverMonthEmissionsChangeRatio = null, double? monthlyEmissionsChangeValue = null, string itemName = null, CarbonEmissionCategoryType categoryType = default) + { + return new CarbonEmissionItemDetail( + CarbonEmissionDataType.ItemDetailsData, + latestMonthEmissions, + previousMonthEmissions, + monthOverMonthEmissionsChangeRatio, + monthlyEmissionsChangeValue, + serializedAdditionalRawData: null, + itemName, + categoryType); + } + + /// Initializes a new instance of . + /// Total carbon emissions for the specified query parameters, measured in kgCO2E. This value represents total emissions over the specified date range (e.g., March-June). + /// Total carbon emissions for the previous month’s date range, which is the same period as the specified date range but shifted left by one month (e.g., if the specified range is March - June, the previous month’s range will be Feb - May). The value is measured in kgCO2E. + /// The percentage change in carbon emissions between the current and previous DateRange. This is calculated as: (latestMonthEmissions - previousMonthEmissions) / previousMonthEmissions. + /// The change in carbon emissions between the current and previous period, calculated as: latestMonthEmissions - previousMonthEmissions. + /// It's resource name. + /// Resource Item category, see supported value defined in CategoryTypeEnum. + /// Subscription Id. + /// Resource Group. + /// The fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /// Resource Location (e.g., 'east us'). + /// The type of resource, for example: microsoft.storage/storageaccounts. + /// A new instance for mocking. + public static ResourceCarbonEmissionItemDetail ResourceCarbonEmissionItemDetail(double latestMonthEmissions = default, double previousMonthEmissions = default, double? monthOverMonthEmissionsChangeRatio = null, double? monthlyEmissionsChangeValue = null, string itemName = null, CarbonEmissionCategoryType categoryType = default, string subscriptionId = null, string resourceGroup = null, ResourceIdentifier resourceId = null, AzureLocation? location = null, ResourceType? resourceType = null) + { + return new ResourceCarbonEmissionItemDetail( + CarbonEmissionDataType.ResourceItemDetailsData, + latestMonthEmissions, + previousMonthEmissions, + monthOverMonthEmissionsChangeRatio, + monthlyEmissionsChangeValue, + serializedAdditionalRawData: null, + itemName, + categoryType, + subscriptionId, + resourceGroup, + resourceId, + location, + resourceType); + } + + /// Initializes a new instance of . + /// Total carbon emissions for the specified query parameters, measured in kgCO2E. This value represents total emissions over the specified date range (e.g., March-June). + /// Total carbon emissions for the previous month’s date range, which is the same period as the specified date range but shifted left by one month (e.g., if the specified range is March - June, the previous month’s range will be Feb - May). The value is measured in kgCO2E. + /// The percentage change in carbon emissions between the current and previous DateRange. This is calculated as: (latestMonthEmissions - previousMonthEmissions) / previousMonthEmissions. + /// The change in carbon emissions between the current and previous period, calculated as: latestMonthEmissions - previousMonthEmissions. + /// It's resource group name. + /// ResourceGroup Item category. + /// Subscription Id. + /// Resource Group url, value format is '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroup}'. + /// A new instance for mocking. + public static ResourceGroupCarbonEmissionItemDetail ResourceGroupCarbonEmissionItemDetail(double latestMonthEmissions = default, double previousMonthEmissions = default, double? monthOverMonthEmissionsChangeRatio = null, double? monthlyEmissionsChangeValue = null, string itemName = null, CarbonEmissionCategoryType categoryType = default, string subscriptionId = null, ResourceIdentifier resourceGroupId = null) + { + return new ResourceGroupCarbonEmissionItemDetail( + CarbonEmissionDataType.ResourceGroupItemDetailsData, + latestMonthEmissions, + previousMonthEmissions, + monthOverMonthEmissionsChangeRatio, + monthlyEmissionsChangeValue, + serializedAdditionalRawData: null, + itemName, + categoryType, + subscriptionId, + resourceGroupId); + } + + /// Initializes a new instance of . + /// Start date parameter, format is yyyy-MM-dd. + /// End date parameter, format is yyyy-MM-dd. + /// A new instance for mocking. + public static CarbonEmissionAvailableDateRange CarbonEmissionAvailableDateRange(DateTimeOffset startOn = default, DateTimeOffset endOn = default) + { + return new CarbonEmissionAvailableDateRange(startOn, endOn, serializedAdditionalRawData: null); + } + } +} diff --git a/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Extensions/CarbonOptimizationExtensions.cs b/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Extensions/CarbonOptimizationExtensions.cs new file mode 100644 index 000000000000..9c4954afb582 --- /dev/null +++ b/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Extensions/CarbonOptimizationExtensions.cs @@ -0,0 +1,153 @@ +// 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.ResourceManager.CarbonOptimization.Mocking; +using Azure.ResourceManager.CarbonOptimization.Models; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.CarbonOptimization +{ + /// A class to add extension methods to Azure.ResourceManager.CarbonOptimization. + public static partial class CarbonOptimizationExtensions + { + private static MockableCarbonOptimizationTenantResource GetMockableCarbonOptimizationTenantResource(ArmResource resource) + { + return resource.GetCachedClient(client => new MockableCarbonOptimizationTenantResource(client, resource.Id)); + } + + /// + /// API for Carbon Emissions Reports + /// + /// + /// Request Path + /// /providers/Microsoft.Carbon/carbonEmissionReports + /// + /// + /// Operation Id + /// CarbonService_QueryCarbonEmissionReports + /// + /// + /// Default Api Version + /// 2025-04-01 + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// Query parameters. + /// The cancellation token to use. + /// or is null. + /// An async collection of that may take multiple service requests to iterate over. + public static AsyncPageable QueryCarbonEmissionReportsAsync(this TenantResource tenantResource, CarbonEmissionQueryFilter queryParameters, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tenantResource, nameof(tenantResource)); + + return GetMockableCarbonOptimizationTenantResource(tenantResource).QueryCarbonEmissionReportsAsync(queryParameters, cancellationToken); + } + + /// + /// API for Carbon Emissions Reports + /// + /// + /// Request Path + /// /providers/Microsoft.Carbon/carbonEmissionReports + /// + /// + /// Operation Id + /// CarbonService_QueryCarbonEmissionReports + /// + /// + /// Default Api Version + /// 2025-04-01 + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// Query parameters. + /// The cancellation token to use. + /// or is null. + /// A collection of that may take multiple service requests to iterate over. + public static Pageable QueryCarbonEmissionReports(this TenantResource tenantResource, CarbonEmissionQueryFilter queryParameters, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tenantResource, nameof(tenantResource)); + + return GetMockableCarbonOptimizationTenantResource(tenantResource).QueryCarbonEmissionReports(queryParameters, cancellationToken); + } + + /// + /// API for query carbon emission data available date range + /// + /// + /// Request Path + /// /providers/Microsoft.Carbon/queryCarbonEmissionDataAvailableDateRange + /// + /// + /// Operation Id + /// CarbonService_QueryCarbonEmissionAvailableDateRange + /// + /// + /// Default Api Version + /// 2025-04-01 + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The cancellation token to use. + /// is null. + public static async Task> QueryCarbonEmissionAvailableDateRangeAsync(this TenantResource tenantResource, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tenantResource, nameof(tenantResource)); + + return await GetMockableCarbonOptimizationTenantResource(tenantResource).QueryCarbonEmissionAvailableDateRangeAsync(cancellationToken).ConfigureAwait(false); + } + + /// + /// API for query carbon emission data available date range + /// + /// + /// Request Path + /// /providers/Microsoft.Carbon/queryCarbonEmissionDataAvailableDateRange + /// + /// + /// Operation Id + /// CarbonService_QueryCarbonEmissionAvailableDateRange + /// + /// + /// Default Api Version + /// 2025-04-01 + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The cancellation token to use. + /// is null. + public static Response QueryCarbonEmissionAvailableDateRange(this TenantResource tenantResource, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tenantResource, nameof(tenantResource)); + + return GetMockableCarbonOptimizationTenantResource(tenantResource).QueryCarbonEmissionAvailableDateRange(cancellationToken); + } + } +} diff --git a/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Extensions/MockableCarbonOptimizationTenantResource.cs b/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Extensions/MockableCarbonOptimizationTenantResource.cs new file mode 100644 index 000000000000..28071c5425ee --- /dev/null +++ b/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Extensions/MockableCarbonOptimizationTenantResource.cs @@ -0,0 +1,171 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.CarbonOptimization.Models; + +namespace Azure.ResourceManager.CarbonOptimization.Mocking +{ + /// A class to add extension methods to TenantResource. + public partial class MockableCarbonOptimizationTenantResource : ArmResource + { + private ClientDiagnostics _carbonServiceClientDiagnostics; + private CarbonServiceRestOperations _carbonServiceRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableCarbonOptimizationTenantResource() + { + } + + /// 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 MockableCarbonOptimizationTenantResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics CarbonServiceClientDiagnostics => _carbonServiceClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.CarbonOptimization", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private CarbonServiceRestOperations CarbonServiceRestClient => _carbonServiceRestClient ??= new CarbonServiceRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// API for Carbon Emissions Reports + /// + /// + /// Request Path + /// /providers/Microsoft.Carbon/carbonEmissionReports + /// + /// + /// Operation Id + /// CarbonService_QueryCarbonEmissionReports + /// + /// + /// Default Api Version + /// 2025-04-01 + /// + /// + /// + /// Query parameters. + /// The cancellation token to use. + /// is null. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable QueryCarbonEmissionReportsAsync(CarbonEmissionQueryFilter queryParameters, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(queryParameters, nameof(queryParameters)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => CarbonServiceRestClient.CreateQueryCarbonEmissionReportsRequest(queryParameters); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => CarbonEmission.DeserializeCarbonEmission(e), CarbonServiceClientDiagnostics, Pipeline, "MockableCarbonOptimizationTenantResource.QueryCarbonEmissionReports", "value", null, cancellationToken); + } + + /// + /// API for Carbon Emissions Reports + /// + /// + /// Request Path + /// /providers/Microsoft.Carbon/carbonEmissionReports + /// + /// + /// Operation Id + /// CarbonService_QueryCarbonEmissionReports + /// + /// + /// Default Api Version + /// 2025-04-01 + /// + /// + /// + /// Query parameters. + /// The cancellation token to use. + /// is null. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable QueryCarbonEmissionReports(CarbonEmissionQueryFilter queryParameters, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(queryParameters, nameof(queryParameters)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => CarbonServiceRestClient.CreateQueryCarbonEmissionReportsRequest(queryParameters); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => CarbonEmission.DeserializeCarbonEmission(e), CarbonServiceClientDiagnostics, Pipeline, "MockableCarbonOptimizationTenantResource.QueryCarbonEmissionReports", "value", null, cancellationToken); + } + + /// + /// API for query carbon emission data available date range + /// + /// + /// Request Path + /// /providers/Microsoft.Carbon/queryCarbonEmissionDataAvailableDateRange + /// + /// + /// Operation Id + /// CarbonService_QueryCarbonEmissionAvailableDateRange + /// + /// + /// Default Api Version + /// 2025-04-01 + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> QueryCarbonEmissionAvailableDateRangeAsync(CancellationToken cancellationToken = default) + { + using var scope = CarbonServiceClientDiagnostics.CreateScope("MockableCarbonOptimizationTenantResource.QueryCarbonEmissionAvailableDateRange"); + scope.Start(); + try + { + var response = await CarbonServiceRestClient.QueryCarbonEmissionAvailableDateRangeAsync(cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// API for query carbon emission data available date range + /// + /// + /// Request Path + /// /providers/Microsoft.Carbon/queryCarbonEmissionDataAvailableDateRange + /// + /// + /// Operation Id + /// CarbonService_QueryCarbonEmissionAvailableDateRange + /// + /// + /// Default Api Version + /// 2025-04-01 + /// + /// + /// + /// The cancellation token to use. + public virtual Response QueryCarbonEmissionAvailableDateRange(CancellationToken cancellationToken = default) + { + using var scope = CarbonServiceClientDiagnostics.CreateScope("MockableCarbonOptimizationTenantResource.QueryCarbonEmissionAvailableDateRange"); + scope.Start(); + try + { + var response = CarbonServiceRestClient.QueryCarbonEmissionAvailableDateRange(cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Internal/Argument.cs b/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Internal/Argument.cs new file mode 100644 index 000000000000..14aabd37427d --- /dev/null +++ b/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/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.CarbonOptimization +{ + 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/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Internal/ChangeTrackingDictionary.cs b/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Internal/ChangeTrackingDictionary.cs new file mode 100644 index 000000000000..bebee292a598 --- /dev/null +++ b/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/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.CarbonOptimization +{ + 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/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Internal/ChangeTrackingList.cs b/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Internal/ChangeTrackingList.cs new file mode 100644 index 000000000000..c0a69d82c3dd --- /dev/null +++ b/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/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.CarbonOptimization +{ + 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/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Internal/ModelSerializationExtensions.cs b/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Internal/ModelSerializationExtensions.cs new file mode 100644 index 000000000000..56bff9009a28 --- /dev/null +++ b/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/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.CarbonOptimization +{ + 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/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Internal/Optional.cs b/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Internal/Optional.cs new file mode 100644 index 000000000000..f2b00200cb54 --- /dev/null +++ b/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/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.CarbonOptimization +{ + 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/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Internal/Utf8JsonRequestContent.cs b/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Internal/Utf8JsonRequestContent.cs new file mode 100644 index 000000000000..8336c2723269 --- /dev/null +++ b/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/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.CarbonOptimization +{ + 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/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/AzureResourceManagerCarbonOptimizationContext.cs b/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/AzureResourceManagerCarbonOptimizationContext.cs new file mode 100644 index 000000000000..40a657916666 --- /dev/null +++ b/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/AzureResourceManagerCarbonOptimizationContext.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.CarbonOptimization +{ + /// + /// 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 AzureResourceManagerCarbonOptimizationContext : ModelReaderWriterContext + { + } +} diff --git a/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/CarbonEmission.Serialization.cs b/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/CarbonEmission.Serialization.cs new file mode 100644 index 000000000000..00b0a34b61e3 --- /dev/null +++ b/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/CarbonEmission.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.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CarbonOptimization.Models +{ + [PersistableModelProxy(typeof(UnknownCarbonEmission))] + public partial class CarbonEmission : 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(CarbonEmission)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("dataType"u8); + writer.WriteStringValue(DataType.ToString()); + writer.WritePropertyName("latestMonthEmissions"u8); + writer.WriteNumberValue(LatestMonthEmissions); + writer.WritePropertyName("previousMonthEmissions"u8); + writer.WriteNumberValue(PreviousMonthEmissions); + if (Optional.IsDefined(MonthOverMonthEmissionsChangeRatio)) + { + writer.WritePropertyName("monthOverMonthEmissionsChangeRatio"u8); + writer.WriteNumberValue(MonthOverMonthEmissionsChangeRatio.Value); + } + if (Optional.IsDefined(MonthlyEmissionsChangeValue)) + { + writer.WritePropertyName("monthlyEmissionsChangeValue"u8); + writer.WriteNumberValue(MonthlyEmissionsChangeValue.Value); + } + 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 + } + } + } + + CarbonEmission 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(CarbonEmission)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeCarbonEmission(document.RootElement, options); + } + + internal static CarbonEmission DeserializeCarbonEmission(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + if (element.TryGetProperty("dataType", out JsonElement discriminator)) + { + switch (discriminator.GetString()) + { + case "ItemDetailsData": return CarbonEmissionItemDetail.DeserializeCarbonEmissionItemDetail(element, options); + case "MonthlySummaryData": return CarbonEmissionMonthlySummary.DeserializeCarbonEmissionMonthlySummary(element, options); + case "OverallSummaryData": return CarbonEmissionOverallSummary.DeserializeCarbonEmissionOverallSummary(element, options); + case "ResourceGroupItemDetailsData": return ResourceGroupCarbonEmissionItemDetail.DeserializeResourceGroupCarbonEmissionItemDetail(element, options); + case "ResourceGroupTopItemsMonthlySummaryData": return ResourceGroupCarbonEmissionTopItemMonthlySummary.DeserializeResourceGroupCarbonEmissionTopItemMonthlySummary(element, options); + case "ResourceGroupTopItemsSummaryData": return ResourceGroupCarbonEmissionTopItemsSummary.DeserializeResourceGroupCarbonEmissionTopItemsSummary(element, options); + case "ResourceItemDetailsData": return ResourceCarbonEmissionItemDetail.DeserializeResourceCarbonEmissionItemDetail(element, options); + case "ResourceTopItemsMonthlySummaryData": return ResourceCarbonEmissionTopItemMonthlySummary.DeserializeResourceCarbonEmissionTopItemMonthlySummary(element, options); + case "ResourceTopItemsSummaryData": return ResourceCarbonEmissionTopItemsSummary.DeserializeResourceCarbonEmissionTopItemsSummary(element, options); + case "TopItemsMonthlySummaryData": return CarbonEmissionTopItemMonthlySummary.DeserializeCarbonEmissionTopItemMonthlySummary(element, options); + case "TopItemsSummaryData": return CarbonEmissionTopItemsSummary.DeserializeCarbonEmissionTopItemsSummary(element, options); + } + } + return UnknownCarbonEmission.DeserializeUnknownCarbonEmission(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, AzureResourceManagerCarbonOptimizationContext.Default); + default: + throw new FormatException($"The model {nameof(CarbonEmission)} does not support writing '{options.Format}' format."); + } + } + + CarbonEmission 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 DeserializeCarbonEmission(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(CarbonEmission)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/CarbonEmission.cs b/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/CarbonEmission.cs new file mode 100644 index 000000000000..631033e6ffde --- /dev/null +++ b/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/CarbonEmission.cs @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.CarbonOptimization.Models +{ + /// + /// The basic response for different query report, all query report result will have these information + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , , , , , , , , , and . + /// + public abstract partial class CarbonEmission + { + /// + /// 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 . + /// Total carbon emissions for the specified query parameters, measured in kgCO2E. This value represents total emissions over the specified date range (e.g., March-June). + /// Total carbon emissions for the previous month’s date range, which is the same period as the specified date range but shifted left by one month (e.g., if the specified range is March - June, the previous month’s range will be Feb - May). The value is measured in kgCO2E. + protected CarbonEmission(double latestMonthEmissions, double previousMonthEmissions) + { + LatestMonthEmissions = latestMonthEmissions; + PreviousMonthEmissions = previousMonthEmissions; + } + + /// Initializes a new instance of . + /// The data type of the query result, indicating the format of the returned response. + /// Total carbon emissions for the specified query parameters, measured in kgCO2E. This value represents total emissions over the specified date range (e.g., March-June). + /// Total carbon emissions for the previous month’s date range, which is the same period as the specified date range but shifted left by one month (e.g., if the specified range is March - June, the previous month’s range will be Feb - May). The value is measured in kgCO2E. + /// The percentage change in carbon emissions between the current and previous DateRange. This is calculated as: (latestMonthEmissions - previousMonthEmissions) / previousMonthEmissions. + /// The change in carbon emissions between the current and previous period, calculated as: latestMonthEmissions - previousMonthEmissions. + /// Keeps track of any properties unknown to the library. + internal CarbonEmission(CarbonEmissionDataType dataType, double latestMonthEmissions, double previousMonthEmissions, double? monthOverMonthEmissionsChangeRatio, double? monthlyEmissionsChangeValue, IDictionary serializedAdditionalRawData) + { + DataType = dataType; + LatestMonthEmissions = latestMonthEmissions; + PreviousMonthEmissions = previousMonthEmissions; + MonthOverMonthEmissionsChangeRatio = monthOverMonthEmissionsChangeRatio; + MonthlyEmissionsChangeValue = monthlyEmissionsChangeValue; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CarbonEmission() + { + } + + /// The data type of the query result, indicating the format of the returned response. + internal CarbonEmissionDataType DataType { get; set; } + /// Total carbon emissions for the specified query parameters, measured in kgCO2E. This value represents total emissions over the specified date range (e.g., March-June). + public double LatestMonthEmissions { get; } + /// Total carbon emissions for the previous month’s date range, which is the same period as the specified date range but shifted left by one month (e.g., if the specified range is March - June, the previous month’s range will be Feb - May). The value is measured in kgCO2E. + public double PreviousMonthEmissions { get; } + /// The percentage change in carbon emissions between the current and previous DateRange. This is calculated as: (latestMonthEmissions - previousMonthEmissions) / previousMonthEmissions. + public double? MonthOverMonthEmissionsChangeRatio { get; } + /// The change in carbon emissions between the current and previous period, calculated as: latestMonthEmissions - previousMonthEmissions. + public double? MonthlyEmissionsChangeValue { get; } + } +} diff --git a/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/CarbonEmissionAccessDecision.cs b/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/CarbonEmissionAccessDecision.cs new file mode 100644 index 000000000000..5dd0d7aa01a0 --- /dev/null +++ b/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/CarbonEmissionAccessDecision.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.CarbonOptimization.Models +{ + /// Enum for Access Decision. + internal readonly partial struct CarbonEmissionAccessDecision : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public CarbonEmissionAccessDecision(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string AllowedValue = "Allowed"; + private const string DeniedValue = "Denied"; + + /// Access allowed. + public static CarbonEmissionAccessDecision Allowed { get; } = new CarbonEmissionAccessDecision(AllowedValue); + /// Access denied. + public static CarbonEmissionAccessDecision Denied { get; } = new CarbonEmissionAccessDecision(DeniedValue); + /// Determines if two values are the same. + public static bool operator ==(CarbonEmissionAccessDecision left, CarbonEmissionAccessDecision right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(CarbonEmissionAccessDecision left, CarbonEmissionAccessDecision right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator CarbonEmissionAccessDecision(string value) => new CarbonEmissionAccessDecision(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is CarbonEmissionAccessDecision other && Equals(other); + /// + public bool Equals(CarbonEmissionAccessDecision 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/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/CarbonEmissionAvailableDateRange.Serialization.cs b/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/CarbonEmissionAvailableDateRange.Serialization.cs new file mode 100644 index 000000000000..eb03c4bad5f6 --- /dev/null +++ b/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/CarbonEmissionAvailableDateRange.Serialization.cs @@ -0,0 +1,134 @@ +// 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.CarbonOptimization.Models +{ + public partial class CarbonEmissionAvailableDateRange : 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(CarbonEmissionAvailableDateRange)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("startDate"u8); + writer.WriteStringValue(StartOn, "O"); + writer.WritePropertyName("endDate"u8); + writer.WriteStringValue(EndOn, "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 + } + } + } + + CarbonEmissionAvailableDateRange 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(CarbonEmissionAvailableDateRange)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeCarbonEmissionAvailableDateRange(document.RootElement, options); + } + + internal static CarbonEmissionAvailableDateRange DeserializeCarbonEmissionAvailableDateRange(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + DateTimeOffset startDate = default; + DateTimeOffset endDate = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("startDate"u8)) + { + startDate = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("endDate"u8)) + { + endDate = property.Value.GetDateTimeOffset("O"); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new CarbonEmissionAvailableDateRange(startDate, endDate, 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, AzureResourceManagerCarbonOptimizationContext.Default); + default: + throw new FormatException($"The model {nameof(CarbonEmissionAvailableDateRange)} does not support writing '{options.Format}' format."); + } + } + + CarbonEmissionAvailableDateRange 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 DeserializeCarbonEmissionAvailableDateRange(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(CarbonEmissionAvailableDateRange)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/CarbonEmissionAvailableDateRange.cs b/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/CarbonEmissionAvailableDateRange.cs new file mode 100644 index 000000000000..984d6d12fce3 --- /dev/null +++ b/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/CarbonEmissionAvailableDateRange.cs @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.CarbonOptimization.Models +{ + /// Response for available date range of carbon emission data. + public partial class CarbonEmissionAvailableDateRange + { + /// + /// 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 . + /// Start date parameter, format is yyyy-MM-dd. + /// End date parameter, format is yyyy-MM-dd. + internal CarbonEmissionAvailableDateRange(DateTimeOffset startOn, DateTimeOffset endOn) + { + StartOn = startOn; + EndOn = endOn; + } + + /// Initializes a new instance of . + /// Start date parameter, format is yyyy-MM-dd. + /// End date parameter, format is yyyy-MM-dd. + /// Keeps track of any properties unknown to the library. + internal CarbonEmissionAvailableDateRange(DateTimeOffset startOn, DateTimeOffset endOn, IDictionary serializedAdditionalRawData) + { + StartOn = startOn; + EndOn = endOn; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CarbonEmissionAvailableDateRange() + { + } + + /// Start date parameter, format is yyyy-MM-dd. + public DateTimeOffset StartOn { get; } + /// End date parameter, format is yyyy-MM-dd. + public DateTimeOffset EndOn { get; } + } +} diff --git a/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/CarbonEmissionCategoryType.cs b/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/CarbonEmissionCategoryType.cs new file mode 100644 index 000000000000..10ba562734a3 --- /dev/null +++ b/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/CarbonEmissionCategoryType.cs @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.CarbonOptimization.Models +{ + /// Supported category types to be used with QueryParameter. Each type represents a different level of emissions data aggregation. + public readonly partial struct CarbonEmissionCategoryType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public CarbonEmissionCategoryType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string SubscriptionValue = "Subscription"; + private const string ResourceGroupValue = "ResourceGroup"; + private const string LocationValue = "Location"; + private const string ResourceValue = "Resource"; + private const string ResourceTypeValue = "ResourceType"; + + /// Emissions aggregated at the subscription level. + public static CarbonEmissionCategoryType Subscription { get; } = new CarbonEmissionCategoryType(SubscriptionValue); + /// Emissions aggregated at the resource group level. + public static CarbonEmissionCategoryType ResourceGroup { get; } = new CarbonEmissionCategoryType(ResourceGroupValue); + /// Emissions aggregated at the location level. + public static CarbonEmissionCategoryType Location { get; } = new CarbonEmissionCategoryType(LocationValue); + /// Emissions aggregated at the resource level. + public static CarbonEmissionCategoryType Resource { get; } = new CarbonEmissionCategoryType(ResourceValue); + /// Emissions aggregated at the resource type level. + public static CarbonEmissionCategoryType ResourceType { get; } = new CarbonEmissionCategoryType(ResourceTypeValue); + /// Determines if two values are the same. + public static bool operator ==(CarbonEmissionCategoryType left, CarbonEmissionCategoryType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(CarbonEmissionCategoryType left, CarbonEmissionCategoryType right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator CarbonEmissionCategoryType(string value) => new CarbonEmissionCategoryType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is CarbonEmissionCategoryType other && Equals(other); + /// + public bool Equals(CarbonEmissionCategoryType 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/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/CarbonEmissionDataType.cs b/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/CarbonEmissionDataType.cs new file mode 100644 index 000000000000..2200a00afeca --- /dev/null +++ b/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/CarbonEmissionDataType.cs @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.CarbonOptimization.Models +{ + /// The response data type of Carbon emission data. + internal readonly partial struct CarbonEmissionDataType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public CarbonEmissionDataType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string OverallSummaryDataValue = "OverallSummaryData"; + private const string MonthlySummaryDataValue = "MonthlySummaryData"; + private const string TopItemsSummaryDataValue = "TopItemsSummaryData"; + private const string ResourceTopItemsSummaryDataValue = "ResourceTopItemsSummaryData"; + private const string ResourceGroupTopItemsSummaryDataValue = "ResourceGroupTopItemsSummaryData"; + private const string TopItemsMonthlySummaryDataValue = "TopItemsMonthlySummaryData"; + private const string ResourceTopItemsMonthlySummaryDataValue = "ResourceTopItemsMonthlySummaryData"; + private const string ResourceGroupTopItemsMonthlySummaryDataValue = "ResourceGroupTopItemsMonthlySummaryData"; + private const string ItemDetailsDataValue = "ItemDetailsData"; + private const string ResourceItemDetailsDataValue = "ResourceItemDetailsData"; + private const string ResourceGroupItemDetailsDataValue = "ResourceGroupItemDetailsData"; + + /// The response data type for OverallSummaryReport. + public static CarbonEmissionDataType OverallSummaryData { get; } = new CarbonEmissionDataType(OverallSummaryDataValue); + /// The response data type for MonthlySummaryReport. + public static CarbonEmissionDataType MonthlySummaryData { get; } = new CarbonEmissionDataType(MonthlySummaryDataValue); + /// The response data type for TopItemsSummaryReport. + public static CarbonEmissionDataType TopItemsSummaryData { get; } = new CarbonEmissionDataType(TopItemsSummaryDataValue); + /// The response data type for Resource's TopItemsSummaryReport. + public static CarbonEmissionDataType ResourceTopItemsSummaryData { get; } = new CarbonEmissionDataType(ResourceTopItemsSummaryDataValue); + /// The response data type for ResourceGroup's TopItemsSummaryReport. + public static CarbonEmissionDataType ResourceGroupTopItemsSummaryData { get; } = new CarbonEmissionDataType(ResourceGroupTopItemsSummaryDataValue); + /// The response data type for TopItemsMonthlySummaryReport. + public static CarbonEmissionDataType TopItemsMonthlySummaryData { get; } = new CarbonEmissionDataType(TopItemsMonthlySummaryDataValue); + /// The response data type for Resource's TopItemsMonthlySummaryReport. + public static CarbonEmissionDataType ResourceTopItemsMonthlySummaryData { get; } = new CarbonEmissionDataType(ResourceTopItemsMonthlySummaryDataValue); + /// The response data type for ResourceGroup's TopItemsMonthlySummaryReport. + public static CarbonEmissionDataType ResourceGroupTopItemsMonthlySummaryData { get; } = new CarbonEmissionDataType(ResourceGroupTopItemsMonthlySummaryDataValue); + /// The response data type for ItemDetailsReport. + public static CarbonEmissionDataType ItemDetailsData { get; } = new CarbonEmissionDataType(ItemDetailsDataValue); + /// The response data type for Resource's ItemDetailsReport. + public static CarbonEmissionDataType ResourceItemDetailsData { get; } = new CarbonEmissionDataType(ResourceItemDetailsDataValue); + /// The response data type for ResourceGroup's ItemDetailsReport. + public static CarbonEmissionDataType ResourceGroupItemDetailsData { get; } = new CarbonEmissionDataType(ResourceGroupItemDetailsDataValue); + /// Determines if two values are the same. + public static bool operator ==(CarbonEmissionDataType left, CarbonEmissionDataType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(CarbonEmissionDataType left, CarbonEmissionDataType right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator CarbonEmissionDataType(string value) => new CarbonEmissionDataType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is CarbonEmissionDataType other && Equals(other); + /// + public bool Equals(CarbonEmissionDataType 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/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/CarbonEmissionItemDetail.Serialization.cs b/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/CarbonEmissionItemDetail.Serialization.cs new file mode 100644 index 000000000000..be20e596aa2e --- /dev/null +++ b/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/CarbonEmissionItemDetail.Serialization.cs @@ -0,0 +1,166 @@ +// 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.CarbonOptimization.Models +{ + public partial class CarbonEmissionItemDetail : 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(CarbonEmissionItemDetail)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + writer.WritePropertyName("itemName"u8); + writer.WriteStringValue(ItemName); + writer.WritePropertyName("categoryType"u8); + writer.WriteStringValue(CategoryType.ToString()); + } + + CarbonEmissionItemDetail 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(CarbonEmissionItemDetail)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeCarbonEmissionItemDetail(document.RootElement, options); + } + + internal static CarbonEmissionItemDetail DeserializeCarbonEmissionItemDetail(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string itemName = default; + CarbonEmissionCategoryType categoryType = default; + CarbonEmissionDataType dataType = default; + double latestMonthEmissions = default; + double previousMonthEmissions = default; + double? monthOverMonthEmissionsChangeRatio = default; + double? monthlyEmissionsChangeValue = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("itemName"u8)) + { + itemName = property.Value.GetString(); + continue; + } + if (property.NameEquals("categoryType"u8)) + { + categoryType = new CarbonEmissionCategoryType(property.Value.GetString()); + continue; + } + if (property.NameEquals("dataType"u8)) + { + dataType = new CarbonEmissionDataType(property.Value.GetString()); + continue; + } + if (property.NameEquals("latestMonthEmissions"u8)) + { + latestMonthEmissions = property.Value.GetDouble(); + continue; + } + if (property.NameEquals("previousMonthEmissions"u8)) + { + previousMonthEmissions = property.Value.GetDouble(); + continue; + } + if (property.NameEquals("monthOverMonthEmissionsChangeRatio"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + monthOverMonthEmissionsChangeRatio = property.Value.GetDouble(); + continue; + } + if (property.NameEquals("monthlyEmissionsChangeValue"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + monthlyEmissionsChangeValue = property.Value.GetDouble(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new CarbonEmissionItemDetail( + dataType, + latestMonthEmissions, + previousMonthEmissions, + monthOverMonthEmissionsChangeRatio, + monthlyEmissionsChangeValue, + serializedAdditionalRawData, + itemName, + categoryType); + } + + 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, AzureResourceManagerCarbonOptimizationContext.Default); + default: + throw new FormatException($"The model {nameof(CarbonEmissionItemDetail)} does not support writing '{options.Format}' format."); + } + } + + CarbonEmissionItemDetail 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 DeserializeCarbonEmissionItemDetail(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(CarbonEmissionItemDetail)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/CarbonEmissionItemDetail.cs b/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/CarbonEmissionItemDetail.cs new file mode 100644 index 000000000000..cb09d8362ce1 --- /dev/null +++ b/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/CarbonEmissionItemDetail.cs @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.CarbonOptimization.Models +{ + /// Response for detailed carbon emissions. + public partial class CarbonEmissionItemDetail : CarbonEmission + { + /// Initializes a new instance of . + /// Total carbon emissions for the specified query parameters, measured in kgCO2E. This value represents total emissions over the specified date range (e.g., March-June). + /// Total carbon emissions for the previous month’s date range, which is the same period as the specified date range but shifted left by one month (e.g., if the specified range is March - June, the previous month’s range will be Feb - May). The value is measured in kgCO2E. + /// Item name, it can be resource name, resource type name, location, resource group name or subscriptionId. It depends on category type. + /// Item category, see supported type value defined in CategoryTypeEnum. + /// is null. + internal CarbonEmissionItemDetail(double latestMonthEmissions, double previousMonthEmissions, string itemName, CarbonEmissionCategoryType categoryType) : base(latestMonthEmissions, previousMonthEmissions) + { + Argument.AssertNotNull(itemName, nameof(itemName)); + + ItemName = itemName; + CategoryType = categoryType; + DataType = CarbonEmissionDataType.ItemDetailsData; + } + + /// Initializes a new instance of . + /// The data type of the query result, indicating the format of the returned response. + /// Total carbon emissions for the specified query parameters, measured in kgCO2E. This value represents total emissions over the specified date range (e.g., March-June). + /// Total carbon emissions for the previous month’s date range, which is the same period as the specified date range but shifted left by one month (e.g., if the specified range is March - June, the previous month’s range will be Feb - May). The value is measured in kgCO2E. + /// The percentage change in carbon emissions between the current and previous DateRange. This is calculated as: (latestMonthEmissions - previousMonthEmissions) / previousMonthEmissions. + /// The change in carbon emissions between the current and previous period, calculated as: latestMonthEmissions - previousMonthEmissions. + /// Keeps track of any properties unknown to the library. + /// Item name, it can be resource name, resource type name, location, resource group name or subscriptionId. It depends on category type. + /// Item category, see supported type value defined in CategoryTypeEnum. + internal CarbonEmissionItemDetail(CarbonEmissionDataType dataType, double latestMonthEmissions, double previousMonthEmissions, double? monthOverMonthEmissionsChangeRatio, double? monthlyEmissionsChangeValue, IDictionary serializedAdditionalRawData, string itemName, CarbonEmissionCategoryType categoryType) : base(dataType, latestMonthEmissions, previousMonthEmissions, monthOverMonthEmissionsChangeRatio, monthlyEmissionsChangeValue, serializedAdditionalRawData) + { + ItemName = itemName; + CategoryType = categoryType; + DataType = dataType; + } + + /// Initializes a new instance of for deserialization. + internal CarbonEmissionItemDetail() + { + } + + /// Item name, it can be resource name, resource type name, location, resource group name or subscriptionId. It depends on category type. + public string ItemName { get; } + /// Item category, see supported type value defined in CategoryTypeEnum. + public CarbonEmissionCategoryType CategoryType { get; } + } +} diff --git a/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/CarbonEmissionListResult.Serialization.cs b/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/CarbonEmissionListResult.Serialization.cs new file mode 100644 index 000000000000..4fecbbd6582d --- /dev/null +++ b/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/CarbonEmissionListResult.Serialization.cs @@ -0,0 +1,172 @@ +// 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.CarbonOptimization.Models +{ + internal partial class CarbonEmissionListResult : 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(CarbonEmissionListResult)} 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(SkipToken)) + { + writer.WritePropertyName("skipToken"u8); + writer.WriteStringValue(SkipToken); + } + if (Optional.IsCollectionDefined(SubscriptionAccessDecisionList)) + { + writer.WritePropertyName("subscriptionAccessDecisionList"u8); + writer.WriteStartArray(); + foreach (var item in SubscriptionAccessDecisionList) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + CarbonEmissionListResult 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(CarbonEmissionListResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeCarbonEmissionListResult(document.RootElement, options); + } + + internal static CarbonEmissionListResult DeserializeCarbonEmissionListResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList value = default; + string skipToken = default; + IReadOnlyList subscriptionAccessDecisionList = 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(CarbonEmission.DeserializeCarbonEmission(item, options)); + } + value = array; + continue; + } + if (property.NameEquals("skipToken"u8)) + { + skipToken = property.Value.GetString(); + continue; + } + if (property.NameEquals("subscriptionAccessDecisionList"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(SubscriptionAccessDecision.DeserializeSubscriptionAccessDecision(item, options)); + } + subscriptionAccessDecisionList = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new CarbonEmissionListResult(value, skipToken, subscriptionAccessDecisionList ?? new ChangeTrackingList(), serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerCarbonOptimizationContext.Default); + default: + throw new FormatException($"The model {nameof(CarbonEmissionListResult)} does not support writing '{options.Format}' format."); + } + } + + CarbonEmissionListResult 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 DeserializeCarbonEmissionListResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(CarbonEmissionListResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/CarbonEmissionListResult.cs b/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/CarbonEmissionListResult.cs new file mode 100644 index 000000000000..5f0c1c279d25 --- /dev/null +++ b/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/CarbonEmissionListResult.cs @@ -0,0 +1,97 @@ +// 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.CarbonOptimization.Models +{ + /// List of carbon emission results. + internal partial class CarbonEmissionListResult + { + /// + /// 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 CarbonEmissionData items on this page + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , , , , , , , , , and . + /// + /// is null. + internal CarbonEmissionListResult(IEnumerable value) + { + Argument.AssertNotNull(value, nameof(value)); + + Value = value.ToList(); + SubscriptionAccessDecisionList = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// + /// The CarbonEmissionData items on this page + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , , , , , , , , , and . + /// + /// The pagination token to fetch next page data, it's null or empty if it doesn't have next page data. + /// The access decision list for each input subscription. + /// Keeps track of any properties unknown to the library. + internal CarbonEmissionListResult(IReadOnlyList value, string skipToken, IReadOnlyList subscriptionAccessDecisionList, IDictionary serializedAdditionalRawData) + { + Value = value; + SkipToken = skipToken; + SubscriptionAccessDecisionList = subscriptionAccessDecisionList; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CarbonEmissionListResult() + { + } + + /// + /// The CarbonEmissionData items on this page + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , , , , , , , , , and . + /// + public IReadOnlyList Value { get; } + /// The pagination token to fetch next page data, it's null or empty if it doesn't have next page data. + public string SkipToken { get; } + /// The access decision list for each input subscription. + public IReadOnlyList SubscriptionAccessDecisionList { get; } + } +} diff --git a/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/CarbonEmissionMonthlySummary.Serialization.cs b/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/CarbonEmissionMonthlySummary.Serialization.cs new file mode 100644 index 000000000000..dd2e0b13fb02 --- /dev/null +++ b/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/CarbonEmissionMonthlySummary.Serialization.cs @@ -0,0 +1,166 @@ +// 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.CarbonOptimization.Models +{ + public partial class CarbonEmissionMonthlySummary : 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(CarbonEmissionMonthlySummary)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + writer.WritePropertyName("date"u8); + writer.WriteStringValue(Date); + writer.WritePropertyName("carbonIntensity"u8); + writer.WriteNumberValue(CarbonIntensity); + } + + CarbonEmissionMonthlySummary 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(CarbonEmissionMonthlySummary)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeCarbonEmissionMonthlySummary(document.RootElement, options); + } + + internal static CarbonEmissionMonthlySummary DeserializeCarbonEmissionMonthlySummary(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string date = default; + double carbonIntensity = default; + CarbonEmissionDataType dataType = default; + double latestMonthEmissions = default; + double previousMonthEmissions = default; + double? monthOverMonthEmissionsChangeRatio = default; + double? monthlyEmissionsChangeValue = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("date"u8)) + { + date = property.Value.GetString(); + continue; + } + if (property.NameEquals("carbonIntensity"u8)) + { + carbonIntensity = property.Value.GetDouble(); + continue; + } + if (property.NameEquals("dataType"u8)) + { + dataType = new CarbonEmissionDataType(property.Value.GetString()); + continue; + } + if (property.NameEquals("latestMonthEmissions"u8)) + { + latestMonthEmissions = property.Value.GetDouble(); + continue; + } + if (property.NameEquals("previousMonthEmissions"u8)) + { + previousMonthEmissions = property.Value.GetDouble(); + continue; + } + if (property.NameEquals("monthOverMonthEmissionsChangeRatio"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + monthOverMonthEmissionsChangeRatio = property.Value.GetDouble(); + continue; + } + if (property.NameEquals("monthlyEmissionsChangeValue"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + monthlyEmissionsChangeValue = property.Value.GetDouble(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new CarbonEmissionMonthlySummary( + dataType, + latestMonthEmissions, + previousMonthEmissions, + monthOverMonthEmissionsChangeRatio, + monthlyEmissionsChangeValue, + serializedAdditionalRawData, + date, + carbonIntensity); + } + + 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, AzureResourceManagerCarbonOptimizationContext.Default); + default: + throw new FormatException($"The model {nameof(CarbonEmissionMonthlySummary)} does not support writing '{options.Format}' format."); + } + } + + CarbonEmissionMonthlySummary 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 DeserializeCarbonEmissionMonthlySummary(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(CarbonEmissionMonthlySummary)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/CarbonEmissionMonthlySummary.cs b/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/CarbonEmissionMonthlySummary.cs new file mode 100644 index 000000000000..57437dbe30f3 --- /dev/null +++ b/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/CarbonEmissionMonthlySummary.cs @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.CarbonOptimization.Models +{ + /// Response for Monthly Carbon Emissions Summary. + public partial class CarbonEmissionMonthlySummary : CarbonEmission + { + /// Initializes a new instance of . + /// Total carbon emissions for the specified query parameters, measured in kgCO2E. This value represents total emissions over the specified date range (e.g., March-June). + /// Total carbon emissions for the previous month’s date range, which is the same period as the specified date range but shifted left by one month (e.g., if the specified range is March - June, the previous month’s range will be Feb - May). The value is measured in kgCO2E. + /// The date, representing the month, for which the emissions data is reported, formatted as yyyy-MM-dd (e.g., 2024-03-01). + /// Carbon intensity for the specified month, typically in units of kgCO2E per unit of normalized usage. + /// is null. + internal CarbonEmissionMonthlySummary(double latestMonthEmissions, double previousMonthEmissions, string date, double carbonIntensity) : base(latestMonthEmissions, previousMonthEmissions) + { + Argument.AssertNotNull(date, nameof(date)); + + Date = date; + CarbonIntensity = carbonIntensity; + DataType = CarbonEmissionDataType.MonthlySummaryData; + } + + /// Initializes a new instance of . + /// The data type of the query result, indicating the format of the returned response. + /// Total carbon emissions for the specified query parameters, measured in kgCO2E. This value represents total emissions over the specified date range (e.g., March-June). + /// Total carbon emissions for the previous month’s date range, which is the same period as the specified date range but shifted left by one month (e.g., if the specified range is March - June, the previous month’s range will be Feb - May). The value is measured in kgCO2E. + /// The percentage change in carbon emissions between the current and previous DateRange. This is calculated as: (latestMonthEmissions - previousMonthEmissions) / previousMonthEmissions. + /// The change in carbon emissions between the current and previous period, calculated as: latestMonthEmissions - previousMonthEmissions. + /// Keeps track of any properties unknown to the library. + /// The date, representing the month, for which the emissions data is reported, formatted as yyyy-MM-dd (e.g., 2024-03-01). + /// Carbon intensity for the specified month, typically in units of kgCO2E per unit of normalized usage. + internal CarbonEmissionMonthlySummary(CarbonEmissionDataType dataType, double latestMonthEmissions, double previousMonthEmissions, double? monthOverMonthEmissionsChangeRatio, double? monthlyEmissionsChangeValue, IDictionary serializedAdditionalRawData, string date, double carbonIntensity) : base(dataType, latestMonthEmissions, previousMonthEmissions, monthOverMonthEmissionsChangeRatio, monthlyEmissionsChangeValue, serializedAdditionalRawData) + { + Date = date; + CarbonIntensity = carbonIntensity; + DataType = dataType; + } + + /// Initializes a new instance of for deserialization. + internal CarbonEmissionMonthlySummary() + { + } + + /// The date, representing the month, for which the emissions data is reported, formatted as yyyy-MM-dd (e.g., 2024-03-01). + public string Date { get; } + /// Carbon intensity for the specified month, typically in units of kgCO2E per unit of normalized usage. + public double CarbonIntensity { get; } + } +} diff --git a/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/CarbonEmissionOverallSummary.Serialization.cs b/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/CarbonEmissionOverallSummary.Serialization.cs new file mode 100644 index 000000000000..bd33b0ab81f0 --- /dev/null +++ b/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/CarbonEmissionOverallSummary.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.CarbonOptimization.Models +{ + public partial class CarbonEmissionOverallSummary : 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(CarbonEmissionOverallSummary)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + } + + CarbonEmissionOverallSummary 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(CarbonEmissionOverallSummary)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeCarbonEmissionOverallSummary(document.RootElement, options); + } + + internal static CarbonEmissionOverallSummary DeserializeCarbonEmissionOverallSummary(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + CarbonEmissionDataType dataType = default; + double latestMonthEmissions = default; + double previousMonthEmissions = default; + double? monthOverMonthEmissionsChangeRatio = default; + double? monthlyEmissionsChangeValue = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("dataType"u8)) + { + dataType = new CarbonEmissionDataType(property.Value.GetString()); + continue; + } + if (property.NameEquals("latestMonthEmissions"u8)) + { + latestMonthEmissions = property.Value.GetDouble(); + continue; + } + if (property.NameEquals("previousMonthEmissions"u8)) + { + previousMonthEmissions = property.Value.GetDouble(); + continue; + } + if (property.NameEquals("monthOverMonthEmissionsChangeRatio"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + monthOverMonthEmissionsChangeRatio = property.Value.GetDouble(); + continue; + } + if (property.NameEquals("monthlyEmissionsChangeValue"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + monthlyEmissionsChangeValue = property.Value.GetDouble(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new CarbonEmissionOverallSummary( + dataType, + latestMonthEmissions, + previousMonthEmissions, + monthOverMonthEmissionsChangeRatio, + monthlyEmissionsChangeValue, + 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, AzureResourceManagerCarbonOptimizationContext.Default); + default: + throw new FormatException($"The model {nameof(CarbonEmissionOverallSummary)} does not support writing '{options.Format}' format."); + } + } + + CarbonEmissionOverallSummary 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 DeserializeCarbonEmissionOverallSummary(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(CarbonEmissionOverallSummary)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/CarbonEmissionOverallSummary.cs b/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/CarbonEmissionOverallSummary.cs new file mode 100644 index 000000000000..f270c44ec284 --- /dev/null +++ b/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/CarbonEmissionOverallSummary.cs @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.CarbonOptimization.Models +{ + /// Response for Overall Carbon Emissions Summary. + public partial class CarbonEmissionOverallSummary : CarbonEmission + { + /// Initializes a new instance of . + /// Total carbon emissions for the specified query parameters, measured in kgCO2E. This value represents total emissions over the specified date range (e.g., March-June). + /// Total carbon emissions for the previous month’s date range, which is the same period as the specified date range but shifted left by one month (e.g., if the specified range is March - June, the previous month’s range will be Feb - May). The value is measured in kgCO2E. + internal CarbonEmissionOverallSummary(double latestMonthEmissions, double previousMonthEmissions) : base(latestMonthEmissions, previousMonthEmissions) + { + DataType = CarbonEmissionDataType.OverallSummaryData; + } + + /// Initializes a new instance of . + /// The data type of the query result, indicating the format of the returned response. + /// Total carbon emissions for the specified query parameters, measured in kgCO2E. This value represents total emissions over the specified date range (e.g., March-June). + /// Total carbon emissions for the previous month’s date range, which is the same period as the specified date range but shifted left by one month (e.g., if the specified range is March - June, the previous month’s range will be Feb - May). The value is measured in kgCO2E. + /// The percentage change in carbon emissions between the current and previous DateRange. This is calculated as: (latestMonthEmissions - previousMonthEmissions) / previousMonthEmissions. + /// The change in carbon emissions between the current and previous period, calculated as: latestMonthEmissions - previousMonthEmissions. + /// Keeps track of any properties unknown to the library. + internal CarbonEmissionOverallSummary(CarbonEmissionDataType dataType, double latestMonthEmissions, double previousMonthEmissions, double? monthOverMonthEmissionsChangeRatio, double? monthlyEmissionsChangeValue, IDictionary serializedAdditionalRawData) : base(dataType, latestMonthEmissions, previousMonthEmissions, monthOverMonthEmissionsChangeRatio, monthlyEmissionsChangeValue, serializedAdditionalRawData) + { + DataType = dataType; + } + + /// Initializes a new instance of for deserialization. + internal CarbonEmissionOverallSummary() + { + } + } +} diff --git a/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/CarbonEmissionQueryDateRange.Serialization.cs b/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/CarbonEmissionQueryDateRange.Serialization.cs new file mode 100644 index 000000000000..ba89ed9a157d --- /dev/null +++ b/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/CarbonEmissionQueryDateRange.Serialization.cs @@ -0,0 +1,134 @@ +// 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.CarbonOptimization.Models +{ + public partial class CarbonEmissionQueryDateRange : 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(CarbonEmissionQueryDateRange)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("start"u8); + writer.WriteStringValue(StartOn, "D"); + writer.WritePropertyName("end"u8); + writer.WriteStringValue(EndOn, "D"); + 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 + } + } + } + + CarbonEmissionQueryDateRange 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(CarbonEmissionQueryDateRange)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeCarbonEmissionQueryDateRange(document.RootElement, options); + } + + internal static CarbonEmissionQueryDateRange DeserializeCarbonEmissionQueryDateRange(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + DateTimeOffset start = default; + DateTimeOffset end = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("start"u8)) + { + start = property.Value.GetDateTimeOffset("D"); + continue; + } + if (property.NameEquals("end"u8)) + { + end = property.Value.GetDateTimeOffset("D"); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new CarbonEmissionQueryDateRange(start, end, 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, AzureResourceManagerCarbonOptimizationContext.Default); + default: + throw new FormatException($"The model {nameof(CarbonEmissionQueryDateRange)} does not support writing '{options.Format}' format."); + } + } + + CarbonEmissionQueryDateRange 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 DeserializeCarbonEmissionQueryDateRange(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(CarbonEmissionQueryDateRange)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/CarbonEmissionQueryDateRange.cs b/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/CarbonEmissionQueryDateRange.cs new file mode 100644 index 000000000000..dd7f906974ba --- /dev/null +++ b/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/CarbonEmissionQueryDateRange.cs @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.CarbonOptimization.Models +{ + /// Date range to be used with QueryParameter, it should be within 12 months between start and end date. In certain cases, start and end dates must be the same date. + public partial class CarbonEmissionQueryDateRange + { + /// + /// 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 . + /// Start date parameter in yyyy-MM-01 format. Only the first day of each month is accepted. + /// End date parameter in yyyy-MM-01 format. Only the first day of each month is accepted. + public CarbonEmissionQueryDateRange(DateTimeOffset startOn, DateTimeOffset endOn) + { + StartOn = startOn; + EndOn = endOn; + } + + /// Initializes a new instance of . + /// Start date parameter in yyyy-MM-01 format. Only the first day of each month is accepted. + /// End date parameter in yyyy-MM-01 format. Only the first day of each month is accepted. + /// Keeps track of any properties unknown to the library. + internal CarbonEmissionQueryDateRange(DateTimeOffset startOn, DateTimeOffset endOn, IDictionary serializedAdditionalRawData) + { + StartOn = startOn; + EndOn = endOn; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CarbonEmissionQueryDateRange() + { + } + + /// Start date parameter in yyyy-MM-01 format. Only the first day of each month is accepted. + public DateTimeOffset StartOn { get; } + /// End date parameter in yyyy-MM-01 format. Only the first day of each month is accepted. + public DateTimeOffset EndOn { get; } + } +} diff --git a/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/CarbonEmissionQueryFilter.Serialization.cs b/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/CarbonEmissionQueryFilter.Serialization.cs new file mode 100644 index 000000000000..eda0fdd190b0 --- /dev/null +++ b/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/CarbonEmissionQueryFilter.Serialization.cs @@ -0,0 +1,167 @@ +// 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.CarbonOptimization.Models +{ + [PersistableModelProxy(typeof(UnknownCarbonEmissionQueryFilter))] + public partial class CarbonEmissionQueryFilter : 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(CarbonEmissionQueryFilter)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("reportType"u8); + writer.WriteStringValue(ReportType.ToString()); + writer.WritePropertyName("dateRange"u8); + writer.WriteObjectValue(DateRange, options); + writer.WritePropertyName("subscriptionList"u8); + writer.WriteStartArray(); + foreach (var item in SubscriptionList) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + if (Optional.IsCollectionDefined(ResourceGroupUrlList)) + { + writer.WritePropertyName("resourceGroupUrlList"u8); + writer.WriteStartArray(); + foreach (var item in ResourceGroupUrlList) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(ResourceTypeList)) + { + writer.WritePropertyName("resourceTypeList"u8); + writer.WriteStartArray(); + foreach (var item in ResourceTypeList) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(LocationList)) + { + writer.WritePropertyName("locationList"u8); + writer.WriteStartArray(); + foreach (var item in LocationList) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + writer.WritePropertyName("carbonScopeList"u8); + writer.WriteStartArray(); + foreach (var item in CarbonScopeList) + { + writer.WriteStringValue(item.ToString()); + } + 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 + } + } + } + + CarbonEmissionQueryFilter 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(CarbonEmissionQueryFilter)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeCarbonEmissionQueryFilter(document.RootElement, options); + } + + internal static CarbonEmissionQueryFilter DeserializeCarbonEmissionQueryFilter(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + if (element.TryGetProperty("reportType", out JsonElement discriminator)) + { + switch (discriminator.GetString()) + { + case "ItemDetailsReport": return ItemDetailsQueryFilter.DeserializeItemDetailsQueryFilter(element, options); + case "MonthlySummaryReport": return MonthlySummaryReportQueryFilter.DeserializeMonthlySummaryReportQueryFilter(element, options); + case "OverallSummaryReport": return OverallSummaryReportQueryFilter.DeserializeOverallSummaryReportQueryFilter(element, options); + case "TopItemsMonthlySummaryReport": return TopItemsMonthlySummaryReportQueryFilter.DeserializeTopItemsMonthlySummaryReportQueryFilter(element, options); + case "TopItemsSummaryReport": return TopItemsSummaryReportQueryFilter.DeserializeTopItemsSummaryReportQueryFilter(element, options); + } + } + return UnknownCarbonEmissionQueryFilter.DeserializeUnknownCarbonEmissionQueryFilter(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, AzureResourceManagerCarbonOptimizationContext.Default); + default: + throw new FormatException($"The model {nameof(CarbonEmissionQueryFilter)} does not support writing '{options.Format}' format."); + } + } + + CarbonEmissionQueryFilter 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 DeserializeCarbonEmissionQueryFilter(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(CarbonEmissionQueryFilter)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/CarbonEmissionQueryFilter.cs b/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/CarbonEmissionQueryFilter.cs new file mode 100644 index 000000000000..9e9a75798c49 --- /dev/null +++ b/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/CarbonEmissionQueryFilter.cs @@ -0,0 +1,114 @@ +// 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; + +namespace Azure.ResourceManager.CarbonOptimization.Models +{ + /// + /// Shared query filter parameter to configure carbon emissions data queries for all different report type defined in ReportTypeEnum. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , , , and . + /// + public abstract partial class CarbonEmissionQueryFilter + { + /// + /// 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 . + /// The start and end dates for carbon emissions data. Required. For ItemDetailsReport and TopItemsSummaryReport, only one month of data is supported at a time, so start and end dates should be equal within DateRange (e.g., start: 2024-06-01 and end: 2024-06-01). + /// List of subscription IDs for which carbon emissions data is requested. Required. Each subscription ID should be in lowercase format. The max length of list is 100. + /// List of carbon emission scopes. Required. Accepts one or more values from EmissionScopeEnum (e.g., Scope1, Scope2, Scope3) in list form. The output will include the total emissions for the specified scopes. + /// , or is null. + protected CarbonEmissionQueryFilter(CarbonEmissionQueryDateRange dateRange, IEnumerable subscriptionList, IEnumerable carbonScopeList) + { + Argument.AssertNotNull(dateRange, nameof(dateRange)); + Argument.AssertNotNull(subscriptionList, nameof(subscriptionList)); + Argument.AssertNotNull(carbonScopeList, nameof(carbonScopeList)); + + DateRange = dateRange; + SubscriptionList = subscriptionList.ToList(); + ResourceGroupUrlList = new ChangeTrackingList(); + ResourceTypeList = new ChangeTrackingList(); + LocationList = new ChangeTrackingList(); + CarbonScopeList = carbonScopeList.ToList(); + } + + /// Initializes a new instance of . + /// The ReportType requested for carbon emissions data. Required. Specifies how data is aggregated and displayed in the output, as explained in the ReportTypeEnum. + /// The start and end dates for carbon emissions data. Required. For ItemDetailsReport and TopItemsSummaryReport, only one month of data is supported at a time, so start and end dates should be equal within DateRange (e.g., start: 2024-06-01 and end: 2024-06-01). + /// List of subscription IDs for which carbon emissions data is requested. Required. Each subscription ID should be in lowercase format. The max length of list is 100. + /// List of resource group URLs for carbon emissions data. Optional. Each URL must follow the format '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroup}', and should be in all lowercase. + /// List of resource types for carbon emissions data. Optional. Each resource type should be specified in lowercase, following the format 'microsoft.{service}/{resourceType}', e.g., 'microsoft.storage/storageaccounts'. + /// List of locations(Azure Region Display Name) for carbon emissions data, with each location specified in lowercase (e.g., 'east us'). Optional. You can use the command 'az account list-locations -o table' to find Azure Region Display Names. + /// List of carbon emission scopes. Required. Accepts one or more values from EmissionScopeEnum (e.g., Scope1, Scope2, Scope3) in list form. The output will include the total emissions for the specified scopes. + /// Keeps track of any properties unknown to the library. + internal CarbonEmissionQueryFilter(CarbonEmissionQueryReportType reportType, CarbonEmissionQueryDateRange dateRange, IList subscriptionList, IList resourceGroupUrlList, IList resourceTypeList, IList locationList, IList carbonScopeList, IDictionary serializedAdditionalRawData) + { + ReportType = reportType; + DateRange = dateRange; + SubscriptionList = subscriptionList; + ResourceGroupUrlList = resourceGroupUrlList; + ResourceTypeList = resourceTypeList; + LocationList = locationList; + CarbonScopeList = carbonScopeList; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CarbonEmissionQueryFilter() + { + } + + /// The ReportType requested for carbon emissions data. Required. Specifies how data is aggregated and displayed in the output, as explained in the ReportTypeEnum. + internal CarbonEmissionQueryReportType ReportType { get; set; } + /// The start and end dates for carbon emissions data. Required. For ItemDetailsReport and TopItemsSummaryReport, only one month of data is supported at a time, so start and end dates should be equal within DateRange (e.g., start: 2024-06-01 and end: 2024-06-01). + public CarbonEmissionQueryDateRange DateRange { get; } + /// List of subscription IDs for which carbon emissions data is requested. Required. Each subscription ID should be in lowercase format. The max length of list is 100. + public IList SubscriptionList { get; } + /// List of resource group URLs for carbon emissions data. Optional. Each URL must follow the format '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroup}', and should be in all lowercase. + public IList ResourceGroupUrlList { get; } + /// List of resource types for carbon emissions data. Optional. Each resource type should be specified in lowercase, following the format 'microsoft.{service}/{resourceType}', e.g., 'microsoft.storage/storageaccounts'. + public IList ResourceTypeList { get; } + /// List of locations(Azure Region Display Name) for carbon emissions data, with each location specified in lowercase (e.g., 'east us'). Optional. You can use the command 'az account list-locations -o table' to find Azure Region Display Names. + public IList LocationList { get; } + /// List of carbon emission scopes. Required. Accepts one or more values from EmissionScopeEnum (e.g., Scope1, Scope2, Scope3) in list form. The output will include the total emissions for the specified scopes. + public IList CarbonScopeList { get; } + } +} diff --git a/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/CarbonEmissionQueryOrderByColumn.cs b/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/CarbonEmissionQueryOrderByColumn.cs new file mode 100644 index 000000000000..a6b93ae8000c --- /dev/null +++ b/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/CarbonEmissionQueryOrderByColumn.cs @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.CarbonOptimization.Models +{ + /// Sorting is supported for columns in ItemDetailsReport. This object includes the column names that sorting is allowed for. Select one of these supported values. + public readonly partial struct CarbonEmissionQueryOrderByColumn : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public CarbonEmissionQueryOrderByColumn(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string ItemNameValue = "ItemName"; + private const string LatestMonthEmissionsValue = "LatestMonthEmissions"; + private const string PreviousMonthEmissionsValue = "PreviousMonthEmissions"; + private const string MonthOverMonthEmissionsChangeRatioValue = "MonthOverMonthEmissionsChangeRatio"; + private const string MonthlyEmissionsChangeValueValue = "MonthlyEmissionsChangeValue"; + private const string ResourceGroupValue = "ResourceGroup"; + + /// The itemName filed in ItemDetailsReport result, see CarbonEmissionItemDetailData for more information. + public static CarbonEmissionQueryOrderByColumn ItemName { get; } = new CarbonEmissionQueryOrderByColumn(ItemNameValue); + /// The latestMonthEmissions filed in ItemDetailsReport result, see CarbonEmissionItemDetailData for more information. + public static CarbonEmissionQueryOrderByColumn LatestMonthEmissions { get; } = new CarbonEmissionQueryOrderByColumn(LatestMonthEmissionsValue); + /// The previousMonthEmissions filed in ItemDetailsReport result, see CarbonEmissionItemDetailData for more information. + public static CarbonEmissionQueryOrderByColumn PreviousMonthEmissions { get; } = new CarbonEmissionQueryOrderByColumn(PreviousMonthEmissionsValue); + /// The monthOverMonthEmissionsChangeRatio filed in ItemDetailsReport result, see CarbonEmissionItemDetailData for more information. + public static CarbonEmissionQueryOrderByColumn MonthOverMonthEmissionsChangeRatio { get; } = new CarbonEmissionQueryOrderByColumn(MonthOverMonthEmissionsChangeRatioValue); + /// The monthlyEmissionsChangeValue filed in ItemDetailsReport result, see CarbonEmissionItemDetailData for more information. + public static CarbonEmissionQueryOrderByColumn MonthlyEmissionsChangeValue { get; } = new CarbonEmissionQueryOrderByColumn(MonthlyEmissionsChangeValueValue); + /// The resourceGroup filed in ResourceCarbonEmissionItemDetailData result, see ResourceCarbonEmissionItemDetailData for more information. + public static CarbonEmissionQueryOrderByColumn ResourceGroup { get; } = new CarbonEmissionQueryOrderByColumn(ResourceGroupValue); + /// Determines if two values are the same. + public static bool operator ==(CarbonEmissionQueryOrderByColumn left, CarbonEmissionQueryOrderByColumn right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(CarbonEmissionQueryOrderByColumn left, CarbonEmissionQueryOrderByColumn right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator CarbonEmissionQueryOrderByColumn(string value) => new CarbonEmissionQueryOrderByColumn(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is CarbonEmissionQueryOrderByColumn other && Equals(other); + /// + public bool Equals(CarbonEmissionQueryOrderByColumn 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/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/CarbonEmissionQueryReportType.cs b/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/CarbonEmissionQueryReportType.cs new file mode 100644 index 000000000000..7c43ed8b1281 --- /dev/null +++ b/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/CarbonEmissionQueryReportType.cs @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.CarbonOptimization.Models +{ + /// Enum for Report Type, specifying different report formats for carbon emissions data. Each report type returns different aggregations of carbon emissions across various categories, date range, emissions scope, and other parameters. + internal readonly partial struct CarbonEmissionQueryReportType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public CarbonEmissionQueryReportType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string OverallSummaryReportValue = "OverallSummaryReport"; + private const string MonthlySummaryReportValue = "MonthlySummaryReport"; + private const string TopItemsSummaryReportValue = "TopItemsSummaryReport"; + private const string TopItemsMonthlySummaryReportValue = "TopItemsMonthlySummaryReport"; + private const string ItemDetailsReportValue = "ItemDetailsReport"; + + /// Overall summary report provides total carbon emissions for the specified date range and query parameters, as well as comparative values for a high-level overview. This report type can accept different values in the start and end fields within DateRange (e.g., start: 2024-03-01 and end: 2024-06-01). + public static CarbonEmissionQueryReportType OverallSummaryReport { get; } = new CarbonEmissionQueryReportType(OverallSummaryReportValue); + /// MonthlySummaryReport provides carbon emissions data by month for the specified query parameters. This report type can accept different values in the start and end fields within DateRange (e.g., start: 2024-03-01 and end: 2024-06-01). + public static CarbonEmissionQueryReportType MonthlySummaryReport { get; } = new CarbonEmissionQueryReportType(MonthlySummaryReportValue); + /// TopItemsSummaryReport provides the N highest-emitting items for the specified query filters. This report returns data for a single month at a time, so it requires the same values for the start and end fields within DateRange. A maximum of N=10 items can be returned at a time. + public static CarbonEmissionQueryReportType TopItemsSummaryReport { get; } = new CarbonEmissionQueryReportType(TopItemsSummaryReportValue); + /// TopItemsMonthlyReport provides the N highest-emitting items by month for the specified query filter. Returns emissions data for the top N items by month within the given date range. A maximum of N=10 items can be returned at a time. + public static CarbonEmissionQueryReportType TopItemsMonthlySummaryReport { get; } = new CarbonEmissionQueryReportType(TopItemsMonthlySummaryReportValue); + /// ItemDetailsReport provides a granular list of items based on the specified CategoryType (e.g., Resource, ResourceGroup, ResourceType, Location, or Subscription) for the query filter. This report can be queried for only one month at a time, requiring the same values in the start and end fields within DateRange. + public static CarbonEmissionQueryReportType ItemDetailsReport { get; } = new CarbonEmissionQueryReportType(ItemDetailsReportValue); + /// Determines if two values are the same. + public static bool operator ==(CarbonEmissionQueryReportType left, CarbonEmissionQueryReportType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(CarbonEmissionQueryReportType left, CarbonEmissionQueryReportType right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator CarbonEmissionQueryReportType(string value) => new CarbonEmissionQueryReportType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is CarbonEmissionQueryReportType other && Equals(other); + /// + public bool Equals(CarbonEmissionQueryReportType 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/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/CarbonEmissionQuerySortDirection.cs b/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/CarbonEmissionQuerySortDirection.cs new file mode 100644 index 000000000000..c06beae5f9f5 --- /dev/null +++ b/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/CarbonEmissionQuerySortDirection.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.CarbonOptimization.Models +{ + /// Sorting is supported for columns in ItemDetailsReport. This object define sorting direction. + public readonly partial struct CarbonEmissionQuerySortDirection : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public CarbonEmissionQuerySortDirection(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string DescValue = "Desc"; + private const string AscValue = "Asc"; + + /// Descending order for query result. + public static CarbonEmissionQuerySortDirection Desc { get; } = new CarbonEmissionQuerySortDirection(DescValue); + /// Ascending order for query result. + public static CarbonEmissionQuerySortDirection Asc { get; } = new CarbonEmissionQuerySortDirection(AscValue); + /// Determines if two values are the same. + public static bool operator ==(CarbonEmissionQuerySortDirection left, CarbonEmissionQuerySortDirection right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(CarbonEmissionQuerySortDirection left, CarbonEmissionQuerySortDirection right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator CarbonEmissionQuerySortDirection(string value) => new CarbonEmissionQuerySortDirection(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is CarbonEmissionQuerySortDirection other && Equals(other); + /// + public bool Equals(CarbonEmissionQuerySortDirection 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/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/CarbonEmissionScope.cs b/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/CarbonEmissionScope.cs new file mode 100644 index 000000000000..8cf62d5e346f --- /dev/null +++ b/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/CarbonEmissionScope.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.CarbonOptimization.Models +{ + /// Supported carbon emission scopes to be used with QueryParameter, as defined by the GHG Protocol. At least one scope must be specified. The output will return a total of all specified scopes. + public readonly partial struct CarbonEmissionScope : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public CarbonEmissionScope(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string Scope1Value = "Scope1"; + private const string Scope2Value = "Scope2"; + private const string Scope3Value = "Scope3"; + + /// Scope1 carbon emission. + public static CarbonEmissionScope Scope1 { get; } = new CarbonEmissionScope(Scope1Value); + /// Scope2 carbon emission. + public static CarbonEmissionScope Scope2 { get; } = new CarbonEmissionScope(Scope2Value); + /// Scope3 carbon emission. + public static CarbonEmissionScope Scope3 { get; } = new CarbonEmissionScope(Scope3Value); + /// Determines if two values are the same. + public static bool operator ==(CarbonEmissionScope left, CarbonEmissionScope right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(CarbonEmissionScope left, CarbonEmissionScope right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator CarbonEmissionScope(string value) => new CarbonEmissionScope(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is CarbonEmissionScope other && Equals(other); + /// + public bool Equals(CarbonEmissionScope 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/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/CarbonEmissionTopItemMonthlySummary.Serialization.cs b/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/CarbonEmissionTopItemMonthlySummary.Serialization.cs new file mode 100644 index 000000000000..6bae646cade6 --- /dev/null +++ b/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/CarbonEmissionTopItemMonthlySummary.Serialization.cs @@ -0,0 +1,175 @@ +// 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.CarbonOptimization.Models +{ + public partial class CarbonEmissionTopItemMonthlySummary : 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(CarbonEmissionTopItemMonthlySummary)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + writer.WritePropertyName("itemName"u8); + writer.WriteStringValue(ItemName); + writer.WritePropertyName("categoryType"u8); + writer.WriteStringValue(CategoryType.ToString()); + writer.WritePropertyName("date"u8); + writer.WriteStringValue(Date); + } + + CarbonEmissionTopItemMonthlySummary 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(CarbonEmissionTopItemMonthlySummary)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeCarbonEmissionTopItemMonthlySummary(document.RootElement, options); + } + + internal static CarbonEmissionTopItemMonthlySummary DeserializeCarbonEmissionTopItemMonthlySummary(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string itemName = default; + CarbonEmissionCategoryType categoryType = default; + string date = default; + CarbonEmissionDataType dataType = default; + double latestMonthEmissions = default; + double previousMonthEmissions = default; + double? monthOverMonthEmissionsChangeRatio = default; + double? monthlyEmissionsChangeValue = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("itemName"u8)) + { + itemName = property.Value.GetString(); + continue; + } + if (property.NameEquals("categoryType"u8)) + { + categoryType = new CarbonEmissionCategoryType(property.Value.GetString()); + continue; + } + if (property.NameEquals("date"u8)) + { + date = property.Value.GetString(); + continue; + } + if (property.NameEquals("dataType"u8)) + { + dataType = new CarbonEmissionDataType(property.Value.GetString()); + continue; + } + if (property.NameEquals("latestMonthEmissions"u8)) + { + latestMonthEmissions = property.Value.GetDouble(); + continue; + } + if (property.NameEquals("previousMonthEmissions"u8)) + { + previousMonthEmissions = property.Value.GetDouble(); + continue; + } + if (property.NameEquals("monthOverMonthEmissionsChangeRatio"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + monthOverMonthEmissionsChangeRatio = property.Value.GetDouble(); + continue; + } + if (property.NameEquals("monthlyEmissionsChangeValue"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + monthlyEmissionsChangeValue = property.Value.GetDouble(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new CarbonEmissionTopItemMonthlySummary( + dataType, + latestMonthEmissions, + previousMonthEmissions, + monthOverMonthEmissionsChangeRatio, + monthlyEmissionsChangeValue, + serializedAdditionalRawData, + itemName, + categoryType, + date); + } + + 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, AzureResourceManagerCarbonOptimizationContext.Default); + default: + throw new FormatException($"The model {nameof(CarbonEmissionTopItemMonthlySummary)} does not support writing '{options.Format}' format."); + } + } + + CarbonEmissionTopItemMonthlySummary 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 DeserializeCarbonEmissionTopItemMonthlySummary(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(CarbonEmissionTopItemMonthlySummary)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/CarbonEmissionTopItemMonthlySummary.cs b/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/CarbonEmissionTopItemMonthlySummary.cs new file mode 100644 index 000000000000..247de674c8e9 --- /dev/null +++ b/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/CarbonEmissionTopItemMonthlySummary.cs @@ -0,0 +1,64 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.CarbonOptimization.Models +{ + /// Response for Top Items Carbon Emissions by Month. + public partial class CarbonEmissionTopItemMonthlySummary : CarbonEmission + { + /// Initializes a new instance of . + /// Total carbon emissions for the specified query parameters, measured in kgCO2E. This value represents total emissions over the specified date range (e.g., March-June). + /// Total carbon emissions for the previous month’s date range, which is the same period as the specified date range but shifted left by one month (e.g., if the specified range is March - June, the previous month’s range will be Feb - May). The value is measured in kgCO2E. + /// Item name, it can be resource name, resource type name, location, resource group name or subscriptionId. It depends on category type. + /// Item category, see supported type value defined in CategoryTypeEnum. + /// The date, representing the month, for which the emissions data is reported, formatted as yyyy-MM-dd (e.g., 2024-03-01). + /// or is null. + internal CarbonEmissionTopItemMonthlySummary(double latestMonthEmissions, double previousMonthEmissions, string itemName, CarbonEmissionCategoryType categoryType, string date) : base(latestMonthEmissions, previousMonthEmissions) + { + Argument.AssertNotNull(itemName, nameof(itemName)); + Argument.AssertNotNull(date, nameof(date)); + + ItemName = itemName; + CategoryType = categoryType; + Date = date; + DataType = CarbonEmissionDataType.TopItemsMonthlySummaryData; + } + + /// Initializes a new instance of . + /// The data type of the query result, indicating the format of the returned response. + /// Total carbon emissions for the specified query parameters, measured in kgCO2E. This value represents total emissions over the specified date range (e.g., March-June). + /// Total carbon emissions for the previous month’s date range, which is the same period as the specified date range but shifted left by one month (e.g., if the specified range is March - June, the previous month’s range will be Feb - May). The value is measured in kgCO2E. + /// The percentage change in carbon emissions between the current and previous DateRange. This is calculated as: (latestMonthEmissions - previousMonthEmissions) / previousMonthEmissions. + /// The change in carbon emissions between the current and previous period, calculated as: latestMonthEmissions - previousMonthEmissions. + /// Keeps track of any properties unknown to the library. + /// Item name, it can be resource name, resource type name, location, resource group name or subscriptionId. It depends on category type. + /// Item category, see supported type value defined in CategoryTypeEnum. + /// The date, representing the month, for which the emissions data is reported, formatted as yyyy-MM-dd (e.g., 2024-03-01). + internal CarbonEmissionTopItemMonthlySummary(CarbonEmissionDataType dataType, double latestMonthEmissions, double previousMonthEmissions, double? monthOverMonthEmissionsChangeRatio, double? monthlyEmissionsChangeValue, IDictionary serializedAdditionalRawData, string itemName, CarbonEmissionCategoryType categoryType, string date) : base(dataType, latestMonthEmissions, previousMonthEmissions, monthOverMonthEmissionsChangeRatio, monthlyEmissionsChangeValue, serializedAdditionalRawData) + { + ItemName = itemName; + CategoryType = categoryType; + Date = date; + DataType = dataType; + } + + /// Initializes a new instance of for deserialization. + internal CarbonEmissionTopItemMonthlySummary() + { + } + + /// Item name, it can be resource name, resource type name, location, resource group name or subscriptionId. It depends on category type. + public string ItemName { get; } + /// Item category, see supported type value defined in CategoryTypeEnum. + public CarbonEmissionCategoryType CategoryType { get; } + /// The date, representing the month, for which the emissions data is reported, formatted as yyyy-MM-dd (e.g., 2024-03-01). + public string Date { get; } + } +} diff --git a/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/CarbonEmissionTopItemsSummary.Serialization.cs b/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/CarbonEmissionTopItemsSummary.Serialization.cs new file mode 100644 index 000000000000..4a1da9a7da4e --- /dev/null +++ b/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/CarbonEmissionTopItemsSummary.Serialization.cs @@ -0,0 +1,166 @@ +// 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.CarbonOptimization.Models +{ + public partial class CarbonEmissionTopItemsSummary : 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(CarbonEmissionTopItemsSummary)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + writer.WritePropertyName("itemName"u8); + writer.WriteStringValue(ItemName); + writer.WritePropertyName("categoryType"u8); + writer.WriteStringValue(CategoryType.ToString()); + } + + CarbonEmissionTopItemsSummary 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(CarbonEmissionTopItemsSummary)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeCarbonEmissionTopItemsSummary(document.RootElement, options); + } + + internal static CarbonEmissionTopItemsSummary DeserializeCarbonEmissionTopItemsSummary(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string itemName = default; + CarbonEmissionCategoryType categoryType = default; + CarbonEmissionDataType dataType = default; + double latestMonthEmissions = default; + double previousMonthEmissions = default; + double? monthOverMonthEmissionsChangeRatio = default; + double? monthlyEmissionsChangeValue = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("itemName"u8)) + { + itemName = property.Value.GetString(); + continue; + } + if (property.NameEquals("categoryType"u8)) + { + categoryType = new CarbonEmissionCategoryType(property.Value.GetString()); + continue; + } + if (property.NameEquals("dataType"u8)) + { + dataType = new CarbonEmissionDataType(property.Value.GetString()); + continue; + } + if (property.NameEquals("latestMonthEmissions"u8)) + { + latestMonthEmissions = property.Value.GetDouble(); + continue; + } + if (property.NameEquals("previousMonthEmissions"u8)) + { + previousMonthEmissions = property.Value.GetDouble(); + continue; + } + if (property.NameEquals("monthOverMonthEmissionsChangeRatio"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + monthOverMonthEmissionsChangeRatio = property.Value.GetDouble(); + continue; + } + if (property.NameEquals("monthlyEmissionsChangeValue"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + monthlyEmissionsChangeValue = property.Value.GetDouble(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new CarbonEmissionTopItemsSummary( + dataType, + latestMonthEmissions, + previousMonthEmissions, + monthOverMonthEmissionsChangeRatio, + monthlyEmissionsChangeValue, + serializedAdditionalRawData, + itemName, + categoryType); + } + + 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, AzureResourceManagerCarbonOptimizationContext.Default); + default: + throw new FormatException($"The model {nameof(CarbonEmissionTopItemsSummary)} does not support writing '{options.Format}' format."); + } + } + + CarbonEmissionTopItemsSummary 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 DeserializeCarbonEmissionTopItemsSummary(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(CarbonEmissionTopItemsSummary)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/CarbonEmissionTopItemsSummary.cs b/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/CarbonEmissionTopItemsSummary.cs new file mode 100644 index 000000000000..e19fe63046f0 --- /dev/null +++ b/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/CarbonEmissionTopItemsSummary.cs @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.CarbonOptimization.Models +{ + /// Response for Top Items by Category Type. + public partial class CarbonEmissionTopItemsSummary : CarbonEmission + { + /// Initializes a new instance of . + /// Total carbon emissions for the specified query parameters, measured in kgCO2E. This value represents total emissions over the specified date range (e.g., March-June). + /// Total carbon emissions for the previous month’s date range, which is the same period as the specified date range but shifted left by one month (e.g., if the specified range is March - June, the previous month’s range will be Feb - May). The value is measured in kgCO2E. + /// The identifier of the item being reported on, which could refer to the resource name, resource type name, location, resource group name, or subscription ID, depending on the specified category type. + /// The category type of the item. This defines which dimension the emissions are aggregated by, and the supported values are defined in CategoryTypeEnum (e.g., Subscription, ResourceGroup, Resource, etc.). + /// is null. + internal CarbonEmissionTopItemsSummary(double latestMonthEmissions, double previousMonthEmissions, string itemName, CarbonEmissionCategoryType categoryType) : base(latestMonthEmissions, previousMonthEmissions) + { + Argument.AssertNotNull(itemName, nameof(itemName)); + + ItemName = itemName; + CategoryType = categoryType; + DataType = CarbonEmissionDataType.TopItemsSummaryData; + } + + /// Initializes a new instance of . + /// The data type of the query result, indicating the format of the returned response. + /// Total carbon emissions for the specified query parameters, measured in kgCO2E. This value represents total emissions over the specified date range (e.g., March-June). + /// Total carbon emissions for the previous month’s date range, which is the same period as the specified date range but shifted left by one month (e.g., if the specified range is March - June, the previous month’s range will be Feb - May). The value is measured in kgCO2E. + /// The percentage change in carbon emissions between the current and previous DateRange. This is calculated as: (latestMonthEmissions - previousMonthEmissions) / previousMonthEmissions. + /// The change in carbon emissions between the current and previous period, calculated as: latestMonthEmissions - previousMonthEmissions. + /// Keeps track of any properties unknown to the library. + /// The identifier of the item being reported on, which could refer to the resource name, resource type name, location, resource group name, or subscription ID, depending on the specified category type. + /// The category type of the item. This defines which dimension the emissions are aggregated by, and the supported values are defined in CategoryTypeEnum (e.g., Subscription, ResourceGroup, Resource, etc.). + internal CarbonEmissionTopItemsSummary(CarbonEmissionDataType dataType, double latestMonthEmissions, double previousMonthEmissions, double? monthOverMonthEmissionsChangeRatio, double? monthlyEmissionsChangeValue, IDictionary serializedAdditionalRawData, string itemName, CarbonEmissionCategoryType categoryType) : base(dataType, latestMonthEmissions, previousMonthEmissions, monthOverMonthEmissionsChangeRatio, monthlyEmissionsChangeValue, serializedAdditionalRawData) + { + ItemName = itemName; + CategoryType = categoryType; + DataType = dataType; + } + + /// Initializes a new instance of for deserialization. + internal CarbonEmissionTopItemsSummary() + { + } + + /// The identifier of the item being reported on, which could refer to the resource name, resource type name, location, resource group name, or subscription ID, depending on the specified category type. + public string ItemName { get; } + /// The category type of the item. This defines which dimension the emissions are aggregated by, and the supported values are defined in CategoryTypeEnum (e.g., Subscription, ResourceGroup, Resource, etc.). + public CarbonEmissionCategoryType CategoryType { get; } + } +} diff --git a/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/ItemDetailsQueryFilter.Serialization.cs b/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/ItemDetailsQueryFilter.Serialization.cs new file mode 100644 index 000000000000..efbe11c9f222 --- /dev/null +++ b/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/ItemDetailsQueryFilter.Serialization.cs @@ -0,0 +1,239 @@ +// 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.CarbonOptimization.Models +{ + public partial class ItemDetailsQueryFilter : 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(ItemDetailsQueryFilter)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + writer.WritePropertyName("categoryType"u8); + writer.WriteStringValue(CategoryType.ToString()); + writer.WritePropertyName("orderBy"u8); + writer.WriteStringValue(OrderBy.ToString()); + writer.WritePropertyName("sortDirection"u8); + writer.WriteStringValue(SortDirection.ToString()); + writer.WritePropertyName("pageSize"u8); + writer.WriteNumberValue(PageSize); + if (Optional.IsDefined(SkipToken)) + { + writer.WritePropertyName("skipToken"u8); + writer.WriteStringValue(SkipToken); + } + } + + ItemDetailsQueryFilter 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(ItemDetailsQueryFilter)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeItemDetailsQueryFilter(document.RootElement, options); + } + + internal static ItemDetailsQueryFilter DeserializeItemDetailsQueryFilter(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + CarbonEmissionCategoryType categoryType = default; + CarbonEmissionQueryOrderByColumn orderBy = default; + CarbonEmissionQuerySortDirection sortDirection = default; + int pageSize = default; + string skipToken = default; + CarbonEmissionQueryReportType reportType = default; + CarbonEmissionQueryDateRange dateRange = default; + IList subscriptionList = default; + IList resourceGroupUrlList = default; + IList resourceTypeList = default; + IList locationList = default; + IList carbonScopeList = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("categoryType"u8)) + { + categoryType = new CarbonEmissionCategoryType(property.Value.GetString()); + continue; + } + if (property.NameEquals("orderBy"u8)) + { + orderBy = new CarbonEmissionQueryOrderByColumn(property.Value.GetString()); + continue; + } + if (property.NameEquals("sortDirection"u8)) + { + sortDirection = new CarbonEmissionQuerySortDirection(property.Value.GetString()); + continue; + } + if (property.NameEquals("pageSize"u8)) + { + pageSize = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("skipToken"u8)) + { + skipToken = property.Value.GetString(); + continue; + } + if (property.NameEquals("reportType"u8)) + { + reportType = new CarbonEmissionQueryReportType(property.Value.GetString()); + continue; + } + if (property.NameEquals("dateRange"u8)) + { + dateRange = CarbonEmissionQueryDateRange.DeserializeCarbonEmissionQueryDateRange(property.Value, options); + continue; + } + if (property.NameEquals("subscriptionList"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + subscriptionList = array; + continue; + } + if (property.NameEquals("resourceGroupUrlList"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + resourceGroupUrlList = array; + continue; + } + if (property.NameEquals("resourceTypeList"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(new ResourceType(item.GetString())); + } + resourceTypeList = array; + continue; + } + if (property.NameEquals("locationList"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(new AzureLocation(item.GetString())); + } + locationList = array; + continue; + } + if (property.NameEquals("carbonScopeList"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(new CarbonEmissionScope(item.GetString())); + } + carbonScopeList = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ItemDetailsQueryFilter( + reportType, + dateRange, + subscriptionList, + resourceGroupUrlList ?? new ChangeTrackingList(), + resourceTypeList ?? new ChangeTrackingList(), + locationList ?? new ChangeTrackingList(), + carbonScopeList, + serializedAdditionalRawData, + categoryType, + orderBy, + sortDirection, + pageSize, + skipToken); + } + + 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, AzureResourceManagerCarbonOptimizationContext.Default); + default: + throw new FormatException($"The model {nameof(ItemDetailsQueryFilter)} does not support writing '{options.Format}' format."); + } + } + + ItemDetailsQueryFilter 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 DeserializeItemDetailsQueryFilter(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ItemDetailsQueryFilter)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/ItemDetailsQueryFilter.cs b/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/ItemDetailsQueryFilter.cs new file mode 100644 index 000000000000..6aa6b4905f48 --- /dev/null +++ b/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/ItemDetailsQueryFilter.cs @@ -0,0 +1,79 @@ +// 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.CarbonOptimization.Models +{ + /// Query Parameters for ItemDetailsReport. + public partial class ItemDetailsQueryFilter : CarbonEmissionQueryFilter + { + /// Initializes a new instance of . + /// The start and end dates for carbon emissions data. Required. For ItemDetailsReport and TopItemsSummaryReport, only one month of data is supported at a time, so start and end dates should be equal within DateRange (e.g., start: 2024-06-01 and end: 2024-06-01). + /// List of subscription IDs for which carbon emissions data is requested. Required. Each subscription ID should be in lowercase format. The max length of list is 100. + /// List of carbon emission scopes. Required. Accepts one or more values from EmissionScopeEnum (e.g., Scope1, Scope2, Scope3) in list form. The output will include the total emissions for the specified scopes. + /// Specifies the category type for detailed emissions data, such as Resource, ResourceGroup, ResourceType, Location, or Subscription. See supported types in CategoryTypeEnum. + /// The column name to order the results by. See supported values in OrderByColumnEnum. + /// Direction for sorting results. See supported values in SortDirectionEnum. + /// Number of items to return in one request, max value is 5000. + /// , or is null. + public ItemDetailsQueryFilter(CarbonEmissionQueryDateRange dateRange, IEnumerable subscriptionList, IEnumerable carbonScopeList, CarbonEmissionCategoryType categoryType, CarbonEmissionQueryOrderByColumn orderBy, CarbonEmissionQuerySortDirection sortDirection, int pageSize) : base(dateRange, subscriptionList, carbonScopeList) + { + Argument.AssertNotNull(dateRange, nameof(dateRange)); + Argument.AssertNotNull(subscriptionList, nameof(subscriptionList)); + Argument.AssertNotNull(carbonScopeList, nameof(carbonScopeList)); + + CategoryType = categoryType; + OrderBy = orderBy; + SortDirection = sortDirection; + PageSize = pageSize; + ReportType = CarbonEmissionQueryReportType.ItemDetailsReport; + } + + /// Initializes a new instance of . + /// The ReportType requested for carbon emissions data. Required. Specifies how data is aggregated and displayed in the output, as explained in the ReportTypeEnum. + /// The start and end dates for carbon emissions data. Required. For ItemDetailsReport and TopItemsSummaryReport, only one month of data is supported at a time, so start and end dates should be equal within DateRange (e.g., start: 2024-06-01 and end: 2024-06-01). + /// List of subscription IDs for which carbon emissions data is requested. Required. Each subscription ID should be in lowercase format. The max length of list is 100. + /// List of resource group URLs for carbon emissions data. Optional. Each URL must follow the format '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroup}', and should be in all lowercase. + /// List of resource types for carbon emissions data. Optional. Each resource type should be specified in lowercase, following the format 'microsoft.{service}/{resourceType}', e.g., 'microsoft.storage/storageaccounts'. + /// List of locations(Azure Region Display Name) for carbon emissions data, with each location specified in lowercase (e.g., 'east us'). Optional. You can use the command 'az account list-locations -o table' to find Azure Region Display Names. + /// List of carbon emission scopes. Required. Accepts one or more values from EmissionScopeEnum (e.g., Scope1, Scope2, Scope3) in list form. The output will include the total emissions for the specified scopes. + /// Keeps track of any properties unknown to the library. + /// Specifies the category type for detailed emissions data, such as Resource, ResourceGroup, ResourceType, Location, or Subscription. See supported types in CategoryTypeEnum. + /// The column name to order the results by. See supported values in OrderByColumnEnum. + /// Direction for sorting results. See supported values in SortDirectionEnum. + /// Number of items to return in one request, max value is 5000. + /// Pagination token for fetching the next page of data. This token is nullable and will be returned in the previous response if additional data pages are available. + internal ItemDetailsQueryFilter(CarbonEmissionQueryReportType reportType, CarbonEmissionQueryDateRange dateRange, IList subscriptionList, IList resourceGroupUrlList, IList resourceTypeList, IList locationList, IList carbonScopeList, IDictionary serializedAdditionalRawData, CarbonEmissionCategoryType categoryType, CarbonEmissionQueryOrderByColumn orderBy, CarbonEmissionQuerySortDirection sortDirection, int pageSize, string skipToken) : base(reportType, dateRange, subscriptionList, resourceGroupUrlList, resourceTypeList, locationList, carbonScopeList, serializedAdditionalRawData) + { + CategoryType = categoryType; + OrderBy = orderBy; + SortDirection = sortDirection; + PageSize = pageSize; + SkipToken = skipToken; + ReportType = reportType; + } + + /// Initializes a new instance of for deserialization. + internal ItemDetailsQueryFilter() + { + } + + /// Specifies the category type for detailed emissions data, such as Resource, ResourceGroup, ResourceType, Location, or Subscription. See supported types in CategoryTypeEnum. + public CarbonEmissionCategoryType CategoryType { get; } + /// The column name to order the results by. See supported values in OrderByColumnEnum. + public CarbonEmissionQueryOrderByColumn OrderBy { get; } + /// Direction for sorting results. See supported values in SortDirectionEnum. + public CarbonEmissionQuerySortDirection SortDirection { get; } + /// Number of items to return in one request, max value is 5000. + public int PageSize { get; } + /// Pagination token for fetching the next page of data. This token is nullable and will be returned in the previous response if additional data pages are available. + public string SkipToken { get; set; } + } +} diff --git a/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/MonthlySummaryReportQueryFilter.Serialization.cs b/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/MonthlySummaryReportQueryFilter.Serialization.cs new file mode 100644 index 000000000000..7690af277434 --- /dev/null +++ b/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/MonthlySummaryReportQueryFilter.Serialization.cs @@ -0,0 +1,191 @@ +// 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.CarbonOptimization.Models +{ + public partial class MonthlySummaryReportQueryFilter : 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(MonthlySummaryReportQueryFilter)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + } + + MonthlySummaryReportQueryFilter 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(MonthlySummaryReportQueryFilter)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeMonthlySummaryReportQueryFilter(document.RootElement, options); + } + + internal static MonthlySummaryReportQueryFilter DeserializeMonthlySummaryReportQueryFilter(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + CarbonEmissionQueryReportType reportType = default; + CarbonEmissionQueryDateRange dateRange = default; + IList subscriptionList = default; + IList resourceGroupUrlList = default; + IList resourceTypeList = default; + IList locationList = default; + IList carbonScopeList = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("reportType"u8)) + { + reportType = new CarbonEmissionQueryReportType(property.Value.GetString()); + continue; + } + if (property.NameEquals("dateRange"u8)) + { + dateRange = CarbonEmissionQueryDateRange.DeserializeCarbonEmissionQueryDateRange(property.Value, options); + continue; + } + if (property.NameEquals("subscriptionList"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + subscriptionList = array; + continue; + } + if (property.NameEquals("resourceGroupUrlList"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + resourceGroupUrlList = array; + continue; + } + if (property.NameEquals("resourceTypeList"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(new ResourceType(item.GetString())); + } + resourceTypeList = array; + continue; + } + if (property.NameEquals("locationList"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(new AzureLocation(item.GetString())); + } + locationList = array; + continue; + } + if (property.NameEquals("carbonScopeList"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(new CarbonEmissionScope(item.GetString())); + } + carbonScopeList = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new MonthlySummaryReportQueryFilter( + reportType, + dateRange, + subscriptionList, + resourceGroupUrlList ?? new ChangeTrackingList(), + resourceTypeList ?? new ChangeTrackingList(), + locationList ?? new ChangeTrackingList(), + carbonScopeList, + 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, AzureResourceManagerCarbonOptimizationContext.Default); + default: + throw new FormatException($"The model {nameof(MonthlySummaryReportQueryFilter)} does not support writing '{options.Format}' format."); + } + } + + MonthlySummaryReportQueryFilter 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 DeserializeMonthlySummaryReportQueryFilter(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(MonthlySummaryReportQueryFilter)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/MonthlySummaryReportQueryFilter.cs b/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/MonthlySummaryReportQueryFilter.cs new file mode 100644 index 000000000000..f19d05574b9b --- /dev/null +++ b/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/MonthlySummaryReportQueryFilter.cs @@ -0,0 +1,50 @@ +// 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.CarbonOptimization.Models +{ + /// Query filter parameter to configure MonthlySummaryReport queries. + public partial class MonthlySummaryReportQueryFilter : CarbonEmissionQueryFilter + { + /// Initializes a new instance of . + /// The start and end dates for carbon emissions data. Required. For ItemDetailsReport and TopItemsSummaryReport, only one month of data is supported at a time, so start and end dates should be equal within DateRange (e.g., start: 2024-06-01 and end: 2024-06-01). + /// List of subscription IDs for which carbon emissions data is requested. Required. Each subscription ID should be in lowercase format. The max length of list is 100. + /// List of carbon emission scopes. Required. Accepts one or more values from EmissionScopeEnum (e.g., Scope1, Scope2, Scope3) in list form. The output will include the total emissions for the specified scopes. + /// , or is null. + public MonthlySummaryReportQueryFilter(CarbonEmissionQueryDateRange dateRange, IEnumerable subscriptionList, IEnumerable carbonScopeList) : base(dateRange, subscriptionList, carbonScopeList) + { + Argument.AssertNotNull(dateRange, nameof(dateRange)); + Argument.AssertNotNull(subscriptionList, nameof(subscriptionList)); + Argument.AssertNotNull(carbonScopeList, nameof(carbonScopeList)); + + ReportType = CarbonEmissionQueryReportType.MonthlySummaryReport; + } + + /// Initializes a new instance of . + /// The ReportType requested for carbon emissions data. Required. Specifies how data is aggregated and displayed in the output, as explained in the ReportTypeEnum. + /// The start and end dates for carbon emissions data. Required. For ItemDetailsReport and TopItemsSummaryReport, only one month of data is supported at a time, so start and end dates should be equal within DateRange (e.g., start: 2024-06-01 and end: 2024-06-01). + /// List of subscription IDs for which carbon emissions data is requested. Required. Each subscription ID should be in lowercase format. The max length of list is 100. + /// List of resource group URLs for carbon emissions data. Optional. Each URL must follow the format '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroup}', and should be in all lowercase. + /// List of resource types for carbon emissions data. Optional. Each resource type should be specified in lowercase, following the format 'microsoft.{service}/{resourceType}', e.g., 'microsoft.storage/storageaccounts'. + /// List of locations(Azure Region Display Name) for carbon emissions data, with each location specified in lowercase (e.g., 'east us'). Optional. You can use the command 'az account list-locations -o table' to find Azure Region Display Names. + /// List of carbon emission scopes. Required. Accepts one or more values from EmissionScopeEnum (e.g., Scope1, Scope2, Scope3) in list form. The output will include the total emissions for the specified scopes. + /// Keeps track of any properties unknown to the library. + internal MonthlySummaryReportQueryFilter(CarbonEmissionQueryReportType reportType, CarbonEmissionQueryDateRange dateRange, IList subscriptionList, IList resourceGroupUrlList, IList resourceTypeList, IList locationList, IList carbonScopeList, IDictionary serializedAdditionalRawData) : base(reportType, dateRange, subscriptionList, resourceGroupUrlList, resourceTypeList, locationList, carbonScopeList, serializedAdditionalRawData) + { + ReportType = reportType; + } + + /// Initializes a new instance of for deserialization. + internal MonthlySummaryReportQueryFilter() + { + } + } +} diff --git a/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/OverallSummaryReportQueryFilter.Serialization.cs b/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/OverallSummaryReportQueryFilter.Serialization.cs new file mode 100644 index 000000000000..34844c0eb6b4 --- /dev/null +++ b/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/OverallSummaryReportQueryFilter.Serialization.cs @@ -0,0 +1,191 @@ +// 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.CarbonOptimization.Models +{ + public partial class OverallSummaryReportQueryFilter : 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(OverallSummaryReportQueryFilter)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + } + + OverallSummaryReportQueryFilter 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(OverallSummaryReportQueryFilter)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeOverallSummaryReportQueryFilter(document.RootElement, options); + } + + internal static OverallSummaryReportQueryFilter DeserializeOverallSummaryReportQueryFilter(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + CarbonEmissionQueryReportType reportType = default; + CarbonEmissionQueryDateRange dateRange = default; + IList subscriptionList = default; + IList resourceGroupUrlList = default; + IList resourceTypeList = default; + IList locationList = default; + IList carbonScopeList = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("reportType"u8)) + { + reportType = new CarbonEmissionQueryReportType(property.Value.GetString()); + continue; + } + if (property.NameEquals("dateRange"u8)) + { + dateRange = CarbonEmissionQueryDateRange.DeserializeCarbonEmissionQueryDateRange(property.Value, options); + continue; + } + if (property.NameEquals("subscriptionList"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + subscriptionList = array; + continue; + } + if (property.NameEquals("resourceGroupUrlList"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + resourceGroupUrlList = array; + continue; + } + if (property.NameEquals("resourceTypeList"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(new ResourceType(item.GetString())); + } + resourceTypeList = array; + continue; + } + if (property.NameEquals("locationList"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(new AzureLocation(item.GetString())); + } + locationList = array; + continue; + } + if (property.NameEquals("carbonScopeList"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(new CarbonEmissionScope(item.GetString())); + } + carbonScopeList = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new OverallSummaryReportQueryFilter( + reportType, + dateRange, + subscriptionList, + resourceGroupUrlList ?? new ChangeTrackingList(), + resourceTypeList ?? new ChangeTrackingList(), + locationList ?? new ChangeTrackingList(), + carbonScopeList, + 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, AzureResourceManagerCarbonOptimizationContext.Default); + default: + throw new FormatException($"The model {nameof(OverallSummaryReportQueryFilter)} does not support writing '{options.Format}' format."); + } + } + + OverallSummaryReportQueryFilter 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 DeserializeOverallSummaryReportQueryFilter(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(OverallSummaryReportQueryFilter)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/OverallSummaryReportQueryFilter.cs b/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/OverallSummaryReportQueryFilter.cs new file mode 100644 index 000000000000..ad75c967b949 --- /dev/null +++ b/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/OverallSummaryReportQueryFilter.cs @@ -0,0 +1,50 @@ +// 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.CarbonOptimization.Models +{ + /// Query filter parameter to configure OverallSummaryReport queries. + public partial class OverallSummaryReportQueryFilter : CarbonEmissionQueryFilter + { + /// Initializes a new instance of . + /// The start and end dates for carbon emissions data. Required. For ItemDetailsReport and TopItemsSummaryReport, only one month of data is supported at a time, so start and end dates should be equal within DateRange (e.g., start: 2024-06-01 and end: 2024-06-01). + /// List of subscription IDs for which carbon emissions data is requested. Required. Each subscription ID should be in lowercase format. The max length of list is 100. + /// List of carbon emission scopes. Required. Accepts one or more values from EmissionScopeEnum (e.g., Scope1, Scope2, Scope3) in list form. The output will include the total emissions for the specified scopes. + /// , or is null. + public OverallSummaryReportQueryFilter(CarbonEmissionQueryDateRange dateRange, IEnumerable subscriptionList, IEnumerable carbonScopeList) : base(dateRange, subscriptionList, carbonScopeList) + { + Argument.AssertNotNull(dateRange, nameof(dateRange)); + Argument.AssertNotNull(subscriptionList, nameof(subscriptionList)); + Argument.AssertNotNull(carbonScopeList, nameof(carbonScopeList)); + + ReportType = CarbonEmissionQueryReportType.OverallSummaryReport; + } + + /// Initializes a new instance of . + /// The ReportType requested for carbon emissions data. Required. Specifies how data is aggregated and displayed in the output, as explained in the ReportTypeEnum. + /// The start and end dates for carbon emissions data. Required. For ItemDetailsReport and TopItemsSummaryReport, only one month of data is supported at a time, so start and end dates should be equal within DateRange (e.g., start: 2024-06-01 and end: 2024-06-01). + /// List of subscription IDs for which carbon emissions data is requested. Required. Each subscription ID should be in lowercase format. The max length of list is 100. + /// List of resource group URLs for carbon emissions data. Optional. Each URL must follow the format '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroup}', and should be in all lowercase. + /// List of resource types for carbon emissions data. Optional. Each resource type should be specified in lowercase, following the format 'microsoft.{service}/{resourceType}', e.g., 'microsoft.storage/storageaccounts'. + /// List of locations(Azure Region Display Name) for carbon emissions data, with each location specified in lowercase (e.g., 'east us'). Optional. You can use the command 'az account list-locations -o table' to find Azure Region Display Names. + /// List of carbon emission scopes. Required. Accepts one or more values from EmissionScopeEnum (e.g., Scope1, Scope2, Scope3) in list form. The output will include the total emissions for the specified scopes. + /// Keeps track of any properties unknown to the library. + internal OverallSummaryReportQueryFilter(CarbonEmissionQueryReportType reportType, CarbonEmissionQueryDateRange dateRange, IList subscriptionList, IList resourceGroupUrlList, IList resourceTypeList, IList locationList, IList carbonScopeList, IDictionary serializedAdditionalRawData) : base(reportType, dateRange, subscriptionList, resourceGroupUrlList, resourceTypeList, locationList, carbonScopeList, serializedAdditionalRawData) + { + ReportType = reportType; + } + + /// Initializes a new instance of for deserialization. + internal OverallSummaryReportQueryFilter() + { + } + } +} diff --git a/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/ResourceCarbonEmissionItemDetail.Serialization.cs b/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/ResourceCarbonEmissionItemDetail.Serialization.cs new file mode 100644 index 000000000000..e7377e701eec --- /dev/null +++ b/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/ResourceCarbonEmissionItemDetail.Serialization.cs @@ -0,0 +1,225 @@ +// 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.CarbonOptimization.Models +{ + public partial class ResourceCarbonEmissionItemDetail : 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(ResourceCarbonEmissionItemDetail)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + writer.WritePropertyName("itemName"u8); + writer.WriteStringValue(ItemName); + writer.WritePropertyName("categoryType"u8); + writer.WriteStringValue(CategoryType.ToString()); + writer.WritePropertyName("subscriptionId"u8); + writer.WriteStringValue(SubscriptionId); + writer.WritePropertyName("resourceGroup"u8); + writer.WriteStringValue(ResourceGroup); + writer.WritePropertyName("resourceId"u8); + writer.WriteStringValue(ResourceId); + if (Optional.IsDefined(Location)) + { + writer.WritePropertyName("location"u8); + writer.WriteStringValue(Location.Value); + } + if (Optional.IsDefined(ResourceType)) + { + writer.WritePropertyName("resourceType"u8); + writer.WriteStringValue(ResourceType.Value); + } + } + + ResourceCarbonEmissionItemDetail 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(ResourceCarbonEmissionItemDetail)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeResourceCarbonEmissionItemDetail(document.RootElement, options); + } + + internal static ResourceCarbonEmissionItemDetail DeserializeResourceCarbonEmissionItemDetail(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string itemName = default; + CarbonEmissionCategoryType categoryType = default; + string subscriptionId = default; + string resourceGroup = default; + ResourceIdentifier resourceId = default; + AzureLocation? location = default; + ResourceType? resourceType = default; + CarbonEmissionDataType dataType = default; + double latestMonthEmissions = default; + double previousMonthEmissions = default; + double? monthOverMonthEmissionsChangeRatio = default; + double? monthlyEmissionsChangeValue = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("itemName"u8)) + { + itemName = property.Value.GetString(); + continue; + } + if (property.NameEquals("categoryType"u8)) + { + categoryType = new CarbonEmissionCategoryType(property.Value.GetString()); + continue; + } + if (property.NameEquals("subscriptionId"u8)) + { + subscriptionId = property.Value.GetString(); + continue; + } + if (property.NameEquals("resourceGroup"u8)) + { + resourceGroup = property.Value.GetString(); + continue; + } + if (property.NameEquals("resourceId"u8)) + { + resourceId = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("location"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + location = new AzureLocation(property.Value.GetString()); + continue; + } + if (property.NameEquals("resourceType"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + resourceType = new ResourceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("dataType"u8)) + { + dataType = new CarbonEmissionDataType(property.Value.GetString()); + continue; + } + if (property.NameEquals("latestMonthEmissions"u8)) + { + latestMonthEmissions = property.Value.GetDouble(); + continue; + } + if (property.NameEquals("previousMonthEmissions"u8)) + { + previousMonthEmissions = property.Value.GetDouble(); + continue; + } + if (property.NameEquals("monthOverMonthEmissionsChangeRatio"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + monthOverMonthEmissionsChangeRatio = property.Value.GetDouble(); + continue; + } + if (property.NameEquals("monthlyEmissionsChangeValue"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + monthlyEmissionsChangeValue = property.Value.GetDouble(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ResourceCarbonEmissionItemDetail( + dataType, + latestMonthEmissions, + previousMonthEmissions, + monthOverMonthEmissionsChangeRatio, + monthlyEmissionsChangeValue, + serializedAdditionalRawData, + itemName, + categoryType, + subscriptionId, + resourceGroup, + resourceId, + location, + resourceType); + } + + 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, AzureResourceManagerCarbonOptimizationContext.Default); + default: + throw new FormatException($"The model {nameof(ResourceCarbonEmissionItemDetail)} does not support writing '{options.Format}' format."); + } + } + + ResourceCarbonEmissionItemDetail 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 DeserializeResourceCarbonEmissionItemDetail(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ResourceCarbonEmissionItemDetail)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/ResourceCarbonEmissionItemDetail.cs b/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/ResourceCarbonEmissionItemDetail.cs new file mode 100644 index 000000000000..10d446a06b47 --- /dev/null +++ b/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/ResourceCarbonEmissionItemDetail.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.CarbonOptimization.Models +{ + /// Response for Resource detailed carbon emissions. + public partial class ResourceCarbonEmissionItemDetail : CarbonEmission + { + /// Initializes a new instance of . + /// Total carbon emissions for the specified query parameters, measured in kgCO2E. This value represents total emissions over the specified date range (e.g., March-June). + /// Total carbon emissions for the previous month’s date range, which is the same period as the specified date range but shifted left by one month (e.g., if the specified range is March - June, the previous month’s range will be Feb - May). The value is measured in kgCO2E. + /// It's resource name. + /// Resource Item category, see supported value defined in CategoryTypeEnum. + /// Subscription Id. + /// Resource Group. + /// The fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /// , , or is null. + internal ResourceCarbonEmissionItemDetail(double latestMonthEmissions, double previousMonthEmissions, string itemName, CarbonEmissionCategoryType categoryType, string subscriptionId, string resourceGroup, ResourceIdentifier resourceId) : base(latestMonthEmissions, previousMonthEmissions) + { + Argument.AssertNotNull(itemName, nameof(itemName)); + Argument.AssertNotNull(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNull(resourceGroup, nameof(resourceGroup)); + Argument.AssertNotNull(resourceId, nameof(resourceId)); + + ItemName = itemName; + CategoryType = categoryType; + SubscriptionId = subscriptionId; + ResourceGroup = resourceGroup; + ResourceId = resourceId; + DataType = CarbonEmissionDataType.ResourceItemDetailsData; + } + + /// Initializes a new instance of . + /// The data type of the query result, indicating the format of the returned response. + /// Total carbon emissions for the specified query parameters, measured in kgCO2E. This value represents total emissions over the specified date range (e.g., March-June). + /// Total carbon emissions for the previous month’s date range, which is the same period as the specified date range but shifted left by one month (e.g., if the specified range is March - June, the previous month’s range will be Feb - May). The value is measured in kgCO2E. + /// The percentage change in carbon emissions between the current and previous DateRange. This is calculated as: (latestMonthEmissions - previousMonthEmissions) / previousMonthEmissions. + /// The change in carbon emissions between the current and previous period, calculated as: latestMonthEmissions - previousMonthEmissions. + /// Keeps track of any properties unknown to the library. + /// It's resource name. + /// Resource Item category, see supported value defined in CategoryTypeEnum. + /// Subscription Id. + /// Resource Group. + /// The fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /// Resource Location (e.g., 'east us'). + /// The type of resource, for example: microsoft.storage/storageaccounts. + internal ResourceCarbonEmissionItemDetail(CarbonEmissionDataType dataType, double latestMonthEmissions, double previousMonthEmissions, double? monthOverMonthEmissionsChangeRatio, double? monthlyEmissionsChangeValue, IDictionary serializedAdditionalRawData, string itemName, CarbonEmissionCategoryType categoryType, string subscriptionId, string resourceGroup, ResourceIdentifier resourceId, AzureLocation? location, ResourceType? resourceType) : base(dataType, latestMonthEmissions, previousMonthEmissions, monthOverMonthEmissionsChangeRatio, monthlyEmissionsChangeValue, serializedAdditionalRawData) + { + ItemName = itemName; + CategoryType = categoryType; + SubscriptionId = subscriptionId; + ResourceGroup = resourceGroup; + ResourceId = resourceId; + Location = location; + ResourceType = resourceType; + DataType = dataType; + } + + /// Initializes a new instance of for deserialization. + internal ResourceCarbonEmissionItemDetail() + { + } + + /// It's resource name. + public string ItemName { get; } + /// Resource Item category, see supported value defined in CategoryTypeEnum. + public CarbonEmissionCategoryType CategoryType { get; } + /// Subscription Id. + public string SubscriptionId { get; } + /// Resource Group. + public string ResourceGroup { get; } + /// The fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + public ResourceIdentifier ResourceId { get; } + /// Resource Location (e.g., 'east us'). + public AzureLocation? Location { get; } + /// The type of resource, for example: microsoft.storage/storageaccounts. + public ResourceType? ResourceType { get; } + } +} diff --git a/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/ResourceCarbonEmissionTopItemMonthlySummary.Serialization.cs b/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/ResourceCarbonEmissionTopItemMonthlySummary.Serialization.cs new file mode 100644 index 000000000000..bac3088e36a2 --- /dev/null +++ b/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/ResourceCarbonEmissionTopItemMonthlySummary.Serialization.cs @@ -0,0 +1,202 @@ +// 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.CarbonOptimization.Models +{ + public partial class ResourceCarbonEmissionTopItemMonthlySummary : 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(ResourceCarbonEmissionTopItemMonthlySummary)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + writer.WritePropertyName("itemName"u8); + writer.WriteStringValue(ItemName); + writer.WritePropertyName("categoryType"u8); + writer.WriteStringValue(CategoryType.ToString()); + writer.WritePropertyName("date"u8); + writer.WriteStringValue(Date); + writer.WritePropertyName("subscriptionId"u8); + writer.WriteStringValue(SubscriptionId); + writer.WritePropertyName("resourceGroup"u8); + writer.WriteStringValue(ResourceGroup); + writer.WritePropertyName("resourceId"u8); + writer.WriteStringValue(ResourceId); + } + + ResourceCarbonEmissionTopItemMonthlySummary 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(ResourceCarbonEmissionTopItemMonthlySummary)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeResourceCarbonEmissionTopItemMonthlySummary(document.RootElement, options); + } + + internal static ResourceCarbonEmissionTopItemMonthlySummary DeserializeResourceCarbonEmissionTopItemMonthlySummary(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string itemName = default; + CarbonEmissionCategoryType categoryType = default; + string date = default; + string subscriptionId = default; + string resourceGroup = default; + ResourceIdentifier resourceId = default; + CarbonEmissionDataType dataType = default; + double latestMonthEmissions = default; + double previousMonthEmissions = default; + double? monthOverMonthEmissionsChangeRatio = default; + double? monthlyEmissionsChangeValue = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("itemName"u8)) + { + itemName = property.Value.GetString(); + continue; + } + if (property.NameEquals("categoryType"u8)) + { + categoryType = new CarbonEmissionCategoryType(property.Value.GetString()); + continue; + } + if (property.NameEquals("date"u8)) + { + date = property.Value.GetString(); + continue; + } + if (property.NameEquals("subscriptionId"u8)) + { + subscriptionId = property.Value.GetString(); + continue; + } + if (property.NameEquals("resourceGroup"u8)) + { + resourceGroup = property.Value.GetString(); + continue; + } + if (property.NameEquals("resourceId"u8)) + { + resourceId = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("dataType"u8)) + { + dataType = new CarbonEmissionDataType(property.Value.GetString()); + continue; + } + if (property.NameEquals("latestMonthEmissions"u8)) + { + latestMonthEmissions = property.Value.GetDouble(); + continue; + } + if (property.NameEquals("previousMonthEmissions"u8)) + { + previousMonthEmissions = property.Value.GetDouble(); + continue; + } + if (property.NameEquals("monthOverMonthEmissionsChangeRatio"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + monthOverMonthEmissionsChangeRatio = property.Value.GetDouble(); + continue; + } + if (property.NameEquals("monthlyEmissionsChangeValue"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + monthlyEmissionsChangeValue = property.Value.GetDouble(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ResourceCarbonEmissionTopItemMonthlySummary( + dataType, + latestMonthEmissions, + previousMonthEmissions, + monthOverMonthEmissionsChangeRatio, + monthlyEmissionsChangeValue, + serializedAdditionalRawData, + itemName, + categoryType, + date, + subscriptionId, + resourceGroup, + resourceId); + } + + 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, AzureResourceManagerCarbonOptimizationContext.Default); + default: + throw new FormatException($"The model {nameof(ResourceCarbonEmissionTopItemMonthlySummary)} does not support writing '{options.Format}' format."); + } + } + + ResourceCarbonEmissionTopItemMonthlySummary 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 DeserializeResourceCarbonEmissionTopItemMonthlySummary(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ResourceCarbonEmissionTopItemMonthlySummary)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/ResourceCarbonEmissionTopItemMonthlySummary.cs b/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/ResourceCarbonEmissionTopItemMonthlySummary.cs new file mode 100644 index 000000000000..38b37c18abeb --- /dev/null +++ b/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/ResourceCarbonEmissionTopItemMonthlySummary.cs @@ -0,0 +1,86 @@ +// 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.CarbonOptimization.Models +{ + /// Response for top items carbon emissions by month for resource. + public partial class ResourceCarbonEmissionTopItemMonthlySummary : CarbonEmission + { + /// Initializes a new instance of . + /// Total carbon emissions for the specified query parameters, measured in kgCO2E. This value represents total emissions over the specified date range (e.g., March-June). + /// Total carbon emissions for the previous month’s date range, which is the same period as the specified date range but shifted left by one month (e.g., if the specified range is March - June, the previous month’s range will be Feb - May). The value is measured in kgCO2E. + /// The resource name of resource for Resource Category. + /// Resource Item category. + /// Monthly date string, format is yyyy-MM-dd. + /// Subscription Id. + /// Resource Group. + /// The fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /// , , , or is null. + internal ResourceCarbonEmissionTopItemMonthlySummary(double latestMonthEmissions, double previousMonthEmissions, string itemName, CarbonEmissionCategoryType categoryType, string date, string subscriptionId, string resourceGroup, ResourceIdentifier resourceId) : base(latestMonthEmissions, previousMonthEmissions) + { + Argument.AssertNotNull(itemName, nameof(itemName)); + Argument.AssertNotNull(date, nameof(date)); + Argument.AssertNotNull(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNull(resourceGroup, nameof(resourceGroup)); + Argument.AssertNotNull(resourceId, nameof(resourceId)); + + ItemName = itemName; + CategoryType = categoryType; + Date = date; + SubscriptionId = subscriptionId; + ResourceGroup = resourceGroup; + ResourceId = resourceId; + DataType = CarbonEmissionDataType.ResourceTopItemsMonthlySummaryData; + } + + /// Initializes a new instance of . + /// The data type of the query result, indicating the format of the returned response. + /// Total carbon emissions for the specified query parameters, measured in kgCO2E. This value represents total emissions over the specified date range (e.g., March-June). + /// Total carbon emissions for the previous month’s date range, which is the same period as the specified date range but shifted left by one month (e.g., if the specified range is March - June, the previous month’s range will be Feb - May). The value is measured in kgCO2E. + /// The percentage change in carbon emissions between the current and previous DateRange. This is calculated as: (latestMonthEmissions - previousMonthEmissions) / previousMonthEmissions. + /// The change in carbon emissions between the current and previous period, calculated as: latestMonthEmissions - previousMonthEmissions. + /// Keeps track of any properties unknown to the library. + /// The resource name of resource for Resource Category. + /// Resource Item category. + /// Monthly date string, format is yyyy-MM-dd. + /// Subscription Id. + /// Resource Group. + /// The fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + internal ResourceCarbonEmissionTopItemMonthlySummary(CarbonEmissionDataType dataType, double latestMonthEmissions, double previousMonthEmissions, double? monthOverMonthEmissionsChangeRatio, double? monthlyEmissionsChangeValue, IDictionary serializedAdditionalRawData, string itemName, CarbonEmissionCategoryType categoryType, string date, string subscriptionId, string resourceGroup, ResourceIdentifier resourceId) : base(dataType, latestMonthEmissions, previousMonthEmissions, monthOverMonthEmissionsChangeRatio, monthlyEmissionsChangeValue, serializedAdditionalRawData) + { + ItemName = itemName; + CategoryType = categoryType; + Date = date; + SubscriptionId = subscriptionId; + ResourceGroup = resourceGroup; + ResourceId = resourceId; + DataType = dataType; + } + + /// Initializes a new instance of for deserialization. + internal ResourceCarbonEmissionTopItemMonthlySummary() + { + } + + /// The resource name of resource for Resource Category. + public string ItemName { get; } + /// Resource Item category. + public CarbonEmissionCategoryType CategoryType { get; } + /// Monthly date string, format is yyyy-MM-dd. + public string Date { get; } + /// Subscription Id. + public string SubscriptionId { get; } + /// Resource Group. + public string ResourceGroup { get; } + /// The fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + public ResourceIdentifier ResourceId { get; } + } +} diff --git a/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/ResourceCarbonEmissionTopItemsSummary.Serialization.cs b/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/ResourceCarbonEmissionTopItemsSummary.Serialization.cs new file mode 100644 index 000000000000..7d5683740601 --- /dev/null +++ b/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/ResourceCarbonEmissionTopItemsSummary.Serialization.cs @@ -0,0 +1,193 @@ +// 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.CarbonOptimization.Models +{ + public partial class ResourceCarbonEmissionTopItemsSummary : 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(ResourceCarbonEmissionTopItemsSummary)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + writer.WritePropertyName("itemName"u8); + writer.WriteStringValue(ItemName); + writer.WritePropertyName("categoryType"u8); + writer.WriteStringValue(CategoryType.ToString()); + writer.WritePropertyName("subscriptionId"u8); + writer.WriteStringValue(SubscriptionId); + writer.WritePropertyName("resourceGroup"u8); + writer.WriteStringValue(ResourceGroup); + writer.WritePropertyName("resourceId"u8); + writer.WriteStringValue(ResourceId); + } + + ResourceCarbonEmissionTopItemsSummary 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(ResourceCarbonEmissionTopItemsSummary)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeResourceCarbonEmissionTopItemsSummary(document.RootElement, options); + } + + internal static ResourceCarbonEmissionTopItemsSummary DeserializeResourceCarbonEmissionTopItemsSummary(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string itemName = default; + CarbonEmissionCategoryType categoryType = default; + string subscriptionId = default; + string resourceGroup = default; + ResourceIdentifier resourceId = default; + CarbonEmissionDataType dataType = default; + double latestMonthEmissions = default; + double previousMonthEmissions = default; + double? monthOverMonthEmissionsChangeRatio = default; + double? monthlyEmissionsChangeValue = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("itemName"u8)) + { + itemName = property.Value.GetString(); + continue; + } + if (property.NameEquals("categoryType"u8)) + { + categoryType = new CarbonEmissionCategoryType(property.Value.GetString()); + continue; + } + if (property.NameEquals("subscriptionId"u8)) + { + subscriptionId = property.Value.GetString(); + continue; + } + if (property.NameEquals("resourceGroup"u8)) + { + resourceGroup = property.Value.GetString(); + continue; + } + if (property.NameEquals("resourceId"u8)) + { + resourceId = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("dataType"u8)) + { + dataType = new CarbonEmissionDataType(property.Value.GetString()); + continue; + } + if (property.NameEquals("latestMonthEmissions"u8)) + { + latestMonthEmissions = property.Value.GetDouble(); + continue; + } + if (property.NameEquals("previousMonthEmissions"u8)) + { + previousMonthEmissions = property.Value.GetDouble(); + continue; + } + if (property.NameEquals("monthOverMonthEmissionsChangeRatio"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + monthOverMonthEmissionsChangeRatio = property.Value.GetDouble(); + continue; + } + if (property.NameEquals("monthlyEmissionsChangeValue"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + monthlyEmissionsChangeValue = property.Value.GetDouble(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ResourceCarbonEmissionTopItemsSummary( + dataType, + latestMonthEmissions, + previousMonthEmissions, + monthOverMonthEmissionsChangeRatio, + monthlyEmissionsChangeValue, + serializedAdditionalRawData, + itemName, + categoryType, + subscriptionId, + resourceGroup, + resourceId); + } + + 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, AzureResourceManagerCarbonOptimizationContext.Default); + default: + throw new FormatException($"The model {nameof(ResourceCarbonEmissionTopItemsSummary)} does not support writing '{options.Format}' format."); + } + } + + ResourceCarbonEmissionTopItemsSummary 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 DeserializeResourceCarbonEmissionTopItemsSummary(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ResourceCarbonEmissionTopItemsSummary)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/ResourceCarbonEmissionTopItemsSummary.cs b/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/ResourceCarbonEmissionTopItemsSummary.cs new file mode 100644 index 000000000000..c3f8e0fdad2c --- /dev/null +++ b/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/ResourceCarbonEmissionTopItemsSummary.cs @@ -0,0 +1,79 @@ +// 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.CarbonOptimization.Models +{ + /// Response for Top Items For Resource Category. + public partial class ResourceCarbonEmissionTopItemsSummary : CarbonEmission + { + /// Initializes a new instance of . + /// Total carbon emissions for the specified query parameters, measured in kgCO2E. This value represents total emissions over the specified date range (e.g., March-June). + /// Total carbon emissions for the previous month’s date range, which is the same period as the specified date range but shifted left by one month (e.g., if the specified range is March - June, the previous month’s range will be Feb - May). The value is measured in kgCO2E. + /// The resource name of the resource for the Resource Category. + /// The category type of the item. This defines which dimension the emissions are aggregated by, and the supported values are defined in CategoryTypeEnum (e.g., Subscription, ResourceGroup, Resource, etc.). + /// Subscription Id. + /// Resource group name. + /// Resource Id, The URI of the resource for the Resource Category. This identifies the resource being reported. + /// , , or is null. + internal ResourceCarbonEmissionTopItemsSummary(double latestMonthEmissions, double previousMonthEmissions, string itemName, CarbonEmissionCategoryType categoryType, string subscriptionId, string resourceGroup, ResourceIdentifier resourceId) : base(latestMonthEmissions, previousMonthEmissions) + { + Argument.AssertNotNull(itemName, nameof(itemName)); + Argument.AssertNotNull(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNull(resourceGroup, nameof(resourceGroup)); + Argument.AssertNotNull(resourceId, nameof(resourceId)); + + ItemName = itemName; + CategoryType = categoryType; + SubscriptionId = subscriptionId; + ResourceGroup = resourceGroup; + ResourceId = resourceId; + DataType = CarbonEmissionDataType.ResourceTopItemsSummaryData; + } + + /// Initializes a new instance of . + /// The data type of the query result, indicating the format of the returned response. + /// Total carbon emissions for the specified query parameters, measured in kgCO2E. This value represents total emissions over the specified date range (e.g., March-June). + /// Total carbon emissions for the previous month’s date range, which is the same period as the specified date range but shifted left by one month (e.g., if the specified range is March - June, the previous month’s range will be Feb - May). The value is measured in kgCO2E. + /// The percentage change in carbon emissions between the current and previous DateRange. This is calculated as: (latestMonthEmissions - previousMonthEmissions) / previousMonthEmissions. + /// The change in carbon emissions between the current and previous period, calculated as: latestMonthEmissions - previousMonthEmissions. + /// Keeps track of any properties unknown to the library. + /// The resource name of the resource for the Resource Category. + /// The category type of the item. This defines which dimension the emissions are aggregated by, and the supported values are defined in CategoryTypeEnum (e.g., Subscription, ResourceGroup, Resource, etc.). + /// Subscription Id. + /// Resource group name. + /// Resource Id, The URI of the resource for the Resource Category. This identifies the resource being reported. + internal ResourceCarbonEmissionTopItemsSummary(CarbonEmissionDataType dataType, double latestMonthEmissions, double previousMonthEmissions, double? monthOverMonthEmissionsChangeRatio, double? monthlyEmissionsChangeValue, IDictionary serializedAdditionalRawData, string itemName, CarbonEmissionCategoryType categoryType, string subscriptionId, string resourceGroup, ResourceIdentifier resourceId) : base(dataType, latestMonthEmissions, previousMonthEmissions, monthOverMonthEmissionsChangeRatio, monthlyEmissionsChangeValue, serializedAdditionalRawData) + { + ItemName = itemName; + CategoryType = categoryType; + SubscriptionId = subscriptionId; + ResourceGroup = resourceGroup; + ResourceId = resourceId; + DataType = dataType; + } + + /// Initializes a new instance of for deserialization. + internal ResourceCarbonEmissionTopItemsSummary() + { + } + + /// The resource name of the resource for the Resource Category. + public string ItemName { get; } + /// The category type of the item. This defines which dimension the emissions are aggregated by, and the supported values are defined in CategoryTypeEnum (e.g., Subscription, ResourceGroup, Resource, etc.). + public CarbonEmissionCategoryType CategoryType { get; } + /// Subscription Id. + public string SubscriptionId { get; } + /// Resource group name. + public string ResourceGroup { get; } + /// Resource Id, The URI of the resource for the Resource Category. This identifies the resource being reported. + public ResourceIdentifier ResourceId { get; } + } +} diff --git a/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/ResourceGroupCarbonEmissionItemDetail.Serialization.cs b/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/ResourceGroupCarbonEmissionItemDetail.Serialization.cs new file mode 100644 index 000000000000..e57edb606544 --- /dev/null +++ b/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/ResourceGroupCarbonEmissionItemDetail.Serialization.cs @@ -0,0 +1,184 @@ +// 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.CarbonOptimization.Models +{ + public partial class ResourceGroupCarbonEmissionItemDetail : 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(ResourceGroupCarbonEmissionItemDetail)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + writer.WritePropertyName("itemName"u8); + writer.WriteStringValue(ItemName); + writer.WritePropertyName("categoryType"u8); + writer.WriteStringValue(CategoryType.ToString()); + writer.WritePropertyName("subscriptionId"u8); + writer.WriteStringValue(SubscriptionId); + writer.WritePropertyName("resourceGroupUrl"u8); + writer.WriteStringValue(ResourceGroupId); + } + + ResourceGroupCarbonEmissionItemDetail 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(ResourceGroupCarbonEmissionItemDetail)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeResourceGroupCarbonEmissionItemDetail(document.RootElement, options); + } + + internal static ResourceGroupCarbonEmissionItemDetail DeserializeResourceGroupCarbonEmissionItemDetail(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string itemName = default; + CarbonEmissionCategoryType categoryType = default; + string subscriptionId = default; + ResourceIdentifier resourceGroupUrl = default; + CarbonEmissionDataType dataType = default; + double latestMonthEmissions = default; + double previousMonthEmissions = default; + double? monthOverMonthEmissionsChangeRatio = default; + double? monthlyEmissionsChangeValue = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("itemName"u8)) + { + itemName = property.Value.GetString(); + continue; + } + if (property.NameEquals("categoryType"u8)) + { + categoryType = new CarbonEmissionCategoryType(property.Value.GetString()); + continue; + } + if (property.NameEquals("subscriptionId"u8)) + { + subscriptionId = property.Value.GetString(); + continue; + } + if (property.NameEquals("resourceGroupUrl"u8)) + { + resourceGroupUrl = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("dataType"u8)) + { + dataType = new CarbonEmissionDataType(property.Value.GetString()); + continue; + } + if (property.NameEquals("latestMonthEmissions"u8)) + { + latestMonthEmissions = property.Value.GetDouble(); + continue; + } + if (property.NameEquals("previousMonthEmissions"u8)) + { + previousMonthEmissions = property.Value.GetDouble(); + continue; + } + if (property.NameEquals("monthOverMonthEmissionsChangeRatio"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + monthOverMonthEmissionsChangeRatio = property.Value.GetDouble(); + continue; + } + if (property.NameEquals("monthlyEmissionsChangeValue"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + monthlyEmissionsChangeValue = property.Value.GetDouble(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ResourceGroupCarbonEmissionItemDetail( + dataType, + latestMonthEmissions, + previousMonthEmissions, + monthOverMonthEmissionsChangeRatio, + monthlyEmissionsChangeValue, + serializedAdditionalRawData, + itemName, + categoryType, + subscriptionId, + resourceGroupUrl); + } + + 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, AzureResourceManagerCarbonOptimizationContext.Default); + default: + throw new FormatException($"The model {nameof(ResourceGroupCarbonEmissionItemDetail)} does not support writing '{options.Format}' format."); + } + } + + ResourceGroupCarbonEmissionItemDetail 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 DeserializeResourceGroupCarbonEmissionItemDetail(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ResourceGroupCarbonEmissionItemDetail)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/ResourceGroupCarbonEmissionItemDetail.cs b/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/ResourceGroupCarbonEmissionItemDetail.cs new file mode 100644 index 000000000000..111d44bb3cf2 --- /dev/null +++ b/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/ResourceGroupCarbonEmissionItemDetail.cs @@ -0,0 +1,72 @@ +// 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.CarbonOptimization.Models +{ + /// Response for Resource Group detailed carbon emissions. + public partial class ResourceGroupCarbonEmissionItemDetail : CarbonEmission + { + /// Initializes a new instance of . + /// Total carbon emissions for the specified query parameters, measured in kgCO2E. This value represents total emissions over the specified date range (e.g., March-June). + /// Total carbon emissions for the previous month’s date range, which is the same period as the specified date range but shifted left by one month (e.g., if the specified range is March - June, the previous month’s range will be Feb - May). The value is measured in kgCO2E. + /// It's resource group name. + /// ResourceGroup Item category. + /// Subscription Id. + /// Resource Group url, value format is '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroup}'. + /// , or is null. + internal ResourceGroupCarbonEmissionItemDetail(double latestMonthEmissions, double previousMonthEmissions, string itemName, CarbonEmissionCategoryType categoryType, string subscriptionId, ResourceIdentifier resourceGroupId) : base(latestMonthEmissions, previousMonthEmissions) + { + Argument.AssertNotNull(itemName, nameof(itemName)); + Argument.AssertNotNull(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNull(resourceGroupId, nameof(resourceGroupId)); + + ItemName = itemName; + CategoryType = categoryType; + SubscriptionId = subscriptionId; + ResourceGroupId = resourceGroupId; + DataType = CarbonEmissionDataType.ResourceGroupItemDetailsData; + } + + /// Initializes a new instance of . + /// The data type of the query result, indicating the format of the returned response. + /// Total carbon emissions for the specified query parameters, measured in kgCO2E. This value represents total emissions over the specified date range (e.g., March-June). + /// Total carbon emissions for the previous month’s date range, which is the same period as the specified date range but shifted left by one month (e.g., if the specified range is March - June, the previous month’s range will be Feb - May). The value is measured in kgCO2E. + /// The percentage change in carbon emissions between the current and previous DateRange. This is calculated as: (latestMonthEmissions - previousMonthEmissions) / previousMonthEmissions. + /// The change in carbon emissions between the current and previous period, calculated as: latestMonthEmissions - previousMonthEmissions. + /// Keeps track of any properties unknown to the library. + /// It's resource group name. + /// ResourceGroup Item category. + /// Subscription Id. + /// Resource Group url, value format is '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroup}'. + internal ResourceGroupCarbonEmissionItemDetail(CarbonEmissionDataType dataType, double latestMonthEmissions, double previousMonthEmissions, double? monthOverMonthEmissionsChangeRatio, double? monthlyEmissionsChangeValue, IDictionary serializedAdditionalRawData, string itemName, CarbonEmissionCategoryType categoryType, string subscriptionId, ResourceIdentifier resourceGroupId) : base(dataType, latestMonthEmissions, previousMonthEmissions, monthOverMonthEmissionsChangeRatio, monthlyEmissionsChangeValue, serializedAdditionalRawData) + { + ItemName = itemName; + CategoryType = categoryType; + SubscriptionId = subscriptionId; + ResourceGroupId = resourceGroupId; + DataType = dataType; + } + + /// Initializes a new instance of for deserialization. + internal ResourceGroupCarbonEmissionItemDetail() + { + } + + /// It's resource group name. + public string ItemName { get; } + /// ResourceGroup Item category. + public CarbonEmissionCategoryType CategoryType { get; } + /// Subscription Id. + public string SubscriptionId { get; } + /// Resource Group url, value format is '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroup}'. + public ResourceIdentifier ResourceGroupId { get; } + } +} diff --git a/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/ResourceGroupCarbonEmissionTopItemMonthlySummary.Serialization.cs b/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/ResourceGroupCarbonEmissionTopItemMonthlySummary.Serialization.cs new file mode 100644 index 000000000000..4ff555e2f13b --- /dev/null +++ b/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/ResourceGroupCarbonEmissionTopItemMonthlySummary.Serialization.cs @@ -0,0 +1,193 @@ +// 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.CarbonOptimization.Models +{ + public partial class ResourceGroupCarbonEmissionTopItemMonthlySummary : 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(ResourceGroupCarbonEmissionTopItemMonthlySummary)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + writer.WritePropertyName("itemName"u8); + writer.WriteStringValue(ItemName); + writer.WritePropertyName("categoryType"u8); + writer.WriteStringValue(CategoryType.ToString()); + writer.WritePropertyName("date"u8); + writer.WriteStringValue(Date); + writer.WritePropertyName("subscriptionId"u8); + writer.WriteStringValue(SubscriptionId); + writer.WritePropertyName("resourceGroupUrl"u8); + writer.WriteStringValue(ResourceGroupId); + } + + ResourceGroupCarbonEmissionTopItemMonthlySummary 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(ResourceGroupCarbonEmissionTopItemMonthlySummary)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeResourceGroupCarbonEmissionTopItemMonthlySummary(document.RootElement, options); + } + + internal static ResourceGroupCarbonEmissionTopItemMonthlySummary DeserializeResourceGroupCarbonEmissionTopItemMonthlySummary(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string itemName = default; + CarbonEmissionCategoryType categoryType = default; + string date = default; + string subscriptionId = default; + ResourceIdentifier resourceGroupUrl = default; + CarbonEmissionDataType dataType = default; + double latestMonthEmissions = default; + double previousMonthEmissions = default; + double? monthOverMonthEmissionsChangeRatio = default; + double? monthlyEmissionsChangeValue = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("itemName"u8)) + { + itemName = property.Value.GetString(); + continue; + } + if (property.NameEquals("categoryType"u8)) + { + categoryType = new CarbonEmissionCategoryType(property.Value.GetString()); + continue; + } + if (property.NameEquals("date"u8)) + { + date = property.Value.GetString(); + continue; + } + if (property.NameEquals("subscriptionId"u8)) + { + subscriptionId = property.Value.GetString(); + continue; + } + if (property.NameEquals("resourceGroupUrl"u8)) + { + resourceGroupUrl = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("dataType"u8)) + { + dataType = new CarbonEmissionDataType(property.Value.GetString()); + continue; + } + if (property.NameEquals("latestMonthEmissions"u8)) + { + latestMonthEmissions = property.Value.GetDouble(); + continue; + } + if (property.NameEquals("previousMonthEmissions"u8)) + { + previousMonthEmissions = property.Value.GetDouble(); + continue; + } + if (property.NameEquals("monthOverMonthEmissionsChangeRatio"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + monthOverMonthEmissionsChangeRatio = property.Value.GetDouble(); + continue; + } + if (property.NameEquals("monthlyEmissionsChangeValue"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + monthlyEmissionsChangeValue = property.Value.GetDouble(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ResourceGroupCarbonEmissionTopItemMonthlySummary( + dataType, + latestMonthEmissions, + previousMonthEmissions, + monthOverMonthEmissionsChangeRatio, + monthlyEmissionsChangeValue, + serializedAdditionalRawData, + itemName, + categoryType, + date, + subscriptionId, + resourceGroupUrl); + } + + 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, AzureResourceManagerCarbonOptimizationContext.Default); + default: + throw new FormatException($"The model {nameof(ResourceGroupCarbonEmissionTopItemMonthlySummary)} does not support writing '{options.Format}' format."); + } + } + + ResourceGroupCarbonEmissionTopItemMonthlySummary 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 DeserializeResourceGroupCarbonEmissionTopItemMonthlySummary(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ResourceGroupCarbonEmissionTopItemMonthlySummary)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/ResourceGroupCarbonEmissionTopItemMonthlySummary.cs b/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/ResourceGroupCarbonEmissionTopItemMonthlySummary.cs new file mode 100644 index 000000000000..392fba21a89f --- /dev/null +++ b/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/ResourceGroupCarbonEmissionTopItemMonthlySummary.cs @@ -0,0 +1,79 @@ +// 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.CarbonOptimization.Models +{ + /// Response for top items carbon emissions by month for resource group. + public partial class ResourceGroupCarbonEmissionTopItemMonthlySummary : CarbonEmission + { + /// Initializes a new instance of . + /// Total carbon emissions for the specified query parameters, measured in kgCO2E. This value represents total emissions over the specified date range (e.g., March-June). + /// Total carbon emissions for the previous month’s date range, which is the same period as the specified date range but shifted left by one month (e.g., if the specified range is March - June, the previous month’s range will be Feb - May). The value is measured in kgCO2E. + /// It's resource group name for ResourceGroup category. + /// ResourceGroup Item category. + /// Monthly date string, format is yyyy-MM-dd. + /// Subscription Id. + /// Resource Group url, the format is '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroup}'. + /// , , or is null. + internal ResourceGroupCarbonEmissionTopItemMonthlySummary(double latestMonthEmissions, double previousMonthEmissions, string itemName, CarbonEmissionCategoryType categoryType, string date, string subscriptionId, ResourceIdentifier resourceGroupId) : base(latestMonthEmissions, previousMonthEmissions) + { + Argument.AssertNotNull(itemName, nameof(itemName)); + Argument.AssertNotNull(date, nameof(date)); + Argument.AssertNotNull(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNull(resourceGroupId, nameof(resourceGroupId)); + + ItemName = itemName; + CategoryType = categoryType; + Date = date; + SubscriptionId = subscriptionId; + ResourceGroupId = resourceGroupId; + DataType = CarbonEmissionDataType.ResourceGroupTopItemsMonthlySummaryData; + } + + /// Initializes a new instance of . + /// The data type of the query result, indicating the format of the returned response. + /// Total carbon emissions for the specified query parameters, measured in kgCO2E. This value represents total emissions over the specified date range (e.g., March-June). + /// Total carbon emissions for the previous month’s date range, which is the same period as the specified date range but shifted left by one month (e.g., if the specified range is March - June, the previous month’s range will be Feb - May). The value is measured in kgCO2E. + /// The percentage change in carbon emissions between the current and previous DateRange. This is calculated as: (latestMonthEmissions - previousMonthEmissions) / previousMonthEmissions. + /// The change in carbon emissions between the current and previous period, calculated as: latestMonthEmissions - previousMonthEmissions. + /// Keeps track of any properties unknown to the library. + /// It's resource group name for ResourceGroup category. + /// ResourceGroup Item category. + /// Monthly date string, format is yyyy-MM-dd. + /// Subscription Id. + /// Resource Group url, the format is '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroup}'. + internal ResourceGroupCarbonEmissionTopItemMonthlySummary(CarbonEmissionDataType dataType, double latestMonthEmissions, double previousMonthEmissions, double? monthOverMonthEmissionsChangeRatio, double? monthlyEmissionsChangeValue, IDictionary serializedAdditionalRawData, string itemName, CarbonEmissionCategoryType categoryType, string date, string subscriptionId, ResourceIdentifier resourceGroupId) : base(dataType, latestMonthEmissions, previousMonthEmissions, monthOverMonthEmissionsChangeRatio, monthlyEmissionsChangeValue, serializedAdditionalRawData) + { + ItemName = itemName; + CategoryType = categoryType; + Date = date; + SubscriptionId = subscriptionId; + ResourceGroupId = resourceGroupId; + DataType = dataType; + } + + /// Initializes a new instance of for deserialization. + internal ResourceGroupCarbonEmissionTopItemMonthlySummary() + { + } + + /// It's resource group name for ResourceGroup category. + public string ItemName { get; } + /// ResourceGroup Item category. + public CarbonEmissionCategoryType CategoryType { get; } + /// Monthly date string, format is yyyy-MM-dd. + public string Date { get; } + /// Subscription Id. + public string SubscriptionId { get; } + /// Resource Group url, the format is '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroup}'. + public ResourceIdentifier ResourceGroupId { get; } + } +} diff --git a/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/ResourceGroupCarbonEmissionTopItemsSummary.Serialization.cs b/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/ResourceGroupCarbonEmissionTopItemsSummary.Serialization.cs new file mode 100644 index 000000000000..88a0f36fff5c --- /dev/null +++ b/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/ResourceGroupCarbonEmissionTopItemsSummary.Serialization.cs @@ -0,0 +1,184 @@ +// 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.CarbonOptimization.Models +{ + public partial class ResourceGroupCarbonEmissionTopItemsSummary : 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(ResourceGroupCarbonEmissionTopItemsSummary)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + writer.WritePropertyName("itemName"u8); + writer.WriteStringValue(ItemName); + writer.WritePropertyName("categoryType"u8); + writer.WriteStringValue(CategoryType.ToString()); + writer.WritePropertyName("subscriptionId"u8); + writer.WriteStringValue(SubscriptionId); + writer.WritePropertyName("resourceGroupUrl"u8); + writer.WriteStringValue(ResourceGroupId); + } + + ResourceGroupCarbonEmissionTopItemsSummary 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(ResourceGroupCarbonEmissionTopItemsSummary)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeResourceGroupCarbonEmissionTopItemsSummary(document.RootElement, options); + } + + internal static ResourceGroupCarbonEmissionTopItemsSummary DeserializeResourceGroupCarbonEmissionTopItemsSummary(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string itemName = default; + CarbonEmissionCategoryType categoryType = default; + string subscriptionId = default; + ResourceIdentifier resourceGroupUrl = default; + CarbonEmissionDataType dataType = default; + double latestMonthEmissions = default; + double previousMonthEmissions = default; + double? monthOverMonthEmissionsChangeRatio = default; + double? monthlyEmissionsChangeValue = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("itemName"u8)) + { + itemName = property.Value.GetString(); + continue; + } + if (property.NameEquals("categoryType"u8)) + { + categoryType = new CarbonEmissionCategoryType(property.Value.GetString()); + continue; + } + if (property.NameEquals("subscriptionId"u8)) + { + subscriptionId = property.Value.GetString(); + continue; + } + if (property.NameEquals("resourceGroupUrl"u8)) + { + resourceGroupUrl = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("dataType"u8)) + { + dataType = new CarbonEmissionDataType(property.Value.GetString()); + continue; + } + if (property.NameEquals("latestMonthEmissions"u8)) + { + latestMonthEmissions = property.Value.GetDouble(); + continue; + } + if (property.NameEquals("previousMonthEmissions"u8)) + { + previousMonthEmissions = property.Value.GetDouble(); + continue; + } + if (property.NameEquals("monthOverMonthEmissionsChangeRatio"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + monthOverMonthEmissionsChangeRatio = property.Value.GetDouble(); + continue; + } + if (property.NameEquals("monthlyEmissionsChangeValue"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + monthlyEmissionsChangeValue = property.Value.GetDouble(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ResourceGroupCarbonEmissionTopItemsSummary( + dataType, + latestMonthEmissions, + previousMonthEmissions, + monthOverMonthEmissionsChangeRatio, + monthlyEmissionsChangeValue, + serializedAdditionalRawData, + itemName, + categoryType, + subscriptionId, + resourceGroupUrl); + } + + 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, AzureResourceManagerCarbonOptimizationContext.Default); + default: + throw new FormatException($"The model {nameof(ResourceGroupCarbonEmissionTopItemsSummary)} does not support writing '{options.Format}' format."); + } + } + + ResourceGroupCarbonEmissionTopItemsSummary 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 DeserializeResourceGroupCarbonEmissionTopItemsSummary(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ResourceGroupCarbonEmissionTopItemsSummary)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/ResourceGroupCarbonEmissionTopItemsSummary.cs b/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/ResourceGroupCarbonEmissionTopItemsSummary.cs new file mode 100644 index 000000000000..3871535cb1bf --- /dev/null +++ b/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/ResourceGroupCarbonEmissionTopItemsSummary.cs @@ -0,0 +1,72 @@ +// 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.CarbonOptimization.Models +{ + /// Response for Top Items For ResourceGroup. + public partial class ResourceGroupCarbonEmissionTopItemsSummary : CarbonEmission + { + /// Initializes a new instance of . + /// Total carbon emissions for the specified query parameters, measured in kgCO2E. This value represents total emissions over the specified date range (e.g., March-June). + /// Total carbon emissions for the previous month’s date range, which is the same period as the specified date range but shifted left by one month (e.g., if the specified range is March - June, the previous month’s range will be Feb - May). The value is measured in kgCO2E. + /// The resourceGroup name of the resource for ResourceGroup Category. + /// ResourceGroup Item category. + /// Subscription Id. + /// Resource Group url, value format is '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroup}'. + /// , or is null. + internal ResourceGroupCarbonEmissionTopItemsSummary(double latestMonthEmissions, double previousMonthEmissions, string itemName, CarbonEmissionCategoryType categoryType, string subscriptionId, ResourceIdentifier resourceGroupId) : base(latestMonthEmissions, previousMonthEmissions) + { + Argument.AssertNotNull(itemName, nameof(itemName)); + Argument.AssertNotNull(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNull(resourceGroupId, nameof(resourceGroupId)); + + ItemName = itemName; + CategoryType = categoryType; + SubscriptionId = subscriptionId; + ResourceGroupId = resourceGroupId; + DataType = CarbonEmissionDataType.ResourceGroupTopItemsSummaryData; + } + + /// Initializes a new instance of . + /// The data type of the query result, indicating the format of the returned response. + /// Total carbon emissions for the specified query parameters, measured in kgCO2E. This value represents total emissions over the specified date range (e.g., March-June). + /// Total carbon emissions for the previous month’s date range, which is the same period as the specified date range but shifted left by one month (e.g., if the specified range is March - June, the previous month’s range will be Feb - May). The value is measured in kgCO2E. + /// The percentage change in carbon emissions between the current and previous DateRange. This is calculated as: (latestMonthEmissions - previousMonthEmissions) / previousMonthEmissions. + /// The change in carbon emissions between the current and previous period, calculated as: latestMonthEmissions - previousMonthEmissions. + /// Keeps track of any properties unknown to the library. + /// The resourceGroup name of the resource for ResourceGroup Category. + /// ResourceGroup Item category. + /// Subscription Id. + /// Resource Group url, value format is '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroup}'. + internal ResourceGroupCarbonEmissionTopItemsSummary(CarbonEmissionDataType dataType, double latestMonthEmissions, double previousMonthEmissions, double? monthOverMonthEmissionsChangeRatio, double? monthlyEmissionsChangeValue, IDictionary serializedAdditionalRawData, string itemName, CarbonEmissionCategoryType categoryType, string subscriptionId, ResourceIdentifier resourceGroupId) : base(dataType, latestMonthEmissions, previousMonthEmissions, monthOverMonthEmissionsChangeRatio, monthlyEmissionsChangeValue, serializedAdditionalRawData) + { + ItemName = itemName; + CategoryType = categoryType; + SubscriptionId = subscriptionId; + ResourceGroupId = resourceGroupId; + DataType = dataType; + } + + /// Initializes a new instance of for deserialization. + internal ResourceGroupCarbonEmissionTopItemsSummary() + { + } + + /// The resourceGroup name of the resource for ResourceGroup Category. + public string ItemName { get; } + /// ResourceGroup Item category. + public CarbonEmissionCategoryType CategoryType { get; } + /// Subscription Id. + public string SubscriptionId { get; } + /// Resource Group url, value format is '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroup}'. + public ResourceIdentifier ResourceGroupId { get; } + } +} diff --git a/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/SubscriptionAccessDecision.Serialization.cs b/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/SubscriptionAccessDecision.Serialization.cs new file mode 100644 index 000000000000..464c26fb1139 --- /dev/null +++ b/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/SubscriptionAccessDecision.Serialization.cs @@ -0,0 +1,145 @@ +// 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.CarbonOptimization.Models +{ + internal partial class SubscriptionAccessDecision : 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(SubscriptionAccessDecision)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("subscriptionId"u8); + writer.WriteStringValue(SubscriptionId); + writer.WritePropertyName("decision"u8); + writer.WriteStringValue(Decision.ToString()); + if (Optional.IsDefined(DenialReason)) + { + writer.WritePropertyName("denialReason"u8); + writer.WriteStringValue(DenialReason); + } + 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 + } + } + } + + SubscriptionAccessDecision 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(SubscriptionAccessDecision)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeSubscriptionAccessDecision(document.RootElement, options); + } + + internal static SubscriptionAccessDecision DeserializeSubscriptionAccessDecision(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string subscriptionId = default; + CarbonEmissionAccessDecision decision = default; + string denialReason = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("subscriptionId"u8)) + { + subscriptionId = property.Value.GetString(); + continue; + } + if (property.NameEquals("decision"u8)) + { + decision = new CarbonEmissionAccessDecision(property.Value.GetString()); + continue; + } + if (property.NameEquals("denialReason"u8)) + { + denialReason = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new SubscriptionAccessDecision(subscriptionId, decision, denialReason, 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, AzureResourceManagerCarbonOptimizationContext.Default); + default: + throw new FormatException($"The model {nameof(SubscriptionAccessDecision)} does not support writing '{options.Format}' format."); + } + } + + SubscriptionAccessDecision 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 DeserializeSubscriptionAccessDecision(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(SubscriptionAccessDecision)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/SubscriptionAccessDecision.cs b/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/SubscriptionAccessDecision.cs new file mode 100644 index 000000000000..0ab77128ae96 --- /dev/null +++ b/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/SubscriptionAccessDecision.cs @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.CarbonOptimization.Models +{ + /// Access Decision for each Subscription. + internal partial class SubscriptionAccessDecision + { + /// + /// 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 . + /// Id of Subscription. + /// Access decision to subscription. + /// is null. + internal SubscriptionAccessDecision(string subscriptionId, CarbonEmissionAccessDecision decision) + { + Argument.AssertNotNull(subscriptionId, nameof(subscriptionId)); + + SubscriptionId = subscriptionId; + Decision = decision; + } + + /// Initializes a new instance of . + /// Id of Subscription. + /// Access decision to subscription. + /// The reason why access request got denied. + /// Keeps track of any properties unknown to the library. + internal SubscriptionAccessDecision(string subscriptionId, CarbonEmissionAccessDecision decision, string denialReason, IDictionary serializedAdditionalRawData) + { + SubscriptionId = subscriptionId; + Decision = decision; + DenialReason = denialReason; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal SubscriptionAccessDecision() + { + } + + /// Id of Subscription. + public string SubscriptionId { get; } + /// Access decision to subscription. + public CarbonEmissionAccessDecision Decision { get; } + /// The reason why access request got denied. + public string DenialReason { get; } + } +} diff --git a/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/TopItemsMonthlySummaryReportQueryFilter.Serialization.cs b/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/TopItemsMonthlySummaryReportQueryFilter.Serialization.cs new file mode 100644 index 000000000000..ddd92d67de2f --- /dev/null +++ b/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/TopItemsMonthlySummaryReportQueryFilter.Serialization.cs @@ -0,0 +1,209 @@ +// 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.CarbonOptimization.Models +{ + public partial class TopItemsMonthlySummaryReportQueryFilter : 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(TopItemsMonthlySummaryReportQueryFilter)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + writer.WritePropertyName("categoryType"u8); + writer.WriteStringValue(CategoryType.ToString()); + writer.WritePropertyName("topItems"u8); + writer.WriteNumberValue(TopItems); + } + + TopItemsMonthlySummaryReportQueryFilter 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(TopItemsMonthlySummaryReportQueryFilter)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeTopItemsMonthlySummaryReportQueryFilter(document.RootElement, options); + } + + internal static TopItemsMonthlySummaryReportQueryFilter DeserializeTopItemsMonthlySummaryReportQueryFilter(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + CarbonEmissionCategoryType categoryType = default; + int topItems = default; + CarbonEmissionQueryReportType reportType = default; + CarbonEmissionQueryDateRange dateRange = default; + IList subscriptionList = default; + IList resourceGroupUrlList = default; + IList resourceTypeList = default; + IList locationList = default; + IList carbonScopeList = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("categoryType"u8)) + { + categoryType = new CarbonEmissionCategoryType(property.Value.GetString()); + continue; + } + if (property.NameEquals("topItems"u8)) + { + topItems = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("reportType"u8)) + { + reportType = new CarbonEmissionQueryReportType(property.Value.GetString()); + continue; + } + if (property.NameEquals("dateRange"u8)) + { + dateRange = CarbonEmissionQueryDateRange.DeserializeCarbonEmissionQueryDateRange(property.Value, options); + continue; + } + if (property.NameEquals("subscriptionList"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + subscriptionList = array; + continue; + } + if (property.NameEquals("resourceGroupUrlList"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + resourceGroupUrlList = array; + continue; + } + if (property.NameEquals("resourceTypeList"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(new ResourceType(item.GetString())); + } + resourceTypeList = array; + continue; + } + if (property.NameEquals("locationList"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(new AzureLocation(item.GetString())); + } + locationList = array; + continue; + } + if (property.NameEquals("carbonScopeList"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(new CarbonEmissionScope(item.GetString())); + } + carbonScopeList = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new TopItemsMonthlySummaryReportQueryFilter( + reportType, + dateRange, + subscriptionList, + resourceGroupUrlList ?? new ChangeTrackingList(), + resourceTypeList ?? new ChangeTrackingList(), + locationList ?? new ChangeTrackingList(), + carbonScopeList, + serializedAdditionalRawData, + categoryType, + topItems); + } + + 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, AzureResourceManagerCarbonOptimizationContext.Default); + default: + throw new FormatException($"The model {nameof(TopItemsMonthlySummaryReportQueryFilter)} does not support writing '{options.Format}' format."); + } + } + + TopItemsMonthlySummaryReportQueryFilter 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 DeserializeTopItemsMonthlySummaryReportQueryFilter(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(TopItemsMonthlySummaryReportQueryFilter)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/TopItemsMonthlySummaryReportQueryFilter.cs b/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/TopItemsMonthlySummaryReportQueryFilter.cs new file mode 100644 index 000000000000..deaa4be9cc38 --- /dev/null +++ b/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/TopItemsMonthlySummaryReportQueryFilter.cs @@ -0,0 +1,63 @@ +// 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.CarbonOptimization.Models +{ + /// Query filter parameter to configure TopItemsMonthlySummaryReport queries. + public partial class TopItemsMonthlySummaryReportQueryFilter : CarbonEmissionQueryFilter + { + /// Initializes a new instance of . + /// The start and end dates for carbon emissions data. Required. For ItemDetailsReport and TopItemsSummaryReport, only one month of data is supported at a time, so start and end dates should be equal within DateRange (e.g., start: 2024-06-01 and end: 2024-06-01). + /// List of subscription IDs for which carbon emissions data is requested. Required. Each subscription ID should be in lowercase format. The max length of list is 100. + /// List of carbon emission scopes. Required. Accepts one or more values from EmissionScopeEnum (e.g., Scope1, Scope2, Scope3) in list form. The output will include the total emissions for the specified scopes. + /// Specifies the category type to retrieve top-emitting items, aggregated by month. See supported types in CategoryTypeEnum. + /// The number of top items to return, based on emissions. Must be between 1 and 10. + /// , or is null. + public TopItemsMonthlySummaryReportQueryFilter(CarbonEmissionQueryDateRange dateRange, IEnumerable subscriptionList, IEnumerable carbonScopeList, CarbonEmissionCategoryType categoryType, int topItems) : base(dateRange, subscriptionList, carbonScopeList) + { + Argument.AssertNotNull(dateRange, nameof(dateRange)); + Argument.AssertNotNull(subscriptionList, nameof(subscriptionList)); + Argument.AssertNotNull(carbonScopeList, nameof(carbonScopeList)); + + CategoryType = categoryType; + TopItems = topItems; + ReportType = CarbonEmissionQueryReportType.TopItemsMonthlySummaryReport; + } + + /// Initializes a new instance of . + /// The ReportType requested for carbon emissions data. Required. Specifies how data is aggregated and displayed in the output, as explained in the ReportTypeEnum. + /// The start and end dates for carbon emissions data. Required. For ItemDetailsReport and TopItemsSummaryReport, only one month of data is supported at a time, so start and end dates should be equal within DateRange (e.g., start: 2024-06-01 and end: 2024-06-01). + /// List of subscription IDs for which carbon emissions data is requested. Required. Each subscription ID should be in lowercase format. The max length of list is 100. + /// List of resource group URLs for carbon emissions data. Optional. Each URL must follow the format '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroup}', and should be in all lowercase. + /// List of resource types for carbon emissions data. Optional. Each resource type should be specified in lowercase, following the format 'microsoft.{service}/{resourceType}', e.g., 'microsoft.storage/storageaccounts'. + /// List of locations(Azure Region Display Name) for carbon emissions data, with each location specified in lowercase (e.g., 'east us'). Optional. You can use the command 'az account list-locations -o table' to find Azure Region Display Names. + /// List of carbon emission scopes. Required. Accepts one or more values from EmissionScopeEnum (e.g., Scope1, Scope2, Scope3) in list form. The output will include the total emissions for the specified scopes. + /// Keeps track of any properties unknown to the library. + /// Specifies the category type to retrieve top-emitting items, aggregated by month. See supported types in CategoryTypeEnum. + /// The number of top items to return, based on emissions. Must be between 1 and 10. + internal TopItemsMonthlySummaryReportQueryFilter(CarbonEmissionQueryReportType reportType, CarbonEmissionQueryDateRange dateRange, IList subscriptionList, IList resourceGroupUrlList, IList resourceTypeList, IList locationList, IList carbonScopeList, IDictionary serializedAdditionalRawData, CarbonEmissionCategoryType categoryType, int topItems) : base(reportType, dateRange, subscriptionList, resourceGroupUrlList, resourceTypeList, locationList, carbonScopeList, serializedAdditionalRawData) + { + CategoryType = categoryType; + TopItems = topItems; + ReportType = reportType; + } + + /// Initializes a new instance of for deserialization. + internal TopItemsMonthlySummaryReportQueryFilter() + { + } + + /// Specifies the category type to retrieve top-emitting items, aggregated by month. See supported types in CategoryTypeEnum. + public CarbonEmissionCategoryType CategoryType { get; } + /// The number of top items to return, based on emissions. Must be between 1 and 10. + public int TopItems { get; } + } +} diff --git a/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/TopItemsSummaryReportQueryFilter.Serialization.cs b/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/TopItemsSummaryReportQueryFilter.Serialization.cs new file mode 100644 index 000000000000..10d51c04430c --- /dev/null +++ b/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/TopItemsSummaryReportQueryFilter.Serialization.cs @@ -0,0 +1,209 @@ +// 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.CarbonOptimization.Models +{ + public partial class TopItemsSummaryReportQueryFilter : 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(TopItemsSummaryReportQueryFilter)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + writer.WritePropertyName("categoryType"u8); + writer.WriteStringValue(CategoryType.ToString()); + writer.WritePropertyName("topItems"u8); + writer.WriteNumberValue(TopItems); + } + + TopItemsSummaryReportQueryFilter 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(TopItemsSummaryReportQueryFilter)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeTopItemsSummaryReportQueryFilter(document.RootElement, options); + } + + internal static TopItemsSummaryReportQueryFilter DeserializeTopItemsSummaryReportQueryFilter(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + CarbonEmissionCategoryType categoryType = default; + int topItems = default; + CarbonEmissionQueryReportType reportType = default; + CarbonEmissionQueryDateRange dateRange = default; + IList subscriptionList = default; + IList resourceGroupUrlList = default; + IList resourceTypeList = default; + IList locationList = default; + IList carbonScopeList = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("categoryType"u8)) + { + categoryType = new CarbonEmissionCategoryType(property.Value.GetString()); + continue; + } + if (property.NameEquals("topItems"u8)) + { + topItems = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("reportType"u8)) + { + reportType = new CarbonEmissionQueryReportType(property.Value.GetString()); + continue; + } + if (property.NameEquals("dateRange"u8)) + { + dateRange = CarbonEmissionQueryDateRange.DeserializeCarbonEmissionQueryDateRange(property.Value, options); + continue; + } + if (property.NameEquals("subscriptionList"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + subscriptionList = array; + continue; + } + if (property.NameEquals("resourceGroupUrlList"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + resourceGroupUrlList = array; + continue; + } + if (property.NameEquals("resourceTypeList"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(new ResourceType(item.GetString())); + } + resourceTypeList = array; + continue; + } + if (property.NameEquals("locationList"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(new AzureLocation(item.GetString())); + } + locationList = array; + continue; + } + if (property.NameEquals("carbonScopeList"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(new CarbonEmissionScope(item.GetString())); + } + carbonScopeList = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new TopItemsSummaryReportQueryFilter( + reportType, + dateRange, + subscriptionList, + resourceGroupUrlList ?? new ChangeTrackingList(), + resourceTypeList ?? new ChangeTrackingList(), + locationList ?? new ChangeTrackingList(), + carbonScopeList, + serializedAdditionalRawData, + categoryType, + topItems); + } + + 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, AzureResourceManagerCarbonOptimizationContext.Default); + default: + throw new FormatException($"The model {nameof(TopItemsSummaryReportQueryFilter)} does not support writing '{options.Format}' format."); + } + } + + TopItemsSummaryReportQueryFilter 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 DeserializeTopItemsSummaryReportQueryFilter(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(TopItemsSummaryReportQueryFilter)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/TopItemsSummaryReportQueryFilter.cs b/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/TopItemsSummaryReportQueryFilter.cs new file mode 100644 index 000000000000..2233a356afac --- /dev/null +++ b/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/TopItemsSummaryReportQueryFilter.cs @@ -0,0 +1,63 @@ +// 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.CarbonOptimization.Models +{ + /// Query filter parameter to configure TopItemsSummaryReport queries. + public partial class TopItemsSummaryReportQueryFilter : CarbonEmissionQueryFilter + { + /// Initializes a new instance of . + /// The start and end dates for carbon emissions data. Required. For ItemDetailsReport and TopItemsSummaryReport, only one month of data is supported at a time, so start and end dates should be equal within DateRange (e.g., start: 2024-06-01 and end: 2024-06-01). + /// List of subscription IDs for which carbon emissions data is requested. Required. Each subscription ID should be in lowercase format. The max length of list is 100. + /// List of carbon emission scopes. Required. Accepts one or more values from EmissionScopeEnum (e.g., Scope1, Scope2, Scope3) in list form. The output will include the total emissions for the specified scopes. + /// Specifies the category type for which to retrieve top-emitting items. See supported values defined in CategoryTypeEnum. + /// The number of top items to return, based on emissions. This value must be between 1 and 10. + /// , or is null. + public TopItemsSummaryReportQueryFilter(CarbonEmissionQueryDateRange dateRange, IEnumerable subscriptionList, IEnumerable carbonScopeList, CarbonEmissionCategoryType categoryType, int topItems) : base(dateRange, subscriptionList, carbonScopeList) + { + Argument.AssertNotNull(dateRange, nameof(dateRange)); + Argument.AssertNotNull(subscriptionList, nameof(subscriptionList)); + Argument.AssertNotNull(carbonScopeList, nameof(carbonScopeList)); + + CategoryType = categoryType; + TopItems = topItems; + ReportType = CarbonEmissionQueryReportType.TopItemsSummaryReport; + } + + /// Initializes a new instance of . + /// The ReportType requested for carbon emissions data. Required. Specifies how data is aggregated and displayed in the output, as explained in the ReportTypeEnum. + /// The start and end dates for carbon emissions data. Required. For ItemDetailsReport and TopItemsSummaryReport, only one month of data is supported at a time, so start and end dates should be equal within DateRange (e.g., start: 2024-06-01 and end: 2024-06-01). + /// List of subscription IDs for which carbon emissions data is requested. Required. Each subscription ID should be in lowercase format. The max length of list is 100. + /// List of resource group URLs for carbon emissions data. Optional. Each URL must follow the format '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroup}', and should be in all lowercase. + /// List of resource types for carbon emissions data. Optional. Each resource type should be specified in lowercase, following the format 'microsoft.{service}/{resourceType}', e.g., 'microsoft.storage/storageaccounts'. + /// List of locations(Azure Region Display Name) for carbon emissions data, with each location specified in lowercase (e.g., 'east us'). Optional. You can use the command 'az account list-locations -o table' to find Azure Region Display Names. + /// List of carbon emission scopes. Required. Accepts one or more values from EmissionScopeEnum (e.g., Scope1, Scope2, Scope3) in list form. The output will include the total emissions for the specified scopes. + /// Keeps track of any properties unknown to the library. + /// Specifies the category type for which to retrieve top-emitting items. See supported values defined in CategoryTypeEnum. + /// The number of top items to return, based on emissions. This value must be between 1 and 10. + internal TopItemsSummaryReportQueryFilter(CarbonEmissionQueryReportType reportType, CarbonEmissionQueryDateRange dateRange, IList subscriptionList, IList resourceGroupUrlList, IList resourceTypeList, IList locationList, IList carbonScopeList, IDictionary serializedAdditionalRawData, CarbonEmissionCategoryType categoryType, int topItems) : base(reportType, dateRange, subscriptionList, resourceGroupUrlList, resourceTypeList, locationList, carbonScopeList, serializedAdditionalRawData) + { + CategoryType = categoryType; + TopItems = topItems; + ReportType = reportType; + } + + /// Initializes a new instance of for deserialization. + internal TopItemsSummaryReportQueryFilter() + { + } + + /// Specifies the category type for which to retrieve top-emitting items. See supported values defined in CategoryTypeEnum. + public CarbonEmissionCategoryType CategoryType { get; } + /// The number of top items to return, based on emissions. This value must be between 1 and 10. + public int TopItems { get; } + } +} diff --git a/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/UnknownCarbonEmission.Serialization.cs b/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/UnknownCarbonEmission.Serialization.cs new file mode 100644 index 000000000000..484c113be2bb --- /dev/null +++ b/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/UnknownCarbonEmission.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.CarbonOptimization.Models +{ + internal partial class UnknownCarbonEmission : 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(CarbonEmission)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + } + + CarbonEmission 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(CarbonEmission)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeCarbonEmission(document.RootElement, options); + } + + internal static UnknownCarbonEmission DeserializeUnknownCarbonEmission(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + CarbonEmissionDataType dataType = "Unknown"; + double latestMonthEmissions = default; + double previousMonthEmissions = default; + double? monthOverMonthEmissionsChangeRatio = default; + double? monthlyEmissionsChangeValue = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("dataType"u8)) + { + dataType = new CarbonEmissionDataType(property.Value.GetString()); + continue; + } + if (property.NameEquals("latestMonthEmissions"u8)) + { + latestMonthEmissions = property.Value.GetDouble(); + continue; + } + if (property.NameEquals("previousMonthEmissions"u8)) + { + previousMonthEmissions = property.Value.GetDouble(); + continue; + } + if (property.NameEquals("monthOverMonthEmissionsChangeRatio"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + monthOverMonthEmissionsChangeRatio = property.Value.GetDouble(); + continue; + } + if (property.NameEquals("monthlyEmissionsChangeValue"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + monthlyEmissionsChangeValue = property.Value.GetDouble(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new UnknownCarbonEmission( + dataType, + latestMonthEmissions, + previousMonthEmissions, + monthOverMonthEmissionsChangeRatio, + monthlyEmissionsChangeValue, + 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, AzureResourceManagerCarbonOptimizationContext.Default); + default: + throw new FormatException($"The model {nameof(CarbonEmission)} does not support writing '{options.Format}' format."); + } + } + + CarbonEmission 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 DeserializeCarbonEmission(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(CarbonEmission)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/UnknownCarbonEmission.cs b/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/UnknownCarbonEmission.cs new file mode 100644 index 000000000000..e181d7b0d39c --- /dev/null +++ b/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/UnknownCarbonEmission.cs @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.CarbonOptimization.Models +{ + /// Unknown version of CarbonEmission. + internal partial class UnknownCarbonEmission : CarbonEmission + { + /// Initializes a new instance of . + /// The data type of the query result, indicating the format of the returned response. + /// Total carbon emissions for the specified query parameters, measured in kgCO2E. This value represents total emissions over the specified date range (e.g., March-June). + /// Total carbon emissions for the previous month’s date range, which is the same period as the specified date range but shifted left by one month (e.g., if the specified range is March - June, the previous month’s range will be Feb - May). The value is measured in kgCO2E. + /// The percentage change in carbon emissions between the current and previous DateRange. This is calculated as: (latestMonthEmissions - previousMonthEmissions) / previousMonthEmissions. + /// The change in carbon emissions between the current and previous period, calculated as: latestMonthEmissions - previousMonthEmissions. + /// Keeps track of any properties unknown to the library. + internal UnknownCarbonEmission(CarbonEmissionDataType dataType, double latestMonthEmissions, double previousMonthEmissions, double? monthOverMonthEmissionsChangeRatio, double? monthlyEmissionsChangeValue, IDictionary serializedAdditionalRawData) : base(dataType, latestMonthEmissions, previousMonthEmissions, monthOverMonthEmissionsChangeRatio, monthlyEmissionsChangeValue, serializedAdditionalRawData) + { + DataType = dataType; + } + + /// Initializes a new instance of for deserialization. + internal UnknownCarbonEmission() + { + } + } +} diff --git a/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/UnknownCarbonEmissionQueryFilter.Serialization.cs b/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/UnknownCarbonEmissionQueryFilter.Serialization.cs new file mode 100644 index 000000000000..187f75b9c103 --- /dev/null +++ b/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/UnknownCarbonEmissionQueryFilter.Serialization.cs @@ -0,0 +1,191 @@ +// 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.CarbonOptimization.Models +{ + internal partial class UnknownCarbonEmissionQueryFilter : 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(CarbonEmissionQueryFilter)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + } + + CarbonEmissionQueryFilter 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(CarbonEmissionQueryFilter)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeCarbonEmissionQueryFilter(document.RootElement, options); + } + + internal static UnknownCarbonEmissionQueryFilter DeserializeUnknownCarbonEmissionQueryFilter(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + CarbonEmissionQueryReportType reportType = "Unknown"; + CarbonEmissionQueryDateRange dateRange = default; + IList subscriptionList = default; + IList resourceGroupUrlList = default; + IList resourceTypeList = default; + IList locationList = default; + IList carbonScopeList = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("reportType"u8)) + { + reportType = new CarbonEmissionQueryReportType(property.Value.GetString()); + continue; + } + if (property.NameEquals("dateRange"u8)) + { + dateRange = CarbonEmissionQueryDateRange.DeserializeCarbonEmissionQueryDateRange(property.Value, options); + continue; + } + if (property.NameEquals("subscriptionList"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + subscriptionList = array; + continue; + } + if (property.NameEquals("resourceGroupUrlList"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + resourceGroupUrlList = array; + continue; + } + if (property.NameEquals("resourceTypeList"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(new ResourceType(item.GetString())); + } + resourceTypeList = array; + continue; + } + if (property.NameEquals("locationList"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(new AzureLocation(item.GetString())); + } + locationList = array; + continue; + } + if (property.NameEquals("carbonScopeList"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(new CarbonEmissionScope(item.GetString())); + } + carbonScopeList = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new UnknownCarbonEmissionQueryFilter( + reportType, + dateRange, + subscriptionList, + resourceGroupUrlList ?? new ChangeTrackingList(), + resourceTypeList ?? new ChangeTrackingList(), + locationList ?? new ChangeTrackingList(), + carbonScopeList, + 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, AzureResourceManagerCarbonOptimizationContext.Default); + default: + throw new FormatException($"The model {nameof(CarbonEmissionQueryFilter)} does not support writing '{options.Format}' format."); + } + } + + CarbonEmissionQueryFilter 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 DeserializeCarbonEmissionQueryFilter(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(CarbonEmissionQueryFilter)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/UnknownCarbonEmissionQueryFilter.cs b/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/UnknownCarbonEmissionQueryFilter.cs new file mode 100644 index 000000000000..07617f5daf64 --- /dev/null +++ b/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/Models/UnknownCarbonEmissionQueryFilter.cs @@ -0,0 +1,36 @@ +// 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.CarbonOptimization.Models +{ + /// Unknown version of CarbonEmissionQueryFilter. + internal partial class UnknownCarbonEmissionQueryFilter : CarbonEmissionQueryFilter + { + /// Initializes a new instance of . + /// The ReportType requested for carbon emissions data. Required. Specifies how data is aggregated and displayed in the output, as explained in the ReportTypeEnum. + /// The start and end dates for carbon emissions data. Required. For ItemDetailsReport and TopItemsSummaryReport, only one month of data is supported at a time, so start and end dates should be equal within DateRange (e.g., start: 2024-06-01 and end: 2024-06-01). + /// List of subscription IDs for which carbon emissions data is requested. Required. Each subscription ID should be in lowercase format. The max length of list is 100. + /// List of resource group URLs for carbon emissions data. Optional. Each URL must follow the format '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroup}', and should be in all lowercase. + /// List of resource types for carbon emissions data. Optional. Each resource type should be specified in lowercase, following the format 'microsoft.{service}/{resourceType}', e.g., 'microsoft.storage/storageaccounts'. + /// List of locations(Azure Region Display Name) for carbon emissions data, with each location specified in lowercase (e.g., 'east us'). Optional. You can use the command 'az account list-locations -o table' to find Azure Region Display Names. + /// List of carbon emission scopes. Required. Accepts one or more values from EmissionScopeEnum (e.g., Scope1, Scope2, Scope3) in list form. The output will include the total emissions for the specified scopes. + /// Keeps track of any properties unknown to the library. + internal UnknownCarbonEmissionQueryFilter(CarbonEmissionQueryReportType reportType, CarbonEmissionQueryDateRange dateRange, IList subscriptionList, IList resourceGroupUrlList, IList resourceTypeList, IList locationList, IList carbonScopeList, IDictionary serializedAdditionalRawData) : base(reportType, dateRange, subscriptionList, resourceGroupUrlList, resourceTypeList, locationList, carbonScopeList, serializedAdditionalRawData) + { + ReportType = reportType; + } + + /// Initializes a new instance of for deserialization. + internal UnknownCarbonEmissionQueryFilter() + { + } + } +} diff --git a/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/ProviderConstants.cs b/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/ProviderConstants.cs new file mode 100644 index 000000000000..08f60e70a709 --- /dev/null +++ b/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/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.CarbonOptimization +{ + internal static class ProviderConstants + { + public static string DefaultProviderNamespace { get; } = ClientDiagnostics.GetResourceProviderNamespace(typeof(ProviderConstants).Assembly); + } +} diff --git a/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/RestOperations/CarbonServiceRestOperations.cs b/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/RestOperations/CarbonServiceRestOperations.cs new file mode 100644 index 000000000000..7c7452cf24e3 --- /dev/null +++ b/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Generated/RestOperations/CarbonServiceRestOperations.cs @@ -0,0 +1,179 @@ +// 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.CarbonOptimization.Models; + +namespace Azure.ResourceManager.CarbonOptimization +{ + internal partial class CarbonServiceRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of CarbonServiceRestOperations. + /// 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 CarbonServiceRestOperations(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-04-01"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal RequestUriBuilder CreateQueryCarbonEmissionReportsRequestUri(CarbonEmissionQueryFilter queryParameters) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/providers/Microsoft.Carbon/carbonEmissionReports", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateQueryCarbonEmissionReportsRequest(CarbonEmissionQueryFilter queryParameters) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/providers/Microsoft.Carbon/carbonEmissionReports", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(queryParameters, ModelSerializationExtensions.WireOptions); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// API for Carbon Emissions Reports. + /// Query parameters. + /// The cancellation token to use. + /// is null. + public async Task> QueryCarbonEmissionReportsAsync(CarbonEmissionQueryFilter queryParameters, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(queryParameters, nameof(queryParameters)); + + using var message = CreateQueryCarbonEmissionReportsRequest(queryParameters); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + CarbonEmissionListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = CarbonEmissionListResult.DeserializeCarbonEmissionListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// API for Carbon Emissions Reports. + /// Query parameters. + /// The cancellation token to use. + /// is null. + public Response QueryCarbonEmissionReports(CarbonEmissionQueryFilter queryParameters, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(queryParameters, nameof(queryParameters)); + + using var message = CreateQueryCarbonEmissionReportsRequest(queryParameters); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + CarbonEmissionListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = CarbonEmissionListResult.DeserializeCarbonEmissionListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateQueryCarbonEmissionAvailableDateRangeRequestUri() + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/providers/Microsoft.Carbon/queryCarbonEmissionDataAvailableDateRange", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateQueryCarbonEmissionAvailableDateRangeRequest() + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/providers/Microsoft.Carbon/queryCarbonEmissionDataAvailableDateRange", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// API for query carbon emission data available date range. + /// The cancellation token to use. + public async Task> QueryCarbonEmissionAvailableDateRangeAsync(CancellationToken cancellationToken = default) + { + using var message = CreateQueryCarbonEmissionAvailableDateRangeRequest(); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + CarbonEmissionAvailableDateRange value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = CarbonEmissionAvailableDateRange.DeserializeCarbonEmissionAvailableDateRange(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// API for query carbon emission data available date range. + /// The cancellation token to use. + public Response QueryCarbonEmissionAvailableDateRange(CancellationToken cancellationToken = default) + { + using var message = CreateQueryCarbonEmissionAvailableDateRangeRequest(); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + CarbonEmissionAvailableDateRange value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = CarbonEmissionAvailableDateRange.DeserializeCarbonEmissionAvailableDateRange(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Properties/AssemblyInfo.cs b/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/src/Properties/AssemblyInfo.cs new file mode 100644 index 000000000000..5be33ff7976b --- /dev/null +++ b/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/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.CarbonOptimization.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("CarbonOptimization")] diff --git a/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/tsp-location.yaml b/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/tsp-location.yaml new file mode 100644 index 000000000000..7e955cd58367 --- /dev/null +++ b/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/tsp-location.yaml @@ -0,0 +1,4 @@ +directory: specification/carbon/Carbon.Management +commit: 0c929c78c4b7892c20cdfee10ddebb97cdf9d8a9 +repo: Azure/azure-rest-api-specs +additionalDirectories: diff --git a/sdk/carbonoptimization/ci.mgmt.yml b/sdk/carbonoptimization/ci.mgmt.yml new file mode 100644 index 000000000000..4efe477bc075 --- /dev/null +++ b/sdk/carbonoptimization/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/carbonoptimization /ci.mgmt.yml + - sdk/carbonoptimization /Azure.ResourceManager.CarbonOptimization / + + +extends: + template: /eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: carbonoptimization + ArtifactName: packages + LimitForPullRequest: true + Artifacts: + - name: Azure.ResourceManager.CarbonOptimization + safeName: AzureResourceManagerCarbonOptimization 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..84e64cb9808f --- /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 static partial class DependencyMapExtensions + { + public static Azure.ResourceManager.DependencyMap.DiscoverySourceResource GetDiscoverySourceResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.ResourceManager.DependencyMap.MapsResource GetMapsResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.Response GetMapsResource(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string mapName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static System.Threading.Tasks.Task> GetMapsResourceAsync(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string mapName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.ResourceManager.DependencyMap.MapsResourceCollection GetMapsResources(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource) { throw null; } + public static Azure.Pageable GetMapsResources(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.AsyncPageable GetMapsResourcesAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class DiscoverySourceResource : Azure.ResourceManager.ArmResource, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public static readonly Azure.Core.ResourceType ResourceType; + protected DiscoverySourceResource() { } + public virtual Azure.ResourceManager.DependencyMap.DiscoverySourceResourceData 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.DiscoverySourceResourceData 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.DiscoverySourceResourceData 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.DiscoverySourceResourcePatch 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.DiscoverySourceResourcePatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class DiscoverySourceResourceCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected DiscoverySourceResourceCollection() { } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string sourceName, Azure.ResourceManager.DependencyMap.DiscoverySourceResourceData 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.DiscoverySourceResourceData 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 DiscoverySourceResourceData : Azure.ResourceManager.Models.TrackedResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public DiscoverySourceResourceData(Azure.Core.AzureLocation location) { } + public Azure.ResourceManager.DependencyMap.Models.DiscoverySourceResourceProperties Properties { get { throw null; } set { } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DependencyMap.DiscoverySourceResourceData 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.DiscoverySourceResourceData 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 MapsResource : Azure.ResourceManager.ArmResource, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public static readonly Azure.Core.ResourceType ResourceType; + protected MapsResource() { } + public virtual Azure.ResourceManager.DependencyMap.MapsResourceData 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.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 GetDiscoverySourceResource(string sourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetDiscoverySourceResourceAsync(string sourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.DependencyMap.DiscoverySourceResourceCollection GetDiscoverySourceResources() { 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.MapsResourceData 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.MapsResourceData 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.MapsResourcePatch 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.MapsResourcePatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class MapsResourceCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected MapsResourceCollection() { } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string mapName, Azure.ResourceManager.DependencyMap.MapsResourceData 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.MapsResourceData 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 MapsResourceData : Azure.ResourceManager.Models.TrackedResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public MapsResourceData(Azure.Core.AzureLocation location) { } + public Azure.ResourceManager.DependencyMap.Models.ProvisioningState? MapsResourceProvisioningState { get { throw null; } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DependencyMap.MapsResourceData 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.MapsResourceData 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; } + } +} +namespace Azure.ResourceManager.DependencyMap.Mocking +{ + public partial class MockableDependencyMapArmClient : Azure.ResourceManager.ArmResource + { + protected MockableDependencyMapArmClient() { } + public virtual Azure.ResourceManager.DependencyMap.DiscoverySourceResource GetDiscoverySourceResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DependencyMap.MapsResource GetMapsResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableDependencyMapResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableDependencyMapResourceGroupResource() { } + public virtual Azure.Response GetMapsResource(string mapName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetMapsResourceAsync(string mapName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.DependencyMap.MapsResourceCollection GetMapsResources() { throw null; } + } + public partial class MockableDependencyMapSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableDependencyMapSubscriptionResource() { } + public virtual Azure.Pageable GetMapsResources(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetMapsResourcesAsync(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.DiscoverySourceResourceData DiscoverySourceResourceData(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.DiscoverySourceResourceProperties properties = null) { throw null; } + public static Azure.ResourceManager.DependencyMap.Models.DiscoverySourceResourceProperties DiscoverySourceResourceProperties(Azure.ResourceManager.DependencyMap.Models.ProvisioningState? provisioningState = default(Azure.ResourceManager.DependencyMap.Models.ProvisioningState?), string sourceType = null, string sourceId = null) { throw null; } + public static Azure.ResourceManager.DependencyMap.Models.ExportDependenciesContent ExportDependenciesContent(string focusedMachineId = null, Azure.ResourceManager.DependencyMap.Models.DependencyMapVisualizationFilter filters = null) { throw null; } + public static Azure.ResourceManager.DependencyMap.Models.GetConnectionsForProcessOnFocusedMachineContent GetConnectionsForProcessOnFocusedMachineContent(string focusedMachineId = null, string processIdOnFocusedMachine = null, Azure.ResourceManager.DependencyMap.Models.DependencyMapVisualizationFilter filters = null) { throw null; } + public static Azure.ResourceManager.DependencyMap.Models.GetConnectionsWithConnectedMachineForFocusedMachineContent GetConnectionsWithConnectedMachineForFocusedMachineContent(string focusedMachineId = null, string connectedMachineId = null, Azure.ResourceManager.DependencyMap.Models.DependencyMapVisualizationFilter filters = null) { throw null; } + public static Azure.ResourceManager.DependencyMap.Models.GetDependencyViewForFocusedMachineContent GetDependencyViewForFocusedMachineContent(string focusedMachineId = null, Azure.ResourceManager.DependencyMap.Models.DependencyMapVisualizationFilter filters = null) { throw null; } + public static Azure.ResourceManager.DependencyMap.MapsResourceData MapsResourceData(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.ProvisioningState? mapsResourceProvisioningState = default(Azure.ResourceManager.DependencyMap.Models.ProvisioningState?)) { throw null; } + public static Azure.ResourceManager.DependencyMap.Models.OffAzureDiscoverySourceResourceProperties OffAzureDiscoverySourceResourceProperties(Azure.ResourceManager.DependencyMap.Models.ProvisioningState? provisioningState = default(Azure.ResourceManager.DependencyMap.Models.ProvisioningState?), string sourceId = null) { throw null; } + } + public partial class DateTimeFilter : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public DateTimeFilter() { } + public System.DateTimeOffset? EndDateTimeUtc { get { throw null; } set { } } + public System.DateTimeOffset? StartDateTimeUtc { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DependencyMap.Models.DateTimeFilter 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.DateTimeFilter 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 DependencyMapVisualizationFilter : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public DependencyMapVisualizationFilter() { } + public Azure.ResourceManager.DependencyMap.Models.DateTimeFilter DateTime { get { throw null; } set { } } + public Azure.ResourceManager.DependencyMap.Models.ProcessNameFilter 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 DiscoverySourceResourcePatch : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public DiscoverySourceResourcePatch() { } + 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.DiscoverySourceResourcePatch 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.DiscoverySourceResourcePatch 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 DiscoverySourceResourceProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + protected DiscoverySourceResourceProperties(string sourceId) { } + public Azure.ResourceManager.DependencyMap.Models.ProvisioningState? ProvisioningState { get { throw null; } } + public string SourceId { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DependencyMap.Models.DiscoverySourceResourceProperties 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.DiscoverySourceResourceProperties 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(string focusedMachineId) { } + public Azure.ResourceManager.DependencyMap.Models.DependencyMapVisualizationFilter Filters { get { throw null; } set { } } + public string 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(string focusedMachineId, string processIdOnFocusedMachine) { } + public Azure.ResourceManager.DependencyMap.Models.DependencyMapVisualizationFilter Filters { get { throw null; } set { } } + public string 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(string focusedMachineId, string connectedMachineId) { } + public string ConnectedMachineId { get { throw null; } } + public Azure.ResourceManager.DependencyMap.Models.DependencyMapVisualizationFilter Filters { get { throw null; } set { } } + public string 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(string focusedMachineId) { } + public Azure.ResourceManager.DependencyMap.Models.DependencyMapVisualizationFilter Filters { get { throw null; } set { } } + public string 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 MapsResourcePatch : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public MapsResourcePatch() { } + 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.MapsResourcePatch 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.MapsResourcePatch 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 OffAzureDiscoverySourceResourceProperties : Azure.ResourceManager.DependencyMap.Models.DiscoverySourceResourceProperties, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public OffAzureDiscoverySourceResourceProperties(string sourceId) : base (default(string)) { } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DependencyMap.Models.OffAzureDiscoverySourceResourceProperties 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.OffAzureDiscoverySourceResourceProperties 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 ProcessNameFilter : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public ProcessNameFilter(Azure.ResourceManager.DependencyMap.Models.ProcessNameFilterOperator @operator, System.Collections.Generic.IEnumerable processNames) { } + public Azure.ResourceManager.DependencyMap.Models.ProcessNameFilterOperator 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.ProcessNameFilter 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.ProcessNameFilter 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 ProcessNameFilterOperator : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public ProcessNameFilterOperator(string value) { throw null; } + public static Azure.ResourceManager.DependencyMap.Models.ProcessNameFilterOperator Contains { get { throw null; } } + public static Azure.ResourceManager.DependencyMap.Models.ProcessNameFilterOperator NotContains { get { throw null; } } + public bool Equals(Azure.ResourceManager.DependencyMap.Models.ProcessNameFilterOperator 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.ProcessNameFilterOperator left, Azure.ResourceManager.DependencyMap.Models.ProcessNameFilterOperator right) { throw null; } + public static implicit operator Azure.ResourceManager.DependencyMap.Models.ProcessNameFilterOperator (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.DependencyMap.Models.ProcessNameFilterOperator left, Azure.ResourceManager.DependencyMap.Models.ProcessNameFilterOperator right) { throw null; } + public override string ToString() { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct ProvisioningState : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public ProvisioningState(string value) { throw null; } + public static Azure.ResourceManager.DependencyMap.Models.ProvisioningState Accepted { get { throw null; } } + public static Azure.ResourceManager.DependencyMap.Models.ProvisioningState Canceled { get { throw null; } } + public static Azure.ResourceManager.DependencyMap.Models.ProvisioningState Deleting { get { throw null; } } + public static Azure.ResourceManager.DependencyMap.Models.ProvisioningState Failed { get { throw null; } } + public static Azure.ResourceManager.DependencyMap.Models.ProvisioningState Provisioning { get { throw null; } } + public static Azure.ResourceManager.DependencyMap.Models.ProvisioningState Succeeded { get { throw null; } } + public static Azure.ResourceManager.DependencyMap.Models.ProvisioningState Updating { get { throw null; } } + public bool Equals(Azure.ResourceManager.DependencyMap.Models.ProvisioningState other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.ResourceManager.DependencyMap.Models.ProvisioningState left, Azure.ResourceManager.DependencyMap.Models.ProvisioningState right) { throw null; } + public static implicit operator Azure.ResourceManager.DependencyMap.Models.ProvisioningState (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.DependencyMap.Models.ProvisioningState left, Azure.ResourceManager.DependencyMap.Models.ProvisioningState right) { throw null; } + public override string ToString() { 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..84e64cb9808f --- /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 static partial class DependencyMapExtensions + { + public static Azure.ResourceManager.DependencyMap.DiscoverySourceResource GetDiscoverySourceResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.ResourceManager.DependencyMap.MapsResource GetMapsResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.Response GetMapsResource(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string mapName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static System.Threading.Tasks.Task> GetMapsResourceAsync(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string mapName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.ResourceManager.DependencyMap.MapsResourceCollection GetMapsResources(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource) { throw null; } + public static Azure.Pageable GetMapsResources(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.AsyncPageable GetMapsResourcesAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class DiscoverySourceResource : Azure.ResourceManager.ArmResource, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public static readonly Azure.Core.ResourceType ResourceType; + protected DiscoverySourceResource() { } + public virtual Azure.ResourceManager.DependencyMap.DiscoverySourceResourceData 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.DiscoverySourceResourceData 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.DiscoverySourceResourceData 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.DiscoverySourceResourcePatch 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.DiscoverySourceResourcePatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class DiscoverySourceResourceCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected DiscoverySourceResourceCollection() { } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string sourceName, Azure.ResourceManager.DependencyMap.DiscoverySourceResourceData 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.DiscoverySourceResourceData 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 DiscoverySourceResourceData : Azure.ResourceManager.Models.TrackedResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public DiscoverySourceResourceData(Azure.Core.AzureLocation location) { } + public Azure.ResourceManager.DependencyMap.Models.DiscoverySourceResourceProperties Properties { get { throw null; } set { } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DependencyMap.DiscoverySourceResourceData 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.DiscoverySourceResourceData 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 MapsResource : Azure.ResourceManager.ArmResource, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public static readonly Azure.Core.ResourceType ResourceType; + protected MapsResource() { } + public virtual Azure.ResourceManager.DependencyMap.MapsResourceData 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.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 GetDiscoverySourceResource(string sourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetDiscoverySourceResourceAsync(string sourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.DependencyMap.DiscoverySourceResourceCollection GetDiscoverySourceResources() { 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.MapsResourceData 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.MapsResourceData 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.MapsResourcePatch 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.MapsResourcePatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class MapsResourceCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected MapsResourceCollection() { } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string mapName, Azure.ResourceManager.DependencyMap.MapsResourceData 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.MapsResourceData 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 MapsResourceData : Azure.ResourceManager.Models.TrackedResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public MapsResourceData(Azure.Core.AzureLocation location) { } + public Azure.ResourceManager.DependencyMap.Models.ProvisioningState? MapsResourceProvisioningState { get { throw null; } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DependencyMap.MapsResourceData 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.MapsResourceData 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; } + } +} +namespace Azure.ResourceManager.DependencyMap.Mocking +{ + public partial class MockableDependencyMapArmClient : Azure.ResourceManager.ArmResource + { + protected MockableDependencyMapArmClient() { } + public virtual Azure.ResourceManager.DependencyMap.DiscoverySourceResource GetDiscoverySourceResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DependencyMap.MapsResource GetMapsResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableDependencyMapResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableDependencyMapResourceGroupResource() { } + public virtual Azure.Response GetMapsResource(string mapName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetMapsResourceAsync(string mapName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.DependencyMap.MapsResourceCollection GetMapsResources() { throw null; } + } + public partial class MockableDependencyMapSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableDependencyMapSubscriptionResource() { } + public virtual Azure.Pageable GetMapsResources(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetMapsResourcesAsync(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.DiscoverySourceResourceData DiscoverySourceResourceData(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.DiscoverySourceResourceProperties properties = null) { throw null; } + public static Azure.ResourceManager.DependencyMap.Models.DiscoverySourceResourceProperties DiscoverySourceResourceProperties(Azure.ResourceManager.DependencyMap.Models.ProvisioningState? provisioningState = default(Azure.ResourceManager.DependencyMap.Models.ProvisioningState?), string sourceType = null, string sourceId = null) { throw null; } + public static Azure.ResourceManager.DependencyMap.Models.ExportDependenciesContent ExportDependenciesContent(string focusedMachineId = null, Azure.ResourceManager.DependencyMap.Models.DependencyMapVisualizationFilter filters = null) { throw null; } + public static Azure.ResourceManager.DependencyMap.Models.GetConnectionsForProcessOnFocusedMachineContent GetConnectionsForProcessOnFocusedMachineContent(string focusedMachineId = null, string processIdOnFocusedMachine = null, Azure.ResourceManager.DependencyMap.Models.DependencyMapVisualizationFilter filters = null) { throw null; } + public static Azure.ResourceManager.DependencyMap.Models.GetConnectionsWithConnectedMachineForFocusedMachineContent GetConnectionsWithConnectedMachineForFocusedMachineContent(string focusedMachineId = null, string connectedMachineId = null, Azure.ResourceManager.DependencyMap.Models.DependencyMapVisualizationFilter filters = null) { throw null; } + public static Azure.ResourceManager.DependencyMap.Models.GetDependencyViewForFocusedMachineContent GetDependencyViewForFocusedMachineContent(string focusedMachineId = null, Azure.ResourceManager.DependencyMap.Models.DependencyMapVisualizationFilter filters = null) { throw null; } + public static Azure.ResourceManager.DependencyMap.MapsResourceData MapsResourceData(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.ProvisioningState? mapsResourceProvisioningState = default(Azure.ResourceManager.DependencyMap.Models.ProvisioningState?)) { throw null; } + public static Azure.ResourceManager.DependencyMap.Models.OffAzureDiscoverySourceResourceProperties OffAzureDiscoverySourceResourceProperties(Azure.ResourceManager.DependencyMap.Models.ProvisioningState? provisioningState = default(Azure.ResourceManager.DependencyMap.Models.ProvisioningState?), string sourceId = null) { throw null; } + } + public partial class DateTimeFilter : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public DateTimeFilter() { } + public System.DateTimeOffset? EndDateTimeUtc { get { throw null; } set { } } + public System.DateTimeOffset? StartDateTimeUtc { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DependencyMap.Models.DateTimeFilter 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.DateTimeFilter 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 DependencyMapVisualizationFilter : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public DependencyMapVisualizationFilter() { } + public Azure.ResourceManager.DependencyMap.Models.DateTimeFilter DateTime { get { throw null; } set { } } + public Azure.ResourceManager.DependencyMap.Models.ProcessNameFilter 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 DiscoverySourceResourcePatch : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public DiscoverySourceResourcePatch() { } + 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.DiscoverySourceResourcePatch 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.DiscoverySourceResourcePatch 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 DiscoverySourceResourceProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + protected DiscoverySourceResourceProperties(string sourceId) { } + public Azure.ResourceManager.DependencyMap.Models.ProvisioningState? ProvisioningState { get { throw null; } } + public string SourceId { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DependencyMap.Models.DiscoverySourceResourceProperties 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.DiscoverySourceResourceProperties 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(string focusedMachineId) { } + public Azure.ResourceManager.DependencyMap.Models.DependencyMapVisualizationFilter Filters { get { throw null; } set { } } + public string 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(string focusedMachineId, string processIdOnFocusedMachine) { } + public Azure.ResourceManager.DependencyMap.Models.DependencyMapVisualizationFilter Filters { get { throw null; } set { } } + public string 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(string focusedMachineId, string connectedMachineId) { } + public string ConnectedMachineId { get { throw null; } } + public Azure.ResourceManager.DependencyMap.Models.DependencyMapVisualizationFilter Filters { get { throw null; } set { } } + public string 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(string focusedMachineId) { } + public Azure.ResourceManager.DependencyMap.Models.DependencyMapVisualizationFilter Filters { get { throw null; } set { } } + public string 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 MapsResourcePatch : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public MapsResourcePatch() { } + 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.MapsResourcePatch 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.MapsResourcePatch 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 OffAzureDiscoverySourceResourceProperties : Azure.ResourceManager.DependencyMap.Models.DiscoverySourceResourceProperties, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public OffAzureDiscoverySourceResourceProperties(string sourceId) : base (default(string)) { } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DependencyMap.Models.OffAzureDiscoverySourceResourceProperties 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.OffAzureDiscoverySourceResourceProperties 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 ProcessNameFilter : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public ProcessNameFilter(Azure.ResourceManager.DependencyMap.Models.ProcessNameFilterOperator @operator, System.Collections.Generic.IEnumerable processNames) { } + public Azure.ResourceManager.DependencyMap.Models.ProcessNameFilterOperator 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.ProcessNameFilter 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.ProcessNameFilter 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 ProcessNameFilterOperator : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public ProcessNameFilterOperator(string value) { throw null; } + public static Azure.ResourceManager.DependencyMap.Models.ProcessNameFilterOperator Contains { get { throw null; } } + public static Azure.ResourceManager.DependencyMap.Models.ProcessNameFilterOperator NotContains { get { throw null; } } + public bool Equals(Azure.ResourceManager.DependencyMap.Models.ProcessNameFilterOperator 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.ProcessNameFilterOperator left, Azure.ResourceManager.DependencyMap.Models.ProcessNameFilterOperator right) { throw null; } + public static implicit operator Azure.ResourceManager.DependencyMap.Models.ProcessNameFilterOperator (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.DependencyMap.Models.ProcessNameFilterOperator left, Azure.ResourceManager.DependencyMap.Models.ProcessNameFilterOperator right) { throw null; } + public override string ToString() { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct ProvisioningState : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public ProvisioningState(string value) { throw null; } + public static Azure.ResourceManager.DependencyMap.Models.ProvisioningState Accepted { get { throw null; } } + public static Azure.ResourceManager.DependencyMap.Models.ProvisioningState Canceled { get { throw null; } } + public static Azure.ResourceManager.DependencyMap.Models.ProvisioningState Deleting { get { throw null; } } + public static Azure.ResourceManager.DependencyMap.Models.ProvisioningState Failed { get { throw null; } } + public static Azure.ResourceManager.DependencyMap.Models.ProvisioningState Provisioning { get { throw null; } } + public static Azure.ResourceManager.DependencyMap.Models.ProvisioningState Succeeded { get { throw null; } } + public static Azure.ResourceManager.DependencyMap.Models.ProvisioningState Updating { get { throw null; } } + public bool Equals(Azure.ResourceManager.DependencyMap.Models.ProvisioningState other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.ResourceManager.DependencyMap.Models.ProvisioningState left, Azure.ResourceManager.DependencyMap.Models.ProvisioningState right) { throw null; } + public static implicit operator Azure.ResourceManager.DependencyMap.Models.ProvisioningState (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.DependencyMap.Models.ProvisioningState left, Azure.ResourceManager.DependencyMap.Models.ProvisioningState right) { throw null; } + public override string ToString() { 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_DiscoverySourceResource.cs b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/samples/Generated/Samples/Sample_DiscoverySourceResource.cs new file mode 100644 index 000000000000..621bbf8898fd --- /dev/null +++ b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/samples/Generated/Samples/Sample_DiscoverySourceResource.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_DiscoverySourceResource + { + [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 DiscoverySourceResource created on azure + // for more information of creating DiscoverySourceResource, please refer to the document of DiscoverySourceResource + string subscriptionId = "D6E58BDB-45F1-41EC-A884-1FC945058848"; + string resourceGroupName = "rgdependencyMap"; + string mapName = "mapsTest1"; + string sourceName = "sourceTest1"; + ResourceIdentifier discoverySourceResourceId = DiscoverySourceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, mapName, sourceName); + DiscoverySourceResource discoverySourceResource = client.GetDiscoverySourceResource(discoverySourceResourceId); + + // invoke the operation + DiscoverySourceResource result = await discoverySourceResource.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 + DiscoverySourceResourceData 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 DiscoverySourceResource created on azure + // for more information of creating DiscoverySourceResource, please refer to the document of DiscoverySourceResource + string subscriptionId = "D6E58BDB-45F1-41EC-A884-1FC945058848"; + string resourceGroupName = "rgdependencyMap"; + string mapName = "mapsTest1"; + string sourceName = "sourceTest1"; + ResourceIdentifier discoverySourceResourceId = DiscoverySourceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, mapName, sourceName); + DiscoverySourceResource discoverySourceResource = client.GetDiscoverySourceResource(discoverySourceResourceId); + + // invoke the operation + await discoverySourceResource.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 DiscoverySourceResource created on azure + // for more information of creating DiscoverySourceResource, please refer to the document of DiscoverySourceResource + string subscriptionId = "D6E58BDB-45F1-41EC-A884-1FC945058848"; + string resourceGroupName = "rgdependencyMap"; + string mapName = "mapsTest1"; + string sourceName = "sourceTest1"; + ResourceIdentifier discoverySourceResourceId = DiscoverySourceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, mapName, sourceName); + DiscoverySourceResource discoverySourceResource = client.GetDiscoverySourceResource(discoverySourceResourceId); + + // invoke the operation + DiscoverySourceResourcePatch patch = new DiscoverySourceResourcePatch + { + Tags = { }, + }; + ArmOperation lro = await discoverySourceResource.UpdateAsync(WaitUntil.Completed, patch); + DiscoverySourceResource 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 + DiscoverySourceResourceData 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_DiscoverySourceResourceCollection.cs b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/samples/Generated/Samples/Sample_DiscoverySourceResourceCollection.cs new file mode 100644 index 000000000000..2f8f614fd834 --- /dev/null +++ b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/samples/Generated/Samples/Sample_DiscoverySourceResourceCollection.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_DiscoverySourceResourceCollection + { + [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 MapsResource created on azure + // for more information of creating MapsResource, please refer to the document of MapsResource + string subscriptionId = "D6E58BDB-45F1-41EC-A884-1FC945058848"; + string resourceGroupName = "rgdependencyMap"; + string mapName = "mapsTest1"; + ResourceIdentifier mapsResourceId = MapsResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, mapName); + MapsResource mapsResource = client.GetMapsResource(mapsResourceId); + + // get the collection of this DiscoverySourceResource + DiscoverySourceResourceCollection collection = mapsResource.GetDiscoverySourceResources(); + + // invoke the operation + string sourceName = "sourceTest1"; + DiscoverySourceResourceData data = new DiscoverySourceResourceData(new AzureLocation("y")) + { + Tags = { }, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, sourceName, data); + DiscoverySourceResource 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 + DiscoverySourceResourceData 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 MapsResource created on azure + // for more information of creating MapsResource, please refer to the document of MapsResource + string subscriptionId = "D6E58BDB-45F1-41EC-A884-1FC945058848"; + string resourceGroupName = "rgdependencyMap"; + string mapName = "mapsTest1"; + ResourceIdentifier mapsResourceId = MapsResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, mapName); + MapsResource mapsResource = client.GetMapsResource(mapsResourceId); + + // get the collection of this DiscoverySourceResource + DiscoverySourceResourceCollection collection = mapsResource.GetDiscoverySourceResources(); + + // invoke the operation + string sourceName = "sourceTest1"; + DiscoverySourceResource 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 + DiscoverySourceResourceData 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 MapsResource created on azure + // for more information of creating MapsResource, please refer to the document of MapsResource + string subscriptionId = "D6E58BDB-45F1-41EC-A884-1FC945058848"; + string resourceGroupName = "rgdependencyMap"; + string mapName = "mapsTest1"; + ResourceIdentifier mapsResourceId = MapsResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, mapName); + MapsResource mapsResource = client.GetMapsResource(mapsResourceId); + + // get the collection of this DiscoverySourceResource + DiscoverySourceResourceCollection collection = mapsResource.GetDiscoverySourceResources(); + + // invoke the operation and iterate over the result + await foreach (DiscoverySourceResource 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 + DiscoverySourceResourceData 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 MapsResource created on azure + // for more information of creating MapsResource, please refer to the document of MapsResource + string subscriptionId = "D6E58BDB-45F1-41EC-A884-1FC945058848"; + string resourceGroupName = "rgdependencyMap"; + string mapName = "mapsTest1"; + ResourceIdentifier mapsResourceId = MapsResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, mapName); + MapsResource mapsResource = client.GetMapsResource(mapsResourceId); + + // get the collection of this DiscoverySourceResource + DiscoverySourceResourceCollection collection = mapsResource.GetDiscoverySourceResources(); + + // 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 MapsResource created on azure + // for more information of creating MapsResource, please refer to the document of MapsResource + string subscriptionId = "D6E58BDB-45F1-41EC-A884-1FC945058848"; + string resourceGroupName = "rgdependencyMap"; + string mapName = "mapsTest1"; + ResourceIdentifier mapsResourceId = MapsResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, mapName); + MapsResource mapsResource = client.GetMapsResource(mapsResourceId); + + // get the collection of this DiscoverySourceResource + DiscoverySourceResourceCollection collection = mapsResource.GetDiscoverySourceResources(); + + // invoke the operation + string sourceName = "sourceTest1"; + NullableResponse response = await collection.GetIfExistsAsync(sourceName); + DiscoverySourceResource 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 + DiscoverySourceResourceData 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_MapsResource.cs b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/samples/Generated/Samples/Sample_MapsResource.cs new file mode 100644 index 000000000000..0f2d298c1a2b --- /dev/null +++ b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/samples/Generated/Samples/Sample_MapsResource.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_MapsResource + { + [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 MapsResource created on azure + // for more information of creating MapsResource, please refer to the document of MapsResource + string subscriptionId = "D6E58BDB-45F1-41EC-A884-1FC945058848"; + string resourceGroupName = "rgdependencyMap"; + string mapName = "mapsTest1"; + ResourceIdentifier mapsResourceId = MapsResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, mapName); + MapsResource mapsResource = client.GetMapsResource(mapsResourceId); + + // invoke the operation + MapsResource result = await mapsResource.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 + MapsResourceData 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 MapsResource created on azure + // for more information of creating MapsResource, please refer to the document of MapsResource + string subscriptionId = "D6E58BDB-45F1-41EC-A884-1FC945058848"; + string resourceGroupName = "rgdependencyMap"; + string mapName = "mapsTest1"; + ResourceIdentifier mapsResourceId = MapsResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, mapName); + MapsResource mapsResource = client.GetMapsResource(mapsResourceId); + + // invoke the operation + await mapsResource.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 MapsResource created on azure + // for more information of creating MapsResource, please refer to the document of MapsResource + string subscriptionId = "D6E58BDB-45F1-41EC-A884-1FC945058848"; + string resourceGroupName = "rgdependencyMap"; + string mapName = "mapsTest1"; + ResourceIdentifier mapsResourceId = MapsResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, mapName); + MapsResource mapsResource = client.GetMapsResource(mapsResourceId); + + // invoke the operation + MapsResourcePatch patch = new MapsResourcePatch + { + Tags = { }, + }; + ArmOperation lro = await mapsResource.UpdateAsync(WaitUntil.Completed, patch); + MapsResource 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 + MapsResourceData 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 MapsResource created on azure + // for more information of creating MapsResource, please refer to the document of MapsResource + string subscriptionId = "D6E58BDB-45F1-41EC-A884-1FC945058848"; + string resourceGroupName = "rgdependencyMap"; + string mapName = "mapsTest1"; + ResourceIdentifier mapsResourceId = MapsResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, mapName); + MapsResource mapsResource = client.GetMapsResource(mapsResourceId); + + // invoke the operation + GetDependencyViewForFocusedMachineContent content = new GetDependencyViewForFocusedMachineContent("imzykeisagngrnfinbqtu") + { + Filters = new DependencyMapVisualizationFilter + { + DateTime = new DateTimeFilter + { + StartDateTimeUtc = DateTimeOffset.Parse("2024-03-29T07:35:15.336Z"), + EndDateTimeUtc = DateTimeOffset.Parse("2024-03-29T07:35:15.336Z"), + }, + ProcessNameFilter = new ProcessNameFilter(ProcessNameFilterOperator.Contains, new string[] { "mnqtvduwzemjcvvmnnoqvcuemwhnz" }), + }, + }; + await mapsResource.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 MapsResource created on azure + // for more information of creating MapsResource, please refer to the document of MapsResource + string subscriptionId = "D6E58BDB-45F1-41EC-A884-1FC945058848"; + string resourceGroupName = "rgdependencyMap"; + string mapName = "mapsTest1"; + ResourceIdentifier mapsResourceId = MapsResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, mapName); + MapsResource mapsResource = client.GetMapsResource(mapsResourceId); + + // invoke the operation + GetConnectionsWithConnectedMachineForFocusedMachineContent content = new GetConnectionsWithConnectedMachineForFocusedMachineContent("gagovctcfgocievqwq", "enaieiloylabljxzvmyrshp") + { + Filters = new DependencyMapVisualizationFilter + { + DateTime = new DateTimeFilter + { + StartDateTimeUtc = DateTimeOffset.Parse("2024-03-29T07:35:15.336Z"), + EndDateTimeUtc = DateTimeOffset.Parse("2024-03-29T07:35:15.336Z"), + }, + ProcessNameFilter = new ProcessNameFilter(ProcessNameFilterOperator.Contains, new string[] { "mnqtvduwzemjcvvmnnoqvcuemwhnz" }), + }, + }; + await mapsResource.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 MapsResource created on azure + // for more information of creating MapsResource, please refer to the document of MapsResource + string subscriptionId = "D6E58BDB-45F1-41EC-A884-1FC945058848"; + string resourceGroupName = "rgdependencyMap"; + string mapName = "mapsTest1"; + ResourceIdentifier mapsResourceId = MapsResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, mapName); + MapsResource mapsResource = client.GetMapsResource(mapsResourceId); + + // invoke the operation + GetConnectionsForProcessOnFocusedMachineContent content = new GetConnectionsForProcessOnFocusedMachineContent("abjy", "yzldgsfupsfvzlztqoqpiv") + { + Filters = new DependencyMapVisualizationFilter + { + DateTime = new DateTimeFilter + { + StartDateTimeUtc = DateTimeOffset.Parse("2024-03-29T07:35:15.336Z"), + EndDateTimeUtc = DateTimeOffset.Parse("2024-03-29T07:35:15.336Z"), + }, + ProcessNameFilter = new ProcessNameFilter(ProcessNameFilterOperator.Contains, new string[] { "mnqtvduwzemjcvvmnnoqvcuemwhnz" }), + }, + }; + await mapsResource.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 MapsResource created on azure + // for more information of creating MapsResource, please refer to the document of MapsResource + string subscriptionId = "D6E58BDB-45F1-41EC-A884-1FC945058848"; + string resourceGroupName = "rgdependencyMap"; + string mapName = "mapsTest1"; + ResourceIdentifier mapsResourceId = MapsResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, mapName); + MapsResource mapsResource = client.GetMapsResource(mapsResourceId); + + // invoke the operation + ExportDependenciesContent content = new ExportDependenciesContent("qzjpilzxpurauwfwwanpiiafvz") + { + Filters = new DependencyMapVisualizationFilter + { + DateTime = new DateTimeFilter + { + StartDateTimeUtc = DateTimeOffset.Parse("2024-03-29T07:35:15.336Z"), + EndDateTimeUtc = DateTimeOffset.Parse("2024-03-29T07:35:15.336Z"), + }, + ProcessNameFilter = new ProcessNameFilter(ProcessNameFilterOperator.Contains, new string[] { "mnqtvduwzemjcvvmnnoqvcuemwhnz" }), + }, + }; + await mapsResource.ExportDependenciesAsync(WaitUntil.Completed, content); + + Console.WriteLine("Succeeded"); + } + } +} diff --git a/sdk/dependencymap/Azure.ResourceManager.DependencyMap/samples/Generated/Samples/Sample_MapsResourceCollection.cs b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/samples/Generated/Samples/Sample_MapsResourceCollection.cs new file mode 100644 index 000000000000..7f65001445da --- /dev/null +++ b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/samples/Generated/Samples/Sample_MapsResourceCollection.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_MapsResourceCollection + { + [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 MapsResource + MapsResourceCollection collection = resourceGroupResource.GetMapsResources(); + + // invoke the operation + string mapName = "mapsTest1"; + MapsResourceData data = new MapsResourceData(new AzureLocation("wjtzelgfcmswfeflfltwxqveo")) + { + Tags = { }, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, mapName, data); + MapsResource 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 + MapsResourceData 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 MapsResource + MapsResourceCollection collection = resourceGroupResource.GetMapsResources(); + + // invoke the operation + string mapName = "mapsTest1"; + MapsResource 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 + MapsResourceData 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 MapsResource + MapsResourceCollection collection = resourceGroupResource.GetMapsResources(); + + // invoke the operation and iterate over the result + await foreach (MapsResource 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 + MapsResourceData 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 MapsResource + MapsResourceCollection collection = resourceGroupResource.GetMapsResources(); + + // 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 MapsResource + MapsResourceCollection collection = resourceGroupResource.GetMapsResources(); + + // invoke the operation + string mapName = "mapsTest1"; + NullableResponse response = await collection.GetIfExistsAsync(mapName); + MapsResource 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 + MapsResourceData 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_SubscriptionResourceExtensions.cs b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs new file mode 100644 index 000000000000..57785e453b0a --- /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 GetMapsResources_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 (MapsResource item in subscriptionResource.GetMapsResourcesAsync()) + { + // 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 + MapsResourceData 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..281b39254ed6 --- /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 MapsResourceData MapsResourceData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, ProvisioningState? mapsResourceProvisioningState = null) + { + tags ??= new Dictionary(); + + return new MapsResourceData( + id, + name, + resourceType, + systemData, + tags, + location, + mapsResourceProvisioningState != null ? new MapsResourceProperties(mapsResourceProvisioningState, 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(string 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(string focusedMachineId = null, string 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(string 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(string 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 DiscoverySourceResourceData DiscoverySourceResourceData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, DiscoverySourceResourceProperties properties = null) + { + tags ??= new Dictionary(); + + return new DiscoverySourceResourceData( + 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 DiscoverySourceResourceProperties DiscoverySourceResourceProperties(ProvisioningState? provisioningState = null, string sourceType = null, string sourceId = null) + { + return new UnknownDiscoverySourceResourceProperties(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 OffAzureDiscoverySourceResourceProperties OffAzureDiscoverySourceResourceProperties(ProvisioningState? provisioningState = null, string sourceId = null) + { + return new OffAzureDiscoverySourceResourceProperties(provisioningState, SourceType.OffAzure, sourceId, serializedAdditionalRawData: null); + } + } +} diff --git a/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/DiscoverySourceResource.Serialization.cs b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/DiscoverySourceResource.Serialization.cs new file mode 100644 index 000000000000..af01b2e21098 --- /dev/null +++ b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/DiscoverySourceResource.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 DiscoverySourceResource : IJsonModel + { + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); + + DiscoverySourceResourceData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)Data).Create(ref reader, options); + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options, AzureResourceManagerDependencyMapContext.Default); + + DiscoverySourceResourceData 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/DiscoverySourceResource.cs b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/DiscoverySourceResource.cs new file mode 100644 index 000000000000..bd8a50b64c51 --- /dev/null +++ b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/DiscoverySourceResource.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 DiscoverySourceResource 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 GetDiscoverySourceResource method. + /// Otherwise you can get one from its parent resource using the GetDiscoverySourceResource method. + /// + public partial class DiscoverySourceResource : 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 _discoverySourceResourceDiscoverySourcesClientDiagnostics; + private readonly DiscoverySourcesRestOperations _discoverySourceResourceDiscoverySourcesRestClient; + private readonly DiscoverySourceResourceData _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 DiscoverySourceResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal DiscoverySourceResource(ArmClient client, DiscoverySourceResourceData 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 DiscoverySourceResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _discoverySourceResourceDiscoverySourcesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DependencyMap", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string discoverySourceResourceDiscoverySourcesApiVersion); + _discoverySourceResourceDiscoverySourcesRestClient = new DiscoverySourcesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, discoverySourceResourceDiscoverySourcesApiVersion); +#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 DiscoverySourceResourceData 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 = _discoverySourceResourceDiscoverySourcesClientDiagnostics.CreateScope("DiscoverySourceResource.Get"); + scope.Start(); + try + { + var response = await _discoverySourceResourceDiscoverySourcesRestClient.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 DiscoverySourceResource(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 = _discoverySourceResourceDiscoverySourcesClientDiagnostics.CreateScope("DiscoverySourceResource.Get"); + scope.Start(); + try + { + var response = _discoverySourceResourceDiscoverySourcesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DiscoverySourceResource(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 = _discoverySourceResourceDiscoverySourcesClientDiagnostics.CreateScope("DiscoverySourceResource.Delete"); + scope.Start(); + try + { + var response = await _discoverySourceResourceDiscoverySourcesRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new DependencyMapArmOperation(_discoverySourceResourceDiscoverySourcesClientDiagnostics, Pipeline, _discoverySourceResourceDiscoverySourcesRestClient.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 = _discoverySourceResourceDiscoverySourcesClientDiagnostics.CreateScope("DiscoverySourceResource.Delete"); + scope.Start(); + try + { + var response = _discoverySourceResourceDiscoverySourcesRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + var operation = new DependencyMapArmOperation(_discoverySourceResourceDiscoverySourcesClientDiagnostics, Pipeline, _discoverySourceResourceDiscoverySourcesRestClient.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, DiscoverySourceResourcePatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(patch, nameof(patch)); + + using var scope = _discoverySourceResourceDiscoverySourcesClientDiagnostics.CreateScope("DiscoverySourceResource.Update"); + scope.Start(); + try + { + var response = await _discoverySourceResourceDiscoverySourcesRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, patch, cancellationToken).ConfigureAwait(false); + var operation = new DependencyMapArmOperation(new DiscoverySourceResourceOperationSource(Client), _discoverySourceResourceDiscoverySourcesClientDiagnostics, Pipeline, _discoverySourceResourceDiscoverySourcesRestClient.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, DiscoverySourceResourcePatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(patch, nameof(patch)); + + using var scope = _discoverySourceResourceDiscoverySourcesClientDiagnostics.CreateScope("DiscoverySourceResource.Update"); + scope.Start(); + try + { + var response = _discoverySourceResourceDiscoverySourcesRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, patch, cancellationToken); + var operation = new DependencyMapArmOperation(new DiscoverySourceResourceOperationSource(Client), _discoverySourceResourceDiscoverySourcesClientDiagnostics, Pipeline, _discoverySourceResourceDiscoverySourcesRestClient.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 = _discoverySourceResourceDiscoverySourcesClientDiagnostics.CreateScope("DiscoverySourceResource.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 _discoverySourceResourceDiscoverySourcesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new DiscoverySourceResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new DiscoverySourceResourcePatch(); + 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 = _discoverySourceResourceDiscoverySourcesClientDiagnostics.CreateScope("DiscoverySourceResource.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 = _discoverySourceResourceDiscoverySourcesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + return Response.FromValue(new DiscoverySourceResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new DiscoverySourceResourcePatch(); + 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 = _discoverySourceResourceDiscoverySourcesClientDiagnostics.CreateScope("DiscoverySourceResource.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 _discoverySourceResourceDiscoverySourcesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new DiscoverySourceResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new DiscoverySourceResourcePatch(); + 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 = _discoverySourceResourceDiscoverySourcesClientDiagnostics.CreateScope("DiscoverySourceResource.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 = _discoverySourceResourceDiscoverySourcesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + return Response.FromValue(new DiscoverySourceResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new DiscoverySourceResourcePatch(); + 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 = _discoverySourceResourceDiscoverySourcesClientDiagnostics.CreateScope("DiscoverySourceResource.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 _discoverySourceResourceDiscoverySourcesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new DiscoverySourceResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new DiscoverySourceResourcePatch(); + 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 = _discoverySourceResourceDiscoverySourcesClientDiagnostics.CreateScope("DiscoverySourceResource.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 = _discoverySourceResourceDiscoverySourcesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + return Response.FromValue(new DiscoverySourceResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new DiscoverySourceResourcePatch(); + 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/DiscoverySourceResourceCollection.cs b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/DiscoverySourceResourceCollection.cs new file mode 100644 index 000000000000..f9fe4bad6e83 --- /dev/null +++ b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/DiscoverySourceResourceCollection.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 GetDiscoverySourceResources method from an instance of . + /// + public partial class DiscoverySourceResourceCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _discoverySourceResourceDiscoverySourcesClientDiagnostics; + private readonly DiscoverySourcesRestOperations _discoverySourceResourceDiscoverySourcesRestClient; + + /// Initializes a new instance of the class for mocking. + protected DiscoverySourceResourceCollection() + { + } + + /// 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 DiscoverySourceResourceCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _discoverySourceResourceDiscoverySourcesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DependencyMap", DiscoverySourceResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(DiscoverySourceResource.ResourceType, out string discoverySourceResourceDiscoverySourcesApiVersion); + _discoverySourceResourceDiscoverySourcesRestClient = new DiscoverySourcesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, discoverySourceResourceDiscoverySourcesApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != MapsResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, MapsResource.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, DiscoverySourceResourceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(sourceName, nameof(sourceName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _discoverySourceResourceDiscoverySourcesClientDiagnostics.CreateScope("DiscoverySourceResourceCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _discoverySourceResourceDiscoverySourcesRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, sourceName, data, cancellationToken).ConfigureAwait(false); + var operation = new DependencyMapArmOperation(new DiscoverySourceResourceOperationSource(Client), _discoverySourceResourceDiscoverySourcesClientDiagnostics, Pipeline, _discoverySourceResourceDiscoverySourcesRestClient.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, DiscoverySourceResourceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(sourceName, nameof(sourceName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _discoverySourceResourceDiscoverySourcesClientDiagnostics.CreateScope("DiscoverySourceResourceCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _discoverySourceResourceDiscoverySourcesRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, sourceName, data, cancellationToken); + var operation = new DependencyMapArmOperation(new DiscoverySourceResourceOperationSource(Client), _discoverySourceResourceDiscoverySourcesClientDiagnostics, Pipeline, _discoverySourceResourceDiscoverySourcesRestClient.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 = _discoverySourceResourceDiscoverySourcesClientDiagnostics.CreateScope("DiscoverySourceResourceCollection.Get"); + scope.Start(); + try + { + var response = await _discoverySourceResourceDiscoverySourcesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, sourceName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DiscoverySourceResource(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 = _discoverySourceResourceDiscoverySourcesClientDiagnostics.CreateScope("DiscoverySourceResourceCollection.Get"); + scope.Start(); + try + { + var response = _discoverySourceResourceDiscoverySourcesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, sourceName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DiscoverySourceResource(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) => _discoverySourceResourceDiscoverySourcesRestClient.CreateListByMapsResourceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _discoverySourceResourceDiscoverySourcesRestClient.CreateListByMapsResourceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DiscoverySourceResource(Client, DiscoverySourceResourceData.DeserializeDiscoverySourceResourceData(e)), _discoverySourceResourceDiscoverySourcesClientDiagnostics, Pipeline, "DiscoverySourceResourceCollection.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) => _discoverySourceResourceDiscoverySourcesRestClient.CreateListByMapsResourceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _discoverySourceResourceDiscoverySourcesRestClient.CreateListByMapsResourceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DiscoverySourceResource(Client, DiscoverySourceResourceData.DeserializeDiscoverySourceResourceData(e)), _discoverySourceResourceDiscoverySourcesClientDiagnostics, Pipeline, "DiscoverySourceResourceCollection.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 = _discoverySourceResourceDiscoverySourcesClientDiagnostics.CreateScope("DiscoverySourceResourceCollection.Exists"); + scope.Start(); + try + { + var response = await _discoverySourceResourceDiscoverySourcesRestClient.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 = _discoverySourceResourceDiscoverySourcesClientDiagnostics.CreateScope("DiscoverySourceResourceCollection.Exists"); + scope.Start(); + try + { + var response = _discoverySourceResourceDiscoverySourcesRestClient.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 = _discoverySourceResourceDiscoverySourcesClientDiagnostics.CreateScope("DiscoverySourceResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _discoverySourceResourceDiscoverySourcesRestClient.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 DiscoverySourceResource(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 = _discoverySourceResourceDiscoverySourcesClientDiagnostics.CreateScope("DiscoverySourceResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = _discoverySourceResourceDiscoverySourcesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, sourceName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DiscoverySourceResource(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/DiscoverySourceResourceData.Serialization.cs b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/DiscoverySourceResourceData.Serialization.cs new file mode 100644 index 000000000000..c65e31036fb7 --- /dev/null +++ b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/DiscoverySourceResourceData.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 DiscoverySourceResourceData : 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(DiscoverySourceResourceData)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); + } + } + + DiscoverySourceResourceData 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(DiscoverySourceResourceData)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDiscoverySourceResourceData(document.RootElement, options); + } + + internal static DiscoverySourceResourceData DeserializeDiscoverySourceResourceData(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + DiscoverySourceResourceProperties 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 = DiscoverySourceResourceProperties.DeserializeDiscoverySourceResourceProperties(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 DiscoverySourceResourceData( + 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(DiscoverySourceResourceData)} does not support writing '{options.Format}' format."); + } + } + + DiscoverySourceResourceData 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 DeserializeDiscoverySourceResourceData(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DiscoverySourceResourceData)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/DiscoverySourceResourceData.cs b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/DiscoverySourceResourceData.cs new file mode 100644 index 000000000000..09d306dc5427 --- /dev/null +++ b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/DiscoverySourceResourceData.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 DiscoverySourceResource data model. + /// A Discovery Source resource + /// + public partial class DiscoverySourceResourceData : 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 DiscoverySourceResourceData(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 DiscoverySourceResourceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, DiscoverySourceResourceProperties properties, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) + { + Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DiscoverySourceResourceData() + { + } + + /// + /// 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 DiscoverySourceResourceProperties Properties { get; set; } + } +} 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..8ca9a2ac6150 --- /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 MapsResource GetMapsResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableDependencyMapArmClient(client).GetMapsResource(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 DiscoverySourceResource GetDiscoverySourceResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableDependencyMapArmClient(client).GetDiscoverySourceResource(id); + } + + /// + /// Gets a collection of MapsResources 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 MapsResources and their operations over a MapsResource. + public static MapsResourceCollection GetMapsResources(this ResourceGroupResource resourceGroupResource) + { + Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); + + return GetMockableDependencyMapResourceGroupResource(resourceGroupResource).GetMapsResources(); + } + + /// + /// 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> GetMapsResourceAsync(this ResourceGroupResource resourceGroupResource, string mapName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); + + return await GetMockableDependencyMapResourceGroupResource(resourceGroupResource).GetMapsResourceAsync(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 GetMapsResource(this ResourceGroupResource resourceGroupResource, string mapName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); + + return GetMockableDependencyMapResourceGroupResource(resourceGroupResource).GetMapsResource(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 GetMapsResourcesAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); + + return GetMockableDependencyMapSubscriptionResource(subscriptionResource).GetMapsResourcesAsync(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 GetMapsResources(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); + + return GetMockableDependencyMapSubscriptionResource(subscriptionResource).GetMapsResources(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..c294211bb6a4 --- /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 MapsResource GetMapsResource(ResourceIdentifier id) + { + MapsResource.ValidateResourceId(id); + return new MapsResource(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 DiscoverySourceResource GetDiscoverySourceResource(ResourceIdentifier id) + { + DiscoverySourceResource.ValidateResourceId(id); + return new DiscoverySourceResource(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..b87c26c0090b --- /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 MapsResources in the ResourceGroupResource. + /// An object representing collection of MapsResources and their operations over a MapsResource. + public virtual MapsResourceCollection GetMapsResources() + { + return GetCachedClient(client => new MapsResourceCollection(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> GetMapsResourceAsync(string mapName, CancellationToken cancellationToken = default) + { + return await GetMapsResources().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 GetMapsResource(string mapName, CancellationToken cancellationToken = default) + { + return GetMapsResources().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..cc9d1df84a21 --- /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 _mapsResourceMapsClientDiagnostics; + private MapsRestOperations _mapsResourceMapsRestClient; + + /// 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 MapsResourceMapsClientDiagnostics => _mapsResourceMapsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.DependencyMap", MapsResource.ResourceType.Namespace, Diagnostics); + private MapsRestOperations MapsResourceMapsRestClient => _mapsResourceMapsRestClient ??= new MapsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(MapsResource.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 GetMapsResourcesAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => MapsResourceMapsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => MapsResourceMapsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new MapsResource(Client, MapsResourceData.DeserializeMapsResourceData(e)), MapsResourceMapsClientDiagnostics, Pipeline, "MockableDependencyMapSubscriptionResource.GetMapsResources", "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 GetMapsResources(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => MapsResourceMapsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => MapsResourceMapsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new MapsResource(Client, MapsResourceData.DeserializeMapsResourceData(e)), MapsResourceMapsClientDiagnostics, Pipeline, "MockableDependencyMapSubscriptionResource.GetMapsResources", "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/DiscoverySourceResourceOperationSource.cs b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/LongRunningOperation/DiscoverySourceResourceOperationSource.cs new file mode 100644 index 000000000000..93ae9727b0f0 --- /dev/null +++ b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/LongRunningOperation/DiscoverySourceResourceOperationSource.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 DiscoverySourceResourceOperationSource : IOperationSource + { + private readonly ArmClient _client; + + internal DiscoverySourceResourceOperationSource(ArmClient client) + { + _client = client; + } + + DiscoverySourceResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + var data = ModelReaderWriter.Read(response.Content, ModelReaderWriterOptions.Json, AzureResourceManagerDependencyMapContext.Default); + return new DiscoverySourceResource(_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 DiscoverySourceResource(_client, data)).ConfigureAwait(false); + } + } +} diff --git a/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/LongRunningOperation/MapsResourceOperationSource.cs b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/LongRunningOperation/MapsResourceOperationSource.cs new file mode 100644 index 000000000000..4cec0cad61ce --- /dev/null +++ b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/LongRunningOperation/MapsResourceOperationSource.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 MapsResourceOperationSource : IOperationSource + { + private readonly ArmClient _client; + + internal MapsResourceOperationSource(ArmClient client) + { + _client = client; + } + + MapsResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + var data = ModelReaderWriter.Read(response.Content, ModelReaderWriterOptions.Json, AzureResourceManagerDependencyMapContext.Default); + return new MapsResource(_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 MapsResource(_client, data)).ConfigureAwait(false); + } + } +} diff --git a/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/MapsResource.Serialization.cs b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/MapsResource.Serialization.cs new file mode 100644 index 000000000000..3a790dbd49c4 --- /dev/null +++ b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/MapsResource.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 MapsResource : IJsonModel + { + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); + + MapsResourceData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)Data).Create(ref reader, options); + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options, AzureResourceManagerDependencyMapContext.Default); + + MapsResourceData 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/MapsResource.cs b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/MapsResource.cs new file mode 100644 index 000000000000..a89063002380 --- /dev/null +++ b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/MapsResource.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 MapsResource 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 GetMapsResource method. + /// Otherwise you can get one from its parent resource using the GetMapsResource method. + /// + public partial class MapsResource : 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 _mapsResourceMapsClientDiagnostics; + private readonly MapsRestOperations _mapsResourceMapsRestClient; + private readonly MapsResourceData _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 MapsResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal MapsResource(ArmClient client, MapsResourceData 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 MapsResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _mapsResourceMapsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DependencyMap", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string mapsResourceMapsApiVersion); + _mapsResourceMapsRestClient = new MapsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, mapsResourceMapsApiVersion); +#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 MapsResourceData 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 DiscoverySourceResources in the MapsResource. + /// An object representing collection of DiscoverySourceResources and their operations over a DiscoverySourceResource. + public virtual DiscoverySourceResourceCollection GetDiscoverySourceResources() + { + return GetCachedClient(client => new DiscoverySourceResourceCollection(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> GetDiscoverySourceResourceAsync(string sourceName, CancellationToken cancellationToken = default) + { + return await GetDiscoverySourceResources().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 GetDiscoverySourceResource(string sourceName, CancellationToken cancellationToken = default) + { + return GetDiscoverySourceResources().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 = _mapsResourceMapsClientDiagnostics.CreateScope("MapsResource.Get"); + scope.Start(); + try + { + var response = await _mapsResourceMapsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new MapsResource(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 = _mapsResourceMapsClientDiagnostics.CreateScope("MapsResource.Get"); + scope.Start(); + try + { + var response = _mapsResourceMapsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new MapsResource(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 = _mapsResourceMapsClientDiagnostics.CreateScope("MapsResource.Delete"); + scope.Start(); + try + { + var response = await _mapsResourceMapsRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new DependencyMapArmOperation(_mapsResourceMapsClientDiagnostics, Pipeline, _mapsResourceMapsRestClient.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 = _mapsResourceMapsClientDiagnostics.CreateScope("MapsResource.Delete"); + scope.Start(); + try + { + var response = _mapsResourceMapsRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + var operation = new DependencyMapArmOperation(_mapsResourceMapsClientDiagnostics, Pipeline, _mapsResourceMapsRestClient.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, MapsResourcePatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(patch, nameof(patch)); + + using var scope = _mapsResourceMapsClientDiagnostics.CreateScope("MapsResource.Update"); + scope.Start(); + try + { + var response = await _mapsResourceMapsRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch, cancellationToken).ConfigureAwait(false); + var operation = new DependencyMapArmOperation(new MapsResourceOperationSource(Client), _mapsResourceMapsClientDiagnostics, Pipeline, _mapsResourceMapsRestClient.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, MapsResourcePatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(patch, nameof(patch)); + + using var scope = _mapsResourceMapsClientDiagnostics.CreateScope("MapsResource.Update"); + scope.Start(); + try + { + var response = _mapsResourceMapsRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch, cancellationToken); + var operation = new DependencyMapArmOperation(new MapsResourceOperationSource(Client), _mapsResourceMapsClientDiagnostics, Pipeline, _mapsResourceMapsRestClient.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 = _mapsResourceMapsClientDiagnostics.CreateScope("MapsResource.GetDependencyViewForFocusedMachine"); + scope.Start(); + try + { + var response = await _mapsResourceMapsRestClient.GetDependencyViewForFocusedMachineAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, content, cancellationToken).ConfigureAwait(false); + var operation = new DependencyMapArmOperation(_mapsResourceMapsClientDiagnostics, Pipeline, _mapsResourceMapsRestClient.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 = _mapsResourceMapsClientDiagnostics.CreateScope("MapsResource.GetDependencyViewForFocusedMachine"); + scope.Start(); + try + { + var response = _mapsResourceMapsRestClient.GetDependencyViewForFocusedMachine(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, content, cancellationToken); + var operation = new DependencyMapArmOperation(_mapsResourceMapsClientDiagnostics, Pipeline, _mapsResourceMapsRestClient.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 = _mapsResourceMapsClientDiagnostics.CreateScope("MapsResource.GetConnectionsWithConnectedMachineForFocusedMachine"); + scope.Start(); + try + { + var response = await _mapsResourceMapsRestClient.GetConnectionsWithConnectedMachineForFocusedMachineAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, content, cancellationToken).ConfigureAwait(false); + var operation = new DependencyMapArmOperation(_mapsResourceMapsClientDiagnostics, Pipeline, _mapsResourceMapsRestClient.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 = _mapsResourceMapsClientDiagnostics.CreateScope("MapsResource.GetConnectionsWithConnectedMachineForFocusedMachine"); + scope.Start(); + try + { + var response = _mapsResourceMapsRestClient.GetConnectionsWithConnectedMachineForFocusedMachine(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, content, cancellationToken); + var operation = new DependencyMapArmOperation(_mapsResourceMapsClientDiagnostics, Pipeline, _mapsResourceMapsRestClient.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 = _mapsResourceMapsClientDiagnostics.CreateScope("MapsResource.GetConnectionsForProcessOnFocusedMachine"); + scope.Start(); + try + { + var response = await _mapsResourceMapsRestClient.GetConnectionsForProcessOnFocusedMachineAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, content, cancellationToken).ConfigureAwait(false); + var operation = new DependencyMapArmOperation(_mapsResourceMapsClientDiagnostics, Pipeline, _mapsResourceMapsRestClient.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 = _mapsResourceMapsClientDiagnostics.CreateScope("MapsResource.GetConnectionsForProcessOnFocusedMachine"); + scope.Start(); + try + { + var response = _mapsResourceMapsRestClient.GetConnectionsForProcessOnFocusedMachine(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, content, cancellationToken); + var operation = new DependencyMapArmOperation(_mapsResourceMapsClientDiagnostics, Pipeline, _mapsResourceMapsRestClient.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 = _mapsResourceMapsClientDiagnostics.CreateScope("MapsResource.ExportDependencies"); + scope.Start(); + try + { + var response = await _mapsResourceMapsRestClient.ExportDependenciesAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, content, cancellationToken).ConfigureAwait(false); + var operation = new DependencyMapArmOperation(_mapsResourceMapsClientDiagnostics, Pipeline, _mapsResourceMapsRestClient.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 = _mapsResourceMapsClientDiagnostics.CreateScope("MapsResource.ExportDependencies"); + scope.Start(); + try + { + var response = _mapsResourceMapsRestClient.ExportDependencies(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, content, cancellationToken); + var operation = new DependencyMapArmOperation(_mapsResourceMapsClientDiagnostics, Pipeline, _mapsResourceMapsRestClient.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 = _mapsResourceMapsClientDiagnostics.CreateScope("MapsResource.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 _mapsResourceMapsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new MapsResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new MapsResourcePatch(); + 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 = _mapsResourceMapsClientDiagnostics.CreateScope("MapsResource.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 = _mapsResourceMapsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + return Response.FromValue(new MapsResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new MapsResourcePatch(); + 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 = _mapsResourceMapsClientDiagnostics.CreateScope("MapsResource.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 _mapsResourceMapsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new MapsResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new MapsResourcePatch(); + 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 = _mapsResourceMapsClientDiagnostics.CreateScope("MapsResource.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 = _mapsResourceMapsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + return Response.FromValue(new MapsResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new MapsResourcePatch(); + 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 = _mapsResourceMapsClientDiagnostics.CreateScope("MapsResource.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 _mapsResourceMapsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new MapsResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new MapsResourcePatch(); + 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 = _mapsResourceMapsClientDiagnostics.CreateScope("MapsResource.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 = _mapsResourceMapsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + return Response.FromValue(new MapsResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new MapsResourcePatch(); + 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/MapsResourceCollection.cs b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/MapsResourceCollection.cs new file mode 100644 index 000000000000..d690aa0d114f --- /dev/null +++ b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/MapsResourceCollection.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 GetMapsResources method from an instance of . + /// + public partial class MapsResourceCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _mapsResourceMapsClientDiagnostics; + private readonly MapsRestOperations _mapsResourceMapsRestClient; + + /// Initializes a new instance of the class for mocking. + protected MapsResourceCollection() + { + } + + /// 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 MapsResourceCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _mapsResourceMapsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DependencyMap", MapsResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(MapsResource.ResourceType, out string mapsResourceMapsApiVersion); + _mapsResourceMapsRestClient = new MapsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, mapsResourceMapsApiVersion); +#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, MapsResourceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(mapName, nameof(mapName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _mapsResourceMapsClientDiagnostics.CreateScope("MapsResourceCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _mapsResourceMapsRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, mapName, data, cancellationToken).ConfigureAwait(false); + var operation = new DependencyMapArmOperation(new MapsResourceOperationSource(Client), _mapsResourceMapsClientDiagnostics, Pipeline, _mapsResourceMapsRestClient.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, MapsResourceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(mapName, nameof(mapName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _mapsResourceMapsClientDiagnostics.CreateScope("MapsResourceCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _mapsResourceMapsRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, mapName, data, cancellationToken); + var operation = new DependencyMapArmOperation(new MapsResourceOperationSource(Client), _mapsResourceMapsClientDiagnostics, Pipeline, _mapsResourceMapsRestClient.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 = _mapsResourceMapsClientDiagnostics.CreateScope("MapsResourceCollection.Get"); + scope.Start(); + try + { + var response = await _mapsResourceMapsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, mapName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new MapsResource(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 = _mapsResourceMapsClientDiagnostics.CreateScope("MapsResourceCollection.Get"); + scope.Start(); + try + { + var response = _mapsResourceMapsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, mapName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new MapsResource(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) => _mapsResourceMapsRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _mapsResourceMapsRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new MapsResource(Client, MapsResourceData.DeserializeMapsResourceData(e)), _mapsResourceMapsClientDiagnostics, Pipeline, "MapsResourceCollection.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) => _mapsResourceMapsRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _mapsResourceMapsRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new MapsResource(Client, MapsResourceData.DeserializeMapsResourceData(e)), _mapsResourceMapsClientDiagnostics, Pipeline, "MapsResourceCollection.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 = _mapsResourceMapsClientDiagnostics.CreateScope("MapsResourceCollection.Exists"); + scope.Start(); + try + { + var response = await _mapsResourceMapsRestClient.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 = _mapsResourceMapsClientDiagnostics.CreateScope("MapsResourceCollection.Exists"); + scope.Start(); + try + { + var response = _mapsResourceMapsRestClient.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 = _mapsResourceMapsClientDiagnostics.CreateScope("MapsResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _mapsResourceMapsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, mapName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MapsResource(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 = _mapsResourceMapsClientDiagnostics.CreateScope("MapsResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = _mapsResourceMapsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, mapName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MapsResource(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/MapsResourceData.Serialization.cs b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/MapsResourceData.Serialization.cs new file mode 100644 index 000000000000..ca2dd9472fdc --- /dev/null +++ b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/MapsResourceData.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 MapsResourceData : 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(MapsResourceData)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); + } + } + + MapsResourceData 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(MapsResourceData)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeMapsResourceData(document.RootElement, options); + } + + internal static MapsResourceData DeserializeMapsResourceData(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + MapsResourceProperties 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 = MapsResourceProperties.DeserializeMapsResourceProperties(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 MapsResourceData( + 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(MapsResourceData)} does not support writing '{options.Format}' format."); + } + } + + MapsResourceData 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 DeserializeMapsResourceData(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(MapsResourceData)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/MapsResourceData.cs b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/MapsResourceData.cs new file mode 100644 index 000000000000..beafdfe4b15c --- /dev/null +++ b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/MapsResourceData.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 MapsResource data model. + /// A Maps resource + /// + public partial class MapsResourceData : 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 MapsResourceData(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 MapsResourceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, MapsResourceProperties properties, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) + { + Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal MapsResourceData() + { + } + + /// The resource-specific properties for this resource. + internal MapsResourceProperties Properties { get; set; } + /// Provisioning state of Maps resource. + public ProvisioningState? MapsResourceProvisioningState + { + get => Properties is null ? default : Properties.ProvisioningState; + } + } +} 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/DateTimeFilter.Serialization.cs b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Models/DateTimeFilter.Serialization.cs new file mode 100644 index 000000000000..375d2f760ab8 --- /dev/null +++ b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Models/DateTimeFilter.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 DateTimeFilter : 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(DateTimeFilter)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(StartDateTimeUtc)) + { + writer.WritePropertyName("startDateTimeUtc"u8); + writer.WriteStringValue(StartDateTimeUtc.Value, "O"); + } + if (Optional.IsDefined(EndDateTimeUtc)) + { + writer.WritePropertyName("endDateTimeUtc"u8); + writer.WriteStringValue(EndDateTimeUtc.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 + } + } + } + + DateTimeFilter 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(DateTimeFilter)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDateTimeFilter(document.RootElement, options); + } + + internal static DateTimeFilter DeserializeDateTimeFilter(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 DateTimeFilter(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(DateTimeFilter)} does not support writing '{options.Format}' format."); + } + } + + DateTimeFilter 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 DeserializeDateTimeFilter(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DateTimeFilter)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Models/DateTimeFilter.cs b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Models/DateTimeFilter.cs new file mode 100644 index 000000000000..b868c07edd8f --- /dev/null +++ b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Models/DateTimeFilter.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 DateTimeFilter + { + /// + /// 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 DateTimeFilter() + { + } + + /// 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 DateTimeFilter(DateTimeOffset? startDateTimeUtc, DateTimeOffset? endDateTimeUtc, IDictionary serializedAdditionalRawData) + { + StartDateTimeUtc = startDateTimeUtc; + EndDateTimeUtc = endDateTimeUtc; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Start date time for dependency map visualization query. + public DateTimeOffset? StartDateTimeUtc { get; set; } + /// End date time for dependency map visualization query. + public DateTimeOffset? EndDateTimeUtc { get; set; } + } +} 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..03c29b3160a0 --- /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; + } + DateTimeFilter dateTime = default; + ProcessNameFilter 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 = DateTimeFilter.DeserializeDateTimeFilter(property.Value, options); + continue; + } + if (property.NameEquals("processNameFilter"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + processNameFilter = ProcessNameFilter.DeserializeProcessNameFilter(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..c2d1ddc2a0d6 --- /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(DateTimeFilter dateTime, ProcessNameFilter processNameFilter, IDictionary serializedAdditionalRawData) + { + DateTime = dateTime; + ProcessNameFilter = processNameFilter; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// DateTime filter. + public DateTimeFilter DateTime { get; set; } + /// Process name filter. + public ProcessNameFilter 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..1f209cd175e8 --- /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(DiscoverySourceResourceData.DeserializeDiscoverySourceResourceData(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..dcfd6ebfb123 --- /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/DiscoverySourceResourcePatch.Serialization.cs b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Models/DiscoverySourceResourcePatch.Serialization.cs new file mode 100644 index 000000000000..ba4cd908f0af --- /dev/null +++ b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Models/DiscoverySourceResourcePatch.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 DiscoverySourceResourcePatch : 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(DiscoverySourceResourcePatch)} 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 + } + } + } + + DiscoverySourceResourcePatch 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(DiscoverySourceResourcePatch)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDiscoverySourceResourcePatch(document.RootElement, options); + } + + internal static DiscoverySourceResourcePatch DeserializeDiscoverySourceResourcePatch(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 DiscoverySourceResourcePatch(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(DiscoverySourceResourcePatch)} does not support writing '{options.Format}' format."); + } + } + + DiscoverySourceResourcePatch 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 DeserializeDiscoverySourceResourcePatch(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DiscoverySourceResourcePatch)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Models/DiscoverySourceResourcePatch.cs b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Models/DiscoverySourceResourcePatch.cs new file mode 100644 index 000000000000..297fb82be416 --- /dev/null +++ b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Models/DiscoverySourceResourcePatch.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 DiscoverySourceResourcePatch + { + /// + /// 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 DiscoverySourceResourcePatch() + { + Tags = new ChangeTrackingDictionary(); + } + + /// Initializes a new instance of . + /// Resource tags. + /// Keeps track of any properties unknown to the library. + internal DiscoverySourceResourcePatch(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/DiscoverySourceResourceProperties.Serialization.cs b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Models/DiscoverySourceResourceProperties.Serialization.cs new file mode 100644 index 000000000000..7b96f465dcd6 --- /dev/null +++ b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Models/DiscoverySourceResourceProperties.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(UnknownDiscoverySourceResourceProperties))] + public partial class DiscoverySourceResourceProperties : 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(DiscoverySourceResourceProperties)} 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 + } + } + } + + DiscoverySourceResourceProperties 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(DiscoverySourceResourceProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDiscoverySourceResourceProperties(document.RootElement, options); + } + + internal static DiscoverySourceResourceProperties DeserializeDiscoverySourceResourceProperties(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 OffAzureDiscoverySourceResourceProperties.DeserializeOffAzureDiscoverySourceResourceProperties(element, options); + } + } + return UnknownDiscoverySourceResourceProperties.DeserializeUnknownDiscoverySourceResourceProperties(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(DiscoverySourceResourceProperties)} does not support writing '{options.Format}' format."); + } + } + + DiscoverySourceResourceProperties 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 DeserializeDiscoverySourceResourceProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DiscoverySourceResourceProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Models/DiscoverySourceResourceProperties.cs b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Models/DiscoverySourceResourceProperties.cs new file mode 100644 index 000000000000..e7e871ce23af --- /dev/null +++ b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Models/DiscoverySourceResourceProperties.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; + +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 DiscoverySourceResourceProperties + { + /// + /// 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 DiscoverySourceResourceProperties(string 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 DiscoverySourceResourceProperties(ProvisioningState? provisioningState, SourceType sourceType, string sourceId, IDictionary serializedAdditionalRawData) + { + ProvisioningState = provisioningState; + SourceType = sourceType; + SourceId = sourceId; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DiscoverySourceResourceProperties() + { + } + + /// Provisioning state of Discovery Source resource. + public ProvisioningState? ProvisioningState { get; } + /// Source type of Discovery Source resource. + internal SourceType SourceType { get; set; } + /// Source ArmId of Discovery Source resource. + public string SourceId { get; set; } + } +} 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..24092d0a67ab --- /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; + } + string focusedMachineId = default; + DependencyMapVisualizationFilter filters = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("focusedMachineId"u8)) + { + focusedMachineId = 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..4459196293f2 --- /dev/null +++ b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Models/ExportDependenciesContent.cs @@ -0,0 +1,79 @@ +// 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 +{ + /// 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(string 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(string focusedMachineId, DependencyMapVisualizationFilter filters, IDictionary serializedAdditionalRawData) + { + FocusedMachineId = focusedMachineId; + Filters = filters; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ExportDependenciesContent() + { + } + + /// Machine arm id. + public string 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..a98dafb781b6 --- /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; + } + string 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 = 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..482940e9b8b8 --- /dev/null +++ b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Models/GetConnectionsForProcessOnFocusedMachineContent.cs @@ -0,0 +1,86 @@ +// 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 +{ + /// 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(string 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(string 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 string 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..09053cd823df --- /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; + } + string focusedMachineId = default; + string connectedMachineId = default; + DependencyMapVisualizationFilter filters = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("focusedMachineId"u8)) + { + focusedMachineId = property.Value.GetString(); + continue; + } + if (property.NameEquals("connectedMachineId"u8)) + { + connectedMachineId = 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..1902d91c88a0 --- /dev/null +++ b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Models/GetConnectionsWithConnectedMachineForFocusedMachineContent.cs @@ -0,0 +1,86 @@ +// 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 +{ + /// 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(string focusedMachineId, string 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(string focusedMachineId, string 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 string FocusedMachineId { get; } + /// Destination machine arm id. + public string 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..d32528f40e4f --- /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; + } + string focusedMachineId = default; + DependencyMapVisualizationFilter filters = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("focusedMachineId"u8)) + { + focusedMachineId = 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..0460469f0b09 --- /dev/null +++ b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Models/GetDependencyViewForFocusedMachineContent.cs @@ -0,0 +1,79 @@ +// 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 +{ + /// 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(string 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(string focusedMachineId, DependencyMapVisualizationFilter filters, IDictionary serializedAdditionalRawData) + { + FocusedMachineId = focusedMachineId; + Filters = filters; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal GetDependencyViewForFocusedMachineContent() + { + } + + /// Machine arm id. + public string 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..db58a0865412 --- /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(MapsResourceData.DeserializeMapsResourceData(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..1c7aa41f27b6 --- /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/MapsResourcePatch.Serialization.cs b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Models/MapsResourcePatch.Serialization.cs new file mode 100644 index 000000000000..a05371d4c8a1 --- /dev/null +++ b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Models/MapsResourcePatch.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 MapsResourcePatch : 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(MapsResourcePatch)} 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 + } + } + } + + MapsResourcePatch 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(MapsResourcePatch)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeMapsResourcePatch(document.RootElement, options); + } + + internal static MapsResourcePatch DeserializeMapsResourcePatch(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 MapsResourcePatch(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(MapsResourcePatch)} does not support writing '{options.Format}' format."); + } + } + + MapsResourcePatch 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 DeserializeMapsResourcePatch(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(MapsResourcePatch)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Models/MapsResourcePatch.cs b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Models/MapsResourcePatch.cs new file mode 100644 index 000000000000..2355f261e756 --- /dev/null +++ b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Models/MapsResourcePatch.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 MapsResourcePatch + { + /// + /// 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 MapsResourcePatch() + { + Tags = new ChangeTrackingDictionary(); + } + + /// Initializes a new instance of . + /// Resource tags. + /// Keeps track of any properties unknown to the library. + internal MapsResourcePatch(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/MapsResourceProperties.Serialization.cs b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Models/MapsResourceProperties.Serialization.cs new file mode 100644 index 000000000000..415acaa417c4 --- /dev/null +++ b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Models/MapsResourceProperties.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 MapsResourceProperties : 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(MapsResourceProperties)} 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 + } + } + } + + MapsResourceProperties 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(MapsResourceProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeMapsResourceProperties(document.RootElement, options); + } + + internal static MapsResourceProperties DeserializeMapsResourceProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ProvisioningState? 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 ProvisioningState(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new MapsResourceProperties(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(MapsResourceProperties)} does not support writing '{options.Format}' format."); + } + } + + MapsResourceProperties 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 DeserializeMapsResourceProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(MapsResourceProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Models/MapsResourceProperties.cs b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Models/MapsResourceProperties.cs new file mode 100644 index 000000000000..d11433df6b96 --- /dev/null +++ b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Models/MapsResourceProperties.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 MapsResourceProperties + { + /// + /// 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 MapsResourceProperties() + { + } + + /// Initializes a new instance of . + /// Provisioning state of Maps resource. + /// Keeps track of any properties unknown to the library. + internal MapsResourceProperties(ProvisioningState? provisioningState, IDictionary serializedAdditionalRawData) + { + ProvisioningState = provisioningState; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Provisioning state of Maps resource. + public ProvisioningState? ProvisioningState { get; } + } +} diff --git a/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Models/OffAzureDiscoverySourceResourceProperties.Serialization.cs b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Models/OffAzureDiscoverySourceResourceProperties.Serialization.cs new file mode 100644 index 000000000000..04ba9eaae3a3 --- /dev/null +++ b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Models/OffAzureDiscoverySourceResourceProperties.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 OffAzureDiscoverySourceResourceProperties : 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(OffAzureDiscoverySourceResourceProperties)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + } + + OffAzureDiscoverySourceResourceProperties 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(OffAzureDiscoverySourceResourceProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeOffAzureDiscoverySourceResourceProperties(document.RootElement, options); + } + + internal static OffAzureDiscoverySourceResourceProperties DeserializeOffAzureDiscoverySourceResourceProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ProvisioningState? provisioningState = default; + SourceType sourceType = default; + string 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 ProvisioningState(property.Value.GetString()); + continue; + } + if (property.NameEquals("sourceType"u8)) + { + sourceType = new SourceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("sourceId"u8)) + { + sourceId = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new OffAzureDiscoverySourceResourceProperties(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(OffAzureDiscoverySourceResourceProperties)} does not support writing '{options.Format}' format."); + } + } + + OffAzureDiscoverySourceResourceProperties 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 DeserializeOffAzureDiscoverySourceResourceProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(OffAzureDiscoverySourceResourceProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Models/OffAzureDiscoverySourceResourceProperties.cs b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Models/OffAzureDiscoverySourceResourceProperties.cs new file mode 100644 index 000000000000..61cb3d3925ef --- /dev/null +++ b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Models/OffAzureDiscoverySourceResourceProperties.cs @@ -0,0 +1,41 @@ +// 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 +{ + /// OffAzure discovery source resource properties. + public partial class OffAzureDiscoverySourceResourceProperties : DiscoverySourceResourceProperties + { + /// Initializes a new instance of . + /// Source ArmId of Discovery Source resource. + /// is null. + public OffAzureDiscoverySourceResourceProperties(string 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 OffAzureDiscoverySourceResourceProperties(ProvisioningState? provisioningState, SourceType sourceType, string sourceId, IDictionary serializedAdditionalRawData) : base(provisioningState, sourceType, sourceId, serializedAdditionalRawData) + { + SourceType = sourceType; + } + + /// Initializes a new instance of for deserialization. + internal OffAzureDiscoverySourceResourceProperties() + { + } + } +} diff --git a/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Models/ProcessNameFilter.Serialization.cs b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Models/ProcessNameFilter.Serialization.cs new file mode 100644 index 000000000000..4e1e93f2c48b --- /dev/null +++ b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Models/ProcessNameFilter.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 ProcessNameFilter : 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(ProcessNameFilter)} 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 + } + } + } + + ProcessNameFilter 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(ProcessNameFilter)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeProcessNameFilter(document.RootElement, options); + } + + internal static ProcessNameFilter DeserializeProcessNameFilter(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ProcessNameFilterOperator @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 ProcessNameFilterOperator(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 ProcessNameFilter(@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(ProcessNameFilter)} does not support writing '{options.Format}' format."); + } + } + + ProcessNameFilter 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 DeserializeProcessNameFilter(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ProcessNameFilter)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Models/ProcessNameFilter.cs b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Models/ProcessNameFilter.cs new file mode 100644 index 000000000000..229da56b7458 --- /dev/null +++ b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Models/ProcessNameFilter.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 ProcessNameFilter + { + /// + /// 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 ProcessNameFilter(ProcessNameFilterOperator @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 ProcessNameFilter(ProcessNameFilterOperator @operator, IList processNames, IDictionary serializedAdditionalRawData) + { + Operator = @operator; + ProcessNames = processNames; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ProcessNameFilter() + { + } + + /// Operator for process name filter. + public ProcessNameFilterOperator 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/ProcessNameFilterOperator.cs b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Models/ProcessNameFilterOperator.cs new file mode 100644 index 000000000000..908487d6539d --- /dev/null +++ b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Models/ProcessNameFilterOperator.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 ProcessNameFilterOperator : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public ProcessNameFilterOperator(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 ProcessNameFilterOperator Contains { get; } = new ProcessNameFilterOperator(ContainsValue); + /// Operator to exclude items in the result. + public static ProcessNameFilterOperator NotContains { get; } = new ProcessNameFilterOperator(NotContainsValue); + /// Determines if two values are the same. + public static bool operator ==(ProcessNameFilterOperator left, ProcessNameFilterOperator right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ProcessNameFilterOperator left, ProcessNameFilterOperator right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator ProcessNameFilterOperator(string value) => new ProcessNameFilterOperator(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ProcessNameFilterOperator other && Equals(other); + /// + public bool Equals(ProcessNameFilterOperator 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/ProvisioningState.cs b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Models/ProvisioningState.cs new file mode 100644 index 000000000000..8ea619102b6f --- /dev/null +++ b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Models/ProvisioningState.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 ProvisioningState : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public ProvisioningState(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string 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 ProvisioningState Succeeded { get; } = new ProvisioningState(SucceededValue); + /// Resource creation failed. + public static ProvisioningState Failed { get; } = new ProvisioningState(FailedValue); + /// Resource creation was canceled. + public static ProvisioningState Canceled { get; } = new ProvisioningState(CanceledValue); + /// This state indicates that the resource is being provisioned. + public static ProvisioningState Provisioning { get; } = new ProvisioningState(ProvisioningValue); + /// This state indicates that the resource is being updated. + public static ProvisioningState Updating { get; } = new ProvisioningState(UpdatingValue); + /// This state indicates that the resource is being deleted. + public static ProvisioningState Deleting { get; } = new ProvisioningState(DeletingValue); + /// This state indicates that the operation on the resource has been accepted. + public static ProvisioningState Accepted { get; } = new ProvisioningState(AcceptedValue); + /// Determines if two values are the same. + public static bool operator ==(ProvisioningState left, ProvisioningState right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ProvisioningState left, ProvisioningState right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator ProvisioningState(string value) => new ProvisioningState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ProvisioningState other && Equals(other); + /// + public bool Equals(ProvisioningState other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} 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/UnknownDiscoverySourceResourceProperties.Serialization.cs b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Models/UnknownDiscoverySourceResourceProperties.Serialization.cs new file mode 100644 index 000000000000..815fd2551bac --- /dev/null +++ b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Models/UnknownDiscoverySourceResourceProperties.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 UnknownDiscoverySourceResourceProperties : 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(DiscoverySourceResourceProperties)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + } + + DiscoverySourceResourceProperties 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(DiscoverySourceResourceProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDiscoverySourceResourceProperties(document.RootElement, options); + } + + internal static UnknownDiscoverySourceResourceProperties DeserializeUnknownDiscoverySourceResourceProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ProvisioningState? provisioningState = default; + SourceType sourceType = "Unknown"; + string 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 ProvisioningState(property.Value.GetString()); + continue; + } + if (property.NameEquals("sourceType"u8)) + { + sourceType = new SourceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("sourceId"u8)) + { + sourceId = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new UnknownDiscoverySourceResourceProperties(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(DiscoverySourceResourceProperties)} does not support writing '{options.Format}' format."); + } + } + + DiscoverySourceResourceProperties 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 DeserializeDiscoverySourceResourceProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DiscoverySourceResourceProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Models/UnknownDiscoverySourceResourceProperties.cs b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Models/UnknownDiscoverySourceResourceProperties.cs new file mode 100644 index 000000000000..03ea8ffcf8f2 --- /dev/null +++ b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/src/Generated/Models/UnknownDiscoverySourceResourceProperties.cs @@ -0,0 +1,31 @@ +// 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 +{ + /// Unknown version of DiscoverySourceResourceProperties. + internal partial class UnknownDiscoverySourceResourceProperties : DiscoverySourceResourceProperties + { + /// 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 UnknownDiscoverySourceResourceProperties(ProvisioningState? provisioningState, SourceType sourceType, string sourceId, IDictionary serializedAdditionalRawData) : base(provisioningState, sourceType, sourceId, serializedAdditionalRawData) + { + SourceType = sourceType; + } + + /// Initializes a new instance of for deserialization. + internal UnknownDiscoverySourceResourceProperties() + { + } + } +} 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..7280c7e53228 --- /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: + { + DiscoverySourceResourceData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = DiscoverySourceResourceData.DeserializeDiscoverySourceResourceData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((DiscoverySourceResourceData)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: + { + DiscoverySourceResourceData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = DiscoverySourceResourceData.DeserializeDiscoverySourceResourceData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((DiscoverySourceResourceData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, string resourceGroupName, string mapName, string sourceName, DiscoverySourceResourceData 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, DiscoverySourceResourceData 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, DiscoverySourceResourceData 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, DiscoverySourceResourceData 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, DiscoverySourceResourcePatch 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, DiscoverySourceResourcePatch 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, DiscoverySourceResourcePatch 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, DiscoverySourceResourcePatch 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..9a0363efa963 --- /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: + { + MapsResourceData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = MapsResourceData.DeserializeMapsResourceData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((MapsResourceData)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: + { + MapsResourceData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = MapsResourceData.DeserializeMapsResourceData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((MapsResourceData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, string resourceGroupName, string mapName, MapsResourceData 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, MapsResourceData 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, MapsResourceData 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, MapsResourceData 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, MapsResourcePatch 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, MapsResourcePatch 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, MapsResourcePatch 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, MapsResourcePatch 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..602d0c7167b5 --- /dev/null +++ b/sdk/dependencymap/Azure.ResourceManager.DependencyMap/tsp-location.yaml @@ -0,0 +1,4 @@ +directory: specification/azuredependencymap/DependencyMap.Management +commit: 0c929c78c4b7892c20cdfee10ddebb97cdf9d8a9 +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/lambdatesthyperexecute/Azure.ResourceManager.LambdaTestHyperExecute/samples/Generated/Samples/Sample_LambdaTestHyperExecuteOrganizationCollection.cs b/sdk/lambdatesthyperexecute/Azure.ResourceManager.LambdaTestHyperExecute/samples/Generated/Samples/Sample_LambdaTestHyperExecuteOrganizationCollection.cs index 3c49557edc93..a7b137a1d756 100644 --- a/sdk/lambdatesthyperexecute/Azure.ResourceManager.LambdaTestHyperExecute/samples/Generated/Samples/Sample_LambdaTestHyperExecuteOrganizationCollection.cs +++ b/sdk/lambdatesthyperexecute/Azure.ResourceManager.LambdaTestHyperExecute/samples/Generated/Samples/Sample_LambdaTestHyperExecuteOrganizationCollection.cs @@ -22,7 +22,7 @@ public partial class Sample_LambdaTestHyperExecuteOrganizationCollection [Ignore("Only validating compilation of examples")] public async Task CreateOrUpdate_OrganizationsCreateOrUpdateMaximumSetGenGeneratedByMaximumSetRuleGeneratedByMaximumSetRuleGeneratedByMaximumSetRule() { - // Generated from example definition: 2024-02-01-preview/Organizations_CreateOrUpdate_MaximumSet_Gen.json + // Generated from example definition: 2024-02-01/Organizations_CreateOrUpdate_MaximumSet_Gen.json // this example is just showing the usage of "OrganizationResource_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 @@ -89,7 +89,7 @@ public async Task CreateOrUpdate_OrganizationsCreateOrUpdateMaximumSetGenGenerat [Ignore("Only validating compilation of examples")] public async Task Get_OrganizationsGetMaximumSetGenGeneratedByMaximumSetRuleGeneratedByMaximumSetRuleGeneratedByMaximumSetRule() { - // Generated from example definition: 2024-02-01-preview/Organizations_Get_MaximumSet_Gen.json + // Generated from example definition: 2024-02-01/Organizations_Get_MaximumSet_Gen.json // this example is just showing the usage of "OrganizationResource_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 @@ -122,7 +122,7 @@ public async Task Get_OrganizationsGetMaximumSetGenGeneratedByMaximumSetRuleGene [Ignore("Only validating compilation of examples")] public async Task GetAll_OrganizationsListByResourceGroupMaximumSetGenGeneratedByMaximumSetRuleGeneratedByMaximumSetRuleGeneratedByMaximumSetRule() { - // Generated from example definition: 2024-02-01-preview/Organizations_ListByResourceGroup_MaximumSet_Gen.json + // Generated from example definition: 2024-02-01/Organizations_ListByResourceGroup_MaximumSet_Gen.json // this example is just showing the usage of "OrganizationResource_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 @@ -157,7 +157,7 @@ public async Task GetAll_OrganizationsListByResourceGroupMaximumSetGenGeneratedB [Ignore("Only validating compilation of examples")] public async Task GetAll_OrganizationsListByResourceGroupMaximumSetGenGeneratedByMaximumSetRuleGeneratedByMaximumSetRuleGeneratedByMinimumSetRule() { - // Generated from example definition: 2024-02-01-preview/Organizations_ListByResourceGroup_MinimumSet_Gen.json + // Generated from example definition: 2024-02-01/Organizations_ListByResourceGroup_MinimumSet_Gen.json // this example is just showing the usage of "OrganizationResource_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 @@ -192,7 +192,7 @@ public async Task GetAll_OrganizationsListByResourceGroupMaximumSetGenGeneratedB [Ignore("Only validating compilation of examples")] public async Task Exists_OrganizationsGetMaximumSetGenGeneratedByMaximumSetRuleGeneratedByMaximumSetRuleGeneratedByMaximumSetRule() { - // Generated from example definition: 2024-02-01-preview/Organizations_Get_MaximumSet_Gen.json + // Generated from example definition: 2024-02-01/Organizations_Get_MaximumSet_Gen.json // this example is just showing the usage of "OrganizationResource_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 @@ -221,7 +221,7 @@ public async Task Exists_OrganizationsGetMaximumSetGenGeneratedByMaximumSetRuleG [Ignore("Only validating compilation of examples")] public async Task GetIfExists_OrganizationsGetMaximumSetGenGeneratedByMaximumSetRuleGeneratedByMaximumSetRuleGeneratedByMaximumSetRule() { - // Generated from example definition: 2024-02-01-preview/Organizations_Get_MaximumSet_Gen.json + // Generated from example definition: 2024-02-01/Organizations_Get_MaximumSet_Gen.json // this example is just showing the usage of "OrganizationResource_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 diff --git a/sdk/lambdatesthyperexecute/Azure.ResourceManager.LambdaTestHyperExecute/samples/Generated/Samples/Sample_LambdaTestHyperExecuteOrganizationResource.cs b/sdk/lambdatesthyperexecute/Azure.ResourceManager.LambdaTestHyperExecute/samples/Generated/Samples/Sample_LambdaTestHyperExecuteOrganizationResource.cs index b6d9240f2d28..2905eef73552 100644 --- a/sdk/lambdatesthyperexecute/Azure.ResourceManager.LambdaTestHyperExecute/samples/Generated/Samples/Sample_LambdaTestHyperExecuteOrganizationResource.cs +++ b/sdk/lambdatesthyperexecute/Azure.ResourceManager.LambdaTestHyperExecute/samples/Generated/Samples/Sample_LambdaTestHyperExecuteOrganizationResource.cs @@ -21,7 +21,7 @@ public partial class Sample_LambdaTestHyperExecuteOrganizationResource [Ignore("Only validating compilation of examples")] public async Task Get_OrganizationsGetMaximumSetGenGeneratedByMaximumSetRuleGeneratedByMaximumSetRuleGeneratedByMaximumSetRule() { - // Generated from example definition: 2024-02-01-preview/Organizations_Get_MaximumSet_Gen.json + // Generated from example definition: 2024-02-01/Organizations_Get_MaximumSet_Gen.json // this example is just showing the usage of "OrganizationResource_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 @@ -51,7 +51,7 @@ public async Task Get_OrganizationsGetMaximumSetGenGeneratedByMaximumSetRuleGene [Ignore("Only validating compilation of examples")] public async Task Delete_OrganizationsDeleteMaximumSetGenGeneratedByMaximumSetRuleGeneratedByMaximumSetRuleGeneratedByMaximumSetRule() { - // Generated from example definition: 2024-02-01-preview/Organizations_Delete_MaximumSet_Gen.json + // Generated from example definition: 2024-02-01/Organizations_Delete_MaximumSet_Gen.json // this example is just showing the usage of "OrganizationResource_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 @@ -77,7 +77,7 @@ public async Task Delete_OrganizationsDeleteMaximumSetGenGeneratedByMaximumSetRu [Ignore("Only validating compilation of examples")] public async Task Update_OrganizationsUpdateMaximumSetGenGeneratedByMaximumSetRuleGeneratedByMaximumSetRuleGeneratedByMaximumSetRule() { - // Generated from example definition: 2024-02-01-preview/Organizations_Update_MaximumSet_Gen.json + // Generated from example definition: 2024-02-01/Organizations_Update_MaximumSet_Gen.json // this example is just showing the usage of "OrganizationResource_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 diff --git a/sdk/lambdatesthyperexecute/Azure.ResourceManager.LambdaTestHyperExecute/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs b/sdk/lambdatesthyperexecute/Azure.ResourceManager.LambdaTestHyperExecute/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs index 0ba05fb51e02..4a31fe37f9d2 100644 --- a/sdk/lambdatesthyperexecute/Azure.ResourceManager.LambdaTestHyperExecute/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs +++ b/sdk/lambdatesthyperexecute/Azure.ResourceManager.LambdaTestHyperExecute/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs @@ -20,7 +20,7 @@ public partial class Sample_SubscriptionResourceExtensions [Ignore("Only validating compilation of examples")] public async Task GetLambdaTestHyperExecuteOrganizations_OrganizationsListBySubscriptionMaximumSetGenGeneratedByMaximumSetRuleGeneratedByMaximumSetRuleGeneratedByMaximumSetRule() { - // Generated from example definition: 2024-02-01-preview/Organizations_ListBySubscription_MaximumSet_Gen.json + // Generated from example definition: 2024-02-01/Organizations_ListBySubscription_MaximumSet_Gen.json // this example is just showing the usage of "OrganizationResource_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 @@ -51,7 +51,7 @@ public async Task GetLambdaTestHyperExecuteOrganizations_OrganizationsListBySubs [Ignore("Only validating compilation of examples")] public async Task GetLambdaTestHyperExecuteOrganizations_OrganizationsListBySubscriptionMaximumSetGenGeneratedByMaximumSetRuleGeneratedByMaximumSetRuleGeneratedByMinimumSetRule() { - // Generated from example definition: 2024-02-01-preview/Organizations_ListBySubscription_MinimumSet_Gen.json + // Generated from example definition: 2024-02-01/Organizations_ListBySubscription_MinimumSet_Gen.json // this example is just showing the usage of "OrganizationResource_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 diff --git a/sdk/lambdatesthyperexecute/Azure.ResourceManager.LambdaTestHyperExecute/src/Generated/Extensions/LambdaTestHyperExecuteExtensions.cs b/sdk/lambdatesthyperexecute/Azure.ResourceManager.LambdaTestHyperExecute/src/Generated/Extensions/LambdaTestHyperExecuteExtensions.cs index d91ff011e710..4342c61dd392 100644 --- a/sdk/lambdatesthyperexecute/Azure.ResourceManager.LambdaTestHyperExecute/src/Generated/Extensions/LambdaTestHyperExecuteExtensions.cs +++ b/sdk/lambdatesthyperexecute/Azure.ResourceManager.LambdaTestHyperExecute/src/Generated/Extensions/LambdaTestHyperExecuteExtensions.cs @@ -81,7 +81,7 @@ public static LambdaTestHyperExecuteOrganizationCollection GetLambdaTestHyperExe /// /// /// Default Api Version - /// 2024-02-01-preview + /// 2024-02-01 /// /// /// Resource @@ -119,7 +119,7 @@ public static async Task> G /// /// /// Default Api Version - /// 2024-02-01-preview + /// 2024-02-01 /// /// /// Resource @@ -157,7 +157,7 @@ public static Response GetLambdaTest /// /// /// Default Api Version - /// 2024-02-01-preview + /// 2024-02-01 /// /// /// Resource @@ -193,7 +193,7 @@ public static AsyncPageable GetLambd /// /// /// Default Api Version - /// 2024-02-01-preview + /// 2024-02-01 /// /// /// Resource diff --git a/sdk/lambdatesthyperexecute/Azure.ResourceManager.LambdaTestHyperExecute/src/Generated/Extensions/MockableLambdaTestHyperExecuteResourceGroupResource.cs b/sdk/lambdatesthyperexecute/Azure.ResourceManager.LambdaTestHyperExecute/src/Generated/Extensions/MockableLambdaTestHyperExecuteResourceGroupResource.cs index 67d80b414704..f3202658ba71 100644 --- a/sdk/lambdatesthyperexecute/Azure.ResourceManager.LambdaTestHyperExecute/src/Generated/Extensions/MockableLambdaTestHyperExecuteResourceGroupResource.cs +++ b/sdk/lambdatesthyperexecute/Azure.ResourceManager.LambdaTestHyperExecute/src/Generated/Extensions/MockableLambdaTestHyperExecuteResourceGroupResource.cs @@ -53,7 +53,7 @@ public virtual LambdaTestHyperExecuteOrganizationCollection GetLambdaTestHyperEx /// /// /// Default Api Version - /// 2024-02-01-preview + /// 2024-02-01 /// /// /// Resource @@ -84,7 +84,7 @@ public virtual async Task> /// /// /// Default Api Version - /// 2024-02-01-preview + /// 2024-02-01 /// /// /// Resource diff --git a/sdk/lambdatesthyperexecute/Azure.ResourceManager.LambdaTestHyperExecute/src/Generated/Extensions/MockableLambdaTestHyperExecuteSubscriptionResource.cs b/sdk/lambdatesthyperexecute/Azure.ResourceManager.LambdaTestHyperExecute/src/Generated/Extensions/MockableLambdaTestHyperExecuteSubscriptionResource.cs index 7e088cf0afab..cb754766aaf0 100644 --- a/sdk/lambdatesthyperexecute/Azure.ResourceManager.LambdaTestHyperExecute/src/Generated/Extensions/MockableLambdaTestHyperExecuteSubscriptionResource.cs +++ b/sdk/lambdatesthyperexecute/Azure.ResourceManager.LambdaTestHyperExecute/src/Generated/Extensions/MockableLambdaTestHyperExecuteSubscriptionResource.cs @@ -52,7 +52,7 @@ private string GetApiVersionOrNull(ResourceType resourceType) /// /// /// Default Api Version - /// 2024-02-01-preview + /// 2024-02-01 /// /// /// Resource @@ -82,7 +82,7 @@ public virtual AsyncPageable GetLamb /// /// /// Default Api Version - /// 2024-02-01-preview + /// 2024-02-01 /// /// /// Resource diff --git a/sdk/lambdatesthyperexecute/Azure.ResourceManager.LambdaTestHyperExecute/src/Generated/LambdaTestHyperExecuteOrganizationCollection.cs b/sdk/lambdatesthyperexecute/Azure.ResourceManager.LambdaTestHyperExecute/src/Generated/LambdaTestHyperExecuteOrganizationCollection.cs index a3cc0f258f87..2c11d656949c 100644 --- a/sdk/lambdatesthyperexecute/Azure.ResourceManager.LambdaTestHyperExecute/src/Generated/LambdaTestHyperExecuteOrganizationCollection.cs +++ b/sdk/lambdatesthyperexecute/Azure.ResourceManager.LambdaTestHyperExecute/src/Generated/LambdaTestHyperExecuteOrganizationCollection.cs @@ -65,7 +65,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2024-02-01-preview + /// 2024-02-01 /// /// /// Resource @@ -114,7 +114,7 @@ public virtual async Task /// /// Default Api Version - /// 2024-02-01-preview + /// 2024-02-01 /// /// /// Resource @@ -163,7 +163,7 @@ public virtual ArmOperation CreateOr /// /// /// Default Api Version - /// 2024-02-01-preview + /// 2024-02-01 /// /// /// Resource @@ -208,7 +208,7 @@ public virtual async Task> /// /// /// Default Api Version - /// 2024-02-01-preview + /// 2024-02-01 /// /// /// Resource @@ -253,7 +253,7 @@ public virtual Response Get(string o /// /// /// Default Api Version - /// 2024-02-01-preview + /// 2024-02-01 /// /// /// Resource @@ -283,7 +283,7 @@ public virtual AsyncPageable GetAllA /// /// /// Default Api Version - /// 2024-02-01-preview + /// 2024-02-01 /// /// /// Resource @@ -313,7 +313,7 @@ public virtual Pageable GetAll(Cance /// /// /// Default Api Version - /// 2024-02-01-preview + /// 2024-02-01 /// /// /// Resource @@ -356,7 +356,7 @@ public virtual async Task> ExistsAsync(string organizationname, C /// /// /// Default Api Version - /// 2024-02-01-preview + /// 2024-02-01 /// /// /// Resource @@ -399,7 +399,7 @@ public virtual Response Exists(string organizationname, CancellationToken /// /// /// Default Api Version - /// 2024-02-01-preview + /// 2024-02-01 /// /// /// Resource @@ -444,7 +444,7 @@ public virtual async Task /// /// Default Api Version - /// 2024-02-01-preview + /// 2024-02-01 /// /// /// Resource diff --git a/sdk/lambdatesthyperexecute/Azure.ResourceManager.LambdaTestHyperExecute/src/Generated/LambdaTestHyperExecuteOrganizationResource.cs b/sdk/lambdatesthyperexecute/Azure.ResourceManager.LambdaTestHyperExecute/src/Generated/LambdaTestHyperExecuteOrganizationResource.cs index 33752728e768..63cec75787bb 100644 --- a/sdk/lambdatesthyperexecute/Azure.ResourceManager.LambdaTestHyperExecute/src/Generated/LambdaTestHyperExecuteOrganizationResource.cs +++ b/sdk/lambdatesthyperexecute/Azure.ResourceManager.LambdaTestHyperExecute/src/Generated/LambdaTestHyperExecuteOrganizationResource.cs @@ -103,7 +103,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2024-02-01-preview + /// 2024-02-01 /// /// /// Resource @@ -143,7 +143,7 @@ public virtual async Task> /// /// /// Default Api Version - /// 2024-02-01-preview + /// 2024-02-01 /// /// /// Resource @@ -183,7 +183,7 @@ public virtual Response Get(Cancella /// /// /// Default Api Version - /// 2024-02-01-preview + /// 2024-02-01 /// /// /// Resource @@ -225,7 +225,7 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell /// /// /// Default Api Version - /// 2024-02-01-preview + /// 2024-02-01 /// /// /// Resource @@ -267,7 +267,7 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel /// /// /// Default Api Version - /// 2024-02-01-preview + /// 2024-02-01 /// /// /// Resource @@ -309,7 +309,7 @@ public virtual async Task> /// /// /// Default Api Version - /// 2024-02-01-preview + /// 2024-02-01 /// /// /// Resource @@ -351,7 +351,7 @@ public virtual Response Update(Lambd /// /// /// Default Api Version - /// 2024-02-01-preview + /// 2024-02-01 /// /// /// Resource @@ -413,7 +413,7 @@ public virtual async Task> /// /// /// Default Api Version - /// 2024-02-01-preview + /// 2024-02-01 /// /// /// Resource @@ -475,7 +475,7 @@ public virtual Response AddTag(strin /// /// /// Default Api Version - /// 2024-02-01-preview + /// 2024-02-01 /// /// /// Resource @@ -532,7 +532,7 @@ public virtual async Task> /// /// /// Default Api Version - /// 2024-02-01-preview + /// 2024-02-01 /// /// /// Resource @@ -589,7 +589,7 @@ public virtual Response SetTags(IDic /// /// /// Default Api Version - /// 2024-02-01-preview + /// 2024-02-01 /// /// /// Resource @@ -649,7 +649,7 @@ public virtual async Task> /// /// /// Default Api Version - /// 2024-02-01-preview + /// 2024-02-01 /// /// /// Resource diff --git a/sdk/lambdatesthyperexecute/Azure.ResourceManager.LambdaTestHyperExecute/src/Generated/RestOperations/OrganizationsRestOperations.cs b/sdk/lambdatesthyperexecute/Azure.ResourceManager.LambdaTestHyperExecute/src/Generated/RestOperations/OrganizationsRestOperations.cs index 4cd7017d9207..6630bb722a32 100644 --- a/sdk/lambdatesthyperexecute/Azure.ResourceManager.LambdaTestHyperExecute/src/Generated/RestOperations/OrganizationsRestOperations.cs +++ b/sdk/lambdatesthyperexecute/Azure.ResourceManager.LambdaTestHyperExecute/src/Generated/RestOperations/OrganizationsRestOperations.cs @@ -32,7 +32,7 @@ public OrganizationsRestOperations(HttpPipeline pipeline, string applicationId, { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2024-02-01-preview"; + _apiVersion = apiVersion ?? "2024-02-01"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/lambdatesthyperexecute/Azure.ResourceManager.LambdaTestHyperExecute/tsp-location.yaml b/sdk/lambdatesthyperexecute/Azure.ResourceManager.LambdaTestHyperExecute/tsp-location.yaml index 353db515eb44..a44d56b9bb06 100644 --- a/sdk/lambdatesthyperexecute/Azure.ResourceManager.LambdaTestHyperExecute/tsp-location.yaml +++ b/sdk/lambdatesthyperexecute/Azure.ResourceManager.LambdaTestHyperExecute/tsp-location.yaml @@ -1,3 +1,4 @@ directory: specification/liftrhyperexecute/LambdaTest.HyperExecute.Management -commit: ad9b489baef1d982f7641f6c47a00794c9a1a5be -repo: Azure/azure-rest-api-specs \ No newline at end of file +commit: 0c929c78c4b7892c20cdfee10ddebb97cdf9d8a9 +repo: Azure/azure-rest-api-specs +additionalDirectories: diff --git a/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/Azure.ResourceManager.OnlineExperimentation.sln b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/Azure.ResourceManager.OnlineExperimentation.sln new file mode 100644 index 000000000000..779249ad70eb --- /dev/null +++ b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/Azure.ResourceManager.OnlineExperimentation.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.OnlineExperimentation.Samples", "samples\Azure.ResourceManager.OnlineExperimentation.Samples.csproj", "{7A2DFF15-5746-49F4-BD0F-C6C35337088A}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Azure.ResourceManager.OnlineExperimentation", "src\Azure.ResourceManager.OnlineExperimentation.csproj", "{28FF4005-4467-4E36-92E7-DEA27DEB1519}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Azure.ResourceManager.OnlineExperimentation.Tests", "tests\Azure.ResourceManager.OnlineExperimentation.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/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/CHANGELOG.md b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/CHANGELOG.md new file mode 100644 index 000000000000..8b33f0fedccc --- /dev/null +++ b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/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/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/Directory.Build.props b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/Directory.Build.props new file mode 100644 index 000000000000..63bd836ad44b --- /dev/null +++ b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/Directory.Build.props @@ -0,0 +1,6 @@ + + + + diff --git a/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/README.md b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/README.md new file mode 100644 index 000000000000..13d45116b02c --- /dev/null +++ b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/README.md @@ -0,0 +1,80 @@ +# Microsoft Azure OnlineExperimentation 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 OnlineExperimentation management library for .NET with [NuGet](https://www.nuget.org/): + +```dotnetcli +dotnet add package Azure.ResourceManager.OnlineExperimentation --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/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/api/Azure.ResourceManager.OnlineExperimentation.net8.0.cs b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/api/Azure.ResourceManager.OnlineExperimentation.net8.0.cs new file mode 100644 index 000000000000..6a6c37d5b579 --- /dev/null +++ b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/api/Azure.ResourceManager.OnlineExperimentation.net8.0.cs @@ -0,0 +1,261 @@ +namespace Azure.ResourceManager.OnlineExperimentation +{ + public partial class AzureResourceManagerOnlineExperimentationContext : System.ClientModel.Primitives.ModelReaderWriterContext + { + internal AzureResourceManagerOnlineExperimentationContext() { } + public static Azure.ResourceManager.OnlineExperimentation.AzureResourceManagerOnlineExperimentationContext Default { get { throw null; } } + protected override bool TryGetTypeBuilderCore(System.Type type, out System.ClientModel.Primitives.ModelReaderWriterTypeBuilder builder) { throw null; } + } + public static partial class OnlineExperimentationExtensions + { + public static Azure.Response GetOnlineExperimentWorkspace(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string workspaceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static System.Threading.Tasks.Task> GetOnlineExperimentWorkspaceAsync(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string workspaceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.ResourceManager.OnlineExperimentation.OnlineExperimentWorkspaceResource GetOnlineExperimentWorkspaceResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.ResourceManager.OnlineExperimentation.OnlineExperimentWorkspaceCollection GetOnlineExperimentWorkspaces(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource) { throw null; } + public static Azure.Pageable GetOnlineExperimentWorkspaces(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.AsyncPageable GetOnlineExperimentWorkspacesAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class OnlineExperimentWorkspaceCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected OnlineExperimentWorkspaceCollection() { } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string workspaceName, Azure.ResourceManager.OnlineExperimentation.OnlineExperimentWorkspaceData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(Azure.WaitUntil waitUntil, string workspaceName, Azure.ResourceManager.OnlineExperimentation.OnlineExperimentWorkspaceData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Exists(string workspaceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string workspaceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string workspaceName, 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 workspaceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.NullableResponse GetIfExists(string workspaceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string workspaceName, 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 OnlineExperimentWorkspaceData : Azure.ResourceManager.Models.TrackedResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public OnlineExperimentWorkspaceData(Azure.Core.AzureLocation location) { } + public Azure.ResourceManager.Models.ManagedServiceIdentity Identity { get { throw null; } set { } } + public Azure.ResourceManager.OnlineExperimentation.Models.OnlineExperimentWorkspaceProperties Properties { get { throw null; } set { } } + public Azure.ResourceManager.OnlineExperimentation.Models.OnlineExperimentationWorkspaceSku Sku { get { throw null; } set { } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.OnlineExperimentation.OnlineExperimentWorkspaceData 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.OnlineExperimentation.OnlineExperimentWorkspaceData 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 OnlineExperimentWorkspaceResource : Azure.ResourceManager.ArmResource, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public static readonly Azure.Core.ResourceType ResourceType; + protected OnlineExperimentWorkspaceResource() { } + public virtual Azure.ResourceManager.OnlineExperimentation.OnlineExperimentWorkspaceData 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 workspaceName) { 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.OnlineExperimentation.OnlineExperimentWorkspaceData 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.OnlineExperimentation.OnlineExperimentWorkspaceData 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.OnlineExperimentation.Models.OnlineExperimentWorkspacePatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.OnlineExperimentation.Models.OnlineExperimentWorkspacePatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} +namespace Azure.ResourceManager.OnlineExperimentation.Mocking +{ + public partial class MockableOnlineExperimentationArmClient : Azure.ResourceManager.ArmResource + { + protected MockableOnlineExperimentationArmClient() { } + public virtual Azure.ResourceManager.OnlineExperimentation.OnlineExperimentWorkspaceResource GetOnlineExperimentWorkspaceResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableOnlineExperimentationResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableOnlineExperimentationResourceGroupResource() { } + public virtual Azure.Response GetOnlineExperimentWorkspace(string workspaceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetOnlineExperimentWorkspaceAsync(string workspaceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.OnlineExperimentation.OnlineExperimentWorkspaceCollection GetOnlineExperimentWorkspaces() { throw null; } + } + public partial class MockableOnlineExperimentationSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableOnlineExperimentationSubscriptionResource() { } + public virtual Azure.Pageable GetOnlineExperimentWorkspaces(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetOnlineExperimentWorkspacesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} +namespace Azure.ResourceManager.OnlineExperimentation.Models +{ + public static partial class ArmOnlineExperimentationModelFactory + { + public static Azure.ResourceManager.OnlineExperimentation.Models.OnlineExperimentationWorkspaceSku OnlineExperimentationWorkspaceSku(Azure.ResourceManager.OnlineExperimentation.Models.OnlineExperimentationWorkspaceSkuName name = default(Azure.ResourceManager.OnlineExperimentation.Models.OnlineExperimentationWorkspaceSkuName), Azure.ResourceManager.OnlineExperimentation.Models.OnlineExperimentationWorkspaceSkuTier? tier = default(Azure.ResourceManager.OnlineExperimentation.Models.OnlineExperimentationWorkspaceSkuTier?)) { throw null; } + public static Azure.ResourceManager.OnlineExperimentation.OnlineExperimentWorkspaceData OnlineExperimentWorkspaceData(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.OnlineExperimentation.Models.OnlineExperimentWorkspaceProperties properties = null, Azure.ResourceManager.Models.ManagedServiceIdentity identity = null, Azure.ResourceManager.OnlineExperimentation.Models.OnlineExperimentationWorkspaceSku sku = null) { throw null; } + public static Azure.ResourceManager.OnlineExperimentation.Models.OnlineExperimentWorkspaceProperties OnlineExperimentWorkspaceProperties(string workspaceId = null, Azure.ResourceManager.OnlineExperimentation.Models.ResourceProvisioningState? provisioningState = default(Azure.ResourceManager.OnlineExperimentation.Models.ResourceProvisioningState?), Azure.Core.ResourceIdentifier logAnalyticsWorkspaceResourceId = null, Azure.Core.ResourceIdentifier logsExporterStorageAccountResourceId = null, Azure.Core.ResourceIdentifier appConfigurationResourceId = null, Azure.ResourceManager.OnlineExperimentation.Models.CustomerManagedKeyEncryption customerManagedKeyEncryption = null, System.Uri endpoint = null) { throw null; } + } + public partial class CustomerManagedKeyEncryption : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public CustomerManagedKeyEncryption() { } + public Azure.ResourceManager.OnlineExperimentation.Models.KeyEncryptionKeyIdentity KeyEncryptionKeyIdentity { get { throw null; } set { } } + public System.Uri KeyEncryptionKeyUri { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.OnlineExperimentation.Models.CustomerManagedKeyEncryption 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.OnlineExperimentation.Models.CustomerManagedKeyEncryption 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 KeyEncryptionKeyIdentity : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public KeyEncryptionKeyIdentity() { } + public System.Guid? FederatedClientId { get { throw null; } set { } } + public Azure.ResourceManager.OnlineExperimentation.Models.KeyEncryptionKeyIdentityType? IdentityType { get { throw null; } set { } } + public Azure.Core.ResourceIdentifier UserAssignedIdentityResourceId { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.OnlineExperimentation.Models.KeyEncryptionKeyIdentity 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.OnlineExperimentation.Models.KeyEncryptionKeyIdentity 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 KeyEncryptionKeyIdentityType : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public KeyEncryptionKeyIdentityType(string value) { throw null; } + public static Azure.ResourceManager.OnlineExperimentation.Models.KeyEncryptionKeyIdentityType SystemAssignedIdentity { get { throw null; } } + public static Azure.ResourceManager.OnlineExperimentation.Models.KeyEncryptionKeyIdentityType UserAssignedIdentity { get { throw null; } } + public bool Equals(Azure.ResourceManager.OnlineExperimentation.Models.KeyEncryptionKeyIdentityType 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.OnlineExperimentation.Models.KeyEncryptionKeyIdentityType left, Azure.ResourceManager.OnlineExperimentation.Models.KeyEncryptionKeyIdentityType right) { throw null; } + public static implicit operator Azure.ResourceManager.OnlineExperimentation.Models.KeyEncryptionKeyIdentityType (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.OnlineExperimentation.Models.KeyEncryptionKeyIdentityType left, Azure.ResourceManager.OnlineExperimentation.Models.KeyEncryptionKeyIdentityType right) { throw null; } + public override string ToString() { throw null; } + } + public partial class OnlineExperimentationWorkspaceSku : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public OnlineExperimentationWorkspaceSku(Azure.ResourceManager.OnlineExperimentation.Models.OnlineExperimentationWorkspaceSkuName name) { } + public Azure.ResourceManager.OnlineExperimentation.Models.OnlineExperimentationWorkspaceSkuName Name { get { throw null; } set { } } + public Azure.ResourceManager.OnlineExperimentation.Models.OnlineExperimentationWorkspaceSkuTier? Tier { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.OnlineExperimentation.Models.OnlineExperimentationWorkspaceSku 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.OnlineExperimentation.Models.OnlineExperimentationWorkspaceSku 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 OnlineExperimentationWorkspaceSkuName : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public OnlineExperimentationWorkspaceSkuName(string value) { throw null; } + public static Azure.ResourceManager.OnlineExperimentation.Models.OnlineExperimentationWorkspaceSkuName D0 { get { throw null; } } + public static Azure.ResourceManager.OnlineExperimentation.Models.OnlineExperimentationWorkspaceSkuName F0 { get { throw null; } } + public static Azure.ResourceManager.OnlineExperimentation.Models.OnlineExperimentationWorkspaceSkuName P0 { get { throw null; } } + public static Azure.ResourceManager.OnlineExperimentation.Models.OnlineExperimentationWorkspaceSkuName S0 { get { throw null; } } + public bool Equals(Azure.ResourceManager.OnlineExperimentation.Models.OnlineExperimentationWorkspaceSkuName 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.OnlineExperimentation.Models.OnlineExperimentationWorkspaceSkuName left, Azure.ResourceManager.OnlineExperimentation.Models.OnlineExperimentationWorkspaceSkuName right) { throw null; } + public static implicit operator Azure.ResourceManager.OnlineExperimentation.Models.OnlineExperimentationWorkspaceSkuName (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.OnlineExperimentation.Models.OnlineExperimentationWorkspaceSkuName left, Azure.ResourceManager.OnlineExperimentation.Models.OnlineExperimentationWorkspaceSkuName right) { throw null; } + public override string ToString() { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct OnlineExperimentationWorkspaceSkuTier : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public OnlineExperimentationWorkspaceSkuTier(string value) { throw null; } + public static Azure.ResourceManager.OnlineExperimentation.Models.OnlineExperimentationWorkspaceSkuTier Developer { get { throw null; } } + public static Azure.ResourceManager.OnlineExperimentation.Models.OnlineExperimentationWorkspaceSkuTier Free { get { throw null; } } + public static Azure.ResourceManager.OnlineExperimentation.Models.OnlineExperimentationWorkspaceSkuTier Premium { get { throw null; } } + public static Azure.ResourceManager.OnlineExperimentation.Models.OnlineExperimentationWorkspaceSkuTier Standard { get { throw null; } } + public bool Equals(Azure.ResourceManager.OnlineExperimentation.Models.OnlineExperimentationWorkspaceSkuTier 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.OnlineExperimentation.Models.OnlineExperimentationWorkspaceSkuTier left, Azure.ResourceManager.OnlineExperimentation.Models.OnlineExperimentationWorkspaceSkuTier right) { throw null; } + public static implicit operator Azure.ResourceManager.OnlineExperimentation.Models.OnlineExperimentationWorkspaceSkuTier (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.OnlineExperimentation.Models.OnlineExperimentationWorkspaceSkuTier left, Azure.ResourceManager.OnlineExperimentation.Models.OnlineExperimentationWorkspaceSkuTier right) { throw null; } + public override string ToString() { throw null; } + } + public partial class OnlineExperimentWorkspacePatch : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public OnlineExperimentWorkspacePatch() { } + public Azure.ResourceManager.Models.ManagedServiceIdentity Identity { get { throw null; } set { } } + public Azure.ResourceManager.OnlineExperimentation.Models.OnlineExperimentWorkspacePatchProperties Properties { get { throw null; } set { } } + public Azure.ResourceManager.OnlineExperimentation.Models.OnlineExperimentationWorkspaceSku Sku { get { throw null; } set { } } + public System.Collections.Generic.IDictionary Tags { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.OnlineExperimentation.Models.OnlineExperimentWorkspacePatch 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.OnlineExperimentation.Models.OnlineExperimentWorkspacePatch 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 OnlineExperimentWorkspacePatchProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public OnlineExperimentWorkspacePatchProperties() { } + public Azure.ResourceManager.OnlineExperimentation.Models.CustomerManagedKeyEncryption CustomerManagedKeyEncryption { get { throw null; } set { } } + public Azure.Core.ResourceIdentifier LogAnalyticsWorkspaceResourceId { get { throw null; } set { } } + public Azure.Core.ResourceIdentifier LogsExporterStorageAccountResourceId { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.OnlineExperimentation.Models.OnlineExperimentWorkspacePatchProperties 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.OnlineExperimentation.Models.OnlineExperimentWorkspacePatchProperties 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 OnlineExperimentWorkspaceProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public OnlineExperimentWorkspaceProperties(Azure.Core.ResourceIdentifier logAnalyticsWorkspaceResourceId, Azure.Core.ResourceIdentifier logsExporterStorageAccountResourceId, Azure.Core.ResourceIdentifier appConfigurationResourceId) { } + public Azure.Core.ResourceIdentifier AppConfigurationResourceId { get { throw null; } set { } } + public Azure.ResourceManager.OnlineExperimentation.Models.CustomerManagedKeyEncryption CustomerManagedKeyEncryption { get { throw null; } set { } } + public System.Uri Endpoint { get { throw null; } } + public Azure.Core.ResourceIdentifier LogAnalyticsWorkspaceResourceId { get { throw null; } set { } } + public Azure.Core.ResourceIdentifier LogsExporterStorageAccountResourceId { get { throw null; } set { } } + public Azure.ResourceManager.OnlineExperimentation.Models.ResourceProvisioningState? ProvisioningState { get { throw null; } } + public string WorkspaceId { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.OnlineExperimentation.Models.OnlineExperimentWorkspaceProperties 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.OnlineExperimentation.Models.OnlineExperimentWorkspaceProperties 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 ResourceProvisioningState : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public ResourceProvisioningState(string value) { throw null; } + public static Azure.ResourceManager.OnlineExperimentation.Models.ResourceProvisioningState Canceled { get { throw null; } } + public static Azure.ResourceManager.OnlineExperimentation.Models.ResourceProvisioningState Failed { get { throw null; } } + public static Azure.ResourceManager.OnlineExperimentation.Models.ResourceProvisioningState Succeeded { get { throw null; } } + public bool Equals(Azure.ResourceManager.OnlineExperimentation.Models.ResourceProvisioningState 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.OnlineExperimentation.Models.ResourceProvisioningState left, Azure.ResourceManager.OnlineExperimentation.Models.ResourceProvisioningState right) { throw null; } + public static implicit operator Azure.ResourceManager.OnlineExperimentation.Models.ResourceProvisioningState (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.OnlineExperimentation.Models.ResourceProvisioningState left, Azure.ResourceManager.OnlineExperimentation.Models.ResourceProvisioningState right) { throw null; } + public override string ToString() { throw null; } + } +} diff --git a/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/api/Azure.ResourceManager.OnlineExperimentation.netstandard2.0.cs b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/api/Azure.ResourceManager.OnlineExperimentation.netstandard2.0.cs new file mode 100644 index 000000000000..6a6c37d5b579 --- /dev/null +++ b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/api/Azure.ResourceManager.OnlineExperimentation.netstandard2.0.cs @@ -0,0 +1,261 @@ +namespace Azure.ResourceManager.OnlineExperimentation +{ + public partial class AzureResourceManagerOnlineExperimentationContext : System.ClientModel.Primitives.ModelReaderWriterContext + { + internal AzureResourceManagerOnlineExperimentationContext() { } + public static Azure.ResourceManager.OnlineExperimentation.AzureResourceManagerOnlineExperimentationContext Default { get { throw null; } } + protected override bool TryGetTypeBuilderCore(System.Type type, out System.ClientModel.Primitives.ModelReaderWriterTypeBuilder builder) { throw null; } + } + public static partial class OnlineExperimentationExtensions + { + public static Azure.Response GetOnlineExperimentWorkspace(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string workspaceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static System.Threading.Tasks.Task> GetOnlineExperimentWorkspaceAsync(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string workspaceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.ResourceManager.OnlineExperimentation.OnlineExperimentWorkspaceResource GetOnlineExperimentWorkspaceResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.ResourceManager.OnlineExperimentation.OnlineExperimentWorkspaceCollection GetOnlineExperimentWorkspaces(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource) { throw null; } + public static Azure.Pageable GetOnlineExperimentWorkspaces(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.AsyncPageable GetOnlineExperimentWorkspacesAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class OnlineExperimentWorkspaceCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected OnlineExperimentWorkspaceCollection() { } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string workspaceName, Azure.ResourceManager.OnlineExperimentation.OnlineExperimentWorkspaceData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(Azure.WaitUntil waitUntil, string workspaceName, Azure.ResourceManager.OnlineExperimentation.OnlineExperimentWorkspaceData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Exists(string workspaceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string workspaceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string workspaceName, 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 workspaceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.NullableResponse GetIfExists(string workspaceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string workspaceName, 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 OnlineExperimentWorkspaceData : Azure.ResourceManager.Models.TrackedResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public OnlineExperimentWorkspaceData(Azure.Core.AzureLocation location) { } + public Azure.ResourceManager.Models.ManagedServiceIdentity Identity { get { throw null; } set { } } + public Azure.ResourceManager.OnlineExperimentation.Models.OnlineExperimentWorkspaceProperties Properties { get { throw null; } set { } } + public Azure.ResourceManager.OnlineExperimentation.Models.OnlineExperimentationWorkspaceSku Sku { get { throw null; } set { } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.OnlineExperimentation.OnlineExperimentWorkspaceData 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.OnlineExperimentation.OnlineExperimentWorkspaceData 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 OnlineExperimentWorkspaceResource : Azure.ResourceManager.ArmResource, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public static readonly Azure.Core.ResourceType ResourceType; + protected OnlineExperimentWorkspaceResource() { } + public virtual Azure.ResourceManager.OnlineExperimentation.OnlineExperimentWorkspaceData 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 workspaceName) { 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.OnlineExperimentation.OnlineExperimentWorkspaceData 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.OnlineExperimentation.OnlineExperimentWorkspaceData 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.OnlineExperimentation.Models.OnlineExperimentWorkspacePatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.OnlineExperimentation.Models.OnlineExperimentWorkspacePatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} +namespace Azure.ResourceManager.OnlineExperimentation.Mocking +{ + public partial class MockableOnlineExperimentationArmClient : Azure.ResourceManager.ArmResource + { + protected MockableOnlineExperimentationArmClient() { } + public virtual Azure.ResourceManager.OnlineExperimentation.OnlineExperimentWorkspaceResource GetOnlineExperimentWorkspaceResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableOnlineExperimentationResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableOnlineExperimentationResourceGroupResource() { } + public virtual Azure.Response GetOnlineExperimentWorkspace(string workspaceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetOnlineExperimentWorkspaceAsync(string workspaceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.OnlineExperimentation.OnlineExperimentWorkspaceCollection GetOnlineExperimentWorkspaces() { throw null; } + } + public partial class MockableOnlineExperimentationSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableOnlineExperimentationSubscriptionResource() { } + public virtual Azure.Pageable GetOnlineExperimentWorkspaces(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetOnlineExperimentWorkspacesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} +namespace Azure.ResourceManager.OnlineExperimentation.Models +{ + public static partial class ArmOnlineExperimentationModelFactory + { + public static Azure.ResourceManager.OnlineExperimentation.Models.OnlineExperimentationWorkspaceSku OnlineExperimentationWorkspaceSku(Azure.ResourceManager.OnlineExperimentation.Models.OnlineExperimentationWorkspaceSkuName name = default(Azure.ResourceManager.OnlineExperimentation.Models.OnlineExperimentationWorkspaceSkuName), Azure.ResourceManager.OnlineExperimentation.Models.OnlineExperimentationWorkspaceSkuTier? tier = default(Azure.ResourceManager.OnlineExperimentation.Models.OnlineExperimentationWorkspaceSkuTier?)) { throw null; } + public static Azure.ResourceManager.OnlineExperimentation.OnlineExperimentWorkspaceData OnlineExperimentWorkspaceData(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.OnlineExperimentation.Models.OnlineExperimentWorkspaceProperties properties = null, Azure.ResourceManager.Models.ManagedServiceIdentity identity = null, Azure.ResourceManager.OnlineExperimentation.Models.OnlineExperimentationWorkspaceSku sku = null) { throw null; } + public static Azure.ResourceManager.OnlineExperimentation.Models.OnlineExperimentWorkspaceProperties OnlineExperimentWorkspaceProperties(string workspaceId = null, Azure.ResourceManager.OnlineExperimentation.Models.ResourceProvisioningState? provisioningState = default(Azure.ResourceManager.OnlineExperimentation.Models.ResourceProvisioningState?), Azure.Core.ResourceIdentifier logAnalyticsWorkspaceResourceId = null, Azure.Core.ResourceIdentifier logsExporterStorageAccountResourceId = null, Azure.Core.ResourceIdentifier appConfigurationResourceId = null, Azure.ResourceManager.OnlineExperimentation.Models.CustomerManagedKeyEncryption customerManagedKeyEncryption = null, System.Uri endpoint = null) { throw null; } + } + public partial class CustomerManagedKeyEncryption : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public CustomerManagedKeyEncryption() { } + public Azure.ResourceManager.OnlineExperimentation.Models.KeyEncryptionKeyIdentity KeyEncryptionKeyIdentity { get { throw null; } set { } } + public System.Uri KeyEncryptionKeyUri { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.OnlineExperimentation.Models.CustomerManagedKeyEncryption 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.OnlineExperimentation.Models.CustomerManagedKeyEncryption 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 KeyEncryptionKeyIdentity : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public KeyEncryptionKeyIdentity() { } + public System.Guid? FederatedClientId { get { throw null; } set { } } + public Azure.ResourceManager.OnlineExperimentation.Models.KeyEncryptionKeyIdentityType? IdentityType { get { throw null; } set { } } + public Azure.Core.ResourceIdentifier UserAssignedIdentityResourceId { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.OnlineExperimentation.Models.KeyEncryptionKeyIdentity 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.OnlineExperimentation.Models.KeyEncryptionKeyIdentity 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 KeyEncryptionKeyIdentityType : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public KeyEncryptionKeyIdentityType(string value) { throw null; } + public static Azure.ResourceManager.OnlineExperimentation.Models.KeyEncryptionKeyIdentityType SystemAssignedIdentity { get { throw null; } } + public static Azure.ResourceManager.OnlineExperimentation.Models.KeyEncryptionKeyIdentityType UserAssignedIdentity { get { throw null; } } + public bool Equals(Azure.ResourceManager.OnlineExperimentation.Models.KeyEncryptionKeyIdentityType 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.OnlineExperimentation.Models.KeyEncryptionKeyIdentityType left, Azure.ResourceManager.OnlineExperimentation.Models.KeyEncryptionKeyIdentityType right) { throw null; } + public static implicit operator Azure.ResourceManager.OnlineExperimentation.Models.KeyEncryptionKeyIdentityType (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.OnlineExperimentation.Models.KeyEncryptionKeyIdentityType left, Azure.ResourceManager.OnlineExperimentation.Models.KeyEncryptionKeyIdentityType right) { throw null; } + public override string ToString() { throw null; } + } + public partial class OnlineExperimentationWorkspaceSku : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public OnlineExperimentationWorkspaceSku(Azure.ResourceManager.OnlineExperimentation.Models.OnlineExperimentationWorkspaceSkuName name) { } + public Azure.ResourceManager.OnlineExperimentation.Models.OnlineExperimentationWorkspaceSkuName Name { get { throw null; } set { } } + public Azure.ResourceManager.OnlineExperimentation.Models.OnlineExperimentationWorkspaceSkuTier? Tier { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.OnlineExperimentation.Models.OnlineExperimentationWorkspaceSku 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.OnlineExperimentation.Models.OnlineExperimentationWorkspaceSku 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 OnlineExperimentationWorkspaceSkuName : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public OnlineExperimentationWorkspaceSkuName(string value) { throw null; } + public static Azure.ResourceManager.OnlineExperimentation.Models.OnlineExperimentationWorkspaceSkuName D0 { get { throw null; } } + public static Azure.ResourceManager.OnlineExperimentation.Models.OnlineExperimentationWorkspaceSkuName F0 { get { throw null; } } + public static Azure.ResourceManager.OnlineExperimentation.Models.OnlineExperimentationWorkspaceSkuName P0 { get { throw null; } } + public static Azure.ResourceManager.OnlineExperimentation.Models.OnlineExperimentationWorkspaceSkuName S0 { get { throw null; } } + public bool Equals(Azure.ResourceManager.OnlineExperimentation.Models.OnlineExperimentationWorkspaceSkuName 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.OnlineExperimentation.Models.OnlineExperimentationWorkspaceSkuName left, Azure.ResourceManager.OnlineExperimentation.Models.OnlineExperimentationWorkspaceSkuName right) { throw null; } + public static implicit operator Azure.ResourceManager.OnlineExperimentation.Models.OnlineExperimentationWorkspaceSkuName (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.OnlineExperimentation.Models.OnlineExperimentationWorkspaceSkuName left, Azure.ResourceManager.OnlineExperimentation.Models.OnlineExperimentationWorkspaceSkuName right) { throw null; } + public override string ToString() { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct OnlineExperimentationWorkspaceSkuTier : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public OnlineExperimentationWorkspaceSkuTier(string value) { throw null; } + public static Azure.ResourceManager.OnlineExperimentation.Models.OnlineExperimentationWorkspaceSkuTier Developer { get { throw null; } } + public static Azure.ResourceManager.OnlineExperimentation.Models.OnlineExperimentationWorkspaceSkuTier Free { get { throw null; } } + public static Azure.ResourceManager.OnlineExperimentation.Models.OnlineExperimentationWorkspaceSkuTier Premium { get { throw null; } } + public static Azure.ResourceManager.OnlineExperimentation.Models.OnlineExperimentationWorkspaceSkuTier Standard { get { throw null; } } + public bool Equals(Azure.ResourceManager.OnlineExperimentation.Models.OnlineExperimentationWorkspaceSkuTier 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.OnlineExperimentation.Models.OnlineExperimentationWorkspaceSkuTier left, Azure.ResourceManager.OnlineExperimentation.Models.OnlineExperimentationWorkspaceSkuTier right) { throw null; } + public static implicit operator Azure.ResourceManager.OnlineExperimentation.Models.OnlineExperimentationWorkspaceSkuTier (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.OnlineExperimentation.Models.OnlineExperimentationWorkspaceSkuTier left, Azure.ResourceManager.OnlineExperimentation.Models.OnlineExperimentationWorkspaceSkuTier right) { throw null; } + public override string ToString() { throw null; } + } + public partial class OnlineExperimentWorkspacePatch : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public OnlineExperimentWorkspacePatch() { } + public Azure.ResourceManager.Models.ManagedServiceIdentity Identity { get { throw null; } set { } } + public Azure.ResourceManager.OnlineExperimentation.Models.OnlineExperimentWorkspacePatchProperties Properties { get { throw null; } set { } } + public Azure.ResourceManager.OnlineExperimentation.Models.OnlineExperimentationWorkspaceSku Sku { get { throw null; } set { } } + public System.Collections.Generic.IDictionary Tags { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.OnlineExperimentation.Models.OnlineExperimentWorkspacePatch 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.OnlineExperimentation.Models.OnlineExperimentWorkspacePatch 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 OnlineExperimentWorkspacePatchProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public OnlineExperimentWorkspacePatchProperties() { } + public Azure.ResourceManager.OnlineExperimentation.Models.CustomerManagedKeyEncryption CustomerManagedKeyEncryption { get { throw null; } set { } } + public Azure.Core.ResourceIdentifier LogAnalyticsWorkspaceResourceId { get { throw null; } set { } } + public Azure.Core.ResourceIdentifier LogsExporterStorageAccountResourceId { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.OnlineExperimentation.Models.OnlineExperimentWorkspacePatchProperties 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.OnlineExperimentation.Models.OnlineExperimentWorkspacePatchProperties 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 OnlineExperimentWorkspaceProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public OnlineExperimentWorkspaceProperties(Azure.Core.ResourceIdentifier logAnalyticsWorkspaceResourceId, Azure.Core.ResourceIdentifier logsExporterStorageAccountResourceId, Azure.Core.ResourceIdentifier appConfigurationResourceId) { } + public Azure.Core.ResourceIdentifier AppConfigurationResourceId { get { throw null; } set { } } + public Azure.ResourceManager.OnlineExperimentation.Models.CustomerManagedKeyEncryption CustomerManagedKeyEncryption { get { throw null; } set { } } + public System.Uri Endpoint { get { throw null; } } + public Azure.Core.ResourceIdentifier LogAnalyticsWorkspaceResourceId { get { throw null; } set { } } + public Azure.Core.ResourceIdentifier LogsExporterStorageAccountResourceId { get { throw null; } set { } } + public Azure.ResourceManager.OnlineExperimentation.Models.ResourceProvisioningState? ProvisioningState { get { throw null; } } + public string WorkspaceId { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.OnlineExperimentation.Models.OnlineExperimentWorkspaceProperties 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.OnlineExperimentation.Models.OnlineExperimentWorkspaceProperties 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 ResourceProvisioningState : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public ResourceProvisioningState(string value) { throw null; } + public static Azure.ResourceManager.OnlineExperimentation.Models.ResourceProvisioningState Canceled { get { throw null; } } + public static Azure.ResourceManager.OnlineExperimentation.Models.ResourceProvisioningState Failed { get { throw null; } } + public static Azure.ResourceManager.OnlineExperimentation.Models.ResourceProvisioningState Succeeded { get { throw null; } } + public bool Equals(Azure.ResourceManager.OnlineExperimentation.Models.ResourceProvisioningState 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.OnlineExperimentation.Models.ResourceProvisioningState left, Azure.ResourceManager.OnlineExperimentation.Models.ResourceProvisioningState right) { throw null; } + public static implicit operator Azure.ResourceManager.OnlineExperimentation.Models.ResourceProvisioningState (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.OnlineExperimentation.Models.ResourceProvisioningState left, Azure.ResourceManager.OnlineExperimentation.Models.ResourceProvisioningState right) { throw null; } + public override string ToString() { throw null; } + } +} diff --git a/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/assets.json b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/assets.json new file mode 100644 index 000000000000..9e49956a0064 --- /dev/null +++ b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/assets.json @@ -0,0 +1,7 @@ + +{ + "AssetsRepo": "Azure/azure-sdk-assets", + "AssetsRepoPrefixPath": "net", + "TagPrefix": "net/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation", + "Tag": "" +} diff --git a/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/samples/Azure.ResourceManager.OnlineExperimentation.Samples.csproj b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/samples/Azure.ResourceManager.OnlineExperimentation.Samples.csproj new file mode 100644 index 000000000000..bd64b7950a3b --- /dev/null +++ b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/samples/Azure.ResourceManager.OnlineExperimentation.Samples.csproj @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/samples/Generated/Samples/Sample_OnlineExperimentWorkspaceCollection.cs b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/samples/Generated/Samples/Sample_OnlineExperimentWorkspaceCollection.cs new file mode 100644 index 000000000000..5861b06e1435 --- /dev/null +++ b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/samples/Generated/Samples/Sample_OnlineExperimentWorkspaceCollection.cs @@ -0,0 +1,272 @@ +// 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.Models; +using Azure.ResourceManager.OnlineExperimentation.Models; +using Azure.ResourceManager.Resources; +using NUnit.Framework; + +namespace Azure.ResourceManager.OnlineExperimentation.Samples +{ + public partial class Sample_OnlineExperimentWorkspaceCollection + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task CreateOrUpdate_CreateOrUpdateAnOnlineExperimentWorkspaceWithFreeSku() + { + // Generated from example definition: 2025-05-31-preview/OnlineExperimentWorkspaces_CreateOrUpdate.json + // this example is just showing the usage of "OnlineExperimentWorkspace_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 = "fa5fc227-a624-475e-b696-cdd604c735bc"; + string resourceGroupName = "res9871"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this OnlineExperimentWorkspaceResource + OnlineExperimentWorkspaceCollection collection = resourceGroupResource.GetOnlineExperimentWorkspaces(); + + // invoke the operation + string workspaceName = "expworkspace7"; + OnlineExperimentWorkspaceData data = new OnlineExperimentWorkspaceData(new AzureLocation("eastus2")) + { + Properties = new OnlineExperimentWorkspaceProperties(new ResourceIdentifier("/subscriptions/fa5fc227-a624-475e-b696-cdd604c735bc/resourceGroups/res9871/providers/Microsoft.OperationalInsights/workspaces/log9871"), new ResourceIdentifier("/subscriptions/fa5fc227-a624-475e-b696-cdd604c735bc/resourceGroups/res9871/providers/Microsoft.Storage/storageAccounts/sto9871"), new ResourceIdentifier("/subscriptions/fa5fc227-a624-475e-b696-cdd604c735bc/resourceGroups/res9871/providers/Microsoft.AppConfiguration/configurationStores/appconfig9871")), + Identity = new ManagedServiceIdentity("UserAssigned") + { + UserAssignedIdentities = +{ +[new ResourceIdentifier("/subscriptions/fa5fc227-a624-475e-b696-cdd604c735bc/resourceGroups/eu2cgroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id1")] = new UserAssignedIdentity(), +[new ResourceIdentifier("/subscriptions/fa5fc227-a624-475e-b696-cdd604c735bc/resourceGroups/eu2cgroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id2")] = new UserAssignedIdentity() +}, + }, + Sku = new OnlineExperimentationWorkspaceSku(OnlineExperimentationWorkspaceSkuName.F0), + Tags = +{ +["newKey"] = "newVal" +}, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, workspaceName, data); + OnlineExperimentWorkspaceResource 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 + OnlineExperimentWorkspaceData 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 CreateOrUpdate_CreateOrUpdateAnOnlineExperimentWorkspaceWithFreeSkuAndCustomerManagedKey() + { + // Generated from example definition: 2025-05-31-preview/OnlineExperimentWorkspaces_CreateOrUpdateWithEncryption.json + // this example is just showing the usage of "OnlineExperimentWorkspace_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 = "fa5fc227-a624-475e-b696-cdd604c735bc"; + string resourceGroupName = "res9871"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this OnlineExperimentWorkspaceResource + OnlineExperimentWorkspaceCollection collection = resourceGroupResource.GetOnlineExperimentWorkspaces(); + + // invoke the operation + string workspaceName = "expworkspace7"; + OnlineExperimentWorkspaceData data = new OnlineExperimentWorkspaceData(new AzureLocation("eastus2")) + { + Properties = new OnlineExperimentWorkspaceProperties(new ResourceIdentifier("/subscriptions/fa5fc227-a624-475e-b696-cdd604c735bc/resourceGroups/res9871/providers/Microsoft.OperationalInsights/workspaces/log9871"), new ResourceIdentifier("/subscriptions/fa5fc227-a624-475e-b696-cdd604c735bc/resourceGroups/res9871/providers/Microsoft.Storage/storageAccounts/sto9871"), new ResourceIdentifier("/subscriptions/fa5fc227-a624-475e-b696-cdd604c735bc/resourceGroups/res9871/providers/Microsoft.AppConfiguration/configurationStores/appconfig9871")) + { + CustomerManagedKeyEncryption = new CustomerManagedKeyEncryption + { + KeyEncryptionKeyIdentity = new KeyEncryptionKeyIdentity + { + IdentityType = KeyEncryptionKeyIdentityType.UserAssignedIdentity, + UserAssignedIdentityResourceId = new ResourceIdentifier("/subscriptions/fa5fc227-a624-475e-b696-cdd604c735bc/resourceGroups/eu2cgroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id1"), + }, + KeyEncryptionKeyUri = new Uri("https://contosovault.vault.azure.net/keys/contosokek"), + }, + }, + Identity = new ManagedServiceIdentity("UserAssigned") + { + UserAssignedIdentities = +{ +[new ResourceIdentifier("/subscriptions/fa5fc227-a624-475e-b696-cdd604c735bc/resourceGroups/eu2cgroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id1")] = new UserAssignedIdentity(), +[new ResourceIdentifier("/subscriptions/fa5fc227-a624-475e-b696-cdd604c735bc/resourceGroups/eu2cgroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id2")] = new UserAssignedIdentity() +}, + }, + Sku = new OnlineExperimentationWorkspaceSku(OnlineExperimentationWorkspaceSkuName.F0), + Tags = +{ +["newKey"] = "newVal" +}, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, workspaceName, data); + OnlineExperimentWorkspaceResource 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 + OnlineExperimentWorkspaceData 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_GetASingleOnlineExperimentWorkspace() + { + // Generated from example definition: 2025-05-31-preview/OnlineExperimentWorkspaces_Get.json + // this example is just showing the usage of "OnlineExperimentWorkspace_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 = "fa5fc227-a624-475e-b696-cdd604c735bc"; + string resourceGroupName = "res9871"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this OnlineExperimentWorkspaceResource + OnlineExperimentWorkspaceCollection collection = resourceGroupResource.GetOnlineExperimentWorkspaces(); + + // invoke the operation + string workspaceName = "expworkspace3"; + OnlineExperimentWorkspaceResource result = await collection.GetAsync(workspaceName); + + // 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 + OnlineExperimentWorkspaceData 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_ListOnlineExperimentWorkspacesInAResourceGroup() + { + // Generated from example definition: 2025-05-31-preview/OnlineExperimentWorkspaces_ListByResourceGroup.json + // this example is just showing the usage of "OnlineExperimentWorkspace_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 = "fa5fc227-a624-475e-b696-cdd604c735bc"; + string resourceGroupName = "res9871"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this OnlineExperimentWorkspaceResource + OnlineExperimentWorkspaceCollection collection = resourceGroupResource.GetOnlineExperimentWorkspaces(); + + // invoke the operation and iterate over the result + await foreach (OnlineExperimentWorkspaceResource 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 + OnlineExperimentWorkspaceData 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_GetASingleOnlineExperimentWorkspace() + { + // Generated from example definition: 2025-05-31-preview/OnlineExperimentWorkspaces_Get.json + // this example is just showing the usage of "OnlineExperimentWorkspace_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 = "fa5fc227-a624-475e-b696-cdd604c735bc"; + string resourceGroupName = "res9871"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this OnlineExperimentWorkspaceResource + OnlineExperimentWorkspaceCollection collection = resourceGroupResource.GetOnlineExperimentWorkspaces(); + + // invoke the operation + string workspaceName = "expworkspace3"; + bool result = await collection.ExistsAsync(workspaceName); + + Console.WriteLine($"Succeeded: {result}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetIfExists_GetASingleOnlineExperimentWorkspace() + { + // Generated from example definition: 2025-05-31-preview/OnlineExperimentWorkspaces_Get.json + // this example is just showing the usage of "OnlineExperimentWorkspace_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 = "fa5fc227-a624-475e-b696-cdd604c735bc"; + string resourceGroupName = "res9871"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this OnlineExperimentWorkspaceResource + OnlineExperimentWorkspaceCollection collection = resourceGroupResource.GetOnlineExperimentWorkspaces(); + + // invoke the operation + string workspaceName = "expworkspace3"; + NullableResponse response = await collection.GetIfExistsAsync(workspaceName); + OnlineExperimentWorkspaceResource 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 + OnlineExperimentWorkspaceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + } +} diff --git a/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/samples/Generated/Samples/Sample_OnlineExperimentWorkspaceResource.cs b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/samples/Generated/Samples/Sample_OnlineExperimentWorkspaceResource.cs new file mode 100644 index 000000000000..2af3b25731b3 --- /dev/null +++ b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/samples/Generated/Samples/Sample_OnlineExperimentWorkspaceResource.cs @@ -0,0 +1,182 @@ +// 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.Models; +using Azure.ResourceManager.OnlineExperimentation.Models; +using NUnit.Framework; + +namespace Azure.ResourceManager.OnlineExperimentation.Samples +{ + public partial class Sample_OnlineExperimentWorkspaceResource + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Get_GetASingleOnlineExperimentWorkspace() + { + // Generated from example definition: 2025-05-31-preview/OnlineExperimentWorkspaces_Get.json + // this example is just showing the usage of "OnlineExperimentWorkspace_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 OnlineExperimentWorkspaceResource created on azure + // for more information of creating OnlineExperimentWorkspaceResource, please refer to the document of OnlineExperimentWorkspaceResource + string subscriptionId = "fa5fc227-a624-475e-b696-cdd604c735bc"; + string resourceGroupName = "res9871"; + string workspaceName = "expworkspace3"; + ResourceIdentifier onlineExperimentWorkspaceResourceId = OnlineExperimentWorkspaceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, workspaceName); + OnlineExperimentWorkspaceResource onlineExperimentWorkspace = client.GetOnlineExperimentWorkspaceResource(onlineExperimentWorkspaceResourceId); + + // invoke the operation + OnlineExperimentWorkspaceResource result = await onlineExperimentWorkspace.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 + OnlineExperimentWorkspaceData 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_DeleteAnOnlineExperimentWorkspace() + { + // Generated from example definition: 2025-05-31-preview/OnlineExperimentWorkspaces_Delete.json + // this example is just showing the usage of "OnlineExperimentWorkspace_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 OnlineExperimentWorkspaceResource created on azure + // for more information of creating OnlineExperimentWorkspaceResource, please refer to the document of OnlineExperimentWorkspaceResource + string subscriptionId = "fa5fc227-a624-475e-b696-cdd604c735bc"; + string resourceGroupName = "res9871"; + string workspaceName = "expworkspace3"; + ResourceIdentifier onlineExperimentWorkspaceResourceId = OnlineExperimentWorkspaceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, workspaceName); + OnlineExperimentWorkspaceResource onlineExperimentWorkspace = client.GetOnlineExperimentWorkspaceResource(onlineExperimentWorkspaceResourceId); + + // invoke the operation + await onlineExperimentWorkspace.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Update_UpdateAnOnlineExperimentWorkspace() + { + // Generated from example definition: 2025-05-31-preview/OnlineExperimentWorkspaces_Update.json + // this example is just showing the usage of "OnlineExperimentWorkspace_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 OnlineExperimentWorkspaceResource created on azure + // for more information of creating OnlineExperimentWorkspaceResource, please refer to the document of OnlineExperimentWorkspaceResource + string subscriptionId = "fa5fc227-a624-475e-b696-cdd604c735bc"; + string resourceGroupName = "res9871"; + string workspaceName = "expworkspace3"; + ResourceIdentifier onlineExperimentWorkspaceResourceId = OnlineExperimentWorkspaceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, workspaceName); + OnlineExperimentWorkspaceResource onlineExperimentWorkspace = client.GetOnlineExperimentWorkspaceResource(onlineExperimentWorkspaceResourceId); + + // invoke the operation + OnlineExperimentWorkspacePatch patch = new OnlineExperimentWorkspacePatch + { + Identity = new ManagedServiceIdentity("UserAssigned") + { + UserAssignedIdentities = +{ +[new ResourceIdentifier("/subscriptions/fa5fc227-a624-475e-b696-cdd604c735bc/resourceGroups/eu2cgroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id1")] = new UserAssignedIdentity(), +[new ResourceIdentifier("/subscriptions/fa5fc227-a624-475e-b696-cdd604c735bc/resourceGroups/eu2cgroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id2")] = new UserAssignedIdentity() +}, + }, + Tags = +{ +["newKey"] = "newVal" +}, + }; + ArmOperation lro = await onlineExperimentWorkspace.UpdateAsync(WaitUntil.Completed, patch); + OnlineExperimentWorkspaceResource 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 + OnlineExperimentWorkspaceData 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 Update_UpdateAnOnlineExperimentWorkspaceWithCustomerManagedEncryptionKey() + { + // Generated from example definition: 2025-05-31-preview/OnlineExperimentWorkspaces_UpdateWithEncryption.json + // this example is just showing the usage of "OnlineExperimentWorkspace_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 OnlineExperimentWorkspaceResource created on azure + // for more information of creating OnlineExperimentWorkspaceResource, please refer to the document of OnlineExperimentWorkspaceResource + string subscriptionId = "fa5fc227-a624-475e-b696-cdd604c735bc"; + string resourceGroupName = "res9871"; + string workspaceName = "expworkspace3"; + ResourceIdentifier onlineExperimentWorkspaceResourceId = OnlineExperimentWorkspaceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, workspaceName); + OnlineExperimentWorkspaceResource onlineExperimentWorkspace = client.GetOnlineExperimentWorkspaceResource(onlineExperimentWorkspaceResourceId); + + // invoke the operation + OnlineExperimentWorkspacePatch patch = new OnlineExperimentWorkspacePatch + { + Identity = new ManagedServiceIdentity("UserAssigned") + { + UserAssignedIdentities = +{ +[new ResourceIdentifier("/subscriptions/fa5fc227-a624-475e-b696-cdd604c735bc/resourceGroups/eu2cgroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id1")] = new UserAssignedIdentity(), +[new ResourceIdentifier("/subscriptions/fa5fc227-a624-475e-b696-cdd604c735bc/resourceGroups/eu2cgroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id2")] = new UserAssignedIdentity() +}, + }, + Tags = +{ +["newKey"] = "newVal" +}, + Properties = new OnlineExperimentWorkspacePatchProperties + { + LogAnalyticsWorkspaceResourceId = new ResourceIdentifier("/subscriptions/fa5fc227-a624-475e-b696-cdd604c735bc/resourceGroups/res9871/providers/Microsoft.OperationalInsights/workspaces/log9871"), + LogsExporterStorageAccountResourceId = new ResourceIdentifier("/subscriptions/fa5fc227-a624-475e-b696-cdd604c735bc/resourceGroups/res9871/providers/Microsoft.Storage/storageAccounts/sto9871"), + CustomerManagedKeyEncryption = new CustomerManagedKeyEncryption + { + KeyEncryptionKeyIdentity = new KeyEncryptionKeyIdentity + { + IdentityType = KeyEncryptionKeyIdentityType.UserAssignedIdentity, + UserAssignedIdentityResourceId = new ResourceIdentifier("/subscriptions/fa5fc227-a624-475e-b696-cdd604c735bc/resourceGroups/eu2cgroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id1"), + }, + KeyEncryptionKeyUri = new Uri("https://contosovault.vault.azure.net/keys/contosokek"), + }, + }, + }; + ArmOperation lro = await onlineExperimentWorkspace.UpdateAsync(WaitUntil.Completed, patch); + OnlineExperimentWorkspaceResource 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 + OnlineExperimentWorkspaceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs new file mode 100644 index 000000000000..10c9728ba122 --- /dev/null +++ b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/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.OnlineExperimentation.Samples +{ + public partial class Sample_SubscriptionResourceExtensions + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetOnlineExperimentWorkspaces_ListOnlineExperimentWorkspacesInASubscription() + { + // Generated from example definition: 2025-05-31-preview/OnlineExperimentWorkspaces_ListBySubscription.json + // this example is just showing the usage of "OnlineExperimentWorkspace_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 = "fa5fc227-a624-475e-b696-cdd604c735bc"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // invoke the operation and iterate over the result + await foreach (OnlineExperimentWorkspaceResource item in subscriptionResource.GetOnlineExperimentWorkspacesAsync()) + { + // 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 + OnlineExperimentWorkspaceData 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/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Azure.ResourceManager.OnlineExperimentation.csproj b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Azure.ResourceManager.OnlineExperimentation.csproj new file mode 100644 index 000000000000..0cd904f70d96 --- /dev/null +++ b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Azure.ResourceManager.OnlineExperimentation.csproj @@ -0,0 +1,8 @@ + + + Azure Resource Manager client SDK for Azure resource provider OnlineExperimentation. + 1.0.0-beta.1 + azure;management;arm;resource manager;onlineexperimentation + Azure.ResourceManager.OnlineExperimentation + + diff --git a/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/ArmOnlineExperimentationModelFactory.cs b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/ArmOnlineExperimentationModelFactory.cs new file mode 100644 index 000000000000..7c01043e0917 --- /dev/null +++ b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/ArmOnlineExperimentationModelFactory.cs @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; +using Azure.Core; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.OnlineExperimentation.Models +{ + /// Model factory for models. + public static partial class ArmOnlineExperimentationModelFactory + { + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The tags. + /// The location. + /// The resource-specific properties for this resource. + /// The managed service identities assigned to this resource. + /// The SKU (Stock Keeping Unit) assigned to this resource. + /// A new instance for mocking. + public static OnlineExperimentWorkspaceData OnlineExperimentWorkspaceData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, OnlineExperimentWorkspaceProperties properties = null, ManagedServiceIdentity identity = null, OnlineExperimentationWorkspaceSku sku = null) + { + tags ??= new Dictionary(); + + return new OnlineExperimentWorkspaceData( + id, + name, + resourceType, + systemData, + tags, + location, + properties, + identity, + sku, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The Id of the workspace. + /// The provisioning state for the resource. + /// The resource identifier of the Log Analytics workspace which online experiment workspace uses for generating experiment analysis results. + /// The resource identifier of storage account where logs are exported from Log Analytics workspace. Online Experiment workspace uses it generating experiment analysis results. + /// The resource identifier of App Configuration with which this online experiment workspace is tied for experimentation. This is a required field for creating an online experiment workspace. + /// The encryption configuration for the online experiment workspace resource. + /// The data plane endpoint for the online experiment workspace resource. + /// A new instance for mocking. + public static OnlineExperimentWorkspaceProperties OnlineExperimentWorkspaceProperties(string workspaceId = null, ResourceProvisioningState? provisioningState = null, ResourceIdentifier logAnalyticsWorkspaceResourceId = null, ResourceIdentifier logsExporterStorageAccountResourceId = null, ResourceIdentifier appConfigurationResourceId = null, CustomerManagedKeyEncryption customerManagedKeyEncryption = null, Uri endpoint = null) + { + return new OnlineExperimentWorkspaceProperties( + workspaceId, + provisioningState, + logAnalyticsWorkspaceResourceId, + logsExporterStorageAccountResourceId, + appConfigurationResourceId, + customerManagedKeyEncryption != null ? new ResourceEncryptionConfiguration(customerManagedKeyEncryption, serializedAdditionalRawData: null) : null, + endpoint, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The name of the SKU. Ex - F0, P0. It is typically a letter+number code. + /// The name of the SKU tier. + /// A new instance for mocking. + public static OnlineExperimentationWorkspaceSku OnlineExperimentationWorkspaceSku(OnlineExperimentationWorkspaceSkuName name = default, OnlineExperimentationWorkspaceSkuTier? tier = null) + { + return new OnlineExperimentationWorkspaceSku(name, tier, serializedAdditionalRawData: null); + } + } +} diff --git a/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Extensions/MockableOnlineExperimentationArmClient.cs b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Extensions/MockableOnlineExperimentationArmClient.cs new file mode 100644 index 000000000000..669fb77b6060 --- /dev/null +++ b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Extensions/MockableOnlineExperimentationArmClient.cs @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; + +namespace Azure.ResourceManager.OnlineExperimentation.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableOnlineExperimentationArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableOnlineExperimentationArmClient() + { + } + + /// 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 MockableOnlineExperimentationArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableOnlineExperimentationArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets an object representing an along with the instance operations that can be performed on it but with no data. + /// You can use to create an from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual OnlineExperimentWorkspaceResource GetOnlineExperimentWorkspaceResource(ResourceIdentifier id) + { + OnlineExperimentWorkspaceResource.ValidateResourceId(id); + return new OnlineExperimentWorkspaceResource(Client, id); + } + } +} diff --git a/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Extensions/MockableOnlineExperimentationResourceGroupResource.cs b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Extensions/MockableOnlineExperimentationResourceGroupResource.cs new file mode 100644 index 000000000000..195543a97bdb --- /dev/null +++ b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Extensions/MockableOnlineExperimentationResourceGroupResource.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.OnlineExperimentation.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableOnlineExperimentationResourceGroupResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableOnlineExperimentationResourceGroupResource() + { + } + + /// 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 MockableOnlineExperimentationResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of OnlineExperimentWorkspaceResources in the ResourceGroupResource. + /// An object representing collection of OnlineExperimentWorkspaceResources and their operations over a OnlineExperimentWorkspaceResource. + public virtual OnlineExperimentWorkspaceCollection GetOnlineExperimentWorkspaces() + { + return GetCachedClient(client => new OnlineExperimentWorkspaceCollection(client, Id)); + } + + /// + /// Gets an experiment workspace + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OnlineExperimentation/workspaces/{workspaceName} + /// + /// + /// Operation Id + /// OnlineExperimentWorkspace_Get + /// + /// + /// Default Api Version + /// 2025-05-31-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the OnlineExperimentWorkspace. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetOnlineExperimentWorkspaceAsync(string workspaceName, CancellationToken cancellationToken = default) + { + return await GetOnlineExperimentWorkspaces().GetAsync(workspaceName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets an experiment workspace + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OnlineExperimentation/workspaces/{workspaceName} + /// + /// + /// Operation Id + /// OnlineExperimentWorkspace_Get + /// + /// + /// Default Api Version + /// 2025-05-31-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the OnlineExperimentWorkspace. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetOnlineExperimentWorkspace(string workspaceName, CancellationToken cancellationToken = default) + { + return GetOnlineExperimentWorkspaces().Get(workspaceName, cancellationToken); + } + } +} diff --git a/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Extensions/MockableOnlineExperimentationSubscriptionResource.cs b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Extensions/MockableOnlineExperimentationSubscriptionResource.cs new file mode 100644 index 000000000000..a60f6cd7553e --- /dev/null +++ b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Extensions/MockableOnlineExperimentationSubscriptionResource.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.OnlineExperimentation.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableOnlineExperimentationSubscriptionResource : ArmResource + { + private ClientDiagnostics _onlineExperimentWorkspaceClientDiagnostics; + private OnlineExperimentWorkspacesRestOperations _onlineExperimentWorkspaceRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableOnlineExperimentationSubscriptionResource() + { + } + + /// 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 MockableOnlineExperimentationSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics OnlineExperimentWorkspaceClientDiagnostics => _onlineExperimentWorkspaceClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.OnlineExperimentation", OnlineExperimentWorkspaceResource.ResourceType.Namespace, Diagnostics); + private OnlineExperimentWorkspacesRestOperations OnlineExperimentWorkspaceRestClient => _onlineExperimentWorkspaceRestClient ??= new OnlineExperimentWorkspacesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(OnlineExperimentWorkspaceResource.ResourceType)); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets all experiment workspaces in the specified subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.OnlineExperimentation/workspaces + /// + /// + /// Operation Id + /// OnlineExperimentWorkspace_ListBySubscription + /// + /// + /// Default Api Version + /// 2025-05-31-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetOnlineExperimentWorkspacesAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => OnlineExperimentWorkspaceRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => OnlineExperimentWorkspaceRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new OnlineExperimentWorkspaceResource(Client, OnlineExperimentWorkspaceData.DeserializeOnlineExperimentWorkspaceData(e)), OnlineExperimentWorkspaceClientDiagnostics, Pipeline, "MockableOnlineExperimentationSubscriptionResource.GetOnlineExperimentWorkspaces", "value", "nextLink", cancellationToken); + } + + /// + /// Gets all experiment workspaces in the specified subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.OnlineExperimentation/workspaces + /// + /// + /// Operation Id + /// OnlineExperimentWorkspace_ListBySubscription + /// + /// + /// Default Api Version + /// 2025-05-31-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetOnlineExperimentWorkspaces(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => OnlineExperimentWorkspaceRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => OnlineExperimentWorkspaceRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new OnlineExperimentWorkspaceResource(Client, OnlineExperimentWorkspaceData.DeserializeOnlineExperimentWorkspaceData(e)), OnlineExperimentWorkspaceClientDiagnostics, Pipeline, "MockableOnlineExperimentationSubscriptionResource.GetOnlineExperimentWorkspaces", "value", "nextLink", cancellationToken); + } + } +} diff --git a/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Extensions/OnlineExperimentationExtensions.cs b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Extensions/OnlineExperimentationExtensions.cs new file mode 100644 index 000000000000..c66a6e467b46 --- /dev/null +++ b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Extensions/OnlineExperimentationExtensions.cs @@ -0,0 +1,219 @@ +// 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.OnlineExperimentation.Mocking; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.OnlineExperimentation +{ + /// A class to add extension methods to Azure.ResourceManager.OnlineExperimentation. + public static partial class OnlineExperimentationExtensions + { + private static MockableOnlineExperimentationArmClient GetMockableOnlineExperimentationArmClient(ArmClient client) + { + return client.GetCachedClient(client0 => new MockableOnlineExperimentationArmClient(client0)); + } + + private static MockableOnlineExperimentationResourceGroupResource GetMockableOnlineExperimentationResourceGroupResource(ArmResource resource) + { + return resource.GetCachedClient(client => new MockableOnlineExperimentationResourceGroupResource(client, resource.Id)); + } + + private static MockableOnlineExperimentationSubscriptionResource GetMockableOnlineExperimentationSubscriptionResource(ArmResource resource) + { + return resource.GetCachedClient(client => new MockableOnlineExperimentationSubscriptionResource(client, resource.Id)); + } + + /// + /// Gets an object representing an along with the instance operations that can be performed on it but with no data. + /// You can use to create an from its components. + /// + /// 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 OnlineExperimentWorkspaceResource GetOnlineExperimentWorkspaceResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableOnlineExperimentationArmClient(client).GetOnlineExperimentWorkspaceResource(id); + } + + /// + /// Gets a collection of OnlineExperimentWorkspaceResources 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 OnlineExperimentWorkspaceResources and their operations over a OnlineExperimentWorkspaceResource. + public static OnlineExperimentWorkspaceCollection GetOnlineExperimentWorkspaces(this ResourceGroupResource resourceGroupResource) + { + Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); + + return GetMockableOnlineExperimentationResourceGroupResource(resourceGroupResource).GetOnlineExperimentWorkspaces(); + } + + /// + /// Gets an experiment workspace + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OnlineExperimentation/workspaces/{workspaceName} + /// + /// + /// Operation Id + /// OnlineExperimentWorkspace_Get + /// + /// + /// Default Api Version + /// 2025-05-31-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The name of the OnlineExperimentWorkspace. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static async Task> GetOnlineExperimentWorkspaceAsync(this ResourceGroupResource resourceGroupResource, string workspaceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); + + return await GetMockableOnlineExperimentationResourceGroupResource(resourceGroupResource).GetOnlineExperimentWorkspaceAsync(workspaceName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets an experiment workspace + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OnlineExperimentation/workspaces/{workspaceName} + /// + /// + /// Operation Id + /// OnlineExperimentWorkspace_Get + /// + /// + /// Default Api Version + /// 2025-05-31-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The name of the OnlineExperimentWorkspace. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static Response GetOnlineExperimentWorkspace(this ResourceGroupResource resourceGroupResource, string workspaceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); + + return GetMockableOnlineExperimentationResourceGroupResource(resourceGroupResource).GetOnlineExperimentWorkspace(workspaceName, cancellationToken); + } + + /// + /// Gets all experiment workspaces in the specified subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.OnlineExperimentation/workspaces + /// + /// + /// Operation Id + /// OnlineExperimentWorkspace_ListBySubscription + /// + /// + /// Default Api Version + /// 2025-05-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 GetOnlineExperimentWorkspacesAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); + + return GetMockableOnlineExperimentationSubscriptionResource(subscriptionResource).GetOnlineExperimentWorkspacesAsync(cancellationToken); + } + + /// + /// Gets all experiment workspaces in the specified subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.OnlineExperimentation/workspaces + /// + /// + /// Operation Id + /// OnlineExperimentWorkspace_ListBySubscription + /// + /// + /// Default Api Version + /// 2025-05-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 GetOnlineExperimentWorkspaces(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); + + return GetMockableOnlineExperimentationSubscriptionResource(subscriptionResource).GetOnlineExperimentWorkspaces(cancellationToken); + } + } +} diff --git a/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Internal/Argument.cs b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Internal/Argument.cs new file mode 100644 index 000000000000..c344bacf5812 --- /dev/null +++ b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/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.OnlineExperimentation +{ + 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/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Internal/ChangeTrackingDictionary.cs b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Internal/ChangeTrackingDictionary.cs new file mode 100644 index 000000000000..5eec91d4d3ae --- /dev/null +++ b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/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.OnlineExperimentation +{ + 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/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Internal/ChangeTrackingList.cs b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Internal/ChangeTrackingList.cs new file mode 100644 index 000000000000..d2c1828f4017 --- /dev/null +++ b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/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.OnlineExperimentation +{ + 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/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Internal/ModelSerializationExtensions.cs b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Internal/ModelSerializationExtensions.cs new file mode 100644 index 000000000000..328975f6da73 --- /dev/null +++ b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/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.OnlineExperimentation +{ + 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/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Internal/Optional.cs b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Internal/Optional.cs new file mode 100644 index 000000000000..fc4221ab7bbf --- /dev/null +++ b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/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.OnlineExperimentation +{ + 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/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Internal/Utf8JsonRequestContent.cs b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Internal/Utf8JsonRequestContent.cs new file mode 100644 index 000000000000..0859f0f298eb --- /dev/null +++ b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/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.OnlineExperimentation +{ + 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/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/LongRunningOperation/OnlineExperimentWorkspaceOperationSource.cs b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/LongRunningOperation/OnlineExperimentWorkspaceOperationSource.cs new file mode 100644 index 000000000000..07e8467f2614 --- /dev/null +++ b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/LongRunningOperation/OnlineExperimentWorkspaceOperationSource.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.OnlineExperimentation +{ + internal class OnlineExperimentWorkspaceOperationSource : IOperationSource + { + private readonly ArmClient _client; + + internal OnlineExperimentWorkspaceOperationSource(ArmClient client) + { + _client = client; + } + + OnlineExperimentWorkspaceResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + var data = ModelReaderWriter.Read(response.Content, ModelReaderWriterOptions.Json, AzureResourceManagerOnlineExperimentationContext.Default); + return new OnlineExperimentWorkspaceResource(_client, data); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + var data = ModelReaderWriter.Read(response.Content, ModelReaderWriterOptions.Json, AzureResourceManagerOnlineExperimentationContext.Default); + return await Task.FromResult(new OnlineExperimentWorkspaceResource(_client, data)).ConfigureAwait(false); + } + } +} diff --git a/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/LongRunningOperation/OnlineExperimentationArmOperation.cs b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/LongRunningOperation/OnlineExperimentationArmOperation.cs new file mode 100644 index 000000000000..18f94030d14c --- /dev/null +++ b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/LongRunningOperation/OnlineExperimentationArmOperation.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.OnlineExperimentation +{ +#pragma warning disable SA1649 // File name should match first type name + internal class OnlineExperimentationArmOperation : 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 OnlineExperimentationArmOperation for mocking. + protected OnlineExperimentationArmOperation() + { + } + + internal OnlineExperimentationArmOperation(Response response, RehydrationToken? rehydrationToken = null) + { + _operation = OperationInternal.Succeeded(response); + _completeRehydrationToken = rehydrationToken; + _operationId = GetOperationId(rehydrationToken); + } + + internal OnlineExperimentationArmOperation(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, "OnlineExperimentationArmOperation", fallbackStrategy: new SequentialDelayStrategy()); + } + + private string GetOperationId(RehydrationToken? rehydrationToken) + { + if (rehydrationToken is null) + { + return null; + } + var lroDetails = ModelReaderWriter.Write(rehydrationToken, ModelReaderWriterOptions.Json, AzureResourceManagerOnlineExperimentationContext.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/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/LongRunningOperation/OnlineExperimentationArmOperationOfT.cs b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/LongRunningOperation/OnlineExperimentationArmOperationOfT.cs new file mode 100644 index 000000000000..051b16a010a1 --- /dev/null +++ b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/LongRunningOperation/OnlineExperimentationArmOperationOfT.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.OnlineExperimentation +{ +#pragma warning disable SA1649 // File name should match first type name + internal class OnlineExperimentationArmOperation : 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 OnlineExperimentationArmOperation for mocking. + protected OnlineExperimentationArmOperation() + { + } + + internal OnlineExperimentationArmOperation(Response response, RehydrationToken? rehydrationToken = null) + { + _operation = OperationInternal.Succeeded(response.GetRawResponse(), response.Value); + _completeRehydrationToken = rehydrationToken; + _operationId = GetOperationId(rehydrationToken); + } + + internal OnlineExperimentationArmOperation(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, "OnlineExperimentationArmOperation", fallbackStrategy: new SequentialDelayStrategy()); + } + + private string GetOperationId(RehydrationToken? rehydrationToken) + { + if (rehydrationToken is null) + { + return null; + } + var lroDetails = ModelReaderWriter.Write(rehydrationToken, ModelReaderWriterOptions.Json, AzureResourceManagerOnlineExperimentationContext.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/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Models/AzureResourceManagerOnlineExperimentationContext.cs b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Models/AzureResourceManagerOnlineExperimentationContext.cs new file mode 100644 index 000000000000..c84fd856fbc0 --- /dev/null +++ b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Models/AzureResourceManagerOnlineExperimentationContext.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.OnlineExperimentation +{ + /// + /// 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 AzureResourceManagerOnlineExperimentationContext : ModelReaderWriterContext + { + } +} diff --git a/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Models/CustomerManagedKeyEncryption.Serialization.cs b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Models/CustomerManagedKeyEncryption.Serialization.cs new file mode 100644 index 000000000000..479c00625c80 --- /dev/null +++ b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Models/CustomerManagedKeyEncryption.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.OnlineExperimentation.Models +{ + public partial class CustomerManagedKeyEncryption : 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(CustomerManagedKeyEncryption)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(KeyEncryptionKeyIdentity)) + { + writer.WritePropertyName("keyEncryptionKeyIdentity"u8); + writer.WriteObjectValue(KeyEncryptionKeyIdentity, options); + } + if (Optional.IsDefined(KeyEncryptionKeyUri)) + { + writer.WritePropertyName("keyEncryptionKeyUrl"u8); + writer.WriteStringValue(KeyEncryptionKeyUri.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 + } + } + } + + CustomerManagedKeyEncryption 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(CustomerManagedKeyEncryption)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeCustomerManagedKeyEncryption(document.RootElement, options); + } + + internal static CustomerManagedKeyEncryption DeserializeCustomerManagedKeyEncryption(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + KeyEncryptionKeyIdentity keyEncryptionKeyIdentity = default; + Uri keyEncryptionKeyUrl = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("keyEncryptionKeyIdentity"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + keyEncryptionKeyIdentity = KeyEncryptionKeyIdentity.DeserializeKeyEncryptionKeyIdentity(property.Value, options); + continue; + } + if (property.NameEquals("keyEncryptionKeyUrl"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + keyEncryptionKeyUrl = new Uri(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new CustomerManagedKeyEncryption(keyEncryptionKeyIdentity, keyEncryptionKeyUrl, 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, AzureResourceManagerOnlineExperimentationContext.Default); + default: + throw new FormatException($"The model {nameof(CustomerManagedKeyEncryption)} does not support writing '{options.Format}' format."); + } + } + + CustomerManagedKeyEncryption 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 DeserializeCustomerManagedKeyEncryption(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(CustomerManagedKeyEncryption)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Models/CustomerManagedKeyEncryption.cs b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Models/CustomerManagedKeyEncryption.cs new file mode 100644 index 000000000000..086b415c91c4 --- /dev/null +++ b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Models/CustomerManagedKeyEncryption.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.OnlineExperimentation.Models +{ + /// Customer-managed key encryption properties for the resource. + public partial class CustomerManagedKeyEncryption + { + /// + /// 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 CustomerManagedKeyEncryption() + { + } + + /// Initializes a new instance of . + /// All identity configuration for Customer-managed key settings defining which identity should be used to auth to Key Vault. + /// key encryption key Url, versioned or non-versioned. Ex: https://contosovault.vault.azure.net/keys/contosokek/562a4bb76b524a1493a6afe8e536ee78 or https://contosovault.vault.azure.net/keys/contosokek. + /// Keeps track of any properties unknown to the library. + internal CustomerManagedKeyEncryption(KeyEncryptionKeyIdentity keyEncryptionKeyIdentity, Uri keyEncryptionKeyUri, IDictionary serializedAdditionalRawData) + { + KeyEncryptionKeyIdentity = keyEncryptionKeyIdentity; + KeyEncryptionKeyUri = keyEncryptionKeyUri; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// All identity configuration for Customer-managed key settings defining which identity should be used to auth to Key Vault. + public KeyEncryptionKeyIdentity KeyEncryptionKeyIdentity { get; set; } + /// key encryption key Url, versioned or non-versioned. Ex: https://contosovault.vault.azure.net/keys/contosokek/562a4bb76b524a1493a6afe8e536ee78 or https://contosovault.vault.azure.net/keys/contosokek. + public Uri KeyEncryptionKeyUri { get; set; } + } +} diff --git a/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Models/KeyEncryptionKeyIdentity.Serialization.cs b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Models/KeyEncryptionKeyIdentity.Serialization.cs new file mode 100644 index 000000000000..86ed1b241153 --- /dev/null +++ b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Models/KeyEncryptionKeyIdentity.Serialization.cs @@ -0,0 +1,163 @@ +// 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.OnlineExperimentation.Models +{ + public partial class KeyEncryptionKeyIdentity : 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(KeyEncryptionKeyIdentity)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(IdentityType)) + { + writer.WritePropertyName("identityType"u8); + writer.WriteStringValue(IdentityType.Value.ToString()); + } + if (Optional.IsDefined(UserAssignedIdentityResourceId)) + { + writer.WritePropertyName("userAssignedIdentityResourceId"u8); + writer.WriteStringValue(UserAssignedIdentityResourceId); + } + if (Optional.IsDefined(FederatedClientId)) + { + writer.WritePropertyName("federatedClientId"u8); + writer.WriteStringValue(FederatedClientId.Value); + } + 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 + } + } + } + + KeyEncryptionKeyIdentity 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(KeyEncryptionKeyIdentity)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeKeyEncryptionKeyIdentity(document.RootElement, options); + } + + internal static KeyEncryptionKeyIdentity DeserializeKeyEncryptionKeyIdentity(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + KeyEncryptionKeyIdentityType? identityType = default; + ResourceIdentifier userAssignedIdentityResourceId = default; + Guid? federatedClientId = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("identityType"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + identityType = new KeyEncryptionKeyIdentityType(property.Value.GetString()); + continue; + } + if (property.NameEquals("userAssignedIdentityResourceId"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + userAssignedIdentityResourceId = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("federatedClientId"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + federatedClientId = property.Value.GetGuid(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new KeyEncryptionKeyIdentity(identityType, userAssignedIdentityResourceId, federatedClientId, 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, AzureResourceManagerOnlineExperimentationContext.Default); + default: + throw new FormatException($"The model {nameof(KeyEncryptionKeyIdentity)} does not support writing '{options.Format}' format."); + } + } + + KeyEncryptionKeyIdentity 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 DeserializeKeyEncryptionKeyIdentity(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(KeyEncryptionKeyIdentity)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Models/KeyEncryptionKeyIdentity.cs b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Models/KeyEncryptionKeyIdentity.cs new file mode 100644 index 000000000000..7f917da8f03e --- /dev/null +++ b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Models/KeyEncryptionKeyIdentity.cs @@ -0,0 +1,74 @@ +// 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.OnlineExperimentation.Models +{ + /// All identity configuration for Customer-managed key settings defining which identity should be used to auth to Key Vault. + public partial class KeyEncryptionKeyIdentity + { + /// + /// 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 KeyEncryptionKeyIdentity() + { + } + + /// Initializes a new instance of . + /// The type of identity to use. Values can be systemAssignedIdentity, userAssignedIdentity, or delegatedResourceIdentity. + /// User assigned identity to use for accessing key encryption key Url. Ex: /subscriptions/fa5fc227-a624-475e-b696-cdd604c735bc/resourceGroups/<resource group>/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myId. Mutually exclusive with identityType systemAssignedIdentity. + /// application client identity to use for accessing key encryption key Url in a different tenant. Ex: f83c6b1b-4d34-47e4-bb34-9d83df58b540. + /// Keeps track of any properties unknown to the library. + internal KeyEncryptionKeyIdentity(KeyEncryptionKeyIdentityType? identityType, ResourceIdentifier userAssignedIdentityResourceId, Guid? federatedClientId, IDictionary serializedAdditionalRawData) + { + IdentityType = identityType; + UserAssignedIdentityResourceId = userAssignedIdentityResourceId; + FederatedClientId = federatedClientId; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The type of identity to use. Values can be systemAssignedIdentity, userAssignedIdentity, or delegatedResourceIdentity. + public KeyEncryptionKeyIdentityType? IdentityType { get; set; } + /// User assigned identity to use for accessing key encryption key Url. Ex: /subscriptions/fa5fc227-a624-475e-b696-cdd604c735bc/resourceGroups/<resource group>/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myId. Mutually exclusive with identityType systemAssignedIdentity. + public ResourceIdentifier UserAssignedIdentityResourceId { get; set; } + /// application client identity to use for accessing key encryption key Url in a different tenant. Ex: f83c6b1b-4d34-47e4-bb34-9d83df58b540. + public Guid? FederatedClientId { get; set; } + } +} diff --git a/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Models/KeyEncryptionKeyIdentityType.cs b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Models/KeyEncryptionKeyIdentityType.cs new file mode 100644 index 000000000000..5dcc17dbd48e --- /dev/null +++ b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Models/KeyEncryptionKeyIdentityType.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.OnlineExperimentation.Models +{ + /// The type of identity to use. + public readonly partial struct KeyEncryptionKeyIdentityType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public KeyEncryptionKeyIdentityType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string SystemAssignedIdentityValue = "SystemAssignedIdentity"; + private const string UserAssignedIdentityValue = "UserAssignedIdentity"; + + /// System assigned identity. + public static KeyEncryptionKeyIdentityType SystemAssignedIdentity { get; } = new KeyEncryptionKeyIdentityType(SystemAssignedIdentityValue); + /// User assigned identity. + public static KeyEncryptionKeyIdentityType UserAssignedIdentity { get; } = new KeyEncryptionKeyIdentityType(UserAssignedIdentityValue); + /// Determines if two values are the same. + public static bool operator ==(KeyEncryptionKeyIdentityType left, KeyEncryptionKeyIdentityType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(KeyEncryptionKeyIdentityType left, KeyEncryptionKeyIdentityType right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator KeyEncryptionKeyIdentityType(string value) => new KeyEncryptionKeyIdentityType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is KeyEncryptionKeyIdentityType other && Equals(other); + /// + public bool Equals(KeyEncryptionKeyIdentityType 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/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Models/OnlineExperimentWorkspaceListResult.Serialization.cs b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Models/OnlineExperimentWorkspaceListResult.Serialization.cs new file mode 100644 index 000000000000..8654621475e3 --- /dev/null +++ b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Models/OnlineExperimentWorkspaceListResult.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.OnlineExperimentation.Models +{ + internal partial class OnlineExperimentWorkspaceListResult : 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(OnlineExperimentWorkspaceListResult)} 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 + } + } + } + + OnlineExperimentWorkspaceListResult 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(OnlineExperimentWorkspaceListResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeOnlineExperimentWorkspaceListResult(document.RootElement, options); + } + + internal static OnlineExperimentWorkspaceListResult DeserializeOnlineExperimentWorkspaceListResult(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(OnlineExperimentWorkspaceData.DeserializeOnlineExperimentWorkspaceData(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 OnlineExperimentWorkspaceListResult(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, AzureResourceManagerOnlineExperimentationContext.Default); + default: + throw new FormatException($"The model {nameof(OnlineExperimentWorkspaceListResult)} does not support writing '{options.Format}' format."); + } + } + + OnlineExperimentWorkspaceListResult 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 DeserializeOnlineExperimentWorkspaceListResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(OnlineExperimentWorkspaceListResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Models/OnlineExperimentWorkspaceListResult.cs b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Models/OnlineExperimentWorkspaceListResult.cs new file mode 100644 index 000000000000..283ace09b30b --- /dev/null +++ b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Models/OnlineExperimentWorkspaceListResult.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.OnlineExperimentation.Models +{ + /// The response of a OnlineExperimentWorkspace list operation. + internal partial class OnlineExperimentWorkspaceListResult + { + /// + /// 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 OnlineExperimentWorkspace items on this page. + /// is null. + internal OnlineExperimentWorkspaceListResult(IEnumerable value) + { + Argument.AssertNotNull(value, nameof(value)); + + Value = value.ToList(); + } + + /// Initializes a new instance of . + /// The OnlineExperimentWorkspace items on this page. + /// The link to the next page of items. + /// Keeps track of any properties unknown to the library. + internal OnlineExperimentWorkspaceListResult(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) + { + Value = value; + NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal OnlineExperimentWorkspaceListResult() + { + } + + /// The OnlineExperimentWorkspace items on this page. + public IReadOnlyList Value { get; } + /// The link to the next page of items. + public Uri NextLink { get; } + } +} diff --git a/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Models/OnlineExperimentWorkspacePatch.Serialization.cs b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Models/OnlineExperimentWorkspacePatch.Serialization.cs new file mode 100644 index 000000000000..ec6588907411 --- /dev/null +++ b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Models/OnlineExperimentWorkspacePatch.Serialization.cs @@ -0,0 +1,192 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.OnlineExperimentation.Models +{ + public partial class OnlineExperimentWorkspacePatch : 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(OnlineExperimentWorkspacePatch)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(Identity)) + { + writer.WritePropertyName("identity"u8); + var serializeOptions = new JsonSerializerOptions { Converters = { new ManagedServiceIdentityTypeV3Converter() } }; + JsonSerializer.Serialize(writer, Identity, serializeOptions); + } + if (Optional.IsCollectionDefined(Tags)) + { + writer.WritePropertyName("tags"u8); + writer.WriteStartObject(); + foreach (var item in Tags) + { + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + if (Optional.IsDefined(Sku)) + { + writer.WritePropertyName("sku"u8); + writer.WriteObjectValue(Sku, options); + } + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + OnlineExperimentWorkspacePatch 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(OnlineExperimentWorkspacePatch)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeOnlineExperimentWorkspacePatch(document.RootElement, options); + } + + internal static OnlineExperimentWorkspacePatch DeserializeOnlineExperimentWorkspacePatch(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ManagedServiceIdentity identity = default; + IDictionary tags = default; + OnlineExperimentationWorkspaceSku sku = default; + OnlineExperimentWorkspacePatchProperties properties = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("identity"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + var serializeOptions = new JsonSerializerOptions { Converters = { new ManagedServiceIdentityTypeV3Converter() } }; + identity = JsonSerializer.Deserialize(property.Value.GetRawText(), serializeOptions); + continue; + } + if (property.NameEquals("tags"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (property.NameEquals("sku"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + sku = OnlineExperimentationWorkspaceSku.DeserializeOnlineExperimentationWorkspaceSku(property.Value, options); + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = OnlineExperimentWorkspacePatchProperties.DeserializeOnlineExperimentWorkspacePatchProperties(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new OnlineExperimentWorkspacePatch(identity, tags ?? new ChangeTrackingDictionary(), sku, 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, AzureResourceManagerOnlineExperimentationContext.Default); + default: + throw new FormatException($"The model {nameof(OnlineExperimentWorkspacePatch)} does not support writing '{options.Format}' format."); + } + } + + OnlineExperimentWorkspacePatch 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 DeserializeOnlineExperimentWorkspacePatch(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(OnlineExperimentWorkspacePatch)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Models/OnlineExperimentWorkspacePatch.cs b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Models/OnlineExperimentWorkspacePatch.cs new file mode 100644 index 000000000000..c5c8e4fd11ba --- /dev/null +++ b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Models/OnlineExperimentWorkspacePatch.cs @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.OnlineExperimentation.Models +{ + /// Partial update of an online experiment workspace resource. + public partial class OnlineExperimentWorkspacePatch + { + /// + /// 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 OnlineExperimentWorkspacePatch() + { + Tags = new ChangeTrackingDictionary(); + } + + /// Initializes a new instance of . + /// The managed service identities assigned to this resource. + /// Resource tags. + /// The SKU (Stock Keeping Unit) assigned to this resource. + /// Updatable properties of the online experiment workspace resource. + /// Keeps track of any properties unknown to the library. + internal OnlineExperimentWorkspacePatch(ManagedServiceIdentity identity, IDictionary tags, OnlineExperimentationWorkspaceSku sku, OnlineExperimentWorkspacePatchProperties properties, IDictionary serializedAdditionalRawData) + { + Identity = identity; + Tags = tags; + Sku = sku; + Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The managed service identities assigned to this resource. + public ManagedServiceIdentity Identity { get; set; } + /// Resource tags. + public IDictionary Tags { get; } + /// The SKU (Stock Keeping Unit) assigned to this resource. + public OnlineExperimentationWorkspaceSku Sku { get; set; } + /// Updatable properties of the online experiment workspace resource. + public OnlineExperimentWorkspacePatchProperties Properties { get; set; } + } +} diff --git a/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Models/OnlineExperimentWorkspacePatchProperties.Serialization.cs b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Models/OnlineExperimentWorkspacePatchProperties.Serialization.cs new file mode 100644 index 000000000000..a63f580ab729 --- /dev/null +++ b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Models/OnlineExperimentWorkspacePatchProperties.Serialization.cs @@ -0,0 +1,163 @@ +// 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.OnlineExperimentation.Models +{ + public partial class OnlineExperimentWorkspacePatchProperties : 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(OnlineExperimentWorkspacePatchProperties)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(LogAnalyticsWorkspaceResourceId)) + { + writer.WritePropertyName("logAnalyticsWorkspaceResourceId"u8); + writer.WriteStringValue(LogAnalyticsWorkspaceResourceId); + } + if (Optional.IsDefined(LogsExporterStorageAccountResourceId)) + { + writer.WritePropertyName("logsExporterStorageAccountResourceId"u8); + writer.WriteStringValue(LogsExporterStorageAccountResourceId); + } + if (Optional.IsDefined(Encryption)) + { + writer.WritePropertyName("encryption"u8); + writer.WriteObjectValue(Encryption, 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 + } + } + } + + OnlineExperimentWorkspacePatchProperties 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(OnlineExperimentWorkspacePatchProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeOnlineExperimentWorkspacePatchProperties(document.RootElement, options); + } + + internal static OnlineExperimentWorkspacePatchProperties DeserializeOnlineExperimentWorkspacePatchProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ResourceIdentifier logAnalyticsWorkspaceResourceId = default; + ResourceIdentifier logsExporterStorageAccountResourceId = default; + ResourceEncryptionConfiguration encryption = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("logAnalyticsWorkspaceResourceId"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + logAnalyticsWorkspaceResourceId = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("logsExporterStorageAccountResourceId"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + logsExporterStorageAccountResourceId = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("encryption"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + encryption = ResourceEncryptionConfiguration.DeserializeResourceEncryptionConfiguration(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new OnlineExperimentWorkspacePatchProperties(logAnalyticsWorkspaceResourceId, logsExporterStorageAccountResourceId, encryption, 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, AzureResourceManagerOnlineExperimentationContext.Default); + default: + throw new FormatException($"The model {nameof(OnlineExperimentWorkspacePatchProperties)} does not support writing '{options.Format}' format."); + } + } + + OnlineExperimentWorkspacePatchProperties 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 DeserializeOnlineExperimentWorkspacePatchProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(OnlineExperimentWorkspacePatchProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Models/OnlineExperimentWorkspacePatchProperties.cs b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Models/OnlineExperimentWorkspacePatchProperties.cs new file mode 100644 index 000000000000..f1f2754d3e86 --- /dev/null +++ b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Models/OnlineExperimentWorkspacePatchProperties.cs @@ -0,0 +1,85 @@ +// 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.OnlineExperimentation.Models +{ + /// The OnlineExperimentWorkspacePatchProperties. + public partial class OnlineExperimentWorkspacePatchProperties + { + /// + /// 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 OnlineExperimentWorkspacePatchProperties() + { + } + + /// Initializes a new instance of . + /// The resource identifier of the Log Analytics workspace which online experiment workspace uses for generating experiment analysis results. + /// The resource identifier of storage account where logs are exported from Log Analytics workspace. Online Experiment workspace uses it generating experiment analysis results. + /// The encryption configuration for the online experiment workspace resource. + /// Keeps track of any properties unknown to the library. + internal OnlineExperimentWorkspacePatchProperties(ResourceIdentifier logAnalyticsWorkspaceResourceId, ResourceIdentifier logsExporterStorageAccountResourceId, ResourceEncryptionConfiguration encryption, IDictionary serializedAdditionalRawData) + { + LogAnalyticsWorkspaceResourceId = logAnalyticsWorkspaceResourceId; + LogsExporterStorageAccountResourceId = logsExporterStorageAccountResourceId; + Encryption = encryption; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The resource identifier of the Log Analytics workspace which online experiment workspace uses for generating experiment analysis results. + public ResourceIdentifier LogAnalyticsWorkspaceResourceId { get; set; } + /// The resource identifier of storage account where logs are exported from Log Analytics workspace. Online Experiment workspace uses it generating experiment analysis results. + public ResourceIdentifier LogsExporterStorageAccountResourceId { get; set; } + /// The encryption configuration for the online experiment workspace resource. + internal ResourceEncryptionConfiguration Encryption { get; set; } + /// All Customer-managed key encryption properties for the resource. + public CustomerManagedKeyEncryption CustomerManagedKeyEncryption + { + get => Encryption is null ? default : Encryption.CustomerManagedKeyEncryption; + set + { + if (Encryption is null) + Encryption = new ResourceEncryptionConfiguration(); + Encryption.CustomerManagedKeyEncryption = value; + } + } + } +} diff --git a/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Models/OnlineExperimentWorkspaceProperties.Serialization.cs b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Models/OnlineExperimentWorkspaceProperties.Serialization.cs new file mode 100644 index 000000000000..4cff502c3a07 --- /dev/null +++ b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Models/OnlineExperimentWorkspaceProperties.Serialization.cs @@ -0,0 +1,206 @@ +// 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.OnlineExperimentation.Models +{ + public partial class OnlineExperimentWorkspaceProperties : 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(OnlineExperimentWorkspaceProperties)} does not support writing '{format}' format."); + } + + if (options.Format != "W" && Optional.IsDefined(WorkspaceId)) + { + writer.WritePropertyName("workspaceId"u8); + writer.WriteStringValue(WorkspaceId); + } + if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState.Value.ToString()); + } + writer.WritePropertyName("logAnalyticsWorkspaceResourceId"u8); + writer.WriteStringValue(LogAnalyticsWorkspaceResourceId); + writer.WritePropertyName("logsExporterStorageAccountResourceId"u8); + writer.WriteStringValue(LogsExporterStorageAccountResourceId); + writer.WritePropertyName("appConfigurationResourceId"u8); + writer.WriteStringValue(AppConfigurationResourceId); + if (Optional.IsDefined(Encryption)) + { + writer.WritePropertyName("encryption"u8); + writer.WriteObjectValue(Encryption, options); + } + if (options.Format != "W" && Optional.IsDefined(Endpoint)) + { + writer.WritePropertyName("endpoint"u8); + writer.WriteStringValue(Endpoint.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 + } + } + } + + OnlineExperimentWorkspaceProperties 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(OnlineExperimentWorkspaceProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeOnlineExperimentWorkspaceProperties(document.RootElement, options); + } + + internal static OnlineExperimentWorkspaceProperties DeserializeOnlineExperimentWorkspaceProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string workspaceId = default; + ResourceProvisioningState? provisioningState = default; + ResourceIdentifier logAnalyticsWorkspaceResourceId = default; + ResourceIdentifier logsExporterStorageAccountResourceId = default; + ResourceIdentifier appConfigurationResourceId = default; + ResourceEncryptionConfiguration encryption = default; + Uri endpoint = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("workspaceId"u8)) + { + workspaceId = property.Value.GetString(); + continue; + } + if (property.NameEquals("provisioningState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new ResourceProvisioningState(property.Value.GetString()); + continue; + } + if (property.NameEquals("logAnalyticsWorkspaceResourceId"u8)) + { + logAnalyticsWorkspaceResourceId = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("logsExporterStorageAccountResourceId"u8)) + { + logsExporterStorageAccountResourceId = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("appConfigurationResourceId"u8)) + { + appConfigurationResourceId = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("encryption"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + encryption = ResourceEncryptionConfiguration.DeserializeResourceEncryptionConfiguration(property.Value, options); + continue; + } + if (property.NameEquals("endpoint"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + endpoint = new Uri(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new OnlineExperimentWorkspaceProperties( + workspaceId, + provisioningState, + logAnalyticsWorkspaceResourceId, + logsExporterStorageAccountResourceId, + appConfigurationResourceId, + encryption, + endpoint, + 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, AzureResourceManagerOnlineExperimentationContext.Default); + default: + throw new FormatException($"The model {nameof(OnlineExperimentWorkspaceProperties)} does not support writing '{options.Format}' format."); + } + } + + OnlineExperimentWorkspaceProperties 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 DeserializeOnlineExperimentWorkspaceProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(OnlineExperimentWorkspaceProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Models/OnlineExperimentWorkspaceProperties.cs b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Models/OnlineExperimentWorkspaceProperties.cs new file mode 100644 index 000000000000..371b76ee88f2 --- /dev/null +++ b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Models/OnlineExperimentWorkspaceProperties.cs @@ -0,0 +1,118 @@ +// 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.OnlineExperimentation.Models +{ + /// The properties of an online experiment workspace. + public partial class OnlineExperimentWorkspaceProperties + { + /// + /// 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 resource identifier of the Log Analytics workspace which online experiment workspace uses for generating experiment analysis results. + /// The resource identifier of storage account where logs are exported from Log Analytics workspace. Online Experiment workspace uses it generating experiment analysis results. + /// The resource identifier of App Configuration with which this online experiment workspace is tied for experimentation. This is a required field for creating an online experiment workspace. + /// , or is null. + public OnlineExperimentWorkspaceProperties(ResourceIdentifier logAnalyticsWorkspaceResourceId, ResourceIdentifier logsExporterStorageAccountResourceId, ResourceIdentifier appConfigurationResourceId) + { + Argument.AssertNotNull(logAnalyticsWorkspaceResourceId, nameof(logAnalyticsWorkspaceResourceId)); + Argument.AssertNotNull(logsExporterStorageAccountResourceId, nameof(logsExporterStorageAccountResourceId)); + Argument.AssertNotNull(appConfigurationResourceId, nameof(appConfigurationResourceId)); + + LogAnalyticsWorkspaceResourceId = logAnalyticsWorkspaceResourceId; + LogsExporterStorageAccountResourceId = logsExporterStorageAccountResourceId; + AppConfigurationResourceId = appConfigurationResourceId; + } + + /// Initializes a new instance of . + /// The Id of the workspace. + /// The provisioning state for the resource. + /// The resource identifier of the Log Analytics workspace which online experiment workspace uses for generating experiment analysis results. + /// The resource identifier of storage account where logs are exported from Log Analytics workspace. Online Experiment workspace uses it generating experiment analysis results. + /// The resource identifier of App Configuration with which this online experiment workspace is tied for experimentation. This is a required field for creating an online experiment workspace. + /// The encryption configuration for the online experiment workspace resource. + /// The data plane endpoint for the online experiment workspace resource. + /// Keeps track of any properties unknown to the library. + internal OnlineExperimentWorkspaceProperties(string workspaceId, ResourceProvisioningState? provisioningState, ResourceIdentifier logAnalyticsWorkspaceResourceId, ResourceIdentifier logsExporterStorageAccountResourceId, ResourceIdentifier appConfigurationResourceId, ResourceEncryptionConfiguration encryption, Uri endpoint, IDictionary serializedAdditionalRawData) + { + WorkspaceId = workspaceId; + ProvisioningState = provisioningState; + LogAnalyticsWorkspaceResourceId = logAnalyticsWorkspaceResourceId; + LogsExporterStorageAccountResourceId = logsExporterStorageAccountResourceId; + AppConfigurationResourceId = appConfigurationResourceId; + Encryption = encryption; + Endpoint = endpoint; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal OnlineExperimentWorkspaceProperties() + { + } + + /// The Id of the workspace. + public string WorkspaceId { get; } + /// The provisioning state for the resource. + public ResourceProvisioningState? ProvisioningState { get; } + /// The resource identifier of the Log Analytics workspace which online experiment workspace uses for generating experiment analysis results. + public ResourceIdentifier LogAnalyticsWorkspaceResourceId { get; set; } + /// The resource identifier of storage account where logs are exported from Log Analytics workspace. Online Experiment workspace uses it generating experiment analysis results. + public ResourceIdentifier LogsExporterStorageAccountResourceId { get; set; } + /// The resource identifier of App Configuration with which this online experiment workspace is tied for experimentation. This is a required field for creating an online experiment workspace. + public ResourceIdentifier AppConfigurationResourceId { get; set; } + /// The encryption configuration for the online experiment workspace resource. + internal ResourceEncryptionConfiguration Encryption { get; set; } + /// All Customer-managed key encryption properties for the resource. + public CustomerManagedKeyEncryption CustomerManagedKeyEncryption + { + get => Encryption is null ? default : Encryption.CustomerManagedKeyEncryption; + set + { + if (Encryption is null) + Encryption = new ResourceEncryptionConfiguration(); + Encryption.CustomerManagedKeyEncryption = value; + } + } + + /// The data plane endpoint for the online experiment workspace resource. + public Uri Endpoint { get; } + } +} diff --git a/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Models/OnlineExperimentationWorkspaceSku.Serialization.cs b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Models/OnlineExperimentationWorkspaceSku.Serialization.cs new file mode 100644 index 000000000000..3aa74ce2c581 --- /dev/null +++ b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Models/OnlineExperimentationWorkspaceSku.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.OnlineExperimentation.Models +{ + public partial class OnlineExperimentationWorkspaceSku : 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(OnlineExperimentationWorkspaceSku)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name.ToString()); + if (options.Format != "W" && Optional.IsDefined(Tier)) + { + writer.WritePropertyName("tier"u8); + writer.WriteStringValue(Tier.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 + } + } + } + + OnlineExperimentationWorkspaceSku 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(OnlineExperimentationWorkspaceSku)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeOnlineExperimentationWorkspaceSku(document.RootElement, options); + } + + internal static OnlineExperimentationWorkspaceSku DeserializeOnlineExperimentationWorkspaceSku(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + OnlineExperimentationWorkspaceSkuName name = default; + OnlineExperimentationWorkspaceSkuTier? tier = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = new OnlineExperimentationWorkspaceSkuName(property.Value.GetString()); + continue; + } + if (property.NameEquals("tier"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + tier = new OnlineExperimentationWorkspaceSkuTier(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new OnlineExperimentationWorkspaceSku(name, tier, 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, AzureResourceManagerOnlineExperimentationContext.Default); + default: + throw new FormatException($"The model {nameof(OnlineExperimentationWorkspaceSku)} does not support writing '{options.Format}' format."); + } + } + + OnlineExperimentationWorkspaceSku 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 DeserializeOnlineExperimentationWorkspaceSku(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(OnlineExperimentationWorkspaceSku)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Models/OnlineExperimentationWorkspaceSku.cs b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Models/OnlineExperimentationWorkspaceSku.cs new file mode 100644 index 000000000000..6eca9afe394e --- /dev/null +++ b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Models/OnlineExperimentationWorkspaceSku.cs @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.OnlineExperimentation.Models +{ + /// The SKU (Stock Keeping Unit) assigned to this resource. + public partial class OnlineExperimentationWorkspaceSku + { + /// + /// 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 name of the SKU. Ex - F0, P0. It is typically a letter+number code. + public OnlineExperimentationWorkspaceSku(OnlineExperimentationWorkspaceSkuName name) + { + Name = name; + } + + /// Initializes a new instance of . + /// The name of the SKU. Ex - F0, P0. It is typically a letter+number code. + /// The name of the SKU tier. + /// Keeps track of any properties unknown to the library. + internal OnlineExperimentationWorkspaceSku(OnlineExperimentationWorkspaceSkuName name, OnlineExperimentationWorkspaceSkuTier? tier, IDictionary serializedAdditionalRawData) + { + Name = name; + Tier = tier; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal OnlineExperimentationWorkspaceSku() + { + } + + /// The name of the SKU. Ex - F0, P0. It is typically a letter+number code. + public OnlineExperimentationWorkspaceSkuName Name { get; set; } + /// The name of the SKU tier. + public OnlineExperimentationWorkspaceSkuTier? Tier { get; } + } +} diff --git a/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Models/OnlineExperimentationWorkspaceSkuName.cs b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Models/OnlineExperimentationWorkspaceSkuName.cs new file mode 100644 index 000000000000..8a9bc528f7cf --- /dev/null +++ b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Models/OnlineExperimentationWorkspaceSkuName.cs @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.OnlineExperimentation.Models +{ + /// The allowed SKU names for the online experimentation workspace. + public readonly partial struct OnlineExperimentationWorkspaceSkuName : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public OnlineExperimentationWorkspaceSkuName(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string F0Value = "F0"; + private const string S0Value = "S0"; + private const string P0Value = "P0"; + private const string D0Value = "D0"; + + /// The Free service sku name. + public static OnlineExperimentationWorkspaceSkuName F0 { get; } = new OnlineExperimentationWorkspaceSkuName(F0Value); + /// The Standard service sku name. + public static OnlineExperimentationWorkspaceSkuName S0 { get; } = new OnlineExperimentationWorkspaceSkuName(S0Value); + /// The Premium service sku name. + public static OnlineExperimentationWorkspaceSkuName P0 { get; } = new OnlineExperimentationWorkspaceSkuName(P0Value); + /// The Developer service sku name. + public static OnlineExperimentationWorkspaceSkuName D0 { get; } = new OnlineExperimentationWorkspaceSkuName(D0Value); + /// Determines if two values are the same. + public static bool operator ==(OnlineExperimentationWorkspaceSkuName left, OnlineExperimentationWorkspaceSkuName right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(OnlineExperimentationWorkspaceSkuName left, OnlineExperimentationWorkspaceSkuName right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator OnlineExperimentationWorkspaceSkuName(string value) => new OnlineExperimentationWorkspaceSkuName(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is OnlineExperimentationWorkspaceSkuName other && Equals(other); + /// + public bool Equals(OnlineExperimentationWorkspaceSkuName 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/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Models/OnlineExperimentationWorkspaceSkuTier.cs b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Models/OnlineExperimentationWorkspaceSkuTier.cs new file mode 100644 index 000000000000..444b84a5c3ea --- /dev/null +++ b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Models/OnlineExperimentationWorkspaceSkuTier.cs @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.OnlineExperimentation.Models +{ + /// The allowed SKU tiers for the online experimentation workspace. + public readonly partial struct OnlineExperimentationWorkspaceSkuTier : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public OnlineExperimentationWorkspaceSkuTier(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string FreeValue = "Free"; + private const string StandardValue = "Standard"; + private const string PremiumValue = "Premium"; + private const string DeveloperValue = "Developer"; + + /// The Free service tier. + public static OnlineExperimentationWorkspaceSkuTier Free { get; } = new OnlineExperimentationWorkspaceSkuTier(FreeValue); + /// The Standard service tier. + public static OnlineExperimentationWorkspaceSkuTier Standard { get; } = new OnlineExperimentationWorkspaceSkuTier(StandardValue); + /// The Premium service tier. + public static OnlineExperimentationWorkspaceSkuTier Premium { get; } = new OnlineExperimentationWorkspaceSkuTier(PremiumValue); + /// The Developer service tier. + public static OnlineExperimentationWorkspaceSkuTier Developer { get; } = new OnlineExperimentationWorkspaceSkuTier(DeveloperValue); + /// Determines if two values are the same. + public static bool operator ==(OnlineExperimentationWorkspaceSkuTier left, OnlineExperimentationWorkspaceSkuTier right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(OnlineExperimentationWorkspaceSkuTier left, OnlineExperimentationWorkspaceSkuTier right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator OnlineExperimentationWorkspaceSkuTier(string value) => new OnlineExperimentationWorkspaceSkuTier(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is OnlineExperimentationWorkspaceSkuTier other && Equals(other); + /// + public bool Equals(OnlineExperimentationWorkspaceSkuTier 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/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Models/ResourceEncryptionConfiguration.Serialization.cs b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Models/ResourceEncryptionConfiguration.Serialization.cs new file mode 100644 index 000000000000..d30e45366796 --- /dev/null +++ b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Models/ResourceEncryptionConfiguration.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.OnlineExperimentation.Models +{ + internal partial class ResourceEncryptionConfiguration : 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(ResourceEncryptionConfiguration)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(CustomerManagedKeyEncryption)) + { + writer.WritePropertyName("customerManagedKeyEncryption"u8); + writer.WriteObjectValue(CustomerManagedKeyEncryption, 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 + } + } + } + + ResourceEncryptionConfiguration 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(ResourceEncryptionConfiguration)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeResourceEncryptionConfiguration(document.RootElement, options); + } + + internal static ResourceEncryptionConfiguration DeserializeResourceEncryptionConfiguration(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + CustomerManagedKeyEncryption customerManagedKeyEncryption = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("customerManagedKeyEncryption"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + customerManagedKeyEncryption = CustomerManagedKeyEncryption.DeserializeCustomerManagedKeyEncryption(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ResourceEncryptionConfiguration(customerManagedKeyEncryption, 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, AzureResourceManagerOnlineExperimentationContext.Default); + default: + throw new FormatException($"The model {nameof(ResourceEncryptionConfiguration)} does not support writing '{options.Format}' format."); + } + } + + ResourceEncryptionConfiguration 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 DeserializeResourceEncryptionConfiguration(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ResourceEncryptionConfiguration)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Models/ResourceEncryptionConfiguration.cs b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Models/ResourceEncryptionConfiguration.cs new file mode 100644 index 000000000000..8e79d4cb8d3d --- /dev/null +++ b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Models/ResourceEncryptionConfiguration.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.OnlineExperimentation.Models +{ + /// The encryption configuration for the online experiment workspace resource. + internal partial class ResourceEncryptionConfiguration + { + /// + /// 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 ResourceEncryptionConfiguration() + { + } + + /// Initializes a new instance of . + /// All Customer-managed key encryption properties for the resource. + /// Keeps track of any properties unknown to the library. + internal ResourceEncryptionConfiguration(CustomerManagedKeyEncryption customerManagedKeyEncryption, IDictionary serializedAdditionalRawData) + { + CustomerManagedKeyEncryption = customerManagedKeyEncryption; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// All Customer-managed key encryption properties for the resource. + public CustomerManagedKeyEncryption CustomerManagedKeyEncryption { get; set; } + } +} diff --git a/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Models/ResourceProvisioningState.cs b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Models/ResourceProvisioningState.cs new file mode 100644 index 000000000000..dcc279210b75 --- /dev/null +++ b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Models/ResourceProvisioningState.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.OnlineExperimentation.Models +{ + /// The provisioning state of a resource type. + public readonly partial struct ResourceProvisioningState : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public ResourceProvisioningState(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string SucceededValue = "Succeeded"; + private const string FailedValue = "Failed"; + private const string CanceledValue = "Canceled"; + + /// Resource has been created. + public static ResourceProvisioningState Succeeded { get; } = new ResourceProvisioningState(SucceededValue); + /// Resource creation failed. + public static ResourceProvisioningState Failed { get; } = new ResourceProvisioningState(FailedValue); + /// Resource creation was canceled. + public static ResourceProvisioningState Canceled { get; } = new ResourceProvisioningState(CanceledValue); + /// Determines if two values are the same. + public static bool operator ==(ResourceProvisioningState left, ResourceProvisioningState right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ResourceProvisioningState left, ResourceProvisioningState right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator ResourceProvisioningState(string value) => new ResourceProvisioningState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ResourceProvisioningState other && Equals(other); + /// + public bool Equals(ResourceProvisioningState 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/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/OnlineExperimentWorkspaceCollection.cs b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/OnlineExperimentWorkspaceCollection.cs new file mode 100644 index 000000000000..d2ae0bf7d049 --- /dev/null +++ b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/OnlineExperimentWorkspaceCollection.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.OnlineExperimentation +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get an instance call the GetOnlineExperimentWorkspaces method from an instance of . + /// + public partial class OnlineExperimentWorkspaceCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _onlineExperimentWorkspaceClientDiagnostics; + private readonly OnlineExperimentWorkspacesRestOperations _onlineExperimentWorkspaceRestClient; + + /// Initializes a new instance of the class for mocking. + protected OnlineExperimentWorkspaceCollection() + { + } + + /// 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 OnlineExperimentWorkspaceCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _onlineExperimentWorkspaceClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.OnlineExperimentation", OnlineExperimentWorkspaceResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(OnlineExperimentWorkspaceResource.ResourceType, out string onlineExperimentWorkspaceApiVersion); + _onlineExperimentWorkspaceRestClient = new OnlineExperimentWorkspacesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, onlineExperimentWorkspaceApiVersion); +#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 an experiment workspace, or update an existing workspace + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OnlineExperimentation/workspaces/{workspaceName} + /// + /// + /// Operation Id + /// OnlineExperimentWorkspace_CreateOrUpdate + /// + /// + /// Default Api Version + /// 2025-05-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 name of the OnlineExperimentWorkspace. + /// 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 workspaceName, OnlineExperimentWorkspaceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(workspaceName, nameof(workspaceName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _onlineExperimentWorkspaceClientDiagnostics.CreateScope("OnlineExperimentWorkspaceCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _onlineExperimentWorkspaceRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, workspaceName, data, cancellationToken).ConfigureAwait(false); + var operation = new OnlineExperimentationArmOperation(new OnlineExperimentWorkspaceOperationSource(Client), _onlineExperimentWorkspaceClientDiagnostics, Pipeline, _onlineExperimentWorkspaceRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, workspaceName, 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 an experiment workspace, or update an existing workspace + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OnlineExperimentation/workspaces/{workspaceName} + /// + /// + /// Operation Id + /// OnlineExperimentWorkspace_CreateOrUpdate + /// + /// + /// Default Api Version + /// 2025-05-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 name of the OnlineExperimentWorkspace. + /// 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 workspaceName, OnlineExperimentWorkspaceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(workspaceName, nameof(workspaceName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _onlineExperimentWorkspaceClientDiagnostics.CreateScope("OnlineExperimentWorkspaceCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _onlineExperimentWorkspaceRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, workspaceName, data, cancellationToken); + var operation = new OnlineExperimentationArmOperation(new OnlineExperimentWorkspaceOperationSource(Client), _onlineExperimentWorkspaceClientDiagnostics, Pipeline, _onlineExperimentWorkspaceRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, workspaceName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets an experiment workspace + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OnlineExperimentation/workspaces/{workspaceName} + /// + /// + /// Operation Id + /// OnlineExperimentWorkspace_Get + /// + /// + /// Default Api Version + /// 2025-05-31-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the OnlineExperimentWorkspace. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string workspaceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(workspaceName, nameof(workspaceName)); + + using var scope = _onlineExperimentWorkspaceClientDiagnostics.CreateScope("OnlineExperimentWorkspaceCollection.Get"); + scope.Start(); + try + { + var response = await _onlineExperimentWorkspaceRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, workspaceName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new OnlineExperimentWorkspaceResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets an experiment workspace + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OnlineExperimentation/workspaces/{workspaceName} + /// + /// + /// Operation Id + /// OnlineExperimentWorkspace_Get + /// + /// + /// Default Api Version + /// 2025-05-31-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the OnlineExperimentWorkspace. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string workspaceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(workspaceName, nameof(workspaceName)); + + using var scope = _onlineExperimentWorkspaceClientDiagnostics.CreateScope("OnlineExperimentWorkspaceCollection.Get"); + scope.Start(); + try + { + var response = _onlineExperimentWorkspaceRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, workspaceName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new OnlineExperimentWorkspaceResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets all experiment workspaces in a resource group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OnlineExperimentation/workspaces + /// + /// + /// Operation Id + /// OnlineExperimentWorkspace_ListByResourceGroup + /// + /// + /// Default Api Version + /// 2025-05-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) => _onlineExperimentWorkspaceRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _onlineExperimentWorkspaceRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new OnlineExperimentWorkspaceResource(Client, OnlineExperimentWorkspaceData.DeserializeOnlineExperimentWorkspaceData(e)), _onlineExperimentWorkspaceClientDiagnostics, Pipeline, "OnlineExperimentWorkspaceCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Gets all experiment workspaces in a resource group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OnlineExperimentation/workspaces + /// + /// + /// Operation Id + /// OnlineExperimentWorkspace_ListByResourceGroup + /// + /// + /// Default Api Version + /// 2025-05-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) => _onlineExperimentWorkspaceRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _onlineExperimentWorkspaceRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new OnlineExperimentWorkspaceResource(Client, OnlineExperimentWorkspaceData.DeserializeOnlineExperimentWorkspaceData(e)), _onlineExperimentWorkspaceClientDiagnostics, Pipeline, "OnlineExperimentWorkspaceCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OnlineExperimentation/workspaces/{workspaceName} + /// + /// + /// Operation Id + /// OnlineExperimentWorkspace_Get + /// + /// + /// Default Api Version + /// 2025-05-31-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the OnlineExperimentWorkspace. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string workspaceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(workspaceName, nameof(workspaceName)); + + using var scope = _onlineExperimentWorkspaceClientDiagnostics.CreateScope("OnlineExperimentWorkspaceCollection.Exists"); + scope.Start(); + try + { + var response = await _onlineExperimentWorkspaceRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, workspaceName, 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.OnlineExperimentation/workspaces/{workspaceName} + /// + /// + /// Operation Id + /// OnlineExperimentWorkspace_Get + /// + /// + /// Default Api Version + /// 2025-05-31-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the OnlineExperimentWorkspace. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string workspaceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(workspaceName, nameof(workspaceName)); + + using var scope = _onlineExperimentWorkspaceClientDiagnostics.CreateScope("OnlineExperimentWorkspaceCollection.Exists"); + scope.Start(); + try + { + var response = _onlineExperimentWorkspaceRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, workspaceName, 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.OnlineExperimentation/workspaces/{workspaceName} + /// + /// + /// Operation Id + /// OnlineExperimentWorkspace_Get + /// + /// + /// Default Api Version + /// 2025-05-31-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the OnlineExperimentWorkspace. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string workspaceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(workspaceName, nameof(workspaceName)); + + using var scope = _onlineExperimentWorkspaceClientDiagnostics.CreateScope("OnlineExperimentWorkspaceCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _onlineExperimentWorkspaceRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, workspaceName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new OnlineExperimentWorkspaceResource(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.OnlineExperimentation/workspaces/{workspaceName} + /// + /// + /// Operation Id + /// OnlineExperimentWorkspace_Get + /// + /// + /// Default Api Version + /// 2025-05-31-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the OnlineExperimentWorkspace. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string workspaceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(workspaceName, nameof(workspaceName)); + + using var scope = _onlineExperimentWorkspaceClientDiagnostics.CreateScope("OnlineExperimentWorkspaceCollection.GetIfExists"); + scope.Start(); + try + { + var response = _onlineExperimentWorkspaceRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, workspaceName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new OnlineExperimentWorkspaceResource(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/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/OnlineExperimentWorkspaceData.Serialization.cs b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/OnlineExperimentWorkspaceData.Serialization.cs new file mode 100644 index 000000000000..dc69b006bb68 --- /dev/null +++ b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/OnlineExperimentWorkspaceData.Serialization.cs @@ -0,0 +1,212 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Models; +using Azure.ResourceManager.OnlineExperimentation.Models; + +namespace Azure.ResourceManager.OnlineExperimentation +{ + public partial class OnlineExperimentWorkspaceData : 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(OnlineExperimentWorkspaceData)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); + } + if (Optional.IsDefined(Identity)) + { + writer.WritePropertyName("identity"u8); + var serializeOptions = new JsonSerializerOptions { Converters = { new ManagedServiceIdentityTypeV3Converter() } }; + JsonSerializer.Serialize(writer, Identity, serializeOptions); + } + if (Optional.IsDefined(Sku)) + { + writer.WritePropertyName("sku"u8); + writer.WriteObjectValue(Sku, options); + } + } + + OnlineExperimentWorkspaceData 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(OnlineExperimentWorkspaceData)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeOnlineExperimentWorkspaceData(document.RootElement, options); + } + + internal static OnlineExperimentWorkspaceData DeserializeOnlineExperimentWorkspaceData(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + OnlineExperimentWorkspaceProperties properties = default; + ManagedServiceIdentity identity = default; + OnlineExperimentationWorkspaceSku sku = 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 = OnlineExperimentWorkspaceProperties.DeserializeOnlineExperimentWorkspaceProperties(property.Value, options); + continue; + } + if (property.NameEquals("identity"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + var serializeOptions = new JsonSerializerOptions { Converters = { new ManagedServiceIdentityTypeV3Converter() } }; + identity = JsonSerializer.Deserialize(property.Value.GetRawText(), serializeOptions); + continue; + } + if (property.NameEquals("sku"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + sku = OnlineExperimentationWorkspaceSku.DeserializeOnlineExperimentationWorkspaceSku(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 OnlineExperimentWorkspaceData( + id, + name, + type, + systemData, + tags ?? new ChangeTrackingDictionary(), + location, + properties, + identity, + sku, + 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, AzureResourceManagerOnlineExperimentationContext.Default); + default: + throw new FormatException($"The model {nameof(OnlineExperimentWorkspaceData)} does not support writing '{options.Format}' format."); + } + } + + OnlineExperimentWorkspaceData 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 DeserializeOnlineExperimentWorkspaceData(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(OnlineExperimentWorkspaceData)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/OnlineExperimentWorkspaceData.cs b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/OnlineExperimentWorkspaceData.cs new file mode 100644 index 000000000000..54239ad0039c --- /dev/null +++ b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/OnlineExperimentWorkspaceData.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.Models; +using Azure.ResourceManager.OnlineExperimentation.Models; + +namespace Azure.ResourceManager.OnlineExperimentation +{ + /// + /// A class representing the OnlineExperimentWorkspace data model. + /// An online experiment workspace resource. + /// + public partial class OnlineExperimentWorkspaceData : 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 OnlineExperimentWorkspaceData(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. + /// The managed service identities assigned to this resource. + /// The SKU (Stock Keeping Unit) assigned to this resource. + /// Keeps track of any properties unknown to the library. + internal OnlineExperimentWorkspaceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, OnlineExperimentWorkspaceProperties properties, ManagedServiceIdentity identity, OnlineExperimentationWorkspaceSku sku, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) + { + Properties = properties; + Identity = identity; + Sku = sku; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal OnlineExperimentWorkspaceData() + { + } + + /// The resource-specific properties for this resource. + public OnlineExperimentWorkspaceProperties Properties { get; set; } + /// The managed service identities assigned to this resource. + public ManagedServiceIdentity Identity { get; set; } + /// The SKU (Stock Keeping Unit) assigned to this resource. + public OnlineExperimentationWorkspaceSku Sku { get; set; } + } +} diff --git a/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/OnlineExperimentWorkspaceResource.Serialization.cs b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/OnlineExperimentWorkspaceResource.Serialization.cs new file mode 100644 index 000000000000..bbd744f82cd9 --- /dev/null +++ b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/OnlineExperimentWorkspaceResource.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.OnlineExperimentation +{ + public partial class OnlineExperimentWorkspaceResource : IJsonModel + { + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); + + OnlineExperimentWorkspaceData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)Data).Create(ref reader, options); + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options, AzureResourceManagerOnlineExperimentationContext.Default); + + OnlineExperimentWorkspaceData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options, AzureResourceManagerOnlineExperimentationContext.Default); + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)Data).GetFormatFromOptions(options); + } +} diff --git a/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/OnlineExperimentWorkspaceResource.cs b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/OnlineExperimentWorkspaceResource.cs new file mode 100644 index 000000000000..a4cf66efd83b --- /dev/null +++ b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/OnlineExperimentWorkspaceResource.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.OnlineExperimentation.Models; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.OnlineExperimentation +{ + /// + /// A Class representing an OnlineExperimentWorkspace along with the instance operations that can be performed on it. + /// If you have a you can construct an + /// from an instance of using the GetOnlineExperimentWorkspaceResource method. + /// Otherwise you can get one from its parent resource using the GetOnlineExperimentWorkspace method. + /// + public partial class OnlineExperimentWorkspaceResource : ArmResource + { + /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The workspaceName. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string workspaceName) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OnlineExperimentation/workspaces/{workspaceName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _onlineExperimentWorkspaceClientDiagnostics; + private readonly OnlineExperimentWorkspacesRestOperations _onlineExperimentWorkspaceRestClient; + private readonly OnlineExperimentWorkspaceData _data; + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.OnlineExperimentation/workspaces"; + + /// Initializes a new instance of the class for mocking. + protected OnlineExperimentWorkspaceResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal OnlineExperimentWorkspaceResource(ArmClient client, OnlineExperimentWorkspaceData 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 OnlineExperimentWorkspaceResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _onlineExperimentWorkspaceClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.OnlineExperimentation", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string onlineExperimentWorkspaceApiVersion); + _onlineExperimentWorkspaceRestClient = new OnlineExperimentWorkspacesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, onlineExperimentWorkspaceApiVersion); +#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 OnlineExperimentWorkspaceData 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 an experiment workspace + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OnlineExperimentation/workspaces/{workspaceName} + /// + /// + /// Operation Id + /// OnlineExperimentWorkspace_Get + /// + /// + /// Default Api Version + /// 2025-05-31-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _onlineExperimentWorkspaceClientDiagnostics.CreateScope("OnlineExperimentWorkspaceResource.Get"); + scope.Start(); + try + { + var response = await _onlineExperimentWorkspaceRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new OnlineExperimentWorkspaceResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets an experiment workspace + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OnlineExperimentation/workspaces/{workspaceName} + /// + /// + /// Operation Id + /// OnlineExperimentWorkspace_Get + /// + /// + /// Default Api Version + /// 2025-05-31-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _onlineExperimentWorkspaceClientDiagnostics.CreateScope("OnlineExperimentWorkspaceResource.Get"); + scope.Start(); + try + { + var response = _onlineExperimentWorkspaceRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new OnlineExperimentWorkspaceResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes an experiment workspace + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OnlineExperimentation/workspaces/{workspaceName} + /// + /// + /// Operation Id + /// OnlineExperimentWorkspace_Delete + /// + /// + /// Default Api Version + /// 2025-05-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 = _onlineExperimentWorkspaceClientDiagnostics.CreateScope("OnlineExperimentWorkspaceResource.Delete"); + scope.Start(); + try + { + var response = await _onlineExperimentWorkspaceRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new OnlineExperimentationArmOperation(_onlineExperimentWorkspaceClientDiagnostics, Pipeline, _onlineExperimentWorkspaceRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes an experiment workspace + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OnlineExperimentation/workspaces/{workspaceName} + /// + /// + /// Operation Id + /// OnlineExperimentWorkspace_Delete + /// + /// + /// Default Api Version + /// 2025-05-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 = _onlineExperimentWorkspaceClientDiagnostics.CreateScope("OnlineExperimentWorkspaceResource.Delete"); + scope.Start(); + try + { + var response = _onlineExperimentWorkspaceRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + var operation = new OnlineExperimentationArmOperation(_onlineExperimentWorkspaceClientDiagnostics, Pipeline, _onlineExperimentWorkspaceRestClient.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; + } + } + + /// + /// Patch an experiment workspace + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OnlineExperimentation/workspaces/{workspaceName} + /// + /// + /// Operation Id + /// OnlineExperimentWorkspace_Update + /// + /// + /// Default Api Version + /// 2025-05-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, OnlineExperimentWorkspacePatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(patch, nameof(patch)); + + using var scope = _onlineExperimentWorkspaceClientDiagnostics.CreateScope("OnlineExperimentWorkspaceResource.Update"); + scope.Start(); + try + { + var response = await _onlineExperimentWorkspaceRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch, cancellationToken).ConfigureAwait(false); + var operation = new OnlineExperimentationArmOperation(new OnlineExperimentWorkspaceOperationSource(Client), _onlineExperimentWorkspaceClientDiagnostics, Pipeline, _onlineExperimentWorkspaceRestClient.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; + } + } + + /// + /// Patch an experiment workspace + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OnlineExperimentation/workspaces/{workspaceName} + /// + /// + /// Operation Id + /// OnlineExperimentWorkspace_Update + /// + /// + /// Default Api Version + /// 2025-05-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, OnlineExperimentWorkspacePatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(patch, nameof(patch)); + + using var scope = _onlineExperimentWorkspaceClientDiagnostics.CreateScope("OnlineExperimentWorkspaceResource.Update"); + scope.Start(); + try + { + var response = _onlineExperimentWorkspaceRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch, cancellationToken); + var operation = new OnlineExperimentationArmOperation(new OnlineExperimentWorkspaceOperationSource(Client), _onlineExperimentWorkspaceClientDiagnostics, Pipeline, _onlineExperimentWorkspaceRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Add a tag to the current resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OnlineExperimentation/workspaces/{workspaceName} + /// + /// + /// Operation Id + /// OnlineExperimentWorkspace_Get + /// + /// + /// Default Api Version + /// 2025-05-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 = _onlineExperimentWorkspaceClientDiagnostics.CreateScope("OnlineExperimentWorkspaceResource.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 _onlineExperimentWorkspaceRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new OnlineExperimentWorkspaceResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new OnlineExperimentWorkspacePatch(); + 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.OnlineExperimentation/workspaces/{workspaceName} + /// + /// + /// Operation Id + /// OnlineExperimentWorkspace_Get + /// + /// + /// Default Api Version + /// 2025-05-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 = _onlineExperimentWorkspaceClientDiagnostics.CreateScope("OnlineExperimentWorkspaceResource.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 = _onlineExperimentWorkspaceRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + return Response.FromValue(new OnlineExperimentWorkspaceResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new OnlineExperimentWorkspacePatch(); + 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.OnlineExperimentation/workspaces/{workspaceName} + /// + /// + /// Operation Id + /// OnlineExperimentWorkspace_Get + /// + /// + /// Default Api Version + /// 2025-05-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 = _onlineExperimentWorkspaceClientDiagnostics.CreateScope("OnlineExperimentWorkspaceResource.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 _onlineExperimentWorkspaceRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new OnlineExperimentWorkspaceResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new OnlineExperimentWorkspacePatch(); + 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.OnlineExperimentation/workspaces/{workspaceName} + /// + /// + /// Operation Id + /// OnlineExperimentWorkspace_Get + /// + /// + /// Default Api Version + /// 2025-05-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 = _onlineExperimentWorkspaceClientDiagnostics.CreateScope("OnlineExperimentWorkspaceResource.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 = _onlineExperimentWorkspaceRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + return Response.FromValue(new OnlineExperimentWorkspaceResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new OnlineExperimentWorkspacePatch(); + 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.OnlineExperimentation/workspaces/{workspaceName} + /// + /// + /// Operation Id + /// OnlineExperimentWorkspace_Get + /// + /// + /// Default Api Version + /// 2025-05-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 = _onlineExperimentWorkspaceClientDiagnostics.CreateScope("OnlineExperimentWorkspaceResource.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 _onlineExperimentWorkspaceRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new OnlineExperimentWorkspaceResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new OnlineExperimentWorkspacePatch(); + 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.OnlineExperimentation/workspaces/{workspaceName} + /// + /// + /// Operation Id + /// OnlineExperimentWorkspace_Get + /// + /// + /// Default Api Version + /// 2025-05-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 = _onlineExperimentWorkspaceClientDiagnostics.CreateScope("OnlineExperimentWorkspaceResource.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 = _onlineExperimentWorkspaceRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + return Response.FromValue(new OnlineExperimentWorkspaceResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new OnlineExperimentWorkspacePatch(); + 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/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/ProviderConstants.cs b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/ProviderConstants.cs new file mode 100644 index 000000000000..f27b73f85b77 --- /dev/null +++ b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/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.OnlineExperimentation +{ + internal static class ProviderConstants + { + public static string DefaultProviderNamespace { get; } = ClientDiagnostics.GetResourceProviderNamespace(typeof(ProviderConstants).Assembly); + } +} diff --git a/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/RestOperations/OnlineExperimentWorkspacesRestOperations.cs b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/RestOperations/OnlineExperimentWorkspacesRestOperations.cs new file mode 100644 index 000000000000..6c85cd032393 --- /dev/null +++ b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/RestOperations/OnlineExperimentWorkspacesRestOperations.cs @@ -0,0 +1,723 @@ +// 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.OnlineExperimentation.Models; + +namespace Azure.ResourceManager.OnlineExperimentation +{ + internal partial class OnlineExperimentWorkspacesRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of OnlineExperimentWorkspacesRestOperations. + /// 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 OnlineExperimentWorkspacesRestOperations(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-05-31-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string workspaceName) + { + 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.OnlineExperimentation/workspaces/", false); + uri.AppendPath(workspaceName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string workspaceName) + { + 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.OnlineExperimentation/workspaces/", false); + uri.AppendPath(workspaceName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets an experiment workspace. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the OnlineExperimentWorkspace. + /// 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 workspaceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(workspaceName, nameof(workspaceName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, workspaceName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + OnlineExperimentWorkspaceData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = OnlineExperimentWorkspaceData.DeserializeOnlineExperimentWorkspaceData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((OnlineExperimentWorkspaceData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets an experiment workspace. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the OnlineExperimentWorkspace. + /// 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 workspaceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(workspaceName, nameof(workspaceName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, workspaceName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + OnlineExperimentWorkspaceData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = OnlineExperimentWorkspaceData.DeserializeOnlineExperimentWorkspaceData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((OnlineExperimentWorkspaceData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, string resourceGroupName, string workspaceName, OnlineExperimentWorkspaceData 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.OnlineExperimentation/workspaces/", false); + uri.AppendPath(workspaceName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string workspaceName, OnlineExperimentWorkspaceData 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.OnlineExperimentation/workspaces/", false); + uri.AppendPath(workspaceName, 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 an experiment workspace, or update an existing workspace. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the OnlineExperimentWorkspace. + /// 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 workspaceName, OnlineExperimentWorkspaceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(workspaceName, nameof(workspaceName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, workspaceName, 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 an experiment workspace, or update an existing workspace. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the OnlineExperimentWorkspace. + /// 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 workspaceName, OnlineExperimentWorkspaceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(workspaceName, nameof(workspaceName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, workspaceName, 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 workspaceName, OnlineExperimentWorkspacePatch 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.OnlineExperimentation/workspaces/", false); + uri.AppendPath(workspaceName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string workspaceName, OnlineExperimentWorkspacePatch 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.OnlineExperimentation/workspaces/", false); + uri.AppendPath(workspaceName, 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; + } + + /// Patch an experiment workspace. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the OnlineExperimentWorkspace. + /// 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 workspaceName, OnlineExperimentWorkspacePatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(workspaceName, nameof(workspaceName)); + Argument.AssertNotNull(patch, nameof(patch)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, workspaceName, 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); + } + } + + /// Patch an experiment workspace. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the OnlineExperimentWorkspace. + /// 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 workspaceName, OnlineExperimentWorkspacePatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(workspaceName, nameof(workspaceName)); + Argument.AssertNotNull(patch, nameof(patch)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, workspaceName, 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 workspaceName) + { + 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.OnlineExperimentation/workspaces/", false); + uri.AppendPath(workspaceName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string workspaceName) + { + 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.OnlineExperimentation/workspaces/", false); + uri.AppendPath(workspaceName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Deletes an experiment workspace. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the OnlineExperimentWorkspace. + /// 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 workspaceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(workspaceName, nameof(workspaceName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, workspaceName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Deletes an experiment workspace. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the OnlineExperimentWorkspace. + /// 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 workspaceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(workspaceName, nameof(workspaceName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, workspaceName); + _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.OnlineExperimentation/workspaces", 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.OnlineExperimentation/workspaces", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets all experiment workspaces in a 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: + { + OnlineExperimentWorkspaceListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = OnlineExperimentWorkspaceListResult.DeserializeOnlineExperimentWorkspaceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets all experiment workspaces in a 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: + { + OnlineExperimentWorkspaceListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = OnlineExperimentWorkspaceListResult.DeserializeOnlineExperimentWorkspaceListResult(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.OnlineExperimentation/workspaces", 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.OnlineExperimentation/workspaces", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets all experiment workspaces in the specified subscription. + /// 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: + { + OnlineExperimentWorkspaceListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = OnlineExperimentWorkspaceListResult.DeserializeOnlineExperimentWorkspaceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets all experiment workspaces in the specified subscription. + /// 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: + { + OnlineExperimentWorkspaceListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = OnlineExperimentWorkspaceListResult.DeserializeOnlineExperimentWorkspaceListResult(document.RootElement); + return Response.FromValue(value, 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; + } + + /// Gets all experiment workspaces in a 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: + { + OnlineExperimentWorkspaceListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = OnlineExperimentWorkspaceListResult.DeserializeOnlineExperimentWorkspaceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets all experiment workspaces in a 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: + { + OnlineExperimentWorkspaceListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = OnlineExperimentWorkspaceListResult.DeserializeOnlineExperimentWorkspaceListResult(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; + } + + /// Gets all experiment workspaces in the specified subscription. + /// 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: + { + OnlineExperimentWorkspaceListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = OnlineExperimentWorkspaceListResult.DeserializeOnlineExperimentWorkspaceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets all experiment workspaces in the specified subscription. + /// 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: + { + OnlineExperimentWorkspaceListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = OnlineExperimentWorkspaceListResult.DeserializeOnlineExperimentWorkspaceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Properties/AssemblyInfo.cs b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Properties/AssemblyInfo.cs new file mode 100644 index 000000000000..4aeb666286c8 --- /dev/null +++ b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/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.OnlineExperimentation.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("OnlineExperimentation")] diff --git a/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/tests/Azure.ResourceManager.OnlineExperimentation.Tests.csproj b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/tests/Azure.ResourceManager.OnlineExperimentation.Tests.csproj new file mode 100644 index 000000000000..509ef6525348 --- /dev/null +++ b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/tests/Azure.ResourceManager.OnlineExperimentation.Tests.csproj @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/tests/OnlineExperimentationManagementTestBase.cs b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/tests/OnlineExperimentationManagementTestBase.cs new file mode 100644 index 000000000000..fac75bab168d --- /dev/null +++ b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/tests/OnlineExperimentationManagementTestBase.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.OnlineExperimentation.Tests +{ + public class OnlineExperimentationManagementTestBase : ManagementRecordedTestBase + { + protected ArmClient Client { get; private set; } + protected SubscriptionResource DefaultSubscription { get; private set; } + + protected OnlineExperimentationManagementTestBase(bool isAsync, RecordedTestMode mode) + : base(isAsync, mode) + { + } + + protected OnlineExperimentationManagementTestBase(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/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/tests/OnlineExperimentationManagementTestEnvironment.cs b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/tests/OnlineExperimentationManagementTestEnvironment.cs new file mode 100644 index 000000000000..79cae7dfee21 --- /dev/null +++ b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/tests/OnlineExperimentationManagementTestEnvironment.cs @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using Azure.Core.TestFramework; + +namespace Azure.ResourceManager.OnlineExperimentation.Tests +{ + public class OnlineExperimentationManagementTestEnvironment : TestEnvironment + { + } +} diff --git a/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/tsp-location.yaml b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/tsp-location.yaml new file mode 100644 index 000000000000..555e843851c8 --- /dev/null +++ b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/tsp-location.yaml @@ -0,0 +1,4 @@ +directory: specification/onlineexperimentation/OnlineExperimentation.Management +commit: 0c929c78c4b7892c20cdfee10ddebb97cdf9d8a9 +repo: Azure/azure-rest-api-specs +additionalDirectories: diff --git a/sdk/onlineexperimentation/ci.mgmt.yml b/sdk/onlineexperimentation/ci.mgmt.yml new file mode 100644 index 000000000000..0fe2fec93cce --- /dev/null +++ b/sdk/onlineexperimentation/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/onlineexperimentation /ci.mgmt.yml + - sdk/onlineexperimentation /Azure.ResourceManager.OnlineExperimentation / + + +extends: + template: /eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: onlineexperimentation + ArtifactName: packages + LimitForPullRequest: true + Artifacts: + - name: Azure.ResourceManager.OnlineExperimentation + safeName: AzureResourceManagerOnlineExperimentation diff --git a/sdk/resourcemanager/ci.mgmt.yml b/sdk/resourcemanager/ci.mgmt.yml index 9ae0a7e75290..48a6e6009f41 100644 --- a/sdk/resourcemanager/ci.mgmt.yml +++ b/sdk/resourcemanager/ci.mgmt.yml @@ -37,6 +37,7 @@ trigger: - sdk/billingbenefits/Azure.ResourceManager.BillingBenefits - sdk/blueprint/Azure.ResourceManager.Blueprint - sdk/botservice/Azure.ResourceManager.BotService + - sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization - sdk/cdn/Azure.ResourceManager.Cdn - sdk/changeanalysis/Azure.ResourceManager.ChangeAnalysis - sdk/chaos/Azure.ResourceManager.Chaos @@ -69,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 @@ -147,6 +149,7 @@ trigger: - sdk/newrelicobservability/Azure.ResourceManager.NewRelicObservability - sdk/nginx/Azure.ResourceManager.Nginx - sdk/notificationhubs/Azure.ResourceManager.NotificationHubs + - sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation - sdk/openenergyplatform/Azure.ResourceManager.EnergyServices - sdk/operationalinsights/Azure.ResourceManager.OperationalInsights - sdk/oracle/Azure.ResourceManager.OracleDatabase @@ -253,6 +256,7 @@ pr: - sdk/billingbenefits/Azure.ResourceManager.BillingBenefits - sdk/blueprint/Azure.ResourceManager.Blueprint - sdk/botservice/Azure.ResourceManager.BotService + - sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization - sdk/cdn/Azure.ResourceManager.Cdn - sdk/changeanalysis/Azure.ResourceManager.ChangeAnalysis - sdk/chaos/Azure.ResourceManager.Chaos @@ -285,6 +289,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 @@ -363,6 +368,7 @@ pr: - sdk/newrelicobservability/Azure.ResourceManager.NewRelicObservability - sdk/nginx/Azure.ResourceManager.Nginx - sdk/notificationhubs/Azure.ResourceManager.NotificationHubs + - sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation - sdk/openenergyplatform/Azure.ResourceManager.EnergyServices - sdk/operationalinsights/Azure.ResourceManager.OperationalInsights - sdk/oracle/Azure.ResourceManager.OracleDatabase diff --git a/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/samples/Generated/Samples/Sample_ApplicationGatewayForContainersSecurityPolicyCollection.cs b/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/samples/Generated/Samples/Sample_ApplicationGatewayForContainersSecurityPolicyCollection.cs index 5fa2642fed33..ed14510cebff 100644 --- a/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/samples/Generated/Samples/Sample_ApplicationGatewayForContainersSecurityPolicyCollection.cs +++ b/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/samples/Generated/Samples/Sample_ApplicationGatewayForContainersSecurityPolicyCollection.cs @@ -17,9 +17,45 @@ public partial class Sample_ApplicationGatewayForContainersSecurityPolicyCollect { [Test] [Ignore("Only validating compilation of examples")] - public async Task CreateOrUpdate_PutSecurityPolicy() + public async Task CreateOrUpdate_PutIpAccessRulesSecurityPolicy() { - // Generated from example definition: 2025-01-01/SecurityPolicyPut.json + // Generated from example definition: 2025-03-01-preview/IpAccessRulesSecurityPolicyPut.json + // this example is just showing the usage of "SecurityPolicy_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 TrafficControllerResource created on azure + // for more information of creating TrafficControllerResource, please refer to the document of TrafficControllerResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string trafficControllerName = "tc1"; + ResourceIdentifier trafficControllerResourceId = TrafficControllerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, trafficControllerName); + TrafficControllerResource trafficController = client.GetTrafficControllerResource(trafficControllerResourceId); + + // get the collection of this ApplicationGatewayForContainersSecurityPolicyResource + ApplicationGatewayForContainersSecurityPolicyCollection collection = trafficController.GetApplicationGatewayForContainersSecurityPolicies(); + + // invoke the operation + string securityPolicyName = "sp1"; + ApplicationGatewayForContainersSecurityPolicyData data = new ApplicationGatewayForContainersSecurityPolicyData(new AzureLocation("NorthCentralUS")); + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, securityPolicyName, data); + ApplicationGatewayForContainersSecurityPolicyResource 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 + ApplicationGatewayForContainersSecurityPolicyData 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 CreateOrUpdate_PutWAFSecurityPolicy() + { + // Generated from example definition: 2025-03-01-preview/WafSecurityPolicyPut.json // this example is just showing the usage of "SecurityPolicy_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 @@ -55,7 +91,7 @@ public async Task CreateOrUpdate_PutSecurityPolicy() [Ignore("Only validating compilation of examples")] public async Task Get_GetSecurityPolicy() { - // Generated from example definition: 2025-01-01/SecurityPolicyGet.json + // Generated from example definition: 2025-03-01-preview/SecurityPolicyGet.json // this example is just showing the usage of "SecurityPolicy_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 @@ -89,7 +125,7 @@ public async Task Get_GetSecurityPolicy() [Ignore("Only validating compilation of examples")] public async Task GetAll_GetSecurityPolicies() { - // Generated from example definition: 2025-01-01/SecurityPoliciesGetList.json + // Generated from example definition: 2025-03-01-preview/SecurityPoliciesGetList.json // this example is just showing the usage of "SecurityPolicy_ListByTrafficController" 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 @@ -125,7 +161,7 @@ public async Task GetAll_GetSecurityPolicies() [Ignore("Only validating compilation of examples")] public async Task Exists_GetSecurityPolicy() { - // Generated from example definition: 2025-01-01/SecurityPolicyGet.json + // Generated from example definition: 2025-03-01-preview/SecurityPolicyGet.json // this example is just showing the usage of "SecurityPolicy_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 @@ -155,7 +191,7 @@ public async Task Exists_GetSecurityPolicy() [Ignore("Only validating compilation of examples")] public async Task GetIfExists_GetSecurityPolicy() { - // Generated from example definition: 2025-01-01/SecurityPolicyGet.json + // Generated from example definition: 2025-03-01-preview/SecurityPolicyGet.json // this example is just showing the usage of "SecurityPolicy_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 diff --git a/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/samples/Generated/Samples/Sample_ApplicationGatewayForContainersSecurityPolicyResource.cs b/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/samples/Generated/Samples/Sample_ApplicationGatewayForContainersSecurityPolicyResource.cs index e3e31c6d5bde..891b87831556 100644 --- a/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/samples/Generated/Samples/Sample_ApplicationGatewayForContainersSecurityPolicyResource.cs +++ b/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/samples/Generated/Samples/Sample_ApplicationGatewayForContainersSecurityPolicyResource.cs @@ -20,7 +20,7 @@ public partial class Sample_ApplicationGatewayForContainersSecurityPolicyResourc [Ignore("Only validating compilation of examples")] public async Task Get_GetSecurityPolicy() { - // Generated from example definition: 2025-01-01/SecurityPolicyGet.json + // Generated from example definition: 2025-03-01-preview/SecurityPolicyGet.json // this example is just showing the usage of "SecurityPolicy_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 @@ -51,7 +51,7 @@ public async Task Get_GetSecurityPolicy() [Ignore("Only validating compilation of examples")] public async Task Delete_DeleteSecurityPolicy() { - // Generated from example definition: 2025-01-01/SecurityPolicyDelete.json + // Generated from example definition: 2025-03-01-preview/SecurityPolicyDelete.json // this example is just showing the usage of "SecurityPolicy_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 @@ -76,9 +76,9 @@ public async Task Delete_DeleteSecurityPolicy() [Test] [Ignore("Only validating compilation of examples")] - public async Task Update_UpdateSecurityPolicy() + public async Task Update_UpdateIpAccessRulesSecurityPolicy() { - // Generated from example definition: 2025-01-01/SecurityPolicyPatch.json + // Generated from example definition: 2025-03-01-preview/IpAccessRulesSecurityPolicyPatch.json // this example is just showing the usage of "SecurityPolicy_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 @@ -98,7 +98,48 @@ public async Task Update_UpdateSecurityPolicy() // invoke the operation ApplicationGatewayForContainersSecurityPolicyPatch patch = new ApplicationGatewayForContainersSecurityPolicyPatch { - WafPolicyId = new ResourceIdentifier("/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.Networking/applicationGatewayWebApplicationFirewallPolicies/wp-0"), + Properties = new SecurityPolicyUpdateProperties + { + Rules = { }, + }, + }; + ApplicationGatewayForContainersSecurityPolicyResource result = await applicationGatewayForContainersSecurityPolicy.UpdateAsync(patch); + + // 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 + ApplicationGatewayForContainersSecurityPolicyData 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 Update_UpdateWAFSecurityPolicy() + { + // Generated from example definition: 2025-03-01-preview/WafSecurityPolicyPatch.json + // this example is just showing the usage of "SecurityPolicy_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 ApplicationGatewayForContainersSecurityPolicyResource created on azure + // for more information of creating ApplicationGatewayForContainersSecurityPolicyResource, please refer to the document of ApplicationGatewayForContainersSecurityPolicyResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string trafficControllerName = "tc1"; + string securityPolicyName = "sp1"; + ResourceIdentifier applicationGatewayForContainersSecurityPolicyResourceId = ApplicationGatewayForContainersSecurityPolicyResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, trafficControllerName, securityPolicyName); + ApplicationGatewayForContainersSecurityPolicyResource applicationGatewayForContainersSecurityPolicy = client.GetApplicationGatewayForContainersSecurityPolicyResource(applicationGatewayForContainersSecurityPolicyResourceId); + + // invoke the operation + ApplicationGatewayForContainersSecurityPolicyPatch patch = new ApplicationGatewayForContainersSecurityPolicyPatch + { + Properties = new SecurityPolicyUpdateProperties + { + WafPolicyId = new ResourceIdentifier("/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.Networking/applicationGatewayWebApplicationFirewallPolicies/wp-0"), + }, }; ApplicationGatewayForContainersSecurityPolicyResource result = await applicationGatewayForContainersSecurityPolicy.UpdateAsync(patch); diff --git a/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs b/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs index 1f04c028950d..ae4d29fe60af 100644 --- a/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs +++ b/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs @@ -20,7 +20,7 @@ public partial class Sample_SubscriptionResourceExtensions [Ignore("Only validating compilation of examples")] public async Task GetTrafficControllers_GetTrafficControllersList() { - // Generated from example definition: 2025-01-01/TrafficControllersGetList.json + // Generated from example definition: 2025-03-01-preview/TrafficControllersGetList.json // this example is just showing the usage of "TrafficController_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 diff --git a/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/samples/Generated/Samples/Sample_TrafficControllerAssociationCollection.cs b/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/samples/Generated/Samples/Sample_TrafficControllerAssociationCollection.cs index 49202d22ac39..23a108ff779c 100644 --- a/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/samples/Generated/Samples/Sample_TrafficControllerAssociationCollection.cs +++ b/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/samples/Generated/Samples/Sample_TrafficControllerAssociationCollection.cs @@ -19,7 +19,7 @@ public partial class Sample_TrafficControllerAssociationCollection [Ignore("Only validating compilation of examples")] public async Task CreateOrUpdate_PutAssociation() { - // Generated from example definition: 2025-01-01/AssociationPut.json + // Generated from example definition: 2025-03-01-preview/AssociationPut.json // this example is just showing the usage of "Association_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 @@ -55,7 +55,7 @@ public async Task CreateOrUpdate_PutAssociation() [Ignore("Only validating compilation of examples")] public async Task Get_GetAssociation() { - // Generated from example definition: 2025-01-01/AssociationGet.json + // Generated from example definition: 2025-03-01-preview/AssociationGet.json // this example is just showing the usage of "Association_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 @@ -89,7 +89,7 @@ public async Task Get_GetAssociation() [Ignore("Only validating compilation of examples")] public async Task GetAll_GetAssociations() { - // Generated from example definition: 2025-01-01/AssociationsGet.json + // Generated from example definition: 2025-03-01-preview/AssociationsGet.json // this example is just showing the usage of "Association_ListByTrafficController" 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 @@ -125,7 +125,7 @@ public async Task GetAll_GetAssociations() [Ignore("Only validating compilation of examples")] public async Task Exists_GetAssociation() { - // Generated from example definition: 2025-01-01/AssociationGet.json + // Generated from example definition: 2025-03-01-preview/AssociationGet.json // this example is just showing the usage of "Association_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 @@ -155,7 +155,7 @@ public async Task Exists_GetAssociation() [Ignore("Only validating compilation of examples")] public async Task GetIfExists_GetAssociation() { - // Generated from example definition: 2025-01-01/AssociationGet.json + // Generated from example definition: 2025-03-01-preview/AssociationGet.json // this example is just showing the usage of "Association_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 diff --git a/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/samples/Generated/Samples/Sample_TrafficControllerAssociationResource.cs b/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/samples/Generated/Samples/Sample_TrafficControllerAssociationResource.cs index c6f65d07d974..3fb3a74eeef2 100644 --- a/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/samples/Generated/Samples/Sample_TrafficControllerAssociationResource.cs +++ b/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/samples/Generated/Samples/Sample_TrafficControllerAssociationResource.cs @@ -20,7 +20,7 @@ public partial class Sample_TrafficControllerAssociationResource [Ignore("Only validating compilation of examples")] public async Task Get_GetAssociation() { - // Generated from example definition: 2025-01-01/AssociationGet.json + // Generated from example definition: 2025-03-01-preview/AssociationGet.json // this example is just showing the usage of "Association_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 @@ -51,7 +51,7 @@ public async Task Get_GetAssociation() [Ignore("Only validating compilation of examples")] public async Task Delete_DeleteAssociation() { - // Generated from example definition: 2025-01-01/AssociationDelete.json + // Generated from example definition: 2025-03-01-preview/AssociationDelete.json // this example is just showing the usage of "Association_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 @@ -78,7 +78,7 @@ public async Task Delete_DeleteAssociation() [Ignore("Only validating compilation of examples")] public async Task Update_UpdateAssociation() { - // Generated from example definition: 2025-01-01/AssociationPatch.json + // Generated from example definition: 2025-03-01-preview/AssociationPatch.json // this example is just showing the usage of "Association_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 diff --git a/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/samples/Generated/Samples/Sample_TrafficControllerCollection.cs b/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/samples/Generated/Samples/Sample_TrafficControllerCollection.cs index c15b0398e234..58709869d47b 100644 --- a/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/samples/Generated/Samples/Sample_TrafficControllerCollection.cs +++ b/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/samples/Generated/Samples/Sample_TrafficControllerCollection.cs @@ -20,7 +20,7 @@ public partial class Sample_TrafficControllerCollection [Ignore("Only validating compilation of examples")] public async Task CreateOrUpdate_PutTrafficController() { - // Generated from example definition: 2025-01-01/TrafficControllerPut.json + // Generated from example definition: 2025-03-01-preview/TrafficControllerPut.json // this example is just showing the usage of "TrafficController_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 @@ -61,7 +61,7 @@ public async Task CreateOrUpdate_PutTrafficController() [Ignore("Only validating compilation of examples")] public async Task Get_GetTrafficController() { - // Generated from example definition: 2025-01-01/TrafficControllerGet.json + // Generated from example definition: 2025-03-01-preview/TrafficControllerGet.json // this example is just showing the usage of "TrafficController_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 @@ -94,7 +94,7 @@ public async Task Get_GetTrafficController() [Ignore("Only validating compilation of examples")] public async Task GetAll_GetTrafficControllers() { - // Generated from example definition: 2025-01-01/TrafficControllersGet.json + // Generated from example definition: 2025-03-01-preview/TrafficControllersGet.json // this example is just showing the usage of "TrafficController_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 @@ -129,7 +129,7 @@ public async Task GetAll_GetTrafficControllers() [Ignore("Only validating compilation of examples")] public async Task Exists_GetTrafficController() { - // Generated from example definition: 2025-01-01/TrafficControllerGet.json + // Generated from example definition: 2025-03-01-preview/TrafficControllerGet.json // this example is just showing the usage of "TrafficController_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 @@ -158,7 +158,7 @@ public async Task Exists_GetTrafficController() [Ignore("Only validating compilation of examples")] public async Task GetIfExists_GetTrafficController() { - // Generated from example definition: 2025-01-01/TrafficControllerGet.json + // Generated from example definition: 2025-03-01-preview/TrafficControllerGet.json // this example is just showing the usage of "TrafficController_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 diff --git a/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/samples/Generated/Samples/Sample_TrafficControllerFrontendCollection.cs b/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/samples/Generated/Samples/Sample_TrafficControllerFrontendCollection.cs index 4ab4cfc44626..98b3bdd771e2 100644 --- a/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/samples/Generated/Samples/Sample_TrafficControllerFrontendCollection.cs +++ b/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/samples/Generated/Samples/Sample_TrafficControllerFrontendCollection.cs @@ -19,7 +19,7 @@ public partial class Sample_TrafficControllerFrontendCollection [Ignore("Only validating compilation of examples")] public async Task CreateOrUpdate_PutFrontend() { - // Generated from example definition: 2025-01-01/FrontendPut.json + // Generated from example definition: 2025-03-01-preview/FrontendPut.json // this example is just showing the usage of "Frontend_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 @@ -55,7 +55,7 @@ public async Task CreateOrUpdate_PutFrontend() [Ignore("Only validating compilation of examples")] public async Task Get_GetFrontend() { - // Generated from example definition: 2025-01-01/FrontendGet.json + // Generated from example definition: 2025-03-01-preview/FrontendGet.json // this example is just showing the usage of "Frontend_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 @@ -89,7 +89,7 @@ public async Task Get_GetFrontend() [Ignore("Only validating compilation of examples")] public async Task GetAll_GetFrontends() { - // Generated from example definition: 2025-01-01/FrontendsGet.json + // Generated from example definition: 2025-03-01-preview/FrontendsGet.json // this example is just showing the usage of "Frontend_ListByTrafficController" 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 @@ -125,7 +125,7 @@ public async Task GetAll_GetFrontends() [Ignore("Only validating compilation of examples")] public async Task Exists_GetFrontend() { - // Generated from example definition: 2025-01-01/FrontendGet.json + // Generated from example definition: 2025-03-01-preview/FrontendGet.json // this example is just showing the usage of "Frontend_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 @@ -155,7 +155,7 @@ public async Task Exists_GetFrontend() [Ignore("Only validating compilation of examples")] public async Task GetIfExists_GetFrontend() { - // Generated from example definition: 2025-01-01/FrontendGet.json + // Generated from example definition: 2025-03-01-preview/FrontendGet.json // this example is just showing the usage of "Frontend_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 diff --git a/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/samples/Generated/Samples/Sample_TrafficControllerFrontendResource.cs b/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/samples/Generated/Samples/Sample_TrafficControllerFrontendResource.cs index e671ad08ea90..0e80f4bfe79a 100644 --- a/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/samples/Generated/Samples/Sample_TrafficControllerFrontendResource.cs +++ b/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/samples/Generated/Samples/Sample_TrafficControllerFrontendResource.cs @@ -20,7 +20,7 @@ public partial class Sample_TrafficControllerFrontendResource [Ignore("Only validating compilation of examples")] public async Task Get_GetFrontend() { - // Generated from example definition: 2025-01-01/FrontendGet.json + // Generated from example definition: 2025-03-01-preview/FrontendGet.json // this example is just showing the usage of "Frontend_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 @@ -51,7 +51,7 @@ public async Task Get_GetFrontend() [Ignore("Only validating compilation of examples")] public async Task Delete_DeleteFrontend() { - // Generated from example definition: 2025-01-01/FrontendDelete.json + // Generated from example definition: 2025-03-01-preview/FrontendDelete.json // this example is just showing the usage of "Frontend_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 @@ -78,7 +78,7 @@ public async Task Delete_DeleteFrontend() [Ignore("Only validating compilation of examples")] public async Task Update_UpdateFrontend() { - // Generated from example definition: 2025-01-01/FrontendPatch.json + // Generated from example definition: 2025-03-01-preview/FrontendPatch.json // this example is just showing the usage of "Frontend_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 diff --git a/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/samples/Generated/Samples/Sample_TrafficControllerResource.cs b/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/samples/Generated/Samples/Sample_TrafficControllerResource.cs index 9d5561710002..b56f139a4dc3 100644 --- a/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/samples/Generated/Samples/Sample_TrafficControllerResource.cs +++ b/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/samples/Generated/Samples/Sample_TrafficControllerResource.cs @@ -20,7 +20,7 @@ public partial class Sample_TrafficControllerResource [Ignore("Only validating compilation of examples")] public async Task Get_GetTrafficController() { - // Generated from example definition: 2025-01-01/TrafficControllerGet.json + // Generated from example definition: 2025-03-01-preview/TrafficControllerGet.json // this example is just showing the usage of "TrafficController_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 @@ -50,7 +50,7 @@ public async Task Get_GetTrafficController() [Ignore("Only validating compilation of examples")] public async Task Delete_DeleteTrafficController() { - // Generated from example definition: 2025-01-01/TrafficControllerDelete.json + // Generated from example definition: 2025-03-01-preview/TrafficControllerDelete.json // this example is just showing the usage of "TrafficController_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 @@ -76,7 +76,7 @@ public async Task Delete_DeleteTrafficController() [Ignore("Only validating compilation of examples")] public async Task Update_PatchTrafficController() { - // Generated from example definition: 2025-01-01/TrafficControllerPatch.json + // Generated from example definition: 2025-03-01-preview/TrafficControllerPatch.json // this example is just showing the usage of "TrafficController_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 diff --git a/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/ApplicationGatewayForContainersSecurityPolicyCollection.cs b/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/ApplicationGatewayForContainersSecurityPolicyCollection.cs index 08a2827165d4..7b690543896d 100644 --- a/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/ApplicationGatewayForContainersSecurityPolicyCollection.cs +++ b/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/ApplicationGatewayForContainersSecurityPolicyCollection.cs @@ -64,7 +64,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2025-01-01 + /// 2025-03-01-preview /// /// /// Resource @@ -113,7 +113,7 @@ public virtual async Task /// /// Default Api Version - /// 2025-01-01 + /// 2025-03-01-preview /// /// /// Resource @@ -162,7 +162,7 @@ public virtual ArmOperation /// /// Default Api Version - /// 2025-01-01 + /// 2025-03-01-preview /// /// /// Resource @@ -207,7 +207,7 @@ public virtual async Task /// /// Default Api Version - /// 2025-01-01 + /// 2025-03-01-preview /// /// /// Resource @@ -252,7 +252,7 @@ public virtual Response G /// /// /// Default Api Version - /// 2025-01-01 + /// 2025-03-01-preview /// /// /// Resource @@ -282,7 +282,7 @@ public virtual AsyncPageable /// /// Default Api Version - /// 2025-01-01 + /// 2025-03-01-preview /// /// /// Resource @@ -312,7 +312,7 @@ public virtual Pageable G /// /// /// Default Api Version - /// 2025-01-01 + /// 2025-03-01-preview /// /// /// Resource @@ -355,7 +355,7 @@ public virtual async Task> ExistsAsync(string securityPolicyName, /// /// /// Default Api Version - /// 2025-01-01 + /// 2025-03-01-preview /// /// /// Resource @@ -398,7 +398,7 @@ public virtual Response Exists(string securityPolicyName, CancellationToke /// /// /// Default Api Version - /// 2025-01-01 + /// 2025-03-01-preview /// /// /// Resource @@ -443,7 +443,7 @@ public virtual async Task /// /// Default Api Version - /// 2025-01-01 + /// 2025-03-01-preview /// /// /// Resource diff --git a/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/ApplicationGatewayForContainersSecurityPolicyData.Serialization.cs b/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/ApplicationGatewayForContainersSecurityPolicyData.Serialization.cs index e607ae25573f..2f0a29f01eb4 100644 --- a/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/ApplicationGatewayForContainersSecurityPolicyData.Serialization.cs +++ b/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/ApplicationGatewayForContainersSecurityPolicyData.Serialization.cs @@ -50,6 +50,11 @@ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWri writer.WritePropertyName("wafPolicy"u8); JsonSerializer.Serialize(writer, WafPolicy); } + if (Optional.IsDefined(IPAccessRulesPolicy)) + { + writer.WritePropertyName("ipAccessRulesPolicy"u8); + writer.WriteObjectValue(IPAccessRulesPolicy, options); + } if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) { writer.WritePropertyName("provisioningState"u8); @@ -86,6 +91,7 @@ internal static ApplicationGatewayForContainersSecurityPolicyData DeserializeApp SystemData systemData = default; ApplicationGatewayForContainersSecurityPolicyType? policyType = default; WritableSubResource wafPolicy = default; + IPAccessRulesPolicy ipAccessRulesPolicy = default; ServiceNetworkingProvisioningState? provisioningState = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); @@ -161,6 +167,15 @@ internal static ApplicationGatewayForContainersSecurityPolicyData DeserializeApp wafPolicy = JsonSerializer.Deserialize(property0.Value.GetRawText()); continue; } + if (property0.NameEquals("ipAccessRulesPolicy"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + ipAccessRulesPolicy = IPAccessRulesPolicy.DeserializeIPAccessRulesPolicy(property0.Value, options); + continue; + } if (property0.NameEquals("provisioningState"u8)) { if (property0.Value.ValueKind == JsonValueKind.Null) @@ -188,6 +203,7 @@ internal static ApplicationGatewayForContainersSecurityPolicyData DeserializeApp location, policyType, wafPolicy, + ipAccessRulesPolicy, provisioningState, serializedAdditionalRawData); } diff --git a/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/ApplicationGatewayForContainersSecurityPolicyData.cs b/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/ApplicationGatewayForContainersSecurityPolicyData.cs index 85a2d35e7de6..0fb345867010 100644 --- a/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/ApplicationGatewayForContainersSecurityPolicyData.cs +++ b/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/ApplicationGatewayForContainersSecurityPolicyData.cs @@ -66,13 +66,15 @@ public ApplicationGatewayForContainersSecurityPolicyData(AzureLocation location) /// The tags. /// The location. /// Type of the Traffic Controller Security Policy. - /// Web Application Firewall Policy of the Traffic Controller Security Policy. + /// Web Application Firewall Policy of the Traffic Controller Security Policy. Single Security Policy can have only one policy type set. + /// Ip Access Policy of the Traffic Controller Security Policy. Single Security Policy can have only one policy type set. /// Provisioning State of Traffic Controller SecurityPolicy Resource. /// Keeps track of any properties unknown to the library. - internal ApplicationGatewayForContainersSecurityPolicyData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ApplicationGatewayForContainersSecurityPolicyType? policyType, WritableSubResource wafPolicy, ServiceNetworkingProvisioningState? provisioningState, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) + internal ApplicationGatewayForContainersSecurityPolicyData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ApplicationGatewayForContainersSecurityPolicyType? policyType, WritableSubResource wafPolicy, IPAccessRulesPolicy ipAccessRulesPolicy, ServiceNetworkingProvisioningState? provisioningState, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { PolicyType = policyType; WafPolicy = wafPolicy; + IPAccessRulesPolicy = ipAccessRulesPolicy; ProvisioningState = provisioningState; _serializedAdditionalRawData = serializedAdditionalRawData; } @@ -84,7 +86,7 @@ internal ApplicationGatewayForContainersSecurityPolicyData() /// Type of the Traffic Controller Security Policy. public ApplicationGatewayForContainersSecurityPolicyType? PolicyType { get; } - /// Web Application Firewall Policy of the Traffic Controller Security Policy. + /// Web Application Firewall Policy of the Traffic Controller Security Policy. Single Security Policy can have only one policy type set. internal WritableSubResource WafPolicy { get; set; } /// Gets or sets Id. public ResourceIdentifier WafPolicyId @@ -98,6 +100,19 @@ public ResourceIdentifier WafPolicyId } } + /// Ip Access Policy of the Traffic Controller Security Policy. Single Security Policy can have only one policy type set. + internal IPAccessRulesPolicy IPAccessRulesPolicy { get; set; } + /// Ip Access Policy Rules List. + public IList Rules + { + get + { + if (IPAccessRulesPolicy is null) + IPAccessRulesPolicy = new IPAccessRulesPolicy(); + return IPAccessRulesPolicy.Rules; + } + } + /// Provisioning State of Traffic Controller SecurityPolicy Resource. public ServiceNetworkingProvisioningState? ProvisioningState { get; } } diff --git a/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/ApplicationGatewayForContainersSecurityPolicyResource.cs b/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/ApplicationGatewayForContainersSecurityPolicyResource.cs index f93bcd37140c..f0f55df95092 100644 --- a/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/ApplicationGatewayForContainersSecurityPolicyResource.cs +++ b/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/ApplicationGatewayForContainersSecurityPolicyResource.cs @@ -103,7 +103,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2025-01-01 + /// 2025-03-01-preview /// /// /// Resource @@ -143,7 +143,7 @@ public virtual async Task /// /// Default Api Version - /// 2025-01-01 + /// 2025-03-01-preview /// /// /// Resource @@ -183,7 +183,7 @@ public virtual Response G /// /// /// Default Api Version - /// 2025-01-01 + /// 2025-03-01-preview /// /// /// Resource @@ -225,7 +225,7 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell /// /// /// Default Api Version - /// 2025-01-01 + /// 2025-03-01-preview /// /// /// Resource @@ -267,7 +267,7 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel /// /// /// Default Api Version - /// 2025-01-01 + /// 2025-03-01-preview /// /// /// Resource @@ -309,7 +309,7 @@ public virtual async Task /// /// Default Api Version - /// 2025-01-01 + /// 2025-03-01-preview /// /// /// Resource @@ -351,7 +351,7 @@ public virtual Response U /// /// /// Default Api Version - /// 2025-01-01 + /// 2025-03-01-preview /// /// /// Resource @@ -413,7 +413,7 @@ public virtual async Task /// /// Default Api Version - /// 2025-01-01 + /// 2025-03-01-preview /// /// /// Resource @@ -475,7 +475,7 @@ public virtual Response A /// /// /// Default Api Version - /// 2025-01-01 + /// 2025-03-01-preview /// /// /// Resource @@ -532,7 +532,7 @@ public virtual async Task /// /// Default Api Version - /// 2025-01-01 + /// 2025-03-01-preview /// /// /// Resource @@ -589,7 +589,7 @@ public virtual Response S /// /// /// Default Api Version - /// 2025-01-01 + /// 2025-03-01-preview /// /// /// Resource @@ -649,7 +649,7 @@ public virtual async Task /// /// Default Api Version - /// 2025-01-01 + /// 2025-03-01-preview /// /// /// Resource diff --git a/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/ArmServiceNetworkingModelFactory.cs b/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/ArmServiceNetworkingModelFactory.cs index 59033db44840..384fc78f3a8f 100644 --- a/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/ArmServiceNetworkingModelFactory.cs +++ b/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/ArmServiceNetworkingModelFactory.cs @@ -53,9 +53,10 @@ public static TrafficControllerAssociationData TrafficControllerAssociationData( /// The tags. /// The location. /// The Fully Qualified Domain Name of the DNS record associated to a Traffic Controller frontend. + /// Frontend Security Policy Configuration. /// Provisioning State of Traffic Controller Frontend Resource. /// A new instance for mocking. - public static TrafficControllerFrontendData TrafficControllerFrontendData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, string fqdn = null, ServiceNetworkingProvisioningState? provisioningState = null) + public static TrafficControllerFrontendData TrafficControllerFrontendData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, string fqdn = null, SecurityPolicyConfigurations securityPolicyConfigurations = null, ServiceNetworkingProvisioningState? provisioningState = null) { tags ??= new Dictionary(); @@ -67,6 +68,7 @@ public static TrafficControllerFrontendData TrafficControllerFrontendData(Resour tags, location, fqdn, + securityPolicyConfigurations, provisioningState, serializedAdditionalRawData: null); } @@ -79,12 +81,14 @@ public static TrafficControllerFrontendData TrafficControllerFrontendData(Resour /// The tags. /// The location. /// Type of the Traffic Controller Security Policy. - /// Web Application Firewall Policy of the Traffic Controller Security Policy. + /// Web Application Firewall Policy of the Traffic Controller Security Policy. Single Security Policy can have only one policy type set. + /// Ip Access Policy of the Traffic Controller Security Policy. Single Security Policy can have only one policy type set. /// Provisioning State of Traffic Controller SecurityPolicy Resource. /// A new instance for mocking. - public static ApplicationGatewayForContainersSecurityPolicyData ApplicationGatewayForContainersSecurityPolicyData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, ApplicationGatewayForContainersSecurityPolicyType? policyType = null, ResourceIdentifier wafPolicyId = null, ServiceNetworkingProvisioningState? provisioningState = null) + public static ApplicationGatewayForContainersSecurityPolicyData ApplicationGatewayForContainersSecurityPolicyData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, ApplicationGatewayForContainersSecurityPolicyType? policyType = null, ResourceIdentifier wafPolicyId = null, IEnumerable rules = null, ServiceNetworkingProvisioningState? provisioningState = null) { tags ??= new Dictionary(); + rules ??= new List(); return new ApplicationGatewayForContainersSecurityPolicyData( id, @@ -95,6 +99,7 @@ public static ApplicationGatewayForContainersSecurityPolicyData ApplicationGatew location, policyType, wafPolicyId != null ? ResourceManagerModelFactory.WritableSubResource(wafPolicyId) : null, + rules != null ? new IPAccessRulesPolicy(rules?.ToList(), serializedAdditionalRawData: null) : null, provisioningState, serializedAdditionalRawData: null); } @@ -110,10 +115,10 @@ public static ApplicationGatewayForContainersSecurityPolicyData ApplicationGatew /// Frontends References List. /// Associations References List. /// Security Policies References List. - /// Security Policy Configuration. + /// Security Policy Configuration. /// The status of the last operation. /// A new instance for mocking. - public static TrafficControllerData TrafficControllerData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, IEnumerable configurationEndpoints = null, IEnumerable frontends = null, IEnumerable associations = null, IEnumerable securityPolicies = null, ResourceIdentifier wafSecurityPolicyId = null, ServiceNetworkingProvisioningState? trafficControllerProvisioningState = null) + public static TrafficControllerData TrafficControllerData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, IEnumerable configurationEndpoints = null, IEnumerable frontends = null, IEnumerable associations = null, IEnumerable securityPolicies = null, SecurityPolicyConfigurations securityPolicyConfigurations = null, ServiceNetworkingProvisioningState? trafficControllerProvisioningState = null) { tags ??= new Dictionary(); configurationEndpoints ??= new List(); @@ -132,7 +137,7 @@ public static TrafficControllerData TrafficControllerData(ResourceIdentifier id frontends?.ToList(), associations?.ToList(), securityPolicies?.ToList(), - wafSecurityPolicyId != null ? new SecurityPolicyConfigurations(ResourceManagerModelFactory.WritableSubResource(wafSecurityPolicyId), serializedAdditionalRawData: null) : null, + securityPolicyConfigurations, trafficControllerProvisioningState, serializedAdditionalRawData: null); } diff --git a/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/Extensions/MockableServiceNetworkingResourceGroupResource.cs b/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/Extensions/MockableServiceNetworkingResourceGroupResource.cs index 0db893ce7671..5d3da1e5fdb4 100644 --- a/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/Extensions/MockableServiceNetworkingResourceGroupResource.cs +++ b/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/Extensions/MockableServiceNetworkingResourceGroupResource.cs @@ -53,7 +53,7 @@ public virtual TrafficControllerCollection GetTrafficControllers() /// /// /// Default Api Version - /// 2025-01-01 + /// 2025-03-01-preview /// /// /// Resource @@ -84,7 +84,7 @@ public virtual async Task> GetTrafficControl /// /// /// Default Api Version - /// 2025-01-01 + /// 2025-03-01-preview /// /// /// Resource diff --git a/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/Extensions/MockableServiceNetworkingSubscriptionResource.cs b/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/Extensions/MockableServiceNetworkingSubscriptionResource.cs index 94e555f1c51a..ae9777a643f7 100644 --- a/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/Extensions/MockableServiceNetworkingSubscriptionResource.cs +++ b/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/Extensions/MockableServiceNetworkingSubscriptionResource.cs @@ -52,7 +52,7 @@ private string GetApiVersionOrNull(ResourceType resourceType) /// /// /// Default Api Version - /// 2025-01-01 + /// 2025-03-01-preview /// /// /// Resource @@ -82,7 +82,7 @@ public virtual AsyncPageable GetTrafficControllersAsy /// /// /// Default Api Version - /// 2025-01-01 + /// 2025-03-01-preview /// /// /// Resource diff --git a/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/Extensions/ServiceNetworkingExtensions.cs b/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/Extensions/ServiceNetworkingExtensions.cs index 49532cd91c87..15863156005f 100644 --- a/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/Extensions/ServiceNetworkingExtensions.cs +++ b/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/Extensions/ServiceNetworkingExtensions.cs @@ -138,7 +138,7 @@ public static TrafficControllerCollection GetTrafficControllers(this ResourceGro /// /// /// Default Api Version - /// 2025-01-01 + /// 2025-03-01-preview /// /// /// Resource @@ -176,7 +176,7 @@ public static async Task> GetTrafficControll /// /// /// Default Api Version - /// 2025-01-01 + /// 2025-03-01-preview /// /// /// Resource @@ -214,7 +214,7 @@ public static Response GetTrafficController(this Reso /// /// /// Default Api Version - /// 2025-01-01 + /// 2025-03-01-preview /// /// /// Resource @@ -250,7 +250,7 @@ public static AsyncPageable GetTrafficControllersAsyn /// /// /// Default Api Version - /// 2025-01-01 + /// 2025-03-01-preview /// /// /// Resource diff --git a/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/Models/ApplicationGatewayForContainersSecurityPolicyPatch.cs b/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/Models/ApplicationGatewayForContainersSecurityPolicyPatch.cs index 352c5a687e4a..0f3ce11356b0 100644 --- a/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/Models/ApplicationGatewayForContainersSecurityPolicyPatch.cs +++ b/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/Models/ApplicationGatewayForContainersSecurityPolicyPatch.cs @@ -7,7 +7,6 @@ using System; using System.Collections.Generic; -using Azure.Core; namespace Azure.ResourceManager.ServiceNetworking.Models { @@ -66,17 +65,6 @@ internal ApplicationGatewayForContainersSecurityPolicyPatch(IDictionary Resource tags. public IDictionary Tags { get; } /// The resource-specific properties for this resource. - internal SecurityPolicyUpdateProperties Properties { get; set; } - /// Gets or sets Id. - public ResourceIdentifier WafPolicyId - { - get => Properties is null ? default : Properties.WafPolicyId; - set - { - if (Properties is null) - Properties = new SecurityPolicyUpdateProperties(); - Properties.WafPolicyId = value; - } - } + public SecurityPolicyUpdateProperties Properties { get; set; } } } diff --git a/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/Models/ApplicationGatewayForContainersSecurityPolicyType.cs b/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/Models/ApplicationGatewayForContainersSecurityPolicyType.cs index ba39041ae845..2ea28087e940 100644 --- a/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/Models/ApplicationGatewayForContainersSecurityPolicyType.cs +++ b/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/Models/ApplicationGatewayForContainersSecurityPolicyType.cs @@ -23,9 +23,12 @@ public ApplicationGatewayForContainersSecurityPolicyType(string value) } private const string WAFValue = "waf"; + private const string IPAccessRulesValue = "ipAccessRules"; /// Policy of Type WAF. public static ApplicationGatewayForContainersSecurityPolicyType WAF { get; } = new ApplicationGatewayForContainersSecurityPolicyType(WAFValue); + /// Policy of Type IpAccessRules. + public static ApplicationGatewayForContainersSecurityPolicyType IPAccessRules { get; } = new ApplicationGatewayForContainersSecurityPolicyType(IPAccessRulesValue); /// Determines if two values are the same. public static bool operator ==(ApplicationGatewayForContainersSecurityPolicyType left, ApplicationGatewayForContainersSecurityPolicyType right) => left.Equals(right); /// Determines if two values are not the same. diff --git a/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/Models/FrontendUpdateProperties.Serialization.cs b/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/Models/FrontendUpdateProperties.Serialization.cs new file mode 100644 index 000000000000..0cc5da74707f --- /dev/null +++ b/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/Models/FrontendUpdateProperties.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.ServiceNetworking.Models +{ + internal partial class FrontendUpdateProperties : 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(FrontendUpdateProperties)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(SecurityPolicyConfigurations)) + { + writer.WritePropertyName("securityPolicyConfigurations"u8); + writer.WriteObjectValue(SecurityPolicyConfigurations, 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 + } + } + } + + FrontendUpdateProperties 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(FrontendUpdateProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeFrontendUpdateProperties(document.RootElement, options); + } + + internal static FrontendUpdateProperties DeserializeFrontendUpdateProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + SecurityPolicyConfigurations securityPolicyConfigurations = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("securityPolicyConfigurations"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + securityPolicyConfigurations = SecurityPolicyConfigurations.DeserializeSecurityPolicyConfigurations(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new FrontendUpdateProperties(securityPolicyConfigurations, 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, AzureResourceManagerServiceNetworkingContext.Default); + default: + throw new FormatException($"The model {nameof(FrontendUpdateProperties)} does not support writing '{options.Format}' format."); + } + } + + FrontendUpdateProperties 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 DeserializeFrontendUpdateProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(FrontendUpdateProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/Models/FrontendUpdateProperties.cs b/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/Models/FrontendUpdateProperties.cs new file mode 100644 index 000000000000..1abf11b8aab3 --- /dev/null +++ b/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/Models/FrontendUpdateProperties.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.ServiceNetworking.Models +{ + /// The updatable properties of the Frontend. + internal partial class FrontendUpdateProperties + { + /// + /// 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 FrontendUpdateProperties() + { + } + + /// Initializes a new instance of . + /// Frontend Security Policy Configuration. + /// Keeps track of any properties unknown to the library. + internal FrontendUpdateProperties(SecurityPolicyConfigurations securityPolicyConfigurations, IDictionary serializedAdditionalRawData) + { + SecurityPolicyConfigurations = securityPolicyConfigurations; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Frontend Security Policy Configuration. + public SecurityPolicyConfigurations SecurityPolicyConfigurations { get; set; } + } +} diff --git a/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/Models/IPAccessRule.Serialization.cs b/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/Models/IPAccessRule.Serialization.cs new file mode 100644 index 000000000000..7f975e7261e9 --- /dev/null +++ b/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/Models/IPAccessRule.Serialization.cs @@ -0,0 +1,160 @@ +// 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.ServiceNetworking.Models +{ + public partial class IPAccessRule : 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(IPAccessRule)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + writer.WritePropertyName("priority"u8); + writer.WriteNumberValue(Priority); + writer.WritePropertyName("sourceAddressPrefixes"u8); + writer.WriteStartArray(); + foreach (var item in SourceAddressPrefixes) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + writer.WritePropertyName("action"u8); + writer.WriteStringValue(Action.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 + } + } + } + + IPAccessRule 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(IPAccessRule)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeIPAccessRule(document.RootElement, options); + } + + internal static IPAccessRule DeserializeIPAccessRule(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string name = default; + int priority = default; + IList sourceAddressPrefixes = default; + IPAccessRuleAction action = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("priority"u8)) + { + priority = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("sourceAddressPrefixes"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + sourceAddressPrefixes = array; + continue; + } + if (property.NameEquals("action"u8)) + { + action = new IPAccessRuleAction(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new IPAccessRule(name, priority, sourceAddressPrefixes, action, 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, AzureResourceManagerServiceNetworkingContext.Default); + default: + throw new FormatException($"The model {nameof(IPAccessRule)} does not support writing '{options.Format}' format."); + } + } + + IPAccessRule 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 DeserializeIPAccessRule(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(IPAccessRule)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/Models/IPAccessRule.cs b/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/Models/IPAccessRule.cs new file mode 100644 index 000000000000..3094abb24dbf --- /dev/null +++ b/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/Models/IPAccessRule.cs @@ -0,0 +1,95 @@ +// 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.ServiceNetworking.Models +{ + /// Ip Access Policy Rules. + public partial class IPAccessRule + { + /// + /// 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 . + /// Name of the Ip Access Rule. + /// The priority of the rule. The value can be between 1 and 500. The priority number must be unique for each rule in the collection. The lower the priority number, the higher the priority of the rule. + /// Source Address Prefixed Applied by the Rule. Asterisk '*' can also be used to match all source IPs. + /// Action of the Rule. + /// or is null. + public IPAccessRule(string name, int priority, IEnumerable sourceAddressPrefixes, IPAccessRuleAction action) + { + Argument.AssertNotNull(name, nameof(name)); + Argument.AssertNotNull(sourceAddressPrefixes, nameof(sourceAddressPrefixes)); + + Name = name; + Priority = priority; + SourceAddressPrefixes = sourceAddressPrefixes.ToList(); + Action = action; + } + + /// Initializes a new instance of . + /// Name of the Ip Access Rule. + /// The priority of the rule. The value can be between 1 and 500. The priority number must be unique for each rule in the collection. The lower the priority number, the higher the priority of the rule. + /// Source Address Prefixed Applied by the Rule. Asterisk '*' can also be used to match all source IPs. + /// Action of the Rule. + /// Keeps track of any properties unknown to the library. + internal IPAccessRule(string name, int priority, IList sourceAddressPrefixes, IPAccessRuleAction action, IDictionary serializedAdditionalRawData) + { + Name = name; + Priority = priority; + SourceAddressPrefixes = sourceAddressPrefixes; + Action = action; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal IPAccessRule() + { + } + + /// Name of the Ip Access Rule. + public string Name { get; set; } + /// The priority of the rule. The value can be between 1 and 500. The priority number must be unique for each rule in the collection. The lower the priority number, the higher the priority of the rule. + public int Priority { get; set; } + /// Source Address Prefixed Applied by the Rule. Asterisk '*' can also be used to match all source IPs. + public IList SourceAddressPrefixes { get; } + /// Action of the Rule. + public IPAccessRuleAction Action { get; set; } + } +} diff --git a/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/Models/IPAccessRuleAction.cs b/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/Models/IPAccessRuleAction.cs new file mode 100644 index 000000000000..7efc80b0ad7f --- /dev/null +++ b/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/Models/IPAccessRuleAction.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.ServiceNetworking.Models +{ + /// Action of Ip Access Rule. + public readonly partial struct IPAccessRuleAction : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public IPAccessRuleAction(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string AllowValue = "allow"; + private const string DenyValue = "deny"; + + /// Allow Source Ip Prefixes. + public static IPAccessRuleAction Allow { get; } = new IPAccessRuleAction(AllowValue); + /// Deny Source Ip Prefixes. + public static IPAccessRuleAction Deny { get; } = new IPAccessRuleAction(DenyValue); + /// Determines if two values are the same. + public static bool operator ==(IPAccessRuleAction left, IPAccessRuleAction right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(IPAccessRuleAction left, IPAccessRuleAction right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator IPAccessRuleAction(string value) => new IPAccessRuleAction(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is IPAccessRuleAction other && Equals(other); + /// + public bool Equals(IPAccessRuleAction 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/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/Models/IPAccessRulesPolicy.Serialization.cs b/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/Models/IPAccessRulesPolicy.Serialization.cs new file mode 100644 index 000000000000..dae15545a65b --- /dev/null +++ b/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/Models/IPAccessRulesPolicy.Serialization.cs @@ -0,0 +1,143 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ServiceNetworking.Models +{ + internal partial class IPAccessRulesPolicy : 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(IPAccessRulesPolicy)} does not support writing '{format}' format."); + } + + if (Optional.IsCollectionDefined(Rules)) + { + writer.WritePropertyName("rules"u8); + writer.WriteStartArray(); + foreach (var item in Rules) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + IPAccessRulesPolicy 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(IPAccessRulesPolicy)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeIPAccessRulesPolicy(document.RootElement, options); + } + + internal static IPAccessRulesPolicy DeserializeIPAccessRulesPolicy(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IList rules = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("rules"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(IPAccessRule.DeserializeIPAccessRule(item, options)); + } + rules = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new IPAccessRulesPolicy(rules ?? new ChangeTrackingList(), serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerServiceNetworkingContext.Default); + default: + throw new FormatException($"The model {nameof(IPAccessRulesPolicy)} does not support writing '{options.Format}' format."); + } + } + + IPAccessRulesPolicy 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 DeserializeIPAccessRulesPolicy(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(IPAccessRulesPolicy)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/Models/IPAccessRulesPolicy.cs b/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/Models/IPAccessRulesPolicy.cs new file mode 100644 index 000000000000..6e4a24a3c012 --- /dev/null +++ b/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/Models/IPAccessRulesPolicy.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.ServiceNetworking.Models +{ + /// Ip Access Policy. + internal partial class IPAccessRulesPolicy + { + /// + /// 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 IPAccessRulesPolicy() + { + Rules = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// Ip Access Policy Rules List. + /// Keeps track of any properties unknown to the library. + internal IPAccessRulesPolicy(IList rules, IDictionary serializedAdditionalRawData) + { + Rules = rules; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Ip Access Policy Rules List. + public IList Rules { get; } + } +} diff --git a/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/Models/SecurityPolicyConfigurations.Serialization.cs b/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/Models/SecurityPolicyConfigurations.Serialization.cs index 6c82ae860597..eb6a3cca1f34 100644 --- a/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/Models/SecurityPolicyConfigurations.Serialization.cs +++ b/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/Models/SecurityPolicyConfigurations.Serialization.cs @@ -14,7 +14,7 @@ namespace Azure.ResourceManager.ServiceNetworking.Models { - internal partial class SecurityPolicyConfigurations : IUtf8JsonSerializable, IJsonModel + public partial class SecurityPolicyConfigurations : IUtf8JsonSerializable, IJsonModel { void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); @@ -40,6 +40,11 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("wafSecurityPolicy"u8); JsonSerializer.Serialize(writer, WafSecurityPolicy); } + if (Optional.IsDefined(IPAccessRulesSecurityPolicy)) + { + writer.WritePropertyName("ipAccessRulesSecurityPolicy"u8); + JsonSerializer.Serialize(writer, IPAccessRulesSecurityPolicy); + } if (options.Format != "W" && _serializedAdditionalRawData != null) { foreach (var item in _serializedAdditionalRawData) @@ -78,6 +83,7 @@ internal static SecurityPolicyConfigurations DeserializeSecurityPolicyConfigurat return null; } WritableSubResource wafSecurityPolicy = default; + WritableSubResource ipAccessRulesSecurityPolicy = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) @@ -91,13 +97,22 @@ internal static SecurityPolicyConfigurations DeserializeSecurityPolicyConfigurat wafSecurityPolicy = JsonSerializer.Deserialize(property.Value.GetRawText()); continue; } + if (property.NameEquals("ipAccessRulesSecurityPolicy"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + ipAccessRulesSecurityPolicy = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } if (options.Format != "W") { rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); } } serializedAdditionalRawData = rawDataDictionary; - return new SecurityPolicyConfigurations(wafSecurityPolicy, serializedAdditionalRawData); + return new SecurityPolicyConfigurations(wafSecurityPolicy, ipAccessRulesSecurityPolicy, serializedAdditionalRawData); } BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) diff --git a/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/Models/SecurityPolicyConfigurations.cs b/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/Models/SecurityPolicyConfigurations.cs index 6d5cbab6f8ed..540534712601 100644 --- a/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/Models/SecurityPolicyConfigurations.cs +++ b/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/Models/SecurityPolicyConfigurations.cs @@ -13,7 +13,7 @@ namespace Azure.ResourceManager.ServiceNetworking.Models { /// SecurityPolicyConfigurations Subresource of Traffic Controller. - internal partial class SecurityPolicyConfigurations + public partial class SecurityPolicyConfigurations { /// /// Keeps track of any properties unknown to the library. @@ -53,15 +53,17 @@ public SecurityPolicyConfigurations() } /// Initializes a new instance of . - /// Contains reference to a WAF-type security policy that is applied at the Traffic Controller level. + /// Contains reference to a WAF-type security policy. + /// Contains reference to a IpAccessRules-type security policy. /// Keeps track of any properties unknown to the library. - internal SecurityPolicyConfigurations(WritableSubResource wafSecurityPolicy, IDictionary serializedAdditionalRawData) + internal SecurityPolicyConfigurations(WritableSubResource wafSecurityPolicy, WritableSubResource ipAccessRulesSecurityPolicy, IDictionary serializedAdditionalRawData) { WafSecurityPolicy = wafSecurityPolicy; + IPAccessRulesSecurityPolicy = ipAccessRulesSecurityPolicy; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// Contains reference to a WAF-type security policy that is applied at the Traffic Controller level. + /// Contains reference to a WAF-type security policy. internal WritableSubResource WafSecurityPolicy { get; set; } /// Gets or sets Id. public ResourceIdentifier WafSecurityPolicyId @@ -74,5 +76,19 @@ public ResourceIdentifier WafSecurityPolicyId WafSecurityPolicy.Id = value; } } + + /// Contains reference to a IpAccessRules-type security policy. + internal WritableSubResource IPAccessRulesSecurityPolicy { get; set; } + /// Gets or sets Id. + public ResourceIdentifier IPAccessRulesSecurityPolicyId + { + get => IPAccessRulesSecurityPolicy is null ? default : IPAccessRulesSecurityPolicy.Id; + set + { + if (IPAccessRulesSecurityPolicy is null) + IPAccessRulesSecurityPolicy = new WritableSubResource(); + IPAccessRulesSecurityPolicy.Id = value; + } + } } } diff --git a/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/Models/SecurityPolicyUpdateProperties.Serialization.cs b/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/Models/SecurityPolicyUpdateProperties.Serialization.cs index 099e134b4fb2..a8ffd6b23eb1 100644 --- a/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/Models/SecurityPolicyUpdateProperties.Serialization.cs +++ b/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/Models/SecurityPolicyUpdateProperties.Serialization.cs @@ -14,7 +14,7 @@ namespace Azure.ResourceManager.ServiceNetworking.Models { - internal partial class SecurityPolicyUpdateProperties : IUtf8JsonSerializable, IJsonModel + public partial class SecurityPolicyUpdateProperties : IUtf8JsonSerializable, IJsonModel { void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); @@ -40,6 +40,11 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("wafPolicy"u8); JsonSerializer.Serialize(writer, WafPolicy); } + if (Optional.IsDefined(IPAccessRulesPolicy)) + { + writer.WritePropertyName("ipAccessRulesPolicy"u8); + writer.WriteObjectValue(IPAccessRulesPolicy, options); + } if (options.Format != "W" && _serializedAdditionalRawData != null) { foreach (var item in _serializedAdditionalRawData) @@ -78,6 +83,7 @@ internal static SecurityPolicyUpdateProperties DeserializeSecurityPolicyUpdatePr return null; } WritableSubResource wafPolicy = default; + IPAccessRulesPolicy ipAccessRulesPolicy = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) @@ -91,13 +97,22 @@ internal static SecurityPolicyUpdateProperties DeserializeSecurityPolicyUpdatePr wafPolicy = JsonSerializer.Deserialize(property.Value.GetRawText()); continue; } + if (property.NameEquals("ipAccessRulesPolicy"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + ipAccessRulesPolicy = IPAccessRulesPolicy.DeserializeIPAccessRulesPolicy(property.Value, options); + continue; + } if (options.Format != "W") { rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); } } serializedAdditionalRawData = rawDataDictionary; - return new SecurityPolicyUpdateProperties(wafPolicy, serializedAdditionalRawData); + return new SecurityPolicyUpdateProperties(wafPolicy, ipAccessRulesPolicy, serializedAdditionalRawData); } BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) diff --git a/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/Models/SecurityPolicyUpdateProperties.cs b/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/Models/SecurityPolicyUpdateProperties.cs index b05b3bcfc797..48bed9c76ab5 100644 --- a/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/Models/SecurityPolicyUpdateProperties.cs +++ b/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/Models/SecurityPolicyUpdateProperties.cs @@ -13,7 +13,7 @@ namespace Azure.ResourceManager.ServiceNetworking.Models { /// The updatable properties of the SecurityPolicy. - internal partial class SecurityPolicyUpdateProperties + public partial class SecurityPolicyUpdateProperties { /// /// Keeps track of any properties unknown to the library. @@ -53,15 +53,17 @@ public SecurityPolicyUpdateProperties() } /// Initializes a new instance of . - /// Web Application Firewall Policy of the Traffic Controller Security Policy. + /// Web Application Firewall Policy of the Traffic Controller Security Policy. Single Security Policy can have only one policy type set. + /// Ip Access Policy of the Traffic Controller Security Policy. Single Security Policy can have only one policy type set. /// Keeps track of any properties unknown to the library. - internal SecurityPolicyUpdateProperties(WritableSubResource wafPolicy, IDictionary serializedAdditionalRawData) + internal SecurityPolicyUpdateProperties(WritableSubResource wafPolicy, IPAccessRulesPolicy ipAccessRulesPolicy, IDictionary serializedAdditionalRawData) { WafPolicy = wafPolicy; + IPAccessRulesPolicy = ipAccessRulesPolicy; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// Web Application Firewall Policy of the Traffic Controller Security Policy. + /// Web Application Firewall Policy of the Traffic Controller Security Policy. Single Security Policy can have only one policy type set. internal WritableSubResource WafPolicy { get; set; } /// Gets or sets Id. public ResourceIdentifier WafPolicyId @@ -74,5 +76,18 @@ public ResourceIdentifier WafPolicyId WafPolicy.Id = value; } } + + /// Ip Access Policy of the Traffic Controller Security Policy. Single Security Policy can have only one policy type set. + internal IPAccessRulesPolicy IPAccessRulesPolicy { get; set; } + /// Ip Access Policy Rules List. + public IList Rules + { + get + { + if (IPAccessRulesPolicy is null) + IPAccessRulesPolicy = new IPAccessRulesPolicy(); + return IPAccessRulesPolicy.Rules; + } + } } } diff --git a/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/Models/TrafficControllerFrontendPatch.Serialization.cs b/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/Models/TrafficControllerFrontendPatch.Serialization.cs index 292313cd2944..f2b1dbefb2e7 100644 --- a/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/Models/TrafficControllerFrontendPatch.Serialization.cs +++ b/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/Models/TrafficControllerFrontendPatch.Serialization.cs @@ -45,6 +45,11 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } writer.WriteEndObject(); } + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); + } if (options.Format != "W" && _serializedAdditionalRawData != null) { foreach (var item in _serializedAdditionalRawData) @@ -83,6 +88,7 @@ internal static TrafficControllerFrontendPatch DeserializeTrafficControllerFront return null; } IDictionary tags = default; + FrontendUpdateProperties properties = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) @@ -101,13 +107,22 @@ internal static TrafficControllerFrontendPatch DeserializeTrafficControllerFront tags = dictionary; continue; } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = FrontendUpdateProperties.DeserializeFrontendUpdateProperties(property.Value, options); + continue; + } if (options.Format != "W") { rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); } } serializedAdditionalRawData = rawDataDictionary; - return new TrafficControllerFrontendPatch(tags ?? new ChangeTrackingDictionary(), serializedAdditionalRawData); + return new TrafficControllerFrontendPatch(tags ?? new ChangeTrackingDictionary(), properties, serializedAdditionalRawData); } BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) diff --git a/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/Models/TrafficControllerFrontendPatch.cs b/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/Models/TrafficControllerFrontendPatch.cs index 0525191e268c..837b8c74342a 100644 --- a/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/Models/TrafficControllerFrontendPatch.cs +++ b/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/Models/TrafficControllerFrontendPatch.cs @@ -53,14 +53,29 @@ public TrafficControllerFrontendPatch() /// Initializes a new instance of . /// Resource tags. + /// The resource-specific properties for this resource. /// Keeps track of any properties unknown to the library. - internal TrafficControllerFrontendPatch(IDictionary tags, IDictionary serializedAdditionalRawData) + internal TrafficControllerFrontendPatch(IDictionary tags, FrontendUpdateProperties properties, IDictionary serializedAdditionalRawData) { Tags = tags; + Properties = properties; _serializedAdditionalRawData = serializedAdditionalRawData; } /// Resource tags. public IDictionary Tags { get; } + /// The resource-specific properties for this resource. + internal FrontendUpdateProperties Properties { get; set; } + /// Frontend Security Policy Configuration. + public SecurityPolicyConfigurations FrontendUpdateSecurityPolicyConfigurations + { + get => Properties is null ? default : Properties.SecurityPolicyConfigurations; + set + { + if (Properties is null) + Properties = new FrontendUpdateProperties(); + Properties.SecurityPolicyConfigurations = value; + } + } } } diff --git a/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/Models/TrafficControllerPatch.cs b/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/Models/TrafficControllerPatch.cs index 8256f1621f94..e1770775deb4 100644 --- a/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/Models/TrafficControllerPatch.cs +++ b/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/Models/TrafficControllerPatch.cs @@ -7,7 +7,6 @@ using System; using System.Collections.Generic; -using Azure.Core; namespace Azure.ResourceManager.ServiceNetworking.Models { @@ -67,15 +66,15 @@ internal TrafficControllerPatch(IDictionary tags, TrafficControl public IDictionary Tags { get; } /// The resource-specific properties for this resource. internal TrafficControllerUpdateProperties Properties { get; set; } - /// Gets or sets Id. - public ResourceIdentifier WafSecurityPolicyId + /// Security Policy Configuration. + public SecurityPolicyConfigurations TrafficControllerUpdateSecurityPolicyConfigurations { - get => Properties is null ? default : Properties.WafSecurityPolicyId; + get => Properties is null ? default : Properties.SecurityPolicyConfigurations; set { if (Properties is null) Properties = new TrafficControllerUpdateProperties(); - Properties.WafSecurityPolicyId = value; + Properties.SecurityPolicyConfigurations = value; } } } diff --git a/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/Models/TrafficControllerUpdateProperties.cs b/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/Models/TrafficControllerUpdateProperties.cs index f848a96b008b..3f49130a4e16 100644 --- a/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/Models/TrafficControllerUpdateProperties.cs +++ b/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/Models/TrafficControllerUpdateProperties.cs @@ -7,7 +7,6 @@ using System; using System.Collections.Generic; -using Azure.Core; namespace Azure.ResourceManager.ServiceNetworking.Models { @@ -61,17 +60,6 @@ internal TrafficControllerUpdateProperties(SecurityPolicyConfigurations security } /// Security Policy Configuration. - internal SecurityPolicyConfigurations SecurityPolicyConfigurations { get; set; } - /// Gets or sets Id. - public ResourceIdentifier WafSecurityPolicyId - { - get => SecurityPolicyConfigurations is null ? default : SecurityPolicyConfigurations.WafSecurityPolicyId; - set - { - if (SecurityPolicyConfigurations is null) - SecurityPolicyConfigurations = new SecurityPolicyConfigurations(); - SecurityPolicyConfigurations.WafSecurityPolicyId = value; - } - } + public SecurityPolicyConfigurations SecurityPolicyConfigurations { get; set; } } } diff --git a/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/RestOperations/AssociationsInterfaceRestOperations.cs b/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/RestOperations/AssociationsInterfaceRestOperations.cs index bd99e32d0434..c350a14d590d 100644 --- a/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/RestOperations/AssociationsInterfaceRestOperations.cs +++ b/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/RestOperations/AssociationsInterfaceRestOperations.cs @@ -32,7 +32,7 @@ public AssociationsInterfaceRestOperations(HttpPipeline pipeline, string applica { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2025-01-01"; + _apiVersion = apiVersion ?? "2025-03-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/RestOperations/FrontendsInterfaceRestOperations.cs b/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/RestOperations/FrontendsInterfaceRestOperations.cs index 0523b711959a..e5c778739b22 100644 --- a/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/RestOperations/FrontendsInterfaceRestOperations.cs +++ b/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/RestOperations/FrontendsInterfaceRestOperations.cs @@ -32,7 +32,7 @@ public FrontendsInterfaceRestOperations(HttpPipeline pipeline, string applicatio { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2025-01-01"; + _apiVersion = apiVersion ?? "2025-03-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/RestOperations/SecurityPoliciesInterfaceRestOperations.cs b/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/RestOperations/SecurityPoliciesInterfaceRestOperations.cs index 268a30551cc6..8756ca255e19 100644 --- a/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/RestOperations/SecurityPoliciesInterfaceRestOperations.cs +++ b/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/RestOperations/SecurityPoliciesInterfaceRestOperations.cs @@ -32,7 +32,7 @@ public SecurityPoliciesInterfaceRestOperations(HttpPipeline pipeline, string app { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2025-01-01"; + _apiVersion = apiVersion ?? "2025-03-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/RestOperations/TrafficControllerInterfaceRestOperations.cs b/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/RestOperations/TrafficControllerInterfaceRestOperations.cs index 1f10386d3068..6c28dea5cce7 100644 --- a/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/RestOperations/TrafficControllerInterfaceRestOperations.cs +++ b/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/RestOperations/TrafficControllerInterfaceRestOperations.cs @@ -32,7 +32,7 @@ public TrafficControllerInterfaceRestOperations(HttpPipeline pipeline, string ap { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2025-01-01"; + _apiVersion = apiVersion ?? "2025-03-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/TrafficControllerAssociationCollection.cs b/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/TrafficControllerAssociationCollection.cs index 64864d11e3f9..95f374feec94 100644 --- a/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/TrafficControllerAssociationCollection.cs +++ b/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/TrafficControllerAssociationCollection.cs @@ -64,7 +64,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2025-01-01 + /// 2025-03-01-preview /// /// /// Resource @@ -113,7 +113,7 @@ public virtual async Task> Cr /// /// /// Default Api Version - /// 2025-01-01 + /// 2025-03-01-preview /// /// /// Resource @@ -162,7 +162,7 @@ public virtual ArmOperation CreateOrUpdate /// /// /// Default Api Version - /// 2025-01-01 + /// 2025-03-01-preview /// /// /// Resource @@ -207,7 +207,7 @@ public virtual async Task> GetAsy /// /// /// Default Api Version - /// 2025-01-01 + /// 2025-03-01-preview /// /// /// Resource @@ -252,7 +252,7 @@ public virtual Response Get(string associa /// /// /// Default Api Version - /// 2025-01-01 + /// 2025-03-01-preview /// /// /// Resource @@ -282,7 +282,7 @@ public virtual AsyncPageable GetAllAsync(C /// /// /// Default Api Version - /// 2025-01-01 + /// 2025-03-01-preview /// /// /// Resource @@ -312,7 +312,7 @@ public virtual Pageable GetAll(Cancellatio /// /// /// Default Api Version - /// 2025-01-01 + /// 2025-03-01-preview /// /// /// Resource @@ -355,7 +355,7 @@ public virtual async Task> ExistsAsync(string associationName, Ca /// /// /// Default Api Version - /// 2025-01-01 + /// 2025-03-01-preview /// /// /// Resource @@ -398,7 +398,7 @@ public virtual Response Exists(string associationName, CancellationToken c /// /// /// Default Api Version - /// 2025-01-01 + /// 2025-03-01-preview /// /// /// Resource @@ -443,7 +443,7 @@ public virtual async Task /// /// /// Default Api Version - /// 2025-01-01 + /// 2025-03-01-preview /// /// /// Resource diff --git a/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/TrafficControllerAssociationResource.cs b/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/TrafficControllerAssociationResource.cs index 2e05cad30094..533d43338a05 100644 --- a/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/TrafficControllerAssociationResource.cs +++ b/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/TrafficControllerAssociationResource.cs @@ -103,7 +103,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2025-01-01 + /// 2025-03-01-preview /// /// /// Resource @@ -143,7 +143,7 @@ public virtual async Task> GetAsy /// /// /// Default Api Version - /// 2025-01-01 + /// 2025-03-01-preview /// /// /// Resource @@ -183,7 +183,7 @@ public virtual Response Get(CancellationTo /// /// /// Default Api Version - /// 2025-01-01 + /// 2025-03-01-preview /// /// /// Resource @@ -225,7 +225,7 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell /// /// /// Default Api Version - /// 2025-01-01 + /// 2025-03-01-preview /// /// /// Resource @@ -267,7 +267,7 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel /// /// /// Default Api Version - /// 2025-01-01 + /// 2025-03-01-preview /// /// /// Resource @@ -309,7 +309,7 @@ public virtual async Task> Update /// /// /// Default Api Version - /// 2025-01-01 + /// 2025-03-01-preview /// /// /// Resource @@ -351,7 +351,7 @@ public virtual Response Update(TrafficCont /// /// /// Default Api Version - /// 2025-01-01 + /// 2025-03-01-preview /// /// /// Resource @@ -413,7 +413,7 @@ public virtual async Task> AddTag /// /// /// Default Api Version - /// 2025-01-01 + /// 2025-03-01-preview /// /// /// Resource @@ -475,7 +475,7 @@ public virtual Response AddTag(string key, /// /// /// Default Api Version - /// 2025-01-01 + /// 2025-03-01-preview /// /// /// Resource @@ -532,7 +532,7 @@ public virtual async Task> SetTag /// /// /// Default Api Version - /// 2025-01-01 + /// 2025-03-01-preview /// /// /// Resource @@ -589,7 +589,7 @@ public virtual Response SetTags(IDictionar /// /// /// Default Api Version - /// 2025-01-01 + /// 2025-03-01-preview /// /// /// Resource @@ -649,7 +649,7 @@ public virtual async Task> Remove /// /// /// Default Api Version - /// 2025-01-01 + /// 2025-03-01-preview /// /// /// Resource diff --git a/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/TrafficControllerCollection.cs b/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/TrafficControllerCollection.cs index 328e576f3eb0..88e3980cdce3 100644 --- a/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/TrafficControllerCollection.cs +++ b/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/TrafficControllerCollection.cs @@ -65,7 +65,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2025-01-01 + /// 2025-03-01-preview /// /// /// Resource @@ -114,7 +114,7 @@ public virtual async Task> CreateOrUpdat /// /// /// Default Api Version - /// 2025-01-01 + /// 2025-03-01-preview /// /// /// Resource @@ -163,7 +163,7 @@ public virtual ArmOperation CreateOrUpdate(WaitUntil /// /// /// Default Api Version - /// 2025-01-01 + /// 2025-03-01-preview /// /// /// Resource @@ -208,7 +208,7 @@ public virtual async Task> GetAsync(string t /// /// /// Default Api Version - /// 2025-01-01 + /// 2025-03-01-preview /// /// /// Resource @@ -253,7 +253,7 @@ public virtual Response Get(string trafficControllerN /// /// /// Default Api Version - /// 2025-01-01 + /// 2025-03-01-preview /// /// /// Resource @@ -283,7 +283,7 @@ public virtual AsyncPageable GetAllAsync(Cancellation /// /// /// Default Api Version - /// 2025-01-01 + /// 2025-03-01-preview /// /// /// Resource @@ -313,7 +313,7 @@ public virtual Pageable GetAll(CancellationToken canc /// /// /// Default Api Version - /// 2025-01-01 + /// 2025-03-01-preview /// /// /// Resource @@ -356,7 +356,7 @@ public virtual async Task> ExistsAsync(string trafficControllerNa /// /// /// Default Api Version - /// 2025-01-01 + /// 2025-03-01-preview /// /// /// Resource @@ -399,7 +399,7 @@ public virtual Response Exists(string trafficControllerName, CancellationT /// /// /// Default Api Version - /// 2025-01-01 + /// 2025-03-01-preview /// /// /// Resource @@ -444,7 +444,7 @@ public virtual async Task> GetIfExis /// /// /// Default Api Version - /// 2025-01-01 + /// 2025-03-01-preview /// /// /// Resource diff --git a/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/TrafficControllerData.cs b/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/TrafficControllerData.cs index 115fdd7a83cb..e26b248767ec 100644 --- a/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/TrafficControllerData.cs +++ b/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/TrafficControllerData.cs @@ -101,19 +101,7 @@ internal TrafficControllerData() /// Security Policies References List. public IReadOnlyList SecurityPolicies { get; } /// Security Policy Configuration. - internal SecurityPolicyConfigurations SecurityPolicyConfigurations { get; set; } - /// Gets or sets Id. - public ResourceIdentifier WafSecurityPolicyId - { - get => SecurityPolicyConfigurations is null ? default : SecurityPolicyConfigurations.WafSecurityPolicyId; - set - { - if (SecurityPolicyConfigurations is null) - SecurityPolicyConfigurations = new SecurityPolicyConfigurations(); - SecurityPolicyConfigurations.WafSecurityPolicyId = value; - } - } - + public SecurityPolicyConfigurations SecurityPolicyConfigurations { get; set; } /// The status of the last operation. public ServiceNetworkingProvisioningState? TrafficControllerProvisioningState { get; } } diff --git a/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/TrafficControllerFrontendCollection.cs b/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/TrafficControllerFrontendCollection.cs index 92c6de88d587..3d8320c75726 100644 --- a/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/TrafficControllerFrontendCollection.cs +++ b/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/TrafficControllerFrontendCollection.cs @@ -64,7 +64,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2025-01-01 + /// 2025-03-01-preview /// /// /// Resource @@ -113,7 +113,7 @@ public virtual async Task> Creat /// /// /// Default Api Version - /// 2025-01-01 + /// 2025-03-01-preview /// /// /// Resource @@ -162,7 +162,7 @@ public virtual ArmOperation CreateOrUpdate(Wa /// /// /// Default Api Version - /// 2025-01-01 + /// 2025-03-01-preview /// /// /// Resource @@ -207,7 +207,7 @@ public virtual async Task> GetAsync( /// /// /// Default Api Version - /// 2025-01-01 + /// 2025-03-01-preview /// /// /// Resource @@ -252,7 +252,7 @@ public virtual Response Get(string frontendNa /// /// /// Default Api Version - /// 2025-01-01 + /// 2025-03-01-preview /// /// /// Resource @@ -282,7 +282,7 @@ public virtual AsyncPageable GetAllAsync(Canc /// /// /// Default Api Version - /// 2025-01-01 + /// 2025-03-01-preview /// /// /// Resource @@ -312,7 +312,7 @@ public virtual Pageable GetAll(CancellationTo /// /// /// Default Api Version - /// 2025-01-01 + /// 2025-03-01-preview /// /// /// Resource @@ -355,7 +355,7 @@ public virtual async Task> ExistsAsync(string frontendName, Cance /// /// /// Default Api Version - /// 2025-01-01 + /// 2025-03-01-preview /// /// /// Resource @@ -398,7 +398,7 @@ public virtual Response Exists(string frontendName, CancellationToken canc /// /// /// Default Api Version - /// 2025-01-01 + /// 2025-03-01-preview /// /// /// Resource @@ -443,7 +443,7 @@ public virtual async Task> G /// /// /// Default Api Version - /// 2025-01-01 + /// 2025-03-01-preview /// /// /// Resource diff --git a/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/TrafficControllerFrontendData.Serialization.cs b/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/TrafficControllerFrontendData.Serialization.cs index 933384668505..f9970facb02b 100644 --- a/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/TrafficControllerFrontendData.Serialization.cs +++ b/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/TrafficControllerFrontendData.Serialization.cs @@ -44,6 +44,11 @@ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWri writer.WritePropertyName("fqdn"u8); writer.WriteStringValue(Fqdn); } + if (Optional.IsDefined(SecurityPolicyConfigurations)) + { + writer.WritePropertyName("securityPolicyConfigurations"u8); + writer.WriteObjectValue(SecurityPolicyConfigurations, options); + } if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) { writer.WritePropertyName("provisioningState"u8); @@ -79,6 +84,7 @@ internal static TrafficControllerFrontendData DeserializeTrafficControllerFronte ResourceType type = default; SystemData systemData = default; string fqdn = default; + SecurityPolicyConfigurations securityPolicyConfigurations = default; ServiceNetworkingProvisioningState? provisioningState = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); @@ -141,6 +147,15 @@ internal static TrafficControllerFrontendData DeserializeTrafficControllerFronte fqdn = property0.Value.GetString(); continue; } + if (property0.NameEquals("securityPolicyConfigurations"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + securityPolicyConfigurations = SecurityPolicyConfigurations.DeserializeSecurityPolicyConfigurations(property0.Value, options); + continue; + } if (property0.NameEquals("provisioningState"u8)) { if (property0.Value.ValueKind == JsonValueKind.Null) @@ -167,6 +182,7 @@ internal static TrafficControllerFrontendData DeserializeTrafficControllerFronte tags ?? new ChangeTrackingDictionary(), location, fqdn, + securityPolicyConfigurations, provisioningState, serializedAdditionalRawData); } diff --git a/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/TrafficControllerFrontendData.cs b/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/TrafficControllerFrontendData.cs index b4dcfe26d763..4cf9ccff1b76 100644 --- a/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/TrafficControllerFrontendData.cs +++ b/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/TrafficControllerFrontendData.cs @@ -65,11 +65,13 @@ public TrafficControllerFrontendData(AzureLocation location) : base(location) /// The tags. /// The location. /// The Fully Qualified Domain Name of the DNS record associated to a Traffic Controller frontend. + /// Frontend Security Policy Configuration. /// Provisioning State of Traffic Controller Frontend Resource. /// Keeps track of any properties unknown to the library. - internal TrafficControllerFrontendData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, string fqdn, ServiceNetworkingProvisioningState? provisioningState, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) + internal TrafficControllerFrontendData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, string fqdn, SecurityPolicyConfigurations securityPolicyConfigurations, ServiceNetworkingProvisioningState? provisioningState, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { Fqdn = fqdn; + SecurityPolicyConfigurations = securityPolicyConfigurations; ProvisioningState = provisioningState; _serializedAdditionalRawData = serializedAdditionalRawData; } @@ -81,6 +83,8 @@ internal TrafficControllerFrontendData() /// The Fully Qualified Domain Name of the DNS record associated to a Traffic Controller frontend. public string Fqdn { get; } + /// Frontend Security Policy Configuration. + public SecurityPolicyConfigurations SecurityPolicyConfigurations { get; set; } /// Provisioning State of Traffic Controller Frontend Resource. public ServiceNetworkingProvisioningState? ProvisioningState { get; } } diff --git a/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/TrafficControllerFrontendResource.cs b/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/TrafficControllerFrontendResource.cs index 857e8ef899b9..ef89d356a216 100644 --- a/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/TrafficControllerFrontendResource.cs +++ b/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/TrafficControllerFrontendResource.cs @@ -103,7 +103,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2025-01-01 + /// 2025-03-01-preview /// /// /// Resource @@ -143,7 +143,7 @@ public virtual async Task> GetAsync( /// /// /// Default Api Version - /// 2025-01-01 + /// 2025-03-01-preview /// /// /// Resource @@ -183,7 +183,7 @@ public virtual Response Get(CancellationToken /// /// /// Default Api Version - /// 2025-01-01 + /// 2025-03-01-preview /// /// /// Resource @@ -225,7 +225,7 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell /// /// /// Default Api Version - /// 2025-01-01 + /// 2025-03-01-preview /// /// /// Resource @@ -267,7 +267,7 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel /// /// /// Default Api Version - /// 2025-01-01 + /// 2025-03-01-preview /// /// /// Resource @@ -309,7 +309,7 @@ public virtual async Task> UpdateAsy /// /// /// Default Api Version - /// 2025-01-01 + /// 2025-03-01-preview /// /// /// Resource @@ -351,7 +351,7 @@ public virtual Response Update(TrafficControl /// /// /// Default Api Version - /// 2025-01-01 + /// 2025-03-01-preview /// /// /// Resource @@ -413,7 +413,7 @@ public virtual async Task> AddTagAsy /// /// /// Default Api Version - /// 2025-01-01 + /// 2025-03-01-preview /// /// /// Resource @@ -475,7 +475,7 @@ public virtual Response AddTag(string key, st /// /// /// Default Api Version - /// 2025-01-01 + /// 2025-03-01-preview /// /// /// Resource @@ -532,7 +532,7 @@ public virtual async Task> SetTagsAs /// /// /// Default Api Version - /// 2025-01-01 + /// 2025-03-01-preview /// /// /// Resource @@ -589,7 +589,7 @@ public virtual Response SetTags(IDictionary /// /// Default Api Version - /// 2025-01-01 + /// 2025-03-01-preview /// /// /// Resource @@ -649,7 +649,7 @@ public virtual async Task> RemoveTag /// /// /// Default Api Version - /// 2025-01-01 + /// 2025-03-01-preview /// /// /// Resource diff --git a/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/TrafficControllerResource.cs b/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/TrafficControllerResource.cs index 8c9ca0ac3c3e..ab5351efba6d 100644 --- a/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/TrafficControllerResource.cs +++ b/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/TrafficControllerResource.cs @@ -110,7 +110,7 @@ public virtual TrafficControllerAssociationCollection GetTrafficControllerAssoci /// /// /// Default Api Version - /// 2025-01-01 + /// 2025-03-01-preview /// /// /// Resource @@ -141,7 +141,7 @@ public virtual async Task> GetTra /// /// /// Default Api Version - /// 2025-01-01 + /// 2025-03-01-preview /// /// /// Resource @@ -179,7 +179,7 @@ public virtual TrafficControllerFrontendCollection GetTrafficControllerFrontends /// /// /// Default Api Version - /// 2025-01-01 + /// 2025-03-01-preview /// /// /// Resource @@ -210,7 +210,7 @@ public virtual async Task> GetTraffi /// /// /// Default Api Version - /// 2025-01-01 + /// 2025-03-01-preview /// /// /// Resource @@ -248,7 +248,7 @@ public virtual ApplicationGatewayForContainersSecurityPolicyCollection GetApplic /// /// /// Default Api Version - /// 2025-01-01 + /// 2025-03-01-preview /// /// /// Resource @@ -279,7 +279,7 @@ public virtual async Task /// /// Default Api Version - /// 2025-01-01 + /// 2025-03-01-preview /// /// /// Resource @@ -310,7 +310,7 @@ public virtual Response G /// /// /// Default Api Version - /// 2025-01-01 + /// 2025-03-01-preview /// /// /// Resource @@ -350,7 +350,7 @@ public virtual async Task> GetAsync(Cancella /// /// /// Default Api Version - /// 2025-01-01 + /// 2025-03-01-preview /// /// /// Resource @@ -390,7 +390,7 @@ public virtual Response Get(CancellationToken cancell /// /// /// Default Api Version - /// 2025-01-01 + /// 2025-03-01-preview /// /// /// Resource @@ -432,7 +432,7 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell /// /// /// Default Api Version - /// 2025-01-01 + /// 2025-03-01-preview /// /// /// Resource @@ -474,7 +474,7 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel /// /// /// Default Api Version - /// 2025-01-01 + /// 2025-03-01-preview /// /// /// Resource @@ -516,7 +516,7 @@ public virtual async Task> UpdateAsync(Traff /// /// /// Default Api Version - /// 2025-01-01 + /// 2025-03-01-preview /// /// /// Resource @@ -558,7 +558,7 @@ public virtual Response Update(TrafficControllerPatch /// /// /// Default Api Version - /// 2025-01-01 + /// 2025-03-01-preview /// /// /// Resource @@ -620,7 +620,7 @@ public virtual async Task> AddTagAsync(strin /// /// /// Default Api Version - /// 2025-01-01 + /// 2025-03-01-preview /// /// /// Resource @@ -682,7 +682,7 @@ public virtual Response AddTag(string key, string val /// /// /// Default Api Version - /// 2025-01-01 + /// 2025-03-01-preview /// /// /// Resource @@ -739,7 +739,7 @@ public virtual async Task> SetTagsAsync(IDic /// /// /// Default Api Version - /// 2025-01-01 + /// 2025-03-01-preview /// /// /// Resource @@ -796,7 +796,7 @@ public virtual Response SetTags(IDictionary /// /// Default Api Version - /// 2025-01-01 + /// 2025-03-01-preview /// /// /// Resource @@ -856,7 +856,7 @@ public virtual async Task> RemoveTagAsync(st /// /// /// Default Api Version - /// 2025-01-01 + /// 2025-03-01-preview /// /// /// Resource diff --git a/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/tsp-location.yaml b/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/tsp-location.yaml index 717c8fce85f2..870991c6514c 100644 --- a/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/tsp-location.yaml +++ b/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/tsp-location.yaml @@ -1,3 +1,4 @@ directory: specification/servicenetworking/ServiceNetworking.Management -commit: 488fe8302cc529352bd6544e882773b5cc391f15 +commit: 0c929c78c4b7892c20cdfee10ddebb97cdf9d8a9 repo: Azure/azure-rest-api-specs +additionalDirectories: diff --git a/sdk/standbypool/Azure.ResourceManager.StandbyPool/api/Azure.ResourceManager.StandbyPool.net8.0.cs b/sdk/standbypool/Azure.ResourceManager.StandbyPool/api/Azure.ResourceManager.StandbyPool.net8.0.cs index 67f05d1f60c1..1d7bbb2319aa 100644 --- a/sdk/standbypool/Azure.ResourceManager.StandbyPool/api/Azure.ResourceManager.StandbyPool.net8.0.cs +++ b/sdk/standbypool/Azure.ResourceManager.StandbyPool/api/Azure.ResourceManager.StandbyPool.net8.0.cs @@ -305,12 +305,8 @@ public static partial class ArmStandbyPoolModelFactory public static Azure.ResourceManager.StandbyPool.StandbyContainerGroupPoolData StandbyContainerGroupPoolData(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.StandbyPool.Models.StandbyContainerGroupPoolProperties properties = null) { throw null; } public static Azure.ResourceManager.StandbyPool.Models.StandbyContainerGroupPoolPrediction StandbyContainerGroupPoolPrediction(System.Collections.Generic.IEnumerable forecastValuesInstancesRequestedCount = null, System.DateTimeOffset forecastStartOn = default(System.DateTimeOffset), string forecastInfo = null) { throw null; } public static Azure.ResourceManager.StandbyPool.Models.StandbyContainerGroupPoolProperties StandbyContainerGroupPoolProperties(Azure.ResourceManager.StandbyPool.Models.StandbyContainerGroupPoolElasticityProfile elasticityProfile = null, Azure.ResourceManager.StandbyPool.Models.StandbyContainerGroupProperties containerGroupProperties = null, System.Collections.Generic.IEnumerable zones = null, Azure.ResourceManager.StandbyPool.Models.StandbyProvisioningState? provisioningState = default(Azure.ResourceManager.StandbyPool.Models.StandbyProvisioningState?)) { throw null; } - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public static Azure.ResourceManager.StandbyPool.Models.StandbyContainerGroupPoolProperties StandbyContainerGroupPoolProperties(Azure.ResourceManager.StandbyPool.Models.StandbyContainerGroupPoolElasticityProfile elasticityProfile, Azure.ResourceManager.StandbyPool.Models.StandbyContainerGroupProperties containerGroupProperties, Azure.ResourceManager.StandbyPool.Models.StandbyProvisioningState? provisioningState) { throw null; } public static Azure.ResourceManager.StandbyPool.StandbyContainerGroupPoolRuntimeViewData StandbyContainerGroupPoolRuntimeViewData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.ResourceManager.StandbyPool.Models.StandbyContainerGroupPoolRuntimeViewProperties properties = null) { throw null; } public static Azure.ResourceManager.StandbyPool.Models.StandbyContainerGroupPoolRuntimeViewProperties StandbyContainerGroupPoolRuntimeViewProperties(System.Collections.Generic.IEnumerable instanceCountSummary = null, Azure.ResourceManager.StandbyPool.Models.StandbyPoolStatus status = null, Azure.ResourceManager.StandbyPool.Models.StandbyProvisioningState? provisioningState = default(Azure.ResourceManager.StandbyPool.Models.StandbyProvisioningState?), Azure.ResourceManager.StandbyPool.Models.StandbyContainerGroupPoolPrediction prediction = null) { throw null; } - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public static Azure.ResourceManager.StandbyPool.Models.StandbyContainerGroupPoolRuntimeViewProperties StandbyContainerGroupPoolRuntimeViewProperties(System.Collections.Generic.IEnumerable instanceCountSummary, Azure.ResourceManager.StandbyPool.Models.StandbyProvisioningState? provisioningState) { throw null; } public static Azure.ResourceManager.StandbyPool.Models.StandbyPoolStatus StandbyPoolStatus(Azure.ResourceManager.StandbyPool.Models.StandbyPoolHealthStateCode code = default(Azure.ResourceManager.StandbyPool.Models.StandbyPoolHealthStateCode), string message = null) { throw null; } public static Azure.ResourceManager.StandbyPool.StandbyVirtualMachineData StandbyVirtualMachineData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.ResourceManager.StandbyPool.Models.StandbyVirtualMachineProperties properties = null) { throw null; } public static Azure.ResourceManager.StandbyPool.Models.StandbyVirtualMachineInstanceCountSummary StandbyVirtualMachineInstanceCountSummary(long? zone = default(long?), System.Collections.Generic.IEnumerable instanceCountsByState = null) { throw null; } @@ -320,8 +316,6 @@ public static partial class ArmStandbyPoolModelFactory public static Azure.ResourceManager.StandbyPool.Models.StandbyVirtualMachinePoolProperties StandbyVirtualMachinePoolProperties(Azure.ResourceManager.StandbyPool.Models.StandbyVirtualMachinePoolElasticityProfile elasticityProfile = null, Azure.ResourceManager.StandbyPool.Models.StandbyVirtualMachineState virtualMachineState = default(Azure.ResourceManager.StandbyPool.Models.StandbyVirtualMachineState), Azure.Core.ResourceIdentifier attachedVirtualMachineScaleSetId = null, Azure.ResourceManager.StandbyPool.Models.StandbyProvisioningState? provisioningState = default(Azure.ResourceManager.StandbyPool.Models.StandbyProvisioningState?)) { throw null; } public static Azure.ResourceManager.StandbyPool.StandbyVirtualMachinePoolRuntimeViewData StandbyVirtualMachinePoolRuntimeViewData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.ResourceManager.StandbyPool.Models.StandbyVirtualMachinePoolRuntimeViewProperties properties = null) { throw null; } public static Azure.ResourceManager.StandbyPool.Models.StandbyVirtualMachinePoolRuntimeViewProperties StandbyVirtualMachinePoolRuntimeViewProperties(System.Collections.Generic.IEnumerable instanceCountSummary = null, Azure.ResourceManager.StandbyPool.Models.StandbyPoolStatus status = null, Azure.ResourceManager.StandbyPool.Models.StandbyProvisioningState? provisioningState = default(Azure.ResourceManager.StandbyPool.Models.StandbyProvisioningState?), Azure.ResourceManager.StandbyPool.Models.StandbyVirtualMachinePoolPrediction prediction = null) { throw null; } - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public static Azure.ResourceManager.StandbyPool.Models.StandbyVirtualMachinePoolRuntimeViewProperties StandbyVirtualMachinePoolRuntimeViewProperties(System.Collections.Generic.IEnumerable instanceCountSummary, Azure.ResourceManager.StandbyPool.Models.StandbyProvisioningState? provisioningState) { throw null; } public static Azure.ResourceManager.StandbyPool.Models.StandbyVirtualMachineProperties StandbyVirtualMachineProperties(Azure.Core.ResourceIdentifier virtualMachineResourceId = null, Azure.ResourceManager.StandbyPool.Models.StandbyProvisioningState? provisioningState = default(Azure.ResourceManager.StandbyPool.Models.StandbyProvisioningState?)) { throw null; } } public partial class ContainerGroupInstanceCountSummary : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel diff --git a/sdk/standbypool/Azure.ResourceManager.StandbyPool/api/Azure.ResourceManager.StandbyPool.netstandard2.0.cs b/sdk/standbypool/Azure.ResourceManager.StandbyPool/api/Azure.ResourceManager.StandbyPool.netstandard2.0.cs index 67f05d1f60c1..1d7bbb2319aa 100644 --- a/sdk/standbypool/Azure.ResourceManager.StandbyPool/api/Azure.ResourceManager.StandbyPool.netstandard2.0.cs +++ b/sdk/standbypool/Azure.ResourceManager.StandbyPool/api/Azure.ResourceManager.StandbyPool.netstandard2.0.cs @@ -305,12 +305,8 @@ public static partial class ArmStandbyPoolModelFactory public static Azure.ResourceManager.StandbyPool.StandbyContainerGroupPoolData StandbyContainerGroupPoolData(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.StandbyPool.Models.StandbyContainerGroupPoolProperties properties = null) { throw null; } public static Azure.ResourceManager.StandbyPool.Models.StandbyContainerGroupPoolPrediction StandbyContainerGroupPoolPrediction(System.Collections.Generic.IEnumerable forecastValuesInstancesRequestedCount = null, System.DateTimeOffset forecastStartOn = default(System.DateTimeOffset), string forecastInfo = null) { throw null; } public static Azure.ResourceManager.StandbyPool.Models.StandbyContainerGroupPoolProperties StandbyContainerGroupPoolProperties(Azure.ResourceManager.StandbyPool.Models.StandbyContainerGroupPoolElasticityProfile elasticityProfile = null, Azure.ResourceManager.StandbyPool.Models.StandbyContainerGroupProperties containerGroupProperties = null, System.Collections.Generic.IEnumerable zones = null, Azure.ResourceManager.StandbyPool.Models.StandbyProvisioningState? provisioningState = default(Azure.ResourceManager.StandbyPool.Models.StandbyProvisioningState?)) { throw null; } - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public static Azure.ResourceManager.StandbyPool.Models.StandbyContainerGroupPoolProperties StandbyContainerGroupPoolProperties(Azure.ResourceManager.StandbyPool.Models.StandbyContainerGroupPoolElasticityProfile elasticityProfile, Azure.ResourceManager.StandbyPool.Models.StandbyContainerGroupProperties containerGroupProperties, Azure.ResourceManager.StandbyPool.Models.StandbyProvisioningState? provisioningState) { throw null; } public static Azure.ResourceManager.StandbyPool.StandbyContainerGroupPoolRuntimeViewData StandbyContainerGroupPoolRuntimeViewData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.ResourceManager.StandbyPool.Models.StandbyContainerGroupPoolRuntimeViewProperties properties = null) { throw null; } public static Azure.ResourceManager.StandbyPool.Models.StandbyContainerGroupPoolRuntimeViewProperties StandbyContainerGroupPoolRuntimeViewProperties(System.Collections.Generic.IEnumerable instanceCountSummary = null, Azure.ResourceManager.StandbyPool.Models.StandbyPoolStatus status = null, Azure.ResourceManager.StandbyPool.Models.StandbyProvisioningState? provisioningState = default(Azure.ResourceManager.StandbyPool.Models.StandbyProvisioningState?), Azure.ResourceManager.StandbyPool.Models.StandbyContainerGroupPoolPrediction prediction = null) { throw null; } - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public static Azure.ResourceManager.StandbyPool.Models.StandbyContainerGroupPoolRuntimeViewProperties StandbyContainerGroupPoolRuntimeViewProperties(System.Collections.Generic.IEnumerable instanceCountSummary, Azure.ResourceManager.StandbyPool.Models.StandbyProvisioningState? provisioningState) { throw null; } public static Azure.ResourceManager.StandbyPool.Models.StandbyPoolStatus StandbyPoolStatus(Azure.ResourceManager.StandbyPool.Models.StandbyPoolHealthStateCode code = default(Azure.ResourceManager.StandbyPool.Models.StandbyPoolHealthStateCode), string message = null) { throw null; } public static Azure.ResourceManager.StandbyPool.StandbyVirtualMachineData StandbyVirtualMachineData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.ResourceManager.StandbyPool.Models.StandbyVirtualMachineProperties properties = null) { throw null; } public static Azure.ResourceManager.StandbyPool.Models.StandbyVirtualMachineInstanceCountSummary StandbyVirtualMachineInstanceCountSummary(long? zone = default(long?), System.Collections.Generic.IEnumerable instanceCountsByState = null) { throw null; } @@ -320,8 +316,6 @@ public static partial class ArmStandbyPoolModelFactory public static Azure.ResourceManager.StandbyPool.Models.StandbyVirtualMachinePoolProperties StandbyVirtualMachinePoolProperties(Azure.ResourceManager.StandbyPool.Models.StandbyVirtualMachinePoolElasticityProfile elasticityProfile = null, Azure.ResourceManager.StandbyPool.Models.StandbyVirtualMachineState virtualMachineState = default(Azure.ResourceManager.StandbyPool.Models.StandbyVirtualMachineState), Azure.Core.ResourceIdentifier attachedVirtualMachineScaleSetId = null, Azure.ResourceManager.StandbyPool.Models.StandbyProvisioningState? provisioningState = default(Azure.ResourceManager.StandbyPool.Models.StandbyProvisioningState?)) { throw null; } public static Azure.ResourceManager.StandbyPool.StandbyVirtualMachinePoolRuntimeViewData StandbyVirtualMachinePoolRuntimeViewData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.ResourceManager.StandbyPool.Models.StandbyVirtualMachinePoolRuntimeViewProperties properties = null) { throw null; } public static Azure.ResourceManager.StandbyPool.Models.StandbyVirtualMachinePoolRuntimeViewProperties StandbyVirtualMachinePoolRuntimeViewProperties(System.Collections.Generic.IEnumerable instanceCountSummary = null, Azure.ResourceManager.StandbyPool.Models.StandbyPoolStatus status = null, Azure.ResourceManager.StandbyPool.Models.StandbyProvisioningState? provisioningState = default(Azure.ResourceManager.StandbyPool.Models.StandbyProvisioningState?), Azure.ResourceManager.StandbyPool.Models.StandbyVirtualMachinePoolPrediction prediction = null) { throw null; } - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public static Azure.ResourceManager.StandbyPool.Models.StandbyVirtualMachinePoolRuntimeViewProperties StandbyVirtualMachinePoolRuntimeViewProperties(System.Collections.Generic.IEnumerable instanceCountSummary, Azure.ResourceManager.StandbyPool.Models.StandbyProvisioningState? provisioningState) { throw null; } public static Azure.ResourceManager.StandbyPool.Models.StandbyVirtualMachineProperties StandbyVirtualMachineProperties(Azure.Core.ResourceIdentifier virtualMachineResourceId = null, Azure.ResourceManager.StandbyPool.Models.StandbyProvisioningState? provisioningState = default(Azure.ResourceManager.StandbyPool.Models.StandbyProvisioningState?)) { throw null; } } public partial class ContainerGroupInstanceCountSummary : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel diff --git a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/ArmStandbyPoolModelFactory.cs b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/ArmStandbyPoolModelFactory.cs index 3575cd0b2ffa..5c251223d21d 100644 --- a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/ArmStandbyPoolModelFactory.cs +++ b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/ArmStandbyPoolModelFactory.cs @@ -7,7 +7,6 @@ using System; using System.Collections.Generic; -using System.ComponentModel; using System.Linq; using Azure.Core; using Azure.ResourceManager.Models; @@ -250,41 +249,5 @@ public static StandbyContainerGroupPoolPrediction StandbyContainerGroupPoolPredi return new StandbyContainerGroupPoolPrediction(forecastValuesInstancesRequestedCount != null ? new StandbyContainerGroupPoolForecastValues(forecastValuesInstancesRequestedCount?.ToList(), serializedAdditionalRawData: null) : null, forecastStartOn, forecastInfo, serializedAdditionalRawData: null); } - - /// Initializes a new instance of . - /// A list containing the counts of container groups in each possible state, as known by the StandbyPool resource provider. - /// Displays the provisioning state of the standby pool. - /// A new instance for mocking. - [EditorBrowsable(EditorBrowsableState.Never)] - public static StandbyContainerGroupPoolRuntimeViewProperties StandbyContainerGroupPoolRuntimeViewProperties(IEnumerable instanceCountSummary, StandbyProvisioningState? provisioningState) - { - return StandbyContainerGroupPoolRuntimeViewProperties(instanceCountSummary: instanceCountSummary, status: default, provisioningState: provisioningState, prediction: default); - } - - /// Initializes a new instance of . - /// Specifies elasticity profile of standby container group pools. - /// Specifies container group properties of standby container group pools. - /// The status of the last operation. - /// A new instance for mocking. - [EditorBrowsable(EditorBrowsableState.Never)] - public static StandbyContainerGroupPoolProperties StandbyContainerGroupPoolProperties(StandbyContainerGroupPoolElasticityProfile elasticityProfile, StandbyContainerGroupProperties containerGroupProperties, StandbyProvisioningState? provisioningState) - { - return StandbyContainerGroupPoolProperties(elasticityProfile: elasticityProfile, containerGroupProperties: containerGroupProperties, zones: default, provisioningState: provisioningState); - } - - /// Initializes a new instance of . - /// - /// A list containing the counts of virtual machines in each possible power state for each zone if enabled, as known by the StandbyPool resource provider. - /// If zones are not enabled on the attached VMSS, the list will contain a single entry with null zone values. - /// Note: any updates to pool resources outside of StandbyPoolRP (i.e deleting a VM through portal) are not reflected here. - /// Note: any resources in the Running state may still be installing extensions / not fully provisioned. - /// - /// Displays the provisioning state of the standby pool. - /// A new instance for mocking. - [EditorBrowsable(EditorBrowsableState.Never)] - public static StandbyVirtualMachinePoolRuntimeViewProperties StandbyVirtualMachinePoolRuntimeViewProperties(IEnumerable instanceCountSummary, StandbyProvisioningState? provisioningState) - { - return StandbyVirtualMachinePoolRuntimeViewProperties(instanceCountSummary: instanceCountSummary, status: default, provisioningState: provisioningState, prediction: default); - } } } diff --git a/sdk/standbypool/Azure.ResourceManager.StandbyPool/tsp-location.yaml b/sdk/standbypool/Azure.ResourceManager.StandbyPool/tsp-location.yaml index db59ec6f9183..c7b1625ea76f 100644 --- a/sdk/standbypool/Azure.ResourceManager.StandbyPool/tsp-location.yaml +++ b/sdk/standbypool/Azure.ResourceManager.StandbyPool/tsp-location.yaml @@ -1,3 +1,4 @@ -directory: specification\standbypool\StandbyPool.Management -commit: dc4c1eaef16e0bc8b1e96c3d1e014deb96259b35 +directory: specification/standbypool/StandbyPool.Management +commit: 0c929c78c4b7892c20cdfee10ddebb97cdf9d8a9 repo: Azure/azure-rest-api-specs +additionalDirectories: diff --git a/sdk/storage/ci.yml b/sdk/storage/ci.yml index 2ca0501b60bd..6d83bf7eebb6 100644 --- a/sdk/storage/ci.yml +++ b/sdk/storage/ci.yml @@ -9,9 +9,17 @@ trigger: paths: include: - sdk/storage/ + exclude: + - sdk/storage/Azure.ResourceManager.Storage/ - sdk/storage/Azure.Storage.DataMovement/ + exclude: + - sdk/storage/Azure.ResourceManager.Storage/ - sdk/storage/Azure.Storage.DataMovement.Blobs/ + exclude: + - sdk/storage/Azure.ResourceManager.Storage/ - 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/ diff --git a/sdk/workloadssapvirtualinstance/Azure.ResourceManager.WorkloadsSapVirtualInstance/tsp-location.yaml b/sdk/workloadssapvirtualinstance/Azure.ResourceManager.WorkloadsSapVirtualInstance/tsp-location.yaml index a53ddf3a0e7c..b16c487e5e8c 100644 --- a/sdk/workloadssapvirtualinstance/Azure.ResourceManager.WorkloadsSapVirtualInstance/tsp-location.yaml +++ b/sdk/workloadssapvirtualinstance/Azure.ResourceManager.WorkloadsSapVirtualInstance/tsp-location.yaml @@ -1,3 +1,4 @@ directory: specification/workloads/Workloads.SAPVirtualInstance.Management -commit: ada20fa9d6dcc6453f04f32d20fe3cf97293aa88 -repo: Azure/azure-rest-api-specs \ No newline at end of file +commit: 0c929c78c4b7892c20cdfee10ddebb97cdf9d8a9 +repo: Azure/azure-rest-api-specs +additionalDirectories: