mixcoatl/resource.py
def multiple_from_file(cls, filename):
        """ Load multiple DCM endpoint definitions from a json file and return a dictionary indexed by Endpoint
         nicknames.

        :param str filename: the full path to a json file containing and multiple endpoint definitions
        :returns: a dictionary of Endpoints indexed by endpoint nicknames
        :rtype: dictionary of Endpoint objects

        Here is an example json file that can be loaded by this function:

            .. code-block:: json

                [
                  {
                    "nickname": "saas",
                    "url": "https://dcm.enstratius.com/api/enstratus/2015-05-25",
                    "api_version": "2015-05-25",
                    "access_key": "abcdefg",
                    "secret_key": "gfedcba",
                    "ssl_verify": true
                  },
                  {
                    "nickname": "vagrant",
                    "url": "https://vagrant.vm/api/enstratus/2015-05-25",
                    "api_version": "2015-05-25",
                    "access_key": "abcdefg",
                    "secret_key": "gfedcba",
                    "ssl_verify": true
                  }
                ]
        """

        endpoint_json = open(filename).read()
        endpoint_in = json.loads(endpoint_json)
        endpoint_dict = {}

        for e in endpoint_in:
            endpoint_dict[e['nickname']] = Endpoint(url=e['url'],
                                                    basepath=e['basepath'] if 'basepath' in e else None,
                                                    api_version=e['api_version'],
                                                    secret_key=str(e['secret_key']),
                                                    access_key=str(e['access_key']),
                                                    ssl_verify=e['ssl_verify'] if 'ssl_verify' in e else None,
                                                    nickname=e['nickname'] if 'nickname' in e else None)
        return endpoint_dict
 Load multiple DCM endpoint definitions from a json file and return a dictionary indexed by Endpoint
         nicknames.

        :param str filename: the full path to a json file containing and multiple endpoint definitions
        :returns: a dictionary of Endpoints indexed by endpoint nicknames
        :rtype: dictionary of Endpoint objects

        Here is an example json file that can be loaded by this function:

            .. code-block:: json

                [
                  {
                    "nickname": "saas",
                    "url": "https://dcm.enstratius.com/api/enstratus/2015-05-25",
                    "api_version": "2015-05-25",
                    "access_key": "abcdefg",
                    "secret_key": "gfedcba",
                    "ssl_verify": true
                  },
                  {
                    "nickname": "vagrant",
                    "url": "https://vagrant.vm/api/enstratus/2015-05-25",
                    "api_version": "2015-05-25",
                    "access_key": "abcdefg",
                    "secret_key": "gfedcba",
                    "ssl_verify": true
                  }
                ]
        
Load multiple DCM endpoint definitions from a json file and return a dictionary indexed by Endpoint
nicknames.
Load multiple DCM endpoint definitions from a json file and return a dictionary indexed by Endpoint nicknames .
def multiple_from_file(cls, filename):
        endpoint_json = open(filename).read()
        endpoint_in = json.loads(endpoint_json)
        endpoint_dict = {}
        for e in endpoint_in:
            endpoint_dict[e['nickname']] = Endpoint(url=e['url'],
                                                    basepath=e['basepath'] if 'basepath' in e else None,
                                                    api_version=e['api_version'],
                                                    secret_key=str(e['secret_key']),
                                                    access_key=str(e['access_key']),
                                                    ssl_verify=e['ssl_verify'] if 'ssl_verify' in e else None,
                                                    nickname=e['nickname'] if 'nickname' in e else None)
        return endpoint_dict
def multiple_from_file ( cls , filename ) : endpoint_json = open ( filename ) . read ( ) endpoint_in = json . loads ( endpoint_json ) endpoint_dict = { } for e in endpoint_in : endpoint_dict [ e [ 'nickname' ] ] = Endpoint ( url = e [ 'url' ] , basepath = e [ 'basepath' ] if 'basepath' in e else None , api_version = e [ 'api_version' ] , secret_key = str ( e [ 'secret_key' ] ) , access_key = str ( e [ 'access_key' ] ) , ssl_verify = e [ 'ssl_verify' ] if 'ssl_verify' in e else None , nickname = e [ 'nickname' ] if 'nickname' in e else None ) return endpoint_dict
Load multiple DCM endpoint definitions from a json file and return a dictionary indexed by Endpoint
nicknames.
Load multiple DCM endpoint definitions from a json file and return a dictionary indexed by Endpoint nicknames .
""" Load multiple DCM endpoint definitions from a json file and return a dictionary indexed by Endpoint
         nicknames.

        :param str filename: the full path to a json file containing and multiple endpoint definitions
        :returns: a dictionary of Endpoints indexed by endpoint nicknames
        :rtype: dictionary of Endpoint objects

        Here is an example json file that can be loaded by this function:

            .. code-block:: json

                [
                  {
                    "nickname": "saas",
                    "url": "https://dcm.enstratius.com/api/enstratus/2015-05-25",
                    "api_version": "2015-05-25",
                    "access_key": "abcdefg",
                    "secret_key": "gfedcba",
                    "ssl_verify": true
                  },
                  {
                    "nickname": "vagrant",
                    "url": "https://vagrant.vm/api/enstratus/2015-05-25",
                    "api_version": "2015-05-25",
                    "access_key": "abcdefg",
                    "secret_key": "gfedcba",
                    "ssl_verify": true
                  }
                ]
        """
a dictionary of Endpoints indexed by endpoint nicknames
a dictionary of Endpoints indexed by endpoint nicknames
dictionary of Endpoint objects
Here is an example json file that can be loaded by this function:

    .. code-block:: json

        [
          {
            "nickname": "saas",
            "url": "https://dcm.enstratius.com/api/enstratus/2015-05-25",
            "api_version": "2015-05-25",
            "access_key": "abcdefg",
            "secret_key": "gfedcba",
            "ssl_verify": true
          },
          {
            "nickname": "vagrant",
            "url": "https://vagrant.vm/api/enstratus/2015-05-25",
            "api_version": "2015-05-25",
            "access_key": "abcdefg",
            "secret_key": "gfedcba",
            "ssl_verify": true
          }
        ]
cls
filename
the full path to a json file containing and multiple endpoint definitions
the full path to a json file containing and multiple endpoint definitions