mirror of https://github.com/apache/cloudstack.git
Changes in the API
This commit is contained in:
parent
50f175e3f9
commit
4b9990408d
|
|
@ -38,6 +38,7 @@ import com.cloud.utils.StringUtils;
|
|||
public class Rules {
|
||||
public static List<String> whenUsing() {
|
||||
List<String> rules = new ArrayList<String>();
|
||||
rules.add("Always be prepared to handle RuntimeExceptions.");
|
||||
return rules;
|
||||
}
|
||||
|
||||
|
|
@ -45,6 +46,7 @@ public class Rules {
|
|||
List<String> rules = new ArrayList<String>();
|
||||
rules.add("You may think you're the greatest developer in the " +
|
||||
"world but every change to the API must be reviewed and approved. ");
|
||||
rules.add("Every API must have unit tests written against it. And not it's unit tests");
|
||||
rules.add("");
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -18,12 +18,12 @@
|
|||
*/
|
||||
package org.apache.cloudstack.platform.cloud.entity.api;
|
||||
|
||||
import org.apache.cloudstack.platform.entity.api.CloudEntity;
|
||||
import org.apache.cloudstack.platform.entity.api.CloudStackEntity;
|
||||
|
||||
/**
|
||||
* @author ahuang
|
||||
*
|
||||
*/
|
||||
public interface BackupEntity extends CloudEntity {
|
||||
public interface BackupEntity extends CloudStackEntity {
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,10 +18,22 @@
|
|||
*/
|
||||
package org.apache.cloudstack.platform.cloud.entity.api;
|
||||
|
||||
import org.apache.cloudstack.platform.entity.api.CloudEntity;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.cloudstack.platform.entity.api.CloudStackEntity;
|
||||
|
||||
import com.cloud.network.Network;
|
||||
|
||||
public interface NetworkEntity extends CloudEntity, Network {
|
||||
void connectTo(NetworkEntity network);
|
||||
public interface NetworkEntity extends CloudStackEntity, Network {
|
||||
void routeTo(NetworkEntity network);
|
||||
|
||||
List<EdgeService> listEdgeServicesTo();
|
||||
|
||||
List<String> listVirtualMachineUuids();
|
||||
|
||||
List<VirtualMachineEntity> listVirtualMachines();
|
||||
|
||||
List<NicEntity> listNics();
|
||||
|
||||
void addIpRange();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,12 +18,12 @@
|
|||
*/
|
||||
package org.apache.cloudstack.platform.cloud.entity.api;
|
||||
|
||||
import org.apache.cloudstack.platform.entity.api.CloudEntity;
|
||||
import org.apache.cloudstack.platform.entity.api.CloudStackEntity;
|
||||
|
||||
/**
|
||||
* @author ahuang
|
||||
*
|
||||
*/
|
||||
public interface NicEntity extends CloudEntity {
|
||||
public interface NicEntity extends CloudStackEntity {
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,11 +18,11 @@
|
|||
*/
|
||||
package org.apache.cloudstack.platform.cloud.entity.api;
|
||||
|
||||
import org.apache.cloudstack.platform.entity.api.CloudEntity;
|
||||
import org.apache.cloudstack.platform.entity.api.CloudStackEntity;
|
||||
|
||||
import com.cloud.storage.Snapshot;
|
||||
|
||||
public interface SnapshotEntity extends CloudEntity, Snapshot {
|
||||
public interface SnapshotEntity extends CloudStackEntity, Snapshot {
|
||||
/**
|
||||
* Make a reservation for backing up this snapshot
|
||||
* @param expiration time in seconds to expire the reservation
|
||||
|
|
|
|||
|
|
@ -18,10 +18,10 @@
|
|||
*/
|
||||
package org.apache.cloudstack.platform.cloud.entity.api;
|
||||
|
||||
import org.apache.cloudstack.platform.entity.api.CloudEntity;
|
||||
import org.apache.cloudstack.platform.entity.api.CloudStackEntity;
|
||||
|
||||
import com.cloud.template.VirtualMachineTemplate;
|
||||
|
||||
public interface TemplateEntity extends CloudEntity, VirtualMachineTemplate {
|
||||
public interface TemplateEntity extends CloudStackEntity, VirtualMachineTemplate {
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ package org.apache.cloudstack.platform.cloud.entity.api;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.cloudstack.platform.entity.api.CloudEntity;
|
||||
import org.apache.cloudstack.platform.entity.api.CloudStackEntity;
|
||||
|
||||
import com.cloud.deploy.DeployDestination;
|
||||
import com.cloud.deploy.DeploymentPlanner.ExcludeList;
|
||||
|
|
@ -31,36 +31,64 @@ import com.cloud.vm.VirtualMachine;
|
|||
* Platform.
|
||||
*
|
||||
*/
|
||||
public interface VirtualMachineEntity extends VirtualMachine, CloudEntity {
|
||||
public interface VirtualMachineEntity extends VirtualMachine, CloudStackEntity {
|
||||
|
||||
/**
|
||||
* @return List of uuids for volumes attached to this virtual machine.
|
||||
*/
|
||||
List<String> listVolumeUuids();
|
||||
|
||||
List<VolumeEntity> getVolumes();
|
||||
/**
|
||||
* @return List of volumes attached to this virtual machine.
|
||||
*/
|
||||
List<VolumeEntity> listVolumes();
|
||||
|
||||
List<NicEntity> getNics();
|
||||
/**
|
||||
* @return List of uuids for nics attached to this virtual machine.
|
||||
*/
|
||||
List<String> listNicUuids();
|
||||
|
||||
/**
|
||||
* @return List of nics attached to this virtual machine.
|
||||
*/
|
||||
List<NicEntity> listNics();
|
||||
|
||||
/**
|
||||
* @return the template this virtual machine is based off.
|
||||
*/
|
||||
TemplateEntity getTemplate();
|
||||
|
||||
/**
|
||||
* @return the list of tags associated with the virtual machine
|
||||
*/
|
||||
List<String> getTags();
|
||||
List<String> listTags();
|
||||
|
||||
void addTag();
|
||||
|
||||
void delTag();
|
||||
|
||||
/**
|
||||
* Start the virtual machine with a given deploy destination
|
||||
* @param plannerToUse the Deployment Planner that should be used
|
||||
* @param dest destination to which to deploy the machine
|
||||
* @param exclude list of areas to exclude
|
||||
* @param plannerToUse the Deployment Planner that should be used
|
||||
* @return a reservation id
|
||||
*/
|
||||
void startIn(DeployDestination dest, ExcludeList exclude, String plannerToUse);
|
||||
String reserve(String plannerToUse, DeployDestination dest, ExcludeList exclude);
|
||||
|
||||
/**
|
||||
* Migrate this VM to a certain destination.
|
||||
*
|
||||
* @param dest
|
||||
* @param exclude
|
||||
* @param plannerToUse
|
||||
* @param reservationId reservation id from reserve call.
|
||||
*/
|
||||
void migrateTo(DeployDestination dest, ExcludeList exclude);
|
||||
void migrateTo(String reservationId);
|
||||
|
||||
/**
|
||||
* Deploy this virtual machine according to the reservation from before.
|
||||
* @param reservationId reservation id from reserve call.
|
||||
*
|
||||
*/
|
||||
void deploy(String reservationId);
|
||||
|
||||
/**
|
||||
* Stop the virtual machine
|
||||
|
|
@ -90,7 +118,7 @@ public interface VirtualMachineEntity extends VirtualMachine, CloudEntity {
|
|||
/**
|
||||
* Take a VM snapshot
|
||||
*/
|
||||
void takeSnapshotOf();
|
||||
SnapshotEntity takeSnapshotOf();
|
||||
|
||||
/**
|
||||
* Attach volume to this VM
|
||||
|
|
|
|||
|
|
@ -18,11 +18,11 @@
|
|||
*/
|
||||
package org.apache.cloudstack.platform.cloud.entity.api;
|
||||
|
||||
import org.apache.cloudstack.platform.entity.api.CloudEntity;
|
||||
import org.apache.cloudstack.platform.entity.api.CloudStackEntity;
|
||||
|
||||
import com.cloud.storage.Volume;
|
||||
|
||||
public interface VolumeEntity extends CloudEntity, Volume {
|
||||
public interface VolumeEntity extends CloudStackEntity, Volume {
|
||||
|
||||
/**
|
||||
* Take a snapshot of the volume
|
||||
|
|
|
|||
|
|
@ -1,90 +0,0 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.apache.cloudstack.platform.entity.api;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* All entities returned by the Cloud Orchestration Platform must implement
|
||||
* this interface. CloudValueEntity is an immutable representation of
|
||||
* an entity exposed by Cloud Orchestration Platform. For each object, it
|
||||
* defines two ids: uuid, generated by CloudStack Orchestration Platform, and
|
||||
* an external id that is set by the caller when the entity is created. All
|
||||
* ids must be unique for that entity. CloudValueEntity also can be converted
|
||||
* to a CloudActionableEntity which contains actions the object can perform.
|
||||
*/
|
||||
public interface CloudEntity {
|
||||
/**
|
||||
* @return the uuid of the object.
|
||||
*/
|
||||
String getUuid();
|
||||
|
||||
/**
|
||||
* @return the id which is often the database id.
|
||||
*/
|
||||
long getId();
|
||||
|
||||
/**
|
||||
* @return external id set by the caller
|
||||
*/
|
||||
String getExternalId();
|
||||
|
||||
/**
|
||||
* @return current state for the entity
|
||||
*/
|
||||
String getCurrentState();
|
||||
|
||||
/**
|
||||
* @return desired state for the entity
|
||||
*/
|
||||
String getDesiredState();
|
||||
|
||||
/**
|
||||
* Get the time the entity was created
|
||||
*/
|
||||
Date getCreatedTime();
|
||||
|
||||
/**
|
||||
* Get the time the entity was last updated
|
||||
*/
|
||||
Date getLastUpdatedTime();
|
||||
|
||||
/**
|
||||
* @return reference to the owner of this entity
|
||||
*/
|
||||
String getOwner();
|
||||
|
||||
/**
|
||||
* @return details stored for this entity when created.
|
||||
*/
|
||||
Map<String, String> getDetails(String source);
|
||||
|
||||
/**
|
||||
* @return a list of sources that have added to the details.
|
||||
*/
|
||||
List<String> getDetailSources();
|
||||
|
||||
/**
|
||||
* @return list of actions that can be performed on the object in its current state
|
||||
*/
|
||||
List<Method> getApplicableActions();
|
||||
}
|
||||
|
|
@ -21,9 +21,14 @@ package org.apache.cloudstack.platform.service.api;
|
|||
import java.net.URI;
|
||||
import java.util.List;
|
||||
|
||||
import com.cloud.utils.component.PluggableService;
|
||||
|
||||
public interface DirectoryService {
|
||||
void registerService(String serviceName, URI endpoint);
|
||||
void unregisterService(String serviceName, URI endpoint);
|
||||
List<URI> getEndPoints(String serviceName);
|
||||
URI getLoadBalancedEndPoint(String serviceName);
|
||||
|
||||
List<PluggableService> listServices();
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,64 +0,0 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.apache.cloudstack.platform.service.api;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.cloud.dc.DataCenter;
|
||||
import com.cloud.dc.Pod;
|
||||
import com.cloud.host.Host;
|
||||
import com.cloud.host.Status;
|
||||
import com.cloud.storage.StoragePool;
|
||||
|
||||
|
||||
/**
|
||||
* ManagementService specifies the management aspects of the
|
||||
* Orchestration Platform.
|
||||
*/
|
||||
public interface ManagementService {
|
||||
|
||||
/**
|
||||
* Registers a storage to use
|
||||
* @param uuid
|
||||
* @return
|
||||
*/
|
||||
String registerStorage(String name, List<String> tags, Map<String, String> details);
|
||||
String registerZone(String name, List<String> tags, Map<String, String> details);
|
||||
String registerPod(String name, List<String> tags, Map<String, String> details);
|
||||
String registerCluster(String name, List<String> tags, Map<String, String> details);
|
||||
String registerHost(String name, List<String> tags, Map<String, String> details);
|
||||
|
||||
void deregisterStorage(String uuid);
|
||||
void deregisterZone();
|
||||
void deregisterPod();
|
||||
void deregisterCluster();
|
||||
void deregisterHost();
|
||||
|
||||
void changeState(String type, String entity, Status state);
|
||||
|
||||
List<Host> listHosts();
|
||||
|
||||
List<Pod> listPods();
|
||||
|
||||
List<DataCenter> listZones();
|
||||
|
||||
List<StoragePool> listStorage();
|
||||
|
||||
}
|
||||
|
|
@ -18,8 +18,10 @@
|
|||
*/
|
||||
package org.apache.cloudstack.platform.service.api;
|
||||
|
||||
import java.net.URL;
|
||||
import java.util.List;
|
||||
|
||||
import com.cloud.alert.Alert;
|
||||
import com.cloud.async.AsyncJob;
|
||||
|
||||
public interface OperationsServices {
|
||||
|
|
@ -34,4 +36,22 @@ public interface OperationsServices {
|
|||
List<AsyncJob> listJobsInWaiting();
|
||||
|
||||
void cancelJob(String job);
|
||||
|
||||
List<Alert> listAlerts();
|
||||
|
||||
Alert getAlert(String uuid);
|
||||
|
||||
void cancelAlert(String alert);
|
||||
|
||||
void registerForAlerts();
|
||||
|
||||
String registerForEventNotifications(String type, String topic, URL url);
|
||||
|
||||
boolean deregisterForEventNotifications(String notificationId);
|
||||
|
||||
/**
|
||||
* @return the list of event topics someone can register for
|
||||
*/
|
||||
List<String> listEventTopics();
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,10 +22,11 @@ import java.net.URL;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.cloudstack.platform.cloud.entity.api.NetworkEntity;
|
||||
import org.apache.cloudstack.platform.cloud.entity.api.TemplateEntity;
|
||||
import org.apache.cloudstack.platform.cloud.entity.api.VirtualMachineEntity;
|
||||
import org.apache.cloudstack.platform.cloud.entity.api.VolumeEntity;
|
||||
|
||||
import com.cloud.exception.InsufficientCapacityException;
|
||||
import com.cloud.hypervisor.Hypervisor;
|
||||
|
||||
public interface OrchestrationService {
|
||||
|
|
@ -44,7 +45,7 @@ public interface OrchestrationService {
|
|||
* @param details extra details to store for the VM
|
||||
* @return VirtualMachine
|
||||
*/
|
||||
VirtualMachineEntity create(String name,
|
||||
VirtualMachineEntity createVirtualMachine(String name,
|
||||
String template,
|
||||
String hostName,
|
||||
int cpu,
|
||||
|
|
@ -56,7 +57,7 @@ public interface OrchestrationService {
|
|||
Map<String, String> details,
|
||||
String owner);
|
||||
|
||||
VirtualMachineEntity createFromScratch(String uuid,
|
||||
VirtualMachineEntity createVirtualMachineFromScratch(String uuid,
|
||||
String iso,
|
||||
String os,
|
||||
String hypervisor,
|
||||
|
|
@ -69,30 +70,15 @@ public interface OrchestrationService {
|
|||
Map<String, String> details,
|
||||
String owner);
|
||||
|
||||
/**
|
||||
* Make reservations for a VM
|
||||
* @param vm uuid of the VM
|
||||
* @param planner DeploymentPlanner to use
|
||||
* @param until time specified in seconds before reservation expires. null means to reserve forever.
|
||||
* @return reservation id
|
||||
*/
|
||||
String reserve(String vm, String planner, Long until) throws InsufficientCapacityException;
|
||||
NetworkEntity createNetwork(String externaId, String name, String cidr, String gateway);
|
||||
|
||||
/**
|
||||
* Deploy the reservation
|
||||
* @param reservationId reservation id during the deployment
|
||||
* @return job Id
|
||||
* @throws CloudRuntimeException if error
|
||||
*/
|
||||
String deploy(String reservationId);
|
||||
|
||||
void joinNetwork(String network1, String network2);
|
||||
|
||||
void createNetwork();
|
||||
|
||||
void destroyNetwork();
|
||||
void destroyNetwork(String networkUuid);
|
||||
|
||||
VolumeEntity createVolume();
|
||||
|
||||
void registerTemplate(String name, URL path, String os, Hypervisor hypervisor);
|
||||
void destroyVolume(String volumeEntity);
|
||||
|
||||
TemplateEntity registerTemplate(String name, URL path, String os, Hypervisor hypervisor);
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue