{-# 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.CloudDirectory.ListPolicyAttachments
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Returns all of the @ObjectIdentifiers@ to which a given policy is
-- attached.
--
-- This operation returns paginated results.
module Amazonka.CloudDirectory.ListPolicyAttachments
  ( -- * Creating a Request
    ListPolicyAttachments (..),
    newListPolicyAttachments,

    -- * Request Lenses
    listPolicyAttachments_consistencyLevel,
    listPolicyAttachments_maxResults,
    listPolicyAttachments_nextToken,
    listPolicyAttachments_directoryArn,
    listPolicyAttachments_policyReference,

    -- * Destructuring the Response
    ListPolicyAttachmentsResponse (..),
    newListPolicyAttachmentsResponse,

    -- * Response Lenses
    listPolicyAttachmentsResponse_nextToken,
    listPolicyAttachmentsResponse_objectIdentifiers,
    listPolicyAttachmentsResponse_httpStatus,
  )
where

import Amazonka.CloudDirectory.Types
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newListPolicyAttachments' smart constructor.
data ListPolicyAttachments = ListPolicyAttachments'
  { -- | Represents the manner and timing in which the successful write or update
    -- of an object is reflected in a subsequent read operation of that same
    -- object.
    ListPolicyAttachments -> Maybe ConsistencyLevel
consistencyLevel :: Prelude.Maybe ConsistencyLevel,
    -- | The maximum number of items to be retrieved in a single call. This is an
    -- approximate number.
    ListPolicyAttachments -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | The pagination token.
    ListPolicyAttachments -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The Amazon Resource Name (ARN) that is associated with the Directory
    -- where objects reside. For more information, see arns.
    ListPolicyAttachments -> Text
directoryArn :: Prelude.Text,
    -- | The reference that identifies the policy object.
    ListPolicyAttachments -> ObjectReference
policyReference :: ObjectReference
  }
  deriving (ListPolicyAttachments -> ListPolicyAttachments -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListPolicyAttachments -> ListPolicyAttachments -> Bool
$c/= :: ListPolicyAttachments -> ListPolicyAttachments -> Bool
== :: ListPolicyAttachments -> ListPolicyAttachments -> Bool
$c== :: ListPolicyAttachments -> ListPolicyAttachments -> Bool
Prelude.Eq, ReadPrec [ListPolicyAttachments]
ReadPrec ListPolicyAttachments
Int -> ReadS ListPolicyAttachments
ReadS [ListPolicyAttachments]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListPolicyAttachments]
$creadListPrec :: ReadPrec [ListPolicyAttachments]
readPrec :: ReadPrec ListPolicyAttachments
$creadPrec :: ReadPrec ListPolicyAttachments
readList :: ReadS [ListPolicyAttachments]
$creadList :: ReadS [ListPolicyAttachments]
readsPrec :: Int -> ReadS ListPolicyAttachments
$creadsPrec :: Int -> ReadS ListPolicyAttachments
Prelude.Read, Int -> ListPolicyAttachments -> ShowS
[ListPolicyAttachments] -> ShowS
ListPolicyAttachments -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListPolicyAttachments] -> ShowS
$cshowList :: [ListPolicyAttachments] -> ShowS
show :: ListPolicyAttachments -> String
$cshow :: ListPolicyAttachments -> String
showsPrec :: Int -> ListPolicyAttachments -> ShowS
$cshowsPrec :: Int -> ListPolicyAttachments -> ShowS
Prelude.Show, forall x. Rep ListPolicyAttachments x -> ListPolicyAttachments
forall x. ListPolicyAttachments -> Rep ListPolicyAttachments x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListPolicyAttachments x -> ListPolicyAttachments
$cfrom :: forall x. ListPolicyAttachments -> Rep ListPolicyAttachments x
Prelude.Generic)

-- |
-- Create a value of 'ListPolicyAttachments' 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:
--
-- 'consistencyLevel', 'listPolicyAttachments_consistencyLevel' - Represents the manner and timing in which the successful write or update
-- of an object is reflected in a subsequent read operation of that same
-- object.
--
-- 'maxResults', 'listPolicyAttachments_maxResults' - The maximum number of items to be retrieved in a single call. This is an
-- approximate number.
--
-- 'nextToken', 'listPolicyAttachments_nextToken' - The pagination token.
--
-- 'directoryArn', 'listPolicyAttachments_directoryArn' - The Amazon Resource Name (ARN) that is associated with the Directory
-- where objects reside. For more information, see arns.
--
-- 'policyReference', 'listPolicyAttachments_policyReference' - The reference that identifies the policy object.
newListPolicyAttachments ::
  -- | 'directoryArn'
  Prelude.Text ->
  -- | 'policyReference'
  ObjectReference ->
  ListPolicyAttachments
newListPolicyAttachments :: Text -> ObjectReference -> ListPolicyAttachments
newListPolicyAttachments
  Text
pDirectoryArn_
  ObjectReference
pPolicyReference_ =
    ListPolicyAttachments'
      { $sel:consistencyLevel:ListPolicyAttachments' :: Maybe ConsistencyLevel
consistencyLevel =
          forall a. Maybe a
Prelude.Nothing,
        $sel:maxResults:ListPolicyAttachments' :: Maybe Natural
maxResults = forall a. Maybe a
Prelude.Nothing,
        $sel:nextToken:ListPolicyAttachments' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
        $sel:directoryArn:ListPolicyAttachments' :: Text
directoryArn = Text
pDirectoryArn_,
        $sel:policyReference:ListPolicyAttachments' :: ObjectReference
policyReference = ObjectReference
pPolicyReference_
      }

-- | Represents the manner and timing in which the successful write or update
-- of an object is reflected in a subsequent read operation of that same
-- object.
listPolicyAttachments_consistencyLevel :: Lens.Lens' ListPolicyAttachments (Prelude.Maybe ConsistencyLevel)
listPolicyAttachments_consistencyLevel :: Lens' ListPolicyAttachments (Maybe ConsistencyLevel)
listPolicyAttachments_consistencyLevel = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPolicyAttachments' {Maybe ConsistencyLevel
consistencyLevel :: Maybe ConsistencyLevel
$sel:consistencyLevel:ListPolicyAttachments' :: ListPolicyAttachments -> Maybe ConsistencyLevel
consistencyLevel} -> Maybe ConsistencyLevel
consistencyLevel) (\s :: ListPolicyAttachments
s@ListPolicyAttachments' {} Maybe ConsistencyLevel
a -> ListPolicyAttachments
s {$sel:consistencyLevel:ListPolicyAttachments' :: Maybe ConsistencyLevel
consistencyLevel = Maybe ConsistencyLevel
a} :: ListPolicyAttachments)

-- | The maximum number of items to be retrieved in a single call. This is an
-- approximate number.
listPolicyAttachments_maxResults :: Lens.Lens' ListPolicyAttachments (Prelude.Maybe Prelude.Natural)
listPolicyAttachments_maxResults :: Lens' ListPolicyAttachments (Maybe Natural)
listPolicyAttachments_maxResults = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPolicyAttachments' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListPolicyAttachments' :: ListPolicyAttachments -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListPolicyAttachments
s@ListPolicyAttachments' {} Maybe Natural
a -> ListPolicyAttachments
s {$sel:maxResults:ListPolicyAttachments' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListPolicyAttachments)

-- | The pagination token.
listPolicyAttachments_nextToken :: Lens.Lens' ListPolicyAttachments (Prelude.Maybe Prelude.Text)
listPolicyAttachments_nextToken :: Lens' ListPolicyAttachments (Maybe Text)
listPolicyAttachments_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPolicyAttachments' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListPolicyAttachments' :: ListPolicyAttachments -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListPolicyAttachments
s@ListPolicyAttachments' {} Maybe Text
a -> ListPolicyAttachments
s {$sel:nextToken:ListPolicyAttachments' :: Maybe Text
nextToken = Maybe Text
a} :: ListPolicyAttachments)

-- | The Amazon Resource Name (ARN) that is associated with the Directory
-- where objects reside. For more information, see arns.
listPolicyAttachments_directoryArn :: Lens.Lens' ListPolicyAttachments Prelude.Text
listPolicyAttachments_directoryArn :: Lens' ListPolicyAttachments Text
listPolicyAttachments_directoryArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPolicyAttachments' {Text
directoryArn :: Text
$sel:directoryArn:ListPolicyAttachments' :: ListPolicyAttachments -> Text
directoryArn} -> Text
directoryArn) (\s :: ListPolicyAttachments
s@ListPolicyAttachments' {} Text
a -> ListPolicyAttachments
s {$sel:directoryArn:ListPolicyAttachments' :: Text
directoryArn = Text
a} :: ListPolicyAttachments)

-- | The reference that identifies the policy object.
listPolicyAttachments_policyReference :: Lens.Lens' ListPolicyAttachments ObjectReference
listPolicyAttachments_policyReference :: Lens' ListPolicyAttachments ObjectReference
listPolicyAttachments_policyReference = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPolicyAttachments' {ObjectReference
policyReference :: ObjectReference
$sel:policyReference:ListPolicyAttachments' :: ListPolicyAttachments -> ObjectReference
policyReference} -> ObjectReference
policyReference) (\s :: ListPolicyAttachments
s@ListPolicyAttachments' {} ObjectReference
a -> ListPolicyAttachments
s {$sel:policyReference:ListPolicyAttachments' :: ObjectReference
policyReference = ObjectReference
a} :: ListPolicyAttachments)

instance Core.AWSPager ListPolicyAttachments where
  page :: ListPolicyAttachments
-> AWSResponse ListPolicyAttachments -> Maybe ListPolicyAttachments
page ListPolicyAttachments
rq AWSResponse ListPolicyAttachments
rs
    | forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListPolicyAttachments
rs
            forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListPolicyAttachmentsResponse (Maybe Text)
listPolicyAttachmentsResponse_nextToken
            forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
        forall a. Maybe a
Prelude.Nothing
    | forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListPolicyAttachments
rs
            forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListPolicyAttachmentsResponse (Maybe [Text])
listPolicyAttachmentsResponse_objectIdentifiers
            forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
        forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
        forall a. a -> Maybe a
Prelude.Just
          forall a b. (a -> b) -> a -> b
Prelude.$ ListPolicyAttachments
rq
          forall a b. a -> (a -> b) -> b
Prelude.& Lens' ListPolicyAttachments (Maybe Text)
listPolicyAttachments_nextToken
          forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListPolicyAttachments
rs
          forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListPolicyAttachmentsResponse (Maybe Text)
listPolicyAttachmentsResponse_nextToken
          forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just

instance Core.AWSRequest ListPolicyAttachments where
  type
    AWSResponse ListPolicyAttachments =
      ListPolicyAttachmentsResponse
  request :: (Service -> Service)
-> ListPolicyAttachments -> Request ListPolicyAttachments
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy ListPolicyAttachments
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ListPolicyAttachments)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe Text -> Maybe [Text] -> Int -> ListPolicyAttachmentsResponse
ListPolicyAttachmentsResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"NextToken")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x
                            forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"ObjectIdentifiers"
                            forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty
                        )
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable ListPolicyAttachments where
  hashWithSalt :: Int -> ListPolicyAttachments -> Int
hashWithSalt Int
_salt ListPolicyAttachments' {Maybe Natural
Maybe Text
Maybe ConsistencyLevel
Text
ObjectReference
policyReference :: ObjectReference
directoryArn :: Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
consistencyLevel :: Maybe ConsistencyLevel
$sel:policyReference:ListPolicyAttachments' :: ListPolicyAttachments -> ObjectReference
$sel:directoryArn:ListPolicyAttachments' :: ListPolicyAttachments -> Text
$sel:nextToken:ListPolicyAttachments' :: ListPolicyAttachments -> Maybe Text
$sel:maxResults:ListPolicyAttachments' :: ListPolicyAttachments -> Maybe Natural
$sel:consistencyLevel:ListPolicyAttachments' :: ListPolicyAttachments -> Maybe ConsistencyLevel
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ConsistencyLevel
consistencyLevel
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
maxResults
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
nextToken
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
directoryArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` ObjectReference
policyReference

instance Prelude.NFData ListPolicyAttachments where
  rnf :: ListPolicyAttachments -> ()
rnf ListPolicyAttachments' {Maybe Natural
Maybe Text
Maybe ConsistencyLevel
Text
ObjectReference
policyReference :: ObjectReference
directoryArn :: Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
consistencyLevel :: Maybe ConsistencyLevel
$sel:policyReference:ListPolicyAttachments' :: ListPolicyAttachments -> ObjectReference
$sel:directoryArn:ListPolicyAttachments' :: ListPolicyAttachments -> Text
$sel:nextToken:ListPolicyAttachments' :: ListPolicyAttachments -> Maybe Text
$sel:maxResults:ListPolicyAttachments' :: ListPolicyAttachments -> Maybe Natural
$sel:consistencyLevel:ListPolicyAttachments' :: ListPolicyAttachments -> Maybe ConsistencyLevel
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe ConsistencyLevel
consistencyLevel
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
maxResults
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextToken
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
directoryArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf ObjectReference
policyReference

instance Data.ToHeaders ListPolicyAttachments where
  toHeaders :: ListPolicyAttachments -> ResponseHeaders
toHeaders ListPolicyAttachments' {Maybe Natural
Maybe Text
Maybe ConsistencyLevel
Text
ObjectReference
policyReference :: ObjectReference
directoryArn :: Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
consistencyLevel :: Maybe ConsistencyLevel
$sel:policyReference:ListPolicyAttachments' :: ListPolicyAttachments -> ObjectReference
$sel:directoryArn:ListPolicyAttachments' :: ListPolicyAttachments -> Text
$sel:nextToken:ListPolicyAttachments' :: ListPolicyAttachments -> Maybe Text
$sel:maxResults:ListPolicyAttachments' :: ListPolicyAttachments -> Maybe Natural
$sel:consistencyLevel:ListPolicyAttachments' :: ListPolicyAttachments -> Maybe ConsistencyLevel
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ HeaderName
"x-amz-consistency-level" forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# Maybe ConsistencyLevel
consistencyLevel,
        HeaderName
"x-amz-data-partition" forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# Text
directoryArn
      ]

instance Data.ToJSON ListPolicyAttachments where
  toJSON :: ListPolicyAttachments -> Value
toJSON ListPolicyAttachments' {Maybe Natural
Maybe Text
Maybe ConsistencyLevel
Text
ObjectReference
policyReference :: ObjectReference
directoryArn :: Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
consistencyLevel :: Maybe ConsistencyLevel
$sel:policyReference:ListPolicyAttachments' :: ListPolicyAttachments -> ObjectReference
$sel:directoryArn:ListPolicyAttachments' :: ListPolicyAttachments -> Text
$sel:nextToken:ListPolicyAttachments' :: ListPolicyAttachments -> Maybe Text
$sel:maxResults:ListPolicyAttachments' :: ListPolicyAttachments -> Maybe Natural
$sel:consistencyLevel:ListPolicyAttachments' :: ListPolicyAttachments -> Maybe ConsistencyLevel
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"MaxResults" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
maxResults,
            (Key
"NextToken" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
nextToken,
            forall a. a -> Maybe a
Prelude.Just
              (Key
"PolicyReference" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= ObjectReference
policyReference)
          ]
      )

instance Data.ToPath ListPolicyAttachments where
  toPath :: ListPolicyAttachments -> ByteString
toPath =
    forall a b. a -> b -> a
Prelude.const
      ByteString
"/amazonclouddirectory/2017-01-11/policy/attachment"

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

-- | /See:/ 'newListPolicyAttachmentsResponse' smart constructor.
data ListPolicyAttachmentsResponse = ListPolicyAttachmentsResponse'
  { -- | The pagination token.
    ListPolicyAttachmentsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | A list of @ObjectIdentifiers@ to which the policy is attached.
    ListPolicyAttachmentsResponse -> Maybe [Text]
objectIdentifiers :: Prelude.Maybe [Prelude.Text],
    -- | The response's http status code.
    ListPolicyAttachmentsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ListPolicyAttachmentsResponse
-> ListPolicyAttachmentsResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListPolicyAttachmentsResponse
-> ListPolicyAttachmentsResponse -> Bool
$c/= :: ListPolicyAttachmentsResponse
-> ListPolicyAttachmentsResponse -> Bool
== :: ListPolicyAttachmentsResponse
-> ListPolicyAttachmentsResponse -> Bool
$c== :: ListPolicyAttachmentsResponse
-> ListPolicyAttachmentsResponse -> Bool
Prelude.Eq, ReadPrec [ListPolicyAttachmentsResponse]
ReadPrec ListPolicyAttachmentsResponse
Int -> ReadS ListPolicyAttachmentsResponse
ReadS [ListPolicyAttachmentsResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListPolicyAttachmentsResponse]
$creadListPrec :: ReadPrec [ListPolicyAttachmentsResponse]
readPrec :: ReadPrec ListPolicyAttachmentsResponse
$creadPrec :: ReadPrec ListPolicyAttachmentsResponse
readList :: ReadS [ListPolicyAttachmentsResponse]
$creadList :: ReadS [ListPolicyAttachmentsResponse]
readsPrec :: Int -> ReadS ListPolicyAttachmentsResponse
$creadsPrec :: Int -> ReadS ListPolicyAttachmentsResponse
Prelude.Read, Int -> ListPolicyAttachmentsResponse -> ShowS
[ListPolicyAttachmentsResponse] -> ShowS
ListPolicyAttachmentsResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListPolicyAttachmentsResponse] -> ShowS
$cshowList :: [ListPolicyAttachmentsResponse] -> ShowS
show :: ListPolicyAttachmentsResponse -> String
$cshow :: ListPolicyAttachmentsResponse -> String
showsPrec :: Int -> ListPolicyAttachmentsResponse -> ShowS
$cshowsPrec :: Int -> ListPolicyAttachmentsResponse -> ShowS
Prelude.Show, forall x.
Rep ListPolicyAttachmentsResponse x
-> ListPolicyAttachmentsResponse
forall x.
ListPolicyAttachmentsResponse
-> Rep ListPolicyAttachmentsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListPolicyAttachmentsResponse x
-> ListPolicyAttachmentsResponse
$cfrom :: forall x.
ListPolicyAttachmentsResponse
-> Rep ListPolicyAttachmentsResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListPolicyAttachmentsResponse' 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', 'listPolicyAttachmentsResponse_nextToken' - The pagination token.
--
-- 'objectIdentifiers', 'listPolicyAttachmentsResponse_objectIdentifiers' - A list of @ObjectIdentifiers@ to which the policy is attached.
--
-- 'httpStatus', 'listPolicyAttachmentsResponse_httpStatus' - The response's http status code.
newListPolicyAttachmentsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListPolicyAttachmentsResponse
newListPolicyAttachmentsResponse :: Int -> ListPolicyAttachmentsResponse
newListPolicyAttachmentsResponse Int
pHttpStatus_ =
  ListPolicyAttachmentsResponse'
    { $sel:nextToken:ListPolicyAttachmentsResponse' :: Maybe Text
nextToken =
        forall a. Maybe a
Prelude.Nothing,
      $sel:objectIdentifiers:ListPolicyAttachmentsResponse' :: Maybe [Text]
objectIdentifiers = forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListPolicyAttachmentsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The pagination token.
listPolicyAttachmentsResponse_nextToken :: Lens.Lens' ListPolicyAttachmentsResponse (Prelude.Maybe Prelude.Text)
listPolicyAttachmentsResponse_nextToken :: Lens' ListPolicyAttachmentsResponse (Maybe Text)
listPolicyAttachmentsResponse_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPolicyAttachmentsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListPolicyAttachmentsResponse' :: ListPolicyAttachmentsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListPolicyAttachmentsResponse
s@ListPolicyAttachmentsResponse' {} Maybe Text
a -> ListPolicyAttachmentsResponse
s {$sel:nextToken:ListPolicyAttachmentsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListPolicyAttachmentsResponse)

-- | A list of @ObjectIdentifiers@ to which the policy is attached.
listPolicyAttachmentsResponse_objectIdentifiers :: Lens.Lens' ListPolicyAttachmentsResponse (Prelude.Maybe [Prelude.Text])
listPolicyAttachmentsResponse_objectIdentifiers :: Lens' ListPolicyAttachmentsResponse (Maybe [Text])
listPolicyAttachmentsResponse_objectIdentifiers = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPolicyAttachmentsResponse' {Maybe [Text]
objectIdentifiers :: Maybe [Text]
$sel:objectIdentifiers:ListPolicyAttachmentsResponse' :: ListPolicyAttachmentsResponse -> Maybe [Text]
objectIdentifiers} -> Maybe [Text]
objectIdentifiers) (\s :: ListPolicyAttachmentsResponse
s@ListPolicyAttachmentsResponse' {} Maybe [Text]
a -> ListPolicyAttachmentsResponse
s {$sel:objectIdentifiers:ListPolicyAttachmentsResponse' :: Maybe [Text]
objectIdentifiers = Maybe [Text]
a} :: ListPolicyAttachmentsResponse) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance Prelude.NFData ListPolicyAttachmentsResponse where
  rnf :: ListPolicyAttachmentsResponse -> ()
rnf ListPolicyAttachmentsResponse' {Int
Maybe [Text]
Maybe Text
httpStatus :: Int
objectIdentifiers :: Maybe [Text]
nextToken :: Maybe Text
$sel:httpStatus:ListPolicyAttachmentsResponse' :: ListPolicyAttachmentsResponse -> Int
$sel:objectIdentifiers:ListPolicyAttachmentsResponse' :: ListPolicyAttachmentsResponse -> Maybe [Text]
$sel:nextToken:ListPolicyAttachmentsResponse' :: ListPolicyAttachmentsResponse -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextToken
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
objectIdentifiers
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus