Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add support for auto IAM authentication to Connector #191

Merged
merged 30 commits into from
Jan 15, 2024

Conversation

jackwotherspoon
Copy link
Collaborator

@jackwotherspoon jackwotherspoon commented Dec 27, 2023

Perform new metadata exchange for connection through the Connector class and add support for automatic IAM authentication through enable_iam_authn flag.

Related to #152

NOTE: Still need to add support for auto iam authentication to AsyncConnector class to add support for asyncpg, follow-up PR incoming.

@jackwotherspoon jackwotherspoon self-assigned this Dec 27, 2023
@jackwotherspoon
Copy link
Collaborator Author

Integration tests passing ✅

Just need to setup mock metadata server for unit tests

Copy link
Member

@enocom enocom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking very good. Making sure we have the timeout right is probably the most important one.

google/api/field_behavior_pb2.py Show resolved Hide resolved
google/cloud/alloydb/connector/connector.py Outdated Show resolved Hide resolved
google/cloud/alloydb/connector/connector.py Outdated Show resolved Hide resolved
google/cloud/alloydb/connector/connector.py Outdated Show resolved Hide resolved
google/cloud/alloydb/connector/connector.py Outdated Show resolved Hide resolved

# validate metadata exchange response
if resp.response_code != connectorspb.MetadataExchangeResponse.OK:
raise ValueError("Metadata Exchange request has failed!")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's add the error message from the response in here.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let me know how this looks now, can't mimic the same as Go or Java as the Java and Go proto libraries at helper methods like GetResponseCode which I don't have here in PYthon

tests/unit/conftest.py Fixed Show resolved Hide resolved
@jackwotherspoon jackwotherspoon marked this pull request as ready for review January 12, 2024 21:27
@jackwotherspoon jackwotherspoon changed the title WIP: add support for auto IAM authentication feat: add support for auto IAM authentication with pg8000 Jan 12, 2024
@jackwotherspoon jackwotherspoon changed the title feat: add support for auto IAM authentication with pg8000 feat: add support for auto IAM authentication to Connector Jan 12, 2024
Copy link
Member

@enocom enocom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Non-blocking nits. If we don't add the extra unit tests in this PR, let's do it as a follow-up PR.

Nice work.

google/cloud/alloydb/connector/client.py Outdated Show resolved Hide resolved
google/cloud/alloydb/connector/client.py Outdated Show resolved Hide resolved
google/cloud/alloydb/connector/client.py Show resolved Hide resolved
tests/unit/mocks.py Outdated Show resolved Hide resolved
google/cloud/alloydb/connector/connector.py Outdated Show resolved Hide resolved
Copy link
Contributor

@ttosta-google ttosta-google left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jackwotherspoon jackwotherspoon merged commit c6c16e8 into main Jan 15, 2024
14 of 15 checks passed
@jackwotherspoon jackwotherspoon deleted the metadata-exchange branch January 15, 2024 20:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants