@@ -294,7 +294,7 @@ def with_universe_domain(self, universe_domain):
294294
295295
296296class CredentialsWithRegionalAccessBoundary (Credentials ):
297- """Abstract base for credentials supporting ``with_regional_access_boundary`` factory """
297+ """Abstract base for credentials supporting regional access boundary configuration. """
298298
299299 def __init__ (self , * args , ** kwargs ):
300300 super (CredentialsWithRegionalAccessBoundary , self ).__init__ (* args , ** kwargs )
@@ -323,28 +323,16 @@ def _perform_refresh_token(self, request):
323323 """
324324 raise NotImplementedError ("_perform_refresh_token must be implemented" )
325325
326- def with_regional_access_boundary (self , regional_access_boundary ):
326+ def _with_regional_access_boundary (self , regional_access_boundary ):
327327 """Returns a copy of these credentials with a modified Regional Access Boundary.
328-
329- This method allows for manually providing the Regional Access Boundary
330- information, which will be cached with a 6-hour lifetime. This bypasses
331- the initial asynchronous lookup. After the cache expires, the library
332- will trigger a background refresh on the next request.
333-
328+ This is an internal method used by credential factory methods (e.g., from_info)
329+ to seed the RAB cache. The provided value is cached with the default TTL.
334330 Args:
335- regional_access_boundary (Mapping[str, str]): The Regional Access Boundary
336- to use for the credential. This should be a map with an
337- "encodedLocations" key that maps to a hex string. Optionally,
338- it can also contain a "locations" key with a list of GCP regions.
339- Example: `{"locations": ["us-central1"], "encodedLocations": "0xA30"}`
340-
331+ regional_access_boundary (dict): Must contain an "encodedLocations" key.
341332 Returns:
342- google.auth.credentials.Credentials: A new credentials instance
343- with the specified Regional Access Boundary.
344-
333+ google.auth.credentials.Credentials: A new credentials instance.
345334 Raises:
346- google.auth.exceptions.InvalidValue: If `regional_access_boundary`
347- is not a dictionary or does not contain the "encodedLocations" key.
335+ google.auth.exceptions.InvalidValue: If the input is malformed.
348336 """
349337 if (
350338 not isinstance (regional_access_boundary , dict )
@@ -377,28 +365,6 @@ def _copy_regional_access_boundary_state(self, target):
377365 # Create a new lock for the target instance to ensure independent thread-safety.
378366 target ._stale_boundary_lock = threading .Lock ()
379367
380- def handle_stale_regional_access_boundary (self , request ):
381- """Handles a stale regional access boundary error.
382- This method is thread-safe and will only initiate a single refresh
383- even if called concurrently.
384- Args:
385- request (google.auth.transport.Request): The object used to make
386- HTTP requests.
387- """
388- with self ._stale_boundary_lock :
389- # Another thread might have already handled the stale boundary.
390- if self ._regional_access_boundary is None :
391- return
392-
393- _LOGGER .info ("Stale regional access boundary detected. Refreshing." )
394-
395- # Clear the cached boundary.
396- self ._regional_access_boundary = None
397- self ._regional_access_boundary_expiry = None
398-
399- # Start the background refresh.
400- self ._regional_access_boundary_refresh_manager .start_refresh (self , request )
401-
402368 def _maybe_start_regional_access_boundary_refresh (self , request , url ):
403369 """
404370 Starts a background thread to refresh the Regional Access Boundary if needed.
0 commit comments