{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# 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.Types.PathToObjectIdentifiers
-- 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)
module Amazonka.CloudDirectory.Types.PathToObjectIdentifiers where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Returns the path to the @ObjectIdentifiers@ that is associated with the
-- directory.
--
-- /See:/ 'newPathToObjectIdentifiers' smart constructor.
data PathToObjectIdentifiers = PathToObjectIdentifiers'
  { -- | Lists @ObjectIdentifiers@ starting from directory root to the object in
    -- the request.
    PathToObjectIdentifiers -> Maybe [Text]
objectIdentifiers :: Prelude.Maybe [Prelude.Text],
    -- | The path that is used to identify the object starting from directory
    -- root.
    PathToObjectIdentifiers -> Maybe Text
path :: Prelude.Maybe Prelude.Text
  }
  deriving (PathToObjectIdentifiers -> PathToObjectIdentifiers -> Bool
(PathToObjectIdentifiers -> PathToObjectIdentifiers -> Bool)
-> (PathToObjectIdentifiers -> PathToObjectIdentifiers -> Bool)
-> Eq PathToObjectIdentifiers
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PathToObjectIdentifiers -> PathToObjectIdentifiers -> Bool
$c/= :: PathToObjectIdentifiers -> PathToObjectIdentifiers -> Bool
== :: PathToObjectIdentifiers -> PathToObjectIdentifiers -> Bool
$c== :: PathToObjectIdentifiers -> PathToObjectIdentifiers -> Bool
Prelude.Eq, ReadPrec [PathToObjectIdentifiers]
ReadPrec PathToObjectIdentifiers
Int -> ReadS PathToObjectIdentifiers
ReadS [PathToObjectIdentifiers]
(Int -> ReadS PathToObjectIdentifiers)
-> ReadS [PathToObjectIdentifiers]
-> ReadPrec PathToObjectIdentifiers
-> ReadPrec [PathToObjectIdentifiers]
-> Read PathToObjectIdentifiers
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PathToObjectIdentifiers]
$creadListPrec :: ReadPrec [PathToObjectIdentifiers]
readPrec :: ReadPrec PathToObjectIdentifiers
$creadPrec :: ReadPrec PathToObjectIdentifiers
readList :: ReadS [PathToObjectIdentifiers]
$creadList :: ReadS [PathToObjectIdentifiers]
readsPrec :: Int -> ReadS PathToObjectIdentifiers
$creadsPrec :: Int -> ReadS PathToObjectIdentifiers
Prelude.Read, Int -> PathToObjectIdentifiers -> ShowS
[PathToObjectIdentifiers] -> ShowS
PathToObjectIdentifiers -> String
(Int -> PathToObjectIdentifiers -> ShowS)
-> (PathToObjectIdentifiers -> String)
-> ([PathToObjectIdentifiers] -> ShowS)
-> Show PathToObjectIdentifiers
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PathToObjectIdentifiers] -> ShowS
$cshowList :: [PathToObjectIdentifiers] -> ShowS
show :: PathToObjectIdentifiers -> String
$cshow :: PathToObjectIdentifiers -> String
showsPrec :: Int -> PathToObjectIdentifiers -> ShowS
$cshowsPrec :: Int -> PathToObjectIdentifiers -> ShowS
Prelude.Show, (forall x.
 PathToObjectIdentifiers -> Rep PathToObjectIdentifiers x)
-> (forall x.
    Rep PathToObjectIdentifiers x -> PathToObjectIdentifiers)
-> Generic PathToObjectIdentifiers
forall x. Rep PathToObjectIdentifiers x -> PathToObjectIdentifiers
forall x. PathToObjectIdentifiers -> Rep PathToObjectIdentifiers x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PathToObjectIdentifiers x -> PathToObjectIdentifiers
$cfrom :: forall x. PathToObjectIdentifiers -> Rep PathToObjectIdentifiers x
Prelude.Generic)

-- |
-- Create a value of 'PathToObjectIdentifiers' 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:
--
-- 'objectIdentifiers', 'pathToObjectIdentifiers_objectIdentifiers' - Lists @ObjectIdentifiers@ starting from directory root to the object in
-- the request.
--
-- 'path', 'pathToObjectIdentifiers_path' - The path that is used to identify the object starting from directory
-- root.
newPathToObjectIdentifiers ::
  PathToObjectIdentifiers
newPathToObjectIdentifiers :: PathToObjectIdentifiers
newPathToObjectIdentifiers =
  PathToObjectIdentifiers' :: Maybe [Text] -> Maybe Text -> PathToObjectIdentifiers
PathToObjectIdentifiers'
    { $sel:objectIdentifiers:PathToObjectIdentifiers' :: Maybe [Text]
objectIdentifiers =
        Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:path:PathToObjectIdentifiers' :: Maybe Text
path = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | Lists @ObjectIdentifiers@ starting from directory root to the object in
-- the request.
pathToObjectIdentifiers_objectIdentifiers :: Lens.Lens' PathToObjectIdentifiers (Prelude.Maybe [Prelude.Text])
pathToObjectIdentifiers_objectIdentifiers :: (Maybe [Text] -> f (Maybe [Text]))
-> PathToObjectIdentifiers -> f PathToObjectIdentifiers
pathToObjectIdentifiers_objectIdentifiers = (PathToObjectIdentifiers -> Maybe [Text])
-> (PathToObjectIdentifiers
    -> Maybe [Text] -> PathToObjectIdentifiers)
-> Lens
     PathToObjectIdentifiers
     PathToObjectIdentifiers
     (Maybe [Text])
     (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PathToObjectIdentifiers' {Maybe [Text]
objectIdentifiers :: Maybe [Text]
$sel:objectIdentifiers:PathToObjectIdentifiers' :: PathToObjectIdentifiers -> Maybe [Text]
objectIdentifiers} -> Maybe [Text]
objectIdentifiers) (\s :: PathToObjectIdentifiers
s@PathToObjectIdentifiers' {} Maybe [Text]
a -> PathToObjectIdentifiers
s {$sel:objectIdentifiers:PathToObjectIdentifiers' :: Maybe [Text]
objectIdentifiers = Maybe [Text]
a} :: PathToObjectIdentifiers) ((Maybe [Text] -> f (Maybe [Text]))
 -> PathToObjectIdentifiers -> f PathToObjectIdentifiers)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> PathToObjectIdentifiers
-> f PathToObjectIdentifiers
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [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 [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The path that is used to identify the object starting from directory
-- root.
pathToObjectIdentifiers_path :: Lens.Lens' PathToObjectIdentifiers (Prelude.Maybe Prelude.Text)
pathToObjectIdentifiers_path :: (Maybe Text -> f (Maybe Text))
-> PathToObjectIdentifiers -> f PathToObjectIdentifiers
pathToObjectIdentifiers_path = (PathToObjectIdentifiers -> Maybe Text)
-> (PathToObjectIdentifiers
    -> Maybe Text -> PathToObjectIdentifiers)
-> Lens
     PathToObjectIdentifiers
     PathToObjectIdentifiers
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PathToObjectIdentifiers' {Maybe Text
path :: Maybe Text
$sel:path:PathToObjectIdentifiers' :: PathToObjectIdentifiers -> Maybe Text
path} -> Maybe Text
path) (\s :: PathToObjectIdentifiers
s@PathToObjectIdentifiers' {} Maybe Text
a -> PathToObjectIdentifiers
s {$sel:path:PathToObjectIdentifiers' :: Maybe Text
path = Maybe Text
a} :: PathToObjectIdentifiers)

instance Core.FromJSON PathToObjectIdentifiers where
  parseJSON :: Value -> Parser PathToObjectIdentifiers
parseJSON =
    String
-> (Object -> Parser PathToObjectIdentifiers)
-> Value
-> Parser PathToObjectIdentifiers
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"PathToObjectIdentifiers"
      ( \Object
x ->
          Maybe [Text] -> Maybe Text -> PathToObjectIdentifiers
PathToObjectIdentifiers'
            (Maybe [Text] -> Maybe Text -> PathToObjectIdentifiers)
-> Parser (Maybe [Text])
-> Parser (Maybe Text -> PathToObjectIdentifiers)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( Object
x Object -> Text -> Parser (Maybe (Maybe [Text]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ObjectIdentifiers"
                            Parser (Maybe (Maybe [Text]))
-> Maybe [Text] -> Parser (Maybe [Text])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [Text]
forall a. Monoid a => a
Prelude.mempty
                        )
            Parser (Maybe Text -> PathToObjectIdentifiers)
-> Parser (Maybe Text) -> Parser PathToObjectIdentifiers
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Path")
      )

instance Prelude.Hashable PathToObjectIdentifiers

instance Prelude.NFData PathToObjectIdentifiers