{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}
module Amazonka.CustomerProfiles.AddProfileKey
(
AddProfileKey (..),
newAddProfileKey,
addProfileKey_profileId,
addProfileKey_keyName,
addProfileKey_values,
addProfileKey_domainName,
AddProfileKeyResponse (..),
newAddProfileKeyResponse,
addProfileKeyResponse_values,
addProfileKeyResponse_keyName,
addProfileKeyResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import Amazonka.CustomerProfiles.Types
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data AddProfileKey = AddProfileKey'
{
AddProfileKey -> Text
profileId :: Prelude.Text,
AddProfileKey -> Text
keyName :: Prelude.Text,
AddProfileKey -> [Text]
values :: [Prelude.Text],
AddProfileKey -> Text
domainName :: Prelude.Text
}
deriving (AddProfileKey -> AddProfileKey -> Bool
(AddProfileKey -> AddProfileKey -> Bool)
-> (AddProfileKey -> AddProfileKey -> Bool) -> Eq AddProfileKey
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AddProfileKey -> AddProfileKey -> Bool
$c/= :: AddProfileKey -> AddProfileKey -> Bool
== :: AddProfileKey -> AddProfileKey -> Bool
$c== :: AddProfileKey -> AddProfileKey -> Bool
Prelude.Eq, ReadPrec [AddProfileKey]
ReadPrec AddProfileKey
Int -> ReadS AddProfileKey
ReadS [AddProfileKey]
(Int -> ReadS AddProfileKey)
-> ReadS [AddProfileKey]
-> ReadPrec AddProfileKey
-> ReadPrec [AddProfileKey]
-> Read AddProfileKey
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AddProfileKey]
$creadListPrec :: ReadPrec [AddProfileKey]
readPrec :: ReadPrec AddProfileKey
$creadPrec :: ReadPrec AddProfileKey
readList :: ReadS [AddProfileKey]
$creadList :: ReadS [AddProfileKey]
readsPrec :: Int -> ReadS AddProfileKey
$creadsPrec :: Int -> ReadS AddProfileKey
Prelude.Read, Int -> AddProfileKey -> ShowS
[AddProfileKey] -> ShowS
AddProfileKey -> String
(Int -> AddProfileKey -> ShowS)
-> (AddProfileKey -> String)
-> ([AddProfileKey] -> ShowS)
-> Show AddProfileKey
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AddProfileKey] -> ShowS
$cshowList :: [AddProfileKey] -> ShowS
show :: AddProfileKey -> String
$cshow :: AddProfileKey -> String
showsPrec :: Int -> AddProfileKey -> ShowS
$cshowsPrec :: Int -> AddProfileKey -> ShowS
Prelude.Show, (forall x. AddProfileKey -> Rep AddProfileKey x)
-> (forall x. Rep AddProfileKey x -> AddProfileKey)
-> Generic AddProfileKey
forall x. Rep AddProfileKey x -> AddProfileKey
forall x. AddProfileKey -> Rep AddProfileKey x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AddProfileKey x -> AddProfileKey
$cfrom :: forall x. AddProfileKey -> Rep AddProfileKey x
Prelude.Generic)
newAddProfileKey ::
Prelude.Text ->
Prelude.Text ->
Prelude.Text ->
AddProfileKey
newAddProfileKey :: Text -> Text -> Text -> AddProfileKey
newAddProfileKey Text
pProfileId_ Text
pKeyName_ Text
pDomainName_ =
AddProfileKey' :: Text -> Text -> [Text] -> Text -> AddProfileKey
AddProfileKey'
{ $sel:profileId:AddProfileKey' :: Text
profileId = Text
pProfileId_,
$sel:keyName:AddProfileKey' :: Text
keyName = Text
pKeyName_,
$sel:values:AddProfileKey' :: [Text]
values = [Text]
forall a. Monoid a => a
Prelude.mempty,
$sel:domainName:AddProfileKey' :: Text
domainName = Text
pDomainName_
}
addProfileKey_profileId :: Lens.Lens' AddProfileKey Prelude.Text
addProfileKey_profileId :: (Text -> f Text) -> AddProfileKey -> f AddProfileKey
addProfileKey_profileId = (AddProfileKey -> Text)
-> (AddProfileKey -> Text -> AddProfileKey)
-> Lens AddProfileKey AddProfileKey Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AddProfileKey' {Text
profileId :: Text
$sel:profileId:AddProfileKey' :: AddProfileKey -> Text
profileId} -> Text
profileId) (\s :: AddProfileKey
s@AddProfileKey' {} Text
a -> AddProfileKey
s {$sel:profileId:AddProfileKey' :: Text
profileId = Text
a} :: AddProfileKey)
addProfileKey_keyName :: Lens.Lens' AddProfileKey Prelude.Text
addProfileKey_keyName :: (Text -> f Text) -> AddProfileKey -> f AddProfileKey
addProfileKey_keyName = (AddProfileKey -> Text)
-> (AddProfileKey -> Text -> AddProfileKey)
-> Lens AddProfileKey AddProfileKey Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AddProfileKey' {Text
keyName :: Text
$sel:keyName:AddProfileKey' :: AddProfileKey -> Text
keyName} -> Text
keyName) (\s :: AddProfileKey
s@AddProfileKey' {} Text
a -> AddProfileKey
s {$sel:keyName:AddProfileKey' :: Text
keyName = Text
a} :: AddProfileKey)
addProfileKey_values :: Lens.Lens' AddProfileKey [Prelude.Text]
addProfileKey_values :: ([Text] -> f [Text]) -> AddProfileKey -> f AddProfileKey
addProfileKey_values = (AddProfileKey -> [Text])
-> (AddProfileKey -> [Text] -> AddProfileKey)
-> Lens AddProfileKey AddProfileKey [Text] [Text]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AddProfileKey' {[Text]
values :: [Text]
$sel:values:AddProfileKey' :: AddProfileKey -> [Text]
values} -> [Text]
values) (\s :: AddProfileKey
s@AddProfileKey' {} [Text]
a -> AddProfileKey
s {$sel:values:AddProfileKey' :: [Text]
values = [Text]
a} :: AddProfileKey) (([Text] -> f [Text]) -> AddProfileKey -> f AddProfileKey)
-> (([Text] -> f [Text]) -> [Text] -> f [Text])
-> ([Text] -> f [Text])
-> AddProfileKey
-> f AddProfileKey
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([Text] -> f [Text]) -> [Text] -> f [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
addProfileKey_domainName :: Lens.Lens' AddProfileKey Prelude.Text
addProfileKey_domainName :: (Text -> f Text) -> AddProfileKey -> f AddProfileKey
addProfileKey_domainName = (AddProfileKey -> Text)
-> (AddProfileKey -> Text -> AddProfileKey)
-> Lens AddProfileKey AddProfileKey Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AddProfileKey' {Text
domainName :: Text
$sel:domainName:AddProfileKey' :: AddProfileKey -> Text
domainName} -> Text
domainName) (\s :: AddProfileKey
s@AddProfileKey' {} Text
a -> AddProfileKey
s {$sel:domainName:AddProfileKey' :: Text
domainName = Text
a} :: AddProfileKey)
instance Core.AWSRequest AddProfileKey where
type
AWSResponse AddProfileKey =
AddProfileKeyResponse
request :: AddProfileKey -> Request AddProfileKey
request = Service -> AddProfileKey -> Request AddProfileKey
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy AddProfileKey
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse AddProfileKey)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse AddProfileKey))
-> Logger
-> Service
-> Proxy AddProfileKey
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse AddProfileKey)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Maybe [Text] -> Maybe Text -> Int -> AddProfileKeyResponse
AddProfileKeyResponse'
(Maybe [Text] -> Maybe Text -> Int -> AddProfileKeyResponse)
-> Either String (Maybe [Text])
-> Either String (Maybe Text -> Int -> AddProfileKeyResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe (Maybe [Text]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Values" Either String (Maybe (Maybe [Text]))
-> Maybe [Text] -> Either String (Maybe [Text])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [Text]
forall a. Monoid a => a
Prelude.mempty)
Either String (Maybe Text -> Int -> AddProfileKeyResponse)
-> Either String (Maybe Text)
-> Either String (Int -> AddProfileKeyResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"KeyName")
Either String (Int -> AddProfileKeyResponse)
-> Either String Int -> Either String AddProfileKeyResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable AddProfileKey
instance Prelude.NFData AddProfileKey
instance Core.ToHeaders AddProfileKey where
toHeaders :: AddProfileKey -> ResponseHeaders
toHeaders =
ResponseHeaders -> AddProfileKey -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"Content-Type"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Core.ToJSON AddProfileKey where
toJSON :: AddProfileKey -> Value
toJSON AddProfileKey' {[Text]
Text
domainName :: Text
values :: [Text]
keyName :: Text
profileId :: Text
$sel:domainName:AddProfileKey' :: AddProfileKey -> Text
$sel:values:AddProfileKey' :: AddProfileKey -> [Text]
$sel:keyName:AddProfileKey' :: AddProfileKey -> Text
$sel:profileId:AddProfileKey' :: AddProfileKey -> 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
"ProfileId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
profileId),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"KeyName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
keyName),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Values" Text -> [Text] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= [Text]
values)
]
)
instance Core.ToPath AddProfileKey where
toPath :: AddProfileKey -> ByteString
toPath AddProfileKey' {[Text]
Text
domainName :: Text
values :: [Text]
keyName :: Text
profileId :: Text
$sel:domainName:AddProfileKey' :: AddProfileKey -> Text
$sel:values:AddProfileKey' :: AddProfileKey -> [Text]
$sel:keyName:AddProfileKey' :: AddProfileKey -> Text
$sel:profileId:AddProfileKey' :: AddProfileKey -> Text
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ByteString
"/domains/", Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
domainName, ByteString
"/profiles/keys"]
instance Core.ToQuery AddProfileKey where
toQuery :: AddProfileKey -> QueryString
toQuery = QueryString -> AddProfileKey -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data AddProfileKeyResponse = AddProfileKeyResponse'
{
AddProfileKeyResponse -> Maybe [Text]
values :: Prelude.Maybe [Prelude.Text],
AddProfileKeyResponse -> Maybe Text
keyName :: Prelude.Maybe Prelude.Text,
AddProfileKeyResponse -> Int
httpStatus :: Prelude.Int
}
deriving (AddProfileKeyResponse -> AddProfileKeyResponse -> Bool
(AddProfileKeyResponse -> AddProfileKeyResponse -> Bool)
-> (AddProfileKeyResponse -> AddProfileKeyResponse -> Bool)
-> Eq AddProfileKeyResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AddProfileKeyResponse -> AddProfileKeyResponse -> Bool
$c/= :: AddProfileKeyResponse -> AddProfileKeyResponse -> Bool
== :: AddProfileKeyResponse -> AddProfileKeyResponse -> Bool
$c== :: AddProfileKeyResponse -> AddProfileKeyResponse -> Bool
Prelude.Eq, ReadPrec [AddProfileKeyResponse]
ReadPrec AddProfileKeyResponse
Int -> ReadS AddProfileKeyResponse
ReadS [AddProfileKeyResponse]
(Int -> ReadS AddProfileKeyResponse)
-> ReadS [AddProfileKeyResponse]
-> ReadPrec AddProfileKeyResponse
-> ReadPrec [AddProfileKeyResponse]
-> Read AddProfileKeyResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AddProfileKeyResponse]
$creadListPrec :: ReadPrec [AddProfileKeyResponse]
readPrec :: ReadPrec AddProfileKeyResponse
$creadPrec :: ReadPrec AddProfileKeyResponse
readList :: ReadS [AddProfileKeyResponse]
$creadList :: ReadS [AddProfileKeyResponse]
readsPrec :: Int -> ReadS AddProfileKeyResponse
$creadsPrec :: Int -> ReadS AddProfileKeyResponse
Prelude.Read, Int -> AddProfileKeyResponse -> ShowS
[AddProfileKeyResponse] -> ShowS
AddProfileKeyResponse -> String
(Int -> AddProfileKeyResponse -> ShowS)
-> (AddProfileKeyResponse -> String)
-> ([AddProfileKeyResponse] -> ShowS)
-> Show AddProfileKeyResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AddProfileKeyResponse] -> ShowS
$cshowList :: [AddProfileKeyResponse] -> ShowS
show :: AddProfileKeyResponse -> String
$cshow :: AddProfileKeyResponse -> String
showsPrec :: Int -> AddProfileKeyResponse -> ShowS
$cshowsPrec :: Int -> AddProfileKeyResponse -> ShowS
Prelude.Show, (forall x. AddProfileKeyResponse -> Rep AddProfileKeyResponse x)
-> (forall x. Rep AddProfileKeyResponse x -> AddProfileKeyResponse)
-> Generic AddProfileKeyResponse
forall x. Rep AddProfileKeyResponse x -> AddProfileKeyResponse
forall x. AddProfileKeyResponse -> Rep AddProfileKeyResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AddProfileKeyResponse x -> AddProfileKeyResponse
$cfrom :: forall x. AddProfileKeyResponse -> Rep AddProfileKeyResponse x
Prelude.Generic)
newAddProfileKeyResponse ::
Prelude.Int ->
AddProfileKeyResponse
newAddProfileKeyResponse :: Int -> AddProfileKeyResponse
newAddProfileKeyResponse Int
pHttpStatus_ =
AddProfileKeyResponse' :: Maybe [Text] -> Maybe Text -> Int -> AddProfileKeyResponse
AddProfileKeyResponse'
{ $sel:values:AddProfileKeyResponse' :: Maybe [Text]
values = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
$sel:keyName:AddProfileKeyResponse' :: Maybe Text
keyName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:AddProfileKeyResponse' :: Int
httpStatus = Int
pHttpStatus_
}
addProfileKeyResponse_values :: Lens.Lens' AddProfileKeyResponse (Prelude.Maybe [Prelude.Text])
addProfileKeyResponse_values :: (Maybe [Text] -> f (Maybe [Text]))
-> AddProfileKeyResponse -> f AddProfileKeyResponse
addProfileKeyResponse_values = (AddProfileKeyResponse -> Maybe [Text])
-> (AddProfileKeyResponse -> Maybe [Text] -> AddProfileKeyResponse)
-> Lens
AddProfileKeyResponse
AddProfileKeyResponse
(Maybe [Text])
(Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AddProfileKeyResponse' {Maybe [Text]
values :: Maybe [Text]
$sel:values:AddProfileKeyResponse' :: AddProfileKeyResponse -> Maybe [Text]
values} -> Maybe [Text]
values) (\s :: AddProfileKeyResponse
s@AddProfileKeyResponse' {} Maybe [Text]
a -> AddProfileKeyResponse
s {$sel:values:AddProfileKeyResponse' :: Maybe [Text]
values = Maybe [Text]
a} :: AddProfileKeyResponse) ((Maybe [Text] -> f (Maybe [Text]))
-> AddProfileKeyResponse -> f AddProfileKeyResponse)
-> ((Maybe [Text] -> f (Maybe [Text]))
-> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> AddProfileKeyResponse
-> f AddProfileKeyResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [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 [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
addProfileKeyResponse_keyName :: Lens.Lens' AddProfileKeyResponse (Prelude.Maybe Prelude.Text)
addProfileKeyResponse_keyName :: (Maybe Text -> f (Maybe Text))
-> AddProfileKeyResponse -> f AddProfileKeyResponse
addProfileKeyResponse_keyName = (AddProfileKeyResponse -> Maybe Text)
-> (AddProfileKeyResponse -> Maybe Text -> AddProfileKeyResponse)
-> Lens
AddProfileKeyResponse
AddProfileKeyResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AddProfileKeyResponse' {Maybe Text
keyName :: Maybe Text
$sel:keyName:AddProfileKeyResponse' :: AddProfileKeyResponse -> Maybe Text
keyName} -> Maybe Text
keyName) (\s :: AddProfileKeyResponse
s@AddProfileKeyResponse' {} Maybe Text
a -> AddProfileKeyResponse
s {$sel:keyName:AddProfileKeyResponse' :: Maybe Text
keyName = Maybe Text
a} :: AddProfileKeyResponse)
addProfileKeyResponse_httpStatus :: Lens.Lens' AddProfileKeyResponse Prelude.Int
addProfileKeyResponse_httpStatus :: (Int -> f Int) -> AddProfileKeyResponse -> f AddProfileKeyResponse
addProfileKeyResponse_httpStatus = (AddProfileKeyResponse -> Int)
-> (AddProfileKeyResponse -> Int -> AddProfileKeyResponse)
-> Lens AddProfileKeyResponse AddProfileKeyResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AddProfileKeyResponse' {Int
httpStatus :: Int
$sel:httpStatus:AddProfileKeyResponse' :: AddProfileKeyResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: AddProfileKeyResponse
s@AddProfileKeyResponse' {} Int
a -> AddProfileKeyResponse
s {$sel:httpStatus:AddProfileKeyResponse' :: Int
httpStatus = Int
a} :: AddProfileKeyResponse)
instance Prelude.NFData AddProfileKeyResponse