/**
 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
 * SPDX-License-Identifier: Apache-2.0.
 */

#pragma once
#include <aws/batch/Batch_EXPORTS.h>
#include <aws/batch/model/EphemeralStorage.h>
#include <aws/batch/model/NetworkConfiguration.h>
#include <aws/batch/model/RuntimePlatform.h>
#include <aws/batch/model/TaskContainerProperties.h>
#include <aws/batch/model/Volume.h>
#include <aws/core/utils/memory/stl/AWSString.h>
#include <aws/core/utils/memory/stl/AWSVector.h>

#include <utility>

namespace Aws {
namespace Utils {
namespace Json {
class JsonValue;
class JsonView;
}  // namespace Json
}  // namespace Utils
namespace Batch {
namespace Model {

/**
 * <p>The properties for a task definition that describes the container and volume
 * definitions of an Amazon ECS task. You can specify which Docker images to use,
 * the required resources, and other configurations related to launching the task
 * definition through an Amazon ECS service or task.</p><p><h3>See Also:</h3>   <a
 * href="http://docs.aws.amazon.com/goto/WebAPI/batch-2016-08-10/EcsTaskProperties">AWS
 * API Reference</a></p>
 */
class EcsTaskProperties {
 public:
  AWS_BATCH_API EcsTaskProperties() = default;
  AWS_BATCH_API EcsTaskProperties(Aws::Utils::Json::JsonView jsonValue);
  AWS_BATCH_API EcsTaskProperties& operator=(Aws::Utils::Json::JsonView jsonValue);
  AWS_BATCH_API Aws::Utils::Json::JsonValue Jsonize() const;

  ///@{
  /**
   * <p>This object is a list of containers.</p>
   */
  inline const Aws::Vector<TaskContainerProperties>& GetContainers() const { return m_containers; }
  inline bool ContainersHasBeenSet() const { return m_containersHasBeenSet; }
  template <typename ContainersT = Aws::Vector<TaskContainerProperties>>
  void SetContainers(ContainersT&& value) {
    m_containersHasBeenSet = true;
    m_containers = std::forward<ContainersT>(value);
  }
  template <typename ContainersT = Aws::Vector<TaskContainerProperties>>
  EcsTaskProperties& WithContainers(ContainersT&& value) {
    SetContainers(std::forward<ContainersT>(value));
    return *this;
  }
  template <typename ContainersT = TaskContainerProperties>
  EcsTaskProperties& AddContainers(ContainersT&& value) {
    m_containersHasBeenSet = true;
    m_containers.emplace_back(std::forward<ContainersT>(value));
    return *this;
  }
  ///@}

  ///@{
  /**
   * <p>The amount of ephemeral storage to allocate for the task. This parameter is
   * used to expand the total amount of ephemeral storage available, beyond the
   * default amount, for tasks hosted on Fargate.</p>
   */
  inline const EphemeralStorage& GetEphemeralStorage() const { return m_ephemeralStorage; }
  inline bool EphemeralStorageHasBeenSet() const { return m_ephemeralStorageHasBeenSet; }
  template <typename EphemeralStorageT = EphemeralStorage>
  void SetEphemeralStorage(EphemeralStorageT&& value) {
    m_ephemeralStorageHasBeenSet = true;
    m_ephemeralStorage = std::forward<EphemeralStorageT>(value);
  }
  template <typename EphemeralStorageT = EphemeralStorage>
  EcsTaskProperties& WithEphemeralStorage(EphemeralStorageT&& value) {
    SetEphemeralStorage(std::forward<EphemeralStorageT>(value));
    return *this;
  }
  ///@}

  ///@{
  /**
   * <p>The Amazon Resource Name (ARN) of the execution role that Batch can assume.
   * For jobs that run on Fargate resources, you must provide an execution role. For
   * more information, see <a
   * href="https://docs.aws.amazon.com/batch/latest/userguide/execution-IAM-role.html">Batch
   * execution IAM role</a> in the <i>Batch User Guide</i>.</p>
   */
  inline const Aws::String& GetExecutionRoleArn() const { return m_executionRoleArn; }
  inline bool ExecutionRoleArnHasBeenSet() const { return m_executionRoleArnHasBeenSet; }
  template <typename ExecutionRoleArnT = Aws::String>
  void SetExecutionRoleArn(ExecutionRoleArnT&& value) {
    m_executionRoleArnHasBeenSet = true;
    m_executionRoleArn = std::forward<ExecutionRoleArnT>(value);
  }
  template <typename ExecutionRoleArnT = Aws::String>
  EcsTaskProperties& WithExecutionRoleArn(ExecutionRoleArnT&& value) {
    SetExecutionRoleArn(std::forward<ExecutionRoleArnT>(value));
    return *this;
  }
  ///@}

  ///@{
  /**
   * <p>The Fargate platform version where the jobs are running. A platform version
   * is specified only for jobs that are running on Fargate resources. If one isn't
   * specified, the <code>LATEST</code> platform version is used by default. This
   * uses a recent, approved version of the Fargate platform for compute resources.
   * For more information, see <a
   * href="https://docs.aws.amazon.com/AmazonECS/latest/developerguide/platform_versions.html">Fargate
   * platform versions</a> in the <i>Amazon Elastic Container Service Developer
   * Guide</i>.</p>
   */
  inline const Aws::String& GetPlatformVersion() const { return m_platformVersion; }
  inline bool PlatformVersionHasBeenSet() const { return m_platformVersionHasBeenSet; }
  template <typename PlatformVersionT = Aws::String>
  void SetPlatformVersion(PlatformVersionT&& value) {
    m_platformVersionHasBeenSet = true;
    m_platformVersion = std::forward<PlatformVersionT>(value);
  }
  template <typename PlatformVersionT = Aws::String>
  EcsTaskProperties& WithPlatformVersion(PlatformVersionT&& value) {
    SetPlatformVersion(std::forward<PlatformVersionT>(value));
    return *this;
  }
  ///@}

  ///@{
  /**
   * <p>The IPC resource namespace to use for the containers in the task. The valid
   * values are <code>host</code>, <code>task</code>, or <code>none</code>.</p> <p>If
   * <code>host</code> is specified, all containers within the tasks that specified
   * the <code>host</code> IPC mode on the same container instance share the same IPC
   * resources with the host Amazon EC2 instance.</p> <p>If <code>task</code> is
   * specified, all containers within the specified <code>task</code> share the same
   * IPC resources.</p> <p>If <code>none</code> is specified, the IPC resources
   * within the containers of a task are private, and are not shared with other
   * containers in a task or on the container instance. </p> <p>If no value is
   * specified, then the IPC resource namespace sharing depends on the Docker daemon
   * setting on the container instance. For more information, see <a
   * href="https://docs.docker.com/engine/reference/run/#ipc-settings---ipc">IPC
   * settings</a> in the Docker run reference.</p>
   */
  inline const Aws::String& GetIpcMode() const { return m_ipcMode; }
  inline bool IpcModeHasBeenSet() const { return m_ipcModeHasBeenSet; }
  template <typename IpcModeT = Aws::String>
  void SetIpcMode(IpcModeT&& value) {
    m_ipcModeHasBeenSet = true;
    m_ipcMode = std::forward<IpcModeT>(value);
  }
  template <typename IpcModeT = Aws::String>
  EcsTaskProperties& WithIpcMode(IpcModeT&& value) {
    SetIpcMode(std::forward<IpcModeT>(value));
    return *this;
  }
  ///@}

  ///@{
  /**
   * <p>The Amazon Resource Name (ARN) that's associated with the Amazon ECS
   * task.</p>  <p>This is object is comparable to <a
   * href="https://docs.aws.amazon.com/batch/latest/APIReference/API_ContainerProperties.html">ContainerProperties:jobRoleArn</a>.</p>
   *
   */
  inline const Aws::String& GetTaskRoleArn() const { return m_taskRoleArn; }
  inline bool TaskRoleArnHasBeenSet() const { return m_taskRoleArnHasBeenSet; }
  template <typename TaskRoleArnT = Aws::String>
  void SetTaskRoleArn(TaskRoleArnT&& value) {
    m_taskRoleArnHasBeenSet = true;
    m_taskRoleArn = std::forward<TaskRoleArnT>(value);
  }
  template <typename TaskRoleArnT = Aws::String>
  EcsTaskProperties& WithTaskRoleArn(TaskRoleArnT&& value) {
    SetTaskRoleArn(std::forward<TaskRoleArnT>(value));
    return *this;
  }
  ///@}

  ///@{
  /**
   * <p>The process namespace to use for the containers in the task. The valid values
   * are <code>host</code> or <code>task</code>. For example, monitoring sidecars
   * might need <code>pidMode</code> to access information about other containers
   * running in the same task.</p> <p>If <code>host</code> is specified, all
   * containers within the tasks that specified the <code>host</code> PID mode on the
   * same container instance share the process namespace with the host Amazon EC2
   * instance.</p> <p>If <code>task</code> is specified, all containers within the
   * specified task share the same process namespace.</p> <p>If no value is
   * specified, the default is a private namespace for each container. For more
   * information, see <a
   * href="https://docs.docker.com/engine/reference/run/#pid-settings---pid">PID
   * settings</a> in the Docker run reference.</p>
   */
  inline const Aws::String& GetPidMode() const { return m_pidMode; }
  inline bool PidModeHasBeenSet() const { return m_pidModeHasBeenSet; }
  template <typename PidModeT = Aws::String>
  void SetPidMode(PidModeT&& value) {
    m_pidModeHasBeenSet = true;
    m_pidMode = std::forward<PidModeT>(value);
  }
  template <typename PidModeT = Aws::String>
  EcsTaskProperties& WithPidMode(PidModeT&& value) {
    SetPidMode(std::forward<PidModeT>(value));
    return *this;
  }
  ///@}

  ///@{
  /**
   * <p>The network configuration for jobs that are running on Fargate resources.
   * Jobs that are running on Amazon EC2 resources must not specify this
   * parameter.</p>
   */
  inline const NetworkConfiguration& GetNetworkConfiguration() const { return m_networkConfiguration; }
  inline bool NetworkConfigurationHasBeenSet() const { return m_networkConfigurationHasBeenSet; }
  template <typename NetworkConfigurationT = NetworkConfiguration>
  void SetNetworkConfiguration(NetworkConfigurationT&& value) {
    m_networkConfigurationHasBeenSet = true;
    m_networkConfiguration = std::forward<NetworkConfigurationT>(value);
  }
  template <typename NetworkConfigurationT = NetworkConfiguration>
  EcsTaskProperties& WithNetworkConfiguration(NetworkConfigurationT&& value) {
    SetNetworkConfiguration(std::forward<NetworkConfigurationT>(value));
    return *this;
  }
  ///@}

  ///@{
  /**
   * <p>An object that represents the compute environment architecture for Batch jobs
   * on Fargate.</p>
   */
  inline const RuntimePlatform& GetRuntimePlatform() const { return m_runtimePlatform; }
  inline bool RuntimePlatformHasBeenSet() const { return m_runtimePlatformHasBeenSet; }
  template <typename RuntimePlatformT = RuntimePlatform>
  void SetRuntimePlatform(RuntimePlatformT&& value) {
    m_runtimePlatformHasBeenSet = true;
    m_runtimePlatform = std::forward<RuntimePlatformT>(value);
  }
  template <typename RuntimePlatformT = RuntimePlatform>
  EcsTaskProperties& WithRuntimePlatform(RuntimePlatformT&& value) {
    SetRuntimePlatform(std::forward<RuntimePlatformT>(value));
    return *this;
  }
  ///@}

  ///@{
  /**
   * <p>A list of volumes that are associated with the job.</p>
   */
  inline const Aws::Vector<Volume>& GetVolumes() const { return m_volumes; }
  inline bool VolumesHasBeenSet() const { return m_volumesHasBeenSet; }
  template <typename VolumesT = Aws::Vector<Volume>>
  void SetVolumes(VolumesT&& value) {
    m_volumesHasBeenSet = true;
    m_volumes = std::forward<VolumesT>(value);
  }
  template <typename VolumesT = Aws::Vector<Volume>>
  EcsTaskProperties& WithVolumes(VolumesT&& value) {
    SetVolumes(std::forward<VolumesT>(value));
    return *this;
  }
  template <typename VolumesT = Volume>
  EcsTaskProperties& AddVolumes(VolumesT&& value) {
    m_volumesHasBeenSet = true;
    m_volumes.emplace_back(std::forward<VolumesT>(value));
    return *this;
  }
  ///@}

  ///@{
  /**
   * <p>Determines whether execute command functionality is turned on for this task.
   * If <code>true</code>, execute command functionality is turned on all the
   * containers in the task.</p>
   */
  inline bool GetEnableExecuteCommand() const { return m_enableExecuteCommand; }
  inline bool EnableExecuteCommandHasBeenSet() const { return m_enableExecuteCommandHasBeenSet; }
  inline void SetEnableExecuteCommand(bool value) {
    m_enableExecuteCommandHasBeenSet = true;
    m_enableExecuteCommand = value;
  }
  inline EcsTaskProperties& WithEnableExecuteCommand(bool value) {
    SetEnableExecuteCommand(value);
    return *this;
  }
  ///@}
 private:
  Aws::Vector<TaskContainerProperties> m_containers;

  EphemeralStorage m_ephemeralStorage;

  Aws::String m_executionRoleArn;

  Aws::String m_platformVersion;

  Aws::String m_ipcMode;

  Aws::String m_taskRoleArn;

  Aws::String m_pidMode;

  NetworkConfiguration m_networkConfiguration;

  RuntimePlatform m_runtimePlatform;

  Aws::Vector<Volume> m_volumes;

  bool m_enableExecuteCommand{false};
  bool m_containersHasBeenSet = false;
  bool m_ephemeralStorageHasBeenSet = false;
  bool m_executionRoleArnHasBeenSet = false;
  bool m_platformVersionHasBeenSet = false;
  bool m_ipcModeHasBeenSet = false;
  bool m_taskRoleArnHasBeenSet = false;
  bool m_pidModeHasBeenSet = false;
  bool m_networkConfigurationHasBeenSet = false;
  bool m_runtimePlatformHasBeenSet = false;
  bool m_volumesHasBeenSet = false;
  bool m_enableExecuteCommandHasBeenSet = false;
};

}  // namespace Model
}  // namespace Batch
}  // namespace Aws
