Skip to content

Commit 1512fc6

Browse files
committed
Adding Etag to ListObjects
1 parent 1a75e47 commit 1512fc6

10 files changed

+26
-12
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
## 3.54.1 (Unreleased)
2+
3+
### Added
4+
- Support Etag for ListObjects
5+
26
## 3.54.0 (November 27, 2019)
37

48
### Added

oci/objectstorage_object_resource.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -888,6 +888,10 @@ func (s *ObjectStorageObjectResourceCrud) setDataObject() error {
888888
func ObjectSummaryToMap(obj oci_object_storage.ObjectSummary) map[string]interface{} {
889889
result := map[string]interface{}{}
890890

891+
if obj.Etag != nil {
892+
result["etag"] = string(*obj.Etag)
893+
}
894+
891895
if obj.Md5 != nil {
892896
result["md5"] = string(*obj.Md5)
893897
}

oci/objectstorage_object_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,7 @@ func TestObjectStorageObjectResource_basic(t *testing.T) {
260260
resource.TestCheckResourceAttrSet(datasourceName, "namespace"),
261261

262262
resource.TestCheckResourceAttr(datasourceName, "objects.#", "1"),
263+
resource.TestCheckResourceAttrSet(datasourceName, "objects.0.etag"),
263264
),
264265
},
265266
// verify datasource for delimiter and prefix

oci/objectstorage_objects_data_source.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,10 @@ func ObjectStorageObjectsDataSource() *schema.Resource {
6868
Type: schema.TypeString,
6969
Computed: true,
7070
},
71+
"etag": {
72+
Type: schema.TypeString,
73+
Computed: true,
74+
},
7175
},
7276
},
7377
},
@@ -93,7 +97,7 @@ func (s *ObjectStorageObjectsDataSourceCrud) VoidState() {
9397
s.D.SetId("")
9498
}
9599

96-
var listObjectsFields = "name,size,md5,timeCreated"
100+
var listObjectsFields = "name,size,md5,timeCreated,etag"
97101

98102
func (s *ObjectStorageObjectsDataSourceCrud) Get() error {
99103
request := oci_object_storage.ListObjectsRequest{

website/docs/d/objectstorage_bucket.html.markdown

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,11 @@ The following attributes are exported:
4343
* `defined_tags` - Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see [Resource Tags](https://docs.cloud.oracle.com/iaas/Content/General/Concepts/resourcetags.htm). Example: `{"Operations.CostCenter": "42"}`
4444
* `etag` - The entity tag (ETag) for the bucket.
4545
* `freeform_tags` - Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see [Resource Tags](https://docs.cloud.oracle.com/iaas/Content/General/Concepts/resourcetags.htm). Example: `{"Department": "Finance"}`
46-
* `kms_key_id` - The OCID of a KMS key id used to call KMS to generate data key or decrypt the encrypted data key.
46+
* `kms_key_id` - The OCID of a master encryption key used to call the Key Management service to generate a data encryption key or to encrypt or decrypt a data encryption key.
4747
* `metadata` - Arbitrary string keys and values for user-defined metadata.
4848
* `name` - The name of the bucket. Avoid entering confidential information. Example: my-new-bucket1
4949
* `namespace` - The Object Storage namespace in which the bucket lives.
50-
* `object_events_enabled` - A property that determines whether events will be generated for operations on objects in this bucket. This is false by default.
50+
* `object_events_enabled` - Whether or not events are emitted for object state changes in this bucket. By default, `objectEventsEnabled` is set to `false`. Set `objectEventsEnabled` to `true` to emit events for object state changes. For more information about events, see [Overview of Events](https://docs.cloud.oracle.com/iaas/Content/Events/Concepts/eventsoverview.htm).
5151
* `object_lifecycle_policy_etag` - The entity tag (ETag) for the live object lifecycle policy on the bucket.
5252
* `storage_tier` - The storage tier type assigned to the bucket. A bucket is set to 'Standard' tier by default, which means objects uploaded or copied to the bucket will be in the standard storage tier. When the 'Archive' tier type is set explicitly for a bucket, objects uploaded or copied to the bucket will be stored in archive storage. The 'storageTier' property is immutable after bucket is created.
5353
* `time_created` - The date and time the bucket was created, as described in [RFC 2616](https://tools.ietf.org/rfc/rfc2616), section 14.29.

website/docs/d/objectstorage_bucket_summaries.html.markdown

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,11 @@ The following attributes are exported:
5454
* `defined_tags` - Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see [Resource Tags](https://docs.cloud.oracle.com/iaas/Content/General/Concepts/resourcetags.htm). Example: `{"Operations.CostCenter": "42"}`
5555
* `etag` - The entity tag (ETag) for the bucket.
5656
* `freeform_tags` - Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see [Resource Tags](https://docs.cloud.oracle.com/iaas/Content/General/Concepts/resourcetags.htm). Example: `{"Department": "Finance"}`
57-
* `kms_key_id` - The OCID of a KMS key id used to call KMS to generate data key or decrypt the encrypted data key.
57+
* `kms_key_id` - The OCID of a master encryption key used to call the Key Management service to generate a data encryption key or to encrypt or decrypt a data encryption key.
5858
* `metadata` - Arbitrary string keys and values for user-defined metadata.
5959
* `name` - The name of the bucket. Avoid entering confidential information. Example: my-new-bucket1
6060
* `namespace` - The Object Storage namespace in which the bucket lives.
61-
* `object_events_enabled` - A property that determines whether events will be generated for operations on objects in this bucket. This is false by default.
61+
* `object_events_enabled` - Whether or not events are emitted for object state changes in this bucket. By default, `objectEventsEnabled` is set to `false`. Set `objectEventsEnabled` to `true` to emit events for object state changes. For more information about events, see [Overview of Events](https://docs.cloud.oracle.com/iaas/Content/Events/Concepts/eventsoverview.htm).
6262
* `object_lifecycle_policy_etag` - The entity tag (ETag) for the live object lifecycle policy on the bucket.
6363
* `storage_tier` - The storage tier type assigned to the bucket. A bucket is set to 'Standard' tier by default, which means objects uploaded or copied to the bucket will be in the standard storage tier. When the 'Archive' tier type is set explicitly for a bucket, objects uploaded or copied to the bucket will be stored in archive storage. The 'storageTier' property is immutable after bucket is created.
6464
* `time_created` - The date and time the bucket was created, as described in [RFC 2616](https://tools.ietf.org/rfc/rfc2616), section 14.29.

website/docs/d/objectstorage_object_lifecycle_policy.html.markdown

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ The following attributes are exported:
3939

4040
For an example of this value, see the [PutObjectLifecyclePolicy API documentation](https://docs.cloud.oracle.com/iaas/api/#/en/objectstorage/20160918/ObjectLifecyclePolicy/PutObjectLifecyclePolicy).
4141
* `action` - The action of the object lifecycle policy rule. Rules using the action 'ARCHIVE' move objects into the [Archive Storage tier](https://docs.cloud.oracle.com/iaas/Content/Archive/Concepts/archivestorageoverview.htm). Rules using the action 'DELETE' permanently delete objects from buckets. 'ARCHIVE' and 'DELETE' are the only two supported actions at this time.
42-
* `is_enabled` - A boolean that determines whether this rule is currently enabled.
42+
* `is_enabled` - A Boolean that determines whether this rule is currently enabled.
4343
* `name` - The name of the lifecycle rule to be applied.
4444
* `object_name_filter` - A filter limiting object names that the rule will apply to.
4545
* `exclusion_patterns` - An array of glob patterns to match the object names to exclude. An empty array is ignored. Exclusion patterns take precedence over inclusion patterns. A Glob pattern is a sequence of characters to match text. Any character that appears in the pattern, other than the special pattern characters described below, matches itself. Glob patterns must be between 1 and 1024 characters.

website/docs/d/objectstorage_objects.html.markdown

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ The following attributes are exported:
6262
* `content_length` - The content length of the body.
6363
* `content_md5` - The base-64 encoded MD5 hash of the body.
6464
* `content_type` - The content type of the object. Defaults to 'application/octet-stream' if not overridden during the PutObject call.
65+
* `etag` - The current entity tag (ETag) for the object.
6566
* `metadata` - Optional user-defined metadata key and value.
6667
Note: Metadata keys are case-insensitive and all returned keys will be lower case.
6768
* `namespace` - The top-level namespace used for the request.

website/docs/r/objectstorage_bucket.html.markdown

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,11 @@ The following arguments are supported:
4242
* `compartment_id` - (Required) (Updatable) The ID of the compartment in which to create the bucket.
4343
* `defined_tags` - (Optional) (Updatable) Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see [Resource Tags](https://docs.cloud.oracle.com/iaas/Content/General/Concepts/resourcetags.htm). Example: `{"Operations.CostCenter": "42"}`
4444
* `freeform_tags` - (Optional) (Updatable) Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see [Resource Tags](https://docs.cloud.oracle.com/iaas/Content/General/Concepts/resourcetags.htm). Example: `{"Department": "Finance"}`
45-
* `kms_key_id` - (Optional) (Updatable) The OCID of a KMS key id used to call KMS to generate the data key or decrypt the encrypted data key.
45+
* `kms_key_id` - (Optional) (Updatable) The OCID of a master encryption key used to call the Key Management service to generate a data encryption key or to encrypt or decrypt a data encryption key.
4646
* `metadata` - (Optional) (Updatable) Arbitrary string, up to 4KB, of keys and values for user-defined metadata.
4747
* `name` - (Required) The name of the bucket. Valid characters are uppercase or lowercase letters, numbers, and dashes. Bucket names must be unique within an Object Storage namespace. Avoid entering confidential information. example: Example: my-new-bucket1
4848
* `namespace` - (Required) The Object Storage namespace used for the request.
49-
* `object_events_enabled` - (Optional) (Updatable) A property that determines whether events will be generated for operations on objects in this bucket. This is false by default.
49+
* `object_events_enabled` - (Optional) (Updatable) Whether or not events are emitted for object state changes in this bucket. By default, `objectEventsEnabled` is set to `false`. Set `objectEventsEnabled` to `true` to emit events for object state changes. For more information about events, see [Overview of Events](https://docs.cloud.oracle.com/iaas/Content/Events/Concepts/eventsoverview.htm).
5050
* `storage_tier` - (Optional) The type of storage tier of this bucket. A bucket is set to 'Standard' tier by default, which means the bucket will be put in the standard storage tier. When 'Archive' tier type is set explicitly, the bucket is put in the Archive Storage tier. The 'storageTier' property is immutable after bucket is created.
5151

5252

@@ -65,11 +65,11 @@ The following attributes are exported:
6565
* `defined_tags` - Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see [Resource Tags](https://docs.cloud.oracle.com/iaas/Content/General/Concepts/resourcetags.htm). Example: `{"Operations.CostCenter": "42"}`
6666
* `etag` - The entity tag (ETag) for the bucket.
6767
* `freeform_tags` - Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see [Resource Tags](https://docs.cloud.oracle.com/iaas/Content/General/Concepts/resourcetags.htm). Example: `{"Department": "Finance"}`
68-
* `kms_key_id` - The OCID of a KMS key id used to call KMS to generate data key or decrypt the encrypted data key.
68+
* `kms_key_id` - The OCID of a master encryption key used to call the Key Management service to generate a data encryption key or to encrypt or decrypt a data encryption key.
6969
* `metadata` - Arbitrary string keys and values for user-defined metadata.
7070
* `name` - The name of the bucket. Avoid entering confidential information. Example: my-new-bucket1
7171
* `namespace` - The Object Storage namespace in which the bucket lives.
72-
* `object_events_enabled` - A property that determines whether events will be generated for operations on objects in this bucket. This is false by default.
72+
* `object_events_enabled` - Whether or not events are emitted for object state changes in this bucket. By default, `objectEventsEnabled` is set to `false`. Set `objectEventsEnabled` to `true` to emit events for object state changes. For more information about events, see [Overview of Events](https://docs.cloud.oracle.com/iaas/Content/Events/Concepts/eventsoverview.htm).
7373
* `object_lifecycle_policy_etag` - The entity tag (ETag) for the live object lifecycle policy on the bucket.
7474
* `storage_tier` - The storage tier type assigned to the bucket. A bucket is set to 'Standard' tier by default, which means objects uploaded or copied to the bucket will be in the standard storage tier. When the 'Archive' tier type is set explicitly for a bucket, objects uploaded or copied to the bucket will be stored in archive storage. The 'storageTier' property is immutable after bucket is created.
7575
* `time_created` - The date and time the bucket was created, as described in [RFC 2616](https://tools.ietf.org/rfc/rfc2616), section 14.29.

website/docs/r/objectstorage_object_lifecycle_policy.html.markdown

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ The following arguments are supported:
5050
* `namespace` - (Required) The Object Storage namespace used for the request.
5151
* `rules` - (Optional) (Updatable) The bucket's set of lifecycle policy rules.
5252
* `action` - (Required) (Updatable) The action of the object lifecycle policy rule. Rules using the action 'ARCHIVE' move objects into the [Archive Storage tier](https://docs.cloud.oracle.com/iaas/Content/Archive/Concepts/archivestorageoverview.htm). Rules using the action 'DELETE' permanently delete objects from buckets. 'ARCHIVE' and 'DELETE' are the only two supported actions at this time.
53-
* `is_enabled` - (Required) (Updatable) A boolean that determines whether this rule is currently enabled.
53+
* `is_enabled` - (Required) (Updatable) A Boolean that determines whether this rule is currently enabled.
5454
* `name` - (Required) (Updatable) The name of the lifecycle rule to be applied.
5555
* `object_name_filter` - (Optional) (Updatable) A filter limiting object names that the rule will apply to.
5656
* `exclusion_patterns` - (Optional) (Updatable) An array of glob patterns to match the object names to exclude. An empty array is ignored. Exclusion patterns take precedence over inclusion patterns. A Glob pattern is a sequence of characters to match text. Any character that appears in the pattern, other than the special pattern characters described below, matches itself. Glob patterns must be between 1 and 1024 characters.
@@ -81,7 +81,7 @@ The following attributes are exported:
8181

8282
For an example of this value, see the [PutObjectLifecyclePolicy API documentation](https://docs.cloud.oracle.com/iaas/api/#/en/objectstorage/20160918/ObjectLifecyclePolicy/PutObjectLifecyclePolicy).
8383
* `action` - The action of the object lifecycle policy rule. Rules using the action 'ARCHIVE' move objects into the [Archive Storage tier](https://docs.cloud.oracle.com/iaas/Content/Archive/Concepts/archivestorageoverview.htm). Rules using the action 'DELETE' permanently delete objects from buckets. 'ARCHIVE' and 'DELETE' are the only two supported actions at this time.
84-
* `is_enabled` - A boolean that determines whether this rule is currently enabled.
84+
* `is_enabled` - A Boolean that determines whether this rule is currently enabled.
8585
* `name` - The name of the lifecycle rule to be applied.
8686
* `object_name_filter` - A filter limiting object names that the rule will apply to.
8787
* `exclusion_patterns` - An array of glob patterns to match the object names to exclude. An empty array is ignored. Exclusion patterns take precedence over inclusion patterns. A Glob pattern is a sequence of characters to match text. Any character that appears in the pattern, other than the special pattern characters described below, matches itself. Glob patterns must be between 1 and 1024 characters.

0 commit comments

Comments
 (0)