{-# 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.CloudWatchEvents.RemoveTargets
-- 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)
--
-- Removes the specified targets from the specified rule. When the rule is
-- triggered, those targets are no longer be invoked.
--
-- When you remove a target, when the associated rule triggers, removed
-- targets might continue to be invoked. Allow a short period of time for
-- changes to take effect.
--
-- This action can partially fail if too many requests are made at the same
-- time. If that happens, @FailedEntryCount@ is non-zero in the response
-- and each entry in @FailedEntries@ provides the ID of the failed target
-- and the error code.
module Amazonka.CloudWatchEvents.RemoveTargets
  ( -- * Creating a Request
    RemoveTargets (..),
    newRemoveTargets,

    -- * Request Lenses
    removeTargets_force,
    removeTargets_eventBusName,
    removeTargets_rule,
    removeTargets_ids,

    -- * Destructuring the Response
    RemoveTargetsResponse (..),
    newRemoveTargetsResponse,

    -- * Response Lenses
    removeTargetsResponse_failedEntryCount,
    removeTargetsResponse_failedEntries,
    removeTargetsResponse_httpStatus,
  )
where

import Amazonka.CloudWatchEvents.Types
import qualified Amazonka.Core as Core
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:/ 'newRemoveTargets' smart constructor.
data RemoveTargets = RemoveTargets'
  { -- | If this is a managed rule, created by an Amazon Web Services service on
    -- your behalf, you must specify @Force@ as @True@ to remove targets. This
    -- parameter is ignored for rules that are not managed rules. You can check
    -- whether a rule is a managed rule by using @DescribeRule@ or @ListRules@
    -- and checking the @ManagedBy@ field of the response.
    RemoveTargets -> Maybe Bool
force :: Prelude.Maybe Prelude.Bool,
    -- | The name or ARN of the event bus associated with the rule. If you omit
    -- this, the default event bus is used.
    RemoveTargets -> Maybe Text
eventBusName :: Prelude.Maybe Prelude.Text,
    -- | The name of the rule.
    RemoveTargets -> Text
rule :: Prelude.Text,
    -- | The IDs of the targets to remove from the rule.
    RemoveTargets -> NonEmpty Text
ids :: Prelude.NonEmpty Prelude.Text
  }
  deriving (RemoveTargets -> RemoveTargets -> Bool
(RemoveTargets -> RemoveTargets -> Bool)
-> (RemoveTargets -> RemoveTargets -> Bool) -> Eq RemoveTargets
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RemoveTargets -> RemoveTargets -> Bool
$c/= :: RemoveTargets -> RemoveTargets -> Bool
== :: RemoveTargets -> RemoveTargets -> Bool
$c== :: RemoveTargets -> RemoveTargets -> Bool
Prelude.Eq, ReadPrec [RemoveTargets]
ReadPrec RemoveTargets
Int -> ReadS RemoveTargets
ReadS [RemoveTargets]
(Int -> ReadS RemoveTargets)
-> ReadS [RemoveTargets]
-> ReadPrec RemoveTargets
-> ReadPrec [RemoveTargets]
-> Read RemoveTargets
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RemoveTargets]
$creadListPrec :: ReadPrec [RemoveTargets]
readPrec :: ReadPrec RemoveTargets
$creadPrec :: ReadPrec RemoveTargets
readList :: ReadS [RemoveTargets]
$creadList :: ReadS [RemoveTargets]
readsPrec :: Int -> ReadS RemoveTargets
$creadsPrec :: Int -> ReadS RemoveTargets
Prelude.Read, Int -> RemoveTargets -> ShowS
[RemoveTargets] -> ShowS
RemoveTargets -> String
(Int -> RemoveTargets -> ShowS)
-> (RemoveTargets -> String)
-> ([RemoveTargets] -> ShowS)
-> Show RemoveTargets
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RemoveTargets] -> ShowS
$cshowList :: [RemoveTargets] -> ShowS
show :: RemoveTargets -> String
$cshow :: RemoveTargets -> String
showsPrec :: Int -> RemoveTargets -> ShowS
$cshowsPrec :: Int -> RemoveTargets -> ShowS
Prelude.Show, (forall x. RemoveTargets -> Rep RemoveTargets x)
-> (forall x. Rep RemoveTargets x -> RemoveTargets)
-> Generic RemoveTargets
forall x. Rep RemoveTargets x -> RemoveTargets
forall x. RemoveTargets -> Rep RemoveTargets x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RemoveTargets x -> RemoveTargets
$cfrom :: forall x. RemoveTargets -> Rep RemoveTargets x
Prelude.Generic)

-- |
-- Create a value of 'RemoveTargets' 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:
--
-- 'force', 'removeTargets_force' - If this is a managed rule, created by an Amazon Web Services service on
-- your behalf, you must specify @Force@ as @True@ to remove targets. This
-- parameter is ignored for rules that are not managed rules. You can check
-- whether a rule is a managed rule by using @DescribeRule@ or @ListRules@
-- and checking the @ManagedBy@ field of the response.
--
-- 'eventBusName', 'removeTargets_eventBusName' - The name or ARN of the event bus associated with the rule. If you omit
-- this, the default event bus is used.
--
-- 'rule', 'removeTargets_rule' - The name of the rule.
--
-- 'ids', 'removeTargets_ids' - The IDs of the targets to remove from the rule.
newRemoveTargets ::
  -- | 'rule'
  Prelude.Text ->
  -- | 'ids'
  Prelude.NonEmpty Prelude.Text ->
  RemoveTargets
newRemoveTargets :: Text -> NonEmpty Text -> RemoveTargets
newRemoveTargets Text
pRule_ NonEmpty Text
pIds_ =
  RemoveTargets' :: Maybe Bool -> Maybe Text -> Text -> NonEmpty Text -> RemoveTargets
RemoveTargets'
    { $sel:force:RemoveTargets' :: Maybe Bool
force = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:eventBusName:RemoveTargets' :: Maybe Text
eventBusName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:rule:RemoveTargets' :: Text
rule = Text
pRule_,
      $sel:ids:RemoveTargets' :: NonEmpty Text
ids = Tagged (NonEmpty Text) (Identity (NonEmpty Text))
-> Tagged (NonEmpty Text) (Identity (NonEmpty Text))
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced (Tagged (NonEmpty Text) (Identity (NonEmpty Text))
 -> Tagged (NonEmpty Text) (Identity (NonEmpty Text)))
-> NonEmpty Text -> NonEmpty Text
forall t b. AReview t b -> b -> t
Lens.# NonEmpty Text
pIds_
    }

-- | If this is a managed rule, created by an Amazon Web Services service on
-- your behalf, you must specify @Force@ as @True@ to remove targets. This
-- parameter is ignored for rules that are not managed rules. You can check
-- whether a rule is a managed rule by using @DescribeRule@ or @ListRules@
-- and checking the @ManagedBy@ field of the response.
removeTargets_force :: Lens.Lens' RemoveTargets (Prelude.Maybe Prelude.Bool)
removeTargets_force :: (Maybe Bool -> f (Maybe Bool)) -> RemoveTargets -> f RemoveTargets
removeTargets_force = (RemoveTargets -> Maybe Bool)
-> (RemoveTargets -> Maybe Bool -> RemoveTargets)
-> Lens RemoveTargets RemoveTargets (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RemoveTargets' {Maybe Bool
force :: Maybe Bool
$sel:force:RemoveTargets' :: RemoveTargets -> Maybe Bool
force} -> Maybe Bool
force) (\s :: RemoveTargets
s@RemoveTargets' {} Maybe Bool
a -> RemoveTargets
s {$sel:force:RemoveTargets' :: Maybe Bool
force = Maybe Bool
a} :: RemoveTargets)

-- | The name or ARN of the event bus associated with the rule. If you omit
-- this, the default event bus is used.
removeTargets_eventBusName :: Lens.Lens' RemoveTargets (Prelude.Maybe Prelude.Text)
removeTargets_eventBusName :: (Maybe Text -> f (Maybe Text)) -> RemoveTargets -> f RemoveTargets
removeTargets_eventBusName = (RemoveTargets -> Maybe Text)
-> (RemoveTargets -> Maybe Text -> RemoveTargets)
-> Lens RemoveTargets RemoveTargets (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RemoveTargets' {Maybe Text
eventBusName :: Maybe Text
$sel:eventBusName:RemoveTargets' :: RemoveTargets -> Maybe Text
eventBusName} -> Maybe Text
eventBusName) (\s :: RemoveTargets
s@RemoveTargets' {} Maybe Text
a -> RemoveTargets
s {$sel:eventBusName:RemoveTargets' :: Maybe Text
eventBusName = Maybe Text
a} :: RemoveTargets)

-- | The name of the rule.
removeTargets_rule :: Lens.Lens' RemoveTargets Prelude.Text
removeTargets_rule :: (Text -> f Text) -> RemoveTargets -> f RemoveTargets
removeTargets_rule = (RemoveTargets -> Text)
-> (RemoveTargets -> Text -> RemoveTargets)
-> Lens RemoveTargets RemoveTargets Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RemoveTargets' {Text
rule :: Text
$sel:rule:RemoveTargets' :: RemoveTargets -> Text
rule} -> Text
rule) (\s :: RemoveTargets
s@RemoveTargets' {} Text
a -> RemoveTargets
s {$sel:rule:RemoveTargets' :: Text
rule = Text
a} :: RemoveTargets)

-- | The IDs of the targets to remove from the rule.
removeTargets_ids :: Lens.Lens' RemoveTargets (Prelude.NonEmpty Prelude.Text)
removeTargets_ids :: (NonEmpty Text -> f (NonEmpty Text))
-> RemoveTargets -> f RemoveTargets
removeTargets_ids = (RemoveTargets -> NonEmpty Text)
-> (RemoveTargets -> NonEmpty Text -> RemoveTargets)
-> Lens RemoveTargets RemoveTargets (NonEmpty Text) (NonEmpty Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RemoveTargets' {NonEmpty Text
ids :: NonEmpty Text
$sel:ids:RemoveTargets' :: RemoveTargets -> NonEmpty Text
ids} -> NonEmpty Text
ids) (\s :: RemoveTargets
s@RemoveTargets' {} NonEmpty Text
a -> RemoveTargets
s {$sel:ids:RemoveTargets' :: NonEmpty Text
ids = NonEmpty Text
a} :: RemoveTargets) ((NonEmpty Text -> f (NonEmpty Text))
 -> RemoveTargets -> f RemoveTargets)
-> ((NonEmpty Text -> f (NonEmpty Text))
    -> NonEmpty Text -> f (NonEmpty Text))
-> (NonEmpty Text -> f (NonEmpty Text))
-> RemoveTargets
-> f RemoveTargets
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (NonEmpty Text -> f (NonEmpty Text))
-> NonEmpty Text -> f (NonEmpty Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance Prelude.NFData RemoveTargets

instance Core.ToHeaders RemoveTargets where
  toHeaders :: RemoveTargets -> ResponseHeaders
toHeaders =
    ResponseHeaders -> RemoveTargets -> 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
"AWSEvents.RemoveTargets" :: 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 RemoveTargets where
  toJSON :: RemoveTargets -> Value
toJSON RemoveTargets' {Maybe Bool
Maybe Text
NonEmpty Text
Text
ids :: NonEmpty Text
rule :: Text
eventBusName :: Maybe Text
force :: Maybe Bool
$sel:ids:RemoveTargets' :: RemoveTargets -> NonEmpty Text
$sel:rule:RemoveTargets' :: RemoveTargets -> Text
$sel:eventBusName:RemoveTargets' :: RemoveTargets -> Maybe Text
$sel:force:RemoveTargets' :: RemoveTargets -> Maybe Bool
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (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,
            (Text
"EventBusName" 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
eventBusName,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Rule" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
rule),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Ids" Text -> NonEmpty Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= NonEmpty Text
ids)
          ]
      )

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

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

-- | /See:/ 'newRemoveTargetsResponse' smart constructor.
data RemoveTargetsResponse = RemoveTargetsResponse'
  { -- | The number of failed entries.
    RemoveTargetsResponse -> Maybe Int
failedEntryCount :: Prelude.Maybe Prelude.Int,
    -- | The failed target entries.
    RemoveTargetsResponse -> Maybe [RemoveTargetsResultEntry]
failedEntries :: Prelude.Maybe [RemoveTargetsResultEntry],
    -- | The response's http status code.
    RemoveTargetsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (RemoveTargetsResponse -> RemoveTargetsResponse -> Bool
(RemoveTargetsResponse -> RemoveTargetsResponse -> Bool)
-> (RemoveTargetsResponse -> RemoveTargetsResponse -> Bool)
-> Eq RemoveTargetsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RemoveTargetsResponse -> RemoveTargetsResponse -> Bool
$c/= :: RemoveTargetsResponse -> RemoveTargetsResponse -> Bool
== :: RemoveTargetsResponse -> RemoveTargetsResponse -> Bool
$c== :: RemoveTargetsResponse -> RemoveTargetsResponse -> Bool
Prelude.Eq, ReadPrec [RemoveTargetsResponse]
ReadPrec RemoveTargetsResponse
Int -> ReadS RemoveTargetsResponse
ReadS [RemoveTargetsResponse]
(Int -> ReadS RemoveTargetsResponse)
-> ReadS [RemoveTargetsResponse]
-> ReadPrec RemoveTargetsResponse
-> ReadPrec [RemoveTargetsResponse]
-> Read RemoveTargetsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RemoveTargetsResponse]
$creadListPrec :: ReadPrec [RemoveTargetsResponse]
readPrec :: ReadPrec RemoveTargetsResponse
$creadPrec :: ReadPrec RemoveTargetsResponse
readList :: ReadS [RemoveTargetsResponse]
$creadList :: ReadS [RemoveTargetsResponse]
readsPrec :: Int -> ReadS RemoveTargetsResponse
$creadsPrec :: Int -> ReadS RemoveTargetsResponse
Prelude.Read, Int -> RemoveTargetsResponse -> ShowS
[RemoveTargetsResponse] -> ShowS
RemoveTargetsResponse -> String
(Int -> RemoveTargetsResponse -> ShowS)
-> (RemoveTargetsResponse -> String)
-> ([RemoveTargetsResponse] -> ShowS)
-> Show RemoveTargetsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RemoveTargetsResponse] -> ShowS
$cshowList :: [RemoveTargetsResponse] -> ShowS
show :: RemoveTargetsResponse -> String
$cshow :: RemoveTargetsResponse -> String
showsPrec :: Int -> RemoveTargetsResponse -> ShowS
$cshowsPrec :: Int -> RemoveTargetsResponse -> ShowS
Prelude.Show, (forall x. RemoveTargetsResponse -> Rep RemoveTargetsResponse x)
-> (forall x. Rep RemoveTargetsResponse x -> RemoveTargetsResponse)
-> Generic RemoveTargetsResponse
forall x. Rep RemoveTargetsResponse x -> RemoveTargetsResponse
forall x. RemoveTargetsResponse -> Rep RemoveTargetsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RemoveTargetsResponse x -> RemoveTargetsResponse
$cfrom :: forall x. RemoveTargetsResponse -> Rep RemoveTargetsResponse x
Prelude.Generic)

-- |
-- Create a value of 'RemoveTargetsResponse' 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:
--
-- 'failedEntryCount', 'removeTargetsResponse_failedEntryCount' - The number of failed entries.
--
-- 'failedEntries', 'removeTargetsResponse_failedEntries' - The failed target entries.
--
-- 'httpStatus', 'removeTargetsResponse_httpStatus' - The response's http status code.
newRemoveTargetsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  RemoveTargetsResponse
newRemoveTargetsResponse :: Int -> RemoveTargetsResponse
newRemoveTargetsResponse Int
pHttpStatus_ =
  RemoveTargetsResponse' :: Maybe Int
-> Maybe [RemoveTargetsResultEntry] -> Int -> RemoveTargetsResponse
RemoveTargetsResponse'
    { $sel:failedEntryCount:RemoveTargetsResponse' :: Maybe Int
failedEntryCount =
        Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:failedEntries:RemoveTargetsResponse' :: Maybe [RemoveTargetsResultEntry]
failedEntries = Maybe [RemoveTargetsResultEntry]
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:RemoveTargetsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The number of failed entries.
removeTargetsResponse_failedEntryCount :: Lens.Lens' RemoveTargetsResponse (Prelude.Maybe Prelude.Int)
removeTargetsResponse_failedEntryCount :: (Maybe Int -> f (Maybe Int))
-> RemoveTargetsResponse -> f RemoveTargetsResponse
removeTargetsResponse_failedEntryCount = (RemoveTargetsResponse -> Maybe Int)
-> (RemoveTargetsResponse -> Maybe Int -> RemoveTargetsResponse)
-> Lens
     RemoveTargetsResponse RemoveTargetsResponse (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RemoveTargetsResponse' {Maybe Int
failedEntryCount :: Maybe Int
$sel:failedEntryCount:RemoveTargetsResponse' :: RemoveTargetsResponse -> Maybe Int
failedEntryCount} -> Maybe Int
failedEntryCount) (\s :: RemoveTargetsResponse
s@RemoveTargetsResponse' {} Maybe Int
a -> RemoveTargetsResponse
s {$sel:failedEntryCount:RemoveTargetsResponse' :: Maybe Int
failedEntryCount = Maybe Int
a} :: RemoveTargetsResponse)

-- | The failed target entries.
removeTargetsResponse_failedEntries :: Lens.Lens' RemoveTargetsResponse (Prelude.Maybe [RemoveTargetsResultEntry])
removeTargetsResponse_failedEntries :: (Maybe [RemoveTargetsResultEntry]
 -> f (Maybe [RemoveTargetsResultEntry]))
-> RemoveTargetsResponse -> f RemoveTargetsResponse
removeTargetsResponse_failedEntries = (RemoveTargetsResponse -> Maybe [RemoveTargetsResultEntry])
-> (RemoveTargetsResponse
    -> Maybe [RemoveTargetsResultEntry] -> RemoveTargetsResponse)
-> Lens
     RemoveTargetsResponse
     RemoveTargetsResponse
     (Maybe [RemoveTargetsResultEntry])
     (Maybe [RemoveTargetsResultEntry])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RemoveTargetsResponse' {Maybe [RemoveTargetsResultEntry]
failedEntries :: Maybe [RemoveTargetsResultEntry]
$sel:failedEntries:RemoveTargetsResponse' :: RemoveTargetsResponse -> Maybe [RemoveTargetsResultEntry]
failedEntries} -> Maybe [RemoveTargetsResultEntry]
failedEntries) (\s :: RemoveTargetsResponse
s@RemoveTargetsResponse' {} Maybe [RemoveTargetsResultEntry]
a -> RemoveTargetsResponse
s {$sel:failedEntries:RemoveTargetsResponse' :: Maybe [RemoveTargetsResultEntry]
failedEntries = Maybe [RemoveTargetsResultEntry]
a} :: RemoveTargetsResponse) ((Maybe [RemoveTargetsResultEntry]
  -> f (Maybe [RemoveTargetsResultEntry]))
 -> RemoveTargetsResponse -> f RemoveTargetsResponse)
-> ((Maybe [RemoveTargetsResultEntry]
     -> f (Maybe [RemoveTargetsResultEntry]))
    -> Maybe [RemoveTargetsResultEntry]
    -> f (Maybe [RemoveTargetsResultEntry]))
-> (Maybe [RemoveTargetsResultEntry]
    -> f (Maybe [RemoveTargetsResultEntry]))
-> RemoveTargetsResponse
-> f RemoveTargetsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [RemoveTargetsResultEntry]
  [RemoveTargetsResultEntry]
  [RemoveTargetsResultEntry]
  [RemoveTargetsResultEntry]
-> Iso
     (Maybe [RemoveTargetsResultEntry])
     (Maybe [RemoveTargetsResultEntry])
     (Maybe [RemoveTargetsResultEntry])
     (Maybe [RemoveTargetsResultEntry])
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
  [RemoveTargetsResultEntry]
  [RemoveTargetsResultEntry]
  [RemoveTargetsResultEntry]
  [RemoveTargetsResultEntry]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance Prelude.NFData RemoveTargetsResponse