{-# 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.CodeStarNotifications.ListTargets
-- 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)
--
-- Returns a list of the notification rule targets for an AWS account.
--
-- This operation returns paginated results.
module Amazonka.CodeStarNotifications.ListTargets
  ( -- * Creating a Request
    ListTargets (..),
    newListTargets,

    -- * Request Lenses
    listTargets_filters,
    listTargets_nextToken,
    listTargets_maxResults,

    -- * Destructuring the Response
    ListTargetsResponse (..),
    newListTargetsResponse,

    -- * Response Lenses
    listTargetsResponse_nextToken,
    listTargetsResponse_targets,
    listTargetsResponse_httpStatus,
  )
where

import Amazonka.CodeStarNotifications.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:/ 'newListTargets' smart constructor.
data ListTargets = ListTargets'
  { -- | The filters to use to return information by service or resource type.
    -- Valid filters include target type, target address, and target status.
    --
    -- A filter with the same name can appear more than once when used with OR
    -- statements. Filters with different names should be applied with AND
    -- statements.
    ListTargets -> Maybe [ListTargetsFilter]
filters :: Prelude.Maybe [ListTargetsFilter],
    -- | An enumeration token that, when provided in a request, returns the next
    -- batch of the results.
    ListTargets -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | A non-negative integer used to limit the number of returned results. The
    -- maximum number of results that can be returned is 100.
    ListTargets -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural
  }
  deriving (ListTargets -> ListTargets -> Bool
(ListTargets -> ListTargets -> Bool)
-> (ListTargets -> ListTargets -> Bool) -> Eq ListTargets
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListTargets -> ListTargets -> Bool
$c/= :: ListTargets -> ListTargets -> Bool
== :: ListTargets -> ListTargets -> Bool
$c== :: ListTargets -> ListTargets -> Bool
Prelude.Eq, ReadPrec [ListTargets]
ReadPrec ListTargets
Int -> ReadS ListTargets
ReadS [ListTargets]
(Int -> ReadS ListTargets)
-> ReadS [ListTargets]
-> ReadPrec ListTargets
-> ReadPrec [ListTargets]
-> Read ListTargets
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListTargets]
$creadListPrec :: ReadPrec [ListTargets]
readPrec :: ReadPrec ListTargets
$creadPrec :: ReadPrec ListTargets
readList :: ReadS [ListTargets]
$creadList :: ReadS [ListTargets]
readsPrec :: Int -> ReadS ListTargets
$creadsPrec :: Int -> ReadS ListTargets
Prelude.Read, Int -> ListTargets -> ShowS
[ListTargets] -> ShowS
ListTargets -> String
(Int -> ListTargets -> ShowS)
-> (ListTargets -> String)
-> ([ListTargets] -> ShowS)
-> Show ListTargets
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListTargets] -> ShowS
$cshowList :: [ListTargets] -> ShowS
show :: ListTargets -> String
$cshow :: ListTargets -> String
showsPrec :: Int -> ListTargets -> ShowS
$cshowsPrec :: Int -> ListTargets -> ShowS
Prelude.Show, (forall x. ListTargets -> Rep ListTargets x)
-> (forall x. Rep ListTargets x -> ListTargets)
-> Generic ListTargets
forall x. Rep ListTargets x -> ListTargets
forall x. ListTargets -> Rep ListTargets x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListTargets x -> ListTargets
$cfrom :: forall x. ListTargets -> Rep ListTargets x
Prelude.Generic)

-- |
-- Create a value of 'ListTargets' 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:
--
-- 'filters', 'listTargets_filters' - The filters to use to return information by service or resource type.
-- Valid filters include target type, target address, and target status.
--
-- A filter with the same name can appear more than once when used with OR
-- statements. Filters with different names should be applied with AND
-- statements.
--
-- 'nextToken', 'listTargets_nextToken' - An enumeration token that, when provided in a request, returns the next
-- batch of the results.
--
-- 'maxResults', 'listTargets_maxResults' - A non-negative integer used to limit the number of returned results. The
-- maximum number of results that can be returned is 100.
newListTargets ::
  ListTargets
newListTargets :: ListTargets
newListTargets =
  ListTargets' :: Maybe [ListTargetsFilter]
-> Maybe Text -> Maybe Natural -> ListTargets
ListTargets'
    { $sel:filters:ListTargets' :: Maybe [ListTargetsFilter]
filters = Maybe [ListTargetsFilter]
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListTargets' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:ListTargets' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing
    }

-- | The filters to use to return information by service or resource type.
-- Valid filters include target type, target address, and target status.
--
-- A filter with the same name can appear more than once when used with OR
-- statements. Filters with different names should be applied with AND
-- statements.
listTargets_filters :: Lens.Lens' ListTargets (Prelude.Maybe [ListTargetsFilter])
listTargets_filters :: (Maybe [ListTargetsFilter] -> f (Maybe [ListTargetsFilter]))
-> ListTargets -> f ListTargets
listTargets_filters = (ListTargets -> Maybe [ListTargetsFilter])
-> (ListTargets -> Maybe [ListTargetsFilter] -> ListTargets)
-> Lens
     ListTargets
     ListTargets
     (Maybe [ListTargetsFilter])
     (Maybe [ListTargetsFilter])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListTargets' {Maybe [ListTargetsFilter]
filters :: Maybe [ListTargetsFilter]
$sel:filters:ListTargets' :: ListTargets -> Maybe [ListTargetsFilter]
filters} -> Maybe [ListTargetsFilter]
filters) (\s :: ListTargets
s@ListTargets' {} Maybe [ListTargetsFilter]
a -> ListTargets
s {$sel:filters:ListTargets' :: Maybe [ListTargetsFilter]
filters = Maybe [ListTargetsFilter]
a} :: ListTargets) ((Maybe [ListTargetsFilter] -> f (Maybe [ListTargetsFilter]))
 -> ListTargets -> f ListTargets)
-> ((Maybe [ListTargetsFilter] -> f (Maybe [ListTargetsFilter]))
    -> Maybe [ListTargetsFilter] -> f (Maybe [ListTargetsFilter]))
-> (Maybe [ListTargetsFilter] -> f (Maybe [ListTargetsFilter]))
-> ListTargets
-> f ListTargets
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [ListTargetsFilter]
  [ListTargetsFilter]
  [ListTargetsFilter]
  [ListTargetsFilter]
-> Iso
     (Maybe [ListTargetsFilter])
     (Maybe [ListTargetsFilter])
     (Maybe [ListTargetsFilter])
     (Maybe [ListTargetsFilter])
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
  [ListTargetsFilter]
  [ListTargetsFilter]
  [ListTargetsFilter]
  [ListTargetsFilter]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | An enumeration token that, when provided in a request, returns the next
-- batch of the results.
listTargets_nextToken :: Lens.Lens' ListTargets (Prelude.Maybe Prelude.Text)
listTargets_nextToken :: (Maybe Text -> f (Maybe Text)) -> ListTargets -> f ListTargets
listTargets_nextToken = (ListTargets -> Maybe Text)
-> (ListTargets -> Maybe Text -> ListTargets)
-> Lens ListTargets ListTargets (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListTargets' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListTargets' :: ListTargets -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListTargets
s@ListTargets' {} Maybe Text
a -> ListTargets
s {$sel:nextToken:ListTargets' :: Maybe Text
nextToken = Maybe Text
a} :: ListTargets)

-- | A non-negative integer used to limit the number of returned results. The
-- maximum number of results that can be returned is 100.
listTargets_maxResults :: Lens.Lens' ListTargets (Prelude.Maybe Prelude.Natural)
listTargets_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> ListTargets -> f ListTargets
listTargets_maxResults = (ListTargets -> Maybe Natural)
-> (ListTargets -> Maybe Natural -> ListTargets)
-> Lens ListTargets ListTargets (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListTargets' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListTargets' :: ListTargets -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListTargets
s@ListTargets' {} Maybe Natural
a -> ListTargets
s {$sel:maxResults:ListTargets' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListTargets)

instance Core.AWSPager ListTargets where
  page :: ListTargets -> AWSResponse ListTargets -> Maybe ListTargets
page ListTargets
rq AWSResponse ListTargets
rs
    | Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListTargets
ListTargetsResponse
rs
            ListTargetsResponse
-> Getting (First Text) ListTargetsResponse Text -> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListTargetsResponse -> Const (First Text) ListTargetsResponse
Lens' ListTargetsResponse (Maybe Text)
listTargetsResponse_nextToken ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListTargetsResponse -> Const (First Text) ListTargetsResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListTargetsResponse Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe ListTargets
forall a. Maybe a
Prelude.Nothing
    | Maybe [TargetSummary] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListTargets
ListTargetsResponse
rs
            ListTargetsResponse
-> Getting
     (First [TargetSummary]) ListTargetsResponse [TargetSummary]
-> Maybe [TargetSummary]
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe [TargetSummary]
 -> Const (First [TargetSummary]) (Maybe [TargetSummary]))
-> ListTargetsResponse
-> Const (First [TargetSummary]) ListTargetsResponse
Lens' ListTargetsResponse (Maybe [TargetSummary])
listTargetsResponse_targets ((Maybe [TargetSummary]
  -> Const (First [TargetSummary]) (Maybe [TargetSummary]))
 -> ListTargetsResponse
 -> Const (First [TargetSummary]) ListTargetsResponse)
-> (([TargetSummary]
     -> Const (First [TargetSummary]) [TargetSummary])
    -> Maybe [TargetSummary]
    -> Const (First [TargetSummary]) (Maybe [TargetSummary]))
-> Getting
     (First [TargetSummary]) ListTargetsResponse [TargetSummary]
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([TargetSummary] -> Const (First [TargetSummary]) [TargetSummary])
-> Maybe [TargetSummary]
-> Const (First [TargetSummary]) (Maybe [TargetSummary])
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe ListTargets
forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
      ListTargets -> Maybe ListTargets
forall a. a -> Maybe a
Prelude.Just (ListTargets -> Maybe ListTargets)
-> ListTargets -> Maybe ListTargets
forall a b. (a -> b) -> a -> b
Prelude.$
        ListTargets
rq
          ListTargets -> (ListTargets -> ListTargets) -> ListTargets
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> ListTargets -> Identity ListTargets
Lens ListTargets ListTargets (Maybe Text) (Maybe Text)
listTargets_nextToken
          ((Maybe Text -> Identity (Maybe Text))
 -> ListTargets -> Identity ListTargets)
-> Maybe Text -> ListTargets -> ListTargets
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListTargets
ListTargetsResponse
rs
          ListTargetsResponse
-> Getting (First Text) ListTargetsResponse Text -> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListTargetsResponse -> Const (First Text) ListTargetsResponse
Lens' ListTargetsResponse (Maybe Text)
listTargetsResponse_nextToken ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListTargetsResponse -> Const (First Text) ListTargetsResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListTargetsResponse Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just

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

instance Prelude.NFData ListTargets

instance Core.ToHeaders ListTargets where
  toHeaders :: ListTargets -> ResponseHeaders
toHeaders =
    ResponseHeaders -> ListTargets -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ 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 ListTargets where
  toJSON :: ListTargets -> Value
toJSON ListTargets' {Maybe Natural
Maybe [ListTargetsFilter]
Maybe Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
filters :: Maybe [ListTargetsFilter]
$sel:maxResults:ListTargets' :: ListTargets -> Maybe Natural
$sel:nextToken:ListTargets' :: ListTargets -> Maybe Text
$sel:filters:ListTargets' :: ListTargets -> Maybe [ListTargetsFilter]
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"Filters" Text -> [ListTargetsFilter] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([ListTargetsFilter] -> Pair)
-> Maybe [ListTargetsFilter] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [ListTargetsFilter]
filters,
            (Text
"NextToken" 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
nextToken,
            (Text
"MaxResults" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
maxResults
          ]
      )

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

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

-- | /See:/ 'newListTargetsResponse' smart constructor.
data ListTargetsResponse = ListTargetsResponse'
  { -- | An enumeration token that can be used in a request to return the next
    -- batch of results.
    ListTargetsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The list of notification rule targets.
    ListTargetsResponse -> Maybe [TargetSummary]
targets :: Prelude.Maybe [TargetSummary],
    -- | The response's http status code.
    ListTargetsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ListTargetsResponse -> ListTargetsResponse -> Bool
(ListTargetsResponse -> ListTargetsResponse -> Bool)
-> (ListTargetsResponse -> ListTargetsResponse -> Bool)
-> Eq ListTargetsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListTargetsResponse -> ListTargetsResponse -> Bool
$c/= :: ListTargetsResponse -> ListTargetsResponse -> Bool
== :: ListTargetsResponse -> ListTargetsResponse -> Bool
$c== :: ListTargetsResponse -> ListTargetsResponse -> Bool
Prelude.Eq, Int -> ListTargetsResponse -> ShowS
[ListTargetsResponse] -> ShowS
ListTargetsResponse -> String
(Int -> ListTargetsResponse -> ShowS)
-> (ListTargetsResponse -> String)
-> ([ListTargetsResponse] -> ShowS)
-> Show ListTargetsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListTargetsResponse] -> ShowS
$cshowList :: [ListTargetsResponse] -> ShowS
show :: ListTargetsResponse -> String
$cshow :: ListTargetsResponse -> String
showsPrec :: Int -> ListTargetsResponse -> ShowS
$cshowsPrec :: Int -> ListTargetsResponse -> ShowS
Prelude.Show, (forall x. ListTargetsResponse -> Rep ListTargetsResponse x)
-> (forall x. Rep ListTargetsResponse x -> ListTargetsResponse)
-> Generic ListTargetsResponse
forall x. Rep ListTargetsResponse x -> ListTargetsResponse
forall x. ListTargetsResponse -> Rep ListTargetsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListTargetsResponse x -> ListTargetsResponse
$cfrom :: forall x. ListTargetsResponse -> Rep ListTargetsResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListTargetsResponse' 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:
--
-- 'nextToken', 'listTargetsResponse_nextToken' - An enumeration token that can be used in a request to return the next
-- batch of results.
--
-- 'targets', 'listTargetsResponse_targets' - The list of notification rule targets.
--
-- 'httpStatus', 'listTargetsResponse_httpStatus' - The response's http status code.
newListTargetsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListTargetsResponse
newListTargetsResponse :: Int -> ListTargetsResponse
newListTargetsResponse Int
pHttpStatus_ =
  ListTargetsResponse' :: Maybe Text -> Maybe [TargetSummary] -> Int -> ListTargetsResponse
ListTargetsResponse'
    { $sel:nextToken:ListTargetsResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:targets:ListTargetsResponse' :: Maybe [TargetSummary]
targets = Maybe [TargetSummary]
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListTargetsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | An enumeration token that can be used in a request to return the next
-- batch of results.
listTargetsResponse_nextToken :: Lens.Lens' ListTargetsResponse (Prelude.Maybe Prelude.Text)
listTargetsResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListTargetsResponse -> f ListTargetsResponse
listTargetsResponse_nextToken = (ListTargetsResponse -> Maybe Text)
-> (ListTargetsResponse -> Maybe Text -> ListTargetsResponse)
-> Lens' ListTargetsResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListTargetsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListTargetsResponse' :: ListTargetsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListTargetsResponse
s@ListTargetsResponse' {} Maybe Text
a -> ListTargetsResponse
s {$sel:nextToken:ListTargetsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListTargetsResponse)

-- | The list of notification rule targets.
listTargetsResponse_targets :: Lens.Lens' ListTargetsResponse (Prelude.Maybe [TargetSummary])
listTargetsResponse_targets :: (Maybe [TargetSummary] -> f (Maybe [TargetSummary]))
-> ListTargetsResponse -> f ListTargetsResponse
listTargetsResponse_targets = (ListTargetsResponse -> Maybe [TargetSummary])
-> (ListTargetsResponse
    -> Maybe [TargetSummary] -> ListTargetsResponse)
-> Lens' ListTargetsResponse (Maybe [TargetSummary])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListTargetsResponse' {Maybe [TargetSummary]
targets :: Maybe [TargetSummary]
$sel:targets:ListTargetsResponse' :: ListTargetsResponse -> Maybe [TargetSummary]
targets} -> Maybe [TargetSummary]
targets) (\s :: ListTargetsResponse
s@ListTargetsResponse' {} Maybe [TargetSummary]
a -> ListTargetsResponse
s {$sel:targets:ListTargetsResponse' :: Maybe [TargetSummary]
targets = Maybe [TargetSummary]
a} :: ListTargetsResponse) ((Maybe [TargetSummary] -> f (Maybe [TargetSummary]))
 -> ListTargetsResponse -> f ListTargetsResponse)
-> ((Maybe [TargetSummary] -> f (Maybe [TargetSummary]))
    -> Maybe [TargetSummary] -> f (Maybe [TargetSummary]))
-> (Maybe [TargetSummary] -> f (Maybe [TargetSummary]))
-> ListTargetsResponse
-> f ListTargetsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [TargetSummary] [TargetSummary] [TargetSummary] [TargetSummary]
-> Iso
     (Maybe [TargetSummary])
     (Maybe [TargetSummary])
     (Maybe [TargetSummary])
     (Maybe [TargetSummary])
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
  [TargetSummary] [TargetSummary] [TargetSummary] [TargetSummary]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance Prelude.NFData ListTargetsResponse