Skip to content

Commit 5f6227b

Browse files
docs: [google-cloud-secret-manager] various documentation clarifications (#13796)
- [ ] Regenerate this pull request now. PiperOrigin-RevId: 748001251 Source-Link: googleapis/googleapis@4657bfa Source-Link: googleapis/googleapis-gen@4ec05d4 Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLXNlY3JldC1tYW5hZ2VyLy5Pd2xCb3QueWFtbCIsImgiOiI0ZWMwNWQ0ODU4ZDNmOWM1OWZmYzNhZjJjZjRjYTlmZThhZTA0ODc2In0= --------- Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
1 parent 5035014 commit 5f6227b

File tree

9 files changed

+1161
-19
lines changed

9 files changed

+1161
-19
lines changed

packages/google-cloud-secret-manager/google/cloud/secretmanager_v1beta1/services/secret_manager_service/async_client.py

Lines changed: 120 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
except AttributeError: # pragma: NO COVER
4444
OptionalRetry = Union[retries.AsyncRetry, object, None] # type: ignore
4545

46+
from google.cloud.location import locations_pb2 # type: ignore
4647
from google.iam.v1 import iam_policy_pb2 # type: ignore
4748
from google.iam.v1 import policy_pb2 # type: ignore
4849
from google.protobuf import field_mask_pb2 # type: ignore
@@ -367,7 +368,7 @@ async def sample_list_secrets():
367368
Returns:
368369
google.cloud.secretmanager_v1beta1.services.secret_manager_service.pagers.ListSecretsAsyncPager:
369370
Response message for
370-
[SecretManagerService.ListSecrets][google.cloud.secrets.v1beta1.SecretManagerService.ListSecrets].
371+
[SecretManagerService.ListSecrets][google.cloud.secrets.v1beta1.SecretManagerService.ListSecrets].
371372
372373
Iterating over this object will yield results and
373374
resolve additional pages automatically.
@@ -516,8 +517,8 @@ async def sample_create_secret():
516517
517518
Returns:
518519
google.cloud.secretmanager_v1beta1.types.Secret:
519-
A [Secret][google.cloud.secrets.v1beta1.Secret] is a logical secret whose value and versions can
520-
be accessed.
520+
A [Secret][google.cloud.secrets.v1beta1.Secret] is a logical secret whose
521+
value and versions can be accessed.
521522
522523
A [Secret][google.cloud.secrets.v1beta1.Secret] is
523524
made up of zero or more
@@ -765,8 +766,8 @@ async def sample_get_secret():
765766
766767
Returns:
767768
google.cloud.secretmanager_v1beta1.types.Secret:
768-
A [Secret][google.cloud.secrets.v1beta1.Secret] is a logical secret whose value and versions can
769-
be accessed.
769+
A [Secret][google.cloud.secrets.v1beta1.Secret] is a logical secret whose
770+
value and versions can be accessed.
770771
771772
A [Secret][google.cloud.secrets.v1beta1.Secret] is
772773
made up of zero or more
@@ -889,8 +890,8 @@ async def sample_update_secret():
889890
890891
Returns:
891892
google.cloud.secretmanager_v1beta1.types.Secret:
892-
A [Secret][google.cloud.secrets.v1beta1.Secret] is a logical secret whose value and versions can
893-
be accessed.
893+
A [Secret][google.cloud.secrets.v1beta1.Secret] is a logical secret whose
894+
value and versions can be accessed.
894895
895896
A [Secret][google.cloud.secrets.v1beta1.Secret] is
896897
made up of zero or more
@@ -1116,7 +1117,7 @@ async def sample_list_secret_versions():
11161117
Returns:
11171118
google.cloud.secretmanager_v1beta1.services.secret_manager_service.pagers.ListSecretVersionsAsyncPager:
11181119
Response message for
1119-
[SecretManagerService.ListSecretVersions][google.cloud.secrets.v1beta1.SecretManagerService.ListSecretVersions].
1120+
[SecretManagerService.ListSecretVersions][google.cloud.secrets.v1beta1.SecretManagerService.ListSecretVersions].
11201121
11211122
Iterating over this object will yield results and
11221123
resolve additional pages automatically.
@@ -1368,7 +1369,7 @@ async def sample_access_secret_version():
13681369
Returns:
13691370
google.cloud.secretmanager_v1beta1.types.AccessSecretVersionResponse:
13701371
Response message for
1371-
[SecretManagerService.AccessSecretVersion][google.cloud.secrets.v1beta1.SecretManagerService.AccessSecretVersion].
1372+
[SecretManagerService.AccessSecretVersion][google.cloud.secrets.v1beta1.SecretManagerService.AccessSecretVersion].
13721373
13731374
"""
13741375
# Create or coerce a protobuf request object.
@@ -2112,6 +2113,116 @@ async def sample_test_iam_permissions():
21122113
# Done; return the response.
21132114
return response
21142115

2116+
async def get_location(
2117+
self,
2118+
request: Optional[locations_pb2.GetLocationRequest] = None,
2119+
*,
2120+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
2121+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
2122+
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
2123+
) -> locations_pb2.Location:
2124+
r"""Gets information about a location.
2125+
2126+
Args:
2127+
request (:class:`~.location_pb2.GetLocationRequest`):
2128+
The request object. Request message for
2129+
`GetLocation` method.
2130+
retry (google.api_core.retry_async.AsyncRetry): Designation of what errors,
2131+
if any, should be retried.
2132+
timeout (float): The timeout for this request.
2133+
metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
2134+
sent along with the request as metadata. Normally, each value must be of type `str`,
2135+
but for metadata keys ending with the suffix `-bin`, the corresponding values must
2136+
be of type `bytes`.
2137+
Returns:
2138+
~.location_pb2.Location:
2139+
Location object.
2140+
"""
2141+
# Create or coerce a protobuf request object.
2142+
# The request isn't a proto-plus wrapped type,
2143+
# so it must be constructed via keyword expansion.
2144+
if isinstance(request, dict):
2145+
request = locations_pb2.GetLocationRequest(**request)
2146+
2147+
# Wrap the RPC method; this adds retry and timeout information,
2148+
# and friendly error handling.
2149+
rpc = self.transport._wrapped_methods[self._client._transport.get_location]
2150+
2151+
# Certain fields should be provided within the metadata header;
2152+
# add these here.
2153+
metadata = tuple(metadata) + (
2154+
gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
2155+
)
2156+
2157+
# Validate the universe domain.
2158+
self._client._validate_universe_domain()
2159+
2160+
# Send the request.
2161+
response = await rpc(
2162+
request,
2163+
retry=retry,
2164+
timeout=timeout,
2165+
metadata=metadata,
2166+
)
2167+
2168+
# Done; return the response.
2169+
return response
2170+
2171+
async def list_locations(
2172+
self,
2173+
request: Optional[locations_pb2.ListLocationsRequest] = None,
2174+
*,
2175+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
2176+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
2177+
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
2178+
) -> locations_pb2.ListLocationsResponse:
2179+
r"""Lists information about the supported locations for this service.
2180+
2181+
Args:
2182+
request (:class:`~.location_pb2.ListLocationsRequest`):
2183+
The request object. Request message for
2184+
`ListLocations` method.
2185+
retry (google.api_core.retry_async.AsyncRetry): Designation of what errors,
2186+
if any, should be retried.
2187+
timeout (float): The timeout for this request.
2188+
metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
2189+
sent along with the request as metadata. Normally, each value must be of type `str`,
2190+
but for metadata keys ending with the suffix `-bin`, the corresponding values must
2191+
be of type `bytes`.
2192+
Returns:
2193+
~.location_pb2.ListLocationsResponse:
2194+
Response message for ``ListLocations`` method.
2195+
"""
2196+
# Create or coerce a protobuf request object.
2197+
# The request isn't a proto-plus wrapped type,
2198+
# so it must be constructed via keyword expansion.
2199+
if isinstance(request, dict):
2200+
request = locations_pb2.ListLocationsRequest(**request)
2201+
2202+
# Wrap the RPC method; this adds retry and timeout information,
2203+
# and friendly error handling.
2204+
rpc = self.transport._wrapped_methods[self._client._transport.list_locations]
2205+
2206+
# Certain fields should be provided within the metadata header;
2207+
# add these here.
2208+
metadata = tuple(metadata) + (
2209+
gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
2210+
)
2211+
2212+
# Validate the universe domain.
2213+
self._client._validate_universe_domain()
2214+
2215+
# Send the request.
2216+
response = await rpc(
2217+
request,
2218+
retry=retry,
2219+
timeout=timeout,
2220+
metadata=metadata,
2221+
)
2222+
2223+
# Done; return the response.
2224+
return response
2225+
21152226
async def __aenter__(self) -> "SecretManagerServiceAsyncClient":
21162227
return self
21172228

packages/google-cloud-secret-manager/google/cloud/secretmanager_v1beta1/services/secret_manager_service/client.py

Lines changed: 128 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060

6161
_LOGGER = std_logging.getLogger(__name__)
6262

63+
from google.cloud.location import locations_pb2 # type: ignore
6364
from google.iam.v1 import iam_policy_pb2 # type: ignore
6465
from google.iam.v1 import policy_pb2 # type: ignore
6566
from google.protobuf import field_mask_pb2 # type: ignore
@@ -804,7 +805,7 @@ def sample_list_secrets():
804805
Returns:
805806
google.cloud.secretmanager_v1beta1.services.secret_manager_service.pagers.ListSecretsPager:
806807
Response message for
807-
[SecretManagerService.ListSecrets][google.cloud.secrets.v1beta1.SecretManagerService.ListSecrets].
808+
[SecretManagerService.ListSecrets][google.cloud.secrets.v1beta1.SecretManagerService.ListSecrets].
808809
809810
Iterating over this object will yield results and
810811
resolve additional pages automatically.
@@ -950,8 +951,8 @@ def sample_create_secret():
950951
951952
Returns:
952953
google.cloud.secretmanager_v1beta1.types.Secret:
953-
A [Secret][google.cloud.secrets.v1beta1.Secret] is a logical secret whose value and versions can
954-
be accessed.
954+
A [Secret][google.cloud.secrets.v1beta1.Secret] is a logical secret whose
955+
value and versions can be accessed.
955956
956957
A [Secret][google.cloud.secrets.v1beta1.Secret] is
957958
made up of zero or more
@@ -1193,8 +1194,8 @@ def sample_get_secret():
11931194
11941195
Returns:
11951196
google.cloud.secretmanager_v1beta1.types.Secret:
1196-
A [Secret][google.cloud.secrets.v1beta1.Secret] is a logical secret whose value and versions can
1197-
be accessed.
1197+
A [Secret][google.cloud.secrets.v1beta1.Secret] is a logical secret whose
1198+
value and versions can be accessed.
11981199
11991200
A [Secret][google.cloud.secrets.v1beta1.Secret] is
12001201
made up of zero or more
@@ -1314,8 +1315,8 @@ def sample_update_secret():
13141315
13151316
Returns:
13161317
google.cloud.secretmanager_v1beta1.types.Secret:
1317-
A [Secret][google.cloud.secrets.v1beta1.Secret] is a logical secret whose value and versions can
1318-
be accessed.
1318+
A [Secret][google.cloud.secrets.v1beta1.Secret] is a logical secret whose
1319+
value and versions can be accessed.
13191320
13201321
A [Secret][google.cloud.secrets.v1beta1.Secret] is
13211322
made up of zero or more
@@ -1535,7 +1536,7 @@ def sample_list_secret_versions():
15351536
Returns:
15361537
google.cloud.secretmanager_v1beta1.services.secret_manager_service.pagers.ListSecretVersionsPager:
15371538
Response message for
1538-
[SecretManagerService.ListSecretVersions][google.cloud.secrets.v1beta1.SecretManagerService.ListSecretVersions].
1539+
[SecretManagerService.ListSecretVersions][google.cloud.secrets.v1beta1.SecretManagerService.ListSecretVersions].
15391540
15401541
Iterating over this object will yield results and
15411542
resolve additional pages automatically.
@@ -1781,7 +1782,7 @@ def sample_access_secret_version():
17811782
Returns:
17821783
google.cloud.secretmanager_v1beta1.types.AccessSecretVersionResponse:
17831784
Response message for
1784-
[SecretManagerService.AccessSecretVersion][google.cloud.secrets.v1beta1.SecretManagerService.AccessSecretVersion].
1785+
[SecretManagerService.AccessSecretVersion][google.cloud.secrets.v1beta1.SecretManagerService.AccessSecretVersion].
17851786
17861787
"""
17871788
# Create or coerce a protobuf request object.
@@ -2523,6 +2524,124 @@ def __exit__(self, type, value, traceback):
25232524
"""
25242525
self.transport.close()
25252526

2527+
def get_location(
2528+
self,
2529+
request: Optional[locations_pb2.GetLocationRequest] = None,
2530+
*,
2531+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
2532+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
2533+
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
2534+
) -> locations_pb2.Location:
2535+
r"""Gets information about a location.
2536+
2537+
Args:
2538+
request (:class:`~.location_pb2.GetLocationRequest`):
2539+
The request object. Request message for
2540+
`GetLocation` method.
2541+
retry (google.api_core.retry.Retry): Designation of what errors,
2542+
if any, should be retried.
2543+
timeout (float): The timeout for this request.
2544+
metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
2545+
sent along with the request as metadata. Normally, each value must be of type `str`,
2546+
but for metadata keys ending with the suffix `-bin`, the corresponding values must
2547+
be of type `bytes`.
2548+
Returns:
2549+
~.location_pb2.Location:
2550+
Location object.
2551+
"""
2552+
# Create or coerce a protobuf request object.
2553+
# The request isn't a proto-plus wrapped type,
2554+
# so it must be constructed via keyword expansion.
2555+
if isinstance(request, dict):
2556+
request = locations_pb2.GetLocationRequest(**request)
2557+
2558+
# Wrap the RPC method; this adds retry and timeout information,
2559+
# and friendly error handling.
2560+
rpc = self._transport._wrapped_methods[self._transport.get_location]
2561+
2562+
# Certain fields should be provided within the metadata header;
2563+
# add these here.
2564+
metadata = tuple(metadata) + (
2565+
gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
2566+
)
2567+
2568+
# Validate the universe domain.
2569+
self._validate_universe_domain()
2570+
2571+
try:
2572+
# Send the request.
2573+
response = rpc(
2574+
request,
2575+
retry=retry,
2576+
timeout=timeout,
2577+
metadata=metadata,
2578+
)
2579+
2580+
# Done; return the response.
2581+
return response
2582+
except core_exceptions.GoogleAPICallError as e:
2583+
self._add_cred_info_for_auth_errors(e)
2584+
raise e
2585+
2586+
def list_locations(
2587+
self,
2588+
request: Optional[locations_pb2.ListLocationsRequest] = None,
2589+
*,
2590+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
2591+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
2592+
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
2593+
) -> locations_pb2.ListLocationsResponse:
2594+
r"""Lists information about the supported locations for this service.
2595+
2596+
Args:
2597+
request (:class:`~.location_pb2.ListLocationsRequest`):
2598+
The request object. Request message for
2599+
`ListLocations` method.
2600+
retry (google.api_core.retry.Retry): Designation of what errors,
2601+
if any, should be retried.
2602+
timeout (float): The timeout for this request.
2603+
metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
2604+
sent along with the request as metadata. Normally, each value must be of type `str`,
2605+
but for metadata keys ending with the suffix `-bin`, the corresponding values must
2606+
be of type `bytes`.
2607+
Returns:
2608+
~.location_pb2.ListLocationsResponse:
2609+
Response message for ``ListLocations`` method.
2610+
"""
2611+
# Create or coerce a protobuf request object.
2612+
# The request isn't a proto-plus wrapped type,
2613+
# so it must be constructed via keyword expansion.
2614+
if isinstance(request, dict):
2615+
request = locations_pb2.ListLocationsRequest(**request)
2616+
2617+
# Wrap the RPC method; this adds retry and timeout information,
2618+
# and friendly error handling.
2619+
rpc = self._transport._wrapped_methods[self._transport.list_locations]
2620+
2621+
# Certain fields should be provided within the metadata header;
2622+
# add these here.
2623+
metadata = tuple(metadata) + (
2624+
gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
2625+
)
2626+
2627+
# Validate the universe domain.
2628+
self._validate_universe_domain()
2629+
2630+
try:
2631+
# Send the request.
2632+
response = rpc(
2633+
request,
2634+
retry=retry,
2635+
timeout=timeout,
2636+
metadata=metadata,
2637+
)
2638+
2639+
# Done; return the response.
2640+
return response
2641+
except core_exceptions.GoogleAPICallError as e:
2642+
self._add_cred_info_for_auth_errors(e)
2643+
raise e
2644+
25262645

25272646
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
25282647
gapic_version=package_version.__version__

0 commit comments

Comments
 (0)