{-# 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.UpdateContainerInstancesState
-- 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)
--
-- Modifies the status of an Amazon ECS container instance.
--
-- Once a container instance has reached an @ACTIVE@ state, you can change
-- the status of a container instance to @DRAINING@ to manually remove an
-- instance from a cluster, for example to perform system updates, update
-- the Docker daemon, or scale down the cluster size.
--
-- A container instance cannot be changed to @DRAINING@ until it has
-- reached an @ACTIVE@ status. If the instance is in any other status, an
-- error will be received.
--
-- When you set a container instance to @DRAINING@, Amazon ECS prevents new
-- tasks from being scheduled for placement on the container instance and
-- replacement service tasks are started on other container instances in
-- the cluster if the resources are available. Service tasks on the
-- container instance that are in the @PENDING@ state are stopped
-- immediately.
--
-- Service tasks on the container instance that are in the @RUNNING@ state
-- are stopped and replaced according to the service\'s deployment
-- configuration parameters, @minimumHealthyPercent@ and @maximumPercent@.
-- You can change the deployment configuration of your service using
-- UpdateService.
--
-- -   If @minimumHealthyPercent@ is below 100%, the scheduler can ignore
--     @desiredCount@ temporarily during task replacement. For example,
--     @desiredCount@ is four tasks, a minimum of 50% allows the scheduler
--     to stop two existing tasks before starting two new tasks. If the
--     minimum is 100%, the service scheduler can\'t remove existing tasks
--     until the replacement tasks are considered healthy. Tasks for
--     services that do not use a load balancer are considered healthy if
--     they are in the @RUNNING@ state. Tasks for services that use a load
--     balancer are considered healthy if they are in the @RUNNING@ state
--     and the container instance they are hosted on is reported as healthy
--     by the load balancer.
--
-- -   The @maximumPercent@ parameter represents an upper limit on the
--     number of running tasks during task replacement, which enables you
--     to define the replacement batch size. For example, if @desiredCount@
--     is four tasks, a maximum of 200% starts four new tasks before
--     stopping the four tasks to be drained, provided that the cluster
--     resources required to do this are available. If the maximum is 100%,
--     then replacement tasks can\'t start until the draining tasks have
--     stopped.
--
-- Any @PENDING@ or @RUNNING@ tasks that do not belong to a service are not
-- affected. You must wait for them to finish or stop them manually.
--
-- A container instance has completed draining when it has no more
-- @RUNNING@ tasks. You can verify this using ListTasks.
--
-- When a container instance has been drained, you can set a container
-- instance to @ACTIVE@ status and once it has reached that status the
-- Amazon ECS scheduler can begin scheduling tasks on the instance again.
module Amazonka.ECS.UpdateContainerInstancesState
  ( -- * Creating a Request
    UpdateContainerInstancesState (..),
    newUpdateContainerInstancesState,

    -- * Request Lenses
    updateContainerInstancesState_cluster,
    updateContainerInstancesState_containerInstances,
    updateContainerInstancesState_status,

    -- * Destructuring the Response
    UpdateContainerInstancesStateResponse (..),
    newUpdateContainerInstancesStateResponse,

    -- * Response Lenses
    updateContainerInstancesStateResponse_failures,
    updateContainerInstancesStateResponse_containerInstances,
    updateContainerInstancesStateResponse_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:/ 'newUpdateContainerInstancesState' smart constructor.
data UpdateContainerInstancesState = UpdateContainerInstancesState'
  { -- | The short name or full Amazon Resource Name (ARN) of the cluster that
    -- hosts the container instance to update. If you do not specify a cluster,
    -- the default cluster is assumed.
    UpdateContainerInstancesState -> Maybe Text
cluster :: Prelude.Maybe Prelude.Text,
    -- | A list of container instance IDs or full ARN entries.
    UpdateContainerInstancesState -> [Text]
containerInstances :: [Prelude.Text],
    -- | The container instance state with which to update the container
    -- instance. The only valid values for this action are @ACTIVE@ and
    -- @DRAINING@. A container instance can only be updated to @DRAINING@
    -- status once it has reached an @ACTIVE@ state. If a container instance is
    -- in @REGISTERING@, @DEREGISTERING@, or @REGISTRATION_FAILED@ state you
    -- can describe the container instance but will be unable to update the
    -- container instance state.
    UpdateContainerInstancesState -> ContainerInstanceStatus
status :: ContainerInstanceStatus
  }
  deriving (UpdateContainerInstancesState
-> UpdateContainerInstancesState -> Bool
(UpdateContainerInstancesState
 -> UpdateContainerInstancesState -> Bool)
-> (UpdateContainerInstancesState
    -> UpdateContainerInstancesState -> Bool)
-> Eq UpdateContainerInstancesState
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateContainerInstancesState
-> UpdateContainerInstancesState -> Bool
$c/= :: UpdateContainerInstancesState
-> UpdateContainerInstancesState -> Bool
== :: UpdateContainerInstancesState
-> UpdateContainerInstancesState -> Bool
$c== :: UpdateContainerInstancesState
-> UpdateContainerInstancesState -> Bool
Prelude.Eq, ReadPrec [UpdateContainerInstancesState]
ReadPrec UpdateContainerInstancesState
Int -> ReadS UpdateContainerInstancesState
ReadS [UpdateContainerInstancesState]
(Int -> ReadS UpdateContainerInstancesState)
-> ReadS [UpdateContainerInstancesState]
-> ReadPrec UpdateContainerInstancesState
-> ReadPrec [UpdateContainerInstancesState]
-> Read UpdateContainerInstancesState
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateContainerInstancesState]
$creadListPrec :: ReadPrec [UpdateContainerInstancesState]
readPrec :: ReadPrec UpdateContainerInstancesState
$creadPrec :: ReadPrec UpdateContainerInstancesState
readList :: ReadS [UpdateContainerInstancesState]
$creadList :: ReadS [UpdateContainerInstancesState]
readsPrec :: Int -> ReadS UpdateContainerInstancesState
$creadsPrec :: Int -> ReadS UpdateContainerInstancesState
Prelude.Read, Int -> UpdateContainerInstancesState -> ShowS
[UpdateContainerInstancesState] -> ShowS
UpdateContainerInstancesState -> String
(Int -> UpdateContainerInstancesState -> ShowS)
-> (UpdateContainerInstancesState -> String)
-> ([UpdateContainerInstancesState] -> ShowS)
-> Show UpdateContainerInstancesState
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateContainerInstancesState] -> ShowS
$cshowList :: [UpdateContainerInstancesState] -> ShowS
show :: UpdateContainerInstancesState -> String
$cshow :: UpdateContainerInstancesState -> String
showsPrec :: Int -> UpdateContainerInstancesState -> ShowS
$cshowsPrec :: Int -> UpdateContainerInstancesState -> ShowS
Prelude.Show, (forall x.
 UpdateContainerInstancesState
 -> Rep UpdateContainerInstancesState x)
-> (forall x.
    Rep UpdateContainerInstancesState x
    -> UpdateContainerInstancesState)
-> Generic UpdateContainerInstancesState
forall x.
Rep UpdateContainerInstancesState x
-> UpdateContainerInstancesState
forall x.
UpdateContainerInstancesState
-> Rep UpdateContainerInstancesState x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UpdateContainerInstancesState x
-> UpdateContainerInstancesState
$cfrom :: forall x.
UpdateContainerInstancesState
-> Rep UpdateContainerInstancesState x
Prelude.Generic)

-- |
-- Create a value of 'UpdateContainerInstancesState' 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', 'updateContainerInstancesState_cluster' - The short name or full Amazon Resource Name (ARN) of the cluster that
-- hosts the container instance to update. If you do not specify a cluster,
-- the default cluster is assumed.
--
-- 'containerInstances', 'updateContainerInstancesState_containerInstances' - A list of container instance IDs or full ARN entries.
--
-- 'status', 'updateContainerInstancesState_status' - The container instance state with which to update the container
-- instance. The only valid values for this action are @ACTIVE@ and
-- @DRAINING@. A container instance can only be updated to @DRAINING@
-- status once it has reached an @ACTIVE@ state. If a container instance is
-- in @REGISTERING@, @DEREGISTERING@, or @REGISTRATION_FAILED@ state you
-- can describe the container instance but will be unable to update the
-- container instance state.
newUpdateContainerInstancesState ::
  -- | 'status'
  ContainerInstanceStatus ->
  UpdateContainerInstancesState
newUpdateContainerInstancesState :: ContainerInstanceStatus -> UpdateContainerInstancesState
newUpdateContainerInstancesState ContainerInstanceStatus
pStatus_ =
  UpdateContainerInstancesState' :: Maybe Text
-> [Text]
-> ContainerInstanceStatus
-> UpdateContainerInstancesState
UpdateContainerInstancesState'
    { $sel:cluster:UpdateContainerInstancesState' :: Maybe Text
cluster =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:containerInstances:UpdateContainerInstancesState' :: [Text]
containerInstances = [Text]
forall a. Monoid a => a
Prelude.mempty,
      $sel:status:UpdateContainerInstancesState' :: ContainerInstanceStatus
status = ContainerInstanceStatus
pStatus_
    }

-- | The short name or full Amazon Resource Name (ARN) of the cluster that
-- hosts the container instance to update. If you do not specify a cluster,
-- the default cluster is assumed.
updateContainerInstancesState_cluster :: Lens.Lens' UpdateContainerInstancesState (Prelude.Maybe Prelude.Text)
updateContainerInstancesState_cluster :: (Maybe Text -> f (Maybe Text))
-> UpdateContainerInstancesState -> f UpdateContainerInstancesState
updateContainerInstancesState_cluster = (UpdateContainerInstancesState -> Maybe Text)
-> (UpdateContainerInstancesState
    -> Maybe Text -> UpdateContainerInstancesState)
-> Lens
     UpdateContainerInstancesState
     UpdateContainerInstancesState
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateContainerInstancesState' {Maybe Text
cluster :: Maybe Text
$sel:cluster:UpdateContainerInstancesState' :: UpdateContainerInstancesState -> Maybe Text
cluster} -> Maybe Text
cluster) (\s :: UpdateContainerInstancesState
s@UpdateContainerInstancesState' {} Maybe Text
a -> UpdateContainerInstancesState
s {$sel:cluster:UpdateContainerInstancesState' :: Maybe Text
cluster = Maybe Text
a} :: UpdateContainerInstancesState)

-- | A list of container instance IDs or full ARN entries.
updateContainerInstancesState_containerInstances :: Lens.Lens' UpdateContainerInstancesState [Prelude.Text]
updateContainerInstancesState_containerInstances :: ([Text] -> f [Text])
-> UpdateContainerInstancesState -> f UpdateContainerInstancesState
updateContainerInstancesState_containerInstances = (UpdateContainerInstancesState -> [Text])
-> (UpdateContainerInstancesState
    -> [Text] -> UpdateContainerInstancesState)
-> Lens
     UpdateContainerInstancesState
     UpdateContainerInstancesState
     [Text]
     [Text]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateContainerInstancesState' {[Text]
containerInstances :: [Text]
$sel:containerInstances:UpdateContainerInstancesState' :: UpdateContainerInstancesState -> [Text]
containerInstances} -> [Text]
containerInstances) (\s :: UpdateContainerInstancesState
s@UpdateContainerInstancesState' {} [Text]
a -> UpdateContainerInstancesState
s {$sel:containerInstances:UpdateContainerInstancesState' :: [Text]
containerInstances = [Text]
a} :: UpdateContainerInstancesState) (([Text] -> f [Text])
 -> UpdateContainerInstancesState
 -> f UpdateContainerInstancesState)
-> (([Text] -> f [Text]) -> [Text] -> f [Text])
-> ([Text] -> f [Text])
-> UpdateContainerInstancesState
-> f UpdateContainerInstancesState
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([Text] -> f [Text]) -> [Text] -> f [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The container instance state with which to update the container
-- instance. The only valid values for this action are @ACTIVE@ and
-- @DRAINING@. A container instance can only be updated to @DRAINING@
-- status once it has reached an @ACTIVE@ state. If a container instance is
-- in @REGISTERING@, @DEREGISTERING@, or @REGISTRATION_FAILED@ state you
-- can describe the container instance but will be unable to update the
-- container instance state.
updateContainerInstancesState_status :: Lens.Lens' UpdateContainerInstancesState ContainerInstanceStatus
updateContainerInstancesState_status :: (ContainerInstanceStatus -> f ContainerInstanceStatus)
-> UpdateContainerInstancesState -> f UpdateContainerInstancesState
updateContainerInstancesState_status = (UpdateContainerInstancesState -> ContainerInstanceStatus)
-> (UpdateContainerInstancesState
    -> ContainerInstanceStatus -> UpdateContainerInstancesState)
-> Lens
     UpdateContainerInstancesState
     UpdateContainerInstancesState
     ContainerInstanceStatus
     ContainerInstanceStatus
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateContainerInstancesState' {ContainerInstanceStatus
status :: ContainerInstanceStatus
$sel:status:UpdateContainerInstancesState' :: UpdateContainerInstancesState -> ContainerInstanceStatus
status} -> ContainerInstanceStatus
status) (\s :: UpdateContainerInstancesState
s@UpdateContainerInstancesState' {} ContainerInstanceStatus
a -> UpdateContainerInstancesState
s {$sel:status:UpdateContainerInstancesState' :: ContainerInstanceStatus
status = ContainerInstanceStatus
a} :: UpdateContainerInstancesState)

instance
  Core.AWSRequest
    UpdateContainerInstancesState
  where
  type
    AWSResponse UpdateContainerInstancesState =
      UpdateContainerInstancesStateResponse
  request :: UpdateContainerInstancesState
-> Request UpdateContainerInstancesState
request = Service
-> UpdateContainerInstancesState
-> Request UpdateContainerInstancesState
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy UpdateContainerInstancesState
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse UpdateContainerInstancesState)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse UpdateContainerInstancesState))
-> Logger
-> Service
-> Proxy UpdateContainerInstancesState
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse UpdateContainerInstancesState)))
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 [Failure]
-> Maybe [ContainerInstance]
-> Int
-> UpdateContainerInstancesStateResponse
UpdateContainerInstancesStateResponse'
            (Maybe [Failure]
 -> Maybe [ContainerInstance]
 -> Int
 -> UpdateContainerInstancesStateResponse)
-> Either String (Maybe [Failure])
-> Either
     String
     (Maybe [ContainerInstance]
      -> Int -> UpdateContainerInstancesStateResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe (Maybe [Failure]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"failures" Either String (Maybe (Maybe [Failure]))
-> Maybe [Failure] -> Either String (Maybe [Failure])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [Failure]
forall a. Monoid a => a
Prelude.mempty)
            Either
  String
  (Maybe [ContainerInstance]
   -> Int -> UpdateContainerInstancesStateResponse)
-> Either String (Maybe [ContainerInstance])
-> Either String (Int -> UpdateContainerInstancesStateResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object -> Text -> Either String (Maybe (Maybe [ContainerInstance]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"containerInstances"
                            Either String (Maybe (Maybe [ContainerInstance]))
-> Maybe [ContainerInstance]
-> Either String (Maybe [ContainerInstance])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [ContainerInstance]
forall a. Monoid a => a
Prelude.mempty
                        )
            Either String (Int -> UpdateContainerInstancesStateResponse)
-> Either String Int
-> Either String UpdateContainerInstancesStateResponse
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
    UpdateContainerInstancesState

instance Prelude.NFData UpdateContainerInstancesState

instance Core.ToHeaders UpdateContainerInstancesState where
  toHeaders :: UpdateContainerInstancesState -> ResponseHeaders
toHeaders =
    ResponseHeaders -> UpdateContainerInstancesState -> 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.UpdateContainerInstancesState" ::
                          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 UpdateContainerInstancesState where
  toJSON :: UpdateContainerInstancesState -> Value
toJSON UpdateContainerInstancesState' {[Text]
Maybe Text
ContainerInstanceStatus
status :: ContainerInstanceStatus
containerInstances :: [Text]
cluster :: Maybe Text
$sel:status:UpdateContainerInstancesState' :: UpdateContainerInstancesState -> ContainerInstanceStatus
$sel:containerInstances:UpdateContainerInstancesState' :: UpdateContainerInstancesState -> [Text]
$sel:cluster:UpdateContainerInstancesState' :: UpdateContainerInstancesState -> 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,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"containerInstances" Text -> [Text] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= [Text]
containerInstances),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"status" Text -> ContainerInstanceStatus -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= ContainerInstanceStatus
status)
          ]
      )

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

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

-- | /See:/ 'newUpdateContainerInstancesStateResponse' smart constructor.
data UpdateContainerInstancesStateResponse = UpdateContainerInstancesStateResponse'
  { -- | Any failures associated with the call.
    UpdateContainerInstancesStateResponse -> Maybe [Failure]
failures :: Prelude.Maybe [Failure],
    -- | The list of container instances.
    UpdateContainerInstancesStateResponse -> Maybe [ContainerInstance]
containerInstances :: Prelude.Maybe [ContainerInstance],
    -- | The response's http status code.
    UpdateContainerInstancesStateResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (UpdateContainerInstancesStateResponse
-> UpdateContainerInstancesStateResponse -> Bool
(UpdateContainerInstancesStateResponse
 -> UpdateContainerInstancesStateResponse -> Bool)
-> (UpdateContainerInstancesStateResponse
    -> UpdateContainerInstancesStateResponse -> Bool)
-> Eq UpdateContainerInstancesStateResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateContainerInstancesStateResponse
-> UpdateContainerInstancesStateResponse -> Bool
$c/= :: UpdateContainerInstancesStateResponse
-> UpdateContainerInstancesStateResponse -> Bool
== :: UpdateContainerInstancesStateResponse
-> UpdateContainerInstancesStateResponse -> Bool
$c== :: UpdateContainerInstancesStateResponse
-> UpdateContainerInstancesStateResponse -> Bool
Prelude.Eq, ReadPrec [UpdateContainerInstancesStateResponse]
ReadPrec UpdateContainerInstancesStateResponse
Int -> ReadS UpdateContainerInstancesStateResponse
ReadS [UpdateContainerInstancesStateResponse]
(Int -> ReadS UpdateContainerInstancesStateResponse)
-> ReadS [UpdateContainerInstancesStateResponse]
-> ReadPrec UpdateContainerInstancesStateResponse
-> ReadPrec [UpdateContainerInstancesStateResponse]
-> Read UpdateContainerInstancesStateResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateContainerInstancesStateResponse]
$creadListPrec :: ReadPrec [UpdateContainerInstancesStateResponse]
readPrec :: ReadPrec UpdateContainerInstancesStateResponse
$creadPrec :: ReadPrec UpdateContainerInstancesStateResponse
readList :: ReadS [UpdateContainerInstancesStateResponse]
$creadList :: ReadS [UpdateContainerInstancesStateResponse]
readsPrec :: Int -> ReadS UpdateContainerInstancesStateResponse
$creadsPrec :: Int -> ReadS UpdateContainerInstancesStateResponse
Prelude.Read, Int -> UpdateContainerInstancesStateResponse -> ShowS
[UpdateContainerInstancesStateResponse] -> ShowS
UpdateContainerInstancesStateResponse -> String
(Int -> UpdateContainerInstancesStateResponse -> ShowS)
-> (UpdateContainerInstancesStateResponse -> String)
-> ([UpdateContainerInstancesStateResponse] -> ShowS)
-> Show UpdateContainerInstancesStateResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateContainerInstancesStateResponse] -> ShowS
$cshowList :: [UpdateContainerInstancesStateResponse] -> ShowS
show :: UpdateContainerInstancesStateResponse -> String
$cshow :: UpdateContainerInstancesStateResponse -> String
showsPrec :: Int -> UpdateContainerInstancesStateResponse -> ShowS
$cshowsPrec :: Int -> UpdateContainerInstancesStateResponse -> ShowS
Prelude.Show, (forall x.
 UpdateContainerInstancesStateResponse
 -> Rep UpdateContainerInstancesStateResponse x)
-> (forall x.
    Rep UpdateContainerInstancesStateResponse x
    -> UpdateContainerInstancesStateResponse)
-> Generic UpdateContainerInstancesStateResponse
forall x.
Rep UpdateContainerInstancesStateResponse x
-> UpdateContainerInstancesStateResponse
forall x.
UpdateContainerInstancesStateResponse
-> Rep UpdateContainerInstancesStateResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UpdateContainerInstancesStateResponse x
-> UpdateContainerInstancesStateResponse
$cfrom :: forall x.
UpdateContainerInstancesStateResponse
-> Rep UpdateContainerInstancesStateResponse x
Prelude.Generic)

-- |
-- Create a value of 'UpdateContainerInstancesStateResponse' 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:
--
-- 'failures', 'updateContainerInstancesStateResponse_failures' - Any failures associated with the call.
--
-- 'containerInstances', 'updateContainerInstancesStateResponse_containerInstances' - The list of container instances.
--
-- 'httpStatus', 'updateContainerInstancesStateResponse_httpStatus' - The response's http status code.
newUpdateContainerInstancesStateResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  UpdateContainerInstancesStateResponse
newUpdateContainerInstancesStateResponse :: Int -> UpdateContainerInstancesStateResponse
newUpdateContainerInstancesStateResponse Int
pHttpStatus_ =
  UpdateContainerInstancesStateResponse' :: Maybe [Failure]
-> Maybe [ContainerInstance]
-> Int
-> UpdateContainerInstancesStateResponse
UpdateContainerInstancesStateResponse'
    { $sel:failures:UpdateContainerInstancesStateResponse' :: Maybe [Failure]
failures =
        Maybe [Failure]
forall a. Maybe a
Prelude.Nothing,
      $sel:containerInstances:UpdateContainerInstancesStateResponse' :: Maybe [ContainerInstance]
containerInstances = Maybe [ContainerInstance]
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:UpdateContainerInstancesStateResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | Any failures associated with the call.
updateContainerInstancesStateResponse_failures :: Lens.Lens' UpdateContainerInstancesStateResponse (Prelude.Maybe [Failure])
updateContainerInstancesStateResponse_failures :: (Maybe [Failure] -> f (Maybe [Failure]))
-> UpdateContainerInstancesStateResponse
-> f UpdateContainerInstancesStateResponse
updateContainerInstancesStateResponse_failures = (UpdateContainerInstancesStateResponse -> Maybe [Failure])
-> (UpdateContainerInstancesStateResponse
    -> Maybe [Failure] -> UpdateContainerInstancesStateResponse)
-> Lens
     UpdateContainerInstancesStateResponse
     UpdateContainerInstancesStateResponse
     (Maybe [Failure])
     (Maybe [Failure])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateContainerInstancesStateResponse' {Maybe [Failure]
failures :: Maybe [Failure]
$sel:failures:UpdateContainerInstancesStateResponse' :: UpdateContainerInstancesStateResponse -> Maybe [Failure]
failures} -> Maybe [Failure]
failures) (\s :: UpdateContainerInstancesStateResponse
s@UpdateContainerInstancesStateResponse' {} Maybe [Failure]
a -> UpdateContainerInstancesStateResponse
s {$sel:failures:UpdateContainerInstancesStateResponse' :: Maybe [Failure]
failures = Maybe [Failure]
a} :: UpdateContainerInstancesStateResponse) ((Maybe [Failure] -> f (Maybe [Failure]))
 -> UpdateContainerInstancesStateResponse
 -> f UpdateContainerInstancesStateResponse)
-> ((Maybe [Failure] -> f (Maybe [Failure]))
    -> Maybe [Failure] -> f (Maybe [Failure]))
-> (Maybe [Failure] -> f (Maybe [Failure]))
-> UpdateContainerInstancesStateResponse
-> f UpdateContainerInstancesStateResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Failure] [Failure] [Failure] [Failure]
-> Iso
     (Maybe [Failure])
     (Maybe [Failure])
     (Maybe [Failure])
     (Maybe [Failure])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso [Failure] [Failure] [Failure] [Failure]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The list of container instances.
updateContainerInstancesStateResponse_containerInstances :: Lens.Lens' UpdateContainerInstancesStateResponse (Prelude.Maybe [ContainerInstance])
updateContainerInstancesStateResponse_containerInstances :: (Maybe [ContainerInstance] -> f (Maybe [ContainerInstance]))
-> UpdateContainerInstancesStateResponse
-> f UpdateContainerInstancesStateResponse
updateContainerInstancesStateResponse_containerInstances = (UpdateContainerInstancesStateResponse
 -> Maybe [ContainerInstance])
-> (UpdateContainerInstancesStateResponse
    -> Maybe [ContainerInstance]
    -> UpdateContainerInstancesStateResponse)
-> Lens
     UpdateContainerInstancesStateResponse
     UpdateContainerInstancesStateResponse
     (Maybe [ContainerInstance])
     (Maybe [ContainerInstance])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateContainerInstancesStateResponse' {Maybe [ContainerInstance]
containerInstances :: Maybe [ContainerInstance]
$sel:containerInstances:UpdateContainerInstancesStateResponse' :: UpdateContainerInstancesStateResponse -> Maybe [ContainerInstance]
containerInstances} -> Maybe [ContainerInstance]
containerInstances) (\s :: UpdateContainerInstancesStateResponse
s@UpdateContainerInstancesStateResponse' {} Maybe [ContainerInstance]
a -> UpdateContainerInstancesStateResponse
s {$sel:containerInstances:UpdateContainerInstancesStateResponse' :: Maybe [ContainerInstance]
containerInstances = Maybe [ContainerInstance]
a} :: UpdateContainerInstancesStateResponse) ((Maybe [ContainerInstance] -> f (Maybe [ContainerInstance]))
 -> UpdateContainerInstancesStateResponse
 -> f UpdateContainerInstancesStateResponse)
-> ((Maybe [ContainerInstance] -> f (Maybe [ContainerInstance]))
    -> Maybe [ContainerInstance] -> f (Maybe [ContainerInstance]))
-> (Maybe [ContainerInstance] -> f (Maybe [ContainerInstance]))
-> UpdateContainerInstancesStateResponse
-> f UpdateContainerInstancesStateResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [ContainerInstance]
  [ContainerInstance]
  [ContainerInstance]
  [ContainerInstance]
-> Iso
     (Maybe [ContainerInstance])
     (Maybe [ContainerInstance])
     (Maybe [ContainerInstance])
     (Maybe [ContainerInstance])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
  [ContainerInstance]
  [ContainerInstance]
  [ContainerInstance]
  [ContainerInstance]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance
  Prelude.NFData
    UpdateContainerInstancesStateResponse