how to get a status of a volume created with API REST

asked 2015-10-22 08:55:00 -0500

hello All,

how to get a status of a volume created with API REST ?

I mean I can create a volume like this

def create_volume(self, snap_vol_instance_id, taille_du_volume, new_machine_name):
    self.url_volume = "https://cloud.numergy.com/volume/v1/"

    payload = {
        "volume":
            {
                "display_name": new_machine_name,
                "snapshot_id": snap_vol_instance_id,  # creating a volume from an existing volume snapshot
                "size": taille_du_volume
            }
    }

    res = requests.post(
        self.url_volume + self.project_id + '/volumes',
        data=json.dumps(payload),
        headers=self.headers)
    try:
        res.raise_for_status()
    except Exception as e:
        self.log.logger.error(e)
        return None
    else:
        return res.json()['volume']['id']

and I would like to check the status of creation. How can I achieve that ?

Thanks for your Help

edit retag flag offensive close merge delete