{-# 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.ListSecurityProfilesForTarget
-- 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)
--
-- Lists the Device Defender security profiles attached to a target (thing
-- group).
--
-- Requires permission to access the
-- <https://docs.aws.amazon.com/service-authorization/latest/reference/list_awsiot.html#awsiot-actions-as-permissions ListSecurityProfilesForTarget>
-- action.
--
-- This operation returns paginated results.
module Amazonka.IoT.ListSecurityProfilesForTarget
  ( -- * Creating a Request
    ListSecurityProfilesForTarget (..),
    newListSecurityProfilesForTarget,

    -- * Request Lenses
    listSecurityProfilesForTarget_nextToken,
    listSecurityProfilesForTarget_recursive,
    listSecurityProfilesForTarget_maxResults,
    listSecurityProfilesForTarget_securityProfileTargetArn,

    -- * Destructuring the Response
    ListSecurityProfilesForTargetResponse (..),
    newListSecurityProfilesForTargetResponse,

    -- * Response Lenses
    listSecurityProfilesForTargetResponse_nextToken,
    listSecurityProfilesForTargetResponse_securityProfileTargetMappings,
    listSecurityProfilesForTargetResponse_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:/ 'newListSecurityProfilesForTarget' smart constructor.
data ListSecurityProfilesForTarget = ListSecurityProfilesForTarget'
  { -- | The token for the next set of results.
    ListSecurityProfilesForTarget -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | If true, return child groups too.
    ListSecurityProfilesForTarget -> Maybe Bool
recursive :: Prelude.Maybe Prelude.Bool,
    -- | The maximum number of results to return at one time.
    ListSecurityProfilesForTarget -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | The ARN of the target (thing group) whose attached security profiles you
    -- want to get.
    ListSecurityProfilesForTarget -> Text
securityProfileTargetArn :: Prelude.Text
  }
  deriving (ListSecurityProfilesForTarget
-> ListSecurityProfilesForTarget -> Bool
(ListSecurityProfilesForTarget
 -> ListSecurityProfilesForTarget -> Bool)
-> (ListSecurityProfilesForTarget
    -> ListSecurityProfilesForTarget -> Bool)
-> Eq ListSecurityProfilesForTarget
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListSecurityProfilesForTarget
-> ListSecurityProfilesForTarget -> Bool
$c/= :: ListSecurityProfilesForTarget
-> ListSecurityProfilesForTarget -> Bool
== :: ListSecurityProfilesForTarget
-> ListSecurityProfilesForTarget -> Bool
$c== :: ListSecurityProfilesForTarget
-> ListSecurityProfilesForTarget -> Bool
Prelude.Eq, ReadPrec [ListSecurityProfilesForTarget]
ReadPrec ListSecurityProfilesForTarget
Int -> ReadS ListSecurityProfilesForTarget
ReadS [ListSecurityProfilesForTarget]
(Int -> ReadS ListSecurityProfilesForTarget)
-> ReadS [ListSecurityProfilesForTarget]
-> ReadPrec ListSecurityProfilesForTarget
-> ReadPrec [ListSecurityProfilesForTarget]
-> Read ListSecurityProfilesForTarget
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListSecurityProfilesForTarget]
$creadListPrec :: ReadPrec [ListSecurityProfilesForTarget]
readPrec :: ReadPrec ListSecurityProfilesForTarget
$creadPrec :: ReadPrec ListSecurityProfilesForTarget
readList :: ReadS [ListSecurityProfilesForTarget]
$creadList :: ReadS [ListSecurityProfilesForTarget]
readsPrec :: Int -> ReadS ListSecurityProfilesForTarget
$creadsPrec :: Int -> ReadS ListSecurityProfilesForTarget
Prelude.Read, Int -> ListSecurityProfilesForTarget -> ShowS
[ListSecurityProfilesForTarget] -> ShowS
ListSecurityProfilesForTarget -> String
(Int -> ListSecurityProfilesForTarget -> ShowS)
-> (ListSecurityProfilesForTarget -> String)
-> ([ListSecurityProfilesForTarget] -> ShowS)
-> Show ListSecurityProfilesForTarget
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListSecurityProfilesForTarget] -> ShowS
$cshowList :: [ListSecurityProfilesForTarget] -> ShowS
show :: ListSecurityProfilesForTarget -> String
$cshow :: ListSecurityProfilesForTarget -> String
showsPrec :: Int -> ListSecurityProfilesForTarget -> ShowS
$cshowsPrec :: Int -> ListSecurityProfilesForTarget -> ShowS
Prelude.Show, (forall x.
 ListSecurityProfilesForTarget
 -> Rep ListSecurityProfilesForTarget x)
-> (forall x.
    Rep ListSecurityProfilesForTarget x
    -> ListSecurityProfilesForTarget)
-> Generic ListSecurityProfilesForTarget
forall x.
Rep ListSecurityProfilesForTarget x
-> ListSecurityProfilesForTarget
forall x.
ListSecurityProfilesForTarget
-> Rep ListSecurityProfilesForTarget x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListSecurityProfilesForTarget x
-> ListSecurityProfilesForTarget
$cfrom :: forall x.
ListSecurityProfilesForTarget
-> Rep ListSecurityProfilesForTarget x
Prelude.Generic)

-- |
-- Create a value of 'ListSecurityProfilesForTarget' 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', 'listSecurityProfilesForTarget_nextToken' - The token for the next set of results.
--
-- 'recursive', 'listSecurityProfilesForTarget_recursive' - If true, return child groups too.
--
-- 'maxResults', 'listSecurityProfilesForTarget_maxResults' - The maximum number of results to return at one time.
--
-- 'securityProfileTargetArn', 'listSecurityProfilesForTarget_securityProfileTargetArn' - The ARN of the target (thing group) whose attached security profiles you
-- want to get.
newListSecurityProfilesForTarget ::
  -- | 'securityProfileTargetArn'
  Prelude.Text ->
  ListSecurityProfilesForTarget
newListSecurityProfilesForTarget :: Text -> ListSecurityProfilesForTarget
newListSecurityProfilesForTarget
  Text
pSecurityProfileTargetArn_ =
    ListSecurityProfilesForTarget' :: Maybe Text
-> Maybe Bool
-> Maybe Natural
-> Text
-> ListSecurityProfilesForTarget
ListSecurityProfilesForTarget'
      { $sel:nextToken:ListSecurityProfilesForTarget' :: Maybe Text
nextToken =
          Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:recursive:ListSecurityProfilesForTarget' :: Maybe Bool
recursive = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
        $sel:maxResults:ListSecurityProfilesForTarget' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
        $sel:securityProfileTargetArn:ListSecurityProfilesForTarget' :: Text
securityProfileTargetArn =
          Text
pSecurityProfileTargetArn_
      }

-- | The token for the next set of results.
listSecurityProfilesForTarget_nextToken :: Lens.Lens' ListSecurityProfilesForTarget (Prelude.Maybe Prelude.Text)
listSecurityProfilesForTarget_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListSecurityProfilesForTarget -> f ListSecurityProfilesForTarget
listSecurityProfilesForTarget_nextToken = (ListSecurityProfilesForTarget -> Maybe Text)
-> (ListSecurityProfilesForTarget
    -> Maybe Text -> ListSecurityProfilesForTarget)
-> Lens
     ListSecurityProfilesForTarget
     ListSecurityProfilesForTarget
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListSecurityProfilesForTarget' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListSecurityProfilesForTarget' :: ListSecurityProfilesForTarget -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListSecurityProfilesForTarget
s@ListSecurityProfilesForTarget' {} Maybe Text
a -> ListSecurityProfilesForTarget
s {$sel:nextToken:ListSecurityProfilesForTarget' :: Maybe Text
nextToken = Maybe Text
a} :: ListSecurityProfilesForTarget)

-- | If true, return child groups too.
listSecurityProfilesForTarget_recursive :: Lens.Lens' ListSecurityProfilesForTarget (Prelude.Maybe Prelude.Bool)
listSecurityProfilesForTarget_recursive :: (Maybe Bool -> f (Maybe Bool))
-> ListSecurityProfilesForTarget -> f ListSecurityProfilesForTarget
listSecurityProfilesForTarget_recursive = (ListSecurityProfilesForTarget -> Maybe Bool)
-> (ListSecurityProfilesForTarget
    -> Maybe Bool -> ListSecurityProfilesForTarget)
-> Lens
     ListSecurityProfilesForTarget
     ListSecurityProfilesForTarget
     (Maybe Bool)
     (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListSecurityProfilesForTarget' {Maybe Bool
recursive :: Maybe Bool
$sel:recursive:ListSecurityProfilesForTarget' :: ListSecurityProfilesForTarget -> Maybe Bool
recursive} -> Maybe Bool
recursive) (\s :: ListSecurityProfilesForTarget
s@ListSecurityProfilesForTarget' {} Maybe Bool
a -> ListSecurityProfilesForTarget
s {$sel:recursive:ListSecurityProfilesForTarget' :: Maybe Bool
recursive = Maybe Bool
a} :: ListSecurityProfilesForTarget)

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

-- | The ARN of the target (thing group) whose attached security profiles you
-- want to get.
listSecurityProfilesForTarget_securityProfileTargetArn :: Lens.Lens' ListSecurityProfilesForTarget Prelude.Text
listSecurityProfilesForTarget_securityProfileTargetArn :: (Text -> f Text)
-> ListSecurityProfilesForTarget -> f ListSecurityProfilesForTarget
listSecurityProfilesForTarget_securityProfileTargetArn = (ListSecurityProfilesForTarget -> Text)
-> (ListSecurityProfilesForTarget
    -> Text -> ListSecurityProfilesForTarget)
-> Lens
     ListSecurityProfilesForTarget
     ListSecurityProfilesForTarget
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListSecurityProfilesForTarget' {Text
securityProfileTargetArn :: Text
$sel:securityProfileTargetArn:ListSecurityProfilesForTarget' :: ListSecurityProfilesForTarget -> Text
securityProfileTargetArn} -> Text
securityProfileTargetArn) (\s :: ListSecurityProfilesForTarget
s@ListSecurityProfilesForTarget' {} Text
a -> ListSecurityProfilesForTarget
s {$sel:securityProfileTargetArn:ListSecurityProfilesForTarget' :: Text
securityProfileTargetArn = Text
a} :: ListSecurityProfilesForTarget)

instance Core.AWSPager ListSecurityProfilesForTarget where
  page :: ListSecurityProfilesForTarget
-> AWSResponse ListSecurityProfilesForTarget
-> Maybe ListSecurityProfilesForTarget
page ListSecurityProfilesForTarget
rq AWSResponse ListSecurityProfilesForTarget
rs
    | Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListSecurityProfilesForTarget
ListSecurityProfilesForTargetResponse
rs
            ListSecurityProfilesForTargetResponse
-> Getting (First Text) ListSecurityProfilesForTargetResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListSecurityProfilesForTargetResponse
-> Const (First Text) ListSecurityProfilesForTargetResponse
Lens' ListSecurityProfilesForTargetResponse (Maybe Text)
listSecurityProfilesForTargetResponse_nextToken
              ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListSecurityProfilesForTargetResponse
 -> Const (First Text) ListSecurityProfilesForTargetResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListSecurityProfilesForTargetResponse 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 ListSecurityProfilesForTarget
forall a. Maybe a
Prelude.Nothing
    | Maybe [SecurityProfileTargetMapping] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListSecurityProfilesForTarget
ListSecurityProfilesForTargetResponse
rs
            ListSecurityProfilesForTargetResponse
-> Getting
     (First [SecurityProfileTargetMapping])
     ListSecurityProfilesForTargetResponse
     [SecurityProfileTargetMapping]
-> Maybe [SecurityProfileTargetMapping]
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe [SecurityProfileTargetMapping]
 -> Const
      (First [SecurityProfileTargetMapping])
      (Maybe [SecurityProfileTargetMapping]))
-> ListSecurityProfilesForTargetResponse
-> Const
     (First [SecurityProfileTargetMapping])
     ListSecurityProfilesForTargetResponse
Lens'
  ListSecurityProfilesForTargetResponse
  (Maybe [SecurityProfileTargetMapping])
listSecurityProfilesForTargetResponse_securityProfileTargetMappings
              ((Maybe [SecurityProfileTargetMapping]
  -> Const
       (First [SecurityProfileTargetMapping])
       (Maybe [SecurityProfileTargetMapping]))
 -> ListSecurityProfilesForTargetResponse
 -> Const
      (First [SecurityProfileTargetMapping])
      ListSecurityProfilesForTargetResponse)
-> (([SecurityProfileTargetMapping]
     -> Const
          (First [SecurityProfileTargetMapping])
          [SecurityProfileTargetMapping])
    -> Maybe [SecurityProfileTargetMapping]
    -> Const
         (First [SecurityProfileTargetMapping])
         (Maybe [SecurityProfileTargetMapping]))
-> Getting
     (First [SecurityProfileTargetMapping])
     ListSecurityProfilesForTargetResponse
     [SecurityProfileTargetMapping]
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([SecurityProfileTargetMapping]
 -> Const
      (First [SecurityProfileTargetMapping])
      [SecurityProfileTargetMapping])
-> Maybe [SecurityProfileTargetMapping]
-> Const
     (First [SecurityProfileTargetMapping])
     (Maybe [SecurityProfileTargetMapping])
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe ListSecurityProfilesForTarget
forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
      ListSecurityProfilesForTarget
-> Maybe ListSecurityProfilesForTarget
forall a. a -> Maybe a
Prelude.Just (ListSecurityProfilesForTarget
 -> Maybe ListSecurityProfilesForTarget)
-> ListSecurityProfilesForTarget
-> Maybe ListSecurityProfilesForTarget
forall a b. (a -> b) -> a -> b
Prelude.$
        ListSecurityProfilesForTarget
rq
          ListSecurityProfilesForTarget
-> (ListSecurityProfilesForTarget -> ListSecurityProfilesForTarget)
-> ListSecurityProfilesForTarget
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> ListSecurityProfilesForTarget
-> Identity ListSecurityProfilesForTarget
Lens
  ListSecurityProfilesForTarget
  ListSecurityProfilesForTarget
  (Maybe Text)
  (Maybe Text)
listSecurityProfilesForTarget_nextToken
          ((Maybe Text -> Identity (Maybe Text))
 -> ListSecurityProfilesForTarget
 -> Identity ListSecurityProfilesForTarget)
-> Maybe Text
-> ListSecurityProfilesForTarget
-> ListSecurityProfilesForTarget
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListSecurityProfilesForTarget
ListSecurityProfilesForTargetResponse
rs
          ListSecurityProfilesForTargetResponse
-> Getting (First Text) ListSecurityProfilesForTargetResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListSecurityProfilesForTargetResponse
-> Const (First Text) ListSecurityProfilesForTargetResponse
Lens' ListSecurityProfilesForTargetResponse (Maybe Text)
listSecurityProfilesForTargetResponse_nextToken
            ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListSecurityProfilesForTargetResponse
 -> Const (First Text) ListSecurityProfilesForTargetResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListSecurityProfilesForTargetResponse 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
    ListSecurityProfilesForTarget
  where
  type
    AWSResponse ListSecurityProfilesForTarget =
      ListSecurityProfilesForTargetResponse
  request :: ListSecurityProfilesForTarget
-> Request ListSecurityProfilesForTarget
request = Service
-> ListSecurityProfilesForTarget
-> Request ListSecurityProfilesForTarget
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
  response :: Logger
-> Service
-> Proxy ListSecurityProfilesForTarget
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ListSecurityProfilesForTarget)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse ListSecurityProfilesForTarget))
-> Logger
-> Service
-> Proxy ListSecurityProfilesForTarget
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ListSecurityProfilesForTarget)))
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 [SecurityProfileTargetMapping]
-> Int
-> ListSecurityProfilesForTargetResponse
ListSecurityProfilesForTargetResponse'
            (Maybe Text
 -> Maybe [SecurityProfileTargetMapping]
 -> Int
 -> ListSecurityProfilesForTargetResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe [SecurityProfileTargetMapping]
      -> Int -> ListSecurityProfilesForTargetResponse)
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 [SecurityProfileTargetMapping]
   -> Int -> ListSecurityProfilesForTargetResponse)
-> Either String (Maybe [SecurityProfileTargetMapping])
-> Either String (Int -> ListSecurityProfilesForTargetResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object
-> Text
-> Either String (Maybe (Maybe [SecurityProfileTargetMapping]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"securityProfileTargetMappings"
                            Either String (Maybe (Maybe [SecurityProfileTargetMapping]))
-> Maybe [SecurityProfileTargetMapping]
-> Either String (Maybe [SecurityProfileTargetMapping])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [SecurityProfileTargetMapping]
forall a. Monoid a => a
Prelude.mempty
                        )
            Either String (Int -> ListSecurityProfilesForTargetResponse)
-> Either String Int
-> Either String ListSecurityProfilesForTargetResponse
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
    ListSecurityProfilesForTarget

instance Prelude.NFData ListSecurityProfilesForTarget

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

instance Core.ToPath ListSecurityProfilesForTarget where
  toPath :: ListSecurityProfilesForTarget -> ByteString
toPath =
    ByteString -> ListSecurityProfilesForTarget -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/security-profiles-for-target"

instance Core.ToQuery ListSecurityProfilesForTarget where
  toQuery :: ListSecurityProfilesForTarget -> QueryString
toQuery ListSecurityProfilesForTarget' {Maybe Bool
Maybe Natural
Maybe Text
Text
securityProfileTargetArn :: Text
maxResults :: Maybe Natural
recursive :: Maybe Bool
nextToken :: Maybe Text
$sel:securityProfileTargetArn:ListSecurityProfilesForTarget' :: ListSecurityProfilesForTarget -> Text
$sel:maxResults:ListSecurityProfilesForTarget' :: ListSecurityProfilesForTarget -> Maybe Natural
$sel:recursive:ListSecurityProfilesForTarget' :: ListSecurityProfilesForTarget -> Maybe Bool
$sel:nextToken:ListSecurityProfilesForTarget' :: ListSecurityProfilesForTarget -> Maybe Text
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"nextToken" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
nextToken,
        ByteString
"recursive" ByteString -> Maybe Bool -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Bool
recursive,
        ByteString
"maxResults" ByteString -> Maybe Natural -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Natural
maxResults,
        ByteString
"securityProfileTargetArn"
          ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
securityProfileTargetArn
      ]

-- | /See:/ 'newListSecurityProfilesForTargetResponse' smart constructor.
data ListSecurityProfilesForTargetResponse = ListSecurityProfilesForTargetResponse'
  { -- | A token that can be used to retrieve the next set of results, or @null@
    -- if there are no additional results.
    ListSecurityProfilesForTargetResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | A list of security profiles and their associated targets.
    ListSecurityProfilesForTargetResponse
-> Maybe [SecurityProfileTargetMapping]
securityProfileTargetMappings :: Prelude.Maybe [SecurityProfileTargetMapping],
    -- | The response's http status code.
    ListSecurityProfilesForTargetResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ListSecurityProfilesForTargetResponse
-> ListSecurityProfilesForTargetResponse -> Bool
(ListSecurityProfilesForTargetResponse
 -> ListSecurityProfilesForTargetResponse -> Bool)
-> (ListSecurityProfilesForTargetResponse
    -> ListSecurityProfilesForTargetResponse -> Bool)
-> Eq ListSecurityProfilesForTargetResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListSecurityProfilesForTargetResponse
-> ListSecurityProfilesForTargetResponse -> Bool
$c/= :: ListSecurityProfilesForTargetResponse
-> ListSecurityProfilesForTargetResponse -> Bool
== :: ListSecurityProfilesForTargetResponse
-> ListSecurityProfilesForTargetResponse -> Bool
$c== :: ListSecurityProfilesForTargetResponse
-> ListSecurityProfilesForTargetResponse -> Bool
Prelude.Eq, ReadPrec [ListSecurityProfilesForTargetResponse]
ReadPrec ListSecurityProfilesForTargetResponse
Int -> ReadS ListSecurityProfilesForTargetResponse
ReadS [ListSecurityProfilesForTargetResponse]
(Int -> ReadS ListSecurityProfilesForTargetResponse)
-> ReadS [ListSecurityProfilesForTargetResponse]
-> ReadPrec ListSecurityProfilesForTargetResponse
-> ReadPrec [ListSecurityProfilesForTargetResponse]
-> Read ListSecurityProfilesForTargetResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListSecurityProfilesForTargetResponse]
$creadListPrec :: ReadPrec [ListSecurityProfilesForTargetResponse]
readPrec :: ReadPrec ListSecurityProfilesForTargetResponse
$creadPrec :: ReadPrec ListSecurityProfilesForTargetResponse
readList :: ReadS [ListSecurityProfilesForTargetResponse]
$creadList :: ReadS [ListSecurityProfilesForTargetResponse]
readsPrec :: Int -> ReadS ListSecurityProfilesForTargetResponse
$creadsPrec :: Int -> ReadS ListSecurityProfilesForTargetResponse
Prelude.Read, Int -> ListSecurityProfilesForTargetResponse -> ShowS
[ListSecurityProfilesForTargetResponse] -> ShowS
ListSecurityProfilesForTargetResponse -> String
(Int -> ListSecurityProfilesForTargetResponse -> ShowS)
-> (ListSecurityProfilesForTargetResponse -> String)
-> ([ListSecurityProfilesForTargetResponse] -> ShowS)
-> Show ListSecurityProfilesForTargetResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListSecurityProfilesForTargetResponse] -> ShowS
$cshowList :: [ListSecurityProfilesForTargetResponse] -> ShowS
show :: ListSecurityProfilesForTargetResponse -> String
$cshow :: ListSecurityProfilesForTargetResponse -> String
showsPrec :: Int -> ListSecurityProfilesForTargetResponse -> ShowS
$cshowsPrec :: Int -> ListSecurityProfilesForTargetResponse -> ShowS
Prelude.Show, (forall x.
 ListSecurityProfilesForTargetResponse
 -> Rep ListSecurityProfilesForTargetResponse x)
-> (forall x.
    Rep ListSecurityProfilesForTargetResponse x
    -> ListSecurityProfilesForTargetResponse)
-> Generic ListSecurityProfilesForTargetResponse
forall x.
Rep ListSecurityProfilesForTargetResponse x
-> ListSecurityProfilesForTargetResponse
forall x.
ListSecurityProfilesForTargetResponse
-> Rep ListSecurityProfilesForTargetResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListSecurityProfilesForTargetResponse x
-> ListSecurityProfilesForTargetResponse
$cfrom :: forall x.
ListSecurityProfilesForTargetResponse
-> Rep ListSecurityProfilesForTargetResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListSecurityProfilesForTargetResponse' 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', 'listSecurityProfilesForTargetResponse_nextToken' - A token that can be used to retrieve the next set of results, or @null@
-- if there are no additional results.
--
-- 'securityProfileTargetMappings', 'listSecurityProfilesForTargetResponse_securityProfileTargetMappings' - A list of security profiles and their associated targets.
--
-- 'httpStatus', 'listSecurityProfilesForTargetResponse_httpStatus' - The response's http status code.
newListSecurityProfilesForTargetResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListSecurityProfilesForTargetResponse
newListSecurityProfilesForTargetResponse :: Int -> ListSecurityProfilesForTargetResponse
newListSecurityProfilesForTargetResponse Int
pHttpStatus_ =
  ListSecurityProfilesForTargetResponse' :: Maybe Text
-> Maybe [SecurityProfileTargetMapping]
-> Int
-> ListSecurityProfilesForTargetResponse
ListSecurityProfilesForTargetResponse'
    { $sel:nextToken:ListSecurityProfilesForTargetResponse' :: Maybe Text
nextToken =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:securityProfileTargetMappings:ListSecurityProfilesForTargetResponse' :: Maybe [SecurityProfileTargetMapping]
securityProfileTargetMappings =
        Maybe [SecurityProfileTargetMapping]
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListSecurityProfilesForTargetResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | A token that can be used to retrieve the next set of results, or @null@
-- if there are no additional results.
listSecurityProfilesForTargetResponse_nextToken :: Lens.Lens' ListSecurityProfilesForTargetResponse (Prelude.Maybe Prelude.Text)
listSecurityProfilesForTargetResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListSecurityProfilesForTargetResponse
-> f ListSecurityProfilesForTargetResponse
listSecurityProfilesForTargetResponse_nextToken = (ListSecurityProfilesForTargetResponse -> Maybe Text)
-> (ListSecurityProfilesForTargetResponse
    -> Maybe Text -> ListSecurityProfilesForTargetResponse)
-> Lens' ListSecurityProfilesForTargetResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListSecurityProfilesForTargetResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListSecurityProfilesForTargetResponse' :: ListSecurityProfilesForTargetResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListSecurityProfilesForTargetResponse
s@ListSecurityProfilesForTargetResponse' {} Maybe Text
a -> ListSecurityProfilesForTargetResponse
s {$sel:nextToken:ListSecurityProfilesForTargetResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListSecurityProfilesForTargetResponse)

-- | A list of security profiles and their associated targets.
listSecurityProfilesForTargetResponse_securityProfileTargetMappings :: Lens.Lens' ListSecurityProfilesForTargetResponse (Prelude.Maybe [SecurityProfileTargetMapping])
listSecurityProfilesForTargetResponse_securityProfileTargetMappings :: (Maybe [SecurityProfileTargetMapping]
 -> f (Maybe [SecurityProfileTargetMapping]))
-> ListSecurityProfilesForTargetResponse
-> f ListSecurityProfilesForTargetResponse
listSecurityProfilesForTargetResponse_securityProfileTargetMappings = (ListSecurityProfilesForTargetResponse
 -> Maybe [SecurityProfileTargetMapping])
-> (ListSecurityProfilesForTargetResponse
    -> Maybe [SecurityProfileTargetMapping]
    -> ListSecurityProfilesForTargetResponse)
-> Lens'
     ListSecurityProfilesForTargetResponse
     (Maybe [SecurityProfileTargetMapping])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListSecurityProfilesForTargetResponse' {Maybe [SecurityProfileTargetMapping]
securityProfileTargetMappings :: Maybe [SecurityProfileTargetMapping]
$sel:securityProfileTargetMappings:ListSecurityProfilesForTargetResponse' :: ListSecurityProfilesForTargetResponse
-> Maybe [SecurityProfileTargetMapping]
securityProfileTargetMappings} -> Maybe [SecurityProfileTargetMapping]
securityProfileTargetMappings) (\s :: ListSecurityProfilesForTargetResponse
s@ListSecurityProfilesForTargetResponse' {} Maybe [SecurityProfileTargetMapping]
a -> ListSecurityProfilesForTargetResponse
s {$sel:securityProfileTargetMappings:ListSecurityProfilesForTargetResponse' :: Maybe [SecurityProfileTargetMapping]
securityProfileTargetMappings = Maybe [SecurityProfileTargetMapping]
a} :: ListSecurityProfilesForTargetResponse) ((Maybe [SecurityProfileTargetMapping]
  -> f (Maybe [SecurityProfileTargetMapping]))
 -> ListSecurityProfilesForTargetResponse
 -> f ListSecurityProfilesForTargetResponse)
-> ((Maybe [SecurityProfileTargetMapping]
     -> f (Maybe [SecurityProfileTargetMapping]))
    -> Maybe [SecurityProfileTargetMapping]
    -> f (Maybe [SecurityProfileTargetMapping]))
-> (Maybe [SecurityProfileTargetMapping]
    -> f (Maybe [SecurityProfileTargetMapping]))
-> ListSecurityProfilesForTargetResponse
-> f ListSecurityProfilesForTargetResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [SecurityProfileTargetMapping]
  [SecurityProfileTargetMapping]
  [SecurityProfileTargetMapping]
  [SecurityProfileTargetMapping]
-> Iso
     (Maybe [SecurityProfileTargetMapping])
     (Maybe [SecurityProfileTargetMapping])
     (Maybe [SecurityProfileTargetMapping])
     (Maybe [SecurityProfileTargetMapping])
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
  [SecurityProfileTargetMapping]
  [SecurityProfileTargetMapping]
  [SecurityProfileTargetMapping]
  [SecurityProfileTargetMapping]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance
  Prelude.NFData
    ListSecurityProfilesForTargetResponse