def cancel(self, replica, execution, force=False): return self.client.post( '/replicas/%(replica_id)s/executions/%(execution_id)s/actions' % { "replica_id": base.getid(replica), "execution_id": base.getid(execution) }, json={'cancel': { 'force': force }})
def validate_connection(self, endpoint): data = self.client.post('/endpoints/%s/actions' % base.getid(endpoint), json={ 'validate-connection': None }).json() validate_data = data["validate-connection"] return validate_data.get("valid"), validate_data.get("message")
def list(self, endpoint, marker=None, limit=None, name=None): query = {} if marker is not None: query['marker'] = marker if limit is not None: query['limit'] = limit if name is not None: query["name"] = name url = '/endpoints/%s/instances' % base.getid(endpoint) if query: url += "?" + urlparse.urlencode(query) return self._list(url, 'instances')
def cancel(self, migration, force=False): return self.client.post('/migrations/%s/actions' % base.getid(migration), json={'cancel': { 'force': force }})
def delete(self, migration): return self._delete('/migrations/%s' % base.getid(migration))
def get(self, migration): return self._get('/migrations/%s' % base.getid(migration), 'migration')
def delete(self, replica, execution): return self._delete( '/replicas/%(replica_id)s/executions/%(execution_id)s' % { "replica_id": base.getid(replica), "execution_id": base.getid(execution) })
def create(self, replica, shutdown_instances=False): data = {"execution": {"shutdown_instances": shutdown_instances}} return self._post('/replicas/%s/executions' % base.getid(replica), data, 'execution')
def get(self, replica, execution): return self._get( '/replicas/%(replica_id)s/executions/%(execution_id)s' % { "replica_id": base.getid(replica), "execution_id": base.getid(execution) }, 'execution')
def list(self, replica): return self._list('/replicas/%s/executions' % base.getid(replica), 'executions')
def delete(self, endpoint): return self._delete('/endpoints/%s' % base.getid(endpoint))
def get(self, endpoint): return self._get('/endpoints/%s' % base.getid(endpoint), 'endpoint')