{-# 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.Greengrass.Types.Connector where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
data Connector = Connector'
{
Connector -> Maybe (HashMap Text Text)
parameters :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
Connector -> Text
connectorArn :: Prelude.Text,
Connector -> Text
id :: Prelude.Text
}
deriving (Connector -> Connector -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Connector -> Connector -> Bool
$c/= :: Connector -> Connector -> Bool
== :: Connector -> Connector -> Bool
$c== :: Connector -> Connector -> Bool
Prelude.Eq, ReadPrec [Connector]
ReadPrec Connector
Int -> ReadS Connector
ReadS [Connector]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Connector]
$creadListPrec :: ReadPrec [Connector]
readPrec :: ReadPrec Connector
$creadPrec :: ReadPrec Connector
readList :: ReadS [Connector]
$creadList :: ReadS [Connector]
readsPrec :: Int -> ReadS Connector
$creadsPrec :: Int -> ReadS Connector
Prelude.Read, Int -> Connector -> ShowS
[Connector] -> ShowS
Connector -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Connector] -> ShowS
$cshowList :: [Connector] -> ShowS
show :: Connector -> String
$cshow :: Connector -> String
showsPrec :: Int -> Connector -> ShowS
$cshowsPrec :: Int -> Connector -> ShowS
Prelude.Show, forall x. Rep Connector x -> Connector
forall x. Connector -> Rep Connector x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Connector x -> Connector
$cfrom :: forall x. Connector -> Rep Connector x
Prelude.Generic)
newConnector ::
Prelude.Text ->
Prelude.Text ->
Connector
newConnector :: Text -> Text -> Connector
newConnector Text
pConnectorArn_ Text
pId_ =
Connector'
{ $sel:parameters:Connector' :: Maybe (HashMap Text Text)
parameters = forall a. Maybe a
Prelude.Nothing,
$sel:connectorArn:Connector' :: Text
connectorArn = Text
pConnectorArn_,
$sel:id:Connector' :: Text
id = Text
pId_
}
connector_parameters :: Lens.Lens' Connector (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
connector_parameters :: Lens' Connector (Maybe (HashMap Text Text))
connector_parameters = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Connector' {Maybe (HashMap Text Text)
parameters :: Maybe (HashMap Text Text)
$sel:parameters:Connector' :: Connector -> Maybe (HashMap Text Text)
parameters} -> Maybe (HashMap Text Text)
parameters) (\s :: Connector
s@Connector' {} Maybe (HashMap Text Text)
a -> Connector
s {$sel:parameters:Connector' :: Maybe (HashMap Text Text)
parameters = Maybe (HashMap Text Text)
a} :: Connector) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
connector_connectorArn :: Lens.Lens' Connector Prelude.Text
connector_connectorArn :: Lens' Connector Text
connector_connectorArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Connector' {Text
connectorArn :: Text
$sel:connectorArn:Connector' :: Connector -> Text
connectorArn} -> Text
connectorArn) (\s :: Connector
s@Connector' {} Text
a -> Connector
s {$sel:connectorArn:Connector' :: Text
connectorArn = Text
a} :: Connector)
connector_id :: Lens.Lens' Connector Prelude.Text
connector_id :: Lens' Connector Text
connector_id = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Connector' {Text
id :: Text
$sel:id:Connector' :: Connector -> Text
id} -> Text
id) (\s :: Connector
s@Connector' {} Text
a -> Connector
s {$sel:id:Connector' :: Text
id = Text
a} :: Connector)
instance Data.FromJSON Connector where
parseJSON :: Value -> Parser Connector
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"Connector"
( \Object
x ->
Maybe (HashMap Text Text) -> Text -> Text -> Connector
Connector'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Parameters" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"ConnectorArn")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"Id")
)
instance Prelude.Hashable Connector where
hashWithSalt :: Int -> Connector -> Int
hashWithSalt Int
_salt Connector' {Maybe (HashMap Text Text)
Text
id :: Text
connectorArn :: Text
parameters :: Maybe (HashMap Text Text)
$sel:id:Connector' :: Connector -> Text
$sel:connectorArn:Connector' :: Connector -> Text
$sel:parameters:Connector' :: Connector -> Maybe (HashMap Text Text)
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (HashMap Text Text)
parameters
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
connectorArn
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
id
instance Prelude.NFData Connector where
rnf :: Connector -> ()
rnf Connector' {Maybe (HashMap Text Text)
Text
id :: Text
connectorArn :: Text
parameters :: Maybe (HashMap Text Text)
$sel:id:Connector' :: Connector -> Text
$sel:connectorArn:Connector' :: Connector -> Text
$sel:parameters:Connector' :: Connector -> Maybe (HashMap Text Text)
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe (HashMap Text Text)
parameters
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
connectorArn
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
id
instance Data.ToJSON Connector where
toJSON :: Connector -> Value
toJSON Connector' {Maybe (HashMap Text Text)
Text
id :: Text
connectorArn :: Text
parameters :: Maybe (HashMap Text Text)
$sel:id:Connector' :: Connector -> Text
$sel:connectorArn:Connector' :: Connector -> Text
$sel:parameters:Connector' :: Connector -> Maybe (HashMap Text Text)
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"Parameters" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text Text)
parameters,
forall a. a -> Maybe a
Prelude.Just (Key
"ConnectorArn" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
connectorArn),
forall a. a -> Maybe a
Prelude.Just (Key
"Id" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
id)
]
)