aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/python/grpcio
diff options
context:
space:
mode:
authorGravatar Yang Gao <yangg@google.com>2015-08-28 15:48:22 -0700
committerGravatar Yang Gao <yangg@google.com>2015-08-28 15:48:22 -0700
commit036bf58b281e4ff65ccc62ea68002a50ddb626cc (patch)
tree16af4ed92842fcebd171d8b3433ca71b64da9f89 /src/python/grpcio
parent79777e0484809ff89a8ea80b6727a174e09c1201 (diff)
parent6c7185d350ef040fc3a2c0970de9268fd936504a (diff)
Merge pull request #3075 from jboeuf/credentials_naming_and_cleanup
Credentials naming and cleanup
Diffstat (limited to 'src/python/grpcio')
-rw-r--r--src/python/grpcio/grpc/_adapter/_c/types.h2
-rw-r--r--src/python/grpcio/grpc/_adapter/_c/types/client_credentials.c33
-rw-r--r--src/python/grpcio/grpc/_cython/_cygrpc/credentials.pyx20
-rw-r--r--src/python/grpcio/grpc/_cython/_cygrpc/grpc.pxd2
-rw-r--r--src/python/grpcio/grpc/_cython/adapter_low.py4
5 files changed, 4 insertions, 57 deletions
diff --git a/src/python/grpcio/grpc/_adapter/_c/types.h b/src/python/grpcio/grpc/_adapter/_c/types.h
index f6ff957baa..ec0687a9fd 100644
--- a/src/python/grpcio/grpc/_adapter/_c/types.h
+++ b/src/python/grpcio/grpc/_adapter/_c/types.h
@@ -57,8 +57,6 @@ ClientCredentials *pygrpc_ClientCredentials_composite(
PyTypeObject *type, PyObject *args, PyObject *kwargs);
ClientCredentials *pygrpc_ClientCredentials_compute_engine(
PyTypeObject *type, PyObject *ignored);
-ClientCredentials *pygrpc_ClientCredentials_service_account(
- PyTypeObject *type, PyObject *args, PyObject *kwargs);
ClientCredentials *pygrpc_ClientCredentials_jwt(
PyTypeObject *type, PyObject *args, PyObject *kwargs);
ClientCredentials *pygrpc_ClientCredentials_refresh_token(
diff --git a/src/python/grpcio/grpc/_adapter/_c/types/client_credentials.c b/src/python/grpcio/grpc/_adapter/_c/types/client_credentials.c
index 36fd207464..90652b7b47 100644
--- a/src/python/grpcio/grpc/_adapter/_c/types/client_credentials.c
+++ b/src/python/grpcio/grpc/_adapter/_c/types/client_credentials.c
@@ -48,8 +48,6 @@ PyMethodDef pygrpc_ClientCredentials_methods[] = {
METH_CLASS|METH_KEYWORDS, ""},
{"compute_engine", (PyCFunction)pygrpc_ClientCredentials_compute_engine,
METH_CLASS|METH_NOARGS, ""},
- {"service_account", (PyCFunction)pygrpc_ClientCredentials_service_account,
- METH_CLASS|METH_KEYWORDS, ""},
{"jwt", (PyCFunction)pygrpc_ClientCredentials_jwt,
METH_CLASS|METH_KEYWORDS, ""},
{"refresh_token", (PyCFunction)pygrpc_ClientCredentials_refresh_token,
@@ -173,7 +171,7 @@ ClientCredentials *pygrpc_ClientCredentials_composite(
ClientCredentials *pygrpc_ClientCredentials_compute_engine(
PyTypeObject *type, PyObject *ignored) {
ClientCredentials *self = (ClientCredentials *)type->tp_alloc(type, 0);
- self->c_creds = grpc_compute_engine_credentials_create(NULL);
+ self->c_creds = grpc_google_compute_engine_credentials_create(NULL);
if (!self->c_creds) {
Py_DECREF(self);
PyErr_SetString(PyExc_RuntimeError,
@@ -183,29 +181,6 @@ ClientCredentials *pygrpc_ClientCredentials_compute_engine(
return self;
}
-ClientCredentials *pygrpc_ClientCredentials_service_account(
- PyTypeObject *type, PyObject *args, PyObject *kwargs) {
- ClientCredentials *self;
- const char *json_key;
- const char *scope;
- double lifetime;
- static char *keywords[] = {"json_key", "scope", "token_lifetime", NULL};
- if (!PyArg_ParseTupleAndKeywords(args, kwargs, "ssd:service_account", keywords,
- &json_key, &scope, &lifetime)) {
- return NULL;
- }
- self = (ClientCredentials *)type->tp_alloc(type, 0);
- self->c_creds = grpc_service_account_credentials_create(
- json_key, scope, pygrpc_cast_double_to_gpr_timespec(lifetime), NULL);
- if (!self->c_creds) {
- Py_DECREF(self);
- PyErr_SetString(PyExc_RuntimeError,
- "couldn't create service account credentials");
- return NULL;
- }
- return self;
-}
-
/* TODO: Rename this credentials to something like service_account_jwt_access */
ClientCredentials *pygrpc_ClientCredentials_jwt(
PyTypeObject *type, PyObject *args, PyObject *kwargs) {
@@ -239,7 +214,7 @@ ClientCredentials *pygrpc_ClientCredentials_refresh_token(
}
self = (ClientCredentials *)type->tp_alloc(type, 0);
self->c_creds =
- grpc_refresh_token_credentials_create(json_refresh_token, NULL);
+ grpc_google_refresh_token_credentials_create(json_refresh_token, NULL);
if (!self->c_creds) {
Py_DECREF(self);
PyErr_SetString(PyExc_RuntimeError,
@@ -260,8 +235,8 @@ ClientCredentials *pygrpc_ClientCredentials_iam(
return NULL;
}
self = (ClientCredentials *)type->tp_alloc(type, 0);
- self->c_creds = grpc_iam_credentials_create(authorization_token,
- authority_selector, NULL);
+ self->c_creds = grpc_google_iam_credentials_create(authorization_token,
+ authority_selector, NULL);
if (!self->c_creds) {
Py_DECREF(self);
PyErr_SetString(PyExc_RuntimeError, "couldn't create IAM credentials");
diff --git a/src/python/grpcio/grpc/_cython/_cygrpc/credentials.pyx b/src/python/grpcio/grpc/_cython/_cygrpc/credentials.pyx
index 2d74702fbd..dc40a7a611 100644
--- a/src/python/grpcio/grpc/_cython/_cygrpc/credentials.pyx
+++ b/src/python/grpcio/grpc/_cython/_cygrpc/credentials.pyx
@@ -106,26 +106,6 @@ def client_credentials_compute_engine():
credentials.c_credentials = grpc.grpc_compute_engine_credentials_create()
return credentials
-def client_credentials_service_account(
- json_key, scope, records.Timespec token_lifetime not None):
- if isinstance(json_key, bytes):
- pass
- elif isinstance(json_key, basestring):
- json_key = json_key.encode()
- else:
- raise TypeError("expected json_key to be str or bytes")
- if isinstance(scope, bytes):
- pass
- elif isinstance(scope, basestring):
- scope = scope.encode()
- else:
- raise TypeError("expected scope to be str or bytes")
- cdef ClientCredentials credentials = ClientCredentials()
- credentials.c_credentials = grpc.grpc_service_account_credentials_create(
- json_key, scope, token_lifetime.c_time)
- credentials.references.extend([json_key, scope])
- return credentials
-
#TODO rename to something like client_credentials_service_account_jwt_access.
def client_credentials_jwt(json_key, records.Timespec token_lifetime not None):
if isinstance(json_key, bytes):
diff --git a/src/python/grpcio/grpc/_cython/_cygrpc/grpc.pxd b/src/python/grpcio/grpc/_cython/_cygrpc/grpc.pxd
index c793774c8d..8b46972490 100644
--- a/src/python/grpcio/grpc/_cython/_cygrpc/grpc.pxd
+++ b/src/python/grpcio/grpc/_cython/_cygrpc/grpc.pxd
@@ -311,8 +311,6 @@ cdef extern from "grpc/grpc_security.h":
grpc_credentials *grpc_composite_credentials_create(grpc_credentials *creds1,
grpc_credentials *creds2)
grpc_credentials *grpc_compute_engine_credentials_create()
- grpc_credentials *grpc_service_account_credentials_create(
- const char *json_key, const char *scope, gpr_timespec token_lifetime)
grpc_credentials *grpc_service_account_jwt_access_credentials_create(const char *json_key,
gpr_timespec token_lifetime)
grpc_credentials *grpc_refresh_token_credentials_create(
diff --git a/src/python/grpcio/grpc/_cython/adapter_low.py b/src/python/grpcio/grpc/_cython/adapter_low.py
index 2bb468eece..4f24da330f 100644
--- a/src/python/grpcio/grpc/_cython/adapter_low.py
+++ b/src/python/grpcio/grpc/_cython/adapter_low.py
@@ -60,10 +60,6 @@ class ClientCredentials(object):
raise NotImplementedError()
@staticmethod
- def service_account():
- raise NotImplementedError()
-
- @staticmethod
def jwt():
raise NotImplementedError()