def _parse_svc_config(self, json_dic, view=None): """Parse a json-decoded ApiServiceConfig dictionary into a 2-tuple :param json_dic: The json dictionary with the config data. :param view: View to materialize. :return: 2-tuple (service config dictionary, role type configurations) """ svc_config = types.json_to_config(json_dic, view == "full") rt_configs = {} if ROLETYPES_CFG_KEY in json_dic: for rt_config in json_dic[ROLETYPES_CFG_KEY]: rt_configs[rt_config["roleType"]] = types.json_to_config(rt_config, view == "full") return (svc_config, rt_configs)
def _parse_svc_config(self, json_dic, view=None): """Parse a json-decoded ApiServiceConfig dictionary into a 2-tuple :param json_dic: The json dictionary with the config data. :param view: View to materialize. :return: 2-tuple (service config dictionary, role type configurations) """ svc_config = types.json_to_config(json_dic, view == 'full') rt_configs = {} if ROLETYPES_CFG_KEY in json_dic: for rt_config in json_dic[ROLETYPES_CFG_KEY]: rt_configs[rt_config['roleType']] = types.json_to_config( rt_config, view == 'full') return (svc_config, rt_configs)
def update_config(self, config): """Update the group's configuration :param config: Dictionary with configuration to update. :return: Dictionary with updated configuration. """ path = self._path() + "/config" resp = self._get_resource_root().put(path, data=types.config_to_json(config)) return types.json_to_config(resp)
def update_config(self, config): """Update the group's configuration :param config: Dictionary with configuration to update. :return: Dictionary with updated configuration. """ path = self._path() + '/config' resp = self._get_resource_root().put( path, data=types.config_to_json(config)) return types.json_to_config(resp)
def get_config(self, view=None): """Retrieve the group's configuration The 'summary' view contains strings as the dictionary values. The full view contains types.ApiConfig instances as the values. :param view: View to materialize ('full' or 'summary'). :return: Dictionary with configuration data. """ path = self._path() + "/config" resp = self._get_resource_root().get(path, params=(dict(view=view) if view else None)) return types.json_to_config(resp, view == "full")
def get_config(self, view=None): """Retrieve the group's configuration The 'summary' view contains strings as the dictionary values. The full view contains types.ApiConfig instances as the values. :param view: View to materialize ('full' or 'summary'). :return: Dictionary with configuration data. """ path = self._path() + '/config' resp = self._get_resource_root().get( path, params=(dict(view=view) if view else None)) return types.json_to_config(resp, view == 'full')