{-# 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.OpsWorks.Types.Source where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.OpsWorks.Types.SourceType
import qualified Amazonka.Prelude as Prelude
data Source = Source'
{
Source -> Maybe Text
url :: Prelude.Maybe Prelude.Text,
Source -> Maybe Text
username :: Prelude.Maybe Prelude.Text,
Source -> Maybe Text
sshKey :: Prelude.Maybe Prelude.Text,
Source -> Maybe Text
password :: Prelude.Maybe Prelude.Text,
Source -> Maybe SourceType
type' :: Prelude.Maybe SourceType,
Source -> Maybe Text
revision :: Prelude.Maybe Prelude.Text
}
deriving (Source -> Source -> Bool
(Source -> Source -> Bool)
-> (Source -> Source -> Bool) -> Eq Source
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Source -> Source -> Bool
$c/= :: Source -> Source -> Bool
== :: Source -> Source -> Bool
$c== :: Source -> Source -> Bool
Prelude.Eq, ReadPrec [Source]
ReadPrec Source
Int -> ReadS Source
ReadS [Source]
(Int -> ReadS Source)
-> ReadS [Source]
-> ReadPrec Source
-> ReadPrec [Source]
-> Read Source
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Source]
$creadListPrec :: ReadPrec [Source]
readPrec :: ReadPrec Source
$creadPrec :: ReadPrec Source
readList :: ReadS [Source]
$creadList :: ReadS [Source]
readsPrec :: Int -> ReadS Source
$creadsPrec :: Int -> ReadS Source
Prelude.Read, Int -> Source -> ShowS
[Source] -> ShowS
Source -> String
(Int -> Source -> ShowS)
-> (Source -> String) -> ([Source] -> ShowS) -> Show Source
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Source] -> ShowS
$cshowList :: [Source] -> ShowS
show :: Source -> String
$cshow :: Source -> String
showsPrec :: Int -> Source -> ShowS
$cshowsPrec :: Int -> Source -> ShowS
Prelude.Show, (forall x. Source -> Rep Source x)
-> (forall x. Rep Source x -> Source) -> Generic Source
forall x. Rep Source x -> Source
forall x. Source -> Rep Source x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Source x -> Source
$cfrom :: forall x. Source -> Rep Source x
Prelude.Generic)
newSource ::
Source
newSource :: Source
newSource =
Source' :: Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe SourceType
-> Maybe Text
-> Source
Source'
{ $sel:url:Source' :: Maybe Text
url = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:username:Source' :: Maybe Text
username = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:sshKey:Source' :: Maybe Text
sshKey = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:password:Source' :: Maybe Text
password = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:type':Source' :: Maybe SourceType
type' = Maybe SourceType
forall a. Maybe a
Prelude.Nothing,
$sel:revision:Source' :: Maybe Text
revision = Maybe Text
forall a. Maybe a
Prelude.Nothing
}
source_url :: Lens.Lens' Source (Prelude.Maybe Prelude.Text)
source_url :: (Maybe Text -> f (Maybe Text)) -> Source -> f Source
source_url = (Source -> Maybe Text)
-> (Source -> Maybe Text -> Source)
-> Lens Source Source (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Source' {Maybe Text
url :: Maybe Text
$sel:url:Source' :: Source -> Maybe Text
url} -> Maybe Text
url) (\s :: Source
s@Source' {} Maybe Text
a -> Source
s {$sel:url:Source' :: Maybe Text
url = Maybe Text
a} :: Source)
source_username :: Lens.Lens' Source (Prelude.Maybe Prelude.Text)
source_username :: (Maybe Text -> f (Maybe Text)) -> Source -> f Source
source_username = (Source -> Maybe Text)
-> (Source -> Maybe Text -> Source)
-> Lens Source Source (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Source' {Maybe Text
username :: Maybe Text
$sel:username:Source' :: Source -> Maybe Text
username} -> Maybe Text
username) (\s :: Source
s@Source' {} Maybe Text
a -> Source
s {$sel:username:Source' :: Maybe Text
username = Maybe Text
a} :: Source)
source_sshKey :: Lens.Lens' Source (Prelude.Maybe Prelude.Text)
source_sshKey :: (Maybe Text -> f (Maybe Text)) -> Source -> f Source
source_sshKey = (Source -> Maybe Text)
-> (Source -> Maybe Text -> Source)
-> Lens Source Source (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Source' {Maybe Text
sshKey :: Maybe Text
$sel:sshKey:Source' :: Source -> Maybe Text
sshKey} -> Maybe Text
sshKey) (\s :: Source
s@Source' {} Maybe Text
a -> Source
s {$sel:sshKey:Source' :: Maybe Text
sshKey = Maybe Text
a} :: Source)
source_password :: Lens.Lens' Source (Prelude.Maybe Prelude.Text)
source_password :: (Maybe Text -> f (Maybe Text)) -> Source -> f Source
source_password = (Source -> Maybe Text)
-> (Source -> Maybe Text -> Source)
-> Lens Source Source (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Source' {Maybe Text
password :: Maybe Text
$sel:password:Source' :: Source -> Maybe Text
password} -> Maybe Text
password) (\s :: Source
s@Source' {} Maybe Text
a -> Source
s {$sel:password:Source' :: Maybe Text
password = Maybe Text
a} :: Source)
source_type :: Lens.Lens' Source (Prelude.Maybe SourceType)
source_type :: (Maybe SourceType -> f (Maybe SourceType)) -> Source -> f Source
source_type = (Source -> Maybe SourceType)
-> (Source -> Maybe SourceType -> Source)
-> Lens Source Source (Maybe SourceType) (Maybe SourceType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Source' {Maybe SourceType
type' :: Maybe SourceType
$sel:type':Source' :: Source -> Maybe SourceType
type'} -> Maybe SourceType
type') (\s :: Source
s@Source' {} Maybe SourceType
a -> Source
s {$sel:type':Source' :: Maybe SourceType
type' = Maybe SourceType
a} :: Source)
source_revision :: Lens.Lens' Source (Prelude.Maybe Prelude.Text)
source_revision :: (Maybe Text -> f (Maybe Text)) -> Source -> f Source
source_revision = (Source -> Maybe Text)
-> (Source -> Maybe Text -> Source)
-> Lens Source Source (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Source' {Maybe Text
revision :: Maybe Text
$sel:revision:Source' :: Source -> Maybe Text
revision} -> Maybe Text
revision) (\s :: Source
s@Source' {} Maybe Text
a -> Source
s {$sel:revision:Source' :: Maybe Text
revision = Maybe Text
a} :: Source)
instance Core.FromJSON Source where
parseJSON :: Value -> Parser Source
parseJSON =
String -> (Object -> Parser Source) -> Value -> Parser Source
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"Source"
( \Object
x ->
Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe SourceType
-> Maybe Text
-> Source
Source'
(Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe SourceType
-> Maybe Text
-> Source)
-> Parser (Maybe Text)
-> Parser
(Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe SourceType
-> Maybe Text
-> Source)
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
"Url")
Parser
(Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe SourceType
-> Maybe Text
-> Source)
-> Parser (Maybe Text)
-> Parser
(Maybe Text
-> Maybe Text -> Maybe SourceType -> Maybe Text -> Source)
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
"Username")
Parser
(Maybe Text
-> Maybe Text -> Maybe SourceType -> Maybe Text -> Source)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe SourceType -> Maybe Text -> Source)
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
"SshKey")
Parser (Maybe Text -> Maybe SourceType -> Maybe Text -> Source)
-> Parser (Maybe Text)
-> Parser (Maybe SourceType -> Maybe Text -> Source)
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
"Password")
Parser (Maybe SourceType -> Maybe Text -> Source)
-> Parser (Maybe SourceType) -> Parser (Maybe Text -> Source)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe SourceType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Type")
Parser (Maybe Text -> Source)
-> Parser (Maybe Text) -> Parser Source
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
"Revision")
)
instance Prelude.Hashable Source
instance Prelude.NFData Source
instance Core.ToJSON Source where
toJSON :: Source -> Value
toJSON Source' {Maybe Text
Maybe SourceType
revision :: Maybe Text
type' :: Maybe SourceType
password :: Maybe Text
sshKey :: Maybe Text
username :: Maybe Text
url :: Maybe Text
$sel:revision:Source' :: Source -> Maybe Text
$sel:type':Source' :: Source -> Maybe SourceType
$sel:password:Source' :: Source -> Maybe Text
$sel:sshKey:Source' :: Source -> Maybe Text
$sel:username:Source' :: Source -> Maybe Text
$sel:url:Source' :: Source -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"Url" 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
url,
(Text
"Username" 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
username,
(Text
"SshKey" 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
sshKey,
(Text
"Password" 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
password,
(Text
"Type" Text -> SourceType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (SourceType -> Pair) -> Maybe SourceType -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe SourceType
type',
(Text
"Revision" 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
revision
]
)