{-# 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 #-}
module Amazonka.DirectoryService.Types.ShareTarget where
import qualified Amazonka.Core as Core
import Amazonka.DirectoryService.Types.TargetType
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data ShareTarget = ShareTarget'
{
ShareTarget -> Text
id :: Prelude.Text,
ShareTarget -> TargetType
type' :: TargetType
}
deriving (ShareTarget -> ShareTarget -> Bool
(ShareTarget -> ShareTarget -> Bool)
-> (ShareTarget -> ShareTarget -> Bool) -> Eq ShareTarget
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ShareTarget -> ShareTarget -> Bool
$c/= :: ShareTarget -> ShareTarget -> Bool
== :: ShareTarget -> ShareTarget -> Bool
$c== :: ShareTarget -> ShareTarget -> Bool
Prelude.Eq, ReadPrec [ShareTarget]
ReadPrec ShareTarget
Int -> ReadS ShareTarget
ReadS [ShareTarget]
(Int -> ReadS ShareTarget)
-> ReadS [ShareTarget]
-> ReadPrec ShareTarget
-> ReadPrec [ShareTarget]
-> Read ShareTarget
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ShareTarget]
$creadListPrec :: ReadPrec [ShareTarget]
readPrec :: ReadPrec ShareTarget
$creadPrec :: ReadPrec ShareTarget
readList :: ReadS [ShareTarget]
$creadList :: ReadS [ShareTarget]
readsPrec :: Int -> ReadS ShareTarget
$creadsPrec :: Int -> ReadS ShareTarget
Prelude.Read, Int -> ShareTarget -> ShowS
[ShareTarget] -> ShowS
ShareTarget -> String
(Int -> ShareTarget -> ShowS)
-> (ShareTarget -> String)
-> ([ShareTarget] -> ShowS)
-> Show ShareTarget
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ShareTarget] -> ShowS
$cshowList :: [ShareTarget] -> ShowS
show :: ShareTarget -> String
$cshow :: ShareTarget -> String
showsPrec :: Int -> ShareTarget -> ShowS
$cshowsPrec :: Int -> ShareTarget -> ShowS
Prelude.Show, (forall x. ShareTarget -> Rep ShareTarget x)
-> (forall x. Rep ShareTarget x -> ShareTarget)
-> Generic ShareTarget
forall x. Rep ShareTarget x -> ShareTarget
forall x. ShareTarget -> Rep ShareTarget x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ShareTarget x -> ShareTarget
$cfrom :: forall x. ShareTarget -> Rep ShareTarget x
Prelude.Generic)
newShareTarget ::
Prelude.Text ->
TargetType ->
ShareTarget
newShareTarget :: Text -> TargetType -> ShareTarget
newShareTarget Text
pId_ TargetType
pType_ =
ShareTarget' :: Text -> TargetType -> ShareTarget
ShareTarget' {$sel:id:ShareTarget' :: Text
id = Text
pId_, $sel:type':ShareTarget' :: TargetType
type' = TargetType
pType_}
shareTarget_id :: Lens.Lens' ShareTarget Prelude.Text
shareTarget_id :: (Text -> f Text) -> ShareTarget -> f ShareTarget
shareTarget_id = (ShareTarget -> Text)
-> (ShareTarget -> Text -> ShareTarget)
-> Lens ShareTarget ShareTarget Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ShareTarget' {Text
id :: Text
$sel:id:ShareTarget' :: ShareTarget -> Text
id} -> Text
id) (\s :: ShareTarget
s@ShareTarget' {} Text
a -> ShareTarget
s {$sel:id:ShareTarget' :: Text
id = Text
a} :: ShareTarget)
shareTarget_type :: Lens.Lens' ShareTarget TargetType
shareTarget_type :: (TargetType -> f TargetType) -> ShareTarget -> f ShareTarget
shareTarget_type = (ShareTarget -> TargetType)
-> (ShareTarget -> TargetType -> ShareTarget)
-> Lens ShareTarget ShareTarget TargetType TargetType
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ShareTarget' {TargetType
type' :: TargetType
$sel:type':ShareTarget' :: ShareTarget -> TargetType
type'} -> TargetType
type') (\s :: ShareTarget
s@ShareTarget' {} TargetType
a -> ShareTarget
s {$sel:type':ShareTarget' :: TargetType
type' = TargetType
a} :: ShareTarget)
instance Prelude.Hashable ShareTarget
instance Prelude.NFData ShareTarget
instance Core.ToJSON ShareTarget where
toJSON :: ShareTarget -> Value
toJSON ShareTarget' {Text
TargetType
type' :: TargetType
id :: Text
$sel:type':ShareTarget' :: ShareTarget -> TargetType
$sel:id:ShareTarget' :: ShareTarget -> Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Id" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
id),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Type" Text -> TargetType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= TargetType
type')
]
)