{-# 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.Lens as Lens
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 :: Core.Sensitive Prelude.Text
}
deriving (PatchSource -> PatchSource -> Bool
(PatchSource -> PatchSource -> Bool)
-> (PatchSource -> PatchSource -> Bool) -> Eq PatchSource
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
(Int -> PatchSource -> ShowS)
-> (PatchSource -> String)
-> ([PatchSource] -> ShowS)
-> Show PatchSource
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. PatchSource -> Rep PatchSource x)
-> (forall x. Rep PatchSource x -> PatchSource)
-> Generic PatchSource
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' :: Text -> NonEmpty Text -> Sensitive Text -> PatchSource
PatchSource'
{ $sel:name:PatchSource' :: Text
name = Text
pName_,
$sel:products:PatchSource' :: NonEmpty Text
products = Tagged (NonEmpty Text) (Identity (NonEmpty Text))
-> Tagged (NonEmpty Text) (Identity (NonEmpty Text))
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced (Tagged (NonEmpty Text) (Identity (NonEmpty Text))
-> Tagged (NonEmpty Text) (Identity (NonEmpty Text)))
-> NonEmpty Text -> NonEmpty Text
forall t b. AReview t b -> b -> t
Lens.# NonEmpty Text
pProducts_,
$sel:configuration:PatchSource' :: Sensitive Text
configuration =
Tagged Text (Identity Text)
-> Tagged (Sensitive Text) (Identity (Sensitive Text))
forall a. Iso' (Sensitive a) a
Core._Sensitive (Tagged Text (Identity Text)
-> Tagged (Sensitive Text) (Identity (Sensitive Text)))
-> Text -> Sensitive Text
forall t b. AReview t b -> b -> t
Lens.# Text
pConfiguration_
}
patchSource_name :: Lens.Lens' PatchSource Prelude.Text
patchSource_name :: (Text -> f Text) -> PatchSource -> f PatchSource
patchSource_name = (PatchSource -> Text)
-> (PatchSource -> Text -> PatchSource)
-> Lens PatchSource PatchSource Text Text
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 :: (NonEmpty Text -> f (NonEmpty Text))
-> PatchSource -> f PatchSource
patchSource_products = (PatchSource -> NonEmpty Text)
-> (PatchSource -> NonEmpty Text -> PatchSource)
-> Lens PatchSource PatchSource (NonEmpty Text) (NonEmpty Text)
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) ((NonEmpty Text -> f (NonEmpty Text))
-> PatchSource -> f PatchSource)
-> ((NonEmpty Text -> f (NonEmpty Text))
-> NonEmpty Text -> f (NonEmpty Text))
-> (NonEmpty Text -> f (NonEmpty Text))
-> PatchSource
-> f PatchSource
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (NonEmpty Text -> f (NonEmpty Text))
-> NonEmpty Text -> f (NonEmpty Text)
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 :: (Text -> f Text) -> PatchSource -> f PatchSource
patchSource_configuration = (PatchSource -> Sensitive Text)
-> (PatchSource -> Sensitive Text -> PatchSource)
-> Lens PatchSource PatchSource (Sensitive Text) (Sensitive Text)
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) ((Sensitive Text -> f (Sensitive Text))
-> PatchSource -> f PatchSource)
-> ((Text -> f Text) -> Sensitive Text -> f (Sensitive Text))
-> (Text -> f Text)
-> PatchSource
-> f PatchSource
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> f Text) -> Sensitive Text -> f (Sensitive Text)
forall a. Iso' (Sensitive a) a
Core._Sensitive
instance Core.FromJSON PatchSource where
parseJSON :: Value -> Parser PatchSource
parseJSON =
String
-> (Object -> Parser PatchSource) -> Value -> Parser PatchSource
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"PatchSource"
( \Object
x ->
Text -> NonEmpty Text -> Sensitive Text -> PatchSource
PatchSource'
(Text -> NonEmpty Text -> Sensitive Text -> PatchSource)
-> Parser Text
-> Parser (NonEmpty Text -> Sensitive Text -> PatchSource)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"Name")
Parser (NonEmpty Text -> Sensitive Text -> PatchSource)
-> Parser (NonEmpty Text) -> Parser (Sensitive Text -> PatchSource)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (NonEmpty Text)
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"Products")
Parser (Sensitive Text -> PatchSource)
-> Parser (Sensitive Text) -> Parser PatchSource
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Sensitive Text)
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"Configuration")
)
instance Prelude.Hashable PatchSource
instance Prelude.NFData PatchSource
instance Core.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
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Name" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
name),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Products" Text -> NonEmpty Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= NonEmpty Text
products),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"Configuration" Text -> Sensitive Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Sensitive Text
configuration)
]
)