{-# 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.CodeBuild.Types.SourceAuth where
import Amazonka.CodeBuild.Types.SourceAuthType
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 SourceAuth = SourceAuth'
{
SourceAuth -> Maybe Text
resource :: Prelude.Maybe Prelude.Text,
SourceAuth -> SourceAuthType
type' :: SourceAuthType
}
deriving (SourceAuth -> SourceAuth -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SourceAuth -> SourceAuth -> Bool
$c/= :: SourceAuth -> SourceAuth -> Bool
== :: SourceAuth -> SourceAuth -> Bool
$c== :: SourceAuth -> SourceAuth -> Bool
Prelude.Eq, ReadPrec [SourceAuth]
ReadPrec SourceAuth
Int -> ReadS SourceAuth
ReadS [SourceAuth]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SourceAuth]
$creadListPrec :: ReadPrec [SourceAuth]
readPrec :: ReadPrec SourceAuth
$creadPrec :: ReadPrec SourceAuth
readList :: ReadS [SourceAuth]
$creadList :: ReadS [SourceAuth]
readsPrec :: Int -> ReadS SourceAuth
$creadsPrec :: Int -> ReadS SourceAuth
Prelude.Read, Int -> SourceAuth -> ShowS
[SourceAuth] -> ShowS
SourceAuth -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SourceAuth] -> ShowS
$cshowList :: [SourceAuth] -> ShowS
show :: SourceAuth -> String
$cshow :: SourceAuth -> String
showsPrec :: Int -> SourceAuth -> ShowS
$cshowsPrec :: Int -> SourceAuth -> ShowS
Prelude.Show, forall x. Rep SourceAuth x -> SourceAuth
forall x. SourceAuth -> Rep SourceAuth x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SourceAuth x -> SourceAuth
$cfrom :: forall x. SourceAuth -> Rep SourceAuth x
Prelude.Generic)
newSourceAuth ::
SourceAuthType ->
SourceAuth
newSourceAuth :: SourceAuthType -> SourceAuth
newSourceAuth SourceAuthType
pType_ =
SourceAuth'
{ $sel:resource:SourceAuth' :: Maybe Text
resource = forall a. Maybe a
Prelude.Nothing,
$sel:type':SourceAuth' :: SourceAuthType
type' = SourceAuthType
pType_
}
sourceAuth_resource :: Lens.Lens' SourceAuth (Prelude.Maybe Prelude.Text)
sourceAuth_resource :: Lens' SourceAuth (Maybe Text)
sourceAuth_resource = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SourceAuth' {Maybe Text
resource :: Maybe Text
$sel:resource:SourceAuth' :: SourceAuth -> Maybe Text
resource} -> Maybe Text
resource) (\s :: SourceAuth
s@SourceAuth' {} Maybe Text
a -> SourceAuth
s {$sel:resource:SourceAuth' :: Maybe Text
resource = Maybe Text
a} :: SourceAuth)
sourceAuth_type :: Lens.Lens' SourceAuth SourceAuthType
sourceAuth_type :: Lens' SourceAuth SourceAuthType
sourceAuth_type = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SourceAuth' {SourceAuthType
type' :: SourceAuthType
$sel:type':SourceAuth' :: SourceAuth -> SourceAuthType
type'} -> SourceAuthType
type') (\s :: SourceAuth
s@SourceAuth' {} SourceAuthType
a -> SourceAuth
s {$sel:type':SourceAuth' :: SourceAuthType
type' = SourceAuthType
a} :: SourceAuth)
instance Data.FromJSON SourceAuth where
parseJSON :: Value -> Parser SourceAuth
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"SourceAuth"
( \Object
x ->
Maybe Text -> SourceAuthType -> SourceAuth
SourceAuth'
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
"resource")
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
"type")
)
instance Prelude.Hashable SourceAuth where
hashWithSalt :: Int -> SourceAuth -> Int
hashWithSalt Int
_salt SourceAuth' {Maybe Text
SourceAuthType
type' :: SourceAuthType
resource :: Maybe Text
$sel:type':SourceAuth' :: SourceAuth -> SourceAuthType
$sel:resource:SourceAuth' :: SourceAuth -> Maybe Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
resource
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` SourceAuthType
type'
instance Prelude.NFData SourceAuth where
rnf :: SourceAuth -> ()
rnf SourceAuth' {Maybe Text
SourceAuthType
type' :: SourceAuthType
resource :: Maybe Text
$sel:type':SourceAuth' :: SourceAuth -> SourceAuthType
$sel:resource:SourceAuth' :: SourceAuth -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
resource
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf SourceAuthType
type'
instance Data.ToJSON SourceAuth where
toJSON :: SourceAuth -> Value
toJSON SourceAuth' {Maybe Text
SourceAuthType
type' :: SourceAuthType
resource :: Maybe Text
$sel:type':SourceAuth' :: SourceAuth -> SourceAuthType
$sel:resource:SourceAuth' :: SourceAuth -> Maybe Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"resource" 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 Text
resource,
forall a. a -> Maybe a
Prelude.Just (Key
"type" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= SourceAuthType
type')
]
)