|
| 1 | +package org.zstack.sdk; |
| 2 | + |
| 3 | +import java.util.HashMap; |
| 4 | +import java.util.Map; |
| 5 | +import org.zstack.sdk.*; |
| 6 | + |
| 7 | +public class UpdateVmInstancePciDeviceSpecRefAction extends AbstractAction { |
| 8 | + |
| 9 | + private static final HashMap<String, Parameter> parameterMap = new HashMap<>(); |
| 10 | + |
| 11 | + private static final HashMap<String, Parameter> nonAPIParameterMap = new HashMap<>(); |
| 12 | + |
| 13 | + public static class Result { |
| 14 | + public ErrorCode error; |
| 15 | + public org.zstack.sdk.UpdateVmInstancePciDeviceSpecRefResult value; |
| 16 | + |
| 17 | + public Result throwExceptionIfError() { |
| 18 | + if (error != null) { |
| 19 | + throw new ApiException( |
| 20 | + String.format("error[code: %s, description: %s, details: %s, globalErrorCode: %s]", error.code, error.description, error.details, error.globalErrorCode) |
| 21 | + ); |
| 22 | + } |
| 23 | + |
| 24 | + return this; |
| 25 | + } |
| 26 | + } |
| 27 | + |
| 28 | + @Param(required = true, nonempty = false, nullElements = false, emptyString = true, noTrim = false) |
| 29 | + public java.lang.String pciSpecUuid; |
| 30 | + |
| 31 | + @Param(required = true, nonempty = false, nullElements = false, emptyString = true, noTrim = false) |
| 32 | + public java.lang.String vmInstanceUuid; |
| 33 | + |
| 34 | + @Param(required = true, nonempty = false, nullElements = false, emptyString = true, numberRange = {1L,100L}, noTrim = false) |
| 35 | + public int pciDeviceNumber = 0; |
| 36 | + |
| 37 | + @Param(required = false) |
| 38 | + public java.util.List systemTags; |
| 39 | + |
| 40 | + @Param(required = false) |
| 41 | + public java.util.List userTags; |
| 42 | + |
| 43 | + @Param(required = false) |
| 44 | + public String sessionId; |
| 45 | + |
| 46 | + @Param(required = false) |
| 47 | + public String accessKeyId; |
| 48 | + |
| 49 | + @Param(required = false) |
| 50 | + public String accessKeySecret; |
| 51 | + |
| 52 | + @Param(required = false) |
| 53 | + public String requestIp; |
| 54 | + |
| 55 | + @NonAPIParam |
| 56 | + public long timeout = -1; |
| 57 | + |
| 58 | + @NonAPIParam |
| 59 | + public long pollingInterval = -1; |
| 60 | + |
| 61 | + |
| 62 | + private Result makeResult(ApiResult res) { |
| 63 | + Result ret = new Result(); |
| 64 | + if (res.error != null) { |
| 65 | + ret.error = res.error; |
| 66 | + return ret; |
| 67 | + } |
| 68 | + |
| 69 | + org.zstack.sdk.UpdateVmInstancePciDeviceSpecRefResult value = res.getResult(org.zstack.sdk.UpdateVmInstancePciDeviceSpecRefResult.class); |
| 70 | + ret.value = value == null ? new org.zstack.sdk.UpdateVmInstancePciDeviceSpecRefResult() : value; |
| 71 | + |
| 72 | + return ret; |
| 73 | + } |
| 74 | + |
| 75 | + public Result call() { |
| 76 | + ApiResult res = ZSClient.call(this); |
| 77 | + return makeResult(res); |
| 78 | + } |
| 79 | + |
| 80 | + public void call(final Completion<Result> completion) { |
| 81 | + ZSClient.call(this, new InternalCompletion() { |
| 82 | + @Override |
| 83 | + public void complete(ApiResult res) { |
| 84 | + completion.complete(makeResult(res)); |
| 85 | + } |
| 86 | + }); |
| 87 | + } |
| 88 | + |
| 89 | + protected Map<String, Parameter> getParameterMap() { |
| 90 | + return parameterMap; |
| 91 | + } |
| 92 | + |
| 93 | + protected Map<String, Parameter> getNonAPIParameterMap() { |
| 94 | + return nonAPIParameterMap; |
| 95 | + } |
| 96 | + |
| 97 | + protected RestInfo getRestInfo() { |
| 98 | + RestInfo info = new RestInfo(); |
| 99 | + info.httpMethod = "PUT"; |
| 100 | + info.path = "/pci-device-specs/{pciSpecUuid}/vm-instances/{vmInstanceUuid}/actions"; |
| 101 | + info.needSession = true; |
| 102 | + info.needPoll = true; |
| 103 | + info.parameterName = "updateVmInstancePciDeviceSpecRef"; |
| 104 | + return info; |
| 105 | + } |
| 106 | + |
| 107 | +} |
0 commit comments