@@ -133,12 +133,15 @@ async def get_secret_by_name(
133133 * ,
134134 secret_name : str ,
135135 region : Optional [Region ] = None ,
136+ project_id : Optional [str ] = None ,
136137 ) -> Secret :
137138 """
138139 Get metadata using the secret's ID.
139- Retrieve the metadata of a secret specified by the `region` and the `secret_id ` parameters.
140+ Retrieve the metadata of a secret specified by the `region`, `secret_id` and `project_id ` parameters.
140141 :param region: Region to target. If none is passed will use default region from the config.
141142 :param secret_name: Name of the secret.
143+ :param project_id: ID of the Project to target.
144+ (Optional.) If not specified, Secret Manager will look for the secret in all Projects.
142145 :return: :class:`Secret <Secret>`
143146
144147 Usage:
@@ -155,6 +158,9 @@ async def get_secret_by_name(
155158 res = self ._request (
156159 "GET" ,
157160 f"/secret-manager/v1alpha1/regions/{ param_region } /secrets-by-name/{ param_secret_name } " ,
161+ params = {
162+ "project_id" : project_id or self .client .default_project_id ,
163+ },
158164 )
159165
160166 self ._throw_on_error (res )
@@ -406,7 +412,7 @@ async def create_secret_version(
406412 :param data: The base64-encoded secret payload of the version.
407413 :param description: Description of the version.
408414 :param disable_previous: Disable the previous secret version.
409- Optional. If there is no previous version or if the previous version was already disabled, does nothing.
415+ ( Optional.) If there is no previous version or if the previous version was already disabled, does nothing.
410416 :param data_crc32: (Optional.) The CRC32 checksum of the data as a base-10 integer.
411417 If specified, Secret Manager will verify the integrity of the data received against the given CRC32 checksum. An error is returned if the CRC32 does not match. If, however, the CRC32 matches, it will be stored and returned along with the SecretVersion on future access requests.
412418 :return: :class:`SecretVersion <SecretVersion>`
@@ -553,14 +559,17 @@ async def get_secret_version_by_name(
553559 secret_name : str ,
554560 revision : str ,
555561 region : Optional [Region ] = None ,
562+ project_id : Optional [str ] = None ,
556563 ) -> SecretVersion :
557564 """
558565 Get metadata of a secret's version using the secret's name.
559- Retrieve the metadata of a secret's given version specified by the `region`, `secret_name` and `revision ` parameters.
566+ Retrieve the metadata of a secret's given version specified by the `region`, `secret_name`, `revision` and `project_id ` parameters.
560567 :param region: Region to target. If none is passed will use default region from the config.
561568 :param secret_name: Name of the secret.
562569 :param revision: Version number.
563570 The first version of the secret is numbered 1, and all subsequent revisions augment by 1. Value can be a number or "latest".
571+ :param project_id: ID of the Project to target.
572+ (Optional.) If not specified, Secret Manager will look for the secret version in all Projects.
564573 :return: :class:`SecretVersion <SecretVersion>`
565574
566575 Usage:
@@ -581,6 +590,9 @@ async def get_secret_version_by_name(
581590 res = self ._request (
582591 "GET" ,
583592 f"/secret-manager/v1alpha1/regions/{ param_region } /secrets-by-name/{ param_secret_name } /versions/{ param_revision } " ,
593+ params = {
594+ "project_id" : project_id or self .client .default_project_id ,
595+ },
584596 )
585597
586598 self ._throw_on_error (res )
@@ -725,15 +737,18 @@ async def list_secret_versions_by_name(
725737 page : Optional [int ] = None ,
726738 page_size : Optional [int ] = None ,
727739 status : Optional [List [SecretVersionStatus ]] = None ,
740+ project_id : Optional [str ] = None ,
728741 ) -> ListSecretVersionsResponse :
729742 """
730743 List versions of a secret using the secret's name.
731- Retrieve the list of a given secret's versions specified by the `secret_name` and `region ` parameters.
744+ Retrieve the list of a given secret's versions specified by the `secret_name`,`region` and `project_id ` parameters.
732745 :param region: Region to target. If none is passed will use default region from the config.
733746 :param secret_name: Name of the secret.
734747 :param page:
735748 :param page_size:
736749 :param status: Filter results by status.
750+ :param project_id: ID of the Project to target.
751+ (Optional.) If not specified, Secret Manager will look for the secret in all Projects.
737752 :return: :class:`ListSecretVersionsResponse <ListSecretVersionsResponse>`
738753
739754 Usage:
@@ -753,6 +768,7 @@ async def list_secret_versions_by_name(
753768 params = {
754769 "page" : page ,
755770 "page_size" : page_size or self .client .default_page_size ,
771+ "project_id" : project_id or self .client .default_project_id ,
756772 "status" : status ,
757773 },
758774 )
@@ -768,15 +784,18 @@ async def list_secret_versions_by_name_all(
768784 page : Optional [int ] = None ,
769785 page_size : Optional [int ] = None ,
770786 status : Optional [List [SecretVersionStatus ]] = None ,
787+ project_id : Optional [str ] = None ,
771788 ) -> List [SecretVersion ]:
772789 """
773790 List versions of a secret using the secret's name.
774- Retrieve the list of a given secret's versions specified by the `secret_name` and `region ` parameters.
791+ Retrieve the list of a given secret's versions specified by the `secret_name`,`region` and `project_id ` parameters.
775792 :param region: Region to target. If none is passed will use default region from the config.
776793 :param secret_name: Name of the secret.
777794 :param page:
778795 :param page_size:
779796 :param status: Filter results by status.
797+ :param project_id: ID of the Project to target.
798+ (Optional.) If not specified, Secret Manager will look for the secret in all Projects.
780799 :return: :class:`List[ListSecretVersionsResponse] <List[ListSecretVersionsResponse]>`
781800
782801 Usage:
@@ -795,6 +814,7 @@ async def list_secret_versions_by_name_all(
795814 "page" : page ,
796815 "page_size" : page_size ,
797816 "status" : status ,
817+ "project_id" : project_id ,
798818 },
799819 )
800820
@@ -921,14 +941,17 @@ async def access_secret_version_by_name(
921941 secret_name : str ,
922942 revision : str ,
923943 region : Optional [Region ] = None ,
944+ project_id : Optional [str ] = None ,
924945 ) -> AccessSecretVersionResponse :
925946 """
926947 Access a secret's version using the secret's name.
927- Access sensitive data in a secret's version specified by the `region`, `secret_name` and `revision ` parameters.
948+ Access sensitive data in a secret's version specified by the `region`, `secret_name`, `revision` and `project_id ` parameters.
928949 :param region: Region to target. If none is passed will use default region from the config.
929950 :param secret_name: Name of the secret.
930951 :param revision: Version number.
931952 The first version of the secret is numbered 1, and all subsequent revisions augment by 1. Value can be a number or "latest".
953+ :param project_id: ID of the Project to target.
954+ (Optional.) If not specified, Secret Manager will look for the secret version in all Projects.
932955 :return: :class:`AccessSecretVersionResponse <AccessSecretVersionResponse>`
933956
934957 Usage:
@@ -949,6 +972,9 @@ async def access_secret_version_by_name(
949972 res = self ._request (
950973 "GET" ,
951974 f"/secret-manager/v1alpha1/regions/{ param_region } /secrets-by-name/{ param_secret_name } /versions/{ param_revision } /access" ,
975+ params = {
976+ "project_id" : project_id or self .client .default_project_id ,
977+ },
952978 )
953979
954980 self ._throw_on_error (res )
0 commit comments