Skip to content
This repository has been archived by the owner on Dec 31, 2023. It is now read-only.

Commit

Permalink
chore: Applying changes from review
Browse files Browse the repository at this point in the history
  • Loading branch information
m-strzelczyk committed Jun 17, 2021
1 parent a36d7d6 commit 1b9ef96
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions samples/snippets/sample_default_values.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ def set_usage_export_bucket(project_id: str, bucket_name: str,
})

if not report_name_prefix:
# Sending empty value for report_name_prefix, will result with the
# next usage report generated will have the default prefix value
# "usage_gce". (ref: https://cloud.google.com/compute/docs/reference/rest/v1/projects/get)
# Sending an empty value for report_name_prefix will result in the
# next usage report generated to have the default prefix value
# "usage_gce". (ref: https://cloud.google.com/compute/docs/reference/rest/v1/projects/setUsageExportBucket)
print("Setting report_name_prefix to empty value will cause the report "
"to have the default prefix of `usage_gce`.")

Expand Down Expand Up @@ -103,12 +103,10 @@ def disable_usage_export(project_id: str) -> None:
project_id: project ID or project number of the project to update.
"""
projects_client = compute_v1.ProjectsClient()
export_location = compute_v1.UsageExportLocation(
{'bucket_name': '', 'report_name_prefix': ''})

# Updating the setting with empty bucket name will disable the
# Updating the setting with None will disable the
# usage report generation.
projects_client.set_usage_export_bucket(
project=project_id, usage_export_location_resource=export_location)
project=project_id, usage_export_location_resource=None)
return
# [END compute_usage_report_disable]

0 comments on commit 1b9ef96

Please sign in to comment.