diff --git a/conf/db/zsv/V5.1.0__schema.sql b/conf/db/zsv/V5.1.0__schema.sql index 9ae3076078b..81372104de5 100644 --- a/conf/db/zsv/V5.1.0__schema.sql +++ b/conf/db/zsv/V5.1.0__schema.sql @@ -265,3 +265,47 @@ DELETE shadow FROM ImageCacheShadowVO shadow LEFT JOIN PrimaryStorageEO ps ON shadow.primaryStorageUuid = ps.uuid WHERE ps.uuid IS NULL; CALL ADD_CONSTRAINT('ImageCacheShadowVO', 'fkImageCacheShadowVOPrimaryStorageEOCascade', 'primaryStorageUuid', 'PrimaryStorageEO', 'uuid', 'CASCADE'); + +-- Feature: Platform Service deployment | ZSV-12505 + +CREATE TABLE IF NOT EXISTS `zstack`.`PlatformServicePackageVO` ( + `uuid` char(32) NOT NULL UNIQUE, + `name` varchar(255) DEFAULT NULL, + `description` varchar(2048) DEFAULT NULL, + `serviceType` varchar(32) NOT NULL, + `artifactType` varchar(32) NOT NULL, + `imageUuid` char(32) DEFAULT NULL, + `status` varchar(32) NOT NULL, + `version` varchar(255) DEFAULT NULL, + `activeApiId` varchar(255) DEFAULT NULL, + `lastError` varchar(4096) DEFAULT NULL, + `lastOpDate` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `createDate` timestamp NOT NULL DEFAULT '1999-12-31 23:59:59', + PRIMARY KEY (`uuid`), + INDEX `idxPlatformServicePackageVOServiceType` (`serviceType`), + INDEX `idxPlatformServicePackageVOImageUuid` (`imageUuid`), + INDEX `idxPlatformServicePackageVOStatus` (`status`), + INDEX `idxPlatformServicePackageVOActiveApiId` (`activeApiId`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +CREATE TABLE IF NOT EXISTS `zstack`.`PlatformServiceInstanceVO` ( + `uuid` char(32) NOT NULL UNIQUE, + `name` varchar(255) DEFAULT NULL, + `description` varchar(2048) DEFAULT NULL, + `serviceType` varchar(32) NOT NULL, + `packageUuid` char(32) NOT NULL, + `vmInstanceUuid` char(32) DEFAULT NULL, + `state` varchar(32) NOT NULL, + `healthStatus` varchar(32) NOT NULL, + `activeApiId` varchar(255) DEFAULT NULL, + `lastError` varchar(4096) DEFAULT NULL, + `lastHealthCheckTime` timestamp NULL DEFAULT NULL, + `lastOpDate` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `createDate` timestamp NOT NULL DEFAULT '1999-12-31 23:59:59', + PRIMARY KEY (`uuid`), + INDEX `idxPlatformServiceInstanceVOServiceType` (`serviceType`), + INDEX `idxPlatformServiceInstanceVOPackageUuid` (`packageUuid`), + INDEX `idxPlatformServiceInstanceVOVmInstanceUuid` (`vmInstanceUuid`), + INDEX `idxPlatformServiceInstanceVOState` (`state`), + INDEX `idxPlatformServiceInstanceVOActiveApiId` (`activeApiId`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; diff --git a/sdk/src/main/java/org/zstack/sdk/SourceClassMap.java b/sdk/src/main/java/org/zstack/sdk/SourceClassMap.java index 0ae7ff81342..40a774556f7 100644 --- a/sdk/src/main/java/org/zstack/sdk/SourceClassMap.java +++ b/sdk/src/main/java/org/zstack/sdk/SourceClassMap.java @@ -499,6 +499,8 @@ public class SourceClassMap { put("org.zstack.pciDevice.virtual.vfio_mdev.MdevDeviceState", "org.zstack.sdk.MdevDeviceState"); put("org.zstack.pciDevice.virtual.vfio_mdev.MdevDeviceStatus", "org.zstack.sdk.MdevDeviceStatus"); put("org.zstack.pciDevice.virtual.vfio_mdev.MdevDeviceType", "org.zstack.sdk.MdevDeviceType"); + put("org.zstack.platformservice.api.PlatformServiceInstanceInventory", "org.zstack.sdk.platformservice.PlatformServiceInstanceInventory"); + put("org.zstack.platformservice.api.PlatformServicePackageInventory", "org.zstack.sdk.platformservice.PlatformServicePackageInventory"); put("org.zstack.policyRoute.PolicyRouteRuleInventory", "org.zstack.sdk.PolicyRouteRuleInventory"); put("org.zstack.policyRoute.PolicyRouteRuleProtocol", "org.zstack.sdk.PolicyRouteRuleProtocol"); put("org.zstack.policyRoute.PolicyRouteRuleSetInventory", "org.zstack.sdk.PolicyRouteRuleSetInventory"); @@ -1314,6 +1316,8 @@ public class SourceClassMap { put("org.zstack.sdk.managements.common.ManagementNodeStatusView", "org.zstack.managements.entity.common.ManagementNodeStatusView"); put("org.zstack.sdk.managements.common.ManagementsStatusView", "org.zstack.managements.entity.common.ManagementsStatusView"); put("org.zstack.sdk.managements.ha2.ZSha2StatusView", "org.zstack.managements.entity.ha2.ZSha2StatusView"); + put("org.zstack.sdk.platformservice.PlatformServiceInstanceInventory", "org.zstack.platformservice.api.PlatformServiceInstanceInventory"); + put("org.zstack.sdk.platformservice.PlatformServicePackageInventory", "org.zstack.platformservice.api.PlatformServicePackageInventory"); put("org.zstack.sdk.sns.SNSApplicationEndpointInventory", "org.zstack.sns.SNSApplicationEndpointInventory"); put("org.zstack.sdk.sns.SNSApplicationPlatformInventory", "org.zstack.sns.SNSApplicationPlatformInventory"); put("org.zstack.sdk.sns.SNSSmsEndpointInventory", "org.zstack.sns.SNSSmsEndpointInventory"); diff --git a/sdk/src/main/java/org/zstack/sdk/platformservice/CheckPlatformServiceHealthAction.java b/sdk/src/main/java/org/zstack/sdk/platformservice/CheckPlatformServiceHealthAction.java new file mode 100644 index 00000000000..2961c0e8a62 --- /dev/null +++ b/sdk/src/main/java/org/zstack/sdk/platformservice/CheckPlatformServiceHealthAction.java @@ -0,0 +1,101 @@ +package org.zstack.sdk.platformservice; + +import java.util.HashMap; +import java.util.Map; +import org.zstack.sdk.*; + +public class CheckPlatformServiceHealthAction 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.platformservice.CheckPlatformServiceHealthResult value; + + public Result throwExceptionIfError() { + if (error != null) { + throw new ApiException( + String.format("error[code: %s, description: %s, details: %s]", error.code, error.description, error.details) + ); + } + + return this; + } + } + + @Param(required = true, nonempty = false, nullElements = false, emptyString = true, noTrim = false) + public java.lang.String uuid; + + @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.platformservice.CheckPlatformServiceHealthResult value = res.getResult(org.zstack.sdk.platformservice.CheckPlatformServiceHealthResult.class); + ret.value = value == null ? new org.zstack.sdk.platformservice.CheckPlatformServiceHealthResult() : 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 = "/platform-services/instances/{uuid}/actions"; + info.needSession = true; + info.needPoll = true; + info.parameterName = "checkPlatformServiceHealth"; + return info; + } + +} diff --git a/sdk/src/main/java/org/zstack/sdk/platformservice/CheckPlatformServiceHealthResult.java b/sdk/src/main/java/org/zstack/sdk/platformservice/CheckPlatformServiceHealthResult.java new file mode 100644 index 00000000000..9fab0a32a21 --- /dev/null +++ b/sdk/src/main/java/org/zstack/sdk/platformservice/CheckPlatformServiceHealthResult.java @@ -0,0 +1,14 @@ +package org.zstack.sdk.platformservice; + +import org.zstack.sdk.platformservice.PlatformServiceInstanceInventory; + +public class CheckPlatformServiceHealthResult { + public PlatformServiceInstanceInventory inventory; + public void setInventory(PlatformServiceInstanceInventory inventory) { + this.inventory = inventory; + } + public PlatformServiceInstanceInventory getInventory() { + return this.inventory; + } + +} diff --git a/sdk/src/main/java/org/zstack/sdk/platformservice/DeletePlatformServicePackageAction.java b/sdk/src/main/java/org/zstack/sdk/platformservice/DeletePlatformServicePackageAction.java new file mode 100644 index 00000000000..b1a92ba2673 --- /dev/null +++ b/sdk/src/main/java/org/zstack/sdk/platformservice/DeletePlatformServicePackageAction.java @@ -0,0 +1,104 @@ +package org.zstack.sdk.platformservice; + +import java.util.HashMap; +import java.util.Map; +import org.zstack.sdk.*; + +public class DeletePlatformServicePackageAction 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.platformservice.DeletePlatformServicePackageResult value; + + public Result throwExceptionIfError() { + if (error != null) { + throw new ApiException( + String.format("error[code: %s, description: %s, details: %s]", error.code, error.description, error.details) + ); + } + + return this; + } + } + + @Param(required = true, nonempty = false, nullElements = false, emptyString = true, noTrim = false) + public java.lang.String uuid; + + @Param(required = false) + public java.lang.String deleteMode = "Permissive"; + + @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.platformservice.DeletePlatformServicePackageResult value = res.getResult(org.zstack.sdk.platformservice.DeletePlatformServicePackageResult.class); + ret.value = value == null ? new org.zstack.sdk.platformservice.DeletePlatformServicePackageResult() : 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 = "DELETE"; + info.path = "/platform-services/packages/{uuid}"; + info.needSession = true; + info.needPoll = true; + info.parameterName = ""; + return info; + } + +} diff --git a/sdk/src/main/java/org/zstack/sdk/platformservice/DeletePlatformServicePackageResult.java b/sdk/src/main/java/org/zstack/sdk/platformservice/DeletePlatformServicePackageResult.java new file mode 100644 index 00000000000..73d3bde551f --- /dev/null +++ b/sdk/src/main/java/org/zstack/sdk/platformservice/DeletePlatformServicePackageResult.java @@ -0,0 +1,7 @@ +package org.zstack.sdk.platformservice; + + + +public class DeletePlatformServicePackageResult { + +} diff --git a/sdk/src/main/java/org/zstack/sdk/platformservice/DeployPlatformServiceAction.java b/sdk/src/main/java/org/zstack/sdk/platformservice/DeployPlatformServiceAction.java new file mode 100644 index 00000000000..75a7bcf2135 --- /dev/null +++ b/sdk/src/main/java/org/zstack/sdk/platformservice/DeployPlatformServiceAction.java @@ -0,0 +1,131 @@ +package org.zstack.sdk.platformservice; + +import java.util.HashMap; +import java.util.Map; +import org.zstack.sdk.*; + +public class DeployPlatformServiceAction 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.platformservice.DeployPlatformServiceResult value; + + public Result throwExceptionIfError() { + if (error != null) { + throw new ApiException( + String.format("error[code: %s, description: %s, details: %s]", error.code, error.description, error.details) + ); + } + + return this; + } + } + + @Param(required = true, nonempty = false, nullElements = false, emptyString = true, noTrim = false) + public java.lang.String packageUuid; + + @Param(required = false, maxLength = 255, nonempty = false, nullElements = false, emptyString = true, noTrim = false) + public java.lang.String name; + + @Param(required = false, maxLength = 2048, nonempty = false, nullElements = false, emptyString = true, noTrim = false) + public java.lang.String description; + + @Param(required = true, nonempty = false, nullElements = false, emptyString = true, numberRange = {1L,2147483647L}, noTrim = false) + public java.lang.Integer cpuNum; + + @Param(required = true, nonempty = false, nullElements = false, emptyString = true, numberRange = {1L,9223372036854775807L}, noTrim = false) + public java.lang.Long memorySize; + + @Param(required = true, nonempty = true, nullElements = false, emptyString = true, noTrim = false) + public java.util.List l3NetworkUuids; + + @Param(required = false, nonempty = false, nullElements = false, emptyString = true, noTrim = false) + public java.lang.String staticIp; + + @Param(required = false, nonempty = false, nullElements = false, emptyString = true, noTrim = false) + public java.lang.String clusterUuid; + + @Param(required = false, nonempty = false, nullElements = false, emptyString = true, noTrim = false) + public java.lang.String hostUuid; + + @Param(required = false, nonempty = false, nullElements = false, emptyString = true, noTrim = false) + public java.lang.String primaryStorageUuidForRootVolume; + + @Param(required = false, maxLength = 255, nonempty = false, nullElements = false, emptyString = true, noTrim = false) + public java.lang.String allocatorStrategy; + + @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.platformservice.DeployPlatformServiceResult value = res.getResult(org.zstack.sdk.platformservice.DeployPlatformServiceResult.class); + ret.value = value == null ? new org.zstack.sdk.platformservice.DeployPlatformServiceResult() : 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 = "/platform-services/packages/{packageUuid}/actions"; + info.needSession = true; + info.needPoll = true; + info.parameterName = "deployPlatformService"; + return info; + } + +} diff --git a/sdk/src/main/java/org/zstack/sdk/platformservice/DeployPlatformServiceResult.java b/sdk/src/main/java/org/zstack/sdk/platformservice/DeployPlatformServiceResult.java new file mode 100644 index 00000000000..d052576f83f --- /dev/null +++ b/sdk/src/main/java/org/zstack/sdk/platformservice/DeployPlatformServiceResult.java @@ -0,0 +1,14 @@ +package org.zstack.sdk.platformservice; + +import org.zstack.sdk.platformservice.PlatformServiceInstanceInventory; + +public class DeployPlatformServiceResult { + public PlatformServiceInstanceInventory inventory; + public void setInventory(PlatformServiceInstanceInventory inventory) { + this.inventory = inventory; + } + public PlatformServiceInstanceInventory getInventory() { + return this.inventory; + } + +} diff --git a/sdk/src/main/java/org/zstack/sdk/platformservice/GetPlatformServiceInstancesAction.java b/sdk/src/main/java/org/zstack/sdk/platformservice/GetPlatformServiceInstancesAction.java new file mode 100644 index 00000000000..716aa297706 --- /dev/null +++ b/sdk/src/main/java/org/zstack/sdk/platformservice/GetPlatformServiceInstancesAction.java @@ -0,0 +1,95 @@ +package org.zstack.sdk.platformservice; + +import java.util.HashMap; +import java.util.Map; +import org.zstack.sdk.*; + +public class GetPlatformServiceInstancesAction 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.platformservice.GetPlatformServiceInstancesResult value; + + public Result throwExceptionIfError() { + if (error != null) { + throw new ApiException( + String.format("error[code: %s, description: %s, details: %s]", error.code, error.description, error.details) + ); + } + + return this; + } + } + + @Param(required = false, validValues = {"ZCenter","ZLR"}, nonempty = false, nullElements = false, emptyString = true, noTrim = false) + public java.lang.String serviceType; + + @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; + + + private Result makeResult(ApiResult res) { + Result ret = new Result(); + if (res.error != null) { + ret.error = res.error; + return ret; + } + + org.zstack.sdk.platformservice.GetPlatformServiceInstancesResult value = res.getResult(org.zstack.sdk.platformservice.GetPlatformServiceInstancesResult.class); + ret.value = value == null ? new org.zstack.sdk.platformservice.GetPlatformServiceInstancesResult() : 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 = "GET"; + info.path = "/platform-services/instances"; + info.needSession = true; + info.needPoll = false; + info.parameterName = ""; + return info; + } + +} diff --git a/sdk/src/main/java/org/zstack/sdk/platformservice/GetPlatformServiceInstancesResult.java b/sdk/src/main/java/org/zstack/sdk/platformservice/GetPlatformServiceInstancesResult.java new file mode 100644 index 00000000000..0a73f7cdc7a --- /dev/null +++ b/sdk/src/main/java/org/zstack/sdk/platformservice/GetPlatformServiceInstancesResult.java @@ -0,0 +1,14 @@ +package org.zstack.sdk.platformservice; + + + +public class GetPlatformServiceInstancesResult { + public java.util.List inventories; + public void setInventories(java.util.List inventories) { + this.inventories = inventories; + } + public java.util.List getInventories() { + return this.inventories; + } + +} diff --git a/sdk/src/main/java/org/zstack/sdk/platformservice/GetPlatformServiceVmInstancesAction.java b/sdk/src/main/java/org/zstack/sdk/platformservice/GetPlatformServiceVmInstancesAction.java new file mode 100644 index 00000000000..87abd657754 --- /dev/null +++ b/sdk/src/main/java/org/zstack/sdk/platformservice/GetPlatformServiceVmInstancesAction.java @@ -0,0 +1,95 @@ +package org.zstack.sdk.platformservice; + +import java.util.HashMap; +import java.util.Map; +import org.zstack.sdk.*; + +public class GetPlatformServiceVmInstancesAction 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.platformservice.GetPlatformServiceVmInstancesResult value; + + public Result throwExceptionIfError() { + if (error != null) { + throw new ApiException( + String.format("error[code: %s, description: %s, details: %s]", error.code, error.description, error.details) + ); + } + + return this; + } + } + + @Param(required = true, nonempty = false, nullElements = false, emptyString = true, noTrim = false) + public java.lang.String uuid; + + @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; + + + private Result makeResult(ApiResult res) { + Result ret = new Result(); + if (res.error != null) { + ret.error = res.error; + return ret; + } + + org.zstack.sdk.platformservice.GetPlatformServiceVmInstancesResult value = res.getResult(org.zstack.sdk.platformservice.GetPlatformServiceVmInstancesResult.class); + ret.value = value == null ? new org.zstack.sdk.platformservice.GetPlatformServiceVmInstancesResult() : 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 = "GET"; + info.path = "/platform-services/instances/{uuid}/vm-instances"; + info.needSession = true; + info.needPoll = false; + info.parameterName = ""; + return info; + } + +} diff --git a/sdk/src/main/java/org/zstack/sdk/platformservice/GetPlatformServiceVmInstancesResult.java b/sdk/src/main/java/org/zstack/sdk/platformservice/GetPlatformServiceVmInstancesResult.java new file mode 100644 index 00000000000..415813e5087 --- /dev/null +++ b/sdk/src/main/java/org/zstack/sdk/platformservice/GetPlatformServiceVmInstancesResult.java @@ -0,0 +1,14 @@ +package org.zstack.sdk.platformservice; + + + +public class GetPlatformServiceVmInstancesResult { + public java.util.List inventories; + public void setInventories(java.util.List inventories) { + this.inventories = inventories; + } + public java.util.List getInventories() { + return this.inventories; + } + +} diff --git a/sdk/src/main/java/org/zstack/sdk/platformservice/PlatformServiceInstanceInventory.java b/sdk/src/main/java/org/zstack/sdk/platformservice/PlatformServiceInstanceInventory.java new file mode 100644 index 00000000000..699995f6405 --- /dev/null +++ b/sdk/src/main/java/org/zstack/sdk/platformservice/PlatformServiceInstanceInventory.java @@ -0,0 +1,151 @@ +package org.zstack.sdk.platformservice; + + + +public class PlatformServiceInstanceInventory { + + public java.lang.String uuid; + public void setUuid(java.lang.String uuid) { + this.uuid = uuid; + } + public java.lang.String getUuid() { + return this.uuid; + } + + public java.lang.String name; + public void setName(java.lang.String name) { + this.name = name; + } + public java.lang.String getName() { + return this.name; + } + + public java.lang.String description; + public void setDescription(java.lang.String description) { + this.description = description; + } + public java.lang.String getDescription() { + return this.description; + } + + public java.lang.String serviceType; + public void setServiceType(java.lang.String serviceType) { + this.serviceType = serviceType; + } + public java.lang.String getServiceType() { + return this.serviceType; + } + + public java.lang.String packageUuid; + public void setPackageUuid(java.lang.String packageUuid) { + this.packageUuid = packageUuid; + } + public java.lang.String getPackageUuid() { + return this.packageUuid; + } + + public java.lang.String vmInstanceUuid; + public void setVmInstanceUuid(java.lang.String vmInstanceUuid) { + this.vmInstanceUuid = vmInstanceUuid; + } + public java.lang.String getVmInstanceUuid() { + return this.vmInstanceUuid; + } + + public java.lang.String state; + public void setState(java.lang.String state) { + this.state = state; + } + public java.lang.String getState() { + return this.state; + } + + public java.lang.String healthStatus; + public void setHealthStatus(java.lang.String healthStatus) { + this.healthStatus = healthStatus; + } + public java.lang.String getHealthStatus() { + return this.healthStatus; + } + + public java.lang.String operationState; + public void setOperationState(java.lang.String operationState) { + this.operationState = operationState; + } + public java.lang.String getOperationState() { + return this.operationState; + } + + public java.lang.String currentStage; + public void setCurrentStage(java.lang.String currentStage) { + this.currentStage = currentStage; + } + public java.lang.String getCurrentStage() { + return this.currentStage; + } + + public java.lang.Integer currentStageIndex; + public void setCurrentStageIndex(java.lang.Integer currentStageIndex) { + this.currentStageIndex = currentStageIndex; + } + public java.lang.Integer getCurrentStageIndex() { + return this.currentStageIndex; + } + + public java.lang.Integer totalStages; + public void setTotalStages(java.lang.Integer totalStages) { + this.totalStages = totalStages; + } + public java.lang.Integer getTotalStages() { + return this.totalStages; + } + + public java.lang.Integer progress; + public void setProgress(java.lang.Integer progress) { + this.progress = progress; + } + public java.lang.Integer getProgress() { + return this.progress; + } + + public java.lang.String currentStep; + public void setCurrentStep(java.lang.String currentStep) { + this.currentStep = currentStep; + } + public java.lang.String getCurrentStep() { + return this.currentStep; + } + + public java.lang.String lastError; + public void setLastError(java.lang.String lastError) { + this.lastError = lastError; + } + public java.lang.String getLastError() { + return this.lastError; + } + + public java.sql.Timestamp lastHealthCheckTime; + public void setLastHealthCheckTime(java.sql.Timestamp lastHealthCheckTime) { + this.lastHealthCheckTime = lastHealthCheckTime; + } + public java.sql.Timestamp getLastHealthCheckTime() { + return this.lastHealthCheckTime; + } + + public java.sql.Timestamp createDate; + public void setCreateDate(java.sql.Timestamp createDate) { + this.createDate = createDate; + } + public java.sql.Timestamp getCreateDate() { + return this.createDate; + } + + public java.sql.Timestamp lastOpDate; + public void setLastOpDate(java.sql.Timestamp lastOpDate) { + this.lastOpDate = lastOpDate; + } + public java.sql.Timestamp getLastOpDate() { + return this.lastOpDate; + } + +} diff --git a/sdk/src/main/java/org/zstack/sdk/platformservice/PlatformServicePackageInventory.java b/sdk/src/main/java/org/zstack/sdk/platformservice/PlatformServicePackageInventory.java new file mode 100644 index 00000000000..73313796078 --- /dev/null +++ b/sdk/src/main/java/org/zstack/sdk/platformservice/PlatformServicePackageInventory.java @@ -0,0 +1,143 @@ +package org.zstack.sdk.platformservice; + + + +public class PlatformServicePackageInventory { + + public java.lang.String uuid; + public void setUuid(java.lang.String uuid) { + this.uuid = uuid; + } + public java.lang.String getUuid() { + return this.uuid; + } + + public java.lang.String name; + public void setName(java.lang.String name) { + this.name = name; + } + public java.lang.String getName() { + return this.name; + } + + public java.lang.String description; + public void setDescription(java.lang.String description) { + this.description = description; + } + public java.lang.String getDescription() { + return this.description; + } + + public java.lang.String serviceType; + public void setServiceType(java.lang.String serviceType) { + this.serviceType = serviceType; + } + public java.lang.String getServiceType() { + return this.serviceType; + } + + public java.lang.String artifactType; + public void setArtifactType(java.lang.String artifactType) { + this.artifactType = artifactType; + } + public java.lang.String getArtifactType() { + return this.artifactType; + } + + public java.lang.String imageUuid; + public void setImageUuid(java.lang.String imageUuid) { + this.imageUuid = imageUuid; + } + public java.lang.String getImageUuid() { + return this.imageUuid; + } + + public java.lang.String status; + public void setStatus(java.lang.String status) { + this.status = status; + } + public java.lang.String getStatus() { + return this.status; + } + + public java.lang.String version; + public void setVersion(java.lang.String version) { + this.version = version; + } + public java.lang.String getVersion() { + return this.version; + } + + public java.lang.String operationState; + public void setOperationState(java.lang.String operationState) { + this.operationState = operationState; + } + public java.lang.String getOperationState() { + return this.operationState; + } + + public java.lang.String currentStage; + public void setCurrentStage(java.lang.String currentStage) { + this.currentStage = currentStage; + } + public java.lang.String getCurrentStage() { + return this.currentStage; + } + + public java.lang.Integer currentStageIndex; + public void setCurrentStageIndex(java.lang.Integer currentStageIndex) { + this.currentStageIndex = currentStageIndex; + } + public java.lang.Integer getCurrentStageIndex() { + return this.currentStageIndex; + } + + public java.lang.Integer totalStages; + public void setTotalStages(java.lang.Integer totalStages) { + this.totalStages = totalStages; + } + public java.lang.Integer getTotalStages() { + return this.totalStages; + } + + public java.lang.Integer progress; + public void setProgress(java.lang.Integer progress) { + this.progress = progress; + } + public java.lang.Integer getProgress() { + return this.progress; + } + + public java.lang.String currentStep; + public void setCurrentStep(java.lang.String currentStep) { + this.currentStep = currentStep; + } + public java.lang.String getCurrentStep() { + return this.currentStep; + } + + public java.lang.String lastError; + public void setLastError(java.lang.String lastError) { + this.lastError = lastError; + } + public java.lang.String getLastError() { + return this.lastError; + } + + public java.sql.Timestamp createDate; + public void setCreateDate(java.sql.Timestamp createDate) { + this.createDate = createDate; + } + public java.sql.Timestamp getCreateDate() { + return this.createDate; + } + + public java.sql.Timestamp lastOpDate; + public void setLastOpDate(java.sql.Timestamp lastOpDate) { + this.lastOpDate = lastOpDate; + } + public java.sql.Timestamp getLastOpDate() { + return this.lastOpDate; + } + +} diff --git a/sdk/src/main/java/org/zstack/sdk/platformservice/QueryPlatformServicePackageAction.java b/sdk/src/main/java/org/zstack/sdk/platformservice/QueryPlatformServicePackageAction.java new file mode 100644 index 00000000000..ac626695782 --- /dev/null +++ b/sdk/src/main/java/org/zstack/sdk/platformservice/QueryPlatformServicePackageAction.java @@ -0,0 +1,75 @@ +package org.zstack.sdk.platformservice; + +import java.util.HashMap; +import java.util.Map; +import org.zstack.sdk.*; + +public class QueryPlatformServicePackageAction extends QueryAction { + + 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.platformservice.QueryPlatformServicePackageResult value; + + public Result throwExceptionIfError() { + if (error != null) { + throw new ApiException( + String.format("error[code: %s, description: %s, details: %s]", error.code, error.description, error.details) + ); + } + + return this; + } + } + + + + private Result makeResult(ApiResult res) { + Result ret = new Result(); + if (res.error != null) { + ret.error = res.error; + return ret; + } + + org.zstack.sdk.platformservice.QueryPlatformServicePackageResult value = res.getResult(org.zstack.sdk.platformservice.QueryPlatformServicePackageResult.class); + ret.value = value == null ? new org.zstack.sdk.platformservice.QueryPlatformServicePackageResult() : 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 = "GET"; + info.path = "/platform-services/packages"; + info.needSession = true; + info.needPoll = false; + info.parameterName = ""; + return info; + } + +} diff --git a/sdk/src/main/java/org/zstack/sdk/platformservice/QueryPlatformServicePackageResult.java b/sdk/src/main/java/org/zstack/sdk/platformservice/QueryPlatformServicePackageResult.java new file mode 100644 index 00000000000..44ee3e1c773 --- /dev/null +++ b/sdk/src/main/java/org/zstack/sdk/platformservice/QueryPlatformServicePackageResult.java @@ -0,0 +1,22 @@ +package org.zstack.sdk.platformservice; + + + +public class QueryPlatformServicePackageResult { + public java.util.List inventories; + public void setInventories(java.util.List inventories) { + this.inventories = inventories; + } + public java.util.List getInventories() { + return this.inventories; + } + + public java.lang.Long total; + public void setTotal(java.lang.Long total) { + this.total = total; + } + public java.lang.Long getTotal() { + return this.total; + } + +} diff --git a/sdk/src/main/java/org/zstack/sdk/platformservice/UndeployPlatformServiceAction.java b/sdk/src/main/java/org/zstack/sdk/platformservice/UndeployPlatformServiceAction.java new file mode 100644 index 00000000000..dfece2a3176 --- /dev/null +++ b/sdk/src/main/java/org/zstack/sdk/platformservice/UndeployPlatformServiceAction.java @@ -0,0 +1,101 @@ +package org.zstack.sdk.platformservice; + +import java.util.HashMap; +import java.util.Map; +import org.zstack.sdk.*; + +public class UndeployPlatformServiceAction 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.platformservice.UndeployPlatformServiceResult value; + + public Result throwExceptionIfError() { + if (error != null) { + throw new ApiException( + String.format("error[code: %s, description: %s, details: %s]", error.code, error.description, error.details) + ); + } + + return this; + } + } + + @Param(required = true, nonempty = false, nullElements = false, emptyString = true, noTrim = false) + public java.lang.String uuid; + + @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.platformservice.UndeployPlatformServiceResult value = res.getResult(org.zstack.sdk.platformservice.UndeployPlatformServiceResult.class); + ret.value = value == null ? new org.zstack.sdk.platformservice.UndeployPlatformServiceResult() : 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 = "/platform-services/instances/{uuid}/actions"; + info.needSession = true; + info.needPoll = true; + info.parameterName = "undeployPlatformService"; + return info; + } + +} diff --git a/sdk/src/main/java/org/zstack/sdk/platformservice/UndeployPlatformServiceResult.java b/sdk/src/main/java/org/zstack/sdk/platformservice/UndeployPlatformServiceResult.java new file mode 100644 index 00000000000..c9d2ee330a3 --- /dev/null +++ b/sdk/src/main/java/org/zstack/sdk/platformservice/UndeployPlatformServiceResult.java @@ -0,0 +1,14 @@ +package org.zstack.sdk.platformservice; + +import org.zstack.sdk.platformservice.PlatformServiceInstanceInventory; + +public class UndeployPlatformServiceResult { + public PlatformServiceInstanceInventory inventory; + public void setInventory(PlatformServiceInstanceInventory inventory) { + this.inventory = inventory; + } + public PlatformServiceInstanceInventory getInventory() { + return this.inventory; + } + +} diff --git a/sdk/src/main/java/org/zstack/sdk/platformservice/UploadPlatformServicePackageAction.java b/sdk/src/main/java/org/zstack/sdk/platformservice/UploadPlatformServicePackageAction.java new file mode 100644 index 00000000000..691266b3637 --- /dev/null +++ b/sdk/src/main/java/org/zstack/sdk/platformservice/UploadPlatformServicePackageAction.java @@ -0,0 +1,125 @@ +package org.zstack.sdk.platformservice; + +import java.util.HashMap; +import java.util.Map; +import org.zstack.sdk.*; + +public class UploadPlatformServicePackageAction 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.platformservice.UploadPlatformServicePackageResult value; + + public Result throwExceptionIfError() { + if (error != null) { + throw new ApiException( + String.format("error[code: %s, description: %s, details: %s]", error.code, error.description, error.details) + ); + } + + return this; + } + } + + @Param(required = true, maxLength = 255, nonempty = false, nullElements = false, emptyString = true, noTrim = false) + public java.lang.String name; + + @Param(required = false, maxLength = 2048, nonempty = false, nullElements = false, emptyString = true, noTrim = false) + public java.lang.String description; + + @Param(required = true, validValues = {"ZCenter","ZLR"}, nonempty = false, nullElements = false, emptyString = true, noTrim = false) + public java.lang.String serviceType; + + @Param(required = false, validValues = {"Qcow2"}, nonempty = false, nullElements = false, emptyString = true, noTrim = false) + public java.lang.String artifactType = "Qcow2"; + + @Param(required = false, maxLength = 255, nonempty = false, nullElements = false, emptyString = true, noTrim = false) + public java.lang.String version; + + @Param(required = true, maxLength = 2048, nonempty = false, nullElements = false, emptyString = true, noTrim = false) + public java.lang.String url; + + @Param(required = false, nonempty = false, nullElements = false, emptyString = true, noTrim = false) + public java.lang.String backupStorageUuid; + + @Param(required = false) + public java.lang.String resourceUuid; + + @Param(required = false, nonempty = false, nullElements = false, emptyString = true, noTrim = false) + public java.util.List tagUuids; + + @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.platformservice.UploadPlatformServicePackageResult value = res.getResult(org.zstack.sdk.platformservice.UploadPlatformServicePackageResult.class); + ret.value = value == null ? new org.zstack.sdk.platformservice.UploadPlatformServicePackageResult() : 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 = "/platform-services/packages/actions"; + info.needSession = true; + info.needPoll = true; + info.parameterName = "uploadPlatformServicePackage"; + return info; + } + +} diff --git a/sdk/src/main/java/org/zstack/sdk/platformservice/UploadPlatformServicePackageResult.java b/sdk/src/main/java/org/zstack/sdk/platformservice/UploadPlatformServicePackageResult.java new file mode 100644 index 00000000000..bbf4359a933 --- /dev/null +++ b/sdk/src/main/java/org/zstack/sdk/platformservice/UploadPlatformServicePackageResult.java @@ -0,0 +1,14 @@ +package org.zstack.sdk.platformservice; + +import org.zstack.sdk.platformservice.PlatformServicePackageInventory; + +public class UploadPlatformServicePackageResult { + public PlatformServicePackageInventory inventory; + public void setInventory(PlatformServicePackageInventory inventory) { + this.inventory = inventory; + } + public PlatformServicePackageInventory getInventory() { + return this.inventory; + } + +} diff --git a/testlib/src/main/java/org/zstack/testlib/ApiHelper.groovy b/testlib/src/main/java/org/zstack/testlib/ApiHelper.groovy index 766461a78cc..73e84f378e7 100644 --- a/testlib/src/main/java/org/zstack/testlib/ApiHelper.groovy +++ b/testlib/src/main/java/org/zstack/testlib/ApiHelper.groovy @@ -37804,6 +37804,224 @@ abstract class ApiHelper { } + def checkPlatformServiceHealth(@DelegatesTo(strategy = Closure.OWNER_FIRST, value = org.zstack.sdk.platformservice.CheckPlatformServiceHealthAction.class) Closure c) { + def a = new org.zstack.sdk.platformservice.CheckPlatformServiceHealthAction() + 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 deletePlatformServicePackage(@DelegatesTo(strategy = Closure.OWNER_FIRST, value = org.zstack.sdk.platformservice.DeletePlatformServicePackageAction.class) Closure c) { + def a = new org.zstack.sdk.platformservice.DeletePlatformServicePackageAction() + 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 deployPlatformService(@DelegatesTo(strategy = Closure.OWNER_FIRST, value = org.zstack.sdk.platformservice.DeployPlatformServiceAction.class) Closure c) { + def a = new org.zstack.sdk.platformservice.DeployPlatformServiceAction() + 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 getPlatformServiceInstances(@DelegatesTo(strategy = Closure.OWNER_FIRST, value = org.zstack.sdk.platformservice.GetPlatformServiceInstancesAction.class) Closure c) { + def a = new org.zstack.sdk.platformservice.GetPlatformServiceInstancesAction() + 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 getPlatformServiceVmInstances(@DelegatesTo(strategy = Closure.OWNER_FIRST, value = org.zstack.sdk.platformservice.GetPlatformServiceVmInstancesAction.class) Closure c) { + def a = new org.zstack.sdk.platformservice.GetPlatformServiceVmInstancesAction() + 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 queryPlatformServicePackage(@DelegatesTo(strategy = Closure.OWNER_FIRST, value = org.zstack.sdk.platformservice.QueryPlatformServicePackageAction.class) Closure c) { + def a = new org.zstack.sdk.platformservice.QueryPlatformServicePackageAction() + a.sessionId = Test.currentEnvSpec?.session?.uuid + c.resolveStrategy = Closure.OWNER_FIRST + c.delegate = a + c() + + a.conditions = a.conditions.collect { it.toString() } + + + 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 undeployPlatformService(@DelegatesTo(strategy = Closure.OWNER_FIRST, value = org.zstack.sdk.platformservice.UndeployPlatformServiceAction.class) Closure c) { + def a = new org.zstack.sdk.platformservice.UndeployPlatformServiceAction() + 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 uploadPlatformServicePackage(@DelegatesTo(strategy = Closure.OWNER_FIRST, value = org.zstack.sdk.platformservice.UploadPlatformServicePackageAction.class) Closure c) { + def a = new org.zstack.sdk.platformservice.UploadPlatformServicePackageAction() + 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 addSNSSmsReceiver(@DelegatesTo(strategy = Closure.OWNER_FIRST, value = org.zstack.sdk.sns.AddSNSSmsReceiverAction.class) Closure c) { def a = new org.zstack.sdk.sns.AddSNSSmsReceiverAction() a.sessionId = Test.currentEnvSpec?.session?.uuid @@ -43136,19 +43354,20 @@ abstract class ApiHelper { 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()) @@ -43162,21 +43381,22 @@ abstract class ApiHelper { c.resolveStrategy = Closure.OWNER_FIRST c.delegate = a c() - + a.conditions = a.conditions.collect { it.toString() } + 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()) @@ -43190,19 +43410,20 @@ abstract class ApiHelper { 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()) @@ -43216,19 +43437,20 @@ abstract class ApiHelper { 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())