Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: fix circular import due to make_admin_client and AdminClient bei…
…ng in the same file (#34)
- Loading branch information
1 parent
bc3318e
commit d631626
Showing
3 changed files
with
27 additions
and
22 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,23 @@ | ||
from typing import Optional | ||
|
||
from google.api_core.client_options import ClientOptions | ||
|
||
from google.cloud.pubsublite.admin_client import AdminClient | ||
from google.cloud.pubsublite.endpoints import regional_endpoint | ||
from google.cloud.pubsublite.internal.wire.admin_client_impl import AdminClientImpl | ||
from google.cloud.pubsublite.location import CloudRegion | ||
from google.cloud.pubsublite_v1 import AdminServiceClient | ||
from google.auth.credentials import Credentials | ||
|
||
|
||
def make_admin_client( | ||
region: CloudRegion, | ||
credentials: Optional[Credentials] = None, | ||
client_options: Optional[ClientOptions] = None, | ||
) -> AdminClient: | ||
if client_options is None: | ||
client_options = ClientOptions(api_endpoint=regional_endpoint(region)) | ||
return AdminClientImpl( | ||
AdminServiceClient(client_options=client_options, credentials=credentials), | ||
region, | ||
) |