{-# 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.Evidently.GetSegment
(
GetSegment (..),
newGetSegment,
getSegment_segment,
GetSegmentResponse (..),
newGetSegmentResponse,
getSegmentResponse_httpStatus,
getSegmentResponse_segment,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.Evidently.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data GetSegment = GetSegment'
{
GetSegment -> Text
segment :: Prelude.Text
}
deriving (GetSegment -> GetSegment -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetSegment -> GetSegment -> Bool
$c/= :: GetSegment -> GetSegment -> Bool
== :: GetSegment -> GetSegment -> Bool
$c== :: GetSegment -> GetSegment -> Bool
Prelude.Eq, ReadPrec [GetSegment]
ReadPrec GetSegment
Int -> ReadS GetSegment
ReadS [GetSegment]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetSegment]
$creadListPrec :: ReadPrec [GetSegment]
readPrec :: ReadPrec GetSegment
$creadPrec :: ReadPrec GetSegment
readList :: ReadS [GetSegment]
$creadList :: ReadS [GetSegment]
readsPrec :: Int -> ReadS GetSegment
$creadsPrec :: Int -> ReadS GetSegment
Prelude.Read, Int -> GetSegment -> ShowS
[GetSegment] -> ShowS
GetSegment -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetSegment] -> ShowS
$cshowList :: [GetSegment] -> ShowS
show :: GetSegment -> String
$cshow :: GetSegment -> String
showsPrec :: Int -> GetSegment -> ShowS
$cshowsPrec :: Int -> GetSegment -> ShowS
Prelude.Show, forall x. Rep GetSegment x -> GetSegment
forall x. GetSegment -> Rep GetSegment x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetSegment x -> GetSegment
$cfrom :: forall x. GetSegment -> Rep GetSegment x
Prelude.Generic)
newGetSegment ::
Prelude.Text ->
GetSegment
newGetSegment :: Text -> GetSegment
newGetSegment Text
pSegment_ =
GetSegment' {$sel:segment:GetSegment' :: Text
segment = Text
pSegment_}
getSegment_segment :: Lens.Lens' GetSegment Prelude.Text
getSegment_segment :: Lens' GetSegment Text
getSegment_segment = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetSegment' {Text
segment :: Text
$sel:segment:GetSegment' :: GetSegment -> Text
segment} -> Text
segment) (\s :: GetSegment
s@GetSegment' {} Text
a -> GetSegment
s {$sel:segment:GetSegment' :: Text
segment = Text
a} :: GetSegment)
instance Core.AWSRequest GetSegment where
type AWSResponse GetSegment = GetSegmentResponse
request :: (Service -> Service) -> GetSegment -> Request GetSegment
request Service -> Service
overrides =
forall a. ToRequest a => Service -> a -> Request a
Request.get (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy GetSegment
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetSegment)))
response =
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Int -> Segment -> GetSegmentResponse
GetSegmentResponse'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String a
Data..:> Key
"segment")
)
instance Prelude.Hashable GetSegment where
hashWithSalt :: Int -> GetSegment -> Int
hashWithSalt Int
_salt GetSegment' {Text
segment :: Text
$sel:segment:GetSegment' :: GetSegment -> Text
..} =
Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
segment
instance Prelude.NFData GetSegment where
rnf :: GetSegment -> ()
rnf GetSegment' {Text
segment :: Text
$sel:segment:GetSegment' :: GetSegment -> Text
..} = forall a. NFData a => a -> ()
Prelude.rnf Text
segment
instance Data.ToHeaders GetSegment where
toHeaders :: GetSegment -> ResponseHeaders
toHeaders =
forall a b. a -> b -> a
Prelude.const
( forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Data.ToPath GetSegment where
toPath :: GetSegment -> ByteString
toPath GetSegment' {Text
segment :: Text
$sel:segment:GetSegment' :: GetSegment -> Text
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat [ByteString
"/segments/", forall a. ToByteString a => a -> ByteString
Data.toBS Text
segment]
instance Data.ToQuery GetSegment where
toQuery :: GetSegment -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data GetSegmentResponse = GetSegmentResponse'
{
GetSegmentResponse -> Int
httpStatus :: Prelude.Int,
GetSegmentResponse -> Segment
segment :: Segment
}
deriving (GetSegmentResponse -> GetSegmentResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetSegmentResponse -> GetSegmentResponse -> Bool
$c/= :: GetSegmentResponse -> GetSegmentResponse -> Bool
== :: GetSegmentResponse -> GetSegmentResponse -> Bool
$c== :: GetSegmentResponse -> GetSegmentResponse -> Bool
Prelude.Eq, ReadPrec [GetSegmentResponse]
ReadPrec GetSegmentResponse
Int -> ReadS GetSegmentResponse
ReadS [GetSegmentResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetSegmentResponse]
$creadListPrec :: ReadPrec [GetSegmentResponse]
readPrec :: ReadPrec GetSegmentResponse
$creadPrec :: ReadPrec GetSegmentResponse
readList :: ReadS [GetSegmentResponse]
$creadList :: ReadS [GetSegmentResponse]
readsPrec :: Int -> ReadS GetSegmentResponse
$creadsPrec :: Int -> ReadS GetSegmentResponse
Prelude.Read, Int -> GetSegmentResponse -> ShowS
[GetSegmentResponse] -> ShowS
GetSegmentResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetSegmentResponse] -> ShowS
$cshowList :: [GetSegmentResponse] -> ShowS
show :: GetSegmentResponse -> String
$cshow :: GetSegmentResponse -> String
showsPrec :: Int -> GetSegmentResponse -> ShowS
$cshowsPrec :: Int -> GetSegmentResponse -> ShowS
Prelude.Show, forall x. Rep GetSegmentResponse x -> GetSegmentResponse
forall x. GetSegmentResponse -> Rep GetSegmentResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetSegmentResponse x -> GetSegmentResponse
$cfrom :: forall x. GetSegmentResponse -> Rep GetSegmentResponse x
Prelude.Generic)
newGetSegmentResponse ::
Prelude.Int ->
Segment ->
GetSegmentResponse
newGetSegmentResponse :: Int -> Segment -> GetSegmentResponse
newGetSegmentResponse Int
pHttpStatus_ Segment
pSegment_ =
GetSegmentResponse'
{ $sel:httpStatus:GetSegmentResponse' :: Int
httpStatus = Int
pHttpStatus_,
$sel:segment:GetSegmentResponse' :: Segment
segment = Segment
pSegment_
}
getSegmentResponse_httpStatus :: Lens.Lens' GetSegmentResponse Prelude.Int
getSegmentResponse_httpStatus :: Lens' GetSegmentResponse Int
getSegmentResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetSegmentResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetSegmentResponse' :: GetSegmentResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetSegmentResponse
s@GetSegmentResponse' {} Int
a -> GetSegmentResponse
s {$sel:httpStatus:GetSegmentResponse' :: Int
httpStatus = Int
a} :: GetSegmentResponse)
getSegmentResponse_segment :: Lens.Lens' GetSegmentResponse Segment
getSegmentResponse_segment :: Lens' GetSegmentResponse Segment
getSegmentResponse_segment = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetSegmentResponse' {Segment
segment :: Segment
$sel:segment:GetSegmentResponse' :: GetSegmentResponse -> Segment
segment} -> Segment
segment) (\s :: GetSegmentResponse
s@GetSegmentResponse' {} Segment
a -> GetSegmentResponse
s {$sel:segment:GetSegmentResponse' :: Segment
segment = Segment
a} :: GetSegmentResponse)
instance Prelude.NFData GetSegmentResponse where
rnf :: GetSegmentResponse -> ()
rnf GetSegmentResponse' {Int
Segment
segment :: Segment
httpStatus :: Int
$sel:segment:GetSegmentResponse' :: GetSegmentResponse -> Segment
$sel:httpStatus:GetSegmentResponse' :: GetSegmentResponse -> Int
..} =
forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Segment
segment