This repository has been archived by the owner on Sep 5, 2023. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
538071b
commit c2b7e9f
Showing
97 changed files
with
20,373 additions
and
11,745 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,164 @@ | ||
# 2.0.0 Migration Guide | ||
|
||
The 2.0 release of the `google-cloud-secret-manager` client is a significant upgrade based on a [next-gen code generator](https://github.com/googleapis/gapic-generator-python), and includes substantial interface changes. Existing code written for earlier versions of this library will likely require updates to use this version. This document describes the changes that have been made, and what you need to do to update your usage. | ||
|
||
If you experience issues or have questions, please file an [issue](https://github.com/googleapis/python-secret-manager/issues). | ||
|
||
## Supported Python Versions | ||
|
||
> **WARNING**: Breaking change | ||
The 2.0.0 release requires Python 3.6+. | ||
|
||
|
||
## Method Calls | ||
|
||
> **WARNING**: Breaking change | ||
Methods expect request objects. We provide a script that will convert most common use cases. | ||
|
||
* Install the library | ||
|
||
```py | ||
python3 -m pip install google-cloud-secret-manager | ||
``` | ||
|
||
* The script `fixup_secretmanager_v1_keywords.py` is shipped with the library. It expects | ||
an input directory (with the code to convert) and an empty destination directory. | ||
|
||
```sh | ||
$ fixup_secretmanager_v1_keywords.py --input-directory .samples/ --output-directory samples/ | ||
``` | ||
|
||
**Before:** | ||
```py | ||
from google.cloud import secretmanager_v1 | ||
|
||
client = secretmanager_v1.SecretManagerServiceClient() | ||
|
||
secret = client.get_secret("secret_name") | ||
``` | ||
|
||
|
||
**After:** | ||
```py | ||
from google.cloud import secretmanager_v1 | ||
|
||
client = secretmanager_v1.SecretManagerServiceClient() | ||
|
||
secret = client.get_secret(request={'name': "secret_name"}) | ||
``` | ||
|
||
### More Details | ||
|
||
In `google-cloud-secret-manager<2.0.0`, parameters required by the API were positional parameters and optional parameters were keyword parameters. | ||
|
||
**Before:** | ||
```py | ||
def create_secret( | ||
self, | ||
parent, | ||
secret_id, | ||
secret, | ||
retry=google.api_core.gapic_v1.method.DEFAULT, | ||
timeout=google.api_core.gapic_v1.method.DEFAULT, | ||
metadata=None, | ||
): | ||
``` | ||
|
||
In the 2.0.0 release, all methods have a single positional parameter `request`. Method docstrings indicate whether a parameter is required or optional. | ||
|
||
Some methods have additional keyword only parameters. The available parameters depend on the `google.api.method_signature` annotation specified by the API producer. | ||
|
||
|
||
**After:** | ||
```py | ||
def create_secret( | ||
self, | ||
request: service.CreateSecretRequest = None, | ||
*, | ||
parent: str = None, | ||
secret_id: str = None, | ||
secret: resources.Secret = None, | ||
retry: retries.Retry = gapic_v1.method.DEFAULT, | ||
timeout: float = None, | ||
metadata: Sequence[Tuple[str, str]] = (), | ||
) -> resources.Secret: | ||
``` | ||
|
||
> **NOTE:** The `request` parameter and flattened keyword parameters for the API are mutually exclusive. | ||
> Passing both will result in an error. | ||
|
||
Both of these calls are valid: | ||
|
||
```py | ||
response = client.create_secret( | ||
request={ | ||
"parent": parent, | ||
"secret_id": secret_id, | ||
"secret": secret | ||
} | ||
) | ||
``` | ||
|
||
```py | ||
response = client.create_secret( | ||
parent=parent, | ||
secret_id=secret_id, | ||
secret=secret | ||
) | ||
``` | ||
|
||
This call is invalid because it mixes `request` with a keyword argument `secret`. Executing this code | ||
will result in an error. | ||
|
||
```py | ||
response = client.create_secret( | ||
request={ | ||
"parent": parent, | ||
"secret_id": secret_id | ||
}, | ||
secret=secret | ||
) | ||
``` | ||
|
||
|
||
|
||
## Enums and Types | ||
|
||
|
||
> **WARNING**: Breaking change | ||
The submodules `enums` and `types` have been removed. | ||
|
||
**Before:** | ||
```py | ||
from google.cloud import secretmanager_v1 | ||
|
||
secret_version = secretmanager_v1.enums.SecretVersion.ENABLED | ||
secret = secretmanager_v1.types.Secret(name="name") | ||
``` | ||
|
||
|
||
**After:** | ||
```py | ||
from google.cloud import secretmanager_v1 | ||
|
||
secret_version = secretmanager_v1.SecretVersion.ENABLED | ||
secret = secretmanager_v1.Secret(name="name") | ||
``` | ||
|
||
## Path Helper Methods | ||
|
||
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}' | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../UPGRADING.md |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
Services for Google Cloud Secretmanager v1 API | ||
============================================== | ||
|
||
.. automodule:: google.cloud.secretmanager_v1.services.secret_manager_service | ||
:members: | ||
:inherited-members: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
Types for Google Cloud Secretmanager v1 API | ||
=========================================== | ||
|
||
.. automodule:: google.cloud.secretmanager_v1.types | ||
:members: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
Services for Google Cloud Secretmanager v1beta1 API | ||
=================================================== | ||
|
||
.. automodule:: google.cloud.secretmanager_v1beta1.services.secret_manager_service | ||
:members: | ||
:inherited-members: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
Types for Google Cloud Secretmanager v1beta1 API | ||
================================================ | ||
|
||
.. automodule:: google.cloud.secretmanager_v1beta1.types | ||
:members: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
# Copyright 2020 Google LLC | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
|
||
from google.cloud.secretmanager_v1.services.secret_manager_service.async_client import ( | ||
SecretManagerServiceAsyncClient, | ||
) | ||
from google.cloud.secretmanager_v1.services.secret_manager_service.client import ( | ||
SecretManagerServiceClient, | ||
) | ||
from google.cloud.secretmanager_v1.types.resources import CustomerManagedEncryption | ||
from google.cloud.secretmanager_v1.types.resources import ( | ||
CustomerManagedEncryptionStatus, | ||
) | ||
from google.cloud.secretmanager_v1.types.resources import Replication | ||
from google.cloud.secretmanager_v1.types.resources import ReplicationStatus | ||
from google.cloud.secretmanager_v1.types.resources import Secret | ||
from google.cloud.secretmanager_v1.types.resources import SecretPayload | ||
from google.cloud.secretmanager_v1.types.resources import SecretVersion | ||
from google.cloud.secretmanager_v1.types.service import AccessSecretVersionRequest | ||
from google.cloud.secretmanager_v1.types.service import AccessSecretVersionResponse | ||
from google.cloud.secretmanager_v1.types.service import AddSecretVersionRequest | ||
from google.cloud.secretmanager_v1.types.service import CreateSecretRequest | ||
from google.cloud.secretmanager_v1.types.service import DeleteSecretRequest | ||
from google.cloud.secretmanager_v1.types.service import DestroySecretVersionRequest | ||
from google.cloud.secretmanager_v1.types.service import DisableSecretVersionRequest | ||
from google.cloud.secretmanager_v1.types.service import EnableSecretVersionRequest | ||
from google.cloud.secretmanager_v1.types.service import GetSecretRequest | ||
from google.cloud.secretmanager_v1.types.service import GetSecretVersionRequest | ||
from google.cloud.secretmanager_v1.types.service import ListSecretVersionsRequest | ||
from google.cloud.secretmanager_v1.types.service import ListSecretVersionsResponse | ||
from google.cloud.secretmanager_v1.types.service import ListSecretsRequest | ||
from google.cloud.secretmanager_v1.types.service import ListSecretsResponse | ||
from google.cloud.secretmanager_v1.types.service import UpdateSecretRequest | ||
|
||
__all__ = ( | ||
"AccessSecretVersionRequest", | ||
"AccessSecretVersionResponse", | ||
"AddSecretVersionRequest", | ||
"CreateSecretRequest", | ||
"CustomerManagedEncryption", | ||
"CustomerManagedEncryptionStatus", | ||
"DeleteSecretRequest", | ||
"DestroySecretVersionRequest", | ||
"DisableSecretVersionRequest", | ||
"EnableSecretVersionRequest", | ||
"GetSecretRequest", | ||
"GetSecretVersionRequest", | ||
"ListSecretVersionsRequest", | ||
"ListSecretVersionsResponse", | ||
"ListSecretsRequest", | ||
"ListSecretsResponse", | ||
"Replication", | ||
"ReplicationStatus", | ||
"Secret", | ||
"SecretManagerServiceAsyncClient", | ||
"SecretManagerServiceClient", | ||
"SecretPayload", | ||
"SecretVersion", | ||
"UpdateSecretRequest", | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# Marker file for PEP 561. | ||
# The google-cloud-secretmanager package uses inline types. |
Oops, something went wrong.