# Class ObjectMetadataPatchBuilder (3.7.0-rc)

3.7.0-rc 3.6.0 (latest) 3.5.0 3.4.0 3.3.0 3.2.0 2.48.0-rc 2.47.1 2.46.0 2.45.0 2.44.0 2.43.0 2.42.0 2.41.0 2.40.0 2.39.0 2.38.0 2.37.0 2.36.0 2.35.0 2.34.0 2.33.0 2.32.0 2.31.0 2.30.0 2.29.0 2.28.0 2.27.0 2.26.0 2.25.1 2.24.0 2.23.0 2.22.1 2.21.0 2.20.0 2.19.0 2.18.0 2.17.0 2.16.0 2.15.1 2.14.0 2.13.0 2.12.0 2.11.0 Prepares a patch for the Bucket resource.
The Bucket resource has many modifiable fields. The application may send a patch request to change (or delete) a small fraction of these fields by using this object.

###### See Also

<https://cloud.google.com/storage/docs/json_api/v1/how-tos/performance#patch> for general information on PATCH requests for the Google Cloud Storage JSON API.

## Constructors

### ObjectMetadataPatchBuilder()

## Functions

### BuildPatch() const

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `std::string` |   |

### SetAcl(std::vector\< ObjectAccessControl \> const \&)

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `v` | `std::vector< ObjectAccessControl > const &` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `ObjectMetadataPatchBuilder &` |   |

### ResetAcl()

Clears the ACL.

> [!WARNING]
> **Warning:** Currently the server ignores requests to reset the full ACL.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `ObjectMetadataPatchBuilder &` |   |

### SetCacheControl(std::string const \&)

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `v` | `std::string const &` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `ObjectMetadataPatchBuilder &` |   |

### ResetCacheControl()

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `ObjectMetadataPatchBuilder &` |   |

### SetContentDisposition(std::string const \&)

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `v` | `std::string const &` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `ObjectMetadataPatchBuilder &` |   |

### ResetContentDisposition()

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `ObjectMetadataPatchBuilder &` |   |

### SetContentEncoding(std::string const \&)

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `v` | `std::string const &` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `ObjectMetadataPatchBuilder &` |   |

### ResetContentEncoding()

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `ObjectMetadataPatchBuilder &` |   |

### SetContentLanguage(std::string const \&)

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `v` | `std::string const &` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `ObjectMetadataPatchBuilder &` |   |

### ResetContentLanguage()

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `ObjectMetadataPatchBuilder &` |   |

### SetContentType(std::string const \&)

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `v` | `std::string const &` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `ObjectMetadataPatchBuilder &` |   |

### ResetContentType()

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `ObjectMetadataPatchBuilder &` |   |

### SetEventBasedHold(bool)

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `v` | `bool` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `ObjectMetadataPatchBuilder &` |   |

### ResetEventBasedHold()

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `ObjectMetadataPatchBuilder &` |   |

### SetMetadata(std::string const \&, std::string const \&)

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `key` | `std::string const &` |
| `value` | `std::string const &` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `ObjectMetadataPatchBuilder &` |   |

### ResetMetadata(std::string const \&)

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `key` | `std::string const &` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `ObjectMetadataPatchBuilder &` |   |

### ResetMetadata()

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `ObjectMetadataPatchBuilder &` |   |

### SetContext(std::string const \&, std::string const \&)

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `key` | `std::string const &` |
| `value` | `std::string const &` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `ObjectMetadataPatchBuilder &` |   |

### ResetContext(std::string const \&)

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `key` | `std::string const &` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `ObjectMetadataPatchBuilder &` |   |

### ResetContexts()

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `ObjectMetadataPatchBuilder &` |   |

### SetTemporaryHold(bool)

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `v` | `bool` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `ObjectMetadataPatchBuilder &` |   |

### ResetTemporaryHold()

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `ObjectMetadataPatchBuilder &` |   |

### SetCustomTime(std::chrono::system_clock::time_point)

Change the `custom_time` field.

###### Example

      namespace gcs = ::google::cloud::storage;
      using ::google::cloud::StatusOr;
      [](gcs::Client client, std::string const& bucket_name,
         std::string const& object_name) {
        auto original = client.GetObjectMetadata(bucket_name, object_name);
        if (!original) throw std::move(original).status();

        auto const tp = std::chrono::system_clock::now() - std::chrono::hours(48);
        auto updated =
            client.PatchObject(bucket_name, object_name,
                               gcs::ObjectMetadataPatchBuilder{}.SetCustomTime(tp));
        if (!updated) throw std::move(updated).status();

        std::cout << "The custom time for object " << updated->name()
                  << " in bucket " << updated->bucket() << " was successfully set. "
                  << "Full object details: " << *updated << "\n";
      }

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `tp` | `std::chrono::system_clock::time_point` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `ObjectMetadataPatchBuilder &` |   |

### ResetCustomTime()

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `ObjectMetadataPatchBuilder &` |   |

### SetRetention(ObjectRetention const \&)

Change the `retention` field.

###### Example

      namespace gcs = ::google::cloud::storage;
      using ::google::cloud::StatusOr;
      [](gcs::Client client, std::string const& bucket_name,
         std::string const& object_name) {
        auto original = client.GetObjectMetadata(bucket_name, object_name);
        if (!original) throw std::move(original).status();

        auto const until =
            std::chrono::system_clock::now() + std::chrono::hours(24);
        auto updated = client.PatchObject(
            bucket_name, object_name,
            gcs::ObjectMetadataPatchBuilder().SetRetention(
                gcs::ObjectRetention{gcs::ObjectRetentionUnlocked(), until}),
            gcs::OverrideUnlockedRetention(true),
            gcs::IfMetagenerationMatch(original->metageneration()));
        if (!updated) throw std::move(updated).status();

        std::cout << "Successfully updated object retention configuration: "
                  << *updated << "\n";
      }

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `tp` | `ObjectRetention const &` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `ObjectMetadataPatchBuilder &` |   |

### ResetRetention()

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `ObjectMetadataPatchBuilder &` |   |