Create a new snapshot of the volume.

@param string $id   the id of the volume
@param string $name a human-readable name for the volume snapshot

@throws HttpException

@return SnapshotEntity
435652
public function snapshot($id, $name)
    {
        $data = [
            'name' => $name,
        ];

        $snapshot = $this->adapter->post(sprintf('%s/volumes/%s/snapshots', $this->endpoint, $id), $data);

        $snapshot = json_decode($snapshot);

        return new SnapshotEntity($snapshot->snapshot);
    }
799385
public function load($id, array $parameters = [], array $headers = [])
    {
        if (empty($parameters)) {
            $parameters = [
                new AppendToResponse([
                    AppendToResponse::IMAGES,
                ])
            ];
        }

        $data = $this->getApi()->getCollection($id, $this->parseQueryParameters($parameters), $headers);

        return $this->getFactory()->create($data);
    }
923588
public function getById($id)
    {
        $image = $this->adapter->get(sprintf('%s/images/%d', $this->endpoint, $id));

        $image = json_decode($image);

        return new ImageEntity($image->image);
    }
138682
public function createNewContent($name)
    {
        $this->getSession()->visit('/admin/content');
        $contentTypes = $this->getSession()->getPage()->findAll('xpath', '//div[@class="megamenu-content"]//li');

        if (is_array($contentTypes) && count($contentTypes)) {
            // Put the content type here
            $_element = null;

            // Iterate the content types in the list
            foreach ($contentTypes as $element) {
                /** @var \Behat\Mink\Element\NodeElement $element */
                if (false !== strpos($element->getText(), $name)) {
                    $_element = $element;
                }
            }

            if (null === $_element) {
                throw new ExpectationException(
                    sprintf('Content type %s not found under "Create new". do you have the correct rights?', $name),
                    $this->getSession()->getDriver()
                );
            }

            $_element->clickLink($name);
        } else {
            // No navigation found
            throw new ExpectationException(
                'No content items found under "Create new", are you sure you are loggedin?',
                $this->getSession()->getDriver()
            );
        }
    }
1192148
public function update($name, $id, HttpResourceInterface $resource)
    {
        $definition = $this->capabilities->get($name);
        $this->client->update(
            $definition->getUrl() . (string) $id,
            $resource
        );

        return $this;
    }
772622
public function store($id)
    {
        $this->repo->createOrUpdate(
            $id,
            $this->instanceName,
            json_encode(serialize([
                'content' => $this->content,
                'coupons' => $this->coupons,
            ]))
        );

        return $this;
    }
1038618
public function update(HCResourceAuthorRequest $request, string $id): JsonResponse
    {
        $record = $this->service->getRepository()->findOneBy(['id' => $id]);
        $record->update($request->getRecordData());

        if ($record) {
            $record = $this->service->getRepository()->find($id);

            event(new HCResourceAuthorUpdated($record));
        }

        return $this->response->success("Created");
    }
356858
public function show($id)
    {
        $reply = $this->client->get(
            sprintf('buckets/%d/client/recordings/%d/replies/%d.json', $this->bucket, $this->parent, $id)
        );

        return new ClientReply($this->response($reply));
    }
93904
protected function getSnapshot($id)
    {
        $snapshot = $this->snapshotManager->findOneBy(['id' => $id]);

        if (null === $snapshot) {
            throw new NotFoundHttpException(sprintf('Snapshot (%d) not found', $id));
        }

        return $snapshot;
    }
303121
public function create(string $name, int $id = 0): array
    {
        $json = ['tagname' => $name];

        if ($id > 0) {
            $json['tagid'] = $id;
        }

        return $this->httpClient->postJson('tag/create', $json);
    }
527684
public function create($name)
    {
        $this->setArchiveName($name);
        $this->getArchiver()->open($this->getArchiveName(), \ZipArchive::CREATE | \ZipArchive::OVERWRITE);
        return $this;
    }
78138
public function create($name, $publicKey)
    {
        $key = $this->adapter->post(sprintf('%s/account/keys', $this->endpoint), ['name' => $name, 'public_key' => $publicKey]);

        $key = json_decode($key);

        return new KeyEntity($key->ssh_key);
    }
903101
public static function fromString(string $id): self
    {
        list($contentId, $versionNo) = explode(':', $id);

        return new self((int) $contentId, (int) $versionNo);
    }
736988
public function newFriendRequestAction($name)
    {
        $logFile = $this->container->getParameter('claroline.param.claroline_log');
        $host = $this->request->query->get('host');
        //uncomment this for debugging puroposes...

        if ($this->container->get('kernel')->getEnvironment() === 'dev') {
            $fileLogger = new \Monolog\Logger('claroline.debug.log');
            $fileLogger->pushHandler(new \Monolog\Handler\StreamHandler($logFile));
            $fileLogger->addInfo(var_export($this->oauthManager->isAutoCreated($host), true));
        }

        $this->oauthManager->addPendingFriendRequest(
            $name,
            $host,
            $this->oauthManager->isAutoCreated($host)
        );

        return new JsonResponse(array('name' => $name, 'host' => $host));
    }
67913
def create_snapshot(self, name=None, description=None, force=False):
        
        name = name or ""
        description = description or ""
        # Note that passing in non-None values is required for the _create_body
        # method to distinguish between this and the request to create and
        # instance.
        return self.manager.create_snapshot(volume=self, name=name,
                    description=description, force=force)
624958
public function record( $name = null ) {

        $snapshot = Snapshot::create();
        $record = new Profiler\Record( $this, $name, $snapshot, $this->_lastRecord );

        $this->_records[] = $record;
        $this->_lastRecord = $record;

        if( !$this->_startRecord )
            $this->_startRecord = $record;

        return $this;
    }
1045585
public function get($id): QueryEntity
    {
        if ($this->has($id)) {
            return $this->meta[$id];
        }

        throw new RuntimeException("Meta with name \"{$id}\" does not exists.");
    }