def create(self): result = self.dnac.exec( family="sda", function="add_fabric", params=self.create_params(), op_modifies=True, ) if isinstance(result, dict): if 'response' in result: result = result.get('response') if isinstance(result, dict) and result.get("status") == "failed": raise AnsibleSDAException(response=result) return result
def get_object_by_name(self, name, is_absent=False): result = None # NOTICE: Does not have a get by name method, using get all try: items = self.dnac.exec( family="sda", function="get_sda_fabric_info", params=self.get_all_params(name=name), ) if isinstance(items, dict): if 'response' in items: items = items.get('response') if isinstance(items, dict) and items.get("status") == "failed": if is_absent: raise AnsibleSDAException(response=items) result = None return result result = get_dict_result(items, 'fabricName', name) except Exception: if is_absent: raise result = None return result
def get_object_by_name(self, name, is_absent=False): result = None # NOTICE: Does not have a get by name method or it is in another action try: items = self.dnac.exec( family="sda", function="get_virtual_network_with_scalable_groups", params=self.get_all_params(name=name), ) if isinstance(items, dict): if 'response' in items: items = items.get('response') if isinstance(items, dict) and items.get("status") == "failed": if is_absent: raise AnsibleSDAException(response=items) result = None return result result = get_dict_result(items, 'name', name) except Exception: if is_absent: raise result = None return result