{-# 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.GetSegmentVersion
(
GetSegmentVersion (..),
newGetSegmentVersion,
getSegmentVersion_segmentId,
getSegmentVersion_version,
getSegmentVersion_applicationId,
GetSegmentVersionResponse (..),
newGetSegmentVersionResponse,
getSegmentVersionResponse_httpStatus,
getSegmentVersionResponse_segmentResponse,
)
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 GetSegmentVersion = GetSegmentVersion'
{
GetSegmentVersion -> Text
segmentId :: Prelude.Text,
GetSegmentVersion -> Text
version :: Prelude.Text,
GetSegmentVersion -> Text
applicationId :: Prelude.Text
}
deriving (GetSegmentVersion -> GetSegmentVersion -> Bool
(GetSegmentVersion -> GetSegmentVersion -> Bool)
-> (GetSegmentVersion -> GetSegmentVersion -> Bool)
-> Eq GetSegmentVersion
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetSegmentVersion -> GetSegmentVersion -> Bool
$c/= :: GetSegmentVersion -> GetSegmentVersion -> Bool
== :: GetSegmentVersion -> GetSegmentVersion -> Bool
$c== :: GetSegmentVersion -> GetSegmentVersion -> Bool
Prelude.Eq, ReadPrec [GetSegmentVersion]
ReadPrec GetSegmentVersion
Int -> ReadS GetSegmentVersion
ReadS [GetSegmentVersion]
(Int -> ReadS GetSegmentVersion)
-> ReadS [GetSegmentVersion]
-> ReadPrec GetSegmentVersion
-> ReadPrec [GetSegmentVersion]
-> Read GetSegmentVersion
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetSegmentVersion]
$creadListPrec :: ReadPrec [GetSegmentVersion]
readPrec :: ReadPrec GetSegmentVersion
$creadPrec :: ReadPrec GetSegmentVersion
readList :: ReadS [GetSegmentVersion]
$creadList :: ReadS [GetSegmentVersion]
readsPrec :: Int -> ReadS GetSegmentVersion
$creadsPrec :: Int -> ReadS GetSegmentVersion
Prelude.Read, Int -> GetSegmentVersion -> ShowS
[GetSegmentVersion] -> ShowS
GetSegmentVersion -> String
(Int -> GetSegmentVersion -> ShowS)
-> (GetSegmentVersion -> String)
-> ([GetSegmentVersion] -> ShowS)
-> Show GetSegmentVersion
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetSegmentVersion] -> ShowS
$cshowList :: [GetSegmentVersion] -> ShowS
show :: GetSegmentVersion -> String
$cshow :: GetSegmentVersion -> String
showsPrec :: Int -> GetSegmentVersion -> ShowS
$cshowsPrec :: Int -> GetSegmentVersion -> ShowS
Prelude.Show, (forall x. GetSegmentVersion -> Rep GetSegmentVersion x)
-> (forall x. Rep GetSegmentVersion x -> GetSegmentVersion)
-> Generic GetSegmentVersion
forall x. Rep GetSegmentVersion x -> GetSegmentVersion
forall x. GetSegmentVersion -> Rep GetSegmentVersion x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetSegmentVersion x -> GetSegmentVersion
$cfrom :: forall x. GetSegmentVersion -> Rep GetSegmentVersion x
Prelude.Generic)
newGetSegmentVersion ::
Prelude.Text ->
Prelude.Text ->
Prelude.Text ->
GetSegmentVersion
newGetSegmentVersion :: Text -> Text -> Text -> GetSegmentVersion
newGetSegmentVersion
Text
pSegmentId_
Text
pVersion_
Text
pApplicationId_ =
GetSegmentVersion' :: Text -> Text -> Text -> GetSegmentVersion
GetSegmentVersion'
{ $sel:segmentId:GetSegmentVersion' :: Text
segmentId = Text
pSegmentId_,
$sel:version:GetSegmentVersion' :: Text
version = Text
pVersion_,
$sel:applicationId:GetSegmentVersion' :: Text
applicationId = Text
pApplicationId_
}
getSegmentVersion_segmentId :: Lens.Lens' GetSegmentVersion Prelude.Text
getSegmentVersion_segmentId :: (Text -> f Text) -> GetSegmentVersion -> f GetSegmentVersion
getSegmentVersion_segmentId = (GetSegmentVersion -> Text)
-> (GetSegmentVersion -> Text -> GetSegmentVersion)
-> Lens GetSegmentVersion GetSegmentVersion Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetSegmentVersion' {Text
segmentId :: Text
$sel:segmentId:GetSegmentVersion' :: GetSegmentVersion -> Text
segmentId} -> Text
segmentId) (\s :: GetSegmentVersion
s@GetSegmentVersion' {} Text
a -> GetSegmentVersion
s {$sel:segmentId:GetSegmentVersion' :: Text
segmentId = Text
a} :: GetSegmentVersion)
getSegmentVersion_version :: Lens.Lens' GetSegmentVersion Prelude.Text
getSegmentVersion_version :: (Text -> f Text) -> GetSegmentVersion -> f GetSegmentVersion
getSegmentVersion_version = (GetSegmentVersion -> Text)
-> (GetSegmentVersion -> Text -> GetSegmentVersion)
-> Lens GetSegmentVersion GetSegmentVersion Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetSegmentVersion' {Text
version :: Text
$sel:version:GetSegmentVersion' :: GetSegmentVersion -> Text
version} -> Text
version) (\s :: GetSegmentVersion
s@GetSegmentVersion' {} Text
a -> GetSegmentVersion
s {$sel:version:GetSegmentVersion' :: Text
version = Text
a} :: GetSegmentVersion)
getSegmentVersion_applicationId :: Lens.Lens' GetSegmentVersion Prelude.Text
getSegmentVersion_applicationId :: (Text -> f Text) -> GetSegmentVersion -> f GetSegmentVersion
getSegmentVersion_applicationId = (GetSegmentVersion -> Text)
-> (GetSegmentVersion -> Text -> GetSegmentVersion)
-> Lens GetSegmentVersion GetSegmentVersion Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetSegmentVersion' {Text
applicationId :: Text
$sel:applicationId:GetSegmentVersion' :: GetSegmentVersion -> Text
applicationId} -> Text
applicationId) (\s :: GetSegmentVersion
s@GetSegmentVersion' {} Text
a -> GetSegmentVersion
s {$sel:applicationId:GetSegmentVersion' :: Text
applicationId = Text
a} :: GetSegmentVersion)
instance Core.AWSRequest GetSegmentVersion where
type
AWSResponse GetSegmentVersion =
GetSegmentVersionResponse
request :: GetSegmentVersion -> Request GetSegmentVersion
request = Service -> GetSegmentVersion -> Request GetSegmentVersion
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
response :: Logger
-> Service
-> Proxy GetSegmentVersion
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetSegmentVersion)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetSegmentVersion))
-> Logger
-> Service
-> Proxy GetSegmentVersion
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetSegmentVersion)))
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 -> SegmentResponse -> GetSegmentVersionResponse
GetSegmentVersionResponse'
(Int -> SegmentResponse -> GetSegmentVersionResponse)
-> Either String Int
-> Either String (SegmentResponse -> GetSegmentVersionResponse)
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 (SegmentResponse -> GetSegmentVersionResponse)
-> Either String SegmentResponse
-> Either String GetSegmentVersionResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object -> Either String SegmentResponse
forall a. FromJSON a => Object -> Either String a
Core.eitherParseJSON Object
x)
)
instance Prelude.Hashable GetSegmentVersion
instance Prelude.NFData GetSegmentVersion
instance Core.ToHeaders GetSegmentVersion where
toHeaders :: GetSegmentVersion -> ResponseHeaders
toHeaders =
ResponseHeaders -> GetSegmentVersion -> 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.ToPath GetSegmentVersion where
toPath :: GetSegmentVersion -> ByteString
toPath GetSegmentVersion' {Text
applicationId :: Text
version :: Text
segmentId :: Text
$sel:applicationId:GetSegmentVersion' :: GetSegmentVersion -> Text
$sel:version:GetSegmentVersion' :: GetSegmentVersion -> Text
$sel:segmentId:GetSegmentVersion' :: GetSegmentVersion -> 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
"/segments/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
segmentId,
ByteString
"/versions/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
version
]
instance Core.ToQuery GetSegmentVersion where
toQuery :: GetSegmentVersion -> QueryString
toQuery = QueryString -> GetSegmentVersion -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data GetSegmentVersionResponse = GetSegmentVersionResponse'
{
GetSegmentVersionResponse -> Int
httpStatus :: Prelude.Int,
GetSegmentVersionResponse -> SegmentResponse
segmentResponse :: SegmentResponse
}
deriving (GetSegmentVersionResponse -> GetSegmentVersionResponse -> Bool
(GetSegmentVersionResponse -> GetSegmentVersionResponse -> Bool)
-> (GetSegmentVersionResponse -> GetSegmentVersionResponse -> Bool)
-> Eq GetSegmentVersionResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetSegmentVersionResponse -> GetSegmentVersionResponse -> Bool
$c/= :: GetSegmentVersionResponse -> GetSegmentVersionResponse -> Bool
== :: GetSegmentVersionResponse -> GetSegmentVersionResponse -> Bool
$c== :: GetSegmentVersionResponse -> GetSegmentVersionResponse -> Bool
Prelude.Eq, ReadPrec [GetSegmentVersionResponse]
ReadPrec GetSegmentVersionResponse
Int -> ReadS GetSegmentVersionResponse
ReadS [GetSegmentVersionResponse]
(Int -> ReadS GetSegmentVersionResponse)
-> ReadS [GetSegmentVersionResponse]
-> ReadPrec GetSegmentVersionResponse
-> ReadPrec [GetSegmentVersionResponse]
-> Read GetSegmentVersionResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetSegmentVersionResponse]
$creadListPrec :: ReadPrec [GetSegmentVersionResponse]
readPrec :: ReadPrec GetSegmentVersionResponse
$creadPrec :: ReadPrec GetSegmentVersionResponse
readList :: ReadS [GetSegmentVersionResponse]
$creadList :: ReadS [GetSegmentVersionResponse]
readsPrec :: Int -> ReadS GetSegmentVersionResponse
$creadsPrec :: Int -> ReadS GetSegmentVersionResponse
Prelude.Read, Int -> GetSegmentVersionResponse -> ShowS
[GetSegmentVersionResponse] -> ShowS
GetSegmentVersionResponse -> String
(Int -> GetSegmentVersionResponse -> ShowS)
-> (GetSegmentVersionResponse -> String)
-> ([GetSegmentVersionResponse] -> ShowS)
-> Show GetSegmentVersionResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetSegmentVersionResponse] -> ShowS
$cshowList :: [GetSegmentVersionResponse] -> ShowS
show :: GetSegmentVersionResponse -> String
$cshow :: GetSegmentVersionResponse -> String
showsPrec :: Int -> GetSegmentVersionResponse -> ShowS
$cshowsPrec :: Int -> GetSegmentVersionResponse -> ShowS
Prelude.Show, (forall x.
GetSegmentVersionResponse -> Rep GetSegmentVersionResponse x)
-> (forall x.
Rep GetSegmentVersionResponse x -> GetSegmentVersionResponse)
-> Generic GetSegmentVersionResponse
forall x.
Rep GetSegmentVersionResponse x -> GetSegmentVersionResponse
forall x.
GetSegmentVersionResponse -> Rep GetSegmentVersionResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetSegmentVersionResponse x -> GetSegmentVersionResponse
$cfrom :: forall x.
GetSegmentVersionResponse -> Rep GetSegmentVersionResponse x
Prelude.Generic)
newGetSegmentVersionResponse ::
Prelude.Int ->
SegmentResponse ->
GetSegmentVersionResponse
newGetSegmentVersionResponse :: Int -> SegmentResponse -> GetSegmentVersionResponse
newGetSegmentVersionResponse
Int
pHttpStatus_
SegmentResponse
pSegmentResponse_ =
GetSegmentVersionResponse' :: Int -> SegmentResponse -> GetSegmentVersionResponse
GetSegmentVersionResponse'
{ $sel:httpStatus:GetSegmentVersionResponse' :: Int
httpStatus =
Int
pHttpStatus_,
$sel:segmentResponse:GetSegmentVersionResponse' :: SegmentResponse
segmentResponse = SegmentResponse
pSegmentResponse_
}
getSegmentVersionResponse_httpStatus :: Lens.Lens' GetSegmentVersionResponse Prelude.Int
getSegmentVersionResponse_httpStatus :: (Int -> f Int)
-> GetSegmentVersionResponse -> f GetSegmentVersionResponse
getSegmentVersionResponse_httpStatus = (GetSegmentVersionResponse -> Int)
-> (GetSegmentVersionResponse -> Int -> GetSegmentVersionResponse)
-> Lens GetSegmentVersionResponse GetSegmentVersionResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetSegmentVersionResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetSegmentVersionResponse' :: GetSegmentVersionResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetSegmentVersionResponse
s@GetSegmentVersionResponse' {} Int
a -> GetSegmentVersionResponse
s {$sel:httpStatus:GetSegmentVersionResponse' :: Int
httpStatus = Int
a} :: GetSegmentVersionResponse)
getSegmentVersionResponse_segmentResponse :: Lens.Lens' GetSegmentVersionResponse SegmentResponse
getSegmentVersionResponse_segmentResponse :: (SegmentResponse -> f SegmentResponse)
-> GetSegmentVersionResponse -> f GetSegmentVersionResponse
getSegmentVersionResponse_segmentResponse = (GetSegmentVersionResponse -> SegmentResponse)
-> (GetSegmentVersionResponse
-> SegmentResponse -> GetSegmentVersionResponse)
-> Lens
GetSegmentVersionResponse
GetSegmentVersionResponse
SegmentResponse
SegmentResponse
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetSegmentVersionResponse' {SegmentResponse
segmentResponse :: SegmentResponse
$sel:segmentResponse:GetSegmentVersionResponse' :: GetSegmentVersionResponse -> SegmentResponse
segmentResponse} -> SegmentResponse
segmentResponse) (\s :: GetSegmentVersionResponse
s@GetSegmentVersionResponse' {} SegmentResponse
a -> GetSegmentVersionResponse
s {$sel:segmentResponse:GetSegmentVersionResponse' :: SegmentResponse
segmentResponse = SegmentResponse
a} :: GetSegmentVersionResponse)
instance Prelude.NFData GetSegmentVersionResponse