# Path: fds/galaxy_fds_client_exception.py
# class GalaxyFDSClientException(Error):
#   def __init__(self, message):
#     self.message = message
# 
#   def __str__(self):
#     if self.message:
#       return super.__str__(self) + ": " + str(self.message)
#     return super.__str__(self)


import json
from fds.galaxy_fds_client_exception import GalaxyFDSClientException
        return rule
    return None

  def get_rule_by_object_name(self, object_name, enabled_rule_only=False):
    '''
    Get rule by object name
    :param object_name:
    :param enabled_rule_only:
    :return: Only one rule will return if more than one rules matched.
    '''
    for rule in self.rules:
      if object_name.startswith(rule.prefix) and (rule.enabled or not enabled_rule_only):
        return rule
    return None


class FDSLifecycleRule(dict):
  def __init__(self, json={}):
    dict.__init__(self, json)
    self._actions = {}
    for name, action in self.get('actions', {}).items():
      if name == 'abortIncompleteMultipartUpload':
        self._actions[name] = FDSAbortIncompleteMultipartUpload(action)
      elif name == 'expiration':
        self._actions[name] = FDSExpiration(action)
      elif name == 'nonCurrentVersionExpiration':
        self._actions[name] = FDSNonCurrentVersionExpiration(action)
      elif name == 'lifeCycleStorageClass':
        self._actions[name] = FDSLifecycleStorageClass(action)
      else:

# Path: fds/galaxy_fds_client_exception.py
# class GalaxyFDSClientException(Error):
#   def __init__(self, message):
#     self.message = message
# 
#   def __str__(self):
#     if self.message:
#       return super.__str__(self) + ": " + str(self.message)
#     return super.__str__(self)


# Path: fds/model/fds_lifecycle.py
import json
from fds.galaxy_fds_client_exception import GalaxyFDSClientException

        return rule
    return None

  def get_rule_by_object_name(self, object_name, enabled_rule_only=False):
    '''
    Get rule by object name
    :param object_name:
    :param enabled_rule_only:
    :return: Only one rule will return if more than one rules matched.
    '''
    for rule in self.rules:
      if object_name.startswith(rule.prefix) and (rule.enabled or not enabled_rule_only):
        return rule
    return None


class FDSLifecycleRule(dict):
  def __init__(self, json={}):
    dict.__init__(self, json)
    self._actions = {}
    for name, action in self.get('actions', {}).items():
      if name == 'abortIncompleteMultipartUpload':
        self._actions[name] = FDSAbortIncompleteMultipartUpload(action)
      elif name == 'expiration':
        self._actions[name] = FDSExpiration(action)
      elif name == 'nonCurrentVersionExpiration':
        self._actions[name] = FDSNonCurrentVersionExpiration(action)
      elif name == 'lifeCycleStorageClass':
        self._actions[name] = FDSLifecycleStorageClass(action)
      else:

        raise GalaxyFDSClientException("invalid action type: " + name)