Creates new bucket with the specified options.

@param string $bucketName name of the bucket
@param array  $options    bucket options in format: "name" => "value"

@throws Exception
@throws \yii\base\InvalidConfigException
5041
public function createBucket($bucketName, $options = [])
    {
        $this->beginProfile($token = "    > create bucket $bucketName ...");

        $this->db->createBucket($bucketName, $options);

        $this->endProfile($token);
    }
631334
final public static function create(string $classname, array $options = array())
    {
        $re =  new FrameworkReflection();
        return ($re->__simpleReturned($classname, $options));
    }
1072010
public function startSpan($operationName, $options = []){

        if (is_array($options)) {
            $options = SpanOptions::create($options);
        }else{
            throw new \Exception("options is not array");
        }

        $references = $options->getReferences();

        $hasParent = false;
        $parentSpan = null;

        foreach ($references as $ref){
            if($ref->isType(Reference::CHILD_OF)){
                $hasParent = true;
                $parentSpan = $ref->getContext();
            }
        }

        if(!$hasParent || !$parentSpan->traceIdLow){
            $low = $this->generateId();
            $spanId = $low;
            $flags = $this->sampler->IsSampled();
            $newSpan = new \Jaeger\SpanContext($spanId, 0, $flags, null, 0);
            $newSpan->traceIdLow = $low;
            if($this->gen128bit == true){
                $newSpan->traceIdHigh = $this->generateId();
            }
        }else{
            $newSpan = new \Jaeger\SpanContext($this->generateId(),
                $parentSpan->spanId, $parentSpan->flags, null, 0);
            $newSpan->traceIdLow = $parentSpan->traceIdLow;
            if($parentSpan->traceIdHigh){
                $newSpan->traceIdHigh = $parentSpan->traceIdHigh;
            }
        }

        $span = new Span($operationName, $newSpan, $references);
        $span->setTags($options->getTags());

        if($newSpan->isSampled() == 1) {
            $this->spans[] = $span;
        }

        return $span;
    }
813551
public function deleteBucketWebsite($bucket, $options = NULL)
    {
        $this->precheckCommon($bucket, NULL, $options, false);
        $options[self::OSS_BUCKET] = $bucket;
        $options[self::OSS_METHOD] = self::OSS_HTTP_DELETE;
        $options[self::OSS_OBJECT] = '/';
        $options[self::OSS_SUB_RESOURCE] = 'website';
        $response = $this->auth($options);
        $result = new PutSetDeleteResult($response);
        return $result->getData();
    }
653324
public static function add($name, array $options) 
		{

			// Already known?
			if (array_key_exists($name, self::$_auths)) {
				throw new \Exception("There is already a Auth defined for '$name'.", 1);				
			}

			// Create it
			$auth = new Auth($name, $options);
			self::$_auths[$name] = $auth;
			return $auth;

		}
1046422
public function doesObjectExist($bucket, $key, array $options = array())
    {
        try {
            $this->HeadObject(array(
                'Bucket' => $bucket,
                'Key' => $key));
            return True;
        }catch (\Exception $e){
            return False;
        }
    }
401829
public function getBucket(string $name): array
    {
        if (!$this->hasBucket($name)) {
            throw new ConfigException("Undefined bucket `{$name}`");
        }

        $bucket = $this->config['buckets'][$name];

        if (!array_key_exists('options', $bucket)) {
            throw new ConfigException("Bucket `{$name}` must specify `options`");
        }

        if (!array_key_exists('prefix', $bucket)) {
            throw new ConfigException("Bucket `{$name}` must specify `prefix`");
        }

        if (!array_key_exists('server', $bucket)) {
            throw new ConfigException("Bucket `{$name}` must specify `server` name.");
        }

        return $bucket;
    }
340312
public function init()
    {
        if (empty($this->clientConfig['credentials'])) {
            throw new InvalidConfigException('Credentials are not set.');
        }

        if (empty($this->clientConfig['region'])) {
            throw new InvalidConfigException('Region is not set.');
        }

        if (empty($this->defaultBucket)) {
            throw new InvalidConfigException('Default bucket name is not set.');
        }

        foreach ($this->defaultComponentDefinitions() as $name => $definition) {
            $this->components[$name] = $this->components[$name] ?? $definition;
        }
    }
31779
public function callMethod($methodName, $options)
    {
        $this->error = false;
        if (null === ($options = $this->getMethodParameters($methodName, $options))) {
            $this->error = true;
            return null;
        }

        return call_user_func_array(array($this, $methodName), $options);
    }
797016
public function dropIndex($indexName, array $options = [])
    {
        if ('*' === $indexName) {
            throw new InvalidArgumentException(
                'Invalid $indexName "*", use dropIndexes() method to delete all indexes.'
            );
        }

        $command = [
            'dropIndexes' => $this->collectionName,
            'index' => $indexName,
        ];

        $cursor = $this->executeCommand($command, $options);

        return $cursor->current();
    }
1114171
public function setEncryption($options)
    {
        if (is_string($options)) {
            $this->blockCipher->setKey($options);
            $this->encryption['key'] = $options;
            return $this;
        }

        if (!is_array($options)) {
            throw new Exception\InvalidArgumentException('Invalid options argument provided to filter');
        }

        $options = $options + $this->encryption;

        if (isset($options['key'])) {
            $this->blockCipher->setKey($options['key']);
        }

        if (isset($options['algorithm'])) {
            try {
                $this->blockCipher->setCipherAlgorithm($options['algorithm']);
            } catch (CryptException\InvalidArgumentException $e) {
                throw new Exception\InvalidArgumentException("The algorithm '{$options['algorithm']}' is not supported");
            }
        }

        if (isset($options['hash'])) {
            try {
                $this->blockCipher->setHashAlgorithm($options['hash']);
            } catch (CryptException\InvalidArgumentException $e) {
                throw new Exception\InvalidArgumentException("The algorithm '{$options['hash']}' is not supported");
            }
        }

        if (isset($options['vector'])) {
            $this->setVector($options['vector']);
        }

        if (isset($options['key_iteration'])) {
            $this->blockCipher->setKeyIteration($options['key_iteration']);
        }

        $this->encryption = $options;

        return $this;
    }
900119
public function validateOptions($name, $options)
	{
		if (is_string($options))
		{
			$name = $options;
			$options = array();
		}

		//if the name is not a string or the options is not an array at this point, throw an error because we can't do anything with it
		if (!is_string($name) || !is_array($options))
		{
			throw new \InvalidArgumentException("One of the fields in your " . $this->config->getOption('name') . " configuration file is invalid");
		}

		//in any case, make sure the 'column_name' option is set
		$options['field_name'] = $name;

		return $options;
	}
1268776
public function createPrimaryIndex($bucketName, $indexName = null, $options = [])
    {
        $this->beginProfile($token = "    > create primary index $bucketName ...");

        $result = $this->db->createPrimaryIndex($bucketName, $indexName, $options);

        $this->endProfile($token);

        return $result;
    }
769226
protected function renderDefault($name, $value, $options)
    {
        $type = $this->type;

        if (method_exists('yii\helpers\Html', $type)) {
            $options['tabindex'] = self::TABINDEX;

            if ($this->renderer->isBootstrapTheme()) {
                Html::addCssClass($options, 'form-control');
            }

            $input = Html::$type($name, $value, $options);
        } elseif (class_exists($type) && method_exists($type, 'widget')) {
            $input = $this->renderWidget($type, $name, $value, $options);
        } else {
            throw new InvalidConfigException("Invalid column type '$type'");
        }

        return $input;
    }
1189080
protected static String getBucketARN(String bucketName) throws IllegalArgumentException {
        return new StringBuilder().append(S3_ARN_PREFIX).append(bucketName).toString();
    }
30084
public function createSendGridMailer($username, $password, $options)
    {
        if (!$username) {
            throw new InvalidConfigException("Username cannot be empty.");
        }
        if (!$password) {
            throw new InvalidConfigException("Password cannot be empty.");
        }
        $sendgrid = new \SendGrid($username, $password , $options);

        return $sendgrid;
    }
985630
public function updateBucket(array $options)
    {
        if (!in_array($options['BucketType'], [Bucket::TYPE_PUBLIC, Bucket::TYPE_PRIVATE])) {
            throw new ValidationException(
                sprintf('Bucket type must be %s or %s', Bucket::TYPE_PRIVATE, Bucket::TYPE_PUBLIC)
            );
        }

        if (!isset($options['BucketId']) && isset($options['BucketName'])) {
            $options['BucketId'] = $this->getBucketIdFromName($options['BucketName']);
        }

        $response = $this->generateAuthenticatedClient([
            'accountId'  => $this->accountId,
            'bucketId'   => $options['BucketId'],
            'bucketType' => $options['BucketType'],
        ])->request('POST', '/b2_update_bucket');

        return new Bucket($response['bucketId'], $response['bucketName'], $response['bucketType']);
    }