{-# 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.Pinpoint.RemoveAttributes
(
RemoveAttributes (..),
newRemoveAttributes,
removeAttributes_attributeType,
removeAttributes_applicationId,
removeAttributes_updateAttributesRequest,
RemoveAttributesResponse (..),
newRemoveAttributesResponse,
removeAttributesResponse_httpStatus,
removeAttributesResponse_attributesResource,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.Pinpoint.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data RemoveAttributes = RemoveAttributes'
{
RemoveAttributes -> Text
attributeType :: Prelude.Text,
RemoveAttributes -> Text
applicationId :: Prelude.Text,
RemoveAttributes -> UpdateAttributesRequest
updateAttributesRequest :: UpdateAttributesRequest
}
deriving (RemoveAttributes -> RemoveAttributes -> Bool
(RemoveAttributes -> RemoveAttributes -> Bool)
-> (RemoveAttributes -> RemoveAttributes -> Bool)
-> Eq RemoveAttributes
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RemoveAttributes -> RemoveAttributes -> Bool
$c/= :: RemoveAttributes -> RemoveAttributes -> Bool
== :: RemoveAttributes -> RemoveAttributes -> Bool
$c== :: RemoveAttributes -> RemoveAttributes -> Bool
Prelude.Eq, ReadPrec [RemoveAttributes]
ReadPrec RemoveAttributes
Int -> ReadS RemoveAttributes
ReadS [RemoveAttributes]
(Int -> ReadS RemoveAttributes)
-> ReadS [RemoveAttributes]
-> ReadPrec RemoveAttributes
-> ReadPrec [RemoveAttributes]
-> Read RemoveAttributes
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RemoveAttributes]
$creadListPrec :: ReadPrec [RemoveAttributes]
readPrec :: ReadPrec RemoveAttributes
$creadPrec :: ReadPrec RemoveAttributes
readList :: ReadS [RemoveAttributes]
$creadList :: ReadS [RemoveAttributes]
readsPrec :: Int -> ReadS RemoveAttributes
$creadsPrec :: Int -> ReadS RemoveAttributes
Prelude.Read, Int -> RemoveAttributes -> ShowS
[RemoveAttributes] -> ShowS
RemoveAttributes -> String
(Int -> RemoveAttributes -> ShowS)
-> (RemoveAttributes -> String)
-> ([RemoveAttributes] -> ShowS)
-> Show RemoveAttributes
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RemoveAttributes] -> ShowS
$cshowList :: [RemoveAttributes] -> ShowS
show :: RemoveAttributes -> String
$cshow :: RemoveAttributes -> String
showsPrec :: Int -> RemoveAttributes -> ShowS
$cshowsPrec :: Int -> RemoveAttributes -> ShowS
Prelude.Show, (forall x. RemoveAttributes -> Rep RemoveAttributes x)
-> (forall x. Rep RemoveAttributes x -> RemoveAttributes)
-> Generic RemoveAttributes
forall x. Rep RemoveAttributes x -> RemoveAttributes
forall x. RemoveAttributes -> Rep RemoveAttributes x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RemoveAttributes x -> RemoveAttributes
$cfrom :: forall x. RemoveAttributes -> Rep RemoveAttributes x
Prelude.Generic)
newRemoveAttributes ::
Prelude.Text ->
Prelude.Text ->
UpdateAttributesRequest ->
RemoveAttributes
newRemoveAttributes :: Text -> Text -> UpdateAttributesRequest -> RemoveAttributes
newRemoveAttributes
Text
pAttributeType_
Text
pApplicationId_
UpdateAttributesRequest
pUpdateAttributesRequest_ =
RemoveAttributes' :: Text -> Text -> UpdateAttributesRequest -> RemoveAttributes
RemoveAttributes'
{ $sel:attributeType:RemoveAttributes' :: Text
attributeType = Text
pAttributeType_,
$sel:applicationId:RemoveAttributes' :: Text
applicationId = Text
pApplicationId_,
$sel:updateAttributesRequest:RemoveAttributes' :: UpdateAttributesRequest
updateAttributesRequest = UpdateAttributesRequest
pUpdateAttributesRequest_
}
removeAttributes_attributeType :: Lens.Lens' RemoveAttributes Prelude.Text
removeAttributes_attributeType :: (Text -> f Text) -> RemoveAttributes -> f RemoveAttributes
removeAttributes_attributeType = (RemoveAttributes -> Text)
-> (RemoveAttributes -> Text -> RemoveAttributes)
-> Lens RemoveAttributes RemoveAttributes Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RemoveAttributes' {Text
attributeType :: Text
$sel:attributeType:RemoveAttributes' :: RemoveAttributes -> Text
attributeType} -> Text
attributeType) (\s :: RemoveAttributes
s@RemoveAttributes' {} Text
a -> RemoveAttributes
s {$sel:attributeType:RemoveAttributes' :: Text
attributeType = Text
a} :: RemoveAttributes)
removeAttributes_applicationId :: Lens.Lens' RemoveAttributes Prelude.Text
removeAttributes_applicationId :: (Text -> f Text) -> RemoveAttributes -> f RemoveAttributes
removeAttributes_applicationId = (RemoveAttributes -> Text)
-> (RemoveAttributes -> Text -> RemoveAttributes)
-> Lens RemoveAttributes RemoveAttributes Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RemoveAttributes' {Text
applicationId :: Text
$sel:applicationId:RemoveAttributes' :: RemoveAttributes -> Text
applicationId} -> Text
applicationId) (\s :: RemoveAttributes
s@RemoveAttributes' {} Text
a -> RemoveAttributes
s {$sel:applicationId:RemoveAttributes' :: Text
applicationId = Text
a} :: RemoveAttributes)
removeAttributes_updateAttributesRequest :: Lens.Lens' RemoveAttributes UpdateAttributesRequest
removeAttributes_updateAttributesRequest :: (UpdateAttributesRequest -> f UpdateAttributesRequest)
-> RemoveAttributes -> f RemoveAttributes
removeAttributes_updateAttributesRequest = (RemoveAttributes -> UpdateAttributesRequest)
-> (RemoveAttributes
-> UpdateAttributesRequest -> RemoveAttributes)
-> Lens
RemoveAttributes
RemoveAttributes
UpdateAttributesRequest
UpdateAttributesRequest
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RemoveAttributes' {UpdateAttributesRequest
updateAttributesRequest :: UpdateAttributesRequest
$sel:updateAttributesRequest:RemoveAttributes' :: RemoveAttributes -> UpdateAttributesRequest
updateAttributesRequest} -> UpdateAttributesRequest
updateAttributesRequest) (\s :: RemoveAttributes
s@RemoveAttributes' {} UpdateAttributesRequest
a -> RemoveAttributes
s {$sel:updateAttributesRequest:RemoveAttributes' :: UpdateAttributesRequest
updateAttributesRequest = UpdateAttributesRequest
a} :: RemoveAttributes)
instance Core.AWSRequest RemoveAttributes where
type
AWSResponse RemoveAttributes =
RemoveAttributesResponse
request :: RemoveAttributes -> Request RemoveAttributes
request = Service -> RemoveAttributes -> Request RemoveAttributes
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.putJSON Service
defaultService
response :: Logger
-> Service
-> Proxy RemoveAttributes
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse RemoveAttributes)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse RemoveAttributes))
-> Logger
-> Service
-> Proxy RemoveAttributes
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse RemoveAttributes)))
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 ->
Int -> AttributesResource -> RemoveAttributesResponse
RemoveAttributesResponse'
(Int -> AttributesResource -> RemoveAttributesResponse)
-> Either String Int
-> Either String (AttributesResource -> RemoveAttributesResponse)
forall (f :: * -> *) a b. Functor 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))
Either String (AttributesResource -> RemoveAttributesResponse)
-> Either String AttributesResource
-> Either String RemoveAttributesResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object -> Either String AttributesResource
forall a. FromJSON a => Object -> Either String a
Core.eitherParseJSON Object
x)
)
instance Prelude.Hashable RemoveAttributes
instance Prelude.NFData RemoveAttributes
instance Core.ToHeaders RemoveAttributes where
toHeaders :: RemoveAttributes -> ResponseHeaders
toHeaders =
ResponseHeaders -> RemoveAttributes -> 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 RemoveAttributes where
toJSON :: RemoveAttributes -> Value
toJSON RemoveAttributes' {Text
UpdateAttributesRequest
updateAttributesRequest :: UpdateAttributesRequest
applicationId :: Text
attributeType :: Text
$sel:updateAttributesRequest:RemoveAttributes' :: RemoveAttributes -> UpdateAttributesRequest
$sel:applicationId:RemoveAttributes' :: RemoveAttributes -> Text
$sel:attributeType:RemoveAttributes' :: RemoveAttributes -> 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
"UpdateAttributesRequest"
Text -> UpdateAttributesRequest -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= UpdateAttributesRequest
updateAttributesRequest
)
]
)
instance Core.ToPath RemoveAttributes where
toPath :: RemoveAttributes -> ByteString
toPath RemoveAttributes' {Text
UpdateAttributesRequest
updateAttributesRequest :: UpdateAttributesRequest
applicationId :: Text
attributeType :: Text
$sel:updateAttributesRequest:RemoveAttributes' :: RemoveAttributes -> UpdateAttributesRequest
$sel:applicationId:RemoveAttributes' :: RemoveAttributes -> Text
$sel:attributeType:RemoveAttributes' :: RemoveAttributes -> Text
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"/v1/apps/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
applicationId,
ByteString
"/attributes/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
attributeType
]
instance Core.ToQuery RemoveAttributes where
toQuery :: RemoveAttributes -> QueryString
toQuery = QueryString -> RemoveAttributes -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data RemoveAttributesResponse = RemoveAttributesResponse'
{
RemoveAttributesResponse -> Int
httpStatus :: Prelude.Int,
RemoveAttributesResponse -> AttributesResource
attributesResource :: AttributesResource
}
deriving (RemoveAttributesResponse -> RemoveAttributesResponse -> Bool
(RemoveAttributesResponse -> RemoveAttributesResponse -> Bool)
-> (RemoveAttributesResponse -> RemoveAttributesResponse -> Bool)
-> Eq RemoveAttributesResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RemoveAttributesResponse -> RemoveAttributesResponse -> Bool
$c/= :: RemoveAttributesResponse -> RemoveAttributesResponse -> Bool
== :: RemoveAttributesResponse -> RemoveAttributesResponse -> Bool
$c== :: RemoveAttributesResponse -> RemoveAttributesResponse -> Bool
Prelude.Eq, ReadPrec [RemoveAttributesResponse]
ReadPrec RemoveAttributesResponse
Int -> ReadS RemoveAttributesResponse
ReadS [RemoveAttributesResponse]
(Int -> ReadS RemoveAttributesResponse)
-> ReadS [RemoveAttributesResponse]
-> ReadPrec RemoveAttributesResponse
-> ReadPrec [RemoveAttributesResponse]
-> Read RemoveAttributesResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RemoveAttributesResponse]
$creadListPrec :: ReadPrec [RemoveAttributesResponse]
readPrec :: ReadPrec RemoveAttributesResponse
$creadPrec :: ReadPrec RemoveAttributesResponse
readList :: ReadS [RemoveAttributesResponse]
$creadList :: ReadS [RemoveAttributesResponse]
readsPrec :: Int -> ReadS RemoveAttributesResponse
$creadsPrec :: Int -> ReadS RemoveAttributesResponse
Prelude.Read, Int -> RemoveAttributesResponse -> ShowS
[RemoveAttributesResponse] -> ShowS
RemoveAttributesResponse -> String
(Int -> RemoveAttributesResponse -> ShowS)
-> (RemoveAttributesResponse -> String)
-> ([RemoveAttributesResponse] -> ShowS)
-> Show RemoveAttributesResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RemoveAttributesResponse] -> ShowS
$cshowList :: [RemoveAttributesResponse] -> ShowS
show :: RemoveAttributesResponse -> String
$cshow :: RemoveAttributesResponse -> String
showsPrec :: Int -> RemoveAttributesResponse -> ShowS
$cshowsPrec :: Int -> RemoveAttributesResponse -> ShowS
Prelude.Show, (forall x.
RemoveAttributesResponse -> Rep RemoveAttributesResponse x)
-> (forall x.
Rep RemoveAttributesResponse x -> RemoveAttributesResponse)
-> Generic RemoveAttributesResponse
forall x.
Rep RemoveAttributesResponse x -> RemoveAttributesResponse
forall x.
RemoveAttributesResponse -> Rep RemoveAttributesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep RemoveAttributesResponse x -> RemoveAttributesResponse
$cfrom :: forall x.
RemoveAttributesResponse -> Rep RemoveAttributesResponse x
Prelude.Generic)
newRemoveAttributesResponse ::
Prelude.Int ->
AttributesResource ->
RemoveAttributesResponse
newRemoveAttributesResponse :: Int -> AttributesResource -> RemoveAttributesResponse
newRemoveAttributesResponse
Int
pHttpStatus_
AttributesResource
pAttributesResource_ =
RemoveAttributesResponse' :: Int -> AttributesResource -> RemoveAttributesResponse
RemoveAttributesResponse'
{ $sel:httpStatus:RemoveAttributesResponse' :: Int
httpStatus =
Int
pHttpStatus_,
$sel:attributesResource:RemoveAttributesResponse' :: AttributesResource
attributesResource = AttributesResource
pAttributesResource_
}
removeAttributesResponse_httpStatus :: Lens.Lens' RemoveAttributesResponse Prelude.Int
removeAttributesResponse_httpStatus :: (Int -> f Int)
-> RemoveAttributesResponse -> f RemoveAttributesResponse
removeAttributesResponse_httpStatus = (RemoveAttributesResponse -> Int)
-> (RemoveAttributesResponse -> Int -> RemoveAttributesResponse)
-> Lens RemoveAttributesResponse RemoveAttributesResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RemoveAttributesResponse' {Int
httpStatus :: Int
$sel:httpStatus:RemoveAttributesResponse' :: RemoveAttributesResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: RemoveAttributesResponse
s@RemoveAttributesResponse' {} Int
a -> RemoveAttributesResponse
s {$sel:httpStatus:RemoveAttributesResponse' :: Int
httpStatus = Int
a} :: RemoveAttributesResponse)
removeAttributesResponse_attributesResource :: Lens.Lens' RemoveAttributesResponse AttributesResource
removeAttributesResponse_attributesResource :: (AttributesResource -> f AttributesResource)
-> RemoveAttributesResponse -> f RemoveAttributesResponse
removeAttributesResponse_attributesResource = (RemoveAttributesResponse -> AttributesResource)
-> (RemoveAttributesResponse
-> AttributesResource -> RemoveAttributesResponse)
-> Lens
RemoveAttributesResponse
RemoveAttributesResponse
AttributesResource
AttributesResource
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RemoveAttributesResponse' {AttributesResource
attributesResource :: AttributesResource
$sel:attributesResource:RemoveAttributesResponse' :: RemoveAttributesResponse -> AttributesResource
attributesResource} -> AttributesResource
attributesResource) (\s :: RemoveAttributesResponse
s@RemoveAttributesResponse' {} AttributesResource
a -> RemoveAttributesResponse
s {$sel:attributesResource:RemoveAttributesResponse' :: AttributesResource
attributesResource = AttributesResource
a} :: RemoveAttributesResponse)
instance Prelude.NFData RemoveAttributesResponse