{-# 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.SSM.Types.PatchSource 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 PatchSource = PatchSource'
{
PatchSource -> Text
name :: Prelude.Text,
PatchSource -> NonEmpty Text
products :: Prelude.NonEmpty Prelude.Text,
PatchSource -> Sensitive Text
configuration :: Data.Sensitive Prelude.Text
}
deriving (PatchSource -> PatchSource -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PatchSource -> PatchSource -> Bool
$c/= :: PatchSource -> PatchSource -> Bool
== :: PatchSource -> PatchSource -> Bool
$c== :: PatchSource -> PatchSource -> Bool
Prelude.Eq, Int -> PatchSource -> ShowS
[PatchSource] -> ShowS
PatchSource -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PatchSource] -> ShowS
$cshowList :: [PatchSource] -> ShowS
show :: PatchSource -> String
$cshow :: PatchSource -> String
showsPrec :: Int -> PatchSource -> ShowS
$cshowsPrec :: Int -> PatchSource -> ShowS
Prelude.Show, forall x. Rep PatchSource x -> PatchSource
forall x. PatchSource -> Rep PatchSource x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PatchSource x -> PatchSource
$cfrom :: forall x. PatchSource -> Rep PatchSource x
Prelude.Generic)
newPatchSource ::
Prelude.Text ->
Prelude.NonEmpty Prelude.Text ->
Prelude.Text ->
PatchSource
newPatchSource :: Text -> NonEmpty Text -> Text -> PatchSource
newPatchSource Text
pName_ NonEmpty Text
pProducts_ Text
pConfiguration_ =
PatchSource'
{ $sel:name:PatchSource' :: Text
name = Text
pName_,
$sel:products:PatchSource' :: NonEmpty Text
products = forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced forall t b. AReview t b -> b -> t
Lens.# NonEmpty Text
pProducts_,
$sel:configuration:PatchSource' :: Sensitive Text
configuration =
forall a. Iso' (Sensitive a) a
Data._Sensitive forall t b. AReview t b -> b -> t
Lens.# Text
pConfiguration_
}
patchSource_name :: Lens.Lens' PatchSource Prelude.Text
patchSource_name :: Lens' PatchSource Text
patchSource_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PatchSource' {Text
name :: Text
$sel:name:PatchSource' :: PatchSource -> Text
name} -> Text
name) (\s :: PatchSource
s@PatchSource' {} Text
a -> PatchSource
s {$sel:name:PatchSource' :: Text
name = Text
a} :: PatchSource)
patchSource_products :: Lens.Lens' PatchSource (Prelude.NonEmpty Prelude.Text)
patchSource_products :: Lens' PatchSource (NonEmpty Text)
patchSource_products = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PatchSource' {NonEmpty Text
products :: NonEmpty Text
$sel:products:PatchSource' :: PatchSource -> NonEmpty Text
products} -> NonEmpty Text
products) (\s :: PatchSource
s@PatchSource' {} NonEmpty Text
a -> PatchSource
s {$sel:products:PatchSource' :: NonEmpty Text
products = NonEmpty Text
a} :: PatchSource) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
patchSource_configuration :: Lens.Lens' PatchSource Prelude.Text
patchSource_configuration :: Lens' PatchSource Text
patchSource_configuration = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PatchSource' {Sensitive Text
configuration :: Sensitive Text
$sel:configuration:PatchSource' :: PatchSource -> Sensitive Text
configuration} -> Sensitive Text
configuration) (\s :: PatchSource
s@PatchSource' {} Sensitive Text
a -> PatchSource
s {$sel:configuration:PatchSource' :: Sensitive Text
configuration = Sensitive Text
a} :: PatchSource) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a. Iso' (Sensitive a) a
Data._Sensitive
instance Data.FromJSON PatchSource where
parseJSON :: Value -> Parser PatchSource
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"PatchSource"
( \Object
x ->
Text -> NonEmpty Text -> Sensitive Text -> PatchSource
PatchSource'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"Name")
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
"Products")
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
"Configuration")
)
instance Prelude.Hashable PatchSource where
hashWithSalt :: Int -> PatchSource -> Int
hashWithSalt Int
_salt PatchSource' {NonEmpty Text
Text
Sensitive Text
configuration :: Sensitive Text
products :: NonEmpty Text
name :: Text
$sel:configuration:PatchSource' :: PatchSource -> Sensitive Text
$sel:products:PatchSource' :: PatchSource -> NonEmpty Text
$sel:name:PatchSource' :: PatchSource -> Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
name
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` NonEmpty Text
products
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Sensitive Text
configuration
instance Prelude.NFData PatchSource where
rnf :: PatchSource -> ()
rnf PatchSource' {NonEmpty Text
Text
Sensitive Text
configuration :: Sensitive Text
products :: NonEmpty Text
name :: Text
$sel:configuration:PatchSource' :: PatchSource -> Sensitive Text
$sel:products:PatchSource' :: PatchSource -> NonEmpty Text
$sel:name:PatchSource' :: PatchSource -> Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Text
name
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf NonEmpty Text
products
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Sensitive Text
configuration
instance Data.ToJSON PatchSource where
toJSON :: PatchSource -> Value
toJSON PatchSource' {NonEmpty Text
Text
Sensitive Text
configuration :: Sensitive Text
products :: NonEmpty Text
name :: Text
$sel:configuration:PatchSource' :: PatchSource -> Sensitive Text
$sel:products:PatchSource' :: PatchSource -> NonEmpty Text
$sel:name:PatchSource' :: PatchSource -> Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ forall a. a -> Maybe a
Prelude.Just (Key
"Name" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
name),
forall a. a -> Maybe a
Prelude.Just (Key
"Products" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= NonEmpty Text
products),
forall a. a -> Maybe a
Prelude.Just
(Key
"Configuration" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Sensitive Text
configuration)
]
)