diff --git a/eng/scripts/Update-Mgmt-CI.ps1 b/eng/scripts/Update-Mgmt-CI.ps1 deleted file mode 100644 index 94649e3fb529..000000000000 --- a/eng/scripts/Update-Mgmt-CI.ps1 +++ /dev/null @@ -1,100 +0,0 @@ -. (Join-Path $PSScriptRoot automation GenerateAndBuildLib.ps1) - -$packagesPath = "$PSScriptRoot/../../sdk" - -$track2MgmtDirs = Get-ChildItem -Path "$packagesPath" -Directory -Recurse -Depth 1 | Where-Object { $_.Name -match "(Azure.ResourceManager.)" -and $(Test-Path("$($_.FullName)/src")) } -$newLine = [Environment]::NewLine -function Update-CIFile() { - param( - [string]$mgmtCiFile = "" - ) - - $shouldRemove = $false - - $content = Get-Content $mgmtCiFile -Raw - - if ($content -match "(?s)ServiceDirectory:\s*(?[^$newLine]+).*-\s*name:\s*(?

[^$newLine]+)") - { - $serviceDirectory = $matches["sd"] - $packageName = $matches["p"] - } - else { - Write-Error "Could not parse out the service directory and package from $mgmtCiFile, so skipping." - return - } - - $relServiceDir = "sdk/$serviceDirectory" - $relPackageDir = "$relServiceDir/$packageName/" - $prtriggers = @" -pr: - branches: - include: - - main - - feature/* - - hotfix/* - - release/* - paths: - include: - - $relServiceDir/ci.mgmt.yml - - $relPackageDir -"@ - - $content = $content -replace "(?s)pr:[^$newLine]*($newLine([ ]+[^$newLine]*|))*", "$prtriggers$newLine$newLine" - $content = $content -replace "(?s)trigger:[^$newLine]*($newLine([ ]+[^$newLine]*|))*", "trigger: none$newLine" - - if ($content -notmatch "LimitForPullRequest: true") - { - $content = $content -replace "(.*)Artifacts:", "`$1LimitForPullRequest: true$newLine`$1Artifacts:" - } - - Set-Content -Path $mgmtCiFile $content -NoNewline - - - $ciFile = $mgmtCiFile.Replace("ci.mgmt", "ci") - - if (Test-Path $ciFile) - { - $ciContent = Get-Content $ciFile -Raw - - $ciContent = $ciContent -replace "(?s)(paths:$newLine(\s+)include:$newLine(?:\s+-[^$newLine]*$newLine)*(?:\s+-\s+$relServiceDir/?$newLine)(?:\s+-[^$newLine]*$newLine)*)(?!\s+exclude:)", "`$1`$2exclude:$newLine`$2- $relPackageDir$newLine" - - Set-Content -Path $ciFile $ciContent -NoNewline - } -} - -#update all Azure.ResourceManager libraries to use the new pattern for ci -Write-Host "Update mgmt sub clients ci.mgmt.yml" -foreach($mgmtDir in $track2MgmtDirs) { - $curDirectory = $mgmtDir.FullName - $mgmtCiFile = "$curDirectory/../ci.mgmt.yml" - $ciFile = "$curDirectory/../ci.yml" - $serviceDirectory = "$mgmtDir/.." - - if(Test-Path $mgmtCiFile) { - Update-CIFile -mgmtCiFile $mgmtCiFile - } - else { - #may have added ci.yml instead - if(Test-Path $ciFile) { - Copy-Item $ciFile $mgmtCiFile - Update-CIFile -mgmtCiFile $mgmtCiFile - } - } - - if(Test-Path $ciFile) { - #check for orphaned ci.yml files - #if this service directory only has mgmt plane ci.yml should not be there - $mgmtDirCount = (Get-ChildItem -Path "$serviceDirectory" -Directory | Where-Object { $_.Name -match "(Azure.ResourceManager.)" }).Length - $totalDirCount = (Get-ChildItem -Path "$serviceDirectory" -Directory).Length - - if($mgmtDirCount -eq $totalDirCount) { - Write-Host "Removing $ciFile" - Remove-Item $ciFile - } - } -} - -Write-Host "Updating mgmt core client ci.mgmt.yml" -#add path for each mgmt library into Azure.ResourceManager -RegisterMgmtSDKToMgmtCoreClient -packagesPath $packagesPath - diff --git a/eng/scripts/automation/GenerateAndBuildLib.ps1 b/eng/scripts/automation/GenerateAndBuildLib.ps1 index 1f726325dc57..0aeb751f5140 100644 --- a/eng/scripts/automation/GenerateAndBuildLib.ps1 +++ b/eng/scripts/automation/GenerateAndBuildLib.ps1 @@ -720,10 +720,6 @@ function GeneratePackage() } if ($isGenerateSuccess) { - # update resourcemanager ci.mgmt.yml for mgmt sdk - if ($serviceType -eq "resource-manager") { - & $sdkRootPath/eng/scripts/Update-Mgmt-CI.ps1 - } # Build project when successfully generated the code Write-Host "Start to build sdk project: $srcPath" dotnet build $srcPath /p:RunApiCompat=$false 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..3bcf944e08d6 --- /dev/null +++ b/sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization/tsp-location.yaml @@ -0,0 +1,4 @@ +directory: specification/carbon/Carbon.Management +commit: 3ac3ddc19fe14ac6f7ac9614d66ff8faf1099b9b +repo: Azure/azure-rest-api-specs +additionalDirectories: diff --git a/sdk/carbonoptimization/ci.yml b/sdk/carbonoptimization/ci.yml new file mode 100644 index 000000000000..08dd556922ed --- /dev/null +++ b/sdk/carbonoptimization/ci.yml @@ -0,0 +1,35 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. + +trigger: + branches: + include: + - main + - hotfix/* + - release/* + paths: + include: + - sdk/carbonoptimization + - sdk/carbonoptimization/ci.yml + - sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/carbonoptimization + - sdk/carbonoptimization/ci.yml + - sdk/carbonoptimization/Azure.ResourceManager.CarbonOptimization + +extends: + template: /eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: carbonoptimization + ArtifactName: packages + Artifacts: + - name: Azure.ResourceManager.CarbonOptimization + safeName: AzureResourceManagerCarbonOptimization