Exemple #1
0
    def from_service_account_json(cls, json_credentials_path, *args, **kwargs):
        """Factory to retrieve JSON credentials while creating client.

        :type json_credentials_path: string
        :param json_credentials_path: The path to a private key file (this file
                                      was given to you when you created the
                                      service account). This file must contain
                                      a JSON object with a private key and
                                      other credentials information (downloaded
                                      from the Google APIs console).

        :type args: tuple
        :param args: Remaining positional arguments to pass to constructor.

        :type kwargs: dictionary
        :param kwargs: Remaining keyword arguments to pass to constructor.

        :rtype: :class:`gcloud.pubsub.client.Client`
        :returns: The client created with the retrieved JSON credentials.
        :raises: class:`TypeError` if there is a conflict with the kwargs
                 and the credentials created by the factory.
        """
        if "credentials" in kwargs:
            raise TypeError("credentials must not be in keyword arguments")
        credentials = get_for_service_account_json(json_credentials_path)
        kwargs["credentials"] = credentials
        return cls(*args, **kwargs)
Exemple #2
0
    def from_service_account_json(cls, json_credentials_path, *args, **kwargs):
        """Factory to retrieve JSON credentials while creating client.

        :type json_credentials_path: string
        :param json_credentials_path: The path to a private key file (this file
                                      was given to you when you created the
                                      service account). This file must contain
                                      a JSON object with a private key and
                                      other credentials information (downloaded
                                      from the Google APIs console).

        :type args: tuple
        :param args: Remaining positional arguments to pass to constructor.

        :type kwargs: dict
        :param kwargs: Remaining keyword arguments to pass to constructor.

        :rtype: :class:`gcloud.pubsub.client.Client`
        :returns: The client created with the retrieved JSON credentials.
        :raises: :class:`TypeError` if there is a conflict with the kwargs
                 and the credentials created by the factory.
        """
        if 'credentials' in kwargs:
            raise TypeError('credentials must not be in keyword arguments')
        credentials = get_for_service_account_json(json_credentials_path)
        kwargs['credentials'] = credentials
        return cls(*args, **kwargs)
    def from_service_account_json(cls, json_credentials_path, *args, **kwargs):
        """Factory to retrieve JSON credentials while creating connection.

        :type json_credentials_path: string
        :param json_credentials_path: The path to a private key file (this file
                                      was given to you when you created the
                                      service account). This file must contain
                                      a JSON object with a private key and
                                      other credentials information (downloaded
                                      from the Google APIs console).

        :type args: tuple
        :param args: Remaining positional arguments to pass to constructor.

        :type kwargs: dictionary
        :param kwargs: Remaining keyword arguments to pass to constructor.

        :rtype: :class:`gcloud.connection.Connection`
        :returns: The connection created with the retrieved JSON credentials.
        """
        credentials = get_for_service_account_json(json_credentials_path)
        if 'credentials' in kwargs:
            raise TypeError('credentials must not be in keyword arguments')
        kwargs['credentials'] = credentials
        return cls(*args, **kwargs)
Exemple #4
0
    def from_service_account_json(cls, json_credentials_path, project=None):
        """Factory to retrieve JSON credentials while creating client.

        :type json_credentials_path: string
        :param json_credentials_path: The path to a private key file (this file
                                      was given to you when you created the
                                      service account). This file must contain
                                      a JSON object with a private key and
                                      other credentials information (downloaded
                                      from the Google APIs console).

        :type project: string
        :param project: the project which the client acts on behalf of. Will be
                        passed when creating a topic.  If not passed, falls
                        back to the default inferred from the environment.

        :rtype: :class:`gcloud.pubsub.client.Client`
        :returns: The client created with the retrieved JSON credentials.
        """
        credentials = get_for_service_account_json(json_credentials_path)
        return cls(project=project, credentials=credentials)
 def _callFUT(self, json_credentials_path, scope=None):
     from gcloud.credentials import get_for_service_account_json
     return get_for_service_account_json(json_credentials_path, scope=scope)
Exemple #6
0
 def _callFUT(self, json_credentials_path, scope=None):
     from gcloud.credentials import get_for_service_account_json
     return get_for_service_account_json(json_credentials_path, scope=scope)