{-# 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.DeregisterContainerInstance
-- 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)
--
-- Deregisters an Amazon ECS container instance from the specified cluster.
-- This instance is no longer available to run tasks.
--
-- If you intend to use the container instance for some other purpose after
-- deregistration, you should stop all of the tasks running on the
-- container instance before deregistration. That prevents any orphaned
-- tasks from consuming resources.
--
-- Deregistering a container instance removes the instance from a cluster,
-- but it does not terminate the EC2 instance. If you are finished using
-- the instance, be sure to terminate it in the Amazon EC2 console to stop
-- billing.
--
-- If you terminate a running container instance, Amazon ECS automatically
-- deregisters the instance from your cluster (stopped container instances
-- or instances with disconnected agents are not automatically deregistered
-- when terminated).
module Amazonka.ECS.DeregisterContainerInstance
  ( -- * Creating a Request
    DeregisterContainerInstance (..),
    newDeregisterContainerInstance,

    -- * Request Lenses
    deregisterContainerInstance_cluster,
    deregisterContainerInstance_force,
    deregisterContainerInstance_containerInstance,

    -- * Destructuring the Response
    DeregisterContainerInstanceResponse (..),
    newDeregisterContainerInstanceResponse,

    -- * Response Lenses
    deregisterContainerInstanceResponse_containerInstance,
    deregisterContainerInstanceResponse_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:/ 'newDeregisterContainerInstance' smart constructor.
data DeregisterContainerInstance = DeregisterContainerInstance'
  { -- | The short name or full Amazon Resource Name (ARN) of the cluster that
    -- hosts the container instance to deregister. If you do not specify a
    -- cluster, the default cluster is assumed.
    DeregisterContainerInstance -> Maybe Text
cluster :: Prelude.Maybe Prelude.Text,
    -- | Forces the deregistration of the container instance. If you have tasks
    -- running on the container instance when you deregister it with the
    -- @force@ option, these tasks remain running until you terminate the
    -- instance or the tasks stop through some other means, but they are
    -- orphaned (no longer monitored or accounted for by Amazon ECS). If an
    -- orphaned task on your container instance is part of an Amazon ECS
    -- service, then the service scheduler starts another copy of that task, on
    -- a different container instance if possible.
    --
    -- Any containers in orphaned service tasks that are registered with a
    -- Classic Load Balancer or an Application Load Balancer target group are
    -- deregistered. They begin connection draining according to the settings
    -- on the load balancer or target group.
    DeregisterContainerInstance -> Maybe Bool
force :: Prelude.Maybe Prelude.Bool,
    -- | The container instance ID or full ARN of the container instance to
    -- deregister. The ARN contains the @arn:aws:ecs@ namespace, followed by
    -- the Region of the container instance, the Amazon Web Services account ID
    -- of the container instance owner, the @container-instance@ namespace, and
    -- then the container instance ID. For example,
    -- @arn:aws:ecs:region:aws_account_id:container-instance\/container_instance_ID@.
    DeregisterContainerInstance -> Text
containerInstance :: Prelude.Text
  }
  deriving (DeregisterContainerInstance -> DeregisterContainerInstance -> Bool
(DeregisterContainerInstance
 -> DeregisterContainerInstance -> Bool)
-> (DeregisterContainerInstance
    -> DeregisterContainerInstance -> Bool)
-> Eq DeregisterContainerInstance
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeregisterContainerInstance -> DeregisterContainerInstance -> Bool
$c/= :: DeregisterContainerInstance -> DeregisterContainerInstance -> Bool
== :: DeregisterContainerInstance -> DeregisterContainerInstance -> Bool
$c== :: DeregisterContainerInstance -> DeregisterContainerInstance -> Bool
Prelude.Eq, ReadPrec [DeregisterContainerInstance]
ReadPrec DeregisterContainerInstance
Int -> ReadS DeregisterContainerInstance
ReadS [DeregisterContainerInstance]
(Int -> ReadS DeregisterContainerInstance)
-> ReadS [DeregisterContainerInstance]
-> ReadPrec DeregisterContainerInstance
-> ReadPrec [DeregisterContainerInstance]
-> Read DeregisterContainerInstance
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeregisterContainerInstance]
$creadListPrec :: ReadPrec [DeregisterContainerInstance]
readPrec :: ReadPrec DeregisterContainerInstance
$creadPrec :: ReadPrec DeregisterContainerInstance
readList :: ReadS [DeregisterContainerInstance]
$creadList :: ReadS [DeregisterContainerInstance]
readsPrec :: Int -> ReadS DeregisterContainerInstance
$creadsPrec :: Int -> ReadS DeregisterContainerInstance
Prelude.Read, Int -> DeregisterContainerInstance -> ShowS
[DeregisterContainerInstance] -> ShowS
DeregisterContainerInstance -> String
(Int -> DeregisterContainerInstance -> ShowS)
-> (DeregisterContainerInstance -> String)
-> ([DeregisterContainerInstance] -> ShowS)
-> Show DeregisterContainerInstance
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeregisterContainerInstance] -> ShowS
$cshowList :: [DeregisterContainerInstance] -> ShowS
show :: DeregisterContainerInstance -> String
$cshow :: DeregisterContainerInstance -> String
showsPrec :: Int -> DeregisterContainerInstance -> ShowS
$cshowsPrec :: Int -> DeregisterContainerInstance -> ShowS
Prelude.Show, (forall x.
 DeregisterContainerInstance -> Rep DeregisterContainerInstance x)
-> (forall x.
    Rep DeregisterContainerInstance x -> DeregisterContainerInstance)
-> Generic DeregisterContainerInstance
forall x.
Rep DeregisterContainerInstance x -> DeregisterContainerInstance
forall x.
DeregisterContainerInstance -> Rep DeregisterContainerInstance x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DeregisterContainerInstance x -> DeregisterContainerInstance
$cfrom :: forall x.
DeregisterContainerInstance -> Rep DeregisterContainerInstance x
Prelude.Generic)

-- |
-- Create a value of 'DeregisterContainerInstance' 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', 'deregisterContainerInstance_cluster' - The short name or full Amazon Resource Name (ARN) of the cluster that
-- hosts the container instance to deregister. If you do not specify a
-- cluster, the default cluster is assumed.
--
-- 'force', 'deregisterContainerInstance_force' - Forces the deregistration of the container instance. If you have tasks
-- running on the container instance when you deregister it with the
-- @force@ option, these tasks remain running until you terminate the
-- instance or the tasks stop through some other means, but they are
-- orphaned (no longer monitored or accounted for by Amazon ECS). If an
-- orphaned task on your container instance is part of an Amazon ECS
-- service, then the service scheduler starts another copy of that task, on
-- a different container instance if possible.
--
-- Any containers in orphaned service tasks that are registered with a
-- Classic Load Balancer or an Application Load Balancer target group are
-- deregistered. They begin connection draining according to the settings
-- on the load balancer or target group.
--
-- 'containerInstance', 'deregisterContainerInstance_containerInstance' - The container instance ID or full ARN of the container instance to
-- deregister. The ARN contains the @arn:aws:ecs@ namespace, followed by
-- the Region of the container instance, the Amazon Web Services account ID
-- of the container instance owner, the @container-instance@ namespace, and
-- then the container instance ID. For example,
-- @arn:aws:ecs:region:aws_account_id:container-instance\/container_instance_ID@.
newDeregisterContainerInstance ::
  -- | 'containerInstance'
  Prelude.Text ->
  DeregisterContainerInstance
newDeregisterContainerInstance :: Text -> DeregisterContainerInstance
newDeregisterContainerInstance Text
pContainerInstance_ =
  DeregisterContainerInstance' :: Maybe Text -> Maybe Bool -> Text -> DeregisterContainerInstance
DeregisterContainerInstance'
    { $sel:cluster:DeregisterContainerInstance' :: Maybe Text
cluster =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:force:DeregisterContainerInstance' :: Maybe Bool
force = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:containerInstance:DeregisterContainerInstance' :: Text
containerInstance = Text
pContainerInstance_
    }

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

-- | Forces the deregistration of the container instance. If you have tasks
-- running on the container instance when you deregister it with the
-- @force@ option, these tasks remain running until you terminate the
-- instance or the tasks stop through some other means, but they are
-- orphaned (no longer monitored or accounted for by Amazon ECS). If an
-- orphaned task on your container instance is part of an Amazon ECS
-- service, then the service scheduler starts another copy of that task, on
-- a different container instance if possible.
--
-- Any containers in orphaned service tasks that are registered with a
-- Classic Load Balancer or an Application Load Balancer target group are
-- deregistered. They begin connection draining according to the settings
-- on the load balancer or target group.
deregisterContainerInstance_force :: Lens.Lens' DeregisterContainerInstance (Prelude.Maybe Prelude.Bool)
deregisterContainerInstance_force :: (Maybe Bool -> f (Maybe Bool))
-> DeregisterContainerInstance -> f DeregisterContainerInstance
deregisterContainerInstance_force = (DeregisterContainerInstance -> Maybe Bool)
-> (DeregisterContainerInstance
    -> Maybe Bool -> DeregisterContainerInstance)
-> Lens
     DeregisterContainerInstance
     DeregisterContainerInstance
     (Maybe Bool)
     (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeregisterContainerInstance' {Maybe Bool
force :: Maybe Bool
$sel:force:DeregisterContainerInstance' :: DeregisterContainerInstance -> Maybe Bool
force} -> Maybe Bool
force) (\s :: DeregisterContainerInstance
s@DeregisterContainerInstance' {} Maybe Bool
a -> DeregisterContainerInstance
s {$sel:force:DeregisterContainerInstance' :: Maybe Bool
force = Maybe Bool
a} :: DeregisterContainerInstance)

-- | The container instance ID or full ARN of the container instance to
-- deregister. The ARN contains the @arn:aws:ecs@ namespace, followed by
-- the Region of the container instance, the Amazon Web Services account ID
-- of the container instance owner, the @container-instance@ namespace, and
-- then the container instance ID. For example,
-- @arn:aws:ecs:region:aws_account_id:container-instance\/container_instance_ID@.
deregisterContainerInstance_containerInstance :: Lens.Lens' DeregisterContainerInstance Prelude.Text
deregisterContainerInstance_containerInstance :: (Text -> f Text)
-> DeregisterContainerInstance -> f DeregisterContainerInstance
deregisterContainerInstance_containerInstance = (DeregisterContainerInstance -> Text)
-> (DeregisterContainerInstance
    -> Text -> DeregisterContainerInstance)
-> Lens
     DeregisterContainerInstance DeregisterContainerInstance Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeregisterContainerInstance' {Text
containerInstance :: Text
$sel:containerInstance:DeregisterContainerInstance' :: DeregisterContainerInstance -> Text
containerInstance} -> Text
containerInstance) (\s :: DeregisterContainerInstance
s@DeregisterContainerInstance' {} Text
a -> DeregisterContainerInstance
s {$sel:containerInstance:DeregisterContainerInstance' :: Text
containerInstance = Text
a} :: DeregisterContainerInstance)

instance Core.AWSRequest DeregisterContainerInstance where
  type
    AWSResponse DeregisterContainerInstance =
      DeregisterContainerInstanceResponse
  request :: DeregisterContainerInstance -> Request DeregisterContainerInstance
request = Service
-> DeregisterContainerInstance
-> Request DeregisterContainerInstance
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy DeregisterContainerInstance
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeregisterContainerInstance)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse DeregisterContainerInstance))
-> Logger
-> Service
-> Proxy DeregisterContainerInstance
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeregisterContainerInstance)))
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 ContainerInstance
-> Int -> DeregisterContainerInstanceResponse
DeregisterContainerInstanceResponse'
            (Maybe ContainerInstance
 -> Int -> DeregisterContainerInstanceResponse)
-> Either String (Maybe ContainerInstance)
-> Either String (Int -> DeregisterContainerInstanceResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe ContainerInstance)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"containerInstance")
            Either String (Int -> DeregisterContainerInstanceResponse)
-> Either String Int
-> Either String DeregisterContainerInstanceResponse
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 DeregisterContainerInstance

instance Prelude.NFData DeregisterContainerInstance

instance Core.ToHeaders DeregisterContainerInstance where
  toHeaders :: DeregisterContainerInstance -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DeregisterContainerInstance -> 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.DeregisterContainerInstance" ::
                          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 DeregisterContainerInstance where
  toJSON :: DeregisterContainerInstance -> Value
toJSON DeregisterContainerInstance' {Maybe Bool
Maybe Text
Text
containerInstance :: Text
force :: Maybe Bool
cluster :: Maybe Text
$sel:containerInstance:DeregisterContainerInstance' :: DeregisterContainerInstance -> Text
$sel:force:DeregisterContainerInstance' :: DeregisterContainerInstance -> Maybe Bool
$sel:cluster:DeregisterContainerInstance' :: DeregisterContainerInstance -> 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
"force" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
force,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"containerInstance" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
containerInstance)
          ]
      )

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

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

-- | /See:/ 'newDeregisterContainerInstanceResponse' smart constructor.
data DeregisterContainerInstanceResponse = DeregisterContainerInstanceResponse'
  { -- | The container instance that was deregistered.
    DeregisterContainerInstanceResponse -> Maybe ContainerInstance
containerInstance :: Prelude.Maybe ContainerInstance,
    -- | The response's http status code.
    DeregisterContainerInstanceResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DeregisterContainerInstanceResponse
-> DeregisterContainerInstanceResponse -> Bool
(DeregisterContainerInstanceResponse
 -> DeregisterContainerInstanceResponse -> Bool)
-> (DeregisterContainerInstanceResponse
    -> DeregisterContainerInstanceResponse -> Bool)
-> Eq DeregisterContainerInstanceResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeregisterContainerInstanceResponse
-> DeregisterContainerInstanceResponse -> Bool
$c/= :: DeregisterContainerInstanceResponse
-> DeregisterContainerInstanceResponse -> Bool
== :: DeregisterContainerInstanceResponse
-> DeregisterContainerInstanceResponse -> Bool
$c== :: DeregisterContainerInstanceResponse
-> DeregisterContainerInstanceResponse -> Bool
Prelude.Eq, ReadPrec [DeregisterContainerInstanceResponse]
ReadPrec DeregisterContainerInstanceResponse
Int -> ReadS DeregisterContainerInstanceResponse
ReadS [DeregisterContainerInstanceResponse]
(Int -> ReadS DeregisterContainerInstanceResponse)
-> ReadS [DeregisterContainerInstanceResponse]
-> ReadPrec DeregisterContainerInstanceResponse
-> ReadPrec [DeregisterContainerInstanceResponse]
-> Read DeregisterContainerInstanceResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeregisterContainerInstanceResponse]
$creadListPrec :: ReadPrec [DeregisterContainerInstanceResponse]
readPrec :: ReadPrec DeregisterContainerInstanceResponse
$creadPrec :: ReadPrec DeregisterContainerInstanceResponse
readList :: ReadS [DeregisterContainerInstanceResponse]
$creadList :: ReadS [DeregisterContainerInstanceResponse]
readsPrec :: Int -> ReadS DeregisterContainerInstanceResponse
$creadsPrec :: Int -> ReadS DeregisterContainerInstanceResponse
Prelude.Read, Int -> DeregisterContainerInstanceResponse -> ShowS
[DeregisterContainerInstanceResponse] -> ShowS
DeregisterContainerInstanceResponse -> String
(Int -> DeregisterContainerInstanceResponse -> ShowS)
-> (DeregisterContainerInstanceResponse -> String)
-> ([DeregisterContainerInstanceResponse] -> ShowS)
-> Show DeregisterContainerInstanceResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeregisterContainerInstanceResponse] -> ShowS
$cshowList :: [DeregisterContainerInstanceResponse] -> ShowS
show :: DeregisterContainerInstanceResponse -> String
$cshow :: DeregisterContainerInstanceResponse -> String
showsPrec :: Int -> DeregisterContainerInstanceResponse -> ShowS
$cshowsPrec :: Int -> DeregisterContainerInstanceResponse -> ShowS
Prelude.Show, (forall x.
 DeregisterContainerInstanceResponse
 -> Rep DeregisterContainerInstanceResponse x)
-> (forall x.
    Rep DeregisterContainerInstanceResponse x
    -> DeregisterContainerInstanceResponse)
-> Generic DeregisterContainerInstanceResponse
forall x.
Rep DeregisterContainerInstanceResponse x
-> DeregisterContainerInstanceResponse
forall x.
DeregisterContainerInstanceResponse
-> Rep DeregisterContainerInstanceResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DeregisterContainerInstanceResponse x
-> DeregisterContainerInstanceResponse
$cfrom :: forall x.
DeregisterContainerInstanceResponse
-> Rep DeregisterContainerInstanceResponse x
Prelude.Generic)

-- |
-- Create a value of 'DeregisterContainerInstanceResponse' 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:
--
-- 'containerInstance', 'deregisterContainerInstanceResponse_containerInstance' - The container instance that was deregistered.
--
-- 'httpStatus', 'deregisterContainerInstanceResponse_httpStatus' - The response's http status code.
newDeregisterContainerInstanceResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DeregisterContainerInstanceResponse
newDeregisterContainerInstanceResponse :: Int -> DeregisterContainerInstanceResponse
newDeregisterContainerInstanceResponse Int
pHttpStatus_ =
  DeregisterContainerInstanceResponse' :: Maybe ContainerInstance
-> Int -> DeregisterContainerInstanceResponse
DeregisterContainerInstanceResponse'
    { $sel:containerInstance:DeregisterContainerInstanceResponse' :: Maybe ContainerInstance
containerInstance =
        Maybe ContainerInstance
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DeregisterContainerInstanceResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The container instance that was deregistered.
deregisterContainerInstanceResponse_containerInstance :: Lens.Lens' DeregisterContainerInstanceResponse (Prelude.Maybe ContainerInstance)
deregisterContainerInstanceResponse_containerInstance :: (Maybe ContainerInstance -> f (Maybe ContainerInstance))
-> DeregisterContainerInstanceResponse
-> f DeregisterContainerInstanceResponse
deregisterContainerInstanceResponse_containerInstance = (DeregisterContainerInstanceResponse -> Maybe ContainerInstance)
-> (DeregisterContainerInstanceResponse
    -> Maybe ContainerInstance -> DeregisterContainerInstanceResponse)
-> Lens
     DeregisterContainerInstanceResponse
     DeregisterContainerInstanceResponse
     (Maybe ContainerInstance)
     (Maybe ContainerInstance)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeregisterContainerInstanceResponse' {Maybe ContainerInstance
containerInstance :: Maybe ContainerInstance
$sel:containerInstance:DeregisterContainerInstanceResponse' :: DeregisterContainerInstanceResponse -> Maybe ContainerInstance
containerInstance} -> Maybe ContainerInstance
containerInstance) (\s :: DeregisterContainerInstanceResponse
s@DeregisterContainerInstanceResponse' {} Maybe ContainerInstance
a -> DeregisterContainerInstanceResponse
s {$sel:containerInstance:DeregisterContainerInstanceResponse' :: Maybe ContainerInstance
containerInstance = Maybe ContainerInstance
a} :: DeregisterContainerInstanceResponse)

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

instance
  Prelude.NFData
    DeregisterContainerInstanceResponse