获取bucket的acl
@param string $bucket (Required)
@param array $opt (Optional)
@return BCS_ResponseCore
14714
public function get_bucket_acl($bucket, $opt = array()) {
		$this->assertParameterArray ( $opt );
		$opt [self::BUCKET] = $bucket;
		$opt [self::METHOD] = 'GET';
		$opt [self::OBJECT] = '/';
		$opt [self::QUERY_STRING] = array (
				self::ACL => 1 );
		$response = $this->authenticate ( $opt );
		$this->log ( $response->isOK () ? "Get bucket acl success!" : "Get bucket acl failed! Response: [" . $response->body . "]", $opt );
		return $response;
	}
620346
public function bucket_get_objects( $options = array() ) {
	 	
	 	$result = null;
	 	if( ! is_array( $options ) ) {
		
			$this->errors[$this->error_count] = 'options not given as array';
			$this->error_count++;
		
		}
		try {
		
			$result = $this->bucket->objects( $options );
		
		}
		catch( \Exception $e ) {
	
			$result = $e;
			$this->errors[$this->error_count] = $e->getServiceException()->getMessage();
			$this->error_count++;
		
		}
		return $result;		
		
	 }
711517
public function listBucketAccessControls($bucket, $optParams = array()) {
      $params = array('bucket' => $bucket);
      $params = array_merge($params, $optParams);
      $data = $this->__call('list', array($params));
      if ($this->useObjects()) {
        return new Google_BucketAccessControls($data);
      } else {
        return $data;
      }
    }
772491
public function clearPath($opt = self::PATH | self::QUERY | self::FRAGMENT)
	{
		$path = ($opt & self::PATH) === self::PATH;
		$query = ($opt & self::QUERY) === self::QUERY;
		$fragment = ($opt & self::FRAGMENT) === self::FRAGMENT;
		if ($path) {
			$this->path->clear();
		}
		if ($query) {
			$this->query->clear();
		}
		if ($fragment) {
			$this->fragment->clear();
		}
		return $this;
	}
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;
	}
1139899
public function getInfo(int $opt = null)
    {
        if ($opt === null) {
            return curl_getinfo($this->curl);
        }

        return curl_getinfo($this->curl, $opt);
    }
552185
public function generate_put_object_url($bucket, $object, $opt = array()) {
		$this->assertParameterArray ( $opt );
		return $this->generate_user_url ( "PUT", $bucket, $object, $opt );
	}
876305
public static function getBucketLocation($bucket)
	{
		$rest = new S3Request('GET', $bucket, '', self::$endpoint);
		$rest->setParameter('location', null);
		$rest = $rest->getResponse();
		if ($rest->error === false && $rest->code !== 200)
			$rest->error = array('code' => $rest->code, 'message' => 'Unexpected HTTP status');
		if ($rest->error !== false)
		{
			self::__triggerError(sprintf("S3::getBucketLocation({$bucket}): [%s] %s",
			$rest->error['code'], $rest->error['message']), __FILE__, __LINE__);
			return false;
		}
		return (isset($rest->body[0]) && (string)$rest->body[0] !== '') ? (string)$rest->body[0] : 'US';
	}
824724
public function statBase($bucket, $path)
    {
        $path       = self::cosUrlEncode($path);
        $expired    = time() + self::EXPIRED_SECONDS;
        $url        = self::generateResUrl($bucket, $path);
        $signature  = $this->createReusableSignature($expired, $bucket);
        $data       = array('op' => 'stat');
        $url        = $url . '?' . http_build_query($data);

        $req = [
            'url'       => $url,
            'method'    => 'get',
            'timeout'   => self::$timeout,
            'header'    => [
                'Authorization: ' . $signature,
            ],
        ];

        return self::sendRequest($req);
    }
1356781
public function createBucket(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)
            );
        }

        $response = $this->generateAuthenticatedClient([
            'accountId'  => $this->accountId,
            'bucketName' => $options['BucketName'],
            'bucketType' => $options['BucketType'],
        ])->request('POST', '/b2_create_bucket');

        return new Bucket($response['bucketId'], $response['bucketName'], $response['bucketType']);
    }
404011
private function format_url($opt) {
		$sign = $this->format_signature ( $opt );
		if ($sign === false) {
			trigger_error ( "Format signature failed, please check!" );
			return false;
		}
		$opt ['sign'] = $sign;
		$url = "";
		$url .= $this->use_ssl ? 'https://' : 'http://';
		$url .= $this->hostname;
		$url .= '/' . $opt [self::BUCKET];
		if (isset ( $opt [self::OBJECT] ) && '/' !== $opt [self::OBJECT]) {
			$url .= "/" . rawurlencode ( $opt [self::OBJECT] );
		}
		$url .= '?' . $sign;
		if (isset ( $opt [self::QUERY_STRING] )) {
			foreach ( $opt [self::QUERY_STRING] as $key => $value ) {
				$url .= '&' . $key . '=' . $value;
			}
		}
		return $url;
	}
577555
public Acl createDefaultBucketAcl(String bucketName) {
    // [START createDefaultBucketAcl]
    Acl acl =
        storage.createDefaultAcl(bucketName, Acl.of(User.ofAllAuthenticatedUsers(), Role.READER));
    // [END createDefaultBucketAcl]
    return acl;
  }
523668
public function getObject(string $bucket, string $object)
    {
        try {
            $content = $this->client->getObject($bucket, $object);
            return $this->success('获取文件成功', ['object' => $content]);
        } catch (\Exception $exception) {
            return $this->error('调用阿里云接口出错：' . $exception->getMessage());
        }
    }
970918
public function setBucketAuth($bucket, $private)
    {
        $path = "/private";
        $params = "bucket=".$bucket."&private=".$private;
        list(, $error) = $this->ucPost($path, $params);
        return $error;
    }
259860
public static function createBucket()
    {
        $ossClient = self::getOssClient();
        if (is_null($ossClient)) exit(1);
        $bucket = self::getBucketName();
        $acl = OssClient::OSS_ACL_TYPE_PUBLIC_READ;
        try {
            $ossClient->createBucket($bucket, $acl);
        } catch (OssException $e) {

            $message = $e->getMessage();
            if (\OSS\Core\OssUtil::startsWith($message, 'http status: 403')) {
                echo "Please Check your AccessKeyId and AccessKeySecret" . "\n";
                exit(0);
            } elseif (strpos($message, "BucketAlreadyExists") !== false) {
                echo "Bucket already exists. Please check whether the bucket belongs to you, or it was visited with correct endpoint. " . "\n";
                exit(0);
            }
            printf(__FUNCTION__ . ": FAILED\n");
            printf($e->getMessage() . "\n");
            return;
        }
        print(__FUNCTION__ . ": OK" . "\n");
    }
75601
public static short translateBucketAcl(GSAccessControlList acl, String userId) {
    short mode = (short) 0;
    for (GrantAndPermission gp : acl.getGrantAndPermissions()) {
      Permission perm = gp.getPermission();
      GranteeInterface grantee = gp.getGrantee();
      if (perm.equals(Permission.PERMISSION_READ)) {
        if (isUserIdInGrantee(grantee, userId)) {
          // If the bucket is readable by the user, add r and x to the owner mode.
          mode |= (short) 0500;
        }
      } else if (perm.equals(Permission.PERMISSION_WRITE)) {
        if (isUserIdInGrantee(grantee, userId)) {
          // If the bucket is writable by the user, +w to the owner mode.
          mode |= (short) 0200;
        }
      } else if (perm.equals(Permission.PERMISSION_FULL_CONTROL)) {
        if (isUserIdInGrantee(grantee, userId)) {
          // If the user has full control to the bucket, +rwx to the owner mode.
          mode |= (short) 0700;
        }
      }
    }
    return mode;
  }
1049709
public static function queryZone($ak, $bucket)
    {
        $zone = new Zone();
        $url = Config::UC_HOST . '/v2/query' . "?ak=$ak&bucket=$bucket";
        $ret = Client::Get($url);
        if (!$ret->ok()) {
            return array(null, new Error($url, $ret));
        }
        $r = ($ret->body === null) ? array() : $ret->json();
        //print_r($ret);
        //parse zone;

        $iovipHost = $r['io']['src']['main'][0];
        $zone->iovipHost = $iovipHost;
        $accMain = $r['up']['acc']['main'][0];
        array_push($zone->cdnUpHosts, $accMain);
        if (isset($r['up']['acc']['backup'])) {
            foreach ($r['up']['acc']['backup'] as $key => $value) {
                array_push($zone->cdnUpHosts, $value);
            }
        }
        $srcMain = $r['up']['src']['main'][0];
        array_push($zone->srcUpHosts, $srcMain);
        if (isset($r['up']['src']['backup'])) {
            foreach ($r['up']['src']['backup'] as $key => $value) {
                array_push($zone->srcUpHosts, $value);
            }
        }

        //set specific hosts
        if (strstr($zone->iovipHost, "z1") !== false) {
            $zone->rsHost = "rs-z1.qbox.me";
            $zone->rsfHost = "rsf-z1.qbox.me";
            $zone->apiHost = "api-z1.qiniu.com";
        } elseif (strstr($zone->iovipHost, "z2") !== false) {
            $zone->rsHost = "rs-z2.qbox.me";
            $zone->rsfHost = "rsf-z2.qbox.me";
            $zone->apiHost = "api-z2.qiniu.com";
        } elseif (strstr($zone->iovipHost, "na0") !== false) {
            $zone->rsHost = "rs-na0.qbox.me";
            $zone->rsfHost = "rsf-na0.qbox.me";
            $zone->apiHost = "api-na0.qiniu.com";
        } elseif (strstr($zone->iovipHost, "as0") !== false) {
            $zone->rsHost = "rs-as0.qbox.me";
            $zone->rsfHost = "rsf-as0.qbox.me";
            $zone->apiHost = "api-as0.qiniu.com";
        } else {
            $zone->rsHost = "rs.qbox.me";
            $zone->rsfHost = "rsf.qbox.me";
            $zone->apiHost = "api.qiniu.com";
        }

        return $zone;
    }