From 44b238d4efae9faaf6554829ae3c7cc3f9848ae0 Mon Sep 17 00:00:00 2001
From: wenzt <wenzt@engine.wenzt.com>
Date: Thu, 12 Apr 2018 20:09:53 +0800
Subject: [PATCH] mytest rest api

Signed-off-by: wenzt <wenzt@engine.wenzt.com>
---
 .../restapi/resource/BackendVmMytestsResource.java | 47 ++++++++++++++++++++++
 .../api/restapi/resource/BackendVmResource.java    | 17 ++++++++
 .../restapi/resource/aaa/BackendUserResource.java  |  6 +++
 pom.xml                                            |  2 +-
 4 files changed, 71 insertions(+), 1 deletion(-)
 create mode 100644 backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendVmMytestsResource.java

diff --git a/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendVmMytestsResource.java b/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendVmMytestsResource.java
new file mode 100644
index 0000000..d22b8c6
--- /dev/null
+++ b/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendVmMytestsResource.java
@@ -0,0 +1,47 @@
+package org.ovirt.engine.api.restapi.resource;
+
+import javax.ws.rs.core.Response;
+
+import org.ovirt.engine.api.model.Mytest;
+import org.ovirt.engine.api.resource.VmMytestResource;
+import org.ovirt.engine.core.common.businessentities.VM;
+import org.ovirt.engine.core.common.queries.IdQueryParameters;
+import org.ovirt.engine.core.common.queries.QueryType;
+import org.ovirt.engine.core.compat.Guid;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+
+public class BackendVmMytestsResource extends AbstractBackendResource<Mytest, VM> implements VmMytestResource{
+    private Logger log = LoggerFactory.getLogger(BackendVmMytestsResource.class);
+    private  Guid vmId;
+    public BackendVmMytestsResource(Guid guid){
+        super(Mytest.class, VM.class);
+        this.vmId = guid;
+        log.info("@logccccccccccccccccccc");
+    }
+
+    @Override
+    public Mytest get() {
+        log.info("@logxxxxxxxxxxxxxxxxxx");
+        VM vm = getVm();
+        return null;
+    }
+
+    @Override
+    public Response add(Mytest test) {
+        Response resp = Response.status(200).entity("hello").build();
+        return resp;
+    }
+
+    private VM getVm() {
+        return getEntity(
+            VM.class,
+            QueryType.GetVmByVmId,
+            new IdQueryParameters(vmId),
+            vmId.toString(),
+            true
+        );
+    }
+}
diff --git a/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendVmResource.java b/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendVmResource.java
index bf0dac9..979d19f 100644
--- a/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendVmResource.java
+++ b/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendVmResource.java
@@ -44,6 +44,7 @@ import org.ovirt.engine.api.resource.VmCdromsResource;
 import org.ovirt.engine.api.resource.VmDisksResource;
 import org.ovirt.engine.api.resource.VmGraphicsConsolesResource;
 import org.ovirt.engine.api.resource.VmHostDevicesResource;
+import org.ovirt.engine.api.resource.VmMytestResource;
 import org.ovirt.engine.api.resource.VmNicsResource;
 import org.ovirt.engine.api.resource.VmNumaNodesResource;
 import org.ovirt.engine.api.resource.VmReportedDevicesResource;
@@ -97,6 +98,8 @@ import org.ovirt.engine.core.common.queries.NameQueryParameters;
 import org.ovirt.engine.core.common.queries.QueryReturnValue;
 import org.ovirt.engine.core.common.queries.QueryType;
 import org.ovirt.engine.core.compat.Guid;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 public class BackendVmResource
         extends AbstractBackendActionableResource<Vm, org.ovirt.engine.core.common.businessentities.VM>
@@ -104,6 +107,8 @@ public class BackendVmResource
 
     private BackendVmsResource parent;
 
+    private Logger log = LoggerFactory.getLogger(BackendVmResource.class);
+
     public static final String DETACH_ONLY = "detach_only";
     public static final String FORCE = "force";
     public static final String NEXT_RUN = "next_run";
@@ -228,6 +233,11 @@ public class BackendVmResource
         return inject(new BackendVmWatchdogsResource(guid));
     }
 
+    @Override
+    public VmMytestResource getMytestsResource(){
+        return inject(new BackendVmMytestsResource(guid));
+    }
+
     public VmDisksResource getDisksResource() {
         return inject(new BackendVmDisksResource(guid));
     }
@@ -457,6 +467,13 @@ public class BackendVmResource
     }
 
     @Override
+    public Response myaction(Action action) {
+        log.info("@logSSSSSSSSSSSD");
+        Response res = null;
+        return res.status(200).entity("hello").build();
+    }
+
+    @Override
     public Response suspend(Action action) {
         return doAction(ActionType.HibernateVm,
                         new VmOperationParameterBase(guid),
diff --git a/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/aaa/BackendUserResource.java b/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/aaa/BackendUserResource.java
index 4a0d593..8023614 100644
--- a/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/aaa/BackendUserResource.java
+++ b/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/aaa/BackendUserResource.java
@@ -7,6 +7,7 @@ import org.ovirt.engine.api.model.User;
 import org.ovirt.engine.api.resource.AssignedPermissionsResource;
 import org.ovirt.engine.api.resource.AssignedRolesResource;
 import org.ovirt.engine.api.resource.AssignedTagsResource;
+import org.ovirt.engine.api.resource.aaa.DomainUserGroupsResource;
 import org.ovirt.engine.api.resource.aaa.SshPublicKeysResource;
 import org.ovirt.engine.api.resource.aaa.UserResource;
 import org.ovirt.engine.api.restapi.resource.AbstractBackendSubResource;
@@ -48,6 +49,11 @@ public class BackendUserResource
     }
 
     @Override
+    public DomainUserGroupsResource getGroupsResource(){
+        return null;
+    }
+
+    @Override
     public AssignedRolesResource getRolesResource() {
         return inject(new BackendAssignedRolesResource(guid));
     }
diff --git a/pom.xml b/pom.xml
index 9b56813..ead78dc 100644
--- a/pom.xml
+++ b/pom.xml
@@ -41,7 +41,7 @@
 
     <!-- Versions of the API model and tools: -->
     <metamodel.version>1.2.15</metamodel.version>
-    <model.version>4.2.26</model.version>
+    <model.version>4.3.9-SNAPSHOT</model.version>
 
     <!-- oVirt extensions versions -->
     <org.ovirt.engine.api.ovirt-engine-extensions-api.version>0.0.0</org.ovirt.engine.api.ovirt-engine-extensions-api.version>
-- 
1.8.3.1

