验证产品的费用是否可以移动到新的发票科目。 只有以定期费用购买的产品以及协议类型为Microsoft 客户协议的计费帐户,才支持此操作。
POST https://management.azure.com/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/products/{productName}/validateMoveEligibility?api-version=2020-05-01
URI 参数
名称 |
在 |
必需 |
类型 |
说明 |
billingAccountName
|
path |
True
|
string
|
唯一标识计费帐户的 ID。
|
productName
|
path |
True
|
string
|
唯一标识产品的 ID。
|
api-version
|
query |
True
|
string
|
要与客户端请求一起使用的 API 的版本。 当前版本为 2020-05-01。
|
请求正文
名称 |
类型 |
说明 |
destinationInvoiceSectionId
|
string
|
目标发票科目 ID。
|
响应
安全性
azure_auth
Azure Active Directory OAuth2 流。
Type:
oauth2
Flow:
implicit
Authorization URL:
https://login.microsoftonline.com/common/oauth2/authorize
Scopes
名称 |
说明 |
user_impersonation
|
模拟用户帐户
|
示例
SubscriptionMoveValidateFailure
Sample Request
POST https://management.azure.com/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/products/{productName}/validateMoveEligibility?api-version=2020-05-01
{
"destinationInvoiceSectionId": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{newInvoiceSectionName}"
}
import com.azure.resourcemanager.billing.models.TransferProductRequestProperties;
/** Samples for Products ValidateMove. */
public final class Main {
/*
* x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2020-05-01/examples/ValidateProductMoveFailure.json
*/
/**
* Sample code: SubscriptionMoveValidateFailure.
*
* @param manager Entry point to BillingManager.
*/
public static void subscriptionMoveValidateFailure(com.azure.resourcemanager.billing.BillingManager manager) {
manager
.products()
.validateMoveWithResponse(
"{billingAccountName}",
"{productName}",
new TransferProductRequestProperties()
.withDestinationInvoiceSectionId(
"/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{newInvoiceSectionName}"),
com.azure.core.util.Context.NONE);
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armbilling_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/billing/armbilling"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/billing/resource-manager/Microsoft.Billing/stable/2020-05-01/examples/ValidateProductMoveFailure.json
func ExampleProductsClient_ValidateMove_subscriptionMoveValidateFailure() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armbilling.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewProductsClient().ValidateMove(ctx, "{billingAccountName}", "{productName}", armbilling.TransferProductRequestProperties{
DestinationInvoiceSectionID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{newInvoiceSectionName}"),
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.ValidateProductTransferEligibilityResult = armbilling.ValidateProductTransferEligibilityResult{
// ErrorDetails: &armbilling.ValidateProductTransferEligibilityError{
// Code: to.Ptr(armbilling.ProductTransferValidationErrorCodeProductTypeNotSupported),
// Message: to.Ptr("Product '{productName}' is not allowed to be transferred."),
// },
// IsMoveEligible: to.Ptr(false),
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { BillingManagementClient } = require("@azure/arm-billing");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Validates if a product's charges can be moved to a new invoice section. This operation is supported only for products that are purchased with a recurring charge and for billing accounts with agreement type Microsoft Customer Agreement.
*
* @summary Validates if a product's charges can be moved to a new invoice section. This operation is supported only for products that are purchased with a recurring charge and for billing accounts with agreement type Microsoft Customer Agreement.
* x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2020-05-01/examples/ValidateProductMoveFailure.json
*/
async function subscriptionMoveValidateFailure() {
const subscriptionId = "00000000-0000-0000-0000-000000000000";
const billingAccountName = "{billingAccountName}";
const productName = "{productName}";
const parameters = {
destinationInvoiceSectionId:
"/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{newInvoiceSectionName}",
};
const credential = new DefaultAzureCredential();
const client = new BillingManagementClient(credential, subscriptionId);
const result = await client.products.validateMove(billingAccountName, productName, parameters);
console.log(result);
}
subscriptionMoveValidateFailure().catch(console.error);
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Sample Response
{
"isMoveEligible": false,
"errorDetails": {
"code": "ProductTypeNotSupported",
"message": "Product '{productName}' is not allowed to be transferred."
}
}
SubscriptionMoveValidateSuccess
Sample Request
POST https://management.azure.com/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/products/{productName}/validateMoveEligibility?api-version=2020-05-01
{
"destinationInvoiceSectionId": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{newInvoiceSectionName}"
}
import com.azure.resourcemanager.billing.models.TransferProductRequestProperties;
/** Samples for Products ValidateMove. */
public final class Main {
/*
* x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2020-05-01/examples/ValidateProductMoveSuccess.json
*/
/**
* Sample code: SubscriptionMoveValidateSuccess.
*
* @param manager Entry point to BillingManager.
*/
public static void subscriptionMoveValidateSuccess(com.azure.resourcemanager.billing.BillingManager manager) {
manager
.products()
.validateMoveWithResponse(
"{billingAccountName}",
"{productName}",
new TransferProductRequestProperties()
.withDestinationInvoiceSectionId(
"/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{newInvoiceSectionName}"),
com.azure.core.util.Context.NONE);
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armbilling_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/billing/armbilling"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/billing/resource-manager/Microsoft.Billing/stable/2020-05-01/examples/ValidateProductMoveSuccess.json
func ExampleProductsClient_ValidateMove_subscriptionMoveValidateSuccess() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armbilling.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewProductsClient().ValidateMove(ctx, "{billingAccountName}", "{productName}", armbilling.TransferProductRequestProperties{
DestinationInvoiceSectionID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{newInvoiceSectionName}"),
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.ValidateProductTransferEligibilityResult = armbilling.ValidateProductTransferEligibilityResult{
// IsMoveEligible: to.Ptr(true),
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { BillingManagementClient } = require("@azure/arm-billing");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Validates if a product's charges can be moved to a new invoice section. This operation is supported only for products that are purchased with a recurring charge and for billing accounts with agreement type Microsoft Customer Agreement.
*
* @summary Validates if a product's charges can be moved to a new invoice section. This operation is supported only for products that are purchased with a recurring charge and for billing accounts with agreement type Microsoft Customer Agreement.
* x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2020-05-01/examples/ValidateProductMoveSuccess.json
*/
async function subscriptionMoveValidateSuccess() {
const subscriptionId = "00000000-0000-0000-0000-000000000000";
const billingAccountName = "{billingAccountName}";
const productName = "{productName}";
const parameters = {
destinationInvoiceSectionId:
"/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{newInvoiceSectionName}",
};
const credential = new DefaultAzureCredential();
const client = new BillingManagementClient(credential, subscriptionId);
const result = await client.products.validateMove(billingAccountName, productName, parameters);
console.log(result);
}
subscriptionMoveValidateSuccess().catch(console.error);
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Sample Response
{
"isMoveEligible": true
}
定义
ErrorDetails
错误的详细信息。
名称 |
类型 |
说明 |
code
|
string
|
错误代码。
|
details
|
ErrorSubDetails[]
|
错误的子详细信息。
|
message
|
string
|
指示操作失败原因的错误消息。
|
target
|
string
|
特定错误的目标。
|
ErrorResponse
错误响应指示服务无法处理传入请求。 错误消息中提供了原因。
ErrorSubDetails
名称 |
类型 |
说明 |
code
|
string
|
错误代码。
|
message
|
string
|
指示操作失败原因的错误消息。
|
target
|
string
|
特定错误的目标。
|
ProductTransferValidationErrorCode
传输验证响应的错误代码。
名称 |
类型 |
说明 |
CrossBillingAccountNotAllowed
|
string
|
|
DestinationBillingProfilePastDue
|
string
|
|
InsufficientPermissionOnDestination
|
string
|
|
InsufficientPermissionOnSource
|
string
|
|
InvalidSource
|
string
|
|
NotAvailableForDestinationMarket
|
string
|
|
OneTimePurchaseProductTransferNotAllowed
|
string
|
|
ProductNotActive
|
string
|
|
ProductTypeNotSupported
|
string
|
|
TransferProductRequestProperties
要启动转移的产品的属性。
名称 |
类型 |
说明 |
destinationInvoiceSectionId
|
string
|
目标发票科目 ID。
|
ValidateProductTransferEligibilityError
产品转移资格验证的错误详细信息。
ValidateProductTransferEligibilityResult
产品转移资格验证的结果。