{-# 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.IoT.ListTargetsForPolicy
-- 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)
--
-- List targets for the specified policy.
--
-- Requires permission to access the
-- <https://docs.aws.amazon.com/service-authorization/latest/reference/list_awsiot.html#awsiot-actions-as-permissions ListTargetsForPolicy>
-- action.
--
-- This operation returns paginated results.
module Amazonka.IoT.ListTargetsForPolicy
  ( -- * Creating a Request
    ListTargetsForPolicy (..),
    newListTargetsForPolicy,

    -- * Request Lenses
    listTargetsForPolicy_marker,
    listTargetsForPolicy_pageSize,
    listTargetsForPolicy_policyName,

    -- * Destructuring the Response
    ListTargetsForPolicyResponse (..),
    newListTargetsForPolicyResponse,

    -- * Response Lenses
    listTargetsForPolicyResponse_targets,
    listTargetsForPolicyResponse_nextMarker,
    listTargetsForPolicyResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import Amazonka.IoT.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:/ 'newListTargetsForPolicy' smart constructor.
data ListTargetsForPolicy = ListTargetsForPolicy'
  { -- | A marker used to get the next set of results.
    ListTargetsForPolicy -> Maybe Text
marker :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of results to return at one time.
    ListTargetsForPolicy -> Maybe Natural
pageSize :: Prelude.Maybe Prelude.Natural,
    -- | The policy name.
    ListTargetsForPolicy -> Text
policyName :: Prelude.Text
  }
  deriving (ListTargetsForPolicy -> ListTargetsForPolicy -> Bool
(ListTargetsForPolicy -> ListTargetsForPolicy -> Bool)
-> (ListTargetsForPolicy -> ListTargetsForPolicy -> Bool)
-> Eq ListTargetsForPolicy
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListTargetsForPolicy -> ListTargetsForPolicy -> Bool
$c/= :: ListTargetsForPolicy -> ListTargetsForPolicy -> Bool
== :: ListTargetsForPolicy -> ListTargetsForPolicy -> Bool
$c== :: ListTargetsForPolicy -> ListTargetsForPolicy -> Bool
Prelude.Eq, ReadPrec [ListTargetsForPolicy]
ReadPrec ListTargetsForPolicy
Int -> ReadS ListTargetsForPolicy
ReadS [ListTargetsForPolicy]
(Int -> ReadS ListTargetsForPolicy)
-> ReadS [ListTargetsForPolicy]
-> ReadPrec ListTargetsForPolicy
-> ReadPrec [ListTargetsForPolicy]
-> Read ListTargetsForPolicy
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListTargetsForPolicy]
$creadListPrec :: ReadPrec [ListTargetsForPolicy]
readPrec :: ReadPrec ListTargetsForPolicy
$creadPrec :: ReadPrec ListTargetsForPolicy
readList :: ReadS [ListTargetsForPolicy]
$creadList :: ReadS [ListTargetsForPolicy]
readsPrec :: Int -> ReadS ListTargetsForPolicy
$creadsPrec :: Int -> ReadS ListTargetsForPolicy
Prelude.Read, Int -> ListTargetsForPolicy -> ShowS
[ListTargetsForPolicy] -> ShowS
ListTargetsForPolicy -> String
(Int -> ListTargetsForPolicy -> ShowS)
-> (ListTargetsForPolicy -> String)
-> ([ListTargetsForPolicy] -> ShowS)
-> Show ListTargetsForPolicy
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListTargetsForPolicy] -> ShowS
$cshowList :: [ListTargetsForPolicy] -> ShowS
show :: ListTargetsForPolicy -> String
$cshow :: ListTargetsForPolicy -> String
showsPrec :: Int -> ListTargetsForPolicy -> ShowS
$cshowsPrec :: Int -> ListTargetsForPolicy -> ShowS
Prelude.Show, (forall x. ListTargetsForPolicy -> Rep ListTargetsForPolicy x)
-> (forall x. Rep ListTargetsForPolicy x -> ListTargetsForPolicy)
-> Generic ListTargetsForPolicy
forall x. Rep ListTargetsForPolicy x -> ListTargetsForPolicy
forall x. ListTargetsForPolicy -> Rep ListTargetsForPolicy x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListTargetsForPolicy x -> ListTargetsForPolicy
$cfrom :: forall x. ListTargetsForPolicy -> Rep ListTargetsForPolicy x
Prelude.Generic)

-- |
-- Create a value of 'ListTargetsForPolicy' 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:
--
-- 'marker', 'listTargetsForPolicy_marker' - A marker used to get the next set of results.
--
-- 'pageSize', 'listTargetsForPolicy_pageSize' - The maximum number of results to return at one time.
--
-- 'policyName', 'listTargetsForPolicy_policyName' - The policy name.
newListTargetsForPolicy ::
  -- | 'policyName'
  Prelude.Text ->
  ListTargetsForPolicy
newListTargetsForPolicy :: Text -> ListTargetsForPolicy
newListTargetsForPolicy Text
pPolicyName_ =
  ListTargetsForPolicy' :: Maybe Text -> Maybe Natural -> Text -> ListTargetsForPolicy
ListTargetsForPolicy'
    { $sel:marker:ListTargetsForPolicy' :: Maybe Text
marker = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:pageSize:ListTargetsForPolicy' :: Maybe Natural
pageSize = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:policyName:ListTargetsForPolicy' :: Text
policyName = Text
pPolicyName_
    }

-- | A marker used to get the next set of results.
listTargetsForPolicy_marker :: Lens.Lens' ListTargetsForPolicy (Prelude.Maybe Prelude.Text)
listTargetsForPolicy_marker :: (Maybe Text -> f (Maybe Text))
-> ListTargetsForPolicy -> f ListTargetsForPolicy
listTargetsForPolicy_marker = (ListTargetsForPolicy -> Maybe Text)
-> (ListTargetsForPolicy -> Maybe Text -> ListTargetsForPolicy)
-> Lens
     ListTargetsForPolicy ListTargetsForPolicy (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListTargetsForPolicy' {Maybe Text
marker :: Maybe Text
$sel:marker:ListTargetsForPolicy' :: ListTargetsForPolicy -> Maybe Text
marker} -> Maybe Text
marker) (\s :: ListTargetsForPolicy
s@ListTargetsForPolicy' {} Maybe Text
a -> ListTargetsForPolicy
s {$sel:marker:ListTargetsForPolicy' :: Maybe Text
marker = Maybe Text
a} :: ListTargetsForPolicy)

-- | The maximum number of results to return at one time.
listTargetsForPolicy_pageSize :: Lens.Lens' ListTargetsForPolicy (Prelude.Maybe Prelude.Natural)
listTargetsForPolicy_pageSize :: (Maybe Natural -> f (Maybe Natural))
-> ListTargetsForPolicy -> f ListTargetsForPolicy
listTargetsForPolicy_pageSize = (ListTargetsForPolicy -> Maybe Natural)
-> (ListTargetsForPolicy -> Maybe Natural -> ListTargetsForPolicy)
-> Lens
     ListTargetsForPolicy
     ListTargetsForPolicy
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListTargetsForPolicy' {Maybe Natural
pageSize :: Maybe Natural
$sel:pageSize:ListTargetsForPolicy' :: ListTargetsForPolicy -> Maybe Natural
pageSize} -> Maybe Natural
pageSize) (\s :: ListTargetsForPolicy
s@ListTargetsForPolicy' {} Maybe Natural
a -> ListTargetsForPolicy
s {$sel:pageSize:ListTargetsForPolicy' :: Maybe Natural
pageSize = Maybe Natural
a} :: ListTargetsForPolicy)

-- | The policy name.
listTargetsForPolicy_policyName :: Lens.Lens' ListTargetsForPolicy Prelude.Text
listTargetsForPolicy_policyName :: (Text -> f Text) -> ListTargetsForPolicy -> f ListTargetsForPolicy
listTargetsForPolicy_policyName = (ListTargetsForPolicy -> Text)
-> (ListTargetsForPolicy -> Text -> ListTargetsForPolicy)
-> Lens ListTargetsForPolicy ListTargetsForPolicy Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListTargetsForPolicy' {Text
policyName :: Text
$sel:policyName:ListTargetsForPolicy' :: ListTargetsForPolicy -> Text
policyName} -> Text
policyName) (\s :: ListTargetsForPolicy
s@ListTargetsForPolicy' {} Text
a -> ListTargetsForPolicy
s {$sel:policyName:ListTargetsForPolicy' :: Text
policyName = Text
a} :: ListTargetsForPolicy)

instance Core.AWSPager ListTargetsForPolicy where
  page :: ListTargetsForPolicy
-> AWSResponse ListTargetsForPolicy -> Maybe ListTargetsForPolicy
page ListTargetsForPolicy
rq AWSResponse ListTargetsForPolicy
rs
    | Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListTargetsForPolicy
ListTargetsForPolicyResponse
rs
            ListTargetsForPolicyResponse
-> Getting (First Text) ListTargetsForPolicyResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListTargetsForPolicyResponse
-> Const (First Text) ListTargetsForPolicyResponse
Lens' ListTargetsForPolicyResponse (Maybe Text)
listTargetsForPolicyResponse_nextMarker
              ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListTargetsForPolicyResponse
 -> Const (First Text) ListTargetsForPolicyResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListTargetsForPolicyResponse 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 ListTargetsForPolicy
forall a. Maybe a
Prelude.Nothing
    | Maybe [Text] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListTargetsForPolicy
ListTargetsForPolicyResponse
rs
            ListTargetsForPolicyResponse
-> Getting (First [Text]) ListTargetsForPolicyResponse [Text]
-> Maybe [Text]
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe [Text] -> Const (First [Text]) (Maybe [Text]))
-> ListTargetsForPolicyResponse
-> Const (First [Text]) ListTargetsForPolicyResponse
Lens' ListTargetsForPolicyResponse (Maybe [Text])
listTargetsForPolicyResponse_targets
              ((Maybe [Text] -> Const (First [Text]) (Maybe [Text]))
 -> ListTargetsForPolicyResponse
 -> Const (First [Text]) ListTargetsForPolicyResponse)
-> (([Text] -> Const (First [Text]) [Text])
    -> Maybe [Text] -> Const (First [Text]) (Maybe [Text]))
-> Getting (First [Text]) ListTargetsForPolicyResponse [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 ListTargetsForPolicy
forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
      ListTargetsForPolicy -> Maybe ListTargetsForPolicy
forall a. a -> Maybe a
Prelude.Just (ListTargetsForPolicy -> Maybe ListTargetsForPolicy)
-> ListTargetsForPolicy -> Maybe ListTargetsForPolicy
forall a b. (a -> b) -> a -> b
Prelude.$
        ListTargetsForPolicy
rq
          ListTargetsForPolicy
-> (ListTargetsForPolicy -> ListTargetsForPolicy)
-> ListTargetsForPolicy
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> ListTargetsForPolicy -> Identity ListTargetsForPolicy
Lens
  ListTargetsForPolicy ListTargetsForPolicy (Maybe Text) (Maybe Text)
listTargetsForPolicy_marker
          ((Maybe Text -> Identity (Maybe Text))
 -> ListTargetsForPolicy -> Identity ListTargetsForPolicy)
-> Maybe Text -> ListTargetsForPolicy -> ListTargetsForPolicy
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListTargetsForPolicy
ListTargetsForPolicyResponse
rs
          ListTargetsForPolicyResponse
-> Getting (First Text) ListTargetsForPolicyResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListTargetsForPolicyResponse
-> Const (First Text) ListTargetsForPolicyResponse
Lens' ListTargetsForPolicyResponse (Maybe Text)
listTargetsForPolicyResponse_nextMarker
            ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListTargetsForPolicyResponse
 -> Const (First Text) ListTargetsForPolicyResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListTargetsForPolicyResponse 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 ListTargetsForPolicy where
  type
    AWSResponse ListTargetsForPolicy =
      ListTargetsForPolicyResponse
  request :: ListTargetsForPolicy -> Request ListTargetsForPolicy
request = Service -> ListTargetsForPolicy -> Request ListTargetsForPolicy
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy ListTargetsForPolicy
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ListTargetsForPolicy)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse ListTargetsForPolicy))
-> Logger
-> Service
-> Proxy ListTargetsForPolicy
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ListTargetsForPolicy)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe [Text] -> Maybe Text -> Int -> ListTargetsForPolicyResponse
ListTargetsForPolicyResponse'
            (Maybe [Text] -> Maybe Text -> Int -> ListTargetsForPolicyResponse)
-> Either String (Maybe [Text])
-> Either
     String (Maybe Text -> Int -> ListTargetsForPolicyResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe (Maybe [Text]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"targets" Either String (Maybe (Maybe [Text]))
-> Maybe [Text] -> Either String (Maybe [Text])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [Text]
forall a. Monoid a => a
Prelude.mempty)
            Either String (Maybe Text -> Int -> ListTargetsForPolicyResponse)
-> Either String (Maybe Text)
-> Either String (Int -> ListTargetsForPolicyResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"nextMarker")
            Either String (Int -> ListTargetsForPolicyResponse)
-> Either String Int -> Either String ListTargetsForPolicyResponse
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 ListTargetsForPolicy

instance Prelude.NFData ListTargetsForPolicy

instance Core.ToHeaders ListTargetsForPolicy where
  toHeaders :: ListTargetsForPolicy -> ResponseHeaders
toHeaders = ResponseHeaders -> ListTargetsForPolicy -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty

instance Core.ToJSON ListTargetsForPolicy where
  toJSON :: ListTargetsForPolicy -> Value
toJSON = Value -> ListTargetsForPolicy -> Value
forall a b. a -> b -> a
Prelude.const (Object -> Value
Core.Object Object
forall a. Monoid a => a
Prelude.mempty)

instance Core.ToPath ListTargetsForPolicy where
  toPath :: ListTargetsForPolicy -> ByteString
toPath ListTargetsForPolicy' {Maybe Natural
Maybe Text
Text
policyName :: Text
pageSize :: Maybe Natural
marker :: Maybe Text
$sel:policyName:ListTargetsForPolicy' :: ListTargetsForPolicy -> Text
$sel:pageSize:ListTargetsForPolicy' :: ListTargetsForPolicy -> Maybe Natural
$sel:marker:ListTargetsForPolicy' :: ListTargetsForPolicy -> Maybe Text
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ByteString
"/policy-targets/", Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
policyName]

instance Core.ToQuery ListTargetsForPolicy where
  toQuery :: ListTargetsForPolicy -> QueryString
toQuery ListTargetsForPolicy' {Maybe Natural
Maybe Text
Text
policyName :: Text
pageSize :: Maybe Natural
marker :: Maybe Text
$sel:policyName:ListTargetsForPolicy' :: ListTargetsForPolicy -> Text
$sel:pageSize:ListTargetsForPolicy' :: ListTargetsForPolicy -> Maybe Natural
$sel:marker:ListTargetsForPolicy' :: ListTargetsForPolicy -> Maybe Text
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"marker" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
marker,
        ByteString
"pageSize" ByteString -> Maybe Natural -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Natural
pageSize
      ]

-- | /See:/ 'newListTargetsForPolicyResponse' smart constructor.
data ListTargetsForPolicyResponse = ListTargetsForPolicyResponse'
  { -- | The policy targets.
    ListTargetsForPolicyResponse -> Maybe [Text]
targets :: Prelude.Maybe [Prelude.Text],
    -- | A marker used to get the next set of results.
    ListTargetsForPolicyResponse -> Maybe Text
nextMarker :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    ListTargetsForPolicyResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ListTargetsForPolicyResponse
-> ListTargetsForPolicyResponse -> Bool
(ListTargetsForPolicyResponse
 -> ListTargetsForPolicyResponse -> Bool)
-> (ListTargetsForPolicyResponse
    -> ListTargetsForPolicyResponse -> Bool)
-> Eq ListTargetsForPolicyResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListTargetsForPolicyResponse
-> ListTargetsForPolicyResponse -> Bool
$c/= :: ListTargetsForPolicyResponse
-> ListTargetsForPolicyResponse -> Bool
== :: ListTargetsForPolicyResponse
-> ListTargetsForPolicyResponse -> Bool
$c== :: ListTargetsForPolicyResponse
-> ListTargetsForPolicyResponse -> Bool
Prelude.Eq, ReadPrec [ListTargetsForPolicyResponse]
ReadPrec ListTargetsForPolicyResponse
Int -> ReadS ListTargetsForPolicyResponse
ReadS [ListTargetsForPolicyResponse]
(Int -> ReadS ListTargetsForPolicyResponse)
-> ReadS [ListTargetsForPolicyResponse]
-> ReadPrec ListTargetsForPolicyResponse
-> ReadPrec [ListTargetsForPolicyResponse]
-> Read ListTargetsForPolicyResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListTargetsForPolicyResponse]
$creadListPrec :: ReadPrec [ListTargetsForPolicyResponse]
readPrec :: ReadPrec ListTargetsForPolicyResponse
$creadPrec :: ReadPrec ListTargetsForPolicyResponse
readList :: ReadS [ListTargetsForPolicyResponse]
$creadList :: ReadS [ListTargetsForPolicyResponse]
readsPrec :: Int -> ReadS ListTargetsForPolicyResponse
$creadsPrec :: Int -> ReadS ListTargetsForPolicyResponse
Prelude.Read, Int -> ListTargetsForPolicyResponse -> ShowS
[ListTargetsForPolicyResponse] -> ShowS
ListTargetsForPolicyResponse -> String
(Int -> ListTargetsForPolicyResponse -> ShowS)
-> (ListTargetsForPolicyResponse -> String)
-> ([ListTargetsForPolicyResponse] -> ShowS)
-> Show ListTargetsForPolicyResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListTargetsForPolicyResponse] -> ShowS
$cshowList :: [ListTargetsForPolicyResponse] -> ShowS
show :: ListTargetsForPolicyResponse -> String
$cshow :: ListTargetsForPolicyResponse -> String
showsPrec :: Int -> ListTargetsForPolicyResponse -> ShowS
$cshowsPrec :: Int -> ListTargetsForPolicyResponse -> ShowS
Prelude.Show, (forall x.
 ListTargetsForPolicyResponse -> Rep ListTargetsForPolicyResponse x)
-> (forall x.
    Rep ListTargetsForPolicyResponse x -> ListTargetsForPolicyResponse)
-> Generic ListTargetsForPolicyResponse
forall x.
Rep ListTargetsForPolicyResponse x -> ListTargetsForPolicyResponse
forall x.
ListTargetsForPolicyResponse -> Rep ListTargetsForPolicyResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListTargetsForPolicyResponse x -> ListTargetsForPolicyResponse
$cfrom :: forall x.
ListTargetsForPolicyResponse -> Rep ListTargetsForPolicyResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListTargetsForPolicyResponse' 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:
--
-- 'targets', 'listTargetsForPolicyResponse_targets' - The policy targets.
--
-- 'nextMarker', 'listTargetsForPolicyResponse_nextMarker' - A marker used to get the next set of results.
--
-- 'httpStatus', 'listTargetsForPolicyResponse_httpStatus' - The response's http status code.
newListTargetsForPolicyResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListTargetsForPolicyResponse
newListTargetsForPolicyResponse :: Int -> ListTargetsForPolicyResponse
newListTargetsForPolicyResponse Int
pHttpStatus_ =
  ListTargetsForPolicyResponse' :: Maybe [Text] -> Maybe Text -> Int -> ListTargetsForPolicyResponse
ListTargetsForPolicyResponse'
    { $sel:targets:ListTargetsForPolicyResponse' :: Maybe [Text]
targets =
        Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:nextMarker:ListTargetsForPolicyResponse' :: Maybe Text
nextMarker = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListTargetsForPolicyResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The policy targets.
listTargetsForPolicyResponse_targets :: Lens.Lens' ListTargetsForPolicyResponse (Prelude.Maybe [Prelude.Text])
listTargetsForPolicyResponse_targets :: (Maybe [Text] -> f (Maybe [Text]))
-> ListTargetsForPolicyResponse -> f ListTargetsForPolicyResponse
listTargetsForPolicyResponse_targets = (ListTargetsForPolicyResponse -> Maybe [Text])
-> (ListTargetsForPolicyResponse
    -> Maybe [Text] -> ListTargetsForPolicyResponse)
-> Lens' ListTargetsForPolicyResponse (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListTargetsForPolicyResponse' {Maybe [Text]
targets :: Maybe [Text]
$sel:targets:ListTargetsForPolicyResponse' :: ListTargetsForPolicyResponse -> Maybe [Text]
targets} -> Maybe [Text]
targets) (\s :: ListTargetsForPolicyResponse
s@ListTargetsForPolicyResponse' {} Maybe [Text]
a -> ListTargetsForPolicyResponse
s {$sel:targets:ListTargetsForPolicyResponse' :: Maybe [Text]
targets = Maybe [Text]
a} :: ListTargetsForPolicyResponse) ((Maybe [Text] -> f (Maybe [Text]))
 -> ListTargetsForPolicyResponse -> f ListTargetsForPolicyResponse)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> ListTargetsForPolicyResponse
-> f ListTargetsForPolicyResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
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 [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | A marker used to get the next set of results.
listTargetsForPolicyResponse_nextMarker :: Lens.Lens' ListTargetsForPolicyResponse (Prelude.Maybe Prelude.Text)
listTargetsForPolicyResponse_nextMarker :: (Maybe Text -> f (Maybe Text))
-> ListTargetsForPolicyResponse -> f ListTargetsForPolicyResponse
listTargetsForPolicyResponse_nextMarker = (ListTargetsForPolicyResponse -> Maybe Text)
-> (ListTargetsForPolicyResponse
    -> Maybe Text -> ListTargetsForPolicyResponse)
-> Lens' ListTargetsForPolicyResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListTargetsForPolicyResponse' {Maybe Text
nextMarker :: Maybe Text
$sel:nextMarker:ListTargetsForPolicyResponse' :: ListTargetsForPolicyResponse -> Maybe Text
nextMarker} -> Maybe Text
nextMarker) (\s :: ListTargetsForPolicyResponse
s@ListTargetsForPolicyResponse' {} Maybe Text
a -> ListTargetsForPolicyResponse
s {$sel:nextMarker:ListTargetsForPolicyResponse' :: Maybe Text
nextMarker = Maybe Text
a} :: ListTargetsForPolicyResponse)

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

instance Prelude.NFData ListTargetsForPolicyResponse