Skip to content

Commit c087903

Browse files
authored
Update Azure.ResourceManager.Carbon project to use the new MPG (#54407)
* Update Azure.ResourceManager.Carbon project to use the new MPG * update * update * update * update
1 parent f2ff2f0 commit c087903

File tree

94 files changed

+4037
-2582
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

94 files changed

+4037
-2582
lines changed

doc/GeneratorMigration/Library_Inventory.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
- Total libraries: 397
1616
- Management Plane (MPG): 226
1717
- Autorest/Swagger: 158
18-
- New Emitter (TypeSpec): 30
19-
- Old TypeSpec: 38
18+
- New Emitter (TypeSpec): 31
19+
- Old TypeSpec: 37
2020
- Data Plane (DPG): 171
2121
- Autorest/Swagger: 86
2222
- New Emitter (TypeSpec): 19
@@ -168,15 +168,15 @@ Libraries that have not yet been migrated to the new TypeSpec emitter. Total: 86
168168

169169
Libraries that provide resource management APIs for Azure services and have been migrated to the new TypeSpec emitter.
170170

171-
**Migration Status**: 30 / 68 (44.1%)
171+
**Migration Status**: 31 / 68 (45.6%)
172172

173173
| Service | Library | New Emitter |
174174
| ------- | ------- | ----------- |
175175
| agricultureplatform | Azure.ResourceManager.AgriculturePlatform ||
176176
| arizeaiobservabilityeval | Azure.ResourceManager.ArizeAIObservabilityEval ||
177177
| avs | Azure.ResourceManager.Avs | |
178178
| azurestackhci | Azure.ResourceManager.Hci.Vm | |
179-
| carbon | Azure.ResourceManager.CarbonOptimization | |
179+
| carbon | Azure.ResourceManager.CarbonOptimization | |
180180
| chaos | Azure.ResourceManager.Chaos | |
181181
| cloudhealth | Azure.ResourceManager.CloudHealth ||
182182
| computefleet | Azure.ResourceManager.ComputeFleet | |

sdk/carbon/Azure.ResourceManager.CarbonOptimization/api/Azure.ResourceManager.CarbonOptimization.net10.0.cs

Lines changed: 513 additions & 0 deletions
Large diffs are not rendered by default.

sdk/carbon/Azure.ResourceManager.CarbonOptimization/api/Azure.ResourceManager.CarbonOptimization.net8.0.cs

Lines changed: 72 additions & 0 deletions
Large diffs are not rendered by default.

sdk/carbon/Azure.ResourceManager.CarbonOptimization/api/Azure.ResourceManager.CarbonOptimization.netstandard2.0.cs

Lines changed: 72 additions & 0 deletions
Large diffs are not rendered by default.

sdk/carbon/Azure.ResourceManager.CarbonOptimization/src/Azure.ResourceManager.CarbonOptimization.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,5 @@
77
<Description>Azure Resource Manager client SDK for Azure resource provider CarbonOptimization.</Description>
88
<PackageTags>azure;management;arm;resource manager;carbonoptimization</PackageTags>
99
<TargetFrameworks>$(RequiredTargetFrameworks)</TargetFrameworks>
10-
<IncludeAutorestDependency>true</IncludeAutorestDependency>
1110
</PropertyGroup>
1211
</Project>

sdk/carbon/Azure.ResourceManager.CarbonOptimization/src/Custom/Extensions/CarbonOptimizationExtensions.cs

Lines changed: 0 additions & 82 deletions
This file was deleted.

sdk/carbon/Azure.ResourceManager.CarbonOptimization/src/Custom/Extensions/MockableCarbonOptimizationTenantResource.cs

Lines changed: 0 additions & 91 deletions
This file was deleted.
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the MIT License.
3+
4+
#nullable disable
5+
6+
namespace Azure.ResourceManager.CarbonOptimization.Models
7+
{
8+
/// <summary>
9+
/// The basic response for different query report, all query report result will have these information
10+
/// Please note <see cref="CarbonEmission"/> 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.
11+
/// The available derived classes include <see cref="CarbonEmissionItemDetail"/>, <see cref="CarbonEmissionMonthlySummary"/>, <see cref="CarbonEmissionOverallSummary"/>, <see cref="ResourceGroupCarbonEmissionItemDetail"/>, <see cref="ResourceGroupCarbonEmissionTopItemMonthlySummary"/>, <see cref="ResourceGroupCarbonEmissionTopItemsSummary"/>, <see cref="ResourceCarbonEmissionItemDetail"/>, <see cref="ResourceCarbonEmissionTopItemMonthlySummary"/>, <see cref="ResourceCarbonEmissionTopItemsSummary"/>, <see cref="CarbonEmissionTopItemMonthlySummary"/> and <see cref="CarbonEmissionTopItemsSummary"/>.
12+
/// </summary>
13+
public abstract partial class CarbonEmission
14+
{
15+
/// <summary> Initializes a new instance of <see cref="CarbonEmission"/>. </summary>
16+
/// <param name="latestMonthEmissions"> 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). </param>
17+
/// <param name="previousMonthEmissions"> 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. </param>
18+
protected CarbonEmission(double latestMonthEmissions, double previousMonthEmissions)
19+
{
20+
LatestMonthEmissions = latestMonthEmissions;
21+
PreviousMonthEmissions = previousMonthEmissions;
22+
}
23+
}
24+
}

sdk/carbon/Azure.ResourceManager.CarbonOptimization/src/Custom/Models/CarbonEmissionListResult.cs

Lines changed: 0 additions & 16 deletions
This file was deleted.
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the MIT License.
3+
4+
#nullable disable
5+
6+
using System;
7+
using System.Collections.Generic;
8+
using System.Linq;
9+
using Azure.Core;
10+
11+
namespace Azure.ResourceManager.CarbonOptimization.Models
12+
{
13+
/// <summary>
14+
/// Shared query filter parameter to configure carbon emissions data queries for all different report type defined in ReportTypeEnum.
15+
/// Please note <see cref="CarbonEmissionQueryFilter"/> 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.
16+
/// The available derived classes include <see cref="ItemDetailsQueryFilter"/>, <see cref="MonthlySummaryReportQueryFilter"/>, <see cref="OverallSummaryReportQueryFilter"/>, <see cref="TopItemsMonthlySummaryReportQueryFilter"/> and <see cref="TopItemsSummaryReportQueryFilter"/>.
17+
/// </summary>
18+
public abstract partial class CarbonEmissionQueryFilter
19+
{
20+
/// <summary> Initializes a new instance of <see cref="CarbonEmissionQueryFilter"/>. </summary>
21+
/// <param name="dateRange"> 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). </param>
22+
/// <param name="subscriptionList"> 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. </param>
23+
/// <param name="carbonScopeList"> 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. </param>
24+
/// <exception cref="ArgumentNullException"> <paramref name="dateRange"/>, <paramref name="subscriptionList"/> or <paramref name="carbonScopeList"/> is null. </exception>
25+
protected CarbonEmissionQueryFilter(CarbonEmissionQueryDateRange dateRange, IEnumerable<string> subscriptionList, IEnumerable<CarbonEmissionScope> carbonScopeList)
26+
{
27+
Argument.AssertNotNull(dateRange, nameof(dateRange));
28+
Argument.AssertNotNull(subscriptionList, nameof(subscriptionList));
29+
Argument.AssertNotNull(carbonScopeList, nameof(carbonScopeList));
30+
31+
DateRange = dateRange;
32+
SubscriptionList = subscriptionList.ToList();
33+
ResourceGroupUrlList = new ChangeTrackingList<string>();
34+
ResourceTypeList = new ChangeTrackingList<ResourceType>();
35+
LocationList = new ChangeTrackingList<AzureLocation>();
36+
CarbonScopeList = carbonScopeList.ToList();
37+
}
38+
}
39+
}

0 commit comments

Comments
 (0)