# coding: utf-8

"""
    Cloudera Manager API

    <h1>Cloudera Manager API v50</h1>       <p>Introduced in Cloudera Manager 7.8.1</p>       <p><a href=\"http://www.cloudera.com/documentation.html\">Cloudera Product Documentation</a></p>

    OpenAPI spec version: 7.8.1
    
    Generated by: https://github.com/swagger-api/swagger-codegen.git
"""


from pprint import pformat
from six import iteritems
import re


class ApiCommandStep(object):
    """
    NOTE: This class is auto generated by the swagger code generator program.
    Do not edit the class manually.
    """


    """
    Attributes:
      swagger_types (dict): The key is attribute name
                            and the value is attribute type.
      attribute_map (dict): The key is attribute name
                            and the value is json key in definition.
    """
    swagger_types = {
        'description': 'str',
        'start_time': 'str',
        'end_time': 'str',
        'state': 'State',
        'result_message': 'str',
        'ignore_error': 'bool',
        'parallel': 'bool',
        'processes': 'list[ApiCommandStepProcess]',
        'client_configs': 'list[ApiCommandStepProcess]',
        'roles': 'list[ApiRoleRef]',
        'clusters': 'list[ApiClusterRef]',
        'hosts': 'list[ApiHostRef]',
        'services': 'list[ApiServiceRef]',
        'children': 'list[ApiCommandStep]',
        'commands': 'list[ApiCommand]',
        'remote_command': 'ApiRemoteCommand'
    }

    attribute_map = {
        'description': 'description',
        'start_time': 'startTime',
        'end_time': 'endTime',
        'state': 'state',
        'result_message': 'resultMessage',
        'ignore_error': 'ignoreError',
        'parallel': 'parallel',
        'processes': 'processes',
        'client_configs': 'clientConfigs',
        'roles': 'roles',
        'clusters': 'clusters',
        'hosts': 'hosts',
        'services': 'services',
        'children': 'children',
        'commands': 'commands',
        'remote_command': 'remoteCommand'
    }

    def __init__(self, description=None, start_time=None, end_time=None, state=None, result_message=None, ignore_error=None, parallel=None, processes=None, client_configs=None, roles=None, clusters=None, hosts=None, services=None, children=None, commands=None, remote_command=None):
        """
        ApiCommandStep - a model defined in Swagger
        """

        self._description = None
        self._start_time = None
        self._end_time = None
        self._state = None
        self._result_message = None
        self._ignore_error = None
        self._parallel = None
        self._processes = None
        self._client_configs = None
        self._roles = None
        self._clusters = None
        self._hosts = None
        self._services = None
        self._children = None
        self._commands = None
        self._remote_command = None

        if description is not None:
          self.description = description
        if start_time is not None:
          self.start_time = start_time
        if end_time is not None:
          self.end_time = end_time
        if state is not None:
          self.state = state
        if result_message is not None:
          self.result_message = result_message
        if ignore_error is not None:
          self.ignore_error = ignore_error
        if parallel is not None:
          self.parallel = parallel
        if processes is not None:
          self.processes = processes
        if client_configs is not None:
          self.client_configs = client_configs
        if roles is not None:
          self.roles = roles
        if clusters is not None:
          self.clusters = clusters
        if hosts is not None:
          self.hosts = hosts
        if services is not None:
          self.services = services
        if children is not None:
          self.children = children
        if commands is not None:
          self.commands = commands
        if remote_command is not None:
          self.remote_command = remote_command

    @property
    def description(self):
        """
        Gets the description of this ApiCommandStep.
        The command step description.

        :return: The description of this ApiCommandStep.
        :rtype: str
        """
        return self._description

    @description.setter
    def description(self, description):
        """
        Sets the description of this ApiCommandStep.
        The command step description.

        :param description: The description of this ApiCommandStep.
        :type: str
        """

        self._description = description

    @property
    def start_time(self):
        """
        Gets the start_time of this ApiCommandStep.
        The start time.

        :return: The start_time of this ApiCommandStep.
        :rtype: str
        """
        return self._start_time

    @start_time.setter
    def start_time(self, start_time):
        """
        Sets the start_time of this ApiCommandStep.
        The start time.

        :param start_time: The start_time of this ApiCommandStep.
        :type: str
        """

        self._start_time = start_time

    @property
    def end_time(self):
        """
        Gets the end_time of this ApiCommandStep.
        The end time, if the command step is finished.

        :return: The end_time of this ApiCommandStep.
        :rtype: str
        """
        return self._end_time

    @end_time.setter
    def end_time(self, end_time):
        """
        Sets the end_time of this ApiCommandStep.
        The end time, if the command step is finished.

        :param end_time: The end_time of this ApiCommandStep.
        :type: str
        """

        self._end_time = end_time

    @property
    def state(self):
        """
        Gets the state of this ApiCommandStep.
        Current state of the command step

        :return: The state of this ApiCommandStep.
        :rtype: State
        """
        return self._state

    @state.setter
    def state(self, state):
        """
        Sets the state of this ApiCommandStep.
        Current state of the command step

        :param state: The state of this ApiCommandStep.
        :type: State
        """

        self._state = state

    @property
    def result_message(self):
        """
        Gets the result_message of this ApiCommandStep.
        If the command step is finished, the result message.

        :return: The result_message of this ApiCommandStep.
        :rtype: str
        """
        return self._result_message

    @result_message.setter
    def result_message(self, result_message):
        """
        Sets the result_message of this ApiCommandStep.
        If the command step is finished, the result message.

        :param result_message: The result_message of this ApiCommandStep.
        :type: str
        """

        self._result_message = result_message

    @property
    def ignore_error(self):
        """
        Gets the ignore_error of this ApiCommandStep.
        Whether the step will continue even upon error.

        :return: The ignore_error of this ApiCommandStep.
        :rtype: bool
        """
        return self._ignore_error

    @ignore_error.setter
    def ignore_error(self, ignore_error):
        """
        Sets the ignore_error of this ApiCommandStep.
        Whether the step will continue even upon error.

        :param ignore_error: The ignore_error of this ApiCommandStep.
        :type: bool
        """

        self._ignore_error = ignore_error

    @property
    def parallel(self):
        """
        Gets the parallel of this ApiCommandStep.
        Whether the children are scattered simultaneously, i.e. parallel. If not they would execute one after another, i.e. serially.

        :return: The parallel of this ApiCommandStep.
        :rtype: bool
        """
        return self._parallel

    @parallel.setter
    def parallel(self, parallel):
        """
        Sets the parallel of this ApiCommandStep.
        Whether the children are scattered simultaneously, i.e. parallel. If not they would execute one after another, i.e. serially.

        :param parallel: The parallel of this ApiCommandStep.
        :type: bool
        """

        self._parallel = parallel

    @property
    def processes(self):
        """
        Gets the processes of this ApiCommandStep.
        List of processes executed by the command step.

        :return: The processes of this ApiCommandStep.
        :rtype: list[ApiCommandStepProcess]
        """
        return self._processes

    @processes.setter
    def processes(self, processes):
        """
        Sets the processes of this ApiCommandStep.
        List of processes executed by the command step.

        :param processes: The processes of this ApiCommandStep.
        :type: list[ApiCommandStepProcess]
        """

        self._processes = processes

    @property
    def client_configs(self):
        """
        Gets the client_configs of this ApiCommandStep.
        List of command step client configs.

        :return: The client_configs of this ApiCommandStep.
        :rtype: list[ApiCommandStepProcess]
        """
        return self._client_configs

    @client_configs.setter
    def client_configs(self, client_configs):
        """
        Sets the client_configs of this ApiCommandStep.
        List of command step client configs.

        :param client_configs: The client_configs of this ApiCommandStep.
        :type: list[ApiCommandStepProcess]
        """

        self._client_configs = client_configs

    @property
    def roles(self):
        """
        Gets the roles of this ApiCommandStep.
        List of command step roles.

        :return: The roles of this ApiCommandStep.
        :rtype: list[ApiRoleRef]
        """
        return self._roles

    @roles.setter
    def roles(self, roles):
        """
        Sets the roles of this ApiCommandStep.
        List of command step roles.

        :param roles: The roles of this ApiCommandStep.
        :type: list[ApiRoleRef]
        """

        self._roles = roles

    @property
    def clusters(self):
        """
        Gets the clusters of this ApiCommandStep.
        List of clusters associated with command step.

        :return: The clusters of this ApiCommandStep.
        :rtype: list[ApiClusterRef]
        """
        return self._clusters

    @clusters.setter
    def clusters(self, clusters):
        """
        Sets the clusters of this ApiCommandStep.
        List of clusters associated with command step.

        :param clusters: The clusters of this ApiCommandStep.
        :type: list[ApiClusterRef]
        """

        self._clusters = clusters

    @property
    def hosts(self):
        """
        Gets the hosts of this ApiCommandStep.
        List of hosts associated with command step.

        :return: The hosts of this ApiCommandStep.
        :rtype: list[ApiHostRef]
        """
        return self._hosts

    @hosts.setter
    def hosts(self, hosts):
        """
        Sets the hosts of this ApiCommandStep.
        List of hosts associated with command step.

        :param hosts: The hosts of this ApiCommandStep.
        :type: list[ApiHostRef]
        """

        self._hosts = hosts

    @property
    def services(self):
        """
        Gets the services of this ApiCommandStep.
        List of services associated with command step.

        :return: The services of this ApiCommandStep.
        :rtype: list[ApiServiceRef]
        """
        return self._services

    @services.setter
    def services(self, services):
        """
        Sets the services of this ApiCommandStep.
        List of services associated with command step.

        :param services: The services of this ApiCommandStep.
        :type: list[ApiServiceRef]
        """

        self._services = services

    @property
    def children(self):
        """
        Gets the children of this ApiCommandStep.
        List of child command steps.

        :return: The children of this ApiCommandStep.
        :rtype: list[ApiCommandStep]
        """
        return self._children

    @children.setter
    def children(self, children):
        """
        Sets the children of this ApiCommandStep.
        List of child command steps.

        :param children: The children of this ApiCommandStep.
        :type: list[ApiCommandStep]
        """

        self._children = children

    @property
    def commands(self):
        """
        Gets the commands of this ApiCommandStep.
        List of subcommands. <p> The list contains only the summary view of the commands.

        :return: The commands of this ApiCommandStep.
        :rtype: list[ApiCommand]
        """
        return self._commands

    @commands.setter
    def commands(self, commands):
        """
        Sets the commands of this ApiCommandStep.
        List of subcommands. <p> The list contains only the summary view of the commands.

        :param commands: The commands of this ApiCommandStep.
        :type: list[ApiCommand]
        """

        self._commands = commands

    @property
    def remote_command(self):
        """
        Gets the remote_command of this ApiCommandStep.
        Remote command executed by the current step on a peer cluster.

        :return: The remote_command of this ApiCommandStep.
        :rtype: ApiRemoteCommand
        """
        return self._remote_command

    @remote_command.setter
    def remote_command(self, remote_command):
        """
        Sets the remote_command of this ApiCommandStep.
        Remote command executed by the current step on a peer cluster.

        :param remote_command: The remote_command of this ApiCommandStep.
        :type: ApiRemoteCommand
        """

        self._remote_command = remote_command

    def to_dict(self):
        """
        Returns the model properties as a dict
        """
        result = {}

        for attr, _ in iteritems(self.swagger_types):
            value = getattr(self, attr)
            if isinstance(value, list):
                result[attr] = list(map(
                    lambda x: x.to_dict() if hasattr(x, "to_dict") else x,
                    value
                ))
            elif hasattr(value, "to_dict"):
                result[attr] = value.to_dict()
            elif isinstance(value, dict):
                result[attr] = dict(map(
                    lambda item: (item[0], item[1].to_dict())
                    if hasattr(item[1], "to_dict") else item,
                    value.items()
                ))
            else:
                result[attr] = value

        return result

    def to_str(self):
        """
        Returns the string representation of the model
        """
        return pformat(self.to_dict())

    def __repr__(self):
        """
        For `print` and `pprint`
        """
        return self.to_str()

    def __eq__(self, other):
        """
        Returns true if both objects are equal
        """
        if not isinstance(other, ApiCommandStep):
            return False

        return self.__dict__ == other.__dict__

    def __ne__(self, other):
        """
        Returns true if both objects are not equal
        """
        return not self == other
