Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
75 commits
Select commit Hold shift + click to select a range
c2a16fb
insert and get contexts perform
salilg-eng Mar 20, 2026
b941e81
Unit Test Cases
salilg-eng Mar 24, 2026
fa985a8
Unit Test Cases
salilg-eng Mar 24, 2026
409e321
Resolve comments
salilg-eng Mar 24, 2026
8f5051f
Follow the checklist and resolved comments
salilg-eng Mar 25, 2026
49d60ad
Follow the checklist and resolved comments
salilg-eng Mar 25, 2026
59732ed
Follow the checklist and resolved comments
salilg-eng Mar 25, 2026
ffc8b00
Fixed gemini related comments
salilg-eng Mar 25, 2026
fbf594e
Fixed gemini related comments
salilg-eng Mar 25, 2026
37b7051
Style code
salilg-eng Mar 25, 2026
e94a00d
Style code
salilg-eng Mar 25, 2026
a563bb4
Personal Review code
salilg-eng Mar 26, 2026
d258bd9
Style set
salilg-eng Mar 26, 2026
711c118
Style set
salilg-eng Mar 26, 2026
d70d66a
Required Changes
salilg-eng Mar 26, 2026
41aec81
Required Changes
salilg-eng Mar 26, 2026
1e86369
Required Changes
salilg-eng Mar 26, 2026
3520f8b
As per new comments changes
salilg-eng Mar 26, 2026
7e433b8
Changes
salilg-eng Mar 27, 2026
248ffe8
Remove old test method
salilg-eng Mar 27, 2026
fdd1e97
Handled System Test cases
salilg-eng Mar 27, 2026
902eb86
Gemini review and style check
salilg-eng Mar 27, 2026
e87efaf
Style Check
salilg-eng Mar 27, 2026
e78441d
Style Check
salilg-eng Mar 27, 2026
5bb84fb
Pending scenario covers
salilg-eng Mar 27, 2026
f31760e
Pending scenario covers
salilg-eng Mar 27, 2026
d1fb39c
Pending scenario covers
salilg-eng Mar 27, 2026
eda39e8
Pending scenario covers
salilg-eng Mar 27, 2026
be06d29
Pending scenario covers
salilg-eng Mar 27, 2026
64b6c01
Remove unwanted delete code
salilg-eng Mar 30, 2026
1241ae6
Remove unwanted delete code
salilg-eng Mar 30, 2026
500b9f2
Add FIle const
salilg-eng Mar 30, 2026
0ed4e1e
Handle more scenario and resolved comments
salilg-eng Apr 1, 2026
3996210
Add more scenarios and also recheck with document
salilg-eng Apr 2, 2026
0e84582
Make a trait for validateContext and use in both bucket and storageOb…
salilg-eng Apr 2, 2026
cfd37d1
Changed code as per gemini review
salilg-eng Apr 2, 2026
54e9eac
Changed code as per gemini review
salilg-eng Apr 2, 2026
b7afe81
Changed code as per gemini review
salilg-eng Apr 2, 2026
b966e67
Changes code as per comments
salilg-eng Apr 7, 2026
c5f7aa8
Style check issue
salilg-eng Apr 7, 2026
6956993
Style check issue
salilg-eng Apr 7, 2026
fe2f2aa
Style check issue
salilg-eng Apr 7, 2026
08fb2de
Review Manage Test
salilg-eng Apr 7, 2026
5d7f458
Overall Completed the Test case only filter in system test is pending
salilg-eng Apr 10, 2026
f8a845d
Add New cases and scenarios
salilg-eng Apr 10, 2026
eac4fd3
Updated code
salilg-eng Apr 13, 2026
b919376
Updated code
salilg-eng Apr 13, 2026
b65b013
Updated code
salilg-eng Apr 13, 2026
6ae7138
Updated code
salilg-eng Apr 13, 2026
60fab43
Updated code
salilg-eng Apr 13, 2026
7a90dad
Updated code
salilg-eng Apr 13, 2026
e4ec9bf
Updated code
salilg-eng Apr 13, 2026
f37252c
Updated Code
salilg-eng Apr 14, 2026
e1a4699
Fixer
salilg-eng Apr 14, 2026
1270cf2
CHanges as per gemini review
salilg-eng Apr 14, 2026
af178b1
CS Fixer
salilg-eng Apr 14, 2026
c4021cb
gemini review
salilg-eng Apr 14, 2026
8eaf4de
gemini review
salilg-eng Apr 14, 2026
51d3e09
Changed according to feedback
salilg-eng Apr 17, 2026
a8a67ff
Final changes code
salilg-eng Apr 17, 2026
fa23edb
Final changes code
salilg-eng Apr 17, 2026
99065d2
Final changes code
salilg-eng Apr 17, 2026
b30316a
Final change and push
salilg-eng Apr 17, 2026
bd9c720
Final change and push
salilg-eng Apr 17, 2026
2d59116
FInal Code
salilg-eng Apr 20, 2026
9c9fcb2
Final Code
salilg-eng Apr 20, 2026
7020c09
Merge branch 'main' into feat/object-contexts
salilg-eng Apr 24, 2026
9db1659
Polish code
salilg-eng Apr 25, 2026
14d3dfc
Apply suggestion from @nidhiii-27
salilg-eng Apr 25, 2026
9068fdd
Jetski review
salilg-eng Apr 25, 2026
8243d3f
Merge branch 'feat/object-contexts' of https://github.com/salilg-eng/…
salilg-eng Apr 25, 2026
6019eb4
Fixed Style check
salilg-eng Apr 27, 2026
e231a62
Fixed JSON
salilg-eng Apr 27, 2026
2d028d2
Removed White space
salilg-eng Apr 29, 2026
de3768d
Merge branch 'main' into feat/object-contexts
salilg-eng Apr 29, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion Storage/src/Bucket.php
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,12 @@ public function exists(array $options = [])
* @type array $metadata The full list of available options are outlined
* at the [JSON API docs](https://cloud.google.com/storage/docs/json_api/v1/objects/insert#request-body).
* @type array $metadata.metadata User-provided metadata, in key/value pairs.
* @type array $contexts Object contexts. See at the
* [API docs](https://docs.cloud.google.com/storage/docs/use-object-contexts) for more details.
* @type string $contexts.custom.{key}.createTime The time the context
* was created in RFC 3339 format. **(read only)**
* @type string $contexts.custom.{key}.updateTime The time the context
* was last updated in RFC 3339 format. **(read only)**
* @type string $encryptionKey A base64 encoded AES-256 customer-supplied
* encryption key. If you would prefer to manage encryption
* utilizing the Cloud Key Management Service (KMS) please use the
Expand All @@ -294,6 +300,15 @@ public function upload($data, array $options = [])
throw new \InvalidArgumentException('A name is required when data is of type string or null.');
}

if (isset($options['contexts'])) {
if (!is_array($options['contexts'])) {
throw new \InvalidArgumentException('Object contexts must be an array.');
}
if (isset($options['contexts']['custom']) && !is_array($options['contexts']['custom'])) {
throw new \InvalidArgumentException('Object contexts custom field must be an array.');
}
}

$encryptionKey = $options['encryptionKey'] ?? null;
$encryptionKeySHA256 = $options['encryptionKeySHA256'] ?? null;

Expand Down Expand Up @@ -703,6 +718,9 @@ public function restore($name, $generation, array $options = [])
* distinct results. **Defaults to** `false`.
* @type string $fields Selector which will cause the response to only
* return the specified fields.
* @type string $filter Filter results to include only objects to which the
* specified context is attached. You can filter by the presence,
* absence, or specific value of context keys.
* @type string $matchGlob A glob pattern to filter results. The string
* value must be UTF-8 encoded. See:
* https://cloud.google.com/storage/docs/json_api/v1/objects/list#list-object-glob
Expand All @@ -712,7 +730,6 @@ public function restore($name, $generation, array $options = [])
public function objects(array $options = [])
{
$resultLimit = $this->pluck('resultLimit', $options, false);

return new ObjectIterator(
new ObjectPageIterator(
function (array $object) {
Expand Down
6 changes: 6 additions & 0 deletions Storage/src/Connection/Rest.php
Original file line number Diff line number Diff line change
Expand Up @@ -526,6 +526,12 @@ private function resolveUploadOptions(array $args)
$args['metadata']['retention'] = $args['retention'];
unset($args['retention']);
}
if (isset($args['contexts'])) {
// during object creation context properties are part of the object resource
// and should be included in the request body.
$args['metadata']['contexts'] = $args['contexts'];
unset($args['contexts']);
}
unset($args['name']);
$args['contentType'] = $args['metadata']['contentType']
?? MimeType::fromFilename($args['metadata']['name']);
Expand Down
40 changes: 40 additions & 0 deletions Storage/src/Connection/ServiceDefinition/storage-v1.json
Original file line number Diff line number Diff line change
Expand Up @@ -1561,6 +1561,41 @@
"type": "string",
"description": "The modification time of the object metadata in RFC 3339 format. Set initially to object creation time and then updated whenever any metadata of the object changes. This includes changes made by a requester, such as modifying custom metadata, as well as changes made by Cloud Storage on behalf of a requester, such as changing the storage class based on an Object Lifecycle Configuration.",
"format": "date-time"
},
"contexts" : {
"type": "object",
"description": "User-defined or system-defined object contexts. Represented as key-payload pairs, where the key identifies the context and the payload contains the associated value and additional metadata.",
"properties" : {
"custom" : {
"type": "object",
"description": "User-provided object contexts where each entry consists of a unique key and a corresponding payload.",
"additionalProperties": {
Comment thread
salilg-eng marked this conversation as resolved.
"$ref": "ObjectCustomContextPayload",
"description": "A single user-defined object context."
}
}
}
}
}
},
"ObjectCustomContextPayload": {
"id": "ObjectCustomContextPayload",
"type": "object",
"description": "The payload associated with a user-defined context key.",
"properties": {
"value": {
"type": "string",
"description": "The value of the object contexts."
},
"createTime": {
"type": "string",
"format": "date-time",
"description": "The time at which the object contexts was created in RFC 3339 format."
},
"updateTime": {
"type": "string",
"format": "date-time",
"description": "The time at which the object context was last updated in RFC 3339 format."
}
}
},
Expand Down Expand Up @@ -4865,6 +4900,11 @@
"required": true,
"location": "path"
},
"filter": {
"type": "string",
"description": "Filter results to include only objects to which the specified context is attached. You can filter by the presence, absence, or specific value of context keys.",
"location": "query"
},
"delimiter": {
"type": "string",
"description": "Returns results in a directory-like mode. items will contain only objects whose names, aside from the prefix, do not contain delimiter. Objects whose names, aside from the prefix, contain delimiter will have their name, truncated after the delimiter, returned in prefixes. Duplicate prefixes are omitted.",
Expand Down
6 changes: 6 additions & 0 deletions Storage/src/StorageObject.php
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,12 @@ public function delete(array $options = [])
* This is the retention configuration set for this object.
* @type string $retention.mode The mode of the retention configuration,
* which can be either `"Unlocked"` or `"Locked"`.
* @type array $contexts Object contexts. See at the
* [API docs](https://docs.cloud.google.com/storage/docs/use-object-contexts) for more details.
* @type string $contexts.custom.{key}.createTime The time the context
* was created in RFC 3339 format. **(read only)**
* @type string $contexts.custom.{key}.updateTime The time the context
* was last updated in RFC 3339 format. **(read only)**
* @type bool $overrideUnlockedRetention Applicable for objects that
* have an unlocked retention configuration. Required to be set to
* `true` if the operation includes a retention property that
Expand Down
Loading
Loading