{-# 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.LookupPolicy
-- 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 all policies from the root of the Directory to the object
-- specified. If there are no policies present, an empty list is returned.
-- If policies are present, and if some objects don\'t have the policies
-- attached, it returns the @ObjectIdentifier@ for such objects. If
-- policies are present, it returns @ObjectIdentifier@, @policyId@, and
-- @policyType@. Paths that don\'t lead to the root from the target object
-- are ignored. For more information, see
-- <https://docs.aws.amazon.com/clouddirectory/latest/developerguide/key_concepts_directory.html#key_concepts_policies Policies>.
--
-- This operation returns paginated results.
module Amazonka.CloudDirectory.LookupPolicy
  ( -- * Creating a Request
    LookupPolicy (..),
    newLookupPolicy,

    -- * Request Lenses
    lookupPolicy_nextToken,
    lookupPolicy_maxResults,
    lookupPolicy_directoryArn,
    lookupPolicy_objectReference,

    -- * Destructuring the Response
    LookupPolicyResponse (..),
    newLookupPolicyResponse,

    -- * Response Lenses
    lookupPolicyResponse_nextToken,
    lookupPolicyResponse_policyToPathList,
    lookupPolicyResponse_httpStatus,
  )
where

import Amazonka.CloudDirectory.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:/ 'newLookupPolicy' smart constructor.
data LookupPolicy = LookupPolicy'
  { -- | The token to request the next page of results.
    LookupPolicy -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of items to be retrieved in a single call. This is an
    -- approximate number.
    LookupPolicy -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | The Amazon Resource Name (ARN) that is associated with the Directory.
    -- For more information, see arns.
    LookupPolicy -> Text
directoryArn :: Prelude.Text,
    -- | Reference that identifies the object whose policies will be looked up.
    LookupPolicy -> ObjectReference
objectReference :: ObjectReference
  }
  deriving (LookupPolicy -> LookupPolicy -> Bool
(LookupPolicy -> LookupPolicy -> Bool)
-> (LookupPolicy -> LookupPolicy -> Bool) -> Eq LookupPolicy
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LookupPolicy -> LookupPolicy -> Bool
$c/= :: LookupPolicy -> LookupPolicy -> Bool
== :: LookupPolicy -> LookupPolicy -> Bool
$c== :: LookupPolicy -> LookupPolicy -> Bool
Prelude.Eq, ReadPrec [LookupPolicy]
ReadPrec LookupPolicy
Int -> ReadS LookupPolicy
ReadS [LookupPolicy]
(Int -> ReadS LookupPolicy)
-> ReadS [LookupPolicy]
-> ReadPrec LookupPolicy
-> ReadPrec [LookupPolicy]
-> Read LookupPolicy
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [LookupPolicy]
$creadListPrec :: ReadPrec [LookupPolicy]
readPrec :: ReadPrec LookupPolicy
$creadPrec :: ReadPrec LookupPolicy
readList :: ReadS [LookupPolicy]
$creadList :: ReadS [LookupPolicy]
readsPrec :: Int -> ReadS LookupPolicy
$creadsPrec :: Int -> ReadS LookupPolicy
Prelude.Read, Int -> LookupPolicy -> ShowS
[LookupPolicy] -> ShowS
LookupPolicy -> String
(Int -> LookupPolicy -> ShowS)
-> (LookupPolicy -> String)
-> ([LookupPolicy] -> ShowS)
-> Show LookupPolicy
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [LookupPolicy] -> ShowS
$cshowList :: [LookupPolicy] -> ShowS
show :: LookupPolicy -> String
$cshow :: LookupPolicy -> String
showsPrec :: Int -> LookupPolicy -> ShowS
$cshowsPrec :: Int -> LookupPolicy -> ShowS
Prelude.Show, (forall x. LookupPolicy -> Rep LookupPolicy x)
-> (forall x. Rep LookupPolicy x -> LookupPolicy)
-> Generic LookupPolicy
forall x. Rep LookupPolicy x -> LookupPolicy
forall x. LookupPolicy -> Rep LookupPolicy x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep LookupPolicy x -> LookupPolicy
$cfrom :: forall x. LookupPolicy -> Rep LookupPolicy x
Prelude.Generic)

-- |
-- Create a value of 'LookupPolicy' 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', 'lookupPolicy_nextToken' - The token to request the next page of results.
--
-- 'maxResults', 'lookupPolicy_maxResults' - The maximum number of items to be retrieved in a single call. This is an
-- approximate number.
--
-- 'directoryArn', 'lookupPolicy_directoryArn' - The Amazon Resource Name (ARN) that is associated with the Directory.
-- For more information, see arns.
--
-- 'objectReference', 'lookupPolicy_objectReference' - Reference that identifies the object whose policies will be looked up.
newLookupPolicy ::
  -- | 'directoryArn'
  Prelude.Text ->
  -- | 'objectReference'
  ObjectReference ->
  LookupPolicy
newLookupPolicy :: Text -> ObjectReference -> LookupPolicy
newLookupPolicy Text
pDirectoryArn_ ObjectReference
pObjectReference_ =
  LookupPolicy' :: Maybe Text
-> Maybe Natural -> Text -> ObjectReference -> LookupPolicy
LookupPolicy'
    { $sel:nextToken:LookupPolicy' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:LookupPolicy' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:directoryArn:LookupPolicy' :: Text
directoryArn = Text
pDirectoryArn_,
      $sel:objectReference:LookupPolicy' :: ObjectReference
objectReference = ObjectReference
pObjectReference_
    }

-- | The token to request the next page of results.
lookupPolicy_nextToken :: Lens.Lens' LookupPolicy (Prelude.Maybe Prelude.Text)
lookupPolicy_nextToken :: (Maybe Text -> f (Maybe Text)) -> LookupPolicy -> f LookupPolicy
lookupPolicy_nextToken = (LookupPolicy -> Maybe Text)
-> (LookupPolicy -> Maybe Text -> LookupPolicy)
-> Lens LookupPolicy LookupPolicy (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LookupPolicy' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:LookupPolicy' :: LookupPolicy -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: LookupPolicy
s@LookupPolicy' {} Maybe Text
a -> LookupPolicy
s {$sel:nextToken:LookupPolicy' :: Maybe Text
nextToken = Maybe Text
a} :: LookupPolicy)

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

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

-- | Reference that identifies the object whose policies will be looked up.
lookupPolicy_objectReference :: Lens.Lens' LookupPolicy ObjectReference
lookupPolicy_objectReference :: (ObjectReference -> f ObjectReference)
-> LookupPolicy -> f LookupPolicy
lookupPolicy_objectReference = (LookupPolicy -> ObjectReference)
-> (LookupPolicy -> ObjectReference -> LookupPolicy)
-> Lens LookupPolicy LookupPolicy ObjectReference ObjectReference
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LookupPolicy' {ObjectReference
objectReference :: ObjectReference
$sel:objectReference:LookupPolicy' :: LookupPolicy -> ObjectReference
objectReference} -> ObjectReference
objectReference) (\s :: LookupPolicy
s@LookupPolicy' {} ObjectReference
a -> LookupPolicy
s {$sel:objectReference:LookupPolicy' :: ObjectReference
objectReference = ObjectReference
a} :: LookupPolicy)

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

instance Prelude.NFData LookupPolicy

instance Core.ToHeaders LookupPolicy where
  toHeaders :: LookupPolicy -> ResponseHeaders
toHeaders LookupPolicy' {Maybe Natural
Maybe Text
Text
ObjectReference
objectReference :: ObjectReference
directoryArn :: Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
$sel:objectReference:LookupPolicy' :: LookupPolicy -> ObjectReference
$sel:directoryArn:LookupPolicy' :: LookupPolicy -> Text
$sel:maxResults:LookupPolicy' :: LookupPolicy -> Maybe Natural
$sel:nextToken:LookupPolicy' :: LookupPolicy -> Maybe Text
..} =
    [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [HeaderName
"x-amz-data-partition" HeaderName -> Text -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# Text
directoryArn]

instance Core.ToJSON LookupPolicy where
  toJSON :: LookupPolicy -> Value
toJSON LookupPolicy' {Maybe Natural
Maybe Text
Text
ObjectReference
objectReference :: ObjectReference
directoryArn :: Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
$sel:objectReference:LookupPolicy' :: LookupPolicy -> ObjectReference
$sel:directoryArn:LookupPolicy' :: LookupPolicy -> Text
$sel:maxResults:LookupPolicy' :: LookupPolicy -> Maybe Natural
$sel:nextToken:LookupPolicy' :: LookupPolicy -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (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,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"ObjectReference" Text -> ObjectReference -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= ObjectReference
objectReference)
          ]
      )

instance Core.ToPath LookupPolicy where
  toPath :: LookupPolicy -> ByteString
toPath =
    ByteString -> LookupPolicy -> ByteString
forall a b. a -> b -> a
Prelude.const
      ByteString
"/amazonclouddirectory/2017-01-11/policy/lookup"

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

-- | /See:/ 'newLookupPolicyResponse' smart constructor.
data LookupPolicyResponse = LookupPolicyResponse'
  { -- | The pagination token.
    LookupPolicyResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | Provides list of path to policies. Policies contain @PolicyId@,
    -- @ObjectIdentifier@, and @PolicyType@. For more information, see
    -- <https://docs.aws.amazon.com/clouddirectory/latest/developerguide/key_concepts_directory.html#key_concepts_policies Policies>.
    LookupPolicyResponse -> Maybe [PolicyToPath]
policyToPathList :: Prelude.Maybe [PolicyToPath],
    -- | The response's http status code.
    LookupPolicyResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (LookupPolicyResponse -> LookupPolicyResponse -> Bool
(LookupPolicyResponse -> LookupPolicyResponse -> Bool)
-> (LookupPolicyResponse -> LookupPolicyResponse -> Bool)
-> Eq LookupPolicyResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LookupPolicyResponse -> LookupPolicyResponse -> Bool
$c/= :: LookupPolicyResponse -> LookupPolicyResponse -> Bool
== :: LookupPolicyResponse -> LookupPolicyResponse -> Bool
$c== :: LookupPolicyResponse -> LookupPolicyResponse -> Bool
Prelude.Eq, ReadPrec [LookupPolicyResponse]
ReadPrec LookupPolicyResponse
Int -> ReadS LookupPolicyResponse
ReadS [LookupPolicyResponse]
(Int -> ReadS LookupPolicyResponse)
-> ReadS [LookupPolicyResponse]
-> ReadPrec LookupPolicyResponse
-> ReadPrec [LookupPolicyResponse]
-> Read LookupPolicyResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [LookupPolicyResponse]
$creadListPrec :: ReadPrec [LookupPolicyResponse]
readPrec :: ReadPrec LookupPolicyResponse
$creadPrec :: ReadPrec LookupPolicyResponse
readList :: ReadS [LookupPolicyResponse]
$creadList :: ReadS [LookupPolicyResponse]
readsPrec :: Int -> ReadS LookupPolicyResponse
$creadsPrec :: Int -> ReadS LookupPolicyResponse
Prelude.Read, Int -> LookupPolicyResponse -> ShowS
[LookupPolicyResponse] -> ShowS
LookupPolicyResponse -> String
(Int -> LookupPolicyResponse -> ShowS)
-> (LookupPolicyResponse -> String)
-> ([LookupPolicyResponse] -> ShowS)
-> Show LookupPolicyResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [LookupPolicyResponse] -> ShowS
$cshowList :: [LookupPolicyResponse] -> ShowS
show :: LookupPolicyResponse -> String
$cshow :: LookupPolicyResponse -> String
showsPrec :: Int -> LookupPolicyResponse -> ShowS
$cshowsPrec :: Int -> LookupPolicyResponse -> ShowS
Prelude.Show, (forall x. LookupPolicyResponse -> Rep LookupPolicyResponse x)
-> (forall x. Rep LookupPolicyResponse x -> LookupPolicyResponse)
-> Generic LookupPolicyResponse
forall x. Rep LookupPolicyResponse x -> LookupPolicyResponse
forall x. LookupPolicyResponse -> Rep LookupPolicyResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep LookupPolicyResponse x -> LookupPolicyResponse
$cfrom :: forall x. LookupPolicyResponse -> Rep LookupPolicyResponse x
Prelude.Generic)

-- |
-- Create a value of 'LookupPolicyResponse' 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', 'lookupPolicyResponse_nextToken' - The pagination token.
--
-- 'policyToPathList', 'lookupPolicyResponse_policyToPathList' - Provides list of path to policies. Policies contain @PolicyId@,
-- @ObjectIdentifier@, and @PolicyType@. For more information, see
-- <https://docs.aws.amazon.com/clouddirectory/latest/developerguide/key_concepts_directory.html#key_concepts_policies Policies>.
--
-- 'httpStatus', 'lookupPolicyResponse_httpStatus' - The response's http status code.
newLookupPolicyResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  LookupPolicyResponse
newLookupPolicyResponse :: Int -> LookupPolicyResponse
newLookupPolicyResponse Int
pHttpStatus_ =
  LookupPolicyResponse' :: Maybe Text -> Maybe [PolicyToPath] -> Int -> LookupPolicyResponse
LookupPolicyResponse'
    { $sel:nextToken:LookupPolicyResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:policyToPathList:LookupPolicyResponse' :: Maybe [PolicyToPath]
policyToPathList = Maybe [PolicyToPath]
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:LookupPolicyResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

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

-- | Provides list of path to policies. Policies contain @PolicyId@,
-- @ObjectIdentifier@, and @PolicyType@. For more information, see
-- <https://docs.aws.amazon.com/clouddirectory/latest/developerguide/key_concepts_directory.html#key_concepts_policies Policies>.
lookupPolicyResponse_policyToPathList :: Lens.Lens' LookupPolicyResponse (Prelude.Maybe [PolicyToPath])
lookupPolicyResponse_policyToPathList :: (Maybe [PolicyToPath] -> f (Maybe [PolicyToPath]))
-> LookupPolicyResponse -> f LookupPolicyResponse
lookupPolicyResponse_policyToPathList = (LookupPolicyResponse -> Maybe [PolicyToPath])
-> (LookupPolicyResponse
    -> Maybe [PolicyToPath] -> LookupPolicyResponse)
-> Lens' LookupPolicyResponse (Maybe [PolicyToPath])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LookupPolicyResponse' {Maybe [PolicyToPath]
policyToPathList :: Maybe [PolicyToPath]
$sel:policyToPathList:LookupPolicyResponse' :: LookupPolicyResponse -> Maybe [PolicyToPath]
policyToPathList} -> Maybe [PolicyToPath]
policyToPathList) (\s :: LookupPolicyResponse
s@LookupPolicyResponse' {} Maybe [PolicyToPath]
a -> LookupPolicyResponse
s {$sel:policyToPathList:LookupPolicyResponse' :: Maybe [PolicyToPath]
policyToPathList = Maybe [PolicyToPath]
a} :: LookupPolicyResponse) ((Maybe [PolicyToPath] -> f (Maybe [PolicyToPath]))
 -> LookupPolicyResponse -> f LookupPolicyResponse)
-> ((Maybe [PolicyToPath] -> f (Maybe [PolicyToPath]))
    -> Maybe [PolicyToPath] -> f (Maybe [PolicyToPath]))
-> (Maybe [PolicyToPath] -> f (Maybe [PolicyToPath]))
-> LookupPolicyResponse
-> f LookupPolicyResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [PolicyToPath] [PolicyToPath] [PolicyToPath] [PolicyToPath]
-> Iso
     (Maybe [PolicyToPath])
     (Maybe [PolicyToPath])
     (Maybe [PolicyToPath])
     (Maybe [PolicyToPath])
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 [PolicyToPath] [PolicyToPath] [PolicyToPath] [PolicyToPath]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance Prelude.NFData LookupPolicyResponse