Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs(samples): Update the Recovery Point Objective (RPO) sample output #725

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 4 additions & 2 deletions google/cloud/storage/constants.py
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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