def describe_file_systems(self, marker=None, max_items=10, creation_token=None, file_system_id=None): """Describe all the EFS File Systems, or specific File Systems. https://docs.aws.amazon.com/efs/latest/ug/API_DescribeFileSystems.html """ # Restrict the possible corpus of resules based on inputs. if creation_token and file_system_id: raise BadRequest( "Request cannot contain both a file system ID and a creation token." ) elif creation_token: # Handle the creation token case. corpus = [] for fs in self.file_systems_by_id.values(): if fs.creation_token == creation_token: corpus.append(fs) elif file_system_id: # Handle the case that a file_system_id is given. if file_system_id not in self.file_systems_by_id: raise FileSystemNotFound(file_system_id) corpus = [self.file_systems_by_id[file_system_id]] elif marker is not None: # Handle the case that a marker is given. if marker not in self.next_markers: raise BadRequest("Invalid Marker") corpus = self.next_markers[marker] else: # Handle the vanilla case. corpus = [fs for fs in self.file_systems_by_id.values()] # Handle the max_items parameter. file_systems = corpus[:max_items] next_marker = self._mark_description(corpus, max_items) return next_marker, file_systems