{-# 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.InventoryGroup where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.SSM.Types.InventoryFilter
data InventoryGroup = InventoryGroup'
{
InventoryGroup -> Text
name :: Prelude.Text,
InventoryGroup -> NonEmpty InventoryFilter
filters :: Prelude.NonEmpty InventoryFilter
}
deriving (InventoryGroup -> InventoryGroup -> Bool
(InventoryGroup -> InventoryGroup -> Bool)
-> (InventoryGroup -> InventoryGroup -> Bool) -> Eq InventoryGroup
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: InventoryGroup -> InventoryGroup -> Bool
$c/= :: InventoryGroup -> InventoryGroup -> Bool
== :: InventoryGroup -> InventoryGroup -> Bool
$c== :: InventoryGroup -> InventoryGroup -> Bool
Prelude.Eq, ReadPrec [InventoryGroup]
ReadPrec InventoryGroup
Int -> ReadS InventoryGroup
ReadS [InventoryGroup]
(Int -> ReadS InventoryGroup)
-> ReadS [InventoryGroup]
-> ReadPrec InventoryGroup
-> ReadPrec [InventoryGroup]
-> Read InventoryGroup
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [InventoryGroup]
$creadListPrec :: ReadPrec [InventoryGroup]
readPrec :: ReadPrec InventoryGroup
$creadPrec :: ReadPrec InventoryGroup
readList :: ReadS [InventoryGroup]
$creadList :: ReadS [InventoryGroup]
readsPrec :: Int -> ReadS InventoryGroup
$creadsPrec :: Int -> ReadS InventoryGroup
Prelude.Read, Int -> InventoryGroup -> ShowS
[InventoryGroup] -> ShowS
InventoryGroup -> String
(Int -> InventoryGroup -> ShowS)
-> (InventoryGroup -> String)
-> ([InventoryGroup] -> ShowS)
-> Show InventoryGroup
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [InventoryGroup] -> ShowS
$cshowList :: [InventoryGroup] -> ShowS
show :: InventoryGroup -> String
$cshow :: InventoryGroup -> String
showsPrec :: Int -> InventoryGroup -> ShowS
$cshowsPrec :: Int -> InventoryGroup -> ShowS
Prelude.Show, (forall x. InventoryGroup -> Rep InventoryGroup x)
-> (forall x. Rep InventoryGroup x -> InventoryGroup)
-> Generic InventoryGroup
forall x. Rep InventoryGroup x -> InventoryGroup
forall x. InventoryGroup -> Rep InventoryGroup x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep InventoryGroup x -> InventoryGroup
$cfrom :: forall x. InventoryGroup -> Rep InventoryGroup x
Prelude.Generic)
newInventoryGroup ::
Prelude.Text ->
Prelude.NonEmpty InventoryFilter ->
InventoryGroup
newInventoryGroup :: Text -> NonEmpty InventoryFilter -> InventoryGroup
newInventoryGroup Text
pName_ NonEmpty InventoryFilter
pFilters_ =
InventoryGroup' :: Text -> NonEmpty InventoryFilter -> InventoryGroup
InventoryGroup'
{ $sel:name:InventoryGroup' :: Text
name = Text
pName_,
$sel:filters:InventoryGroup' :: NonEmpty InventoryFilter
filters = Tagged
(NonEmpty InventoryFilter) (Identity (NonEmpty InventoryFilter))
-> Tagged
(NonEmpty InventoryFilter) (Identity (NonEmpty InventoryFilter))
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced (Tagged
(NonEmpty InventoryFilter) (Identity (NonEmpty InventoryFilter))
-> Tagged
(NonEmpty InventoryFilter) (Identity (NonEmpty InventoryFilter)))
-> NonEmpty InventoryFilter -> NonEmpty InventoryFilter
forall t b. AReview t b -> b -> t
Lens.# NonEmpty InventoryFilter
pFilters_
}
inventoryGroup_name :: Lens.Lens' InventoryGroup Prelude.Text
inventoryGroup_name :: (Text -> f Text) -> InventoryGroup -> f InventoryGroup
inventoryGroup_name = (InventoryGroup -> Text)
-> (InventoryGroup -> Text -> InventoryGroup)
-> Lens InventoryGroup InventoryGroup Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InventoryGroup' {Text
name :: Text
$sel:name:InventoryGroup' :: InventoryGroup -> Text
name} -> Text
name) (\s :: InventoryGroup
s@InventoryGroup' {} Text
a -> InventoryGroup
s {$sel:name:InventoryGroup' :: Text
name = Text
a} :: InventoryGroup)
inventoryGroup_filters :: Lens.Lens' InventoryGroup (Prelude.NonEmpty InventoryFilter)
inventoryGroup_filters :: (NonEmpty InventoryFilter -> f (NonEmpty InventoryFilter))
-> InventoryGroup -> f InventoryGroup
inventoryGroup_filters = (InventoryGroup -> NonEmpty InventoryFilter)
-> (InventoryGroup -> NonEmpty InventoryFilter -> InventoryGroup)
-> Lens
InventoryGroup
InventoryGroup
(NonEmpty InventoryFilter)
(NonEmpty InventoryFilter)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InventoryGroup' {NonEmpty InventoryFilter
filters :: NonEmpty InventoryFilter
$sel:filters:InventoryGroup' :: InventoryGroup -> NonEmpty InventoryFilter
filters} -> NonEmpty InventoryFilter
filters) (\s :: InventoryGroup
s@InventoryGroup' {} NonEmpty InventoryFilter
a -> InventoryGroup
s {$sel:filters:InventoryGroup' :: NonEmpty InventoryFilter
filters = NonEmpty InventoryFilter
a} :: InventoryGroup) ((NonEmpty InventoryFilter -> f (NonEmpty InventoryFilter))
-> InventoryGroup -> f InventoryGroup)
-> ((NonEmpty InventoryFilter -> f (NonEmpty InventoryFilter))
-> NonEmpty InventoryFilter -> f (NonEmpty InventoryFilter))
-> (NonEmpty InventoryFilter -> f (NonEmpty InventoryFilter))
-> InventoryGroup
-> f InventoryGroup
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (NonEmpty InventoryFilter -> f (NonEmpty InventoryFilter))
-> NonEmpty InventoryFilter -> f (NonEmpty InventoryFilter)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Prelude.Hashable InventoryGroup
instance Prelude.NFData InventoryGroup
instance Core.ToJSON InventoryGroup where
toJSON :: InventoryGroup -> Value
toJSON InventoryGroup' {NonEmpty InventoryFilter
Text
filters :: NonEmpty InventoryFilter
name :: Text
$sel:filters:InventoryGroup' :: InventoryGroup -> NonEmpty InventoryFilter
$sel:name:InventoryGroup' :: InventoryGroup -> 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
"Filters" Text -> NonEmpty InventoryFilter -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= NonEmpty InventoryFilter
filters)
]
)