{-# 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.ListObjectParents
-- 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 parent objects that are associated with a given object in
-- pagination fashion.
module Amazonka.CloudDirectory.ListObjectParents
  ( -- * Creating a Request
    ListObjectParents (..),
    newListObjectParents,

    -- * Request Lenses
    listObjectParents_consistencyLevel,
    listObjectParents_includeAllLinksToEachParent,
    listObjectParents_nextToken,
    listObjectParents_maxResults,
    listObjectParents_directoryArn,
    listObjectParents_objectReference,

    -- * Destructuring the Response
    ListObjectParentsResponse (..),
    newListObjectParentsResponse,

    -- * Response Lenses
    listObjectParentsResponse_nextToken,
    listObjectParentsResponse_parents,
    listObjectParentsResponse_parentLinks,
    listObjectParentsResponse_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:/ 'newListObjectParents' smart constructor.
data ListObjectParents = ListObjectParents'
  { -- | 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.
    ListObjectParents -> Maybe ConsistencyLevel
consistencyLevel :: Prelude.Maybe ConsistencyLevel,
    -- | When set to True, returns all ListObjectParentsResponse$ParentLinks.
    -- There could be multiple links between a parent-child pair.
    ListObjectParents -> Maybe Bool
includeAllLinksToEachParent :: Prelude.Maybe Prelude.Bool,
    -- | The pagination token.
    ListObjectParents -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of items to be retrieved in a single call. This is an
    -- approximate number.
    ListObjectParents -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | The Amazon Resource Name (ARN) that is associated with the Directory
    -- where the object resides. For more information, see arns.
    ListObjectParents -> Text
directoryArn :: Prelude.Text,
    -- | The reference that identifies the object for which parent objects are
    -- being listed.
    ListObjectParents -> ObjectReference
objectReference :: ObjectReference
  }
  deriving (ListObjectParents -> ListObjectParents -> Bool
(ListObjectParents -> ListObjectParents -> Bool)
-> (ListObjectParents -> ListObjectParents -> Bool)
-> Eq ListObjectParents
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListObjectParents -> ListObjectParents -> Bool
$c/= :: ListObjectParents -> ListObjectParents -> Bool
== :: ListObjectParents -> ListObjectParents -> Bool
$c== :: ListObjectParents -> ListObjectParents -> Bool
Prelude.Eq, ReadPrec [ListObjectParents]
ReadPrec ListObjectParents
Int -> ReadS ListObjectParents
ReadS [ListObjectParents]
(Int -> ReadS ListObjectParents)
-> ReadS [ListObjectParents]
-> ReadPrec ListObjectParents
-> ReadPrec [ListObjectParents]
-> Read ListObjectParents
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListObjectParents]
$creadListPrec :: ReadPrec [ListObjectParents]
readPrec :: ReadPrec ListObjectParents
$creadPrec :: ReadPrec ListObjectParents
readList :: ReadS [ListObjectParents]
$creadList :: ReadS [ListObjectParents]
readsPrec :: Int -> ReadS ListObjectParents
$creadsPrec :: Int -> ReadS ListObjectParents
Prelude.Read, Int -> ListObjectParents -> ShowS
[ListObjectParents] -> ShowS
ListObjectParents -> String
(Int -> ListObjectParents -> ShowS)
-> (ListObjectParents -> String)
-> ([ListObjectParents] -> ShowS)
-> Show ListObjectParents
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListObjectParents] -> ShowS
$cshowList :: [ListObjectParents] -> ShowS
show :: ListObjectParents -> String
$cshow :: ListObjectParents -> String
showsPrec :: Int -> ListObjectParents -> ShowS
$cshowsPrec :: Int -> ListObjectParents -> ShowS
Prelude.Show, (forall x. ListObjectParents -> Rep ListObjectParents x)
-> (forall x. Rep ListObjectParents x -> ListObjectParents)
-> Generic ListObjectParents
forall x. Rep ListObjectParents x -> ListObjectParents
forall x. ListObjectParents -> Rep ListObjectParents x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListObjectParents x -> ListObjectParents
$cfrom :: forall x. ListObjectParents -> Rep ListObjectParents x
Prelude.Generic)

-- |
-- Create a value of 'ListObjectParents' 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', 'listObjectParents_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.
--
-- 'includeAllLinksToEachParent', 'listObjectParents_includeAllLinksToEachParent' - When set to True, returns all ListObjectParentsResponse$ParentLinks.
-- There could be multiple links between a parent-child pair.
--
-- 'nextToken', 'listObjectParents_nextToken' - The pagination token.
--
-- 'maxResults', 'listObjectParents_maxResults' - The maximum number of items to be retrieved in a single call. This is an
-- approximate number.
--
-- 'directoryArn', 'listObjectParents_directoryArn' - The Amazon Resource Name (ARN) that is associated with the Directory
-- where the object resides. For more information, see arns.
--
-- 'objectReference', 'listObjectParents_objectReference' - The reference that identifies the object for which parent objects are
-- being listed.
newListObjectParents ::
  -- | 'directoryArn'
  Prelude.Text ->
  -- | 'objectReference'
  ObjectReference ->
  ListObjectParents
newListObjectParents :: Text -> ObjectReference -> ListObjectParents
newListObjectParents Text
pDirectoryArn_ ObjectReference
pObjectReference_ =
  ListObjectParents' :: Maybe ConsistencyLevel
-> Maybe Bool
-> Maybe Text
-> Maybe Natural
-> Text
-> ObjectReference
-> ListObjectParents
ListObjectParents'
    { $sel:consistencyLevel:ListObjectParents' :: Maybe ConsistencyLevel
consistencyLevel =
        Maybe ConsistencyLevel
forall a. Maybe a
Prelude.Nothing,
      $sel:includeAllLinksToEachParent:ListObjectParents' :: Maybe Bool
includeAllLinksToEachParent = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListObjectParents' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:ListObjectParents' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:directoryArn:ListObjectParents' :: Text
directoryArn = Text
pDirectoryArn_,
      $sel:objectReference:ListObjectParents' :: ObjectReference
objectReference = ObjectReference
pObjectReference_
    }

-- | 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.
listObjectParents_consistencyLevel :: Lens.Lens' ListObjectParents (Prelude.Maybe ConsistencyLevel)
listObjectParents_consistencyLevel :: (Maybe ConsistencyLevel -> f (Maybe ConsistencyLevel))
-> ListObjectParents -> f ListObjectParents
listObjectParents_consistencyLevel = (ListObjectParents -> Maybe ConsistencyLevel)
-> (ListObjectParents
    -> Maybe ConsistencyLevel -> ListObjectParents)
-> Lens
     ListObjectParents
     ListObjectParents
     (Maybe ConsistencyLevel)
     (Maybe ConsistencyLevel)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListObjectParents' {Maybe ConsistencyLevel
consistencyLevel :: Maybe ConsistencyLevel
$sel:consistencyLevel:ListObjectParents' :: ListObjectParents -> Maybe ConsistencyLevel
consistencyLevel} -> Maybe ConsistencyLevel
consistencyLevel) (\s :: ListObjectParents
s@ListObjectParents' {} Maybe ConsistencyLevel
a -> ListObjectParents
s {$sel:consistencyLevel:ListObjectParents' :: Maybe ConsistencyLevel
consistencyLevel = Maybe ConsistencyLevel
a} :: ListObjectParents)

-- | When set to True, returns all ListObjectParentsResponse$ParentLinks.
-- There could be multiple links between a parent-child pair.
listObjectParents_includeAllLinksToEachParent :: Lens.Lens' ListObjectParents (Prelude.Maybe Prelude.Bool)
listObjectParents_includeAllLinksToEachParent :: (Maybe Bool -> f (Maybe Bool))
-> ListObjectParents -> f ListObjectParents
listObjectParents_includeAllLinksToEachParent = (ListObjectParents -> Maybe Bool)
-> (ListObjectParents -> Maybe Bool -> ListObjectParents)
-> Lens
     ListObjectParents ListObjectParents (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListObjectParents' {Maybe Bool
includeAllLinksToEachParent :: Maybe Bool
$sel:includeAllLinksToEachParent:ListObjectParents' :: ListObjectParents -> Maybe Bool
includeAllLinksToEachParent} -> Maybe Bool
includeAllLinksToEachParent) (\s :: ListObjectParents
s@ListObjectParents' {} Maybe Bool
a -> ListObjectParents
s {$sel:includeAllLinksToEachParent:ListObjectParents' :: Maybe Bool
includeAllLinksToEachParent = Maybe Bool
a} :: ListObjectParents)

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

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

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

-- | The reference that identifies the object for which parent objects are
-- being listed.
listObjectParents_objectReference :: Lens.Lens' ListObjectParents ObjectReference
listObjectParents_objectReference :: (ObjectReference -> f ObjectReference)
-> ListObjectParents -> f ListObjectParents
listObjectParents_objectReference = (ListObjectParents -> ObjectReference)
-> (ListObjectParents -> ObjectReference -> ListObjectParents)
-> Lens
     ListObjectParents ListObjectParents ObjectReference ObjectReference
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListObjectParents' {ObjectReference
objectReference :: ObjectReference
$sel:objectReference:ListObjectParents' :: ListObjectParents -> ObjectReference
objectReference} -> ObjectReference
objectReference) (\s :: ListObjectParents
s@ListObjectParents' {} ObjectReference
a -> ListObjectParents
s {$sel:objectReference:ListObjectParents' :: ObjectReference
objectReference = ObjectReference
a} :: ListObjectParents)

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

instance Prelude.NFData ListObjectParents

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

instance Core.ToJSON ListObjectParents where
  toJSON :: ListObjectParents -> Value
toJSON ListObjectParents' {Maybe Bool
Maybe Natural
Maybe Text
Maybe ConsistencyLevel
Text
ObjectReference
objectReference :: ObjectReference
directoryArn :: Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
includeAllLinksToEachParent :: Maybe Bool
consistencyLevel :: Maybe ConsistencyLevel
$sel:objectReference:ListObjectParents' :: ListObjectParents -> ObjectReference
$sel:directoryArn:ListObjectParents' :: ListObjectParents -> Text
$sel:maxResults:ListObjectParents' :: ListObjectParents -> Maybe Natural
$sel:nextToken:ListObjectParents' :: ListObjectParents -> Maybe Text
$sel:includeAllLinksToEachParent:ListObjectParents' :: ListObjectParents -> Maybe Bool
$sel:consistencyLevel:ListObjectParents' :: ListObjectParents -> Maybe ConsistencyLevel
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"IncludeAllLinksToEachParent" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
includeAllLinksToEachParent,
            (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 ListObjectParents where
  toPath :: ListObjectParents -> ByteString
toPath =
    ByteString -> ListObjectParents -> ByteString
forall a b. a -> b -> a
Prelude.const
      ByteString
"/amazonclouddirectory/2017-01-11/object/parent"

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

-- | /See:/ 'newListObjectParentsResponse' smart constructor.
data ListObjectParentsResponse = ListObjectParentsResponse'
  { -- | The pagination token.
    ListObjectParentsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The parent structure, which is a map with key as the @ObjectIdentifier@
    -- and LinkName as the value.
    ListObjectParentsResponse -> Maybe (HashMap Text Text)
parents :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | Returns a list of parent reference and LinkName Tuples.
    ListObjectParentsResponse
-> Maybe [ObjectIdentifierAndLinkNameTuple]
parentLinks :: Prelude.Maybe [ObjectIdentifierAndLinkNameTuple],
    -- | The response's http status code.
    ListObjectParentsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ListObjectParentsResponse -> ListObjectParentsResponse -> Bool
(ListObjectParentsResponse -> ListObjectParentsResponse -> Bool)
-> (ListObjectParentsResponse -> ListObjectParentsResponse -> Bool)
-> Eq ListObjectParentsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListObjectParentsResponse -> ListObjectParentsResponse -> Bool
$c/= :: ListObjectParentsResponse -> ListObjectParentsResponse -> Bool
== :: ListObjectParentsResponse -> ListObjectParentsResponse -> Bool
$c== :: ListObjectParentsResponse -> ListObjectParentsResponse -> Bool
Prelude.Eq, ReadPrec [ListObjectParentsResponse]
ReadPrec ListObjectParentsResponse
Int -> ReadS ListObjectParentsResponse
ReadS [ListObjectParentsResponse]
(Int -> ReadS ListObjectParentsResponse)
-> ReadS [ListObjectParentsResponse]
-> ReadPrec ListObjectParentsResponse
-> ReadPrec [ListObjectParentsResponse]
-> Read ListObjectParentsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListObjectParentsResponse]
$creadListPrec :: ReadPrec [ListObjectParentsResponse]
readPrec :: ReadPrec ListObjectParentsResponse
$creadPrec :: ReadPrec ListObjectParentsResponse
readList :: ReadS [ListObjectParentsResponse]
$creadList :: ReadS [ListObjectParentsResponse]
readsPrec :: Int -> ReadS ListObjectParentsResponse
$creadsPrec :: Int -> ReadS ListObjectParentsResponse
Prelude.Read, Int -> ListObjectParentsResponse -> ShowS
[ListObjectParentsResponse] -> ShowS
ListObjectParentsResponse -> String
(Int -> ListObjectParentsResponse -> ShowS)
-> (ListObjectParentsResponse -> String)
-> ([ListObjectParentsResponse] -> ShowS)
-> Show ListObjectParentsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListObjectParentsResponse] -> ShowS
$cshowList :: [ListObjectParentsResponse] -> ShowS
show :: ListObjectParentsResponse -> String
$cshow :: ListObjectParentsResponse -> String
showsPrec :: Int -> ListObjectParentsResponse -> ShowS
$cshowsPrec :: Int -> ListObjectParentsResponse -> ShowS
Prelude.Show, (forall x.
 ListObjectParentsResponse -> Rep ListObjectParentsResponse x)
-> (forall x.
    Rep ListObjectParentsResponse x -> ListObjectParentsResponse)
-> Generic ListObjectParentsResponse
forall x.
Rep ListObjectParentsResponse x -> ListObjectParentsResponse
forall x.
ListObjectParentsResponse -> Rep ListObjectParentsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListObjectParentsResponse x -> ListObjectParentsResponse
$cfrom :: forall x.
ListObjectParentsResponse -> Rep ListObjectParentsResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListObjectParentsResponse' 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', 'listObjectParentsResponse_nextToken' - The pagination token.
--
-- 'parents', 'listObjectParentsResponse_parents' - The parent structure, which is a map with key as the @ObjectIdentifier@
-- and LinkName as the value.
--
-- 'parentLinks', 'listObjectParentsResponse_parentLinks' - Returns a list of parent reference and LinkName Tuples.
--
-- 'httpStatus', 'listObjectParentsResponse_httpStatus' - The response's http status code.
newListObjectParentsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListObjectParentsResponse
newListObjectParentsResponse :: Int -> ListObjectParentsResponse
newListObjectParentsResponse Int
pHttpStatus_ =
  ListObjectParentsResponse' :: Maybe Text
-> Maybe (HashMap Text Text)
-> Maybe [ObjectIdentifierAndLinkNameTuple]
-> Int
-> ListObjectParentsResponse
ListObjectParentsResponse'
    { $sel:nextToken:ListObjectParentsResponse' :: Maybe Text
nextToken =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:parents:ListObjectParentsResponse' :: Maybe (HashMap Text Text)
parents = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing,
      $sel:parentLinks:ListObjectParentsResponse' :: Maybe [ObjectIdentifierAndLinkNameTuple]
parentLinks = Maybe [ObjectIdentifierAndLinkNameTuple]
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListObjectParentsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

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

-- | The parent structure, which is a map with key as the @ObjectIdentifier@
-- and LinkName as the value.
listObjectParentsResponse_parents :: Lens.Lens' ListObjectParentsResponse (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
listObjectParentsResponse_parents :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> ListObjectParentsResponse -> f ListObjectParentsResponse
listObjectParentsResponse_parents = (ListObjectParentsResponse -> Maybe (HashMap Text Text))
-> (ListObjectParentsResponse
    -> Maybe (HashMap Text Text) -> ListObjectParentsResponse)
-> Lens
     ListObjectParentsResponse
     ListObjectParentsResponse
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListObjectParentsResponse' {Maybe (HashMap Text Text)
parents :: Maybe (HashMap Text Text)
$sel:parents:ListObjectParentsResponse' :: ListObjectParentsResponse -> Maybe (HashMap Text Text)
parents} -> Maybe (HashMap Text Text)
parents) (\s :: ListObjectParentsResponse
s@ListObjectParentsResponse' {} Maybe (HashMap Text Text)
a -> ListObjectParentsResponse
s {$sel:parents:ListObjectParentsResponse' :: Maybe (HashMap Text Text)
parents = Maybe (HashMap Text Text)
a} :: ListObjectParentsResponse) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
 -> ListObjectParentsResponse -> f ListObjectParentsResponse)
-> ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
    -> Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> ListObjectParentsResponse
-> f ListObjectParentsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
-> Iso
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text 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
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Returns a list of parent reference and LinkName Tuples.
listObjectParentsResponse_parentLinks :: Lens.Lens' ListObjectParentsResponse (Prelude.Maybe [ObjectIdentifierAndLinkNameTuple])
listObjectParentsResponse_parentLinks :: (Maybe [ObjectIdentifierAndLinkNameTuple]
 -> f (Maybe [ObjectIdentifierAndLinkNameTuple]))
-> ListObjectParentsResponse -> f ListObjectParentsResponse
listObjectParentsResponse_parentLinks = (ListObjectParentsResponse
 -> Maybe [ObjectIdentifierAndLinkNameTuple])
-> (ListObjectParentsResponse
    -> Maybe [ObjectIdentifierAndLinkNameTuple]
    -> ListObjectParentsResponse)
-> Lens
     ListObjectParentsResponse
     ListObjectParentsResponse
     (Maybe [ObjectIdentifierAndLinkNameTuple])
     (Maybe [ObjectIdentifierAndLinkNameTuple])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListObjectParentsResponse' {Maybe [ObjectIdentifierAndLinkNameTuple]
parentLinks :: Maybe [ObjectIdentifierAndLinkNameTuple]
$sel:parentLinks:ListObjectParentsResponse' :: ListObjectParentsResponse
-> Maybe [ObjectIdentifierAndLinkNameTuple]
parentLinks} -> Maybe [ObjectIdentifierAndLinkNameTuple]
parentLinks) (\s :: ListObjectParentsResponse
s@ListObjectParentsResponse' {} Maybe [ObjectIdentifierAndLinkNameTuple]
a -> ListObjectParentsResponse
s {$sel:parentLinks:ListObjectParentsResponse' :: Maybe [ObjectIdentifierAndLinkNameTuple]
parentLinks = Maybe [ObjectIdentifierAndLinkNameTuple]
a} :: ListObjectParentsResponse) ((Maybe [ObjectIdentifierAndLinkNameTuple]
  -> f (Maybe [ObjectIdentifierAndLinkNameTuple]))
 -> ListObjectParentsResponse -> f ListObjectParentsResponse)
-> ((Maybe [ObjectIdentifierAndLinkNameTuple]
     -> f (Maybe [ObjectIdentifierAndLinkNameTuple]))
    -> Maybe [ObjectIdentifierAndLinkNameTuple]
    -> f (Maybe [ObjectIdentifierAndLinkNameTuple]))
-> (Maybe [ObjectIdentifierAndLinkNameTuple]
    -> f (Maybe [ObjectIdentifierAndLinkNameTuple]))
-> ListObjectParentsResponse
-> f ListObjectParentsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [ObjectIdentifierAndLinkNameTuple]
  [ObjectIdentifierAndLinkNameTuple]
  [ObjectIdentifierAndLinkNameTuple]
  [ObjectIdentifierAndLinkNameTuple]
-> Iso
     (Maybe [ObjectIdentifierAndLinkNameTuple])
     (Maybe [ObjectIdentifierAndLinkNameTuple])
     (Maybe [ObjectIdentifierAndLinkNameTuple])
     (Maybe [ObjectIdentifierAndLinkNameTuple])
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
  [ObjectIdentifierAndLinkNameTuple]
  [ObjectIdentifierAndLinkNameTuple]
  [ObjectIdentifierAndLinkNameTuple]
  [ObjectIdentifierAndLinkNameTuple]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance Prelude.NFData ListObjectParentsResponse