Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
import "@azure-tools/typespec-azure-core";
import "@azure-tools/typespec-azure-resource-manager";
import "@typespec/http";
import "@typespec/rest";
import "./models.tsp";

using TypeSpec.Http;
using TypeSpec.Rest;
using Azure.ResourceManager;
using TypeSpec.Versioning;

namespace Microsoft.BillingBenefits;

/**
* A catalog group represents a BenefitResourceType + Namespace grouping used for benefit SKU discovery.
*/
model CatalogGroup
is Azure.ResourceManager.ProxyResource<CatalogGroupProperties> {
...ResourceNameParameter<
Resource = CatalogGroup,
KeyName = "catalogGroupName",
SegmentName = "catalogGroups",
NamePattern = "^[a-zA-Z0-9_\\-\\.]+$"
>;
}

/**
* Additional parameters for the CatalogGroups list operation.
*/
model CatalogGroupsListParameters {
/**
* OData filter expression to narrow the list of catalog groups.
*/
@query("$filter")
$filter?: string;
}

/**
* Reusable CatalogGroup extension operations for a specific target scope.
*/
interface CatalogGroupsExtensionOps<Scope extends Azure.ResourceManager.Foundations.SimpleResource> {
/**
* List catalog groups at the target scope.
*/
list is Extension.ListByTarget<
Scope,
CatalogGroup,
CatalogGroupsListParameters
>;

/**
* Get a specific catalog group at the target scope.
*/
get is Extension.Read<Scope, CatalogGroup>;
}

/**
* Subscription scope: /subscriptions/{subscriptionId}
*/
alias SubscriptionScope = Extension.Subscription;

/**
* Billing account scope: /providers/Microsoft.Billing/billingAccounts/{billingAccountName}
*/
alias BillingAccountScope = Extension.ExternalResource<
TargetNamespace = "Microsoft.Billing",
ResourceType = "billingAccounts",
ResourceParameterName = "billingAccountName",
NamePattern = "^[a-zA-Z0-9_\\-\\.:]+$",
Description = "The name of the billing account.",
ParentType = "Tenant"
>;

/**
* Billing profile scope: /providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}
*/
alias BillingProfileScope = Extension.ExternalChildResource<
BillingAccountScope,
"billingProfiles",
"billingProfileName",
NamePattern = "^[a-zA-Z0-9_\\-\\.]+$",
Description = "The name of the billing profile."
>;

@armResourceOperations
interface SubscriptionCatalogGroupsOps
extends CatalogGroupsExtensionOps<SubscriptionScope> {}

@armResourceOperations
interface BillingAccountCatalogGroupsOps
extends CatalogGroupsExtensionOps<BillingAccountScope> {}

@armResourceOperations
interface BillingProfileCatalogGroupsOps
extends CatalogGroupsExtensionOps<BillingProfileScope> {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import "@azure-tools/typespec-azure-core";
import "@azure-tools/typespec-azure-resource-manager";
import "@typespec/openapi";
import "@typespec/rest";
import "./models.tsp";
import "./ConditionalCredit.tsp";

using TypeSpec.Rest;
using Azure.ResourceManager;
using TypeSpec.Http;
using TypeSpec.OpenAPI;
using TypeSpec.Versioning;

namespace Microsoft.BillingBenefits;

/**
* Transaction resource definition for ConditionalCredits
*/
@parentResource(ConditionalCredit)
model ConditionalCreditTransaction
is Azure.ResourceManager.ProxyResource<TransactionProperties> {
...ResourceNameParameter<
Resource = ConditionalCreditTransaction,
KeyName = "transactionName",
SegmentName = "transactions",
NamePattern = "^[a-zA-Z0-9_\\-\\.]+$"
>;
}

@armResourceOperations
interface ConditionalCreditTransactions {
/**
* Get a specific transaction for a conditional credit.
*/
get is ArmResourceRead<ConditionalCreditTransaction>;

/**
* List all transactions for a conditional credit.
*/
listByParent is ArmResourceListByParent<
ConditionalCreditTransaction,
Response = ArmResponse<ConditionalCreditTransactionsList>
>;
}

@@doc(ConditionalCreditTransaction.name, "Name of the transaction");
@@doc(ConditionalCreditTransaction.properties, "Transaction properties");
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,20 @@ interface Credits {
| (ArmResponse<Credit> & ArmAsyncOperationHeader<FinalResult = Credit>)
| ArmAcceptedLroResponse<LroHeaders = ArmCombinedLroHeaders<FinalResult = Credit>>
>;

/**
* Change the sponsor of a credit.
*/
#suppress "@azure-tools/typespec-azure-resource-manager/arm-post-operation-response-codes" "LintDiff PostResponseCodes requires 204 for no-content LRO final response"
@Azure.Core.useFinalStateVia("location")
changeSponsor is ArmResourceActionAsyncBase<
Credit,
Request = ChangeSponsorRequest,
BaseParameters = Azure.ResourceManager.Foundations.DefaultBaseParameters<Credit>,
Response =
| ArmAcceptedLroResponse<LroHeaders = ArmCombinedLroHeaders>
| NoContentResponse
>;
}

@@doc(Credit.name, "Name of the credit");
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import "@azure-tools/typespec-azure-core";
import "@azure-tools/typespec-azure-resource-manager";
import "@typespec/openapi";
import "@typespec/rest";
import "./models.tsp";
import "./Credit.tsp";

using TypeSpec.Rest;
using Azure.ResourceManager;
using TypeSpec.Http;
using TypeSpec.OpenAPI;
using TypeSpec.Versioning;

namespace Microsoft.BillingBenefits;

/**
* Transaction resource definition for Credits
*/
@parentResource(Credit)
model CreditTransaction
is Azure.ResourceManager.ProxyResource<TransactionProperties> {
...ResourceNameParameter<
Resource = CreditTransaction,
KeyName = "transactionName",
SegmentName = "transactions",
NamePattern = "^[a-zA-Z0-9_\\-\\.]+$"
>;
}

@armResourceOperations
interface CreditTransactions {
/**
* Get a specific transaction for a credit.
*/
get is ArmResourceRead<CreditTransaction>;

/**
* List all transactions for a credit.
*/
listByParent is ArmResourceListByParent<
CreditTransaction,
Response = ArmResponse<TransactionsList>
>;
}

@@doc(CreditTransaction.name, "Name of the transaction");
@@doc(CreditTransaction.properties, "Transaction properties");
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import "@azure-tools/typespec-azure-core";
import "@azure-tools/typespec-azure-resource-manager";
import "@typespec/openapi";
import "@typespec/rest";
import "./models.tsp";
import "./Macc.tsp";

using TypeSpec.Rest;
using Azure.ResourceManager;
using TypeSpec.Http;
using TypeSpec.OpenAPI;
using TypeSpec.Versioning;

namespace Microsoft.BillingBenefits;

/**
* Transaction resource definition for Maccs
*/
@parentResource(Macc)
model MaccTransaction
is Azure.ResourceManager.ProxyResource<TransactionProperties> {
...ResourceNameParameter<
Resource = MaccTransaction,
KeyName = "transactionName",
SegmentName = "transactions",
NamePattern = "^[a-zA-Z0-9_\\-\\.]+$"
>;
}

@armResourceOperations
interface MaccTransactions {
/**
* Get a specific transaction for a MACC.
*/
get is ArmResourceRead<MaccTransaction>;

/**
* List all transactions for a MACC.
*/
listByParent is ArmResourceListByParent<
MaccTransaction,
Response = ArmResponse<MaccTransactionsList>
>;
}

@@doc(MaccTransaction.name, "Name of the transaction");
@@doc(MaccTransaction.properties, "Transaction properties");
Original file line number Diff line number Diff line change
Expand Up @@ -97,5 +97,5 @@ interface SavingsPlanModels {
{
parameters: ExpandParameter,
},
"!go,!javascript,!csharp"
"!go,!javascript"
);
Loading
Loading