Skip to content

Commit

Permalink
docs(samples): Update the Recovery Point Objective (RPO) sample output (
Browse files Browse the repository at this point in the history
#725)

@ddelgrosso1 Related to b/217259317.

Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly:
- [ ] Make sure to open an issue as a [bug/issue](https://github.com/googleapis/python-storage/issues/new/choose) before writing your code!  That way we can discuss the change, evaluate designs, and agree on the general idea
- [ ] Ensure the tests and linter pass
- [ ] Code coverage does not decrease (if any source code was changed)
- [ ] Appropriate docs were updated (if necessary)

Fixes #<issue_number_goes_here> 🦕
  • Loading branch information
rebecca-pete committed May 20, 2022
1 parent 3664dde commit b0bf411
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 9 deletions.
6 changes: 4 additions & 2 deletions google/cloud/storage/constants.py
Expand Up @@ -119,13 +119,15 @@
"""

RPO_ASYNC_TURBO = "ASYNC_TURBO"
"""Turbo Replication RPO
"""The recovery point objective (RPO) indicates how quickly newly written objects are asynchronously replicated to a separate geographic location.
When the RPO value is set to ASYNC_TURBO, the turbo replication feature is enabled.
See: https://cloud.google.com/storage/docs/managing-turbo-replication
"""

RPO_DEFAULT = "DEFAULT"
"""Default RPO
"""The recovery point objective (RPO) indicates how quickly newly written objects are asynchronously replicated to a separate geographic location.
When the RPO value is set to DEFAULT, the default replication behavior is enabled.
See: https://cloud.google.com/storage/docs/managing-turbo-replication
"""
6 changes: 3 additions & 3 deletions samples/snippets/rpo_test.py
Expand Up @@ -45,17 +45,17 @@ def test_get_rpo(dual_region_bucket, capsys):
def test_set_rpo_async_turbo(dual_region_bucket, capsys):
storage_set_rpo_async_turbo.set_rpo_async_turbo(dual_region_bucket.name)
out, _ = capsys.readouterr()
assert f"RPO is ASYNC_TURBO for {dual_region_bucket.name}." in out
assert f"RPO is set to ASYNC_TURBO for {dual_region_bucket.name}." in out


def test_set_rpo_default(dual_region_bucket, capsys):
storage_set_rpo_default.set_rpo_default(dual_region_bucket.name)
out, _ = capsys.readouterr()
assert f"RPO is DEFAULT for {dual_region_bucket.name}." in out
assert f"RPO is set to DEFAULT for {dual_region_bucket.name}." in out


def test_create_bucket_turbo_replication(capsys):
bucket_name = f"test-rpo-{uuid.uuid4()}"
storage_create_bucket_turbo_replication.create_bucket_turbo_replication(bucket_name)
out, _ = capsys.readouterr()
assert f"{bucket_name} created with RPO ASYNC_TURBO in NAM4." in out
assert f"{bucket_name} created with the recovery point objective (RPO) set to ASYNC_TURBO in NAM4." in out
Expand Up @@ -39,7 +39,7 @@ def create_bucket_turbo_replication(bucket_name):
bucket.rpo = RPO_ASYNC_TURBO
bucket.create()

print(f"{bucket.name} created with RPO {bucket.rpo} in {bucket.location}.")
print(f"{bucket.name} created with the recovery point objective (RPO) set to {bucket.rpo} in {bucket.location}.")


# [END storage_create_bucket_turbo_replication]
Expand Down
2 changes: 1 addition & 1 deletion samples/snippets/storage_set_rpo_async_turbo.py
Expand Up @@ -39,7 +39,7 @@ def set_rpo_async_turbo(bucket_name):
bucket.rpo = RPO_ASYNC_TURBO
bucket.patch()

print(f"RPO is ASYNC_TURBO for {bucket.name}.")
print(f"RPO is set to ASYNC_TURBO for {bucket.name}.")


# [END storage_set_rpo_async_turbo]
Expand Down
4 changes: 2 additions & 2 deletions samples/snippets/storage_set_rpo_default.py
Expand Up @@ -16,7 +16,7 @@

import sys

"""Sample that sets RPO (Recovery Point Objective) to default
"""Sample that sets the replication behavior or recovery point objective (RPO) to default.
This sample is used on this page:
https://cloud.google.com/storage/docs/managing-turbo-replication
For more information, see README.md.
Expand All @@ -39,7 +39,7 @@ def set_rpo_default(bucket_name):
bucket.rpo = RPO_DEFAULT
bucket.patch()

print(f"RPO is DEFAULT for {bucket.name}.")
print(f"RPO is set to DEFAULT for {bucket.name}.")


# [END storage_set_rpo_default]
Expand Down

0 comments on commit b0bf411

Please sign in to comment.