Create a new certificate.

@param  integer $serverId
@param  integer $siteId
@param  array $data
@param  boolean $wait
@return Certificate
194550
public function createCertificate($serverId, $siteId, array $data, $wait = true)
    {
        $certificate = $this->post("servers/$serverId/sites/$siteId/certificates", $data)['certificate'];

        if ($wait) {
            return $this->retry($this->getTimeout(), function () use ($serverId, $siteId, $certificate) {
                $certificate = $this->certificate($serverId, $siteId, $certificate['id']);

                return $certificate->status == 'installed' ? $certificate : null;
            });
        }

        return new Certificate($certificate + ['server_id' => $serverId, 'site_id' => $siteId], $this);
    }
1122333
public function restartDaemon($serverId, $daemonId, $wait = true)
    {
        $this->post("servers/$serverId/daemons/$daemonId/restart");

        if ($wait) {
            $this->retry(30, function () use ($serverId, $daemonId) {
                $daemon = $this->daemon($serverId, $daemonId);

                return $daemon->status == 'installed';
            });
        }
    }
1082621
public function createFirewallRule($serverId, array $data, $wait = true)
    {
        $rule = $this->post("servers/$serverId/firewall-rules", $data)['rule'];

        if ($wait) {
            return $this->retry($this->getTimeout(), function () use ($serverId, $rule) {
                $rule = $this->firewallRule($serverId, $rule['id']);

                return $rule->status == 'installed' ? $rule : null;
            });
        }

        return new FirewallRule($rule + ['server_id' => $serverId], $this);
    }
480539
protected function __create(array $data, $index, $type, $id = null, array $parameters = []) {
        $parameters+=["api" => "create"];
        $api = strtolower($parameters["api"]) == "index" ? "index" : "create";
        unset($parameters["api"]);
        $result = $this->client->$api([
            'index' => $index,
            'type' => $type,
            'body' => $data] + ($id ? ['id' => $id] : []) + $parameters);
        if (array_key_exists('_shards', $result) && array_key_exists('failed', $result['_shards']) && $result['_shards']['failed'] > 0) {
            throw new Exception('Failed to create the document. Serialized results: ' + json_encode($result));
        } else {
            $result = $this->__find($result['_index'], $result['_type'], $result['_id']);
        }
        return $result;
    }
32072
public function createNew(
        string $providerName,
        string $credentialPubKey,
        string $accessToken,
        string $tokenSecret = '',
        string $signupHash = ''
    ) : array {

        $array = [
            'provider'     => $providerName,
            'access_token' => $accessToken,
            'credential'   => $credentialPubKey
        ];

        if (! empty($tokenSecret)) {
            $array['token_secret'] = $tokenSecret;
        }

        if (! empty($signupHash)) {
            $array['signup_hash'] = $signupHash;
        }

        return $this->sendPost(
            '/sso',
            [],
            $array
        );
    }
853246
public function certificates($serverId, $siteId)
    {
        return $this->transformCollection(
            $this->get("servers/$serverId/sites/$siteId/certificates")['certificates'],
            Certificate::class,
            ['server_id' => $serverId, 'site_id' => $siteId]
        );
    }
1355641
protected function _create(array $data, $id = null, array $parameters = []) {
        return parent::_create($data, $this->type(), $id, $parameters);
    }
148547
public function create($data, $cardId = null)
    {
        if (isset($cardId)) {
            return $this->client()->put($data, 'payment-cards/{cardId}', ['cardId' => $cardId]);
        }

        return $this->client()->post($data, 'payment-cards');
    }
1114477
def create(gandi, name, datacenter, backend, port, vhost, algorithm,
           ssl_enable, zone_alter, ssl, private_key, poll_cert):
    
    try:
        gandi.datacenter.is_opened(datacenter, 'iaas')
    except DatacenterLimited as exc:
        gandi.echo('/!\ Datacenter %s will be closed on %s, '
                   'please consider using another datacenter.' %
                   (datacenter, exc.date))

    backends = backend
    for backend in backends:
        # Check if a port is set for each backend, else set a default port
        if 'port' not in backend:
            if not port:
                backend['port'] = click.prompt('Please set a port for '
                                               'backends. If you want to set '
                                               'different port for each '
                                               'backend, use `-b ip:port`',
                                               type=int)
            else:
                backend['port'] = port

    if vhost and not gandi.hostedcert.activate_ssl(vhost,
                                                   ssl,
                                                   private_key,
                                                   poll_cert):
        return

    result = gandi.webacc.create(name, datacenter, backends, vhost, algorithm,
                                 ssl_enable, zone_alter)
    return result
48496
public function createSurveyPage($surveyId, array $data = [])
	{
		return $this->sendRequest(
			$this->createRequest('POST', sprintf('surveys/%d/pages', $surveyId), [], $data)
		);
	}
59154
public function create($data, $tokenId = null)
    {
        if (isset($tokenId)) {
            return $this->client()->put($data, 'sessions/{tokenId}', ['tokenId' => $tokenId]);
        }

        return $this->client()->post($data, 'sessions');
    }
481641
public function getBlockById(int $blockId, int $siteId = null)
    {
        /** @var SuperTableBlock|null $block */
        $block = Craft::$app->getElements()->getElementById($blockId, SuperTableBlockElement::class, $siteId);

        return $block;
    }
220359
public function createPostUnderPublication($publicationId, array $data)
    {
        $requestData = [
            'form_params' => $data,
        ];

        return $this->client->makeRequest('POST', 'publications/' . $publicationId . '/posts', $requestData);
    }
1164539
public function createNode($nodeId, $data = array())
    {

        $node = new Graph\Node($nodeId, $data);
        $node->setGraph($this);
        $this->addNode($node);

        return $node;
    }
1134355
public static function create(
        string $description,
        string $secret,
        array $permittedIps = null,
        array $customHeaders = [],
        ApiContext $apiContext = null
    ): BunqResponseInt {
        if (is_null($apiContext)) {
            throw new BunqException(self::ERROR_API_CONTEXT_IS_NULL);
        }

        $apiClient = new ApiClient($apiContext);
        $responseRaw = $apiClient->post(
            vsprintf(
                self::ENDPOINT_URL_CREATE,
                []
            ),
            [
                self::FIELD_DESCRIPTION => $description,
                self::FIELD_SECRET => $secret,
                self::FIELD_PERMITTED_IPS => $permittedIps,
            ],
            $customHeaders
        );

        return BunqResponseInt::castFromBunqResponse(
            static::processForId($responseRaw)
        );
    }
461463
protected function _create(array $data, $type, $id = null, array $parameters = []) {
        return $this->__create($data, $this->index(), $type, $id, $parameters);
    }
10785
public function createPage(
        SiteEntity $site,
        $pageData,
        $publishPage = false,
        $doFlush = true
    ) {
        if (empty($pageData['createdByUserId'])) {
            throw new PageException('CreatedByUserId is required to create a page.');
        }
        if (empty($pageData['createdReason'])) {
            $pageData['createdReason'] = Tracking::UNKNOWN_REASON;
        }
        if (empty($pageData['author'])) {
            throw new PageException('Author is required to create a page.');
        }
        $revision = new Revision(
            $pageData['createdByUserId'],
            $pageData['createdReason']
        );
        $revision->setAuthor($pageData['author']);

        // we should not have an Id on page create
        unset($pageData['pageId']);

        $page = new PageEntity(
            $pageData['createdByUserId'],
            $pageData['createdReason']
        );
        $page->populate($pageData);

        $page->setSite($site);

        $this->assertCanCreateSitePage(
            $page->getSite(),
            $page->getName(),
            $page->getPageType()
        );

        if (!$publishPage) {
            $page->setStagedRevision($revision);
        } else {
            $page->setPublishedRevision($revision);
        }

        $page->addRevision($revision);

        $this->_em->persist($revision);
        $this->_em->persist($page);

        if ($doFlush) {
            $this->_em->flush(
                [
                    $revision,
                    $page
                ]
            );
        }

        return $page;
    }