Skip to content

Commit

Permalink
Swap target, request for request, target in secure_authorized_channel…
Browse files Browse the repository at this point in the history
…'s argument order. (#81)
  • Loading branch information
Jon Wayne Parrott authored Nov 10, 2016
1 parent 53c7b17 commit 840b3ac
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion docs/user-guide.rst
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ this is to use google-auth to create the gRPC channel::
http_request = google.auth.transport.requests.Request()

channel = google.auth.transport.grpc.secure_authorized_channel(
credentials, 'pubsub.googleapis.com:443', http_request)
credentials, http_request, 'pubsub.googleapis.com:443')

.. note:: Even though gRPC is its own transport, you still need to use one of
the other HTTP transports with gRPC. The reason is that most credential
Expand Down
4 changes: 2 additions & 2 deletions google/auth/transport/grpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def __call__(self, context, callback):


def secure_authorized_channel(
credentials, target, request, ssl_credentials=None):
credentials, request, target, ssl_credentials=None):
"""Creates a secure authorized gRPC channel.
This creates a channel with SSL and :class:`AuthMetadataPlugin`. This
Expand Down Expand Up @@ -91,11 +91,11 @@ def secure_authorized_channel(
Args:
credentials (google.auth.credentials.Credentials): The credentials to
add to requests.
target (str): The host and port of the service.
request (google.auth.transport.Request): A HTTP transport request
object used to refresh credentials as needed. Even though gRPC
is a separate transport, there's no way to refresh the credentials
without using a standard http transport.
target (str): The host and port of the service.
ssl_credentials (grpc.ChannelCredentials): Optional SSL channel
credentials. This can be used to specify different certificates.
Expand Down
2 changes: 1 addition & 1 deletion system_tests/test_grpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def test_grpc_request(http_request):
publisher_api.PublisherApi.DEFAULT_SERVICE_PORT)

channel = google.auth.transport.grpc.secure_authorized_channel(
credentials, target, http_request)
credentials, http_request, target)

# Create a pub/sub client.
client = publisher_api.PublisherApi(channel=channel)
Expand Down
4 changes: 2 additions & 2 deletions tests/transport/test_grpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def test_secure_authorized_channel(
target = 'example.com:80'

channel = google.auth.transport.grpc.secure_authorized_channel(
credentials, target, request)
credentials, request, target)

# Check the auth plugin construction.
auth_plugin = metadata_call_credentials.call_args[0][0]
Expand Down Expand Up @@ -118,7 +118,7 @@ def test_secure_authorized_channel_explicit_ssl(
ssl_credentials = mock.Mock()

google.auth.transport.grpc.secure_authorized_channel(
credentials, target, request, ssl_credentials=ssl_credentials)
credentials, request, target, ssl_credentials=ssl_credentials)

# Check the ssl channel call.
assert not ssl_channel_credentials.called
Expand Down

0 comments on commit 840b3ac

Please sign in to comment.