Skip to content
Merged
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
  •  
  •  
  •  
4 changes: 4 additions & 0 deletions specification/billing/cspell.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,8 @@ overrides:
- cnpj
- mosp
- resellee
- filename: '**/specification/billing/**/*.tsp'
words:
- cnpj
- resellee

Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
import "@azure-tools/typespec-azure-core";
import "@azure-tools/typespec-azure-resource-manager";
import "@typespec/openapi";
import "@typespec/rest";
import "./models.tsp";
import "./BillingAccount.tsp";

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

namespace Microsoft.Billing;
/**
* An agreement.
*/
@tenantResource
@parentResource(BillingAccount)
model Agreement is Azure.ResourceManager.ProxyResource<AgreementProperties> {
...ResourceNameParameter<
Resource = Agreement,
KeyName = "agreementName",
SegmentName = "agreements",
NamePattern = "^[a-fA-F0-9]{1,12}$"
>;

/**
* Dictionary of metadata associated with the resource. It may not be populated for all resource types. Maximum key/value length supported of 256 characters. Keys/value should not empty value nor null. Keys can not contain < > % & \ ? /
*/
#suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-invalid-envelope-property" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
#suppress "@azure-tools/typespec-azure-resource-manager/arm-no-record" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
tags?: Record<string>;
}

@armResourceOperations(#{ omitTags: true })
interface Agreements {
/**
* Gets an agreement by ID.
*/
#suppress "@azure-tools/typespec-azure-core/no-openapi" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
@externalDocs("https://docs.microsoft.com/en-us/rest/api/billing/")
@tag("Agreement")
get is ArmResourceRead<
Agreement,
BaseParameters = Azure.ResourceManager.Foundations.TenantBaseParameters
>;

/**
* Lists the agreements for a billing account.
*/
#suppress "@azure-tools/typespec-azure-core/no-openapi" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
@externalDocs("https://docs.microsoft.com/en-us/rest/api/billing/")
@tag("Agreement")
listByBillingAccount is ArmResourceListByParent<
Agreement,
BaseParameters = Azure.ResourceManager.Foundations.TenantBaseParameters,
Parameters = {
/**
* May be used to expand the participants.
*/
@query("expand")
expand?: string;
},
Response = ArmResponse<AgreementListResult>
>;
}

@@doc(Agreement.name, "The ID that uniquely identifies an agreement.");
@@doc(Agreement.properties, "An agreement.");
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
import "@azure-tools/typespec-azure-core";
import "@azure-tools/typespec-azure-resource-manager";
import "@typespec/openapi";
import "@typespec/rest";
import "./models.tsp";
import "./BillingAccount.tsp";

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

namespace Microsoft.Billing;
/**
* An associated tenant.
*/
@tenantResource
@parentResource(BillingAccount)
model AssociatedTenant
is Azure.ResourceManager.ProxyResource<AssociatedTenantProperties> {
...ResourceNameParameter<
Resource = AssociatedTenant,
KeyName = "associatedTenantName",
SegmentName = "associatedTenants",
NamePattern = "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$"
>;

/**
* Dictionary of metadata associated with the resource. It may not be populated for all resource types. Maximum key/value length supported of 256 characters. Keys/value should not empty value nor null. Keys can not contain < > % & \ ? /
*/
#suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-invalid-envelope-property" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
#suppress "@azure-tools/typespec-azure-resource-manager/arm-no-record" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
tags?: Record<string>;
}

@armResourceOperations(#{ omitTags: true })
interface AssociatedTenants {
/**
* Gets an associated tenant by ID.
*/
#suppress "@azure-tools/typespec-azure-core/no-openapi" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
@externalDocs("https://docs.microsoft.com/en-us/rest/api/billing/")
@tag("AssociatedTenant")
get is ArmResourceRead<
AssociatedTenant,
BaseParameters = Azure.ResourceManager.Foundations.TenantBaseParameters
>;

/**
* Create or update an associated tenant for the billing account.
*/
#suppress "@azure-tools/typespec-azure-core/no-openapi" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
@externalDocs("https://docs.microsoft.com/en-us/rest/api/billing/")
@tag("AssociatedTenant")
createOrUpdate is ArmResourceCreateOrReplaceAsync<
AssociatedTenant,
BaseParameters = Azure.ResourceManager.Foundations.TenantBaseParameters,
LroHeaders = ArmLroLocationHeader<FinalResult = AssociatedTenant> &
Azure.Core.Foundations.RetryAfterHeader
>;

/**
* Deletes an associated tenant for a billing account.
*/
#suppress "@azure-tools/typespec-azure-core/no-openapi" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
@externalDocs("https://docs.microsoft.com/en-us/rest/api/billing/")
@tag("AssociatedTenant")
delete is ArmResourceDeleteWithoutOkAsync<
AssociatedTenant,
BaseParameters = Azure.ResourceManager.Foundations.TenantBaseParameters
>;

/**
* Lists the associated tenants that can collaborate with the billing account on commerce activities like viewing and downloading invoices, managing payments, making purchases, and managing or provisioning licenses.
*/
#suppress "@azure-tools/typespec-azure-core/no-openapi" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
@externalDocs("https://docs.microsoft.com/en-us/rest/api/billing/")
@tag("AssociatedTenant")
listByBillingAccount is ArmResourceListByParent<
AssociatedTenant,
BaseParameters = Azure.ResourceManager.Foundations.TenantBaseParameters,
Parameters = AssociatedTenantsListByBillingAccountParameters,
Response = ArmResponse<AssociatedTenantListResult>
>;
}

alias AssociatedTenantsListByBillingAccountParameters = {
/**
* Can be used to get revoked associated tenants.
*/
@query("includeRevoked")
includeRevoked?: boolean = false;

/**
* The filter query option allows clients to filter a collection of resources that are addressed by a request URL.
*/
@query("filter")
filter?: string;

/**
* The orderby query option allows clients to request resources in a particular order.
*/
@query("orderBy")
orderBy?: string;

/**
* The top query option requests the number of items in the queried collection to be included in the result. The maximum supported value for top is 50.
*/
@query("top")
top?: int64;

/**
* The skip query option requests the number of items in the queried collection that are to be skipped and not included in the result.
*/
@query("skip")
skip?: int64;

/**
* The count query option allows clients to request a count of the matching resources included with the resources in the response.
*/
@query("count")
count?: boolean;

/**
* The search query option allows clients to request items within a collection matching a free-text search expression. search is only supported for string fields.
*/
@query("search")
search?: string;
};

@@doc(AssociatedTenant.name, "The ID that uniquely identifies a tenant.");
@@doc(AssociatedTenant.properties, "An associated tenant.");
@@doc(AssociatedTenants.createOrUpdate::parameters.resource,
"An associated tenant."
);
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
import "@azure-tools/typespec-azure-core";
import "@azure-tools/typespec-azure-resource-manager";
import "@typespec/openapi";
import "@typespec/rest";
import "./models.tsp";
import "./BillingAccount.tsp";

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

namespace Microsoft.Billing;
/**
* The Available Credit or Payment on Account Balance. The credit balance can be used to settle due or past due invoices.
*/
@singleton("default")
@tenantResource
@parentResource(BillingAccount)
model AvailableBalance
is Azure.ResourceManager.ProxyResource<AvailableBalanceProperties> {
...ResourceNameParameter<
Resource = AvailableBalance,
KeyName = "availableBalance",
SegmentName = "availableBalance",
NamePattern = ""
>;

/**
* Dictionary of metadata associated with the resource. It may not be populated for all resource types. Maximum key/value length supported of 256 characters. Keys/value should not empty value nor null. Keys can not contain < > % & \ ? /
*/
#suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-invalid-envelope-property" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
#suppress "@azure-tools/typespec-azure-resource-manager/arm-no-record" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
tags?: Record<string>;
}

alias AvailableBalanceOps = Azure.ResourceManager.Legacy.ExtensionOperations<
{
...ApiVersionParameter;

/** the provider namespace */
@path
@segment("providers")
@key
providerNamespace: "Microsoft.Billing";

/** The ID that uniquely identifies a billing account. */
@path
@segment("billingAccounts")
@key
@pattern("^([0-9]+|([Pp][Cc][Nn]\\.[A-Za-z0-9]+)|[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}(:[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}_[0-9]{4}(-[0-9]{2}){2})?)$")
billingAccountName: string;
},
{},
{
/** undefined */
@path
@segment("availableBalance")
@key
default: "default";
}
>;

@armResourceOperations(#{ omitTags: true })
interface AvailableBalances {
/**
* The Available Credit or Payment on Account Balance for a billing account. The credit balance can be used to settle due or past due invoices and is supported for billing accounts with agreement type Microsoft Customer Agreement. The payment on account balance is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Online Services Program.
*/
#suppress "@azure-tools/typespec-azure-core/no-openapi" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
@externalDocs("https://docs.microsoft.com/en-us/rest/api/billing/")
@tag("AvailableBalance")
getByBillingAccount is AvailableBalanceOps.Read<AvailableBalance>;
}
alias AvailableBalanceOperationGroupOps = Azure.ResourceManager.Legacy.ExtensionOperations<
{
...ApiVersionParameter;

/** the provider namespace */
@path
@segment("providers")
@key
providerNamespace: "Microsoft.Billing";

/** The ID that uniquely identifies a billing account. */
@path
@segment("billingAccounts")
@key
@pattern("^([0-9]+|([Pp][Cc][Nn]\\.[A-Za-z0-9]+)|[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}(:[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}_[0-9]{4}(-[0-9]{2}){2})?)$")
billingAccountName: string;

/** The ID that uniquely identifies a billing profile. */
@path
@segment("billingProfiles")
@key
@pattern("^[a-zA-Z\\d-_]{1,128}$")
billingProfileName: string;
},
{},
{
/** undefined */
@path
@segment("availableBalance")
@key
default: "default";
}
>;

@armResourceOperations(#{ omitTags: true })
interface AvailableBalanceOperationGroup {
/**
* The Available Credit or Payment on Account Balance for a billing profile. The credit balance can be used to settle due or past due invoices and is supported for billing accounts with agreement type Microsoft Customer Agreement. The payment on account balance is supported for billing accounts with agreement type Microsoft Customer Agreement.
*/
#suppress "@azure-tools/typespec-azure-core/no-openapi" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
@externalDocs("https://docs.microsoft.com/en-us/rest/api/billing/")
@tag("AvailableBalance")
getByBillingProfile is AvailableBalanceOperationGroupOps.Read<AvailableBalance>;
}

@@doc(AvailableBalance.name, "");
@@doc(AvailableBalance.properties,
"The Available Credit or Payment on Account Balance. The credit balance can be used to settle due or past due invoices."
);
Loading
Loading