{-# 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.Location.AssociateTrackerConsumer
(
AssociateTrackerConsumer (..),
newAssociateTrackerConsumer,
associateTrackerConsumer_consumerArn,
associateTrackerConsumer_trackerName,
AssociateTrackerConsumerResponse (..),
newAssociateTrackerConsumerResponse,
associateTrackerConsumerResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.Location.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data AssociateTrackerConsumer = AssociateTrackerConsumer'
{
AssociateTrackerConsumer -> Text
consumerArn :: Prelude.Text,
AssociateTrackerConsumer -> Text
trackerName :: Prelude.Text
}
deriving (AssociateTrackerConsumer -> AssociateTrackerConsumer -> Bool
(AssociateTrackerConsumer -> AssociateTrackerConsumer -> Bool)
-> (AssociateTrackerConsumer -> AssociateTrackerConsumer -> Bool)
-> Eq AssociateTrackerConsumer
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AssociateTrackerConsumer -> AssociateTrackerConsumer -> Bool
$c/= :: AssociateTrackerConsumer -> AssociateTrackerConsumer -> Bool
== :: AssociateTrackerConsumer -> AssociateTrackerConsumer -> Bool
$c== :: AssociateTrackerConsumer -> AssociateTrackerConsumer -> Bool
Prelude.Eq, ReadPrec [AssociateTrackerConsumer]
ReadPrec AssociateTrackerConsumer
Int -> ReadS AssociateTrackerConsumer
ReadS [AssociateTrackerConsumer]
(Int -> ReadS AssociateTrackerConsumer)
-> ReadS [AssociateTrackerConsumer]
-> ReadPrec AssociateTrackerConsumer
-> ReadPrec [AssociateTrackerConsumer]
-> Read AssociateTrackerConsumer
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AssociateTrackerConsumer]
$creadListPrec :: ReadPrec [AssociateTrackerConsumer]
readPrec :: ReadPrec AssociateTrackerConsumer
$creadPrec :: ReadPrec AssociateTrackerConsumer
readList :: ReadS [AssociateTrackerConsumer]
$creadList :: ReadS [AssociateTrackerConsumer]
readsPrec :: Int -> ReadS AssociateTrackerConsumer
$creadsPrec :: Int -> ReadS AssociateTrackerConsumer
Prelude.Read, Int -> AssociateTrackerConsumer -> ShowS
[AssociateTrackerConsumer] -> ShowS
AssociateTrackerConsumer -> String
(Int -> AssociateTrackerConsumer -> ShowS)
-> (AssociateTrackerConsumer -> String)
-> ([AssociateTrackerConsumer] -> ShowS)
-> Show AssociateTrackerConsumer
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AssociateTrackerConsumer] -> ShowS
$cshowList :: [AssociateTrackerConsumer] -> ShowS
show :: AssociateTrackerConsumer -> String
$cshow :: AssociateTrackerConsumer -> String
showsPrec :: Int -> AssociateTrackerConsumer -> ShowS
$cshowsPrec :: Int -> AssociateTrackerConsumer -> ShowS
Prelude.Show, (forall x.
AssociateTrackerConsumer -> Rep AssociateTrackerConsumer x)
-> (forall x.
Rep AssociateTrackerConsumer x -> AssociateTrackerConsumer)
-> Generic AssociateTrackerConsumer
forall x.
Rep AssociateTrackerConsumer x -> AssociateTrackerConsumer
forall x.
AssociateTrackerConsumer -> Rep AssociateTrackerConsumer x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AssociateTrackerConsumer x -> AssociateTrackerConsumer
$cfrom :: forall x.
AssociateTrackerConsumer -> Rep AssociateTrackerConsumer x
Prelude.Generic)
newAssociateTrackerConsumer ::
Prelude.Text ->
Prelude.Text ->
AssociateTrackerConsumer
newAssociateTrackerConsumer :: Text -> Text -> AssociateTrackerConsumer
newAssociateTrackerConsumer
Text
pConsumerArn_
Text
pTrackerName_ =
AssociateTrackerConsumer' :: Text -> Text -> AssociateTrackerConsumer
AssociateTrackerConsumer'
{ $sel:consumerArn:AssociateTrackerConsumer' :: Text
consumerArn =
Text
pConsumerArn_,
$sel:trackerName:AssociateTrackerConsumer' :: Text
trackerName = Text
pTrackerName_
}
associateTrackerConsumer_consumerArn :: Lens.Lens' AssociateTrackerConsumer Prelude.Text
associateTrackerConsumer_consumerArn :: (Text -> f Text)
-> AssociateTrackerConsumer -> f AssociateTrackerConsumer
associateTrackerConsumer_consumerArn = (AssociateTrackerConsumer -> Text)
-> (AssociateTrackerConsumer -> Text -> AssociateTrackerConsumer)
-> Lens AssociateTrackerConsumer AssociateTrackerConsumer Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociateTrackerConsumer' {Text
consumerArn :: Text
$sel:consumerArn:AssociateTrackerConsumer' :: AssociateTrackerConsumer -> Text
consumerArn} -> Text
consumerArn) (\s :: AssociateTrackerConsumer
s@AssociateTrackerConsumer' {} Text
a -> AssociateTrackerConsumer
s {$sel:consumerArn:AssociateTrackerConsumer' :: Text
consumerArn = Text
a} :: AssociateTrackerConsumer)
associateTrackerConsumer_trackerName :: Lens.Lens' AssociateTrackerConsumer Prelude.Text
associateTrackerConsumer_trackerName :: (Text -> f Text)
-> AssociateTrackerConsumer -> f AssociateTrackerConsumer
associateTrackerConsumer_trackerName = (AssociateTrackerConsumer -> Text)
-> (AssociateTrackerConsumer -> Text -> AssociateTrackerConsumer)
-> Lens AssociateTrackerConsumer AssociateTrackerConsumer Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociateTrackerConsumer' {Text
trackerName :: Text
$sel:trackerName:AssociateTrackerConsumer' :: AssociateTrackerConsumer -> Text
trackerName} -> Text
trackerName) (\s :: AssociateTrackerConsumer
s@AssociateTrackerConsumer' {} Text
a -> AssociateTrackerConsumer
s {$sel:trackerName:AssociateTrackerConsumer' :: Text
trackerName = Text
a} :: AssociateTrackerConsumer)
instance Core.AWSRequest AssociateTrackerConsumer where
type
AWSResponse AssociateTrackerConsumer =
AssociateTrackerConsumerResponse
request :: AssociateTrackerConsumer -> Request AssociateTrackerConsumer
request = Service
-> AssociateTrackerConsumer -> Request AssociateTrackerConsumer
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy AssociateTrackerConsumer
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse AssociateTrackerConsumer)))
response =
(Int
-> ResponseHeaders
-> ()
-> Either String (AWSResponse AssociateTrackerConsumer))
-> Logger
-> Service
-> Proxy AssociateTrackerConsumer
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse AssociateTrackerConsumer)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
( \Int
s ResponseHeaders
h ()
x ->
Int -> AssociateTrackerConsumerResponse
AssociateTrackerConsumerResponse'
(Int -> AssociateTrackerConsumerResponse)
-> Either String Int
-> Either String AssociateTrackerConsumerResponse
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))
)
instance Prelude.Hashable AssociateTrackerConsumer
instance Prelude.NFData AssociateTrackerConsumer
instance Core.ToHeaders AssociateTrackerConsumer where
toHeaders :: AssociateTrackerConsumer -> ResponseHeaders
toHeaders =
ResponseHeaders -> AssociateTrackerConsumer -> 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 AssociateTrackerConsumer where
toJSON :: AssociateTrackerConsumer -> Value
toJSON AssociateTrackerConsumer' {Text
trackerName :: Text
consumerArn :: Text
$sel:trackerName:AssociateTrackerConsumer' :: AssociateTrackerConsumer -> Text
$sel:consumerArn:AssociateTrackerConsumer' :: AssociateTrackerConsumer -> 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
"ConsumerArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
consumerArn)]
)
instance Core.ToPath AssociateTrackerConsumer where
toPath :: AssociateTrackerConsumer -> ByteString
toPath AssociateTrackerConsumer' {Text
trackerName :: Text
consumerArn :: Text
$sel:trackerName:AssociateTrackerConsumer' :: AssociateTrackerConsumer -> Text
$sel:consumerArn:AssociateTrackerConsumer' :: AssociateTrackerConsumer -> Text
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"/tracking/v0/trackers/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
trackerName,
ByteString
"/consumers"
]
instance Core.ToQuery AssociateTrackerConsumer where
toQuery :: AssociateTrackerConsumer -> QueryString
toQuery = QueryString -> AssociateTrackerConsumer -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data AssociateTrackerConsumerResponse = AssociateTrackerConsumerResponse'
{
AssociateTrackerConsumerResponse -> Int
httpStatus :: Prelude.Int
}
deriving (AssociateTrackerConsumerResponse
-> AssociateTrackerConsumerResponse -> Bool
(AssociateTrackerConsumerResponse
-> AssociateTrackerConsumerResponse -> Bool)
-> (AssociateTrackerConsumerResponse
-> AssociateTrackerConsumerResponse -> Bool)
-> Eq AssociateTrackerConsumerResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AssociateTrackerConsumerResponse
-> AssociateTrackerConsumerResponse -> Bool
$c/= :: AssociateTrackerConsumerResponse
-> AssociateTrackerConsumerResponse -> Bool
== :: AssociateTrackerConsumerResponse
-> AssociateTrackerConsumerResponse -> Bool
$c== :: AssociateTrackerConsumerResponse
-> AssociateTrackerConsumerResponse -> Bool
Prelude.Eq, ReadPrec [AssociateTrackerConsumerResponse]
ReadPrec AssociateTrackerConsumerResponse
Int -> ReadS AssociateTrackerConsumerResponse
ReadS [AssociateTrackerConsumerResponse]
(Int -> ReadS AssociateTrackerConsumerResponse)
-> ReadS [AssociateTrackerConsumerResponse]
-> ReadPrec AssociateTrackerConsumerResponse
-> ReadPrec [AssociateTrackerConsumerResponse]
-> Read AssociateTrackerConsumerResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AssociateTrackerConsumerResponse]
$creadListPrec :: ReadPrec [AssociateTrackerConsumerResponse]
readPrec :: ReadPrec AssociateTrackerConsumerResponse
$creadPrec :: ReadPrec AssociateTrackerConsumerResponse
readList :: ReadS [AssociateTrackerConsumerResponse]
$creadList :: ReadS [AssociateTrackerConsumerResponse]
readsPrec :: Int -> ReadS AssociateTrackerConsumerResponse
$creadsPrec :: Int -> ReadS AssociateTrackerConsumerResponse
Prelude.Read, Int -> AssociateTrackerConsumerResponse -> ShowS
[AssociateTrackerConsumerResponse] -> ShowS
AssociateTrackerConsumerResponse -> String
(Int -> AssociateTrackerConsumerResponse -> ShowS)
-> (AssociateTrackerConsumerResponse -> String)
-> ([AssociateTrackerConsumerResponse] -> ShowS)
-> Show AssociateTrackerConsumerResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AssociateTrackerConsumerResponse] -> ShowS
$cshowList :: [AssociateTrackerConsumerResponse] -> ShowS
show :: AssociateTrackerConsumerResponse -> String
$cshow :: AssociateTrackerConsumerResponse -> String
showsPrec :: Int -> AssociateTrackerConsumerResponse -> ShowS
$cshowsPrec :: Int -> AssociateTrackerConsumerResponse -> ShowS
Prelude.Show, (forall x.
AssociateTrackerConsumerResponse
-> Rep AssociateTrackerConsumerResponse x)
-> (forall x.
Rep AssociateTrackerConsumerResponse x
-> AssociateTrackerConsumerResponse)
-> Generic AssociateTrackerConsumerResponse
forall x.
Rep AssociateTrackerConsumerResponse x
-> AssociateTrackerConsumerResponse
forall x.
AssociateTrackerConsumerResponse
-> Rep AssociateTrackerConsumerResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AssociateTrackerConsumerResponse x
-> AssociateTrackerConsumerResponse
$cfrom :: forall x.
AssociateTrackerConsumerResponse
-> Rep AssociateTrackerConsumerResponse x
Prelude.Generic)
newAssociateTrackerConsumerResponse ::
Prelude.Int ->
AssociateTrackerConsumerResponse
newAssociateTrackerConsumerResponse :: Int -> AssociateTrackerConsumerResponse
newAssociateTrackerConsumerResponse Int
pHttpStatus_ =
AssociateTrackerConsumerResponse' :: Int -> AssociateTrackerConsumerResponse
AssociateTrackerConsumerResponse'
{ $sel:httpStatus:AssociateTrackerConsumerResponse' :: Int
httpStatus =
Int
pHttpStatus_
}
associateTrackerConsumerResponse_httpStatus :: Lens.Lens' AssociateTrackerConsumerResponse Prelude.Int
associateTrackerConsumerResponse_httpStatus :: (Int -> f Int)
-> AssociateTrackerConsumerResponse
-> f AssociateTrackerConsumerResponse
associateTrackerConsumerResponse_httpStatus = (AssociateTrackerConsumerResponse -> Int)
-> (AssociateTrackerConsumerResponse
-> Int -> AssociateTrackerConsumerResponse)
-> Lens
AssociateTrackerConsumerResponse
AssociateTrackerConsumerResponse
Int
Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociateTrackerConsumerResponse' {Int
httpStatus :: Int
$sel:httpStatus:AssociateTrackerConsumerResponse' :: AssociateTrackerConsumerResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: AssociateTrackerConsumerResponse
s@AssociateTrackerConsumerResponse' {} Int
a -> AssociateTrackerConsumerResponse
s {$sel:httpStatus:AssociateTrackerConsumerResponse' :: Int
httpStatus = Int
a} :: AssociateTrackerConsumerResponse)
instance
Prelude.NFData
AssociateTrackerConsumerResponse