{-# 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.Config.Types.Relationship where
import Amazonka.Config.Types.ResourceType
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data Relationship = Relationship'
{
Relationship -> Maybe Text
resourceId :: Prelude.Maybe Prelude.Text,
Relationship -> Maybe ResourceType
resourceType :: Prelude.Maybe ResourceType,
Relationship -> Maybe Text
resourceName :: Prelude.Maybe Prelude.Text,
Relationship -> Maybe Text
relationshipName :: Prelude.Maybe Prelude.Text
}
deriving (Relationship -> Relationship -> Bool
(Relationship -> Relationship -> Bool)
-> (Relationship -> Relationship -> Bool) -> Eq Relationship
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Relationship -> Relationship -> Bool
$c/= :: Relationship -> Relationship -> Bool
== :: Relationship -> Relationship -> Bool
$c== :: Relationship -> Relationship -> Bool
Prelude.Eq, ReadPrec [Relationship]
ReadPrec Relationship
Int -> ReadS Relationship
ReadS [Relationship]
(Int -> ReadS Relationship)
-> ReadS [Relationship]
-> ReadPrec Relationship
-> ReadPrec [Relationship]
-> Read Relationship
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Relationship]
$creadListPrec :: ReadPrec [Relationship]
readPrec :: ReadPrec Relationship
$creadPrec :: ReadPrec Relationship
readList :: ReadS [Relationship]
$creadList :: ReadS [Relationship]
readsPrec :: Int -> ReadS Relationship
$creadsPrec :: Int -> ReadS Relationship
Prelude.Read, Int -> Relationship -> ShowS
[Relationship] -> ShowS
Relationship -> String
(Int -> Relationship -> ShowS)
-> (Relationship -> String)
-> ([Relationship] -> ShowS)
-> Show Relationship
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Relationship] -> ShowS
$cshowList :: [Relationship] -> ShowS
show :: Relationship -> String
$cshow :: Relationship -> String
showsPrec :: Int -> Relationship -> ShowS
$cshowsPrec :: Int -> Relationship -> ShowS
Prelude.Show, (forall x. Relationship -> Rep Relationship x)
-> (forall x. Rep Relationship x -> Relationship)
-> Generic Relationship
forall x. Rep Relationship x -> Relationship
forall x. Relationship -> Rep Relationship x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Relationship x -> Relationship
$cfrom :: forall x. Relationship -> Rep Relationship x
Prelude.Generic)
newRelationship ::
Relationship
newRelationship :: Relationship
newRelationship =
Relationship' :: Maybe Text
-> Maybe ResourceType -> Maybe Text -> Maybe Text -> Relationship
Relationship'
{ $sel:resourceId:Relationship' :: Maybe Text
resourceId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:resourceType:Relationship' :: Maybe ResourceType
resourceType = Maybe ResourceType
forall a. Maybe a
Prelude.Nothing,
$sel:resourceName:Relationship' :: Maybe Text
resourceName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:relationshipName:Relationship' :: Maybe Text
relationshipName = Maybe Text
forall a. Maybe a
Prelude.Nothing
}
relationship_resourceId :: Lens.Lens' Relationship (Prelude.Maybe Prelude.Text)
relationship_resourceId :: (Maybe Text -> f (Maybe Text)) -> Relationship -> f Relationship
relationship_resourceId = (Relationship -> Maybe Text)
-> (Relationship -> Maybe Text -> Relationship)
-> Lens Relationship Relationship (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Relationship' {Maybe Text
resourceId :: Maybe Text
$sel:resourceId:Relationship' :: Relationship -> Maybe Text
resourceId} -> Maybe Text
resourceId) (\s :: Relationship
s@Relationship' {} Maybe Text
a -> Relationship
s {$sel:resourceId:Relationship' :: Maybe Text
resourceId = Maybe Text
a} :: Relationship)
relationship_resourceType :: Lens.Lens' Relationship (Prelude.Maybe ResourceType)
relationship_resourceType :: (Maybe ResourceType -> f (Maybe ResourceType))
-> Relationship -> f Relationship
relationship_resourceType = (Relationship -> Maybe ResourceType)
-> (Relationship -> Maybe ResourceType -> Relationship)
-> Lens
Relationship Relationship (Maybe ResourceType) (Maybe ResourceType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Relationship' {Maybe ResourceType
resourceType :: Maybe ResourceType
$sel:resourceType:Relationship' :: Relationship -> Maybe ResourceType
resourceType} -> Maybe ResourceType
resourceType) (\s :: Relationship
s@Relationship' {} Maybe ResourceType
a -> Relationship
s {$sel:resourceType:Relationship' :: Maybe ResourceType
resourceType = Maybe ResourceType
a} :: Relationship)
relationship_resourceName :: Lens.Lens' Relationship (Prelude.Maybe Prelude.Text)
relationship_resourceName :: (Maybe Text -> f (Maybe Text)) -> Relationship -> f Relationship
relationship_resourceName = (Relationship -> Maybe Text)
-> (Relationship -> Maybe Text -> Relationship)
-> Lens Relationship Relationship (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Relationship' {Maybe Text
resourceName :: Maybe Text
$sel:resourceName:Relationship' :: Relationship -> Maybe Text
resourceName} -> Maybe Text
resourceName) (\s :: Relationship
s@Relationship' {} Maybe Text
a -> Relationship
s {$sel:resourceName:Relationship' :: Maybe Text
resourceName = Maybe Text
a} :: Relationship)
relationship_relationshipName :: Lens.Lens' Relationship (Prelude.Maybe Prelude.Text)
relationship_relationshipName :: (Maybe Text -> f (Maybe Text)) -> Relationship -> f Relationship
relationship_relationshipName = (Relationship -> Maybe Text)
-> (Relationship -> Maybe Text -> Relationship)
-> Lens Relationship Relationship (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Relationship' {Maybe Text
relationshipName :: Maybe Text
$sel:relationshipName:Relationship' :: Relationship -> Maybe Text
relationshipName} -> Maybe Text
relationshipName) (\s :: Relationship
s@Relationship' {} Maybe Text
a -> Relationship
s {$sel:relationshipName:Relationship' :: Maybe Text
relationshipName = Maybe Text
a} :: Relationship)
instance Core.FromJSON Relationship where
parseJSON :: Value -> Parser Relationship
parseJSON =
String
-> (Object -> Parser Relationship) -> Value -> Parser Relationship
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"Relationship"
( \Object
x ->
Maybe Text
-> Maybe ResourceType -> Maybe Text -> Maybe Text -> Relationship
Relationship'
(Maybe Text
-> Maybe ResourceType -> Maybe Text -> Maybe Text -> Relationship)
-> Parser (Maybe Text)
-> Parser
(Maybe ResourceType -> Maybe Text -> Maybe Text -> Relationship)
forall (f :: * -> *) a b. Functor 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
"resourceId")
Parser
(Maybe ResourceType -> Maybe Text -> Maybe Text -> Relationship)
-> Parser (Maybe ResourceType)
-> Parser (Maybe Text -> Maybe Text -> Relationship)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe ResourceType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"resourceType")
Parser (Maybe Text -> Maybe Text -> Relationship)
-> Parser (Maybe Text) -> Parser (Maybe Text -> Relationship)
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
"resourceName")
Parser (Maybe Text -> Relationship)
-> Parser (Maybe Text) -> Parser Relationship
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
"relationshipName")
)
instance Prelude.Hashable Relationship
instance Prelude.NFData Relationship