修改设备配置

2024-06-16

我正在尝试使用 Softlayer java API 来实现修改设备配置。 此过程与采购订单类似。有没有具体的API来升级和降级设备?我找到了虚拟访客的 getUpgradeRequest() 。如果您提供任何示例代码或 API 指南将会有所帮助。 谢谢修改设备配置页面 https://i.stack.imgur.com/XUEhD.png

        for (Guest guest :  Account.service(client).getVirtualGuests()){
            if(guest.getFullyQualifiedDomainName().equals(deviceName))  {
                Request rqt = Guest.service(client, guest.getId()).getUpgradeRequest();
                rqt.setId(id);
                rqt.setOrderId(orderId);
            }
        }

以下是升级 VSI 的 Java 示例。例如:

import java.util.ArrayList;
import java.util.List;
import com.softlayer.api.ApiClient;
import com.softlayer.api.RestApiClient;
import com.softlayer.api.service.container.product.Order;
import com.softlayer.api.service.container.product.order.Property;
import com.softlayer.api.service.product.item.Price;
import com.softlayer.api.service.virtual.Guest;
import com.softlayer.api.service.container.product.order.virtual.guest.Upgrade;

public class UpgradeVirtualGuest {

    public static void main(String[] args) {

        String username = "set me";
        String apikey = "set me";

        // Set the Virtual Guest to upgrade
        Long vsiId = new Long(11498369);

       // Declare item prices. In this case I’m updating the RAM
       // Please set the new item Price

        Long[] prices = { new Long(1641)};  

        List<Property> properties = new ArrayList<Property>();
        Property maintenance = new Property(); 
        maintenance.setName("MAINTENANCE_WINDOW");
        maintenance.setValue("2015-10-05T9:00:00-05:00");
        properties.add(maintenance);

        Guest vsi = new Guest();
        vsi.setId(vsiId);

        String containerIdentifier = "SoftLayer_Container_Product_Order_Virtual_Guest_Upgrade";

        // Create a SoftLayer API client object
        ApiClient client = new RestApiClient().withCredentials(username, apikey).withLoggingEnabled();


        /*
         * Set up Order template
         */
        Upgrade upgradeOrder = new Upgrade();

        upgradeOrder.setContainerIdentifier(containerIdentifier);
        upgradeOrder.getProperties().addAll(properties);
        upgradeOrder.getVirtualGuests().add(0, vsi);

        // Add Item prices to list
        for (Long i : prices) {
            Price price = new Price();
            price.setId(new Long(i));
            upgradeOrder.getPrices().add(price);
        }


        try 
        {
            Order orderResult = com.softlayer.api.service.product.Order.service(client).verifyOrder(upgradeOrder);
            System.out.println("order successfully verified: " + orderResult);

        } catch (Exception e) {
            System.out.println(e);
        }

    }

}

如何获取虚拟访客升级的可用价格? 执行:

https://[username]:[apikey]@api.softlayer.com/rest/v3/SoftLayer_Virtual_Guest/[virtual_guest_ID]/getUpgradeItemPrices

Method: GET

参考:

https://forums.softlayer.com/forum/softlayer-developer-network/general-discussion/84916-changing-virtual-guest-maxmemory https://forums.softlayer.com/forum/softlayer-developer-network/general-discussion/84916-changing-virtual-guest-maxmemory(这个论坛很快就会过时,但现在对你有帮助)https://sldn.softlayer.com/es/reference/datatypes/SoftLayer_Container_Product_Order_Virtual_Guest_Upgrade https://sldn.softlayer.com/es/reference/datatypes/SoftLayer_Container_Product_Order_Virtual_Guest_Upgrade http://sldn.softlayer.com/reference/services/SoftLayer_Product_Order http://sldn.softlayer.com/reference/services/SoftLayer_Product_Order

其他例子:

https://softlayer.github.io/php/upgrade_virtual_guest/ https://softlayer.github.io/php/upgrade_virtual_guest/ https://gist.github.com/underscorephil/3790139 https://gist.github.com/underscorephil/3790139 https://github.com/softlayer/softlayer-java/blob/master/examples/src/main/java/com/softlayer/api/example/OrderVirtualServer.java https://github.com/softlayer/softlayer-java/blob/master/examples/src/main/java/com/softlayer/api/example/OrderVirtualServer.java https://softlayer.github.io/ https://softlayer.github.io/

Regards

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

修改设备配置 的相关文章

  • 如何连接重叠的圆圈?

    我想在视觉上连接两个重叠的圆圈 以便 becomes 我已经有部分圆的方法 但现在我需要知道每个圆的重叠角度有多大 但我不知道该怎么做 有人有主意吗 Phi ArcTan Sqrt 4 R 2 d 2 d HTH Edit 对于两个不同的半
  • 将 Firebase 云消息传递与 Windows 应用程序结合使用

    我在 Android 和 iOS 应用程序中使用 Firebase Cloud Messaging 但是我还有此应用程序的 Windows Mac OS 版本 我想保留相同的逻辑 我知道 Firebase Cloud Messaging 可

随机推荐

  • 对 Scala Not Null 特征的库支持

    Notice 从 Scala 2 11 开始 NotNull已弃用 据我了解 如果您希望引用类型不可为空 则必须混合魔法NotNull特征 编译器会自动阻止你输入null 可以值在里面 看到这个邮件列表线程 http www nabble
  • JavaScript RegEx:不同的结果:使用字符串和使用正则表达式“文字”构建模式?

    使用 RegExp 文字与字符串之间有什么区别吗 http jsfiddle net yMMrk http jsfiddle net yMMrk String prototype lastIndexOf function pattern p
  • Java 8 流 - 合并共享相同 ID 的对象集合

    我有一系列发票 class Invoice int month BigDecimal amount 我想合并这些发票 这样我每个月都会收到一张发票 金额是本月发票金额的总和 例如 invoice 1 month 1 amount 1000
  • 如何在 C++ 中标记字符串?

    Java有一个方便的分割方法 String str The quick brown fox String results str split 在 C 中是否有一种简单的方法可以做到这一点 The 增强分词器 http www boost o
  • 如何在另一个自定义 Hook 中使用返回值的自定义 Hook?

    我正在使用 React native 其中有一个名为的自定义 HookuseUser使用以下方法从 AWS Amplify 获取用户信息Auth getUserInfro方法 然后获取返回对象的一部分并用它设置一个状态变量 我还有另一个名为
  • 无限循环与无限递归。两者都是未定义的吗?

    无副作用的无限循环是未定义的行为 看here https coliru stacked crooked com view id 24e0a58778f67cd4举个例子参考参数 https en cppreference com w cpp
  • Javafx 拖放 TabPane

    我 在 JavaFx 应用程序中 有一个带有不同选项卡的选项卡 我想实现拖放功能以将选项卡拖到舞台之外 这样它就可以生成一个新窗口 就像在 Google Chrome 中一样 谢谢您的帮助 您应该检查 Tom Schindl 在他的网站上显
  • 垃圾收集最佳实践

    如果您要从显示列表中删除某个 MovieClip 并且该 MovieClip 又具有具有自己的事件侦听器的子 MovieClip 则是否有必要从子 MovieClip 中删除所有侦听器 或者只是直接从显示列表中删除的父级 MovieClip
  • 是否可以使用从服务器端 Oauth2 获取的访问令牌打开 google picker?

    我在服务器端使用 Oauth2 集成了我的 Google 驱动器 并在数据库中存储了访问令牌和刷新令牌等凭据 const clientId process env GOOGLE DRIVE CLIENT ID const clientSec
  • 我可以有效地从 HashSet 中随机采样吗?

    我有一个std collections HashSet 我想采样并删除一个均匀随机的元素 目前 我正在做的是使用随机抽样索引rand gen range 然后迭代HashSet到该索引来获取元素 然后我删除选定的元素 这可行 但效率不高 有
  • 如何确保我的代码永远不会直接退出?

    eval require file subsequent code goes here If file包含一个exit语句 后面的代码就没有机会运行 如何解决以便后续代码始终有机会运行eval已经完成了 中止是不可能的exit call f
  • IRichBolt 在storm-1.0.0 和 pyleus-0.3.0 上运行拓扑时出错

    我正在运行风暴拓扑 pyleus verbose local xyz topology jar using storm 1 0 0 pyleus 0 3 0 centos 6 6并得到错误 线程 main java lang NoClass
  • 在 Sql Server 中转换为日期时间 MM/dd/yyyy HH:mm:ss

    如何将给定的日期格式转换为MM dd yyyy HH mm ss 我尝试了下面这个但没有实现 谁能帮我 SELECT CONVERT VARCHAR 20 GETDATE 120 SQL Server 2005及以上版本支持 SELECT
  • 使用 scala 集合 - CanBuildFrom 麻烦

    我正在尝试编写一个接受任何类型集合的方法CC 并将其映射到一个新的集合 相同的集合类型但不同的元素类型 我正在挣扎 基本上我正在尝试实施map but 不在集合本身上 问题 我正在尝试实现一个带有签名的方法 它看起来有点像 def map
  • ActiveRecord:向包含的 ON 子句添加条件

    我有一个模型报价和另一个历史报价 一个报价有很多历史报价 现在 我想立即加载一组报价的某一天的历史报价 如果存在 为此 我认为我需要将这一天传递给 ON 子句 而不是 WHERE 子句 以便我获得所有报价 即使在给定日期没有历史报价时也是如
  • 如何清除NPM的https代理设置?

    如何清除NPM之前的ssl代理设置 好吧 我搜索了很多 但我得到的所有帖子主要是关于如何set公司网络中的代理 我尝试将代理设置为空 npm config set http proxy npm config set https proxy
  • Amplify 和 AppSync 不更新来自多个来源的突变数据

    我一直在尝试与 AppSync GraphQL 交互 Lambda 创建 有效 更新 不更改数据 Angular 已收到创建 更新订阅 但对象为空 Angular 欺骗更新 不更改数据 AppSync 控制台 欺骗更新 不更改数据 Post
  • IIS 7.5 托管的 WCF 服务仅针对大型请求抛出 EndpointNotFoundException 和 404

    我有一个 WCF REST 服务托管在 IIS 7 5 Windows 2008 R2 上 该服务按预期工作 除非客户端尝试发送大于 25 MB 的消息 具体来说 当发送大小约为 25 MB 的消息时 服务会正确接收并处理消息 而当发送大小
  • 将数据框中重叠的范围合并到唯一的组中

    我有一个 n 行 3 的数据框 df lt data frame start c 178 400 983 1932 33653 end c 5025 5025 5535 6918 38197 group c 1 1 2 2 3 df sta
  • 修改设备配置

    我正在尝试使用 Softlayer java API 来实现修改设备配置 此过程与采购订单类似 有没有具体的API来升级和降级设备 我找到了虚拟访客的 getUpgradeRequest 如果您提供任何示例代码或 API 指南将会有所帮助