Skip to content

Commit 9144c25

Browse files
chore(storage): move commented example value to docblocks in Storage samples (#1715)
1 parent 2e3407f commit 9144c25

106 files changed

Lines changed: 221 additions & 336 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎storage/src/activate_hmac_key.php‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,12 @@
3030
* Activate an HMAC key.
3131
*
3232
* @param string $projectId The ID of your Google Cloud Platform project.
33+
* (e.g. 'my-project-id')
3334
* @param string $accessId Access ID for an inactive HMAC key.
35+
* (e.g. 'GOOG0234230X00')
3436
*/
3537
function activate_hmac_key(string $projectId, string $accessId): void
3638
{
37-
// $projectId = 'my-project-id';
38-
// $accessId = 'GOOG0234230X00';
39-
4039
$storage = new StorageClient();
4140
// By default hmacKey will use the projectId used by StorageClient().
4241
$hmacKey = $storage->hmacKey($accessId, $projectId);

‎storage/src/add_bucket_acl.php‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,14 @@
3030
* Add an entity and role to a bucket's ACL.
3131
*
3232
* @param string $bucketName The name of your Cloud Storage bucket.
33+
* (e.g. 'my-bucket')
3334
* @param string $entity The entity for which to update access controls.
35+
* (e.g. 'user-example@domain.com')
3436
* @param string $role The permissions to add for the specified entity.
37+
* (e.g. 'OWNER')
3538
*/
3639
function add_bucket_acl(string $bucketName, string $entity, string $role): void
3740
{
38-
// $bucketName = 'my-bucket';
39-
// $entity = 'user-example@domain.com';
40-
// $role = 'OWNER';
41-
4241
$storage = new StorageClient();
4342
$bucket = $storage->bucket($bucketName);
4443
$acl = $bucket->acl();

‎storage/src/add_bucket_conditional_iam_binding.php‎

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,24 +30,22 @@
3030
* Adds a conditional IAM binding to a bucket's IAM policy.
3131
*
3232
* @param string $bucketName The name of your Cloud Storage bucket.
33+
* (e.g. 'my-bucket')
3334
* @param string $role The role that will be given to members in this binding.
35+
* (e.g. 'roles/storage.objectViewer')
3436
* @param string[] $members The member(s) associated with this binding.
35-
* @param string $title The title of the condition.
37+
* (e.g. ['group:example@google.com'])
38+
* @param string $title The title of the condition. (e.g. 'Title')
3639
* @param string $description The description of the condition.
40+
* (e.g. 'Condition Description')
3741
* @param string $expression The condition specified in CEL expression language.
42+
* (e.g. 'resource.name.startsWith("projects/_/buckets/bucket-name/objects/prefix-a-")')
3843
*
3944
* To see how to express a condition in CEL, visit:
4045
* @see https://cloud.google.com/storage/docs/access-control/iam#conditions.
4146
*/
4247
function add_bucket_conditional_iam_binding(string $bucketName, string $role, array $members, string $title, string $description, string $expression): void
4348
{
44-
// $bucketName = 'my-bucket';
45-
// $role = 'roles/storage.objectViewer';
46-
// $members = ['group:example@google.com'];
47-
// $title = 'Title';
48-
// $description = 'Condition Description';
49-
// $expression = 'resource.name.startsWith("projects/_/buckets/bucket-name/objects/prefix-a-")';
50-
5149
$storage = new StorageClient();
5250
$bucket = $storage->bucket($bucketName);
5351

‎storage/src/add_bucket_default_acl.php‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,14 @@
3030
* Add an entity and role to a bucket's default ACL.
3131
*
3232
* @param string $bucketName The name of your Cloud Storage bucket.
33+
* (e.g. 'my-bucket')
3334
* @param string $entity The entity for which to update access controls.
35+
* (e.g. 'user-example@domain.com')
3436
* @param string $role The permissions to add for the specified entity.
37+
* (e.g. 'OWNER')
3538
*/
3639
function add_bucket_default_acl(string $bucketName, string $entity, string $role): void
3740
{
38-
// $bucketName = 'my-bucket';
39-
// $entity = 'user-example@domain.com';
40-
// $role = 'OWNER';
41-
4241
$storage = new StorageClient();
4342
$bucket = $storage->bucket($bucketName);
4443
$acl = $bucket->defaultAcl();

‎storage/src/add_bucket_iam_member.php‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,14 @@
3030
* Adds a new member / role IAM pair to a given Cloud Storage bucket.
3131
*
3232
* @param string $bucketName The name of your Cloud Storage bucket.
33+
* (e.g. 'my-bucket')
3334
* @param string $role The role to which the given member should be added.
35+
* (e.g. 'roles/storage.objectViewer')
3436
* @param string[] $members The member(s) to be added to the role.
37+
* (e.g. ['group:example@google.com'])
3538
*/
3639
function add_bucket_iam_member(string $bucketName, string $role, array $members): void
3740
{
38-
// $bucketName = 'my-bucket';
39-
// $role = 'roles/storage.objectViewer';
40-
// $members = ['group:example@google.com'];
41-
4241
$storage = new StorageClient();
4342
$bucket = $storage->bucket($bucketName);
4443

‎storage/src/add_bucket_label.php‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,14 @@
3030
* Adds or updates a bucket label.
3131
*
3232
* @param string $bucketName The name of your Cloud Storage bucket.
33+
* (e.g. 'my-bucket')
3334
* @param string $labelName The name of the label to add.
35+
* (e.g. 'label-key-to-add')
3436
* @param string $labelValue The value of the label to add.
37+
* (e.g. 'label-value-to-add')
3538
*/
3639
function add_bucket_label(string $bucketName, string $labelName, string $labelValue): void
3740
{
38-
// $bucketName = 'my-bucket';
39-
// $labelName = 'label-key-to-add';
40-
// $labelValue = 'label-value-to-add';
41-
4241
$storage = new StorageClient();
4342
$bucket = $storage->bucket($bucketName);
4443
$newLabels = [$labelName => $labelValue];

‎storage/src/add_object_acl.php‎

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,17 +30,16 @@
3030
* Add an entity and role to an object's ACL.
3131
*
3232
* @param string $bucketName The name of your Cloud Storage bucket.
33+
* (e.g. 'my-bucket')
3334
* @param string $objectName The name of your Cloud Storage object.
35+
* (e.g. 'my-object')
3436
* @param string $entity The entity for which to update access controls.
37+
* (e.g. 'user-example@domain.com')
3538
* @param string $role The permissions to add for the specified entity.
39+
* (e.g. 'OWNER')
3640
*/
3741
function add_object_acl(string $bucketName, string $objectName, string $entity, string $role): void
3842
{
39-
// $bucketName = 'my-bucket';
40-
// $objectName = 'my-object';
41-
// $entity = 'user-example@domain.com';
42-
// $role = 'OWNER';
43-
4443
$storage = new StorageClient();
4544
$bucket = $storage->bucket($bucketName);
4645
$object = $bucket->object($objectName);

‎storage/src/bucket_delete_default_kms_key.php‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,10 @@
3030
* Delete the default KMS key on the given bucket.
3131
*
3232
* @param string $bucketName The name of your Cloud Storage bucket.
33+
* (e.g. 'my-bucket')
3334
*/
3435
function bucket_delete_default_kms_key(string $bucketName): void
3536
{
36-
// $bucketName = 'my-bucket';
37-
3837
$storage = new StorageClient();
3938
$bucket = $storage->bucket($bucketName);
4039

‎storage/src/change_default_storage_class.php‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,10 @@
3030
* Change the default storage class for the given bucket.
3131
*
3232
* @param string $bucketName The name of your Cloud Storage bucket.
33+
* (e.g. 'my-bucket')
3334
*/
3435
function change_default_storage_class(string $bucketName): void
3536
{
36-
// $bucketName = 'my-bucket';
37-
3837
$storage = new StorageClient();
3938
$bucket = $storage->bucket($bucketName);
4039

‎storage/src/change_file_storage_class.php‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,14 @@
3030
* Change the storage class of the given file.
3131
*
3232
* @param string $bucketName The name of your Cloud Storage bucket.
33+
* (e.g. 'my-bucket')
3334
* @param string $objectName The name of your Cloud Storage object.
35+
* (e.g. 'my-object')
3436
* @param string $storageClass The storage class of the new object.
37+
* (e.g. 'COLDLINE')
3538
*/
3639
function change_file_storage_class(string $bucketName, string $objectName, string $storageClass): void
3740
{
38-
// $bucketName = 'my-bucket';
39-
// $objectName = 'my-object';
40-
// $storageClass = 'COLDLINE';
41-
4241
$storage = new StorageClient();
4342
$bucket = $storage->bucket($bucketName);
4443
$object = $bucket->object($objectName);

0 commit comments

Comments
 (0)