PHP Класс Google\Cloud\Storage\StorageClient

Example: use Google\Cloud\ServiceBuilder; $cloud = new ServiceBuilder(); $storage = $cloud->storage(); StorageClient can be instantiated directly. use Google\Cloud\Storage\StorageClient; $storage = new StorageClient();
Наследование: use trait Google\Cloud\ClientTrait
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$connection Google\Cloud\Storage\Connection\ConnectionInterface Represents a connection to Storage.

Открытые методы

Метод Описание
__construct ( array $config = [] ) Create a Storage client.
bucket ( string $name ) : Bucket Lazily instantiates a bucket. There are no network requests made at this point. To see the operations that can be performed on a bucket please see {@see Google\Cloud\Storage\Bucket}.
buckets ( array $options = [] ) : Generator Fetches all buckets in the project.
createBucket ( string $name, array $options = [] ) : Bucket Create a bucket. Bucket names must be unique as Cloud Storage uses a flat namespace. For more information please see bucket name requirements

Описание методов

__construct() публичный Метод

Create a Storage client.
public __construct ( array $config = [] )
$config array [optional] { Configuration options. @type string $projectId The project ID from the Google Developer's Console. @type CacheItemPoolInterface $authCache A cache used storing access tokens. **Defaults to** a simple in memory implementation. @type array $authCacheOptions Cache configuration options. @type callable $authHttpHandler A handler used to deliver Psr7 requests specifically for authentication. @type callable $httpHandler A handler used to deliver Psr7 requests. Only valid for requests sent over REST. @type string $keyFile The contents of the service account credentials .json file retrieved from the Google Developers Console. @type string $keyFilePath The full path to your service account credentials .json file retrieved from the Google Developers Console. @type int $retries Number of retries for a failed request. **Defaults to** `3`. @type array $scopes Scopes to be used for the request. }

bucket() публичный Метод

Example: $bucket = $storage->bucket('my-bucket');
public bucket ( string $name ) : Bucket
$name string The name of the bucket to request.
Результат Bucket

buckets() публичный Метод

Example: $buckets = $storage->buckets(); Get all buckets beginning with the prefix 'album'. $buckets = $storage->buckets([ 'prefix' => 'album' ]); foreach ($buckets as $bucket) { echo $bucket->name() . PHP_EOL; }
См. также: https://cloud.google.com/storage/docs/json_api/v1/buckets/list Buckets list API documentation.
public buckets ( array $options = [] ) : Generator
$options array [optional] { Configuration options. @type integer $maxResults Maximum number of results to return per request. @type string $prefix Filter results with this prefix. @type string $projection Determines which properties to return. May be either 'full' or 'noAcl'. @type string $fields Selector which will cause the response to only return the specified fields. }
Результат Generator

createBucket() публичный Метод

Example: $bucket = $storage->createBucket('bucket'); Create a bucket with logging enabled. $bucket = $storage->createBucket('myBeautifulBucket', [ 'logging' => [ 'logBucket' => 'bucketToLogTo', 'logObjectPrefix' => 'myPrefix' ] ]);
См. также: https://cloud.google.com/storage/docs/json_api/v1/buckets/insert Buckets insert API documentation.
public createBucket ( string $name, array $options = [] ) : Bucket
$name string Name of the bucket to be created.
$options array [optional] { Configuration options. @type string $predefinedAcl Apply a predefined set of access controls to this bucket. @type string $predefinedDefaultObjectAcl Apply a predefined set of default object access controls to this bucket. @type string $projection Determines which properties to return. May be either 'full' or 'noAcl'. @type string $fields Selector which will cause the response to only return the specified fields. @type array $acl Access controls on the bucket. @type array $cors The bucket's Cross-Origin Resource Sharing (CORS) configuration. @type array $defaultObjectAcl Default access controls to apply to new objects when no ACL is provided. @type array $lifecycle The bucket's lifecycle configuration. @type string $location The location of the bucket. **Defaults to** `"US"`. @type array $logging The bucket's logging configuration, which defines the destination bucket and optional name prefix for the current bucket's logs. @type string $storageClass The bucket's storage class. This defines how objects in the bucket are stored and determines the SLA and the cost of storage. Values include MULTI_REGIONAL, REGIONAL, NEARLINE, COLDLINE, STANDARD and DURABLE_REDUCED_AVAILABILITY. @type array $versioning The bucket's versioning configuration. @type array $website The bucket's website configuration. }
Результат Bucket

Описание свойств

$connection защищенное свойство

Represents a connection to Storage.
protected ConnectionInterface,Google\Cloud\Storage\Connection $connection
Результат Google\Cloud\Storage\Connection\ConnectionInterface