All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.qingcloud.sdk.service.NicService Maven / Gradle / Ivy

Go to download

青云为开发者提供软件开发包 SDK (Software Development Kit), 可以利用它对青云的资源进行查看、创建和操作,借此开发出更富创造力的产品。

There is a newer version: 1.2.4
Show newest version
// +-------------------------------------------------------------------------
// | Copyright (C) 2016 Yunify, Inc.
// +-------------------------------------------------------------------------
// | Licensed under the Apache License, Version 2.0 (the "License");
// | you may not use this work except in compliance with the License.
// | You may obtain a copy of the License in the LICENSE file, or at:
// |
// | http://www.apache.org/licenses/LICENSE-2.0
// |
// | Unless required by applicable law or agreed to in writing, software
// | distributed under the License is distributed on an "AS IS" BASIS,
// | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// | See the License for the specific language governing permissions and
// | limitations under the License.
// +-------------------------------------------------------------------------

package com.qingcloud.sdk.service;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.qingcloud.sdk.config.EnvContext;
import com.qingcloud.sdk.constants.QCConstant;
import com.qingcloud.sdk.model.OutputModel;
import com.qingcloud.sdk.request.ResponseCallBack;
import com.qingcloud.sdk.request.ResourceRequestFactory;
import com.qingcloud.sdk.exception.QCException;
import com.qingcloud.sdk.model.IaasParamBody;
import com.qingcloud.sdk.service.Types.*;
import com.qingcloud.sdk.utils.QCStringUtil;
import com.fasterxml.jackson.annotation.JsonProperty;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class NicService {

    private EnvContext envContext;

    private String zone;

    public NicService(EnvContext envContext) {
        this.envContext = envContext;
    }

    public NicService(EnvContext envContext, String zone) {
        this.envContext = envContext;
        this.zone = zone;
    }
        
    /**
      * @param input Request parameters and headers in the class
      * @return AttachNicsOutput Response body and headers in the class
      * @throws QCException IOException or network error
      *
      * Documentation URL
      */
    @SuppressWarnings({"rawtypes", "unchecked"})
    public AttachNicsOutput attachNics(AttachNicsInput input) throws QCException {
        if (input == null) {
            input = new AttachNicsInput();
        }
        Map context = new HashMap();
        context.put(QCConstant.ENV_CONTEXT_KEY, this.envContext);
        context.put("OperationName", "AttachNics");
        context.put("APIName", "AttachNics");
        context.put("ServiceName", "AttachNics");
        context.put("RequestMethod", "GET");
        context.put("RequestURI", "/iaas/AttachNics");

        input.setAction("AttachNics");
        if (QCStringUtil.isEmpty(this.zone)) {
            input.setZone(this.envContext.getZone());
        } else {
            input.setZone(this.zone);
        }

        Object backModel = ResourceRequestFactory.getResourceRequest().sendApiRequest(context, input,AttachNicsOutput.class);
        if(backModel != null){
            return (AttachNicsOutput)backModel;
        }
        return null;
    }

     /**
       * @param input Request parameters and headers in the class
       * @param callback Response calls back when success
       * @throws QCException IOException or network error
       *
       * Documentation URL
       */
    @SuppressWarnings({"rawtypes", "unchecked"})
    public void attachNics(AttachNicsInput input, ResponseCallBack callback) throws QCException {
        if (input == null) {
            input = new AttachNicsInput();
        }
        Map context = new HashMap();
        context.put(QCConstant.ENV_CONTEXT_KEY, this.envContext);
        context.put("OperationName", "AttachNics");
        context.put("APIName", "AttachNics");
        context.put("ServiceName", "AttachNics");
        context.put("RequestMethod", "GET");
        context.put("RequestURI", "/iaas/AttachNics");

        input.setAction("AttachNics");
        if (QCStringUtil.isEmpty(this.zone)) {
            input.setZone(this.envContext.getZone());
        } else {
            input.setZone(this.zone);
        }

        if(callback == null) {
            throw new QCException("callback can't be null");
        }

        ResourceRequestFactory.getResourceRequest().sendApiRequestAsync(context,input,callback);
    }

    public static class AttachNicsInput extends IaasParamBody {
        // Required
        private String instance;

        @JsonProperty(value = "instance")
        public void setInstance(String instance) {
            this.instance = instance;
        }

        @JsonProperty(value = "instance")
        public String getInstance() {
            return this.instance;
        }

        // Required
        private List nics;

        @JsonProperty(value = "nics")
        public void setNics(List nics) {
            this.nics = nics;
        }

        @JsonProperty(value = "nics")
        public List getNics() {
            return this.nics;
        }

        public String validateParam() throws QCException {
            if (QCStringUtil.isEmpty(this.getInstance())) {
                throw new QCException("Instance is required");
            }
            return null;
        }
    }

    @JsonIgnoreProperties(ignoreUnknown = true)
    public static class AttachNicsOutput extends OutputModel {
        private String action;

        @JsonProperty(value = "action")
        public void setAction(String action) {
            this.action = action;
        }

        @JsonProperty(value = "action")
        public String getAction() {
            return this.action;
        }

        private String jobID;

        @JsonProperty(value = "job_id")
        public void setJobID(String jobID) {
            this.jobID = jobID;
        }

        @JsonProperty(value = "job_id")
        public String getJobID() {
            return this.jobID;
        }

        private Integer retCode;

        @JsonProperty(value = "ret_code")
        public void setRetCode(Integer retCode) {
            this.retCode = retCode;
        }

        @JsonProperty(value = "ret_code")
        public Integer getRetCode() {
            return this.retCode;
        }

    }
        
    /**
      * @param input Request parameters and headers in the class
      * @return CreateNicsOutput Response body and headers in the class
      * @throws QCException IOException or network error
      *
      * Documentation URL
      */
    @SuppressWarnings({"rawtypes", "unchecked"})
    public CreateNicsOutput createNics(CreateNicsInput input) throws QCException {
        if (input == null) {
            input = new CreateNicsInput();
        }
        Map context = new HashMap();
        context.put(QCConstant.ENV_CONTEXT_KEY, this.envContext);
        context.put("OperationName", "CreateNics");
        context.put("APIName", "CreateNics");
        context.put("ServiceName", "CreateNics");
        context.put("RequestMethod", "GET");
        context.put("RequestURI", "/iaas/CreateNics");

        input.setAction("CreateNics");
        if (QCStringUtil.isEmpty(this.zone)) {
            input.setZone(this.envContext.getZone());
        } else {
            input.setZone(this.zone);
        }

        Object backModel = ResourceRequestFactory.getResourceRequest().sendApiRequest(context, input,CreateNicsOutput.class);
        if(backModel != null){
            return (CreateNicsOutput)backModel;
        }
        return null;
    }

     /**
       * @param input Request parameters and headers in the class
       * @param callback Response calls back when success
       * @throws QCException IOException or network error
       *
       * Documentation URL
       */
    @SuppressWarnings({"rawtypes", "unchecked"})
    public void createNics(CreateNicsInput input, ResponseCallBack callback) throws QCException {
        if (input == null) {
            input = new CreateNicsInput();
        }
        Map context = new HashMap();
        context.put(QCConstant.ENV_CONTEXT_KEY, this.envContext);
        context.put("OperationName", "CreateNics");
        context.put("APIName", "CreateNics");
        context.put("ServiceName", "CreateNics");
        context.put("RequestMethod", "GET");
        context.put("RequestURI", "/iaas/CreateNics");

        input.setAction("CreateNics");
        if (QCStringUtil.isEmpty(this.zone)) {
            input.setZone(this.envContext.getZone());
        } else {
            input.setZone(this.zone);
        }

        if(callback == null) {
            throw new QCException("callback can't be null");
        }

        ResourceRequestFactory.getResourceRequest().sendApiRequestAsync(context,input,callback);
    }

    public static class CreateNicsInput extends IaasParamBody {
        private Integer count;

        @JsonProperty(value = "count")
        public void setCount(Integer count) {
            this.count = count;
        }

        @JsonProperty(value = "count")
        public Integer getCount() {
            return this.count;
        }

        private String nICName;

        @JsonProperty(value = "nic_name")
        public void setNICName(String nICName) {
            this.nICName = nICName;
        }

        @JsonProperty(value = "nic_name")
        public String getNICName() {
            return this.nICName;
        }

        private List privateIPs;

        @JsonProperty(value = "private_ips")
        public void setPrivateIPs(List privateIPs) {
            this.privateIPs = privateIPs;
        }

        @JsonProperty(value = "private_ips")
        public List getPrivateIPs() {
            return this.privateIPs;
        }

        // Required
        private String vxNet;

        @JsonProperty(value = "vxnet")
        public void setVxNet(String vxNet) {
            this.vxNet = vxNet;
        }

        @JsonProperty(value = "vxnet")
        public String getVxNet() {
            return this.vxNet;
        }

        public String validateParam() throws QCException {
            if (QCStringUtil.isEmpty(this.getVxNet())) {
                throw new QCException("VxNet is required");
            }
            return null;
        }
    }

    @JsonIgnoreProperties(ignoreUnknown = true)
    public static class CreateNicsOutput extends OutputModel {
        private String action;

        @JsonProperty(value = "action")
        public void setAction(String action) {
            this.action = action;
        }

        @JsonProperty(value = "action")
        public String getAction() {
            return this.action;
        }

        private List nics;

        @JsonProperty(value = "nics")
        public void setNics(List nics) {
            this.nics = nics;
        }

        @JsonProperty(value = "nics")
        public List getNics() {
            return this.nics;
        }

        private Integer retCode;

        @JsonProperty(value = "ret_code")
        public void setRetCode(Integer retCode) {
            this.retCode = retCode;
        }

        @JsonProperty(value = "ret_code")
        public Integer getRetCode() {
            return this.retCode;
        }

    }
        
    /**
      * @param input Request parameters and headers in the class
      * @return DeleteNicsOutput Response body and headers in the class
      * @throws QCException IOException or network error
      *
      * Documentation URL
      */
    @SuppressWarnings({"rawtypes", "unchecked"})
    public DeleteNicsOutput deleteNics(DeleteNicsInput input) throws QCException {
        if (input == null) {
            input = new DeleteNicsInput();
        }
        Map context = new HashMap();
        context.put(QCConstant.ENV_CONTEXT_KEY, this.envContext);
        context.put("OperationName", "DeleteNics");
        context.put("APIName", "DeleteNics");
        context.put("ServiceName", "DeleteNics");
        context.put("RequestMethod", "GET");
        context.put("RequestURI", "/iaas/DeleteNics");

        input.setAction("DeleteNics");
        if (QCStringUtil.isEmpty(this.zone)) {
            input.setZone(this.envContext.getZone());
        } else {
            input.setZone(this.zone);
        }

        Object backModel = ResourceRequestFactory.getResourceRequest().sendApiRequest(context, input,DeleteNicsOutput.class);
        if(backModel != null){
            return (DeleteNicsOutput)backModel;
        }
        return null;
    }

     /**
       * @param input Request parameters and headers in the class
       * @param callback Response calls back when success
       * @throws QCException IOException or network error
       *
       * Documentation URL
       */
    @SuppressWarnings({"rawtypes", "unchecked"})
    public void deleteNics(DeleteNicsInput input, ResponseCallBack callback) throws QCException {
        if (input == null) {
            input = new DeleteNicsInput();
        }
        Map context = new HashMap();
        context.put(QCConstant.ENV_CONTEXT_KEY, this.envContext);
        context.put("OperationName", "DeleteNics");
        context.put("APIName", "DeleteNics");
        context.put("ServiceName", "DeleteNics");
        context.put("RequestMethod", "GET");
        context.put("RequestURI", "/iaas/DeleteNics");

        input.setAction("DeleteNics");
        if (QCStringUtil.isEmpty(this.zone)) {
            input.setZone(this.envContext.getZone());
        } else {
            input.setZone(this.zone);
        }

        if(callback == null) {
            throw new QCException("callback can't be null");
        }

        ResourceRequestFactory.getResourceRequest().sendApiRequestAsync(context,input,callback);
    }

    public static class DeleteNicsInput extends IaasParamBody {
        // Required
        private List nics;

        @JsonProperty(value = "nics")
        public void setNics(List nics) {
            this.nics = nics;
        }

        @JsonProperty(value = "nics")
        public List getNics() {
            return this.nics;
        }

        public String validateParam() throws QCException {
            return null;
        }
    }

    @JsonIgnoreProperties(ignoreUnknown = true)
    public static class DeleteNicsOutput extends OutputModel {
        private String action;

        @JsonProperty(value = "action")
        public void setAction(String action) {
            this.action = action;
        }

        @JsonProperty(value = "action")
        public String getAction() {
            return this.action;
        }

        private Integer retCode;

        @JsonProperty(value = "ret_code")
        public void setRetCode(Integer retCode) {
            this.retCode = retCode;
        }

        @JsonProperty(value = "ret_code")
        public Integer getRetCode() {
            return this.retCode;
        }

    }
        
    /**
      * @param input Request parameters and headers in the class
      * @return DescribeNicsOutput Response body and headers in the class
      * @throws QCException IOException or network error
      *
      * Documentation URL
      */
    @SuppressWarnings({"rawtypes", "unchecked"})
    public DescribeNicsOutput describeNics(DescribeNicsInput input) throws QCException {
        if (input == null) {
            input = new DescribeNicsInput();
        }
        Map context = new HashMap();
        context.put(QCConstant.ENV_CONTEXT_KEY, this.envContext);
        context.put("OperationName", "DescribeNics");
        context.put("APIName", "DescribeNics");
        context.put("ServiceName", "DescribeNics");
        context.put("RequestMethod", "GET");
        context.put("RequestURI", "/iaas/DescribeNics");

        input.setAction("DescribeNics");
        if (QCStringUtil.isEmpty(this.zone)) {
            input.setZone(this.envContext.getZone());
        } else {
            input.setZone(this.zone);
        }

        Object backModel = ResourceRequestFactory.getResourceRequest().sendApiRequest(context, input,DescribeNicsOutput.class);
        if(backModel != null){
            return (DescribeNicsOutput)backModel;
        }
        return null;
    }

     /**
       * @param input Request parameters and headers in the class
       * @param callback Response calls back when success
       * @throws QCException IOException or network error
       *
       * Documentation URL
       */
    @SuppressWarnings({"rawtypes", "unchecked"})
    public void describeNics(DescribeNicsInput input, ResponseCallBack callback) throws QCException {
        if (input == null) {
            input = new DescribeNicsInput();
        }
        Map context = new HashMap();
        context.put(QCConstant.ENV_CONTEXT_KEY, this.envContext);
        context.put("OperationName", "DescribeNics");
        context.put("APIName", "DescribeNics");
        context.put("ServiceName", "DescribeNics");
        context.put("RequestMethod", "GET");
        context.put("RequestURI", "/iaas/DescribeNics");

        input.setAction("DescribeNics");
        if (QCStringUtil.isEmpty(this.zone)) {
            input.setZone(this.envContext.getZone());
        } else {
            input.setZone(this.zone);
        }

        if(callback == null) {
            throw new QCException("callback can't be null");
        }

        ResourceRequestFactory.getResourceRequest().sendApiRequestAsync(context,input,callback);
    }

    public static class DescribeNicsInput extends IaasParamBody {
        private List instances;

        @JsonProperty(value = "instances")
        public void setInstances(List instances) {
            this.instances = instances;
        }

        @JsonProperty(value = "instances")
        public List getInstances() {
            return this.instances;
        }

        private Integer limit;

        @JsonProperty(value = "limit")
        public void setLimit(Integer limit) {
            this.limit = limit;
        }

        @JsonProperty(value = "limit")
        public Integer getLimit() {
            return this.limit;
        }

        private String nICName;

        @JsonProperty(value = "nic_name")
        public void setNICName(String nICName) {
            this.nICName = nICName;
        }

        @JsonProperty(value = "nic_name")
        public String getNICName() {
            return this.nICName;
        }

        private List nics;

        @JsonProperty(value = "nics")
        public void setNics(List nics) {
            this.nics = nics;
        }

        @JsonProperty(value = "nics")
        public List getNics() {
            return this.nics;
        }

        private Integer offset;

        @JsonProperty(value = "offset")
        public void setOffset(Integer offset) {
            this.offset = offset;
        }

        @JsonProperty(value = "offset")
        public Integer getOffset() {
            return this.offset;
        }

        private String owner;

        @JsonProperty(value = "owner")
        public void setOwner(String owner) {
            this.owner = owner;
        }

        @JsonProperty(value = "owner")
        public String getOwner() {
            return this.owner;
        }

    	// Status's available values: available, in-use
        private String status;

        @JsonProperty(value = "status")
        public void setStatus(String status) {
            this.status = status;
        }

        @JsonProperty(value = "status")
        public String getStatus() {
            return this.status;
        }

    	// VxNetType's available values: 0, 1
        private Integer vxNetType;

        @JsonProperty(value = "vxnet_type")
        public void setVxNetType(Integer vxNetType) {
            this.vxNetType = vxNetType;
        }

        @JsonProperty(value = "vxnet_type")
        public Integer getVxNetType() {
            return this.vxNetType;
        }

        private List vxNets;

        @JsonProperty(value = "vxnets")
        public void setVxNets(List vxNets) {
            this.vxNets = vxNets;
        }

        @JsonProperty(value = "vxnets")
        public List getVxNets() {
            return this.vxNets;
        }

        public String validateParam() throws QCException {
            String[] statusValidValues = {
                "available", "in-use"
            };

            boolean statusIsValid = false;
            for (String v : statusValidValues) {
                if (v.equals(this.getStatus())) {
                    statusIsValid = true;
                }
                Boolean statusIsRequired = Boolean.FALSE;
                if (statusIsRequired.equals(Boolean.FALSE) && this.getStatus() == null) {
                    statusIsValid = true;
                }
            }

            if (!statusIsValid) {
                throw new QCException("Status value " + this.getStatus() + "is invalid");
            }
            String[]vxNetTypeValidValues = {"0", "1"};
            boolean vxNetTypeIsValid = false;
            for (String v : vxNetTypeValidValues) {
                if (v.equals(this.getVxNetType()+"")) {
                    vxNetTypeIsValid = true;
                }
                Boolean vxNetTypeIsRequired = Boolean.FALSE;
                if (vxNetTypeIsRequired.equals(Boolean.FALSE) && this.getVxNetType()==null) {
                    vxNetTypeIsValid = true;
                }
            }

            if (!vxNetTypeIsValid) {
                throw new QCException("VxNetType value " + this.getVxNetType() + "is invalid");
            }
            return null;
        }
    }

    @JsonIgnoreProperties(ignoreUnknown = true)
    public static class DescribeNicsOutput extends OutputModel {
        private String action;

        @JsonProperty(value = "action")
        public void setAction(String action) {
            this.action = action;
        }

        @JsonProperty(value = "action")
        public String getAction() {
            return this.action;
        }

        private List nICSet;

        @JsonProperty(value = "nic_set")
        public void setNICSet(List nICSet) {
            this.nICSet = nICSet;
        }

        @JsonProperty(value = "nic_set")
        public List getNICSet() {
            return this.nICSet;
        }

        private Integer retCode;

        @JsonProperty(value = "ret_code")
        public void setRetCode(Integer retCode) {
            this.retCode = retCode;
        }

        @JsonProperty(value = "ret_code")
        public Integer getRetCode() {
            return this.retCode;
        }

        private Integer totalCount;

        @JsonProperty(value = "total_count")
        public void setTotalCount(Integer totalCount) {
            this.totalCount = totalCount;
        }

        @JsonProperty(value = "total_count")
        public Integer getTotalCount() {
            return this.totalCount;
        }

    }
        
    /**
      * @param input Request parameters and headers in the class
      * @return DetachNicsOutput Response body and headers in the class
      * @throws QCException IOException or network error
      *
      * Documentation URL
      */
    @SuppressWarnings({"rawtypes", "unchecked"})
    public DetachNicsOutput detachNics(DetachNicsInput input) throws QCException {
        if (input == null) {
            input = new DetachNicsInput();
        }
        Map context = new HashMap();
        context.put(QCConstant.ENV_CONTEXT_KEY, this.envContext);
        context.put("OperationName", "DetachNics");
        context.put("APIName", "DetachNics");
        context.put("ServiceName", "DetachNics");
        context.put("RequestMethod", "GET");
        context.put("RequestURI", "/iaas/DetachNics");

        input.setAction("DetachNics");
        if (QCStringUtil.isEmpty(this.zone)) {
            input.setZone(this.envContext.getZone());
        } else {
            input.setZone(this.zone);
        }

        Object backModel = ResourceRequestFactory.getResourceRequest().sendApiRequest(context, input,DetachNicsOutput.class);
        if(backModel != null){
            return (DetachNicsOutput)backModel;
        }
        return null;
    }

     /**
       * @param input Request parameters and headers in the class
       * @param callback Response calls back when success
       * @throws QCException IOException or network error
       *
       * Documentation URL
       */
    @SuppressWarnings({"rawtypes", "unchecked"})
    public void detachNics(DetachNicsInput input, ResponseCallBack callback) throws QCException {
        if (input == null) {
            input = new DetachNicsInput();
        }
        Map context = new HashMap();
        context.put(QCConstant.ENV_CONTEXT_KEY, this.envContext);
        context.put("OperationName", "DetachNics");
        context.put("APIName", "DetachNics");
        context.put("ServiceName", "DetachNics");
        context.put("RequestMethod", "GET");
        context.put("RequestURI", "/iaas/DetachNics");

        input.setAction("DetachNics");
        if (QCStringUtil.isEmpty(this.zone)) {
            input.setZone(this.envContext.getZone());
        } else {
            input.setZone(this.zone);
        }

        if(callback == null) {
            throw new QCException("callback can't be null");
        }

        ResourceRequestFactory.getResourceRequest().sendApiRequestAsync(context,input,callback);
    }

    public static class DetachNicsInput extends IaasParamBody {
        // Required
        private List nics;

        @JsonProperty(value = "nics")
        public void setNics(List nics) {
            this.nics = nics;
        }

        @JsonProperty(value = "nics")
        public List getNics() {
            return this.nics;
        }

        public String validateParam() throws QCException {
            return null;
        }
    }

    @JsonIgnoreProperties(ignoreUnknown = true)
    public static class DetachNicsOutput extends OutputModel {
        private String action;

        @JsonProperty(value = "action")
        public void setAction(String action) {
            this.action = action;
        }

        @JsonProperty(value = "action")
        public String getAction() {
            return this.action;
        }

        private String jobID;

        @JsonProperty(value = "job_id")
        public void setJobID(String jobID) {
            this.jobID = jobID;
        }

        @JsonProperty(value = "job_id")
        public String getJobID() {
            return this.jobID;
        }

        private Integer retCode;

        @JsonProperty(value = "ret_code")
        public void setRetCode(Integer retCode) {
            this.retCode = retCode;
        }

        @JsonProperty(value = "ret_code")
        public Integer getRetCode() {
            return this.retCode;
        }

    }
        
    /**
      * @param input Request parameters and headers in the class
      * @return ModifyNicAttributesOutput Response body and headers in the class
      * @throws QCException IOException or network error
      *
      * Documentation URL
      */
    @SuppressWarnings({"rawtypes", "unchecked"})
    public ModifyNicAttributesOutput modifyNicAttributes(ModifyNicAttributesInput input) throws QCException {
        if (input == null) {
            input = new ModifyNicAttributesInput();
        }
        Map context = new HashMap();
        context.put(QCConstant.ENV_CONTEXT_KEY, this.envContext);
        context.put("OperationName", "ModifyNicAttributes");
        context.put("APIName", "ModifyNicAttributes");
        context.put("ServiceName", "ModifyNicAttributes");
        context.put("RequestMethod", "GET");
        context.put("RequestURI", "/iaas/ModifyNicAttributes");

        input.setAction("ModifyNicAttributes");
        if (QCStringUtil.isEmpty(this.zone)) {
            input.setZone(this.envContext.getZone());
        } else {
            input.setZone(this.zone);
        }

        Object backModel = ResourceRequestFactory.getResourceRequest().sendApiRequest(context, input,ModifyNicAttributesOutput.class);
        if(backModel != null){
            return (ModifyNicAttributesOutput)backModel;
        }
        return null;
    }

     /**
       * @param input Request parameters and headers in the class
       * @param callback Response calls back when success
       * @throws QCException IOException or network error
       *
       * Documentation URL
       */
    @SuppressWarnings({"rawtypes", "unchecked"})
    public void modifyNicAttributes(ModifyNicAttributesInput input, ResponseCallBack callback) throws QCException {
        if (input == null) {
            input = new ModifyNicAttributesInput();
        }
        Map context = new HashMap();
        context.put(QCConstant.ENV_CONTEXT_KEY, this.envContext);
        context.put("OperationName", "ModifyNicAttributes");
        context.put("APIName", "ModifyNicAttributes");
        context.put("ServiceName", "ModifyNicAttributes");
        context.put("RequestMethod", "GET");
        context.put("RequestURI", "/iaas/ModifyNicAttributes");

        input.setAction("ModifyNicAttributes");
        if (QCStringUtil.isEmpty(this.zone)) {
            input.setZone(this.envContext.getZone());
        } else {
            input.setZone(this.zone);
        }

        if(callback == null) {
            throw new QCException("callback can't be null");
        }

        ResourceRequestFactory.getResourceRequest().sendApiRequestAsync(context,input,callback);
    }

    public static class ModifyNicAttributesInput extends IaasParamBody {
        // Required
        private String nIC;

        @JsonProperty(value = "nic")
        public void setNIC(String nIC) {
            this.nIC = nIC;
        }

        @JsonProperty(value = "nic")
        public String getNIC() {
            return this.nIC;
        }

        private String nICName;

        @JsonProperty(value = "nic_name")
        public void setNICName(String nICName) {
            this.nICName = nICName;
        }

        @JsonProperty(value = "nic_name")
        public String getNICName() {
            return this.nICName;
        }

        private String privateIP;

        @JsonProperty(value = "private_ip")
        public void setPrivateIP(String privateIP) {
            this.privateIP = privateIP;
        }

        @JsonProperty(value = "private_ip")
        public String getPrivateIP() {
            return this.privateIP;
        }

        private String vxNet;

        @JsonProperty(value = "vxnet")
        public void setVxNet(String vxNet) {
            this.vxNet = vxNet;
        }

        @JsonProperty(value = "vxnet")
        public String getVxNet() {
            return this.vxNet;
        }

        public String validateParam() throws QCException {
            if (QCStringUtil.isEmpty(this.getNIC())) {
                throw new QCException("NIC is required");
            }
            return null;
        }
    }

    @JsonIgnoreProperties(ignoreUnknown = true)
    public static class ModifyNicAttributesOutput extends OutputModel {
        private String action;

        @JsonProperty(value = "action")
        public void setAction(String action) {
            this.action = action;
        }

        @JsonProperty(value = "action")
        public String getAction() {
            return this.action;
        }

        private Integer retCode;

        @JsonProperty(value = "ret_code")
        public void setRetCode(Integer retCode) {
            this.retCode = retCode;
        }

        @JsonProperty(value = "ret_code")
        public Integer getRetCode() {
            return this.retCode;
        }

    }}























© 2015 - 2024 Weber Informatics LLC | Privacy Policy