diff --git a/UPGRADING.md b/UPGRADING.md index 08e5033..e810d13 100644 --- a/UPGRADING.md +++ b/UPGRADING.md @@ -149,13 +149,16 @@ secret_version = secretmanager_v1.SecretVersion.ENABLED secret = secretmanager_v1.Secret(name="name") ``` -## Project Path Helper Method +## Path Helper Methods -Project path helper method has been removed. Please construct -the path manually. +The following path helper methods have been removed. Please construct +the paths manually. ```py project = 'my-project' +secret = 'secret' +secret_version = 'secret_version' project_path = f'projects/{project}' +secret_version_path = f'projects/{project}/secrets/{secret}/versions/{secret_version}' ``` \ No newline at end of file diff --git a/samples/snippets/access_secret_version.py b/samples/snippets/access_secret_version.py index 1bd3da9..1b61f60 100644 --- a/samples/snippets/access_secret_version.py +++ b/samples/snippets/access_secret_version.py @@ -33,7 +33,7 @@ def access_secret_version(project_id, secret_id, version_id): client = secretmanager.SecretManagerServiceClient() # Build the resource name of the secret version. - name = client.secret_version_path(project_id, secret_id, version_id) + name = f'projects/{project_id}/secrets/{secret_id}/versions/{version_id}' # Access the secret version. response = client.access_secret_version(request={'name': name}) diff --git a/samples/snippets/destroy_secret_version.py b/samples/snippets/destroy_secret_version.py index 1192318..98c48ac 100644 --- a/samples/snippets/destroy_secret_version.py +++ b/samples/snippets/destroy_secret_version.py @@ -33,7 +33,7 @@ def destroy_secret_version(project_id, secret_id, version_id): client = secretmanager.SecretManagerServiceClient() # Build the resource name of the secret version - name = client.secret_version_path(project_id, secret_id, version_id) + name = f'projects/{project_id}/secrets/{secret_id}/versions/{version_id}' # Destroy the secret version. response = client.destroy_secret_version(request={'name': name}) diff --git a/samples/snippets/disable_secret_version.py b/samples/snippets/disable_secret_version.py index c1ce111..48916ca 100644 --- a/samples/snippets/disable_secret_version.py +++ b/samples/snippets/disable_secret_version.py @@ -33,7 +33,7 @@ def disable_secret_version(project_id, secret_id, version_id): client = secretmanager.SecretManagerServiceClient() # Build the resource name of the secret version - name = client.secret_version_path(project_id, secret_id, version_id) + name = f'projects/{project_id}/secrets/{secret_id}/versions/{version_id}' # Disable the secret version. response = client.disable_secret_version(request={'name': name}) diff --git a/samples/snippets/enable_secret_version.py b/samples/snippets/enable_secret_version.py index e9771e5..33dfc1e 100644 --- a/samples/snippets/enable_secret_version.py +++ b/samples/snippets/enable_secret_version.py @@ -33,7 +33,7 @@ def enable_secret_version(project_id, secret_id, version_id): client = secretmanager.SecretManagerServiceClient() # Build the resource name of the secret version - name = client.secret_version_path(project_id, secret_id, version_id) + name = f'projects/{project_id}/secrets/{secret_id}/versions/{version_id}' # Disable the secret version. response = client.enable_secret_version(request={'name': name}) diff --git a/samples/snippets/get_secret_version.py b/samples/snippets/get_secret_version.py index 37b82e1..f510b70 100644 --- a/samples/snippets/get_secret_version.py +++ b/samples/snippets/get_secret_version.py @@ -34,7 +34,7 @@ def get_secret_version(project_id, secret_id, version_id): client = secretmanager.SecretManagerServiceClient() # Build the resource name of the secret version. - name = client.secret_version_path(project_id, secret_id, version_id) + name = f'projects/{project_id}/secrets/{secret_id}/versions/{version_id}' # Get the secret version. response = client.get_secret_version(request={'name': name}) diff --git a/samples/snippets/requirements.txt b/samples/snippets/requirements.txt index da667b1..9542bce 100644 --- a/samples/snippets/requirements.txt +++ b/samples/snippets/requirements.txt @@ -1 +1,2 @@ -google-cloud-secret-manager==1.0.0 +#google-cloud-secret-manager==1.0.0 +-e ./../../ \ No newline at end of file diff --git a/samples/snippets/snippets_test.py b/samples/snippets/snippets_test.py index 00f56cd..09ae106 100644 --- a/samples/snippets/snippets_test.py +++ b/samples/snippets/snippets_test.py @@ -120,7 +120,7 @@ def test_delete_secret(client, secret): delete_secret(project_id, secret_id) with pytest.raises(exceptions.NotFound): print('{}'.format(client)) - name = client.secret_version_path(project_id, secret_id, 'latest') + name = f'projects/{project_id}/secrets/{secret_id}/versions/latest' client.access_secret_version(request={'name': name})