ovh\Cloud\CloudClient::postInstanceSnapshot PHP Method

postInstanceSnapshot() public method

POST Snapshot Instance POST /cloud/project/{serviceName}/instance/{instanceId}/snapshot
public postInstanceSnapshot ( $serviceName, $idInstance, $snapshotName ) : null
return null
    public function postInstanceSnapshot($serviceName, $idInstance, $snapshotName)
    {
        if (!$serviceName) {
            throw new BadMethodCallException('Missing parameter $serviceName (OVH Cloud Project).');
        }
        if (!$idInstance) {
            throw new BadMethodCallException('Missing parameter $idInstance (OVH Cloud Instance ID).');
        }
        if (!$snapshotName) {
            throw new BadMethodCallException('Missing parameter $snapshotName (OVH Cloud Instance Snapshot Name).');
        }
        $post = array('snapshotName' => $snapshotName);
        try {
            $r = $this->post('cloud/project/' . $serviceName . '/instance/' . $idInstance . '/snapshot', array('Content-Type' => 'application/json;charset=UTF-8'), json_encode($post))->send();
        } catch (\Exception $e) {
            throw new CloudException($e->getMessage(), $e->getCode(), $e);
        }
        return $r->getBody(true);
    }