diff --git a/sdk/src/main/java/org/zstack/sdk/UpdateAiModelCacheGlobalConfigAction.java b/sdk/src/main/java/org/zstack/sdk/UpdateAiModelCacheGlobalConfigAction.java new file mode 100644 index 00000000000..2a169c77b97 --- /dev/null +++ b/sdk/src/main/java/org/zstack/sdk/UpdateAiModelCacheGlobalConfigAction.java @@ -0,0 +1,101 @@ +package org.zstack.sdk; + +import java.util.HashMap; +import java.util.Map; +import org.zstack.sdk.*; + +public class UpdateAiModelCacheGlobalConfigAction extends AbstractAction { + + private static final HashMap parameterMap = new HashMap<>(); + + private static final HashMap nonAPIParameterMap = new HashMap<>(); + + public static class Result { + public ErrorCode error; + public org.zstack.sdk.UpdateAiModelCacheGlobalConfigResult value; + + public Result throwExceptionIfError() { + if (error != null) { + throw new ApiException( + String.format("error[code: %s, description: %s, details: %s, globalErrorCode: %s]", error.code, error.description, error.details, error.globalErrorCode) + ); + } + + return this; + } + } + + @Param(required = true, nonempty = false, nullElements = false, emptyString = true, noTrim = false) + public java.lang.Boolean enabled; + + @Param(required = false) + public java.util.List systemTags; + + @Param(required = false) + public java.util.List userTags; + + @Param(required = false) + public String sessionId; + + @Param(required = false) + public String accessKeyId; + + @Param(required = false) + public String accessKeySecret; + + @Param(required = false) + public String requestIp; + + @NonAPIParam + public long timeout = -1; + + @NonAPIParam + public long pollingInterval = -1; + + + private Result makeResult(ApiResult res) { + Result ret = new Result(); + if (res.error != null) { + ret.error = res.error; + return ret; + } + + org.zstack.sdk.UpdateAiModelCacheGlobalConfigResult value = res.getResult(org.zstack.sdk.UpdateAiModelCacheGlobalConfigResult.class); + ret.value = value == null ? new org.zstack.sdk.UpdateAiModelCacheGlobalConfigResult() : value; + + return ret; + } + + public Result call() { + ApiResult res = ZSClient.call(this); + return makeResult(res); + } + + public void call(final Completion completion) { + ZSClient.call(this, new InternalCompletion() { + @Override + public void complete(ApiResult res) { + completion.complete(makeResult(res)); + } + }); + } + + protected Map getParameterMap() { + return parameterMap; + } + + protected Map getNonAPIParameterMap() { + return nonAPIParameterMap; + } + + protected RestInfo getRestInfo() { + RestInfo info = new RestInfo(); + info.httpMethod = "PUT"; + info.path = "/ai/model-cache-global-config/actions"; + info.needSession = true; + info.needPoll = true; + info.parameterName = "updateAiModelCacheGlobalConfig"; + return info; + } + +} diff --git a/sdk/src/main/java/org/zstack/sdk/UpdateAiModelCacheGlobalConfigResult.java b/sdk/src/main/java/org/zstack/sdk/UpdateAiModelCacheGlobalConfigResult.java new file mode 100644 index 00000000000..16fb974026d --- /dev/null +++ b/sdk/src/main/java/org/zstack/sdk/UpdateAiModelCacheGlobalConfigResult.java @@ -0,0 +1,22 @@ +package org.zstack.sdk; + + + +public class UpdateAiModelCacheGlobalConfigResult { + public java.lang.Boolean virtiofsEnabled; + public void setVirtiofsEnabled(java.lang.Boolean virtiofsEnabled) { + this.virtiofsEnabled = virtiofsEnabled; + } + public java.lang.Boolean getVirtiofsEnabled() { + return this.virtiofsEnabled; + } + + public java.lang.Boolean modelCacheEnabled; + public void setModelCacheEnabled(java.lang.Boolean modelCacheEnabled) { + this.modelCacheEnabled = modelCacheEnabled; + } + public java.lang.Boolean getModelCacheEnabled() { + return this.modelCacheEnabled; + } + +} diff --git a/testlib/src/main/java/org/zstack/testlib/ApiHelper.groovy b/testlib/src/main/java/org/zstack/testlib/ApiHelper.groovy index 194f5e0937c..3f04cb0dd48 100644 --- a/testlib/src/main/java/org/zstack/testlib/ApiHelper.groovy +++ b/testlib/src/main/java/org/zstack/testlib/ApiHelper.groovy @@ -44686,6 +44686,33 @@ abstract class ApiHelper { } + def updateAiModelCacheGlobalConfig(@DelegatesTo(strategy = Closure.OWNER_FIRST, value = org.zstack.sdk.UpdateAiModelCacheGlobalConfigAction.class) Closure c) { + def a = new org.zstack.sdk.UpdateAiModelCacheGlobalConfigAction() + a.sessionId = Test.currentEnvSpec?.session?.uuid + c.resolveStrategy = Closure.OWNER_FIRST + c.delegate = a + c() + + + if (System.getProperty("apipath") != null) { + if (a.apiId == null) { + a.apiId = Platform.uuid + } + + def tracker = new ApiPathTracker(a.apiId) + def out = errorOut(a.call()) + def path = tracker.getApiPath() + if (!path.isEmpty()) { + Test.apiPaths[a.class.name] = path.join(" --->\n") + } + + return out + } else { + return errorOut(a.call()) + } + } + + def updateAliyunDisk(@DelegatesTo(strategy = Closure.OWNER_FIRST, value = org.zstack.sdk.UpdateAliyunDiskAction.class) Closure c) { def a = new org.zstack.sdk.UpdateAliyunDiskAction() a.sessionId = Test.currentEnvSpec?.session?.uuid