{-# 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.ListObjectParentPaths
-- 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)
--
-- Retrieves all available parent paths for any object type such as node,
-- leaf node, policy node, and index node objects. For more information
-- about objects, see
-- <https://docs.aws.amazon.com/clouddirectory/latest/developerguide/key_concepts_directorystructure.html Directory Structure>.
--
-- Use this API to evaluate all parents for an object. The call returns all
-- objects from the root of the directory up to the requested object. The
-- API returns the number of paths based on user-defined @MaxResults@, in
-- case there are multiple paths to the parent. The order of the paths and
-- nodes returned is consistent among multiple API calls unless the objects
-- are deleted or moved. Paths not leading to the directory root are
-- ignored from the target object.
--
-- This operation returns paginated results.
module Amazonka.CloudDirectory.ListObjectParentPaths
  ( -- * Creating a Request
    ListObjectParentPaths (..),
    newListObjectParentPaths,

    -- * Request Lenses
    listObjectParentPaths_nextToken,
    listObjectParentPaths_maxResults,
    listObjectParentPaths_directoryArn,
    listObjectParentPaths_objectReference,

    -- * Destructuring the Response
    ListObjectParentPathsResponse (..),
    newListObjectParentPathsResponse,

    -- * Response Lenses
    listObjectParentPathsResponse_pathToObjectIdentifiersList,
    listObjectParentPathsResponse_nextToken,
    listObjectParentPathsResponse_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:/ 'newListObjectParentPaths' smart constructor.
data ListObjectParentPaths = ListObjectParentPaths'
  { -- | The pagination token.
    ListObjectParentPaths -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of items to be retrieved in a single call. This is an
    -- approximate number.
    ListObjectParentPaths -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | The ARN of the directory to which the parent path applies.
    ListObjectParentPaths -> Text
directoryArn :: Prelude.Text,
    -- | The reference that identifies the object whose parent paths are listed.
    ListObjectParentPaths -> ObjectReference
objectReference :: ObjectReference
  }
  deriving (ListObjectParentPaths -> ListObjectParentPaths -> Bool
(ListObjectParentPaths -> ListObjectParentPaths -> Bool)
-> (ListObjectParentPaths -> ListObjectParentPaths -> Bool)
-> Eq ListObjectParentPaths
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListObjectParentPaths -> ListObjectParentPaths -> Bool
$c/= :: ListObjectParentPaths -> ListObjectParentPaths -> Bool
== :: ListObjectParentPaths -> ListObjectParentPaths -> Bool
$c== :: ListObjectParentPaths -> ListObjectParentPaths -> Bool
Prelude.Eq, ReadPrec [ListObjectParentPaths]
ReadPrec ListObjectParentPaths
Int -> ReadS ListObjectParentPaths
ReadS [ListObjectParentPaths]
(Int -> ReadS ListObjectParentPaths)
-> ReadS [ListObjectParentPaths]
-> ReadPrec ListObjectParentPaths
-> ReadPrec [ListObjectParentPaths]
-> Read ListObjectParentPaths
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListObjectParentPaths]
$creadListPrec :: ReadPrec [ListObjectParentPaths]
readPrec :: ReadPrec ListObjectParentPaths
$creadPrec :: ReadPrec ListObjectParentPaths
readList :: ReadS [ListObjectParentPaths]
$creadList :: ReadS [ListObjectParentPaths]
readsPrec :: Int -> ReadS ListObjectParentPaths
$creadsPrec :: Int -> ReadS ListObjectParentPaths
Prelude.Read, Int -> ListObjectParentPaths -> ShowS
[ListObjectParentPaths] -> ShowS
ListObjectParentPaths -> String
(Int -> ListObjectParentPaths -> ShowS)
-> (ListObjectParentPaths -> String)
-> ([ListObjectParentPaths] -> ShowS)
-> Show ListObjectParentPaths
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListObjectParentPaths] -> ShowS
$cshowList :: [ListObjectParentPaths] -> ShowS
show :: ListObjectParentPaths -> String
$cshow :: ListObjectParentPaths -> String
showsPrec :: Int -> ListObjectParentPaths -> ShowS
$cshowsPrec :: Int -> ListObjectParentPaths -> ShowS
Prelude.Show, (forall x. ListObjectParentPaths -> Rep ListObjectParentPaths x)
-> (forall x. Rep ListObjectParentPaths x -> ListObjectParentPaths)
-> Generic ListObjectParentPaths
forall x. Rep ListObjectParentPaths x -> ListObjectParentPaths
forall x. ListObjectParentPaths -> Rep ListObjectParentPaths x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListObjectParentPaths x -> ListObjectParentPaths
$cfrom :: forall x. ListObjectParentPaths -> Rep ListObjectParentPaths x
Prelude.Generic)

-- |
-- Create a value of 'ListObjectParentPaths' 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', 'listObjectParentPaths_nextToken' - The pagination token.
--
-- 'maxResults', 'listObjectParentPaths_maxResults' - The maximum number of items to be retrieved in a single call. This is an
-- approximate number.
--
-- 'directoryArn', 'listObjectParentPaths_directoryArn' - The ARN of the directory to which the parent path applies.
--
-- 'objectReference', 'listObjectParentPaths_objectReference' - The reference that identifies the object whose parent paths are listed.
newListObjectParentPaths ::
  -- | 'directoryArn'
  Prelude.Text ->
  -- | 'objectReference'
  ObjectReference ->
  ListObjectParentPaths
newListObjectParentPaths :: Text -> ObjectReference -> ListObjectParentPaths
newListObjectParentPaths
  Text
pDirectoryArn_
  ObjectReference
pObjectReference_ =
    ListObjectParentPaths' :: Maybe Text
-> Maybe Natural
-> Text
-> ObjectReference
-> ListObjectParentPaths
ListObjectParentPaths'
      { $sel:nextToken:ListObjectParentPaths' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:maxResults:ListObjectParentPaths' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
        $sel:directoryArn:ListObjectParentPaths' :: Text
directoryArn = Text
pDirectoryArn_,
        $sel:objectReference:ListObjectParentPaths' :: ObjectReference
objectReference = ObjectReference
pObjectReference_
      }

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

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

-- | The ARN of the directory to which the parent path applies.
listObjectParentPaths_directoryArn :: Lens.Lens' ListObjectParentPaths Prelude.Text
listObjectParentPaths_directoryArn :: (Text -> f Text)
-> ListObjectParentPaths -> f ListObjectParentPaths
listObjectParentPaths_directoryArn = (ListObjectParentPaths -> Text)
-> (ListObjectParentPaths -> Text -> ListObjectParentPaths)
-> Lens ListObjectParentPaths ListObjectParentPaths Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListObjectParentPaths' {Text
directoryArn :: Text
$sel:directoryArn:ListObjectParentPaths' :: ListObjectParentPaths -> Text
directoryArn} -> Text
directoryArn) (\s :: ListObjectParentPaths
s@ListObjectParentPaths' {} Text
a -> ListObjectParentPaths
s {$sel:directoryArn:ListObjectParentPaths' :: Text
directoryArn = Text
a} :: ListObjectParentPaths)

-- | The reference that identifies the object whose parent paths are listed.
listObjectParentPaths_objectReference :: Lens.Lens' ListObjectParentPaths ObjectReference
listObjectParentPaths_objectReference :: (ObjectReference -> f ObjectReference)
-> ListObjectParentPaths -> f ListObjectParentPaths
listObjectParentPaths_objectReference = (ListObjectParentPaths -> ObjectReference)
-> (ListObjectParentPaths
    -> ObjectReference -> ListObjectParentPaths)
-> Lens
     ListObjectParentPaths
     ListObjectParentPaths
     ObjectReference
     ObjectReference
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListObjectParentPaths' {ObjectReference
objectReference :: ObjectReference
$sel:objectReference:ListObjectParentPaths' :: ListObjectParentPaths -> ObjectReference
objectReference} -> ObjectReference
objectReference) (\s :: ListObjectParentPaths
s@ListObjectParentPaths' {} ObjectReference
a -> ListObjectParentPaths
s {$sel:objectReference:ListObjectParentPaths' :: ObjectReference
objectReference = ObjectReference
a} :: ListObjectParentPaths)

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

instance Prelude.NFData ListObjectParentPaths

instance Core.ToHeaders ListObjectParentPaths where
  toHeaders :: ListObjectParentPaths -> ResponseHeaders
toHeaders ListObjectParentPaths' {Maybe Natural
Maybe Text
Text
ObjectReference
objectReference :: ObjectReference
directoryArn :: Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
$sel:objectReference:ListObjectParentPaths' :: ListObjectParentPaths -> ObjectReference
$sel:directoryArn:ListObjectParentPaths' :: ListObjectParentPaths -> Text
$sel:maxResults:ListObjectParentPaths' :: ListObjectParentPaths -> Maybe Natural
$sel:nextToken:ListObjectParentPaths' :: ListObjectParentPaths -> 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 ListObjectParentPaths where
  toJSON :: ListObjectParentPaths -> Value
toJSON ListObjectParentPaths' {Maybe Natural
Maybe Text
Text
ObjectReference
objectReference :: ObjectReference
directoryArn :: Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
$sel:objectReference:ListObjectParentPaths' :: ListObjectParentPaths -> ObjectReference
$sel:directoryArn:ListObjectParentPaths' :: ListObjectParentPaths -> Text
$sel:maxResults:ListObjectParentPaths' :: ListObjectParentPaths -> Maybe Natural
$sel:nextToken:ListObjectParentPaths' :: ListObjectParentPaths -> 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 ListObjectParentPaths where
  toPath :: ListObjectParentPaths -> ByteString
toPath =
    ByteString -> ListObjectParentPaths -> ByteString
forall a b. a -> b -> a
Prelude.const
      ByteString
"/amazonclouddirectory/2017-01-11/object/parentpaths"

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

-- | /See:/ 'newListObjectParentPathsResponse' smart constructor.
data ListObjectParentPathsResponse = ListObjectParentPathsResponse'
  { -- | Returns the path to the @ObjectIdentifiers@ that are associated with the
    -- directory.
    ListObjectParentPathsResponse -> Maybe [PathToObjectIdentifiers]
pathToObjectIdentifiersList :: Prelude.Maybe [PathToObjectIdentifiers],
    -- | The pagination token.
    ListObjectParentPathsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    ListObjectParentPathsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ListObjectParentPathsResponse
-> ListObjectParentPathsResponse -> Bool
(ListObjectParentPathsResponse
 -> ListObjectParentPathsResponse -> Bool)
-> (ListObjectParentPathsResponse
    -> ListObjectParentPathsResponse -> Bool)
-> Eq ListObjectParentPathsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListObjectParentPathsResponse
-> ListObjectParentPathsResponse -> Bool
$c/= :: ListObjectParentPathsResponse
-> ListObjectParentPathsResponse -> Bool
== :: ListObjectParentPathsResponse
-> ListObjectParentPathsResponse -> Bool
$c== :: ListObjectParentPathsResponse
-> ListObjectParentPathsResponse -> Bool
Prelude.Eq, ReadPrec [ListObjectParentPathsResponse]
ReadPrec ListObjectParentPathsResponse
Int -> ReadS ListObjectParentPathsResponse
ReadS [ListObjectParentPathsResponse]
(Int -> ReadS ListObjectParentPathsResponse)
-> ReadS [ListObjectParentPathsResponse]
-> ReadPrec ListObjectParentPathsResponse
-> ReadPrec [ListObjectParentPathsResponse]
-> Read ListObjectParentPathsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListObjectParentPathsResponse]
$creadListPrec :: ReadPrec [ListObjectParentPathsResponse]
readPrec :: ReadPrec ListObjectParentPathsResponse
$creadPrec :: ReadPrec ListObjectParentPathsResponse
readList :: ReadS [ListObjectParentPathsResponse]
$creadList :: ReadS [ListObjectParentPathsResponse]
readsPrec :: Int -> ReadS ListObjectParentPathsResponse
$creadsPrec :: Int -> ReadS ListObjectParentPathsResponse
Prelude.Read, Int -> ListObjectParentPathsResponse -> ShowS
[ListObjectParentPathsResponse] -> ShowS
ListObjectParentPathsResponse -> String
(Int -> ListObjectParentPathsResponse -> ShowS)
-> (ListObjectParentPathsResponse -> String)
-> ([ListObjectParentPathsResponse] -> ShowS)
-> Show ListObjectParentPathsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListObjectParentPathsResponse] -> ShowS
$cshowList :: [ListObjectParentPathsResponse] -> ShowS
show :: ListObjectParentPathsResponse -> String
$cshow :: ListObjectParentPathsResponse -> String
showsPrec :: Int -> ListObjectParentPathsResponse -> ShowS
$cshowsPrec :: Int -> ListObjectParentPathsResponse -> ShowS
Prelude.Show, (forall x.
 ListObjectParentPathsResponse
 -> Rep ListObjectParentPathsResponse x)
-> (forall x.
    Rep ListObjectParentPathsResponse x
    -> ListObjectParentPathsResponse)
-> Generic ListObjectParentPathsResponse
forall x.
Rep ListObjectParentPathsResponse x
-> ListObjectParentPathsResponse
forall x.
ListObjectParentPathsResponse
-> Rep ListObjectParentPathsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListObjectParentPathsResponse x
-> ListObjectParentPathsResponse
$cfrom :: forall x.
ListObjectParentPathsResponse
-> Rep ListObjectParentPathsResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListObjectParentPathsResponse' 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:
--
-- 'pathToObjectIdentifiersList', 'listObjectParentPathsResponse_pathToObjectIdentifiersList' - Returns the path to the @ObjectIdentifiers@ that are associated with the
-- directory.
--
-- 'nextToken', 'listObjectParentPathsResponse_nextToken' - The pagination token.
--
-- 'httpStatus', 'listObjectParentPathsResponse_httpStatus' - The response's http status code.
newListObjectParentPathsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListObjectParentPathsResponse
newListObjectParentPathsResponse :: Int -> ListObjectParentPathsResponse
newListObjectParentPathsResponse Int
pHttpStatus_ =
  ListObjectParentPathsResponse' :: Maybe [PathToObjectIdentifiers]
-> Maybe Text -> Int -> ListObjectParentPathsResponse
ListObjectParentPathsResponse'
    { $sel:pathToObjectIdentifiersList:ListObjectParentPathsResponse' :: Maybe [PathToObjectIdentifiers]
pathToObjectIdentifiersList =
        Maybe [PathToObjectIdentifiers]
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListObjectParentPathsResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListObjectParentPathsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | Returns the path to the @ObjectIdentifiers@ that are associated with the
-- directory.
listObjectParentPathsResponse_pathToObjectIdentifiersList :: Lens.Lens' ListObjectParentPathsResponse (Prelude.Maybe [PathToObjectIdentifiers])
listObjectParentPathsResponse_pathToObjectIdentifiersList :: (Maybe [PathToObjectIdentifiers]
 -> f (Maybe [PathToObjectIdentifiers]))
-> ListObjectParentPathsResponse -> f ListObjectParentPathsResponse
listObjectParentPathsResponse_pathToObjectIdentifiersList = (ListObjectParentPathsResponse -> Maybe [PathToObjectIdentifiers])
-> (ListObjectParentPathsResponse
    -> Maybe [PathToObjectIdentifiers]
    -> ListObjectParentPathsResponse)
-> Lens'
     ListObjectParentPathsResponse (Maybe [PathToObjectIdentifiers])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListObjectParentPathsResponse' {Maybe [PathToObjectIdentifiers]
pathToObjectIdentifiersList :: Maybe [PathToObjectIdentifiers]
$sel:pathToObjectIdentifiersList:ListObjectParentPathsResponse' :: ListObjectParentPathsResponse -> Maybe [PathToObjectIdentifiers]
pathToObjectIdentifiersList} -> Maybe [PathToObjectIdentifiers]
pathToObjectIdentifiersList) (\s :: ListObjectParentPathsResponse
s@ListObjectParentPathsResponse' {} Maybe [PathToObjectIdentifiers]
a -> ListObjectParentPathsResponse
s {$sel:pathToObjectIdentifiersList:ListObjectParentPathsResponse' :: Maybe [PathToObjectIdentifiers]
pathToObjectIdentifiersList = Maybe [PathToObjectIdentifiers]
a} :: ListObjectParentPathsResponse) ((Maybe [PathToObjectIdentifiers]
  -> f (Maybe [PathToObjectIdentifiers]))
 -> ListObjectParentPathsResponse
 -> f ListObjectParentPathsResponse)
-> ((Maybe [PathToObjectIdentifiers]
     -> f (Maybe [PathToObjectIdentifiers]))
    -> Maybe [PathToObjectIdentifiers]
    -> f (Maybe [PathToObjectIdentifiers]))
-> (Maybe [PathToObjectIdentifiers]
    -> f (Maybe [PathToObjectIdentifiers]))
-> ListObjectParentPathsResponse
-> f ListObjectParentPathsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [PathToObjectIdentifiers]
  [PathToObjectIdentifiers]
  [PathToObjectIdentifiers]
  [PathToObjectIdentifiers]
-> Iso
     (Maybe [PathToObjectIdentifiers])
     (Maybe [PathToObjectIdentifiers])
     (Maybe [PathToObjectIdentifiers])
     (Maybe [PathToObjectIdentifiers])
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
  [PathToObjectIdentifiers]
  [PathToObjectIdentifiers]
  [PathToObjectIdentifiers]
  [PathToObjectIdentifiers]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

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

instance Prelude.NFData ListObjectParentPathsResponse