删除空间

@param String $bucket 空间名称
@return array
979023
public function dropBucket($bucket){
        $err = $this->subBucketManager->dropBucket($bucket);
        if($err){
            return $this->error($err->message(), ['errorCode'=>$err->code()]);
        }
        return $this->success('操作成功');
    }
1074946
def empty(Bucket, MFA=None, RequestPayer=None, region=None, key=None,
          keyid=None, profile=None):
    '''
    

    '''

    stuff = list_object_versions(Bucket, region=region, key=key, keyid=keyid,
                                 profile=profile)
    Delete = {}
    Delete['Objects'] = [{'Key': v['Key'], 'VersionId': v['VersionId']} for v in stuff.get('Versions', [])]
    Delete['Objects'] += [{'Key': v['Key'], 'VersionId': v['VersionId']} for v in stuff.get('DeleteMarkers', [])]
    if Delete['Objects']:
        ret = delete_objects(Bucket, Delete, MFA=MFA, RequestPayer=RequestPayer,
                             region=region, key=key, keyid=keyid, profile=profile)
        failed = ret.get('failed', [])
        if failed:
            return {'deleted': False, 'failed': ret[failed]}
    return {'deleted': True}
432920
public function domains($bucket){
        list($domains, $err) = $this->bucketManager->domains($bucket);
        if($err){
            return $this->error($err->message(), ['errorCode'=>$err->code()]);
        }
        return $this->success('操作成功', $domains);
    }
427024
public function createBucket(string $bucket, string $acl = OssClient::OSS_ACL_TYPE_PRIVATE)
    {
        try {
            $this->client->createBucket($bucket, $acl);
            return $this->success('创建Bucket成功');
        } catch (\Exception $exception) {
            return $this->error('调用阿里云接口出错：' . $exception->getMessage());
        }
    }
435279
public function get(string $org): array
    {
        return $this->getApi()->request($this->getApi()->sprintf('/orgs/:org', $org));
    }
619639
public function fetch($bucket, $url, $key = null){
        list($ret, $err) = $this->bucketManager->fetch($url, $bucket, $key);
        if($err){
            return $this->error($err->message(), ['errorCode'=>$err->code()]);
        }
        return $this->success('操作成功', $ret);
    }
13028
protected function getBucketIdFromName($name)
    {
        $buckets = $this->listBuckets();

        foreach ($buckets as $bucket) {
            if ($bucket->getName() === $name) {
                return $bucket->getId();
            }
        }

        return null;
    }
18437
public function delete_bucket($bucket, $opt = array()) {
		$this->assertParameterArray ( $opt );
		$opt [self::BUCKET] = $bucket;
		$opt [self::METHOD] = 'DELETE';
		$opt [self::OBJECT] = '/';
		$response = $this->authenticate ( $opt );
		$this->log ( $response->isOK () ? "Delete bucket success!" : "Delete bucket failed! Response: [" . $response->body . "]", $opt );
		return $response;
	}
1286408
public function getOptions(Bucket $bucket): array
    {
        $options = [];
        foreach ($this->properties as $property) {
            $options[$property] = $bucket->$property;
        }

        return $options;
    }
862702
public static function getSpaceFromToken($token) {
        $pieces = explode('::', $token);
        if ( count($pieces) != 4 ) return false;
        $space = implode('::', array_slice($pieces,0,2));
        return $space;
    }
196120
private function listBucket($object_prefix = null) {
    $headers = $this->getOAuthTokenHeader(parent::READ_SCOPE);
    if ($headers === false) {
      if (!$this->quiet) {
        trigger_error("Unable to acquire OAuth token.", E_USER_WARNING);
      }
      return false;
    }

    $query_arr = [
        'delimiter' => parent::DELIMITER,
        'max-keys' => self::MAX_KEYS,
    ];
    if (isset($object_prefix)) {
      $query_arr['prefix'] = $object_prefix;
    }
    if (isset($this->next_marker)) {
      $query_arr['marker'] = $this->next_marker;
    }

    $url = $this->createObjectUrl($this->bucket_name);
    $query_str = http_build_query($query_arr);
    $http_response = $this->makeHttpRequest(sprintf("%s?%s", $url, $query_str),
                                            "GET",
                                            $headers);
    if ($http_response === false) {
      if (!$this->quiet) {
        trigger_error('Unable to connect to the Cloud Storage Service.',
                      E_USER_WARNING);
      }
      return false;
    }

    if (HttpResponse::OK !== $http_response['status_code']) {
      if (!$this->quiet) {
        trigger_error($this->getErrorMessage($http_response['status_code'],
                                             $http_response['body']),
                      E_USER_WARNING);
      }
      return false;
    }

    // Extract the files into the result array.
    $xml = simplexml_load_string($http_response['body']);

    if (isset($xml->NextMarker)) {
      $this->next_marker = (string) $xml->NextMarker;
    } else {
      $this->next_marker = null;
    }

    $results = [];
    foreach($xml->Contents as $content) {
      $results [] = [
          'name' => (string) $content->Key,
          'size' => (string) $content->Size,
          'mtime' => (string) $content->LastModified,
      ];
    }
    // Subdirectories will be returned in the CommonPrefixes section. Refer to
    // https://developers.google.com/storage/docs/reference-methods#getbucket
    foreach($xml->CommonPrefixes as $common_prefix) {
      $results[] = [
          'name' => (string) $common_prefix->Prefix,
      ];
    }
    return $results;
  }
1351433
public function determineBucketRegionAsync($bucketName)
    {
        $command = $this->getCommand('HeadBucket', ['Bucket' => $bucketName]);
        $handlerList = clone $this->getHandlerList();
        $handlerList->remove('s3.permanent_redirect');
        $handlerList->remove('signer');
        $handler = $handlerList->resolve();

        return $handler($command)
            ->then(static function (ResultInterface $result) {
                return $result['@metadata']['headers']['x-amz-bucket-region'];
            });
    }
416079
private static function delBase($bucketName, $path)
    {
        if ($path == '/') {
            return [
                    'code'    => self::COSAPI_PARAMS_ERROR,
                    'message' => 'can not delete bucket using api! go to http://console.qcloud.com/cos to operate bucket',
                    ];
        }

        $path = self::cosUrlEncode($path);

        $url = self::generateResUrl($bucketName, $path);
        $sign = Auth::appSign_once(
                $path, $bucketName);

        $data = [
            'op' => 'delete',
        ];

        $data = json_encode($data);

        $req = [
            'url'     => $url,
            'method'  => 'post',
            'timeout' => self::$timeout,
            'data'    => $data,
            'header'  => [
                'Authorization:'.$sign,
                'Content-Type: application/json',
            ],
        ];

        return self::sendRequest($req);
    }
1325344
public function work_running($bucket = self::DEFAULT_BUCKET)
	{
		$results = array();
		foreach ($this->forked_children as $pid => $child)
		{
			if ($child['status'] != self::STOPPED && $child['bucket'] === $bucket)
			{
				$results[$pid] = $child;
			}
		}

		return $results;
	}
1362322
def get_bucket(self, hash_name, bucket_key):
        
        if hash_name in self.buckets:
            if bucket_key in self.buckets[hash_name]:
                return self.buckets[hash_name][bucket_key]
        return []
1155290
public function get_result($bucket = self::DEFAULT_BUCKET)
	{
		// check for additional results
		$this->post_results($bucket);

		if (!$this->has_result($bucket))
		{
			return null;
		}

		return array_shift($this->results[$bucket]);
	}
1233593
public function bucket_list($include_default_bucket = true)
	{
		$bucket_list = array();

		foreach ($this->buckets as $bucket_id)
		{
			// skip the default bucket if ignored
			if ( ($include_default_bucket === false) && ($bucket_id === self::DEFAULT_BUCKET) )
			{
				continue;
			}

			$bucket_list[] = $bucket_id;
		}

		return $bucket_list;
	}