Skip to content

Commit

Permalink
docs(samples): Update access secret version and add secret version sa…
Browse files Browse the repository at this point in the history
…mple to include `import google_crc32c` (#11113)

* update access secret version sample to include `import google_crc32c`

* update access secret version sample to include `import google_crc32c`

* move opening region tag
  • Loading branch information
kapishps committed Jan 12, 2024
1 parent c53865b commit 9cdd36b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 9 deletions.
7 changes: 2 additions & 5 deletions secretmanager/snippets/access_secret_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@

import argparse

# [START secretmanager_access_secret_version]
from google.cloud import secretmanager
import google_crc32c # type: ignore
import google_crc32c


# [START secretmanager_access_secret_version]
def access_secret_version(
project_id: str, secret_id: str, version_id: str
) -> secretmanager.AccessSecretVersionResponse:
Expand All @@ -31,9 +31,6 @@ def access_secret_version(
can be a version number as a string (e.g. "5") or an alias (e.g. "latest").
"""

# Import the Secret Manager client library.
from google.cloud import secretmanager

# Create the Secret Manager client.
client = secretmanager.SecretManagerServiceClient()

Expand Down
5 changes: 1 addition & 4 deletions secretmanager/snippets/add_secret_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,18 @@

import argparse

# [START secretmanager_add_secret_version]
from google.cloud import secretmanager
import google_crc32c # type: ignore


# [START secretmanager_add_secret_version]
def add_secret_version(
project_id: str, secret_id: str, payload: str
) -> secretmanager.SecretVersion:
"""
Add a new secret version to the given secret with the provided payload.
"""

# Import the Secret Manager client library.
from google.cloud import secretmanager

# Create the Secret Manager client.
client = secretmanager.SecretManagerServiceClient()

Expand Down

0 comments on commit 9cdd36b

Please sign in to comment.