本文介绍了如何为我的一个CSP客户用户启用保留实例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
Hello All,
$
我们有一位客户要求为他的订阅订购预订实例。
目前,他收到错误消息"您的提供商未在此订阅上启用预留实例购买...."&
如何为CSP客户用户启用保留实例?
谢谢你
Roy
Hello All,
We have a Customer that ask to order a reserved instance for his subscription.
Currently, he is getting an error message "your provider has not enabled reserved instances purchase on this subscription...."
How Can enable reserved instance for CSP customer user?
Thanks
Roy
推荐答案
您是否使用过以下代码?
Did you use the code like below?
var partnerOperations = this.Context.UserPartnerOperations;
// obtain the customer ID, the ID of the subscription to amend with the add on offer and the add on offer ID
var customerId = this.ObtainCustomerId();
var subscriptionId = this.ObtainSubscriptionId(customerId, "Enter the subscription ID for which to purchase an add on");
//string addOnOfferId = this.Context.ConsoleHelper.ReadNonEmptyString("Enter the ID of the add on offer to purchase", "Offer ID can't be empty");
string addOnOfferId = "6B648C1E-F362-46C0-8379-09F50A2215E0";
var subscriptionOperations = partnerOperations.Customers.ById(customerId).Subscriptions.ById(subscriptionId);
// get the parent subscription details
this.Context.ConsoleHelper.StartProgress("Retrieving order information for existing subscription");
var parentSubscription = subscriptionOperations.Get();
this.Context.ConsoleHelper.StopProgress();
// in order to buy an add on subscription for this offer, we need to patch/update the order through which the base offer was purchased
// by creating an order object with a single line item which represents the add-on offer purchase.
var orderToUpdate = new Order()
{
ReferenceCustomerId = customerId,
LineItems = new List<OrderLineItem>()
{
new OrderLineItem()
{
LineItemNumber = 0,
OfferId = addOnOfferId,
FriendlyName = "Some friendly name1",
Quantity = 25,
ParentSubscriptionId = subscriptionId
}
}
};
// update the order to apply the add on purchase
this.Context.ConsoleHelper.StartProgress("Updating parent subscription order");
Order updatedOrder = partnerOperations.Customers.ById(customerId).Orders.ById(parentSubscription.OrderId).Patch(orderToUpdate);
this.Context.ConsoleHelper.StopProgress();
this.Context.ConsoleHelper.WriteObject(updatedOrder, "Updated order");
// fetch the subscription add ons and display these
this.Context.ConsoleHelper.StartProgress("Retrieving subscription supported add ons");
var subscriptionAddOns = subscriptionOperations.AddOns.Get();
this.Context.ConsoleHelper.StopProgress();
this.Context.ConsoleHelper.WriteObject(subscriptionAddOns, "Subscription add ons");
更多信息:
最好的问候,
Dennis
这篇关于如何为我的一个CSP客户用户启用保留实例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!