Skip to content

Commit 697e19f

Browse files
Add MACC Milestone APIs
1 parent ea4fbe5 commit 697e19f

File tree

136 files changed

+16085
-1
lines changed

Some content is hidden

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

136 files changed

+16085
-1
lines changed
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
import "@azure-tools/typespec-azure-core";
2+
import "@azure-tools/typespec-azure-resource-manager";
3+
import "@typespec/openapi";
4+
import "@typespec/rest";
5+
import "@typespec/versioning";
6+
import "./models.tsp";
7+
import "./Macc.tsp";
8+
9+
using TypeSpec.Rest;
10+
using Azure.ResourceManager;
11+
using TypeSpec.Http;
12+
using TypeSpec.OpenAPI;
13+
using TypeSpec.Versioning;
14+
15+
namespace Microsoft.BillingBenefits;
16+
/**
17+
* MACC contributor
18+
*/
19+
@added(Versions.v2025_05_01_preview)
20+
@parentResource(Macc)
21+
model Contributor is Azure.ResourceManager.ProxyResource<MaccModelProperties> {
22+
...ResourceNameParameter<
23+
Resource = Contributor,
24+
KeyName = "contributorName",
25+
SegmentName = "contributors",
26+
NamePattern = "^[a-zA-Z0-9_\\-\\.]+$"
27+
>;
28+
}
29+
30+
@added(Versions.v2025_05_01_preview)
31+
@armResourceOperations
32+
interface Contributors {
33+
/**
34+
* Get a contributor for primary service admin
35+
*/
36+
getFromPrimary is ArmResourceRead<Contributor>;
37+
38+
/**
39+
* List contributors under a MACC for primary service admin
40+
*/
41+
listFromPrimary is ArmResourceListByParent<
42+
Contributor,
43+
Response = ArmResponse<ContributorList>
44+
>;
45+
}
46+
47+
@@doc(Contributor.name,
48+
"Unique name of contributor in the format {contributorCloudSubId}_{resourceGroupName}_{nameInContributorTenant}."
49+
);
50+
@@doc(Contributor.properties, "MACC contributor properties");
Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
import "@azure-tools/typespec-azure-core";
2+
import "@azure-tools/typespec-azure-resource-manager";
3+
import "@typespec/openapi";
4+
import "@typespec/rest";
5+
import "@typespec/versioning";
6+
import "./models.tsp";
7+
8+
using TypeSpec.Rest;
9+
using Azure.ResourceManager;
10+
using TypeSpec.Http;
11+
using TypeSpec.OpenAPI;
12+
using TypeSpec.Versioning;
13+
14+
namespace Microsoft.BillingBenefits;
15+
/**
16+
* Microsoft Azure Consumption Commitment.
17+
*/
18+
@added(Versions.v2025_05_01_preview)
19+
model Macc is Azure.ResourceManager.TrackedResource<MaccModelProperties> {
20+
...ResourceNameParameter<
21+
Resource = Macc,
22+
KeyName = "maccName",
23+
SegmentName = "maccs",
24+
NamePattern = "^[a-zA-Z0-9_\\-\\.]+$"
25+
>;
26+
}
27+
28+
@added(Versions.v2025_05_01_preview)
29+
@armResourceOperations
30+
interface Maccs {
31+
/**
32+
* Get a MACC.
33+
*/
34+
get is ArmResourceRead<Macc>;
35+
36+
/**
37+
* Create MACC.
38+
*/
39+
create is ArmResourceCreateOrReplaceAsync<Macc>;
40+
41+
/**
42+
* Update MACC.
43+
*/
44+
@patch(#{ implicitOptionality: false })
45+
update is ArmCustomPatchAsync<
46+
Macc,
47+
PatchModel = MaccPatchRequest,
48+
LroHeaders = ArmAsyncOperationHeader &
49+
Azure.Core.Foundations.RetryAfterHeader &
50+
ArmLroLocationHeader
51+
>;
52+
53+
/**
54+
* Delete MACC.
55+
*/
56+
delete is ArmResourceDeleteWithoutOkAsync<
57+
Macc,
58+
LroHeaders = ArmAsyncOperationHeader &
59+
Azure.Core.Foundations.RetryAfterHeader &
60+
ArmLroLocationHeader
61+
>;
62+
63+
/**
64+
* List MACCs under a resource group for primary service admin.
65+
*/
66+
listByResourceGroup is ArmResourceListByParent<
67+
Macc,
68+
Response = ArmResponse<MaccList>
69+
>;
70+
71+
/**
72+
* List MACCs under a subscription from primary service tenant.
73+
*/
74+
listBySubscription is ArmListBySubscription<
75+
Macc,
76+
Response = ArmResponse<MaccList>
77+
>;
78+
79+
/**
80+
* Represents an operation to cancel MACC contract. This operation does not indicate deletion of the MACC, but rather stops applying the benefit to the account.
81+
*/
82+
cancel is ArmResourceActionAsync<
83+
Macc,
84+
void,
85+
ArmResponse<Macc>,
86+
LroHeaders = ArmAsyncOperationHeader &
87+
Azure.Core.Foundations.RetryAfterHeader &
88+
ArmLroLocationHeader
89+
>;
90+
91+
/**
92+
* Operation to waive a customer's pending MACC balance (Shortfall) from their account, ensuring they are not charged for the outstanding amount.
93+
*/
94+
writeOff is ArmResourceActionAsync<
95+
Macc,
96+
void,
97+
ArmResponse<Macc>,
98+
LroHeaders = ArmAsyncOperationHeader &
99+
Azure.Core.Foundations.RetryAfterHeader &
100+
ArmLroLocationHeader
101+
>;
102+
103+
/**
104+
* Operation to charge shortfall to a customer's account, ensuring they are charged for the outstanding amount of MACC credit.
105+
*/
106+
chargeShortfall is ArmResourceActionAsync<
107+
Macc,
108+
ChargeShortfallRequest,
109+
ArmResponse<Macc>,
110+
LroHeaders = ArmAsyncOperationHeader &
111+
Azure.Core.Foundations.RetryAfterHeader &
112+
ArmLroLocationHeader
113+
>;
114+
}
115+
116+
@@doc(Macc.name, "Name of primary MACC.");
117+
@@doc(Macc.properties, "MACC properties");
118+
@@doc(Maccs.create::parameters.resource, "Request body for creating MACC.");
119+
@@doc(Maccs.update::parameters.properties, "Request body for updating MACC.");
120+
@@doc(Maccs.chargeShortfall::parameters.body,
121+
"Request body for charging shortfall."
122+
);

specification/billingbenefits/BillingBenefits.Management/back-compatible.tsp

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@ using Microsoft.BillingBenefits;
2323
@@clientLocation(SavingsPlanOrderModels.elevate, "SavingsPlanOrder");
2424
@@clientLocation(Discounts.get, "Discount");
2525
@@clientLocation(Discounts.update, "Discount");
26+
@@clientLocation(MaccsOperationGroup.list, "ApplicableMaccs");
27+
@@clientLocation(ContributorsOperationGroup.listFromApplicableMacc,
28+
Contributors
29+
);
30+
@@clientLocation(SellerResourceOperationGroup.list, "SellerResource");
2631

2732
#suppress "@azure-tools/typespec-azure-core/no-legacy-usage" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
2833
@@Azure.ClientGenerator.Core.Legacy.flattenProperty(RoleAssignmentEntity.properties
@@ -53,6 +58,20 @@ using Microsoft.BillingBenefits;
5358
@@Azure.ClientGenerator.Core.Legacy.flattenProperty(SavingsPlanModel.properties
5459
);
5560

61+
#suppress "@azure-tools/typespec-azure-core/no-legacy-usage" "For backward compatibility"
62+
@@Azure.ClientGenerator.Core.Legacy.flattenProperty(MaccPatchRequest.properties
63+
);
64+
65+
#suppress "@azure-tools/typespec-azure-core/no-legacy-usage" "For backward compatibility"
66+
@@Azure.ClientGenerator.Core.Legacy.flattenProperty(ChargeShortfallRequest.properties
67+
);
68+
69+
#suppress "@azure-tools/typespec-azure-core/no-legacy-usage" "For backward compatibility"
70+
@@Azure.ClientGenerator.Core.Legacy.flattenProperty(SellerResourceListRequest.properties
71+
);
72+
73+
@@clientName(SellerResourceListRequestProperties.$filter, "filter");
74+
5675
@@clientName(ReservationOrderAliasResponses.create::parameters.resource,
5776
"body"
5877
);
@@ -62,3 +81,6 @@ using Microsoft.BillingBenefits;
6281

6382
@@clientName(Discounts.create::parameters.resource, "body");
6483
@@clientName(Discounts.update::parameters.properties, "body");
84+
85+
@@clientName(Maccs.create::parameters.resource, "body");
86+
@@clientName(Maccs.update::parameters.properties, "body");
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
{
2+
"parameters": {
3+
"api-version": "2025-05-01-preview",
4+
"scope": "providers/Microsoft.Billing/billingAccounts/20000000-1000-0000-0000-000000000000:20000000-0000-3000-0000-000000000000_2019-05-31"
5+
},
6+
"responses": {
7+
"200": {
8+
"body": {
9+
"value": [
10+
{
11+
"name": "13810867107109237",
12+
"type": "Microsoft.BillingBenefits/applicableMaccs",
13+
"id": "/providers/Microsoft.Billing/billingAccounts/{acctId:orgId}/providers/Microsoft.BillingBenefits/applicableMaccs/13810867107109237",
14+
"properties": {
15+
"allowContributors": true,
16+
"automaticShortfall": "Enabled",
17+
"billingAccountResourceId": "/providers/Microsoft.Billing/billingAccounts/{acctId:orgId}",
18+
"commitment": {
19+
"amount": 20000,
20+
"currencyCode": "USD",
21+
"grain": "FullTerm"
22+
},
23+
"displayName": "macc 20230614",
24+
"endAt": "2024-07-01T00:00:00Z",
25+
"entityType": "Primary",
26+
"productCode": "0001d726-0000-0160-330f-a0b98cdbbdc4",
27+
"provisioningState": "Succeeded",
28+
"startAt": "2023-07-01T00:00:00Z",
29+
"status": "Active",
30+
"systemId": "13810867107109237"
31+
}
32+
}
33+
]
34+
}
35+
}
36+
},
37+
"operationId": "ApplicableMaccs_List",
38+
"title": "DiscountScopeList"
39+
}
Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
{
2+
"parameters": {
3+
"api-version": "2025-05-01-preview",
4+
"body": {
5+
"location": "global",
6+
"properties": {
7+
"endAt": "2024-07-01T00:00:00Z",
8+
"entityType": "Contributor",
9+
"primaryResourceId": "/subscriptions/10000000-0000-0000-0000-000000000000/resourceGroups/resource_group_name_02/providers/Microsoft.BillingBenefits/maccs/macc_20230614",
10+
"productCode": "0001d726-0000-0160-330f-a0b98cdbbdc4",
11+
"startAt": "2023-07-01T00:00:00Z",
12+
"systemId": "13810867107109237"
13+
},
14+
"tags": {
15+
"key1": "value1",
16+
"key2": "value2"
17+
}
18+
},
19+
"maccName": "macc_contributor_20230614",
20+
"resourceGroupName": "resource_group_name_01",
21+
"subscriptionId": "20000000-0000-0000-0000-000000000000"
22+
},
23+
"responses": {
24+
"200": {
25+
"body": {
26+
"name": "macc_contributor_20230614",
27+
"type": "Microsoft.BillingBenefits/maccs",
28+
"id": "/subscriptions/20000000-0000-0000-0000-000000000000/resourceGroups/resource_group_name_02/providers/Microsoft.BillingBenefits/maccs/macc_contributor_20230614",
29+
"location": "global",
30+
"properties": {
31+
"automaticShortfall": "Enabled",
32+
"displayName": "macc contributor 20230614",
33+
"endAt": "2024-07-01T00:00:00Z",
34+
"entityType": "Contributor",
35+
"primaryResourceId": "/subscriptions/10000000-0000-0000-0000-000000000000/resourceGroups/resource_group_name_02/providers/Microsoft.BillingBenefits/maccs/macc_20230614",
36+
"productCode": "0001d726-0000-0160-330f-a0b98cdbbdc4",
37+
"provisioningState": "Succeeded",
38+
"startAt": "2023-07-01T00:00:00Z",
39+
"status": "Scheduled",
40+
"systemId": "13810867107109237"
41+
},
42+
"systemData": {
43+
"createdAt": "2023-02-01T01:01:01.1075056Z",
44+
"createdByType": "User",
45+
"lastModifiedAt": "2023-02-01T01:01:01.1075056Z",
46+
"lastModifiedByType": "User"
47+
},
48+
"tags": {
49+
"key1": "value1",
50+
"key2": "value2"
51+
}
52+
}
53+
},
54+
"201": {
55+
"body": {
56+
"name": "macc_contributor_20230614",
57+
"type": "Microsoft.BillingBenefits/maccs",
58+
"id": "/subscriptions/20000000-0000-0000-0000-000000000000/resourceGroups/resource_group_name_02/providers/Microsoft.BillingBenefits/maccs/macc_contributor_20230614",
59+
"location": "global",
60+
"properties": {
61+
"automaticShortfall": "Enabled",
62+
"billingAccountResourceId": "/providers/Microsoft.Billing/billingAccounts/{acctId:orgId}",
63+
"displayName": "macc contributor 20230614",
64+
"endAt": "2024-07-01T00:00:00Z",
65+
"entityType": "Contributor",
66+
"primaryBillingAccountResourceId": "/providers/Microsoft.Billing/billingAccounts/{acctId:orgId}",
67+
"primaryResourceId": "/subscriptions/10000000-0000-0000-0000-000000000000/resourceGroups/resource_group_name_02/providers/Microsoft.BillingBenefits/maccs/macc_20230614",
68+
"productCode": "0001d726-0000-0160-330f-a0b98cdbbdc4",
69+
"provisioningState": "Pending",
70+
"startAt": "2023-07-01T00:00:00Z",
71+
"status": "Scheduled",
72+
"systemId": "13810867107109237"
73+
},
74+
"systemData": {
75+
"createdAt": "2023-02-01T01:01:01.1075056Z",
76+
"createdByType": "User",
77+
"lastModifiedAt": "2023-02-01T01:01:01.1075056Z",
78+
"lastModifiedByType": "User"
79+
},
80+
"tags": {
81+
"key1": "value1",
82+
"key2": "value2"
83+
}
84+
},
85+
"headers": {
86+
"Azure-AsyncOperation": "https://management.azure.com/subscriptions/20000000-0000-0000-0000-000000000000/resourceGroups/resource_group_name_02/providers/Microsoft.BillingBenefits/operationResults/4e2ffff7-b331-4fcb-ab11-b5fa49368188?api-version=2023-11-01-preview",
87+
"Location": "https://management.azure.com/subscriptions/20000000-0000-0000-0000-000000000000/resourceGroups/resource_group_name_02/providers/Microsoft.BillingBenefits/operationResults/4e2ffff7-b331-4fcb-ab11-b5fa49368188?api-version=2023-11-01-preview",
88+
"Retry-After": 5
89+
}
90+
}
91+
},
92+
"operationId": "Maccs_Create",
93+
"title": "Contributor_Create"
94+
}

0 commit comments

Comments
 (0)