虚机实例
所有文档

          边缘计算节点 BEC

          虚机实例

          获取BEC虚机列表

          如下代码可以获取BEC虚机列表:

          public void getBecVmInstanceList(BecClient client) {
              GetBecVmInstanceListRequest request = new GetBecVmInstanceListRequest();
              GetBecVmInstanceListResponse response = client.getBecVmInstanceList(request);
          }

          获取所在节点的BEC虚机列表

          使用以下代码可以获取所在节点的BEC虚机列表:

          public void getBecNodeVmInstanceList(BecClient client) {
              GetBecNodeVmInstanceListRequest request = new GetBecNodeVmInstanceListRequest();
              // 分页信息
              ListRequest listRequest = new ListRequest();
              // 部署实例区域
              request.setRegion("EAST_CHINA");
              // 部署实例运营商
              request.setServiceProvider("CHINA_TELECOM");
              // 部署实例城市
              request.setCity("SHANGHAI");
              request.setListRequest(listRequest);
              GetBecNodeVmInstanceListResponse response = client.getBecNodeVmInstanceList(request);
          }

          获取BEC虚机详情

          使用以下代码可以获取BEC虚机详情:

          public void getBecVirtualMachine(BecClient client) {
              GetBecVirtualMachineRequest request = new GetBecVirtualMachineRequest();
              // 虚机Id
              request.setVmID("vm-id");
              GetBecVirtualMachineResponse response = client.getBecVirtualMachine(request);
          }

          删除BEC虚机

          使用以下代码删除BEC虚机:

          public void deleteBecVmInstance(BecClient client) {
              DeleteBecVmInstanceRequest request = new DeleteBecVmInstanceRequest();
              // 虚机Id
              request.setVmID("vm-id");
              DeleteBecVmInstanceResponse response = client.deleteBecVmInstance(request);
          }

          更新BEC虚机资源

          使用以下代码可以更新BEC虚机资源:

          public void updateBecVmDeployment(BecClient client) {
              UpdateBecVmDeploymentRequest request = new UpdateBecVmDeploymentRequest();
              // 更新类型
              request.setType("vmName");
              // 虚机名称
              request.setVmName("vm-name");
              // 虚机Id
              request.setVmID("vm-id");
          
              UpdateBecVmDeploymentResponse response = client.updateBecVmDeployment(request);
          }

          更新详情请参照API参考文档

          重装BEC虚机系统

          使用以下代码可以重装BEC虚机系统:

          public void reinstallBecVmInstance(BecClient client) {
              ReinstallBecVmInstanceRequest request = new ReinstallBecVmInstanceRequest();
              // 虚机Id
              request.setVmID("vm-id");
              // 密码
              request.setAdminPass("adminPass");
              // 镜像id
              request.setImageId("imageId");
              ReinstallBecVmInstanceResponse response = client.reinstallBecVmInstance(request);
          }

          操作BEC虚机资源

          使用以下代码可以操作BEC虚机资源:

          public void operateBecVmDeployment(BecClient client) {
              OperateBecVmDeploymentRequest request = new OperateBecVmDeploymentRequest();
              // 虚机id
              request.setVmID("vm-id");
              // 动作(start,stop,restart)
              request.setAction("start");
              OperateBecVmDeploymentResponse response = client.operateBecVmDeployment(request);
          }

          获取VM服务监控

          使用以下代码可以获取VM服务监控:

          public void getBecVmInstanceMetrics(BecClient client) {
              GetBecVmInstanceMetricsRequest request = new GetBecVmInstanceMetricsRequest();
              // 虚机id
              request.setVmId("vm-id");
              // 监控类型(CPU,MEMORY,BANDWIDTH_RECEIVE,BANDWIDTH_TRANSMIT,TRAFFIC_RECEIVE,TRAFFIC_TRANSMIT,REQUEST_NUMBER,REQUEST_RATE,REQUEST_DELAY)
              request.setType("cpu");
              // 偏移秒
              request.setOffsetInSeconds(3600);
              GetBecVmInstanceMetricsResponse response = client.getBecVmInstanceMetrics(request);
          }

          获取相同BEC虚机实例配置

          public void getBecVmConfig(BecClient client) {
              GetBecVmConfigRequest request = new GetBecVmConfigRequest();
              // 虚机Id
              request.setVmID("vm-id");
              GetBecVmConfigResponse response = client.getBecVmConfig(request);
          }
          上一篇
          虚机服务
          下一篇
          负载均衡