Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,15 @@ public interface MagnumService extends RestService {
*/
Container showContainer(String id);

/**
* Update a container
*
* @param id
* @param operations
* @return
*/
Container updateContainer(String id, String operations);

/**
* Gets certificate
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,14 @@
import org.openstack4j.openstack.magnum.MagnumBaymodel;
import org.openstack4j.openstack.magnum.MagnumBaymodel.Baymodels;
import org.openstack4j.openstack.magnum.MagnumCertificate;
import org.openstack4j.openstack.magnum.MagnumCluster;
import org.openstack4j.openstack.magnum.MagnumCluster.Clusters;
import org.openstack4j.openstack.magnum.MagnumClustertemplate;
import org.openstack4j.openstack.magnum.MagnumClustertemplate.Clustertemplates;
import org.openstack4j.openstack.magnum.MagnumContainer;
import org.openstack4j.openstack.magnum.MagnumContainer.Containers;
import org.openstack4j.openstack.magnum.MagnumMservice.Mservices;
import org.openstack4j.openstack.magnum.MagnumPod;
import org.openstack4j.openstack.magnum.MagnumPod.Pods;


Expand Down Expand Up @@ -147,37 +150,45 @@ public String getContainerLogs(String id) {
@Override
public Container pauseContainer(String id) {
checkNotNull(id);
return put(Container.class, uri("%s/%s/pause", MAGNUM_CONTAINERS, id)).serviceType(ServiceType.MAGNUM).execute();
return put(MagnumContainer.class, uri("%s/%s/pause", MAGNUM_CONTAINERS, id)).serviceType(ServiceType.MAGNUM).execute();
}

@Override
public Container unpauseContainer(String id) {
checkNotNull(id);
return put(Container.class, uri("%s/%s/unpause", MAGNUM_CONTAINERS, id)).serviceType(ServiceType.MAGNUM).execute();
return put(MagnumContainer.class, uri("%s/%s/unpause", MAGNUM_CONTAINERS, id)).serviceType(ServiceType.MAGNUM).execute();
}

@Override
public Container rebootContainer(String id) {
checkNotNull(id);
return put(Container.class, uri("%s/%s/reboot", MAGNUM_CONTAINERS, id)).serviceType(ServiceType.MAGNUM).execute();
return put(MagnumContainer.class, uri("%s/%s/reboot", MAGNUM_CONTAINERS, id)).serviceType(ServiceType.MAGNUM).execute();
}

@Override
public Container startContainer(String id) {
checkNotNull(id);
return put(Container.class, uri("%s/%s/start", MAGNUM_CONTAINERS, id)).serviceType(ServiceType.MAGNUM).execute();
return put(MagnumContainer.class, uri("%s/%s/start", MAGNUM_CONTAINERS, id)).serviceType(ServiceType.MAGNUM).execute();
}

@Override
public Container stopContainer(String id) {
checkNotNull(id);
return put(Container.class, uri("%s/%s/stop", MAGNUM_CONTAINERS, id)).serviceType(ServiceType.MAGNUM).execute();
return put(MagnumContainer.class, uri("%s/%s/stop", MAGNUM_CONTAINERS, id)).serviceType(ServiceType.MAGNUM).execute();
}

@Override
public Container showContainer(String id) {
checkNotNull(id);
return get(Container.class, uri("%s/%s", MAGNUM_CONTAINERS, id)).serviceType(ServiceType.MAGNUM).execute();
return get(MagnumContainer.class, uri("%s/%s", MAGNUM_CONTAINERS, id)).serviceType(ServiceType.MAGNUM).execute();
}

@Override
public Container updateContainer(String id, String operations) {
checkNotNull(id);
checkNotNull(operations);
return patch(MagnumContainer.class, MAGNUM_CONTAINERS, "/", id).serviceType(ServiceType.MAGNUM).json(operations).execute();

}

@Override
Expand All @@ -203,7 +214,7 @@ public ActionResponse rotateCertificate(String uuid) {
@Override
public Cluster createCluster(Cluster cluster) {
checkNotNull(cluster);
return post(Cluster.class, MAGNUM_CLUSTERS).serviceType(ServiceType.MAGNUM).entity(cluster).execute();
return post(MagnumCluster.class, MAGNUM_CLUSTERS).serviceType(ServiceType.MAGNUM).entity(cluster).execute();
}

@Override
Expand All @@ -227,15 +238,15 @@ public ActionResponse deleteCluster(String id) {
public Cluster updateCluster(String id, String operations) {
checkNotNull(id);
checkNotNull(operations);
return patch(Cluster.class, MAGNUM_CLUSTERS, "/", id).serviceType(ServiceType.MAGNUM).json(operations).execute();
return patch(MagnumCluster.class, MAGNUM_CLUSTERS, "/", id).serviceType(ServiceType.MAGNUM).json(operations).execute();
}

//Cluster template APIs

@Override
public Clustertemplate createClustertemplate(Clustertemplate template) {
checkNotNull(template);
return post(Clustertemplate.class, MAGNUM_CLUSTERTEMPLATES).serviceType(ServiceType.MAGNUM).entity(template).execute();
return post(MagnumClustertemplate.class, MAGNUM_CLUSTERTEMPLATES).serviceType(ServiceType.MAGNUM).entity(template).execute();
}

@Override
Expand All @@ -253,7 +264,7 @@ public ActionResponse deleteClustertemplate(String id) {
public Clustertemplate updateClustertemplate(String id, String operations) {
checkNotNull(id);
checkNotNull(operations);
return patch(Clustertemplate.class, MAGNUM_CLUSTERTEMPLATES, "/", id).serviceType(ServiceType.MAGNUM).json(operations).execute();
return patch(MagnumClustertemplate.class, MAGNUM_CLUSTERTEMPLATES, "/", id).serviceType(ServiceType.MAGNUM).json(operations).execute();
}

@Override
Expand All @@ -266,7 +277,7 @@ public List<? extends Pod> listPods(String bayUuid) {
@Override
public Pod createPod(Pod pod) {
checkNotNull(pod);
return post(Pod.class, MAGNUM_PODS).serviceType(ServiceType.MAGNUM).entity(pod).execute();
return post(MagnumPod.class, MAGNUM_PODS).serviceType(ServiceType.MAGNUM).entity(pod).execute();
}

@Override
Expand All @@ -284,14 +295,14 @@ public Pod showPod(String bayUuid, String id) {
checkNotNull(id);

// Url: '/v1/pods/%s/?bay_ident=%s'
return get(Pod.class, uri("%s/?bay_ident=%s", MAGNUM_PODS, bayUuid)).serviceType(ServiceType.MAGNUM).execute();
return get(MagnumPod.class, uri("%s/?bay_ident=%s", MAGNUM_PODS, bayUuid)).serviceType(ServiceType.MAGNUM).execute();
}

@Override
public Pod updatePod(String bayUuid, String id, String operations) {
checkNotNull(id);
checkNotNull(operations);
return patch(Pod.class, MAGNUM_PODS, "/", id).serviceType(ServiceType.MAGNUM).json(operations).execute();
return patch(MagnumPod.class, MAGNUM_PODS, "/", id).serviceType(ServiceType.MAGNUM).json(operations).execute();
}


Expand Down