{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.ECS.ExecuteCommand
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Runs a command remotely on a container within a task.
module Amazonka.ECS.ExecuteCommand
  ( -- * Creating a Request
    ExecuteCommand (..),
    newExecuteCommand,

    -- * Request Lenses
    executeCommand_cluster,
    executeCommand_container,
    executeCommand_command,
    executeCommand_interactive,
    executeCommand_task,

    -- * Destructuring the Response
    ExecuteCommandResponse (..),
    newExecuteCommandResponse,

    -- * Response Lenses
    executeCommandResponse_clusterArn,
    executeCommandResponse_containerArn,
    executeCommandResponse_taskArn,
    executeCommandResponse_containerName,
    executeCommandResponse_interactive,
    executeCommandResponse_session,
    executeCommandResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import Amazonka.ECS.Types
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newExecuteCommand' smart constructor.
data ExecuteCommand = ExecuteCommand'
  { -- | The Amazon Resource Name (ARN) or short name of the cluster the task is
    -- running in. If you do not specify a cluster, the default cluster is
    -- assumed.
    ExecuteCommand -> Maybe Text
cluster :: Prelude.Maybe Prelude.Text,
    -- | The name of the container to execute the command on. A container name
    -- only needs to be specified for tasks containing multiple containers.
    ExecuteCommand -> Maybe Text
container :: Prelude.Maybe Prelude.Text,
    -- | The command to run on the container.
    ExecuteCommand -> Text
command :: Prelude.Text,
    -- | Use this flag to run your command in interactive mode.
    ExecuteCommand -> Bool
interactive :: Prelude.Bool,
    -- | The Amazon Resource Name (ARN) or ID of the task the container is part
    -- of.
    ExecuteCommand -> Text
task :: Prelude.Text
  }
  deriving (ExecuteCommand -> ExecuteCommand -> Bool
(ExecuteCommand -> ExecuteCommand -> Bool)
-> (ExecuteCommand -> ExecuteCommand -> Bool) -> Eq ExecuteCommand
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ExecuteCommand -> ExecuteCommand -> Bool
$c/= :: ExecuteCommand -> ExecuteCommand -> Bool
== :: ExecuteCommand -> ExecuteCommand -> Bool
$c== :: ExecuteCommand -> ExecuteCommand -> Bool
Prelude.Eq, ReadPrec [ExecuteCommand]
ReadPrec ExecuteCommand
Int -> ReadS ExecuteCommand
ReadS [ExecuteCommand]
(Int -> ReadS ExecuteCommand)
-> ReadS [ExecuteCommand]
-> ReadPrec ExecuteCommand
-> ReadPrec [ExecuteCommand]
-> Read ExecuteCommand
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ExecuteCommand]
$creadListPrec :: ReadPrec [ExecuteCommand]
readPrec :: ReadPrec ExecuteCommand
$creadPrec :: ReadPrec ExecuteCommand
readList :: ReadS [ExecuteCommand]
$creadList :: ReadS [ExecuteCommand]
readsPrec :: Int -> ReadS ExecuteCommand
$creadsPrec :: Int -> ReadS ExecuteCommand
Prelude.Read, Int -> ExecuteCommand -> ShowS
[ExecuteCommand] -> ShowS
ExecuteCommand -> String
(Int -> ExecuteCommand -> ShowS)
-> (ExecuteCommand -> String)
-> ([ExecuteCommand] -> ShowS)
-> Show ExecuteCommand
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ExecuteCommand] -> ShowS
$cshowList :: [ExecuteCommand] -> ShowS
show :: ExecuteCommand -> String
$cshow :: ExecuteCommand -> String
showsPrec :: Int -> ExecuteCommand -> ShowS
$cshowsPrec :: Int -> ExecuteCommand -> ShowS
Prelude.Show, (forall x. ExecuteCommand -> Rep ExecuteCommand x)
-> (forall x. Rep ExecuteCommand x -> ExecuteCommand)
-> Generic ExecuteCommand
forall x. Rep ExecuteCommand x -> ExecuteCommand
forall x. ExecuteCommand -> Rep ExecuteCommand x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ExecuteCommand x -> ExecuteCommand
$cfrom :: forall x. ExecuteCommand -> Rep ExecuteCommand x
Prelude.Generic)

-- |
-- Create a value of 'ExecuteCommand' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'cluster', 'executeCommand_cluster' - The Amazon Resource Name (ARN) or short name of the cluster the task is
-- running in. If you do not specify a cluster, the default cluster is
-- assumed.
--
-- 'container', 'executeCommand_container' - The name of the container to execute the command on. A container name
-- only needs to be specified for tasks containing multiple containers.
--
-- 'command', 'executeCommand_command' - The command to run on the container.
--
-- 'interactive', 'executeCommand_interactive' - Use this flag to run your command in interactive mode.
--
-- 'task', 'executeCommand_task' - The Amazon Resource Name (ARN) or ID of the task the container is part
-- of.
newExecuteCommand ::
  -- | 'command'
  Prelude.Text ->
  -- | 'interactive'
  Prelude.Bool ->
  -- | 'task'
  Prelude.Text ->
  ExecuteCommand
newExecuteCommand :: Text -> Bool -> Text -> ExecuteCommand
newExecuteCommand Text
pCommand_ Bool
pInteractive_ Text
pTask_ =
  ExecuteCommand' :: Maybe Text -> Maybe Text -> Text -> Bool -> Text -> ExecuteCommand
ExecuteCommand'
    { $sel:cluster:ExecuteCommand' :: Maybe Text
cluster = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:container:ExecuteCommand' :: Maybe Text
container = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:command:ExecuteCommand' :: Text
command = Text
pCommand_,
      $sel:interactive:ExecuteCommand' :: Bool
interactive = Bool
pInteractive_,
      $sel:task:ExecuteCommand' :: Text
task = Text
pTask_
    }

-- | The Amazon Resource Name (ARN) or short name of the cluster the task is
-- running in. If you do not specify a cluster, the default cluster is
-- assumed.
executeCommand_cluster :: Lens.Lens' ExecuteCommand (Prelude.Maybe Prelude.Text)
executeCommand_cluster :: (Maybe Text -> f (Maybe Text))
-> ExecuteCommand -> f ExecuteCommand
executeCommand_cluster = (ExecuteCommand -> Maybe Text)
-> (ExecuteCommand -> Maybe Text -> ExecuteCommand)
-> Lens ExecuteCommand ExecuteCommand (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExecuteCommand' {Maybe Text
cluster :: Maybe Text
$sel:cluster:ExecuteCommand' :: ExecuteCommand -> Maybe Text
cluster} -> Maybe Text
cluster) (\s :: ExecuteCommand
s@ExecuteCommand' {} Maybe Text
a -> ExecuteCommand
s {$sel:cluster:ExecuteCommand' :: Maybe Text
cluster = Maybe Text
a} :: ExecuteCommand)

-- | The name of the container to execute the command on. A container name
-- only needs to be specified for tasks containing multiple containers.
executeCommand_container :: Lens.Lens' ExecuteCommand (Prelude.Maybe Prelude.Text)
executeCommand_container :: (Maybe Text -> f (Maybe Text))
-> ExecuteCommand -> f ExecuteCommand
executeCommand_container = (ExecuteCommand -> Maybe Text)
-> (ExecuteCommand -> Maybe Text -> ExecuteCommand)
-> Lens ExecuteCommand ExecuteCommand (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExecuteCommand' {Maybe Text
container :: Maybe Text
$sel:container:ExecuteCommand' :: ExecuteCommand -> Maybe Text
container} -> Maybe Text
container) (\s :: ExecuteCommand
s@ExecuteCommand' {} Maybe Text
a -> ExecuteCommand
s {$sel:container:ExecuteCommand' :: Maybe Text
container = Maybe Text
a} :: ExecuteCommand)

-- | The command to run on the container.
executeCommand_command :: Lens.Lens' ExecuteCommand Prelude.Text
executeCommand_command :: (Text -> f Text) -> ExecuteCommand -> f ExecuteCommand
executeCommand_command = (ExecuteCommand -> Text)
-> (ExecuteCommand -> Text -> ExecuteCommand)
-> Lens ExecuteCommand ExecuteCommand Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExecuteCommand' {Text
command :: Text
$sel:command:ExecuteCommand' :: ExecuteCommand -> Text
command} -> Text
command) (\s :: ExecuteCommand
s@ExecuteCommand' {} Text
a -> ExecuteCommand
s {$sel:command:ExecuteCommand' :: Text
command = Text
a} :: ExecuteCommand)

-- | Use this flag to run your command in interactive mode.
executeCommand_interactive :: Lens.Lens' ExecuteCommand Prelude.Bool
executeCommand_interactive :: (Bool -> f Bool) -> ExecuteCommand -> f ExecuteCommand
executeCommand_interactive = (ExecuteCommand -> Bool)
-> (ExecuteCommand -> Bool -> ExecuteCommand)
-> Lens ExecuteCommand ExecuteCommand Bool Bool
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExecuteCommand' {Bool
interactive :: Bool
$sel:interactive:ExecuteCommand' :: ExecuteCommand -> Bool
interactive} -> Bool
interactive) (\s :: ExecuteCommand
s@ExecuteCommand' {} Bool
a -> ExecuteCommand
s {$sel:interactive:ExecuteCommand' :: Bool
interactive = Bool
a} :: ExecuteCommand)

-- | The Amazon Resource Name (ARN) or ID of the task the container is part
-- of.
executeCommand_task :: Lens.Lens' ExecuteCommand Prelude.Text
executeCommand_task :: (Text -> f Text) -> ExecuteCommand -> f ExecuteCommand
executeCommand_task = (ExecuteCommand -> Text)
-> (ExecuteCommand -> Text -> ExecuteCommand)
-> Lens ExecuteCommand ExecuteCommand Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExecuteCommand' {Text
task :: Text
$sel:task:ExecuteCommand' :: ExecuteCommand -> Text
task} -> Text
task) (\s :: ExecuteCommand
s@ExecuteCommand' {} Text
a -> ExecuteCommand
s {$sel:task:ExecuteCommand' :: Text
task = Text
a} :: ExecuteCommand)

instance Core.AWSRequest ExecuteCommand where
  type
    AWSResponse ExecuteCommand =
      ExecuteCommandResponse
  request :: ExecuteCommand -> Request ExecuteCommand
request = Service -> ExecuteCommand -> Request ExecuteCommand
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy ExecuteCommand
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ExecuteCommand)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse ExecuteCommand))
-> Logger
-> Service
-> Proxy ExecuteCommand
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ExecuteCommand)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Bool
-> Maybe Session
-> Int
-> ExecuteCommandResponse
ExecuteCommandResponse'
            (Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Bool
 -> Maybe Session
 -> Int
 -> ExecuteCommandResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Bool
      -> Maybe Session
      -> Int
      -> ExecuteCommandResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"clusterArn")
            Either
  String
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Bool
   -> Maybe Session
   -> Int
   -> ExecuteCommandResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe Text
      -> Maybe Text
      -> Maybe Bool
      -> Maybe Session
      -> Int
      -> ExecuteCommandResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"containerArn")
            Either
  String
  (Maybe Text
   -> Maybe Text
   -> Maybe Bool
   -> Maybe Session
   -> Int
   -> ExecuteCommandResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe Text
      -> Maybe Bool -> Maybe Session -> Int -> ExecuteCommandResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"taskArn")
            Either
  String
  (Maybe Text
   -> Maybe Bool -> Maybe Session -> Int -> ExecuteCommandResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe Bool -> Maybe Session -> Int -> ExecuteCommandResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"containerName")
            Either
  String
  (Maybe Bool -> Maybe Session -> Int -> ExecuteCommandResponse)
-> Either String (Maybe Bool)
-> Either String (Maybe Session -> Int -> ExecuteCommandResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"interactive")
            Either String (Maybe Session -> Int -> ExecuteCommandResponse)
-> Either String (Maybe Session)
-> Either String (Int -> ExecuteCommandResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Session)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"session")
            Either String (Int -> ExecuteCommandResponse)
-> Either String Int -> Either String ExecuteCommandResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable ExecuteCommand

instance Prelude.NFData ExecuteCommand

instance Core.ToHeaders ExecuteCommand where
  toHeaders :: ExecuteCommand -> ResponseHeaders
toHeaders =
    ResponseHeaders -> ExecuteCommand -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"AmazonEC2ContainerServiceV20141113.ExecuteCommand" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Core.ToJSON ExecuteCommand where
  toJSON :: ExecuteCommand -> Value
toJSON ExecuteCommand' {Bool
Maybe Text
Text
task :: Text
interactive :: Bool
command :: Text
container :: Maybe Text
cluster :: Maybe Text
$sel:task:ExecuteCommand' :: ExecuteCommand -> Text
$sel:interactive:ExecuteCommand' :: ExecuteCommand -> Bool
$sel:command:ExecuteCommand' :: ExecuteCommand -> Text
$sel:container:ExecuteCommand' :: ExecuteCommand -> Maybe Text
$sel:cluster:ExecuteCommand' :: ExecuteCommand -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"cluster" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
cluster,
            (Text
"container" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
container,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"command" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
command),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"interactive" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Bool
interactive),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"task" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
task)
          ]
      )

instance Core.ToPath ExecuteCommand where
  toPath :: ExecuteCommand -> ByteString
toPath = ByteString -> ExecuteCommand -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

instance Core.ToQuery ExecuteCommand where
  toQuery :: ExecuteCommand -> QueryString
toQuery = QueryString -> ExecuteCommand -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty

-- | /See:/ 'newExecuteCommandResponse' smart constructor.
data ExecuteCommandResponse = ExecuteCommandResponse'
  { -- | The Amazon Resource Name (ARN) of the cluster.
    ExecuteCommandResponse -> Maybe Text
clusterArn :: Prelude.Maybe Prelude.Text,
    -- | The Amazon Resource Name (ARN) of the container.
    ExecuteCommandResponse -> Maybe Text
containerArn :: Prelude.Maybe Prelude.Text,
    -- | The Amazon Resource Name (ARN) of the task.
    ExecuteCommandResponse -> Maybe Text
taskArn :: Prelude.Maybe Prelude.Text,
    -- | The name of the container.
    ExecuteCommandResponse -> Maybe Text
containerName :: Prelude.Maybe Prelude.Text,
    -- | Whether or not the execute command session is running in interactive
    -- mode. Amazon ECS only supports initiating interactive sessions, so you
    -- must specify @true@ for this value.
    ExecuteCommandResponse -> Maybe Bool
interactive :: Prelude.Maybe Prelude.Bool,
    -- | The details of the SSM session that was created for this instance of
    -- execute-command.
    ExecuteCommandResponse -> Maybe Session
session :: Prelude.Maybe Session,
    -- | The response's http status code.
    ExecuteCommandResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ExecuteCommandResponse -> ExecuteCommandResponse -> Bool
(ExecuteCommandResponse -> ExecuteCommandResponse -> Bool)
-> (ExecuteCommandResponse -> ExecuteCommandResponse -> Bool)
-> Eq ExecuteCommandResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ExecuteCommandResponse -> ExecuteCommandResponse -> Bool
$c/= :: ExecuteCommandResponse -> ExecuteCommandResponse -> Bool
== :: ExecuteCommandResponse -> ExecuteCommandResponse -> Bool
$c== :: ExecuteCommandResponse -> ExecuteCommandResponse -> Bool
Prelude.Eq, Int -> ExecuteCommandResponse -> ShowS
[ExecuteCommandResponse] -> ShowS
ExecuteCommandResponse -> String
(Int -> ExecuteCommandResponse -> ShowS)
-> (ExecuteCommandResponse -> String)
-> ([ExecuteCommandResponse] -> ShowS)
-> Show ExecuteCommandResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ExecuteCommandResponse] -> ShowS
$cshowList :: [ExecuteCommandResponse] -> ShowS
show :: ExecuteCommandResponse -> String
$cshow :: ExecuteCommandResponse -> String
showsPrec :: Int -> ExecuteCommandResponse -> ShowS
$cshowsPrec :: Int -> ExecuteCommandResponse -> ShowS
Prelude.Show, (forall x. ExecuteCommandResponse -> Rep ExecuteCommandResponse x)
-> (forall x.
    Rep ExecuteCommandResponse x -> ExecuteCommandResponse)
-> Generic ExecuteCommandResponse
forall x. Rep ExecuteCommandResponse x -> ExecuteCommandResponse
forall x. ExecuteCommandResponse -> Rep ExecuteCommandResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ExecuteCommandResponse x -> ExecuteCommandResponse
$cfrom :: forall x. ExecuteCommandResponse -> Rep ExecuteCommandResponse x
Prelude.Generic)

-- |
-- Create a value of 'ExecuteCommandResponse' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'clusterArn', 'executeCommandResponse_clusterArn' - The Amazon Resource Name (ARN) of the cluster.
--
-- 'containerArn', 'executeCommandResponse_containerArn' - The Amazon Resource Name (ARN) of the container.
--
-- 'taskArn', 'executeCommandResponse_taskArn' - The Amazon Resource Name (ARN) of the task.
--
-- 'containerName', 'executeCommandResponse_containerName' - The name of the container.
--
-- 'interactive', 'executeCommandResponse_interactive' - Whether or not the execute command session is running in interactive
-- mode. Amazon ECS only supports initiating interactive sessions, so you
-- must specify @true@ for this value.
--
-- 'session', 'executeCommandResponse_session' - The details of the SSM session that was created for this instance of
-- execute-command.
--
-- 'httpStatus', 'executeCommandResponse_httpStatus' - The response's http status code.
newExecuteCommandResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ExecuteCommandResponse
newExecuteCommandResponse :: Int -> ExecuteCommandResponse
newExecuteCommandResponse Int
pHttpStatus_ =
  ExecuteCommandResponse' :: Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Bool
-> Maybe Session
-> Int
-> ExecuteCommandResponse
ExecuteCommandResponse'
    { $sel:clusterArn:ExecuteCommandResponse' :: Maybe Text
clusterArn =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:containerArn:ExecuteCommandResponse' :: Maybe Text
containerArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:taskArn:ExecuteCommandResponse' :: Maybe Text
taskArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:containerName:ExecuteCommandResponse' :: Maybe Text
containerName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:interactive:ExecuteCommandResponse' :: Maybe Bool
interactive = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:session:ExecuteCommandResponse' :: Maybe Session
session = Maybe Session
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ExecuteCommandResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The Amazon Resource Name (ARN) of the cluster.
executeCommandResponse_clusterArn :: Lens.Lens' ExecuteCommandResponse (Prelude.Maybe Prelude.Text)
executeCommandResponse_clusterArn :: (Maybe Text -> f (Maybe Text))
-> ExecuteCommandResponse -> f ExecuteCommandResponse
executeCommandResponse_clusterArn = (ExecuteCommandResponse -> Maybe Text)
-> (ExecuteCommandResponse -> Maybe Text -> ExecuteCommandResponse)
-> Lens
     ExecuteCommandResponse
     ExecuteCommandResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExecuteCommandResponse' {Maybe Text
clusterArn :: Maybe Text
$sel:clusterArn:ExecuteCommandResponse' :: ExecuteCommandResponse -> Maybe Text
clusterArn} -> Maybe Text
clusterArn) (\s :: ExecuteCommandResponse
s@ExecuteCommandResponse' {} Maybe Text
a -> ExecuteCommandResponse
s {$sel:clusterArn:ExecuteCommandResponse' :: Maybe Text
clusterArn = Maybe Text
a} :: ExecuteCommandResponse)

-- | The Amazon Resource Name (ARN) of the container.
executeCommandResponse_containerArn :: Lens.Lens' ExecuteCommandResponse (Prelude.Maybe Prelude.Text)
executeCommandResponse_containerArn :: (Maybe Text -> f (Maybe Text))
-> ExecuteCommandResponse -> f ExecuteCommandResponse
executeCommandResponse_containerArn = (ExecuteCommandResponse -> Maybe Text)
-> (ExecuteCommandResponse -> Maybe Text -> ExecuteCommandResponse)
-> Lens
     ExecuteCommandResponse
     ExecuteCommandResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExecuteCommandResponse' {Maybe Text
containerArn :: Maybe Text
$sel:containerArn:ExecuteCommandResponse' :: ExecuteCommandResponse -> Maybe Text
containerArn} -> Maybe Text
containerArn) (\s :: ExecuteCommandResponse
s@ExecuteCommandResponse' {} Maybe Text
a -> ExecuteCommandResponse
s {$sel:containerArn:ExecuteCommandResponse' :: Maybe Text
containerArn = Maybe Text
a} :: ExecuteCommandResponse)

-- | The Amazon Resource Name (ARN) of the task.
executeCommandResponse_taskArn :: Lens.Lens' ExecuteCommandResponse (Prelude.Maybe Prelude.Text)
executeCommandResponse_taskArn :: (Maybe Text -> f (Maybe Text))
-> ExecuteCommandResponse -> f ExecuteCommandResponse
executeCommandResponse_taskArn = (ExecuteCommandResponse -> Maybe Text)
-> (ExecuteCommandResponse -> Maybe Text -> ExecuteCommandResponse)
-> Lens
     ExecuteCommandResponse
     ExecuteCommandResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExecuteCommandResponse' {Maybe Text
taskArn :: Maybe Text
$sel:taskArn:ExecuteCommandResponse' :: ExecuteCommandResponse -> Maybe Text
taskArn} -> Maybe Text
taskArn) (\s :: ExecuteCommandResponse
s@ExecuteCommandResponse' {} Maybe Text
a -> ExecuteCommandResponse
s {$sel:taskArn:ExecuteCommandResponse' :: Maybe Text
taskArn = Maybe Text
a} :: ExecuteCommandResponse)

-- | The name of the container.
executeCommandResponse_containerName :: Lens.Lens' ExecuteCommandResponse (Prelude.Maybe Prelude.Text)
executeCommandResponse_containerName :: (Maybe Text -> f (Maybe Text))
-> ExecuteCommandResponse -> f ExecuteCommandResponse
executeCommandResponse_containerName = (ExecuteCommandResponse -> Maybe Text)
-> (ExecuteCommandResponse -> Maybe Text -> ExecuteCommandResponse)
-> Lens
     ExecuteCommandResponse
     ExecuteCommandResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExecuteCommandResponse' {Maybe Text
containerName :: Maybe Text
$sel:containerName:ExecuteCommandResponse' :: ExecuteCommandResponse -> Maybe Text
containerName} -> Maybe Text
containerName) (\s :: ExecuteCommandResponse
s@ExecuteCommandResponse' {} Maybe Text
a -> ExecuteCommandResponse
s {$sel:containerName:ExecuteCommandResponse' :: Maybe Text
containerName = Maybe Text
a} :: ExecuteCommandResponse)

-- | Whether or not the execute command session is running in interactive
-- mode. Amazon ECS only supports initiating interactive sessions, so you
-- must specify @true@ for this value.
executeCommandResponse_interactive :: Lens.Lens' ExecuteCommandResponse (Prelude.Maybe Prelude.Bool)
executeCommandResponse_interactive :: (Maybe Bool -> f (Maybe Bool))
-> ExecuteCommandResponse -> f ExecuteCommandResponse
executeCommandResponse_interactive = (ExecuteCommandResponse -> Maybe Bool)
-> (ExecuteCommandResponse -> Maybe Bool -> ExecuteCommandResponse)
-> Lens
     ExecuteCommandResponse
     ExecuteCommandResponse
     (Maybe Bool)
     (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExecuteCommandResponse' {Maybe Bool
interactive :: Maybe Bool
$sel:interactive:ExecuteCommandResponse' :: ExecuteCommandResponse -> Maybe Bool
interactive} -> Maybe Bool
interactive) (\s :: ExecuteCommandResponse
s@ExecuteCommandResponse' {} Maybe Bool
a -> ExecuteCommandResponse
s {$sel:interactive:ExecuteCommandResponse' :: Maybe Bool
interactive = Maybe Bool
a} :: ExecuteCommandResponse)

-- | The details of the SSM session that was created for this instance of
-- execute-command.
executeCommandResponse_session :: Lens.Lens' ExecuteCommandResponse (Prelude.Maybe Session)
executeCommandResponse_session :: (Maybe Session -> f (Maybe Session))
-> ExecuteCommandResponse -> f ExecuteCommandResponse
executeCommandResponse_session = (ExecuteCommandResponse -> Maybe Session)
-> (ExecuteCommandResponse
    -> Maybe Session -> ExecuteCommandResponse)
-> Lens
     ExecuteCommandResponse
     ExecuteCommandResponse
     (Maybe Session)
     (Maybe Session)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExecuteCommandResponse' {Maybe Session
session :: Maybe Session
$sel:session:ExecuteCommandResponse' :: ExecuteCommandResponse -> Maybe Session
session} -> Maybe Session
session) (\s :: ExecuteCommandResponse
s@ExecuteCommandResponse' {} Maybe Session
a -> ExecuteCommandResponse
s {$sel:session:ExecuteCommandResponse' :: Maybe Session
session = Maybe Session
a} :: ExecuteCommandResponse)

-- | The response's http status code.
executeCommandResponse_httpStatus :: Lens.Lens' ExecuteCommandResponse Prelude.Int
executeCommandResponse_httpStatus :: (Int -> f Int)
-> ExecuteCommandResponse -> f ExecuteCommandResponse
executeCommandResponse_httpStatus = (ExecuteCommandResponse -> Int)
-> (ExecuteCommandResponse -> Int -> ExecuteCommandResponse)
-> Lens ExecuteCommandResponse ExecuteCommandResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExecuteCommandResponse' {Int
httpStatus :: Int
$sel:httpStatus:ExecuteCommandResponse' :: ExecuteCommandResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ExecuteCommandResponse
s@ExecuteCommandResponse' {} Int
a -> ExecuteCommandResponse
s {$sel:httpStatus:ExecuteCommandResponse' :: Int
httpStatus = Int
a} :: ExecuteCommandResponse)

instance Prelude.NFData ExecuteCommandResponse