{-# 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.Pinpoint.Types.WriteSegmentRequest where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.Pinpoint.Types.SegmentDimensions
import Amazonka.Pinpoint.Types.SegmentGroupList
import qualified Amazonka.Prelude as Prelude
data WriteSegmentRequest = WriteSegmentRequest'
{
WriteSegmentRequest -> Maybe SegmentGroupList
segmentGroups :: Prelude.Maybe SegmentGroupList,
WriteSegmentRequest -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
WriteSegmentRequest -> Maybe SegmentDimensions
dimensions :: Prelude.Maybe SegmentDimensions,
WriteSegmentRequest -> Maybe (HashMap Text Text)
tags :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text)
}
deriving (WriteSegmentRequest -> WriteSegmentRequest -> Bool
(WriteSegmentRequest -> WriteSegmentRequest -> Bool)
-> (WriteSegmentRequest -> WriteSegmentRequest -> Bool)
-> Eq WriteSegmentRequest
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: WriteSegmentRequest -> WriteSegmentRequest -> Bool
$c/= :: WriteSegmentRequest -> WriteSegmentRequest -> Bool
== :: WriteSegmentRequest -> WriteSegmentRequest -> Bool
$c== :: WriteSegmentRequest -> WriteSegmentRequest -> Bool
Prelude.Eq, ReadPrec [WriteSegmentRequest]
ReadPrec WriteSegmentRequest
Int -> ReadS WriteSegmentRequest
ReadS [WriteSegmentRequest]
(Int -> ReadS WriteSegmentRequest)
-> ReadS [WriteSegmentRequest]
-> ReadPrec WriteSegmentRequest
-> ReadPrec [WriteSegmentRequest]
-> Read WriteSegmentRequest
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [WriteSegmentRequest]
$creadListPrec :: ReadPrec [WriteSegmentRequest]
readPrec :: ReadPrec WriteSegmentRequest
$creadPrec :: ReadPrec WriteSegmentRequest
readList :: ReadS [WriteSegmentRequest]
$creadList :: ReadS [WriteSegmentRequest]
readsPrec :: Int -> ReadS WriteSegmentRequest
$creadsPrec :: Int -> ReadS WriteSegmentRequest
Prelude.Read, Int -> WriteSegmentRequest -> ShowS
[WriteSegmentRequest] -> ShowS
WriteSegmentRequest -> String
(Int -> WriteSegmentRequest -> ShowS)
-> (WriteSegmentRequest -> String)
-> ([WriteSegmentRequest] -> ShowS)
-> Show WriteSegmentRequest
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [WriteSegmentRequest] -> ShowS
$cshowList :: [WriteSegmentRequest] -> ShowS
show :: WriteSegmentRequest -> String
$cshow :: WriteSegmentRequest -> String
showsPrec :: Int -> WriteSegmentRequest -> ShowS
$cshowsPrec :: Int -> WriteSegmentRequest -> ShowS
Prelude.Show, (forall x. WriteSegmentRequest -> Rep WriteSegmentRequest x)
-> (forall x. Rep WriteSegmentRequest x -> WriteSegmentRequest)
-> Generic WriteSegmentRequest
forall x. Rep WriteSegmentRequest x -> WriteSegmentRequest
forall x. WriteSegmentRequest -> Rep WriteSegmentRequest x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep WriteSegmentRequest x -> WriteSegmentRequest
$cfrom :: forall x. WriteSegmentRequest -> Rep WriteSegmentRequest x
Prelude.Generic)
newWriteSegmentRequest ::
WriteSegmentRequest
newWriteSegmentRequest :: WriteSegmentRequest
newWriteSegmentRequest =
WriteSegmentRequest' :: Maybe SegmentGroupList
-> Maybe Text
-> Maybe SegmentDimensions
-> Maybe (HashMap Text Text)
-> WriteSegmentRequest
WriteSegmentRequest'
{ $sel:segmentGroups:WriteSegmentRequest' :: Maybe SegmentGroupList
segmentGroups =
Maybe SegmentGroupList
forall a. Maybe a
Prelude.Nothing,
$sel:name:WriteSegmentRequest' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:dimensions:WriteSegmentRequest' :: Maybe SegmentDimensions
dimensions = Maybe SegmentDimensions
forall a. Maybe a
Prelude.Nothing,
$sel:tags:WriteSegmentRequest' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing
}
writeSegmentRequest_segmentGroups :: Lens.Lens' WriteSegmentRequest (Prelude.Maybe SegmentGroupList)
writeSegmentRequest_segmentGroups :: (Maybe SegmentGroupList -> f (Maybe SegmentGroupList))
-> WriteSegmentRequest -> f WriteSegmentRequest
writeSegmentRequest_segmentGroups = (WriteSegmentRequest -> Maybe SegmentGroupList)
-> (WriteSegmentRequest
-> Maybe SegmentGroupList -> WriteSegmentRequest)
-> Lens
WriteSegmentRequest
WriteSegmentRequest
(Maybe SegmentGroupList)
(Maybe SegmentGroupList)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\WriteSegmentRequest' {Maybe SegmentGroupList
segmentGroups :: Maybe SegmentGroupList
$sel:segmentGroups:WriteSegmentRequest' :: WriteSegmentRequest -> Maybe SegmentGroupList
segmentGroups} -> Maybe SegmentGroupList
segmentGroups) (\s :: WriteSegmentRequest
s@WriteSegmentRequest' {} Maybe SegmentGroupList
a -> WriteSegmentRequest
s {$sel:segmentGroups:WriteSegmentRequest' :: Maybe SegmentGroupList
segmentGroups = Maybe SegmentGroupList
a} :: WriteSegmentRequest)
writeSegmentRequest_name :: Lens.Lens' WriteSegmentRequest (Prelude.Maybe Prelude.Text)
writeSegmentRequest_name :: (Maybe Text -> f (Maybe Text))
-> WriteSegmentRequest -> f WriteSegmentRequest
writeSegmentRequest_name = (WriteSegmentRequest -> Maybe Text)
-> (WriteSegmentRequest -> Maybe Text -> WriteSegmentRequest)
-> Lens
WriteSegmentRequest WriteSegmentRequest (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\WriteSegmentRequest' {Maybe Text
name :: Maybe Text
$sel:name:WriteSegmentRequest' :: WriteSegmentRequest -> Maybe Text
name} -> Maybe Text
name) (\s :: WriteSegmentRequest
s@WriteSegmentRequest' {} Maybe Text
a -> WriteSegmentRequest
s {$sel:name:WriteSegmentRequest' :: Maybe Text
name = Maybe Text
a} :: WriteSegmentRequest)
writeSegmentRequest_dimensions :: Lens.Lens' WriteSegmentRequest (Prelude.Maybe SegmentDimensions)
writeSegmentRequest_dimensions :: (Maybe SegmentDimensions -> f (Maybe SegmentDimensions))
-> WriteSegmentRequest -> f WriteSegmentRequest
writeSegmentRequest_dimensions = (WriteSegmentRequest -> Maybe SegmentDimensions)
-> (WriteSegmentRequest
-> Maybe SegmentDimensions -> WriteSegmentRequest)
-> Lens
WriteSegmentRequest
WriteSegmentRequest
(Maybe SegmentDimensions)
(Maybe SegmentDimensions)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\WriteSegmentRequest' {Maybe SegmentDimensions
dimensions :: Maybe SegmentDimensions
$sel:dimensions:WriteSegmentRequest' :: WriteSegmentRequest -> Maybe SegmentDimensions
dimensions} -> Maybe SegmentDimensions
dimensions) (\s :: WriteSegmentRequest
s@WriteSegmentRequest' {} Maybe SegmentDimensions
a -> WriteSegmentRequest
s {$sel:dimensions:WriteSegmentRequest' :: Maybe SegmentDimensions
dimensions = Maybe SegmentDimensions
a} :: WriteSegmentRequest)
writeSegmentRequest_tags :: Lens.Lens' WriteSegmentRequest (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
writeSegmentRequest_tags :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> WriteSegmentRequest -> f WriteSegmentRequest
writeSegmentRequest_tags = (WriteSegmentRequest -> Maybe (HashMap Text Text))
-> (WriteSegmentRequest
-> Maybe (HashMap Text Text) -> WriteSegmentRequest)
-> Lens
WriteSegmentRequest
WriteSegmentRequest
(Maybe (HashMap Text Text))
(Maybe (HashMap Text Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\WriteSegmentRequest' {Maybe (HashMap Text Text)
tags :: Maybe (HashMap Text Text)
$sel:tags:WriteSegmentRequest' :: WriteSegmentRequest -> Maybe (HashMap Text Text)
tags} -> Maybe (HashMap Text Text)
tags) (\s :: WriteSegmentRequest
s@WriteSegmentRequest' {} Maybe (HashMap Text Text)
a -> WriteSegmentRequest
s {$sel:tags:WriteSegmentRequest' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
a} :: WriteSegmentRequest) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> WriteSegmentRequest -> f WriteSegmentRequest)
-> ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> WriteSegmentRequest
-> f WriteSegmentRequest
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
-> Iso
(Maybe (HashMap Text Text))
(Maybe (HashMap Text Text))
(Maybe (HashMap Text Text))
(Maybe (HashMap Text Text))
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Prelude.Hashable WriteSegmentRequest
instance Prelude.NFData WriteSegmentRequest
instance Core.ToJSON WriteSegmentRequest where
toJSON :: WriteSegmentRequest -> Value
toJSON WriteSegmentRequest' {Maybe Text
Maybe (HashMap Text Text)
Maybe SegmentDimensions
Maybe SegmentGroupList
tags :: Maybe (HashMap Text Text)
dimensions :: Maybe SegmentDimensions
name :: Maybe Text
segmentGroups :: Maybe SegmentGroupList
$sel:tags:WriteSegmentRequest' :: WriteSegmentRequest -> Maybe (HashMap Text Text)
$sel:dimensions:WriteSegmentRequest' :: WriteSegmentRequest -> Maybe SegmentDimensions
$sel:name:WriteSegmentRequest' :: WriteSegmentRequest -> Maybe Text
$sel:segmentGroups:WriteSegmentRequest' :: WriteSegmentRequest -> Maybe SegmentGroupList
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"SegmentGroups" Text -> SegmentGroupList -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (SegmentGroupList -> Pair) -> Maybe SegmentGroupList -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe SegmentGroupList
segmentGroups,
(Text
"Name" 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
name,
(Text
"Dimensions" Text -> SegmentDimensions -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (SegmentDimensions -> Pair)
-> Maybe SegmentDimensions -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe SegmentDimensions
dimensions,
(Text
"tags" Text -> HashMap Text Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (HashMap Text Text -> Pair)
-> Maybe (HashMap Text Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text Text)
tags
]
)