{-# 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.ChimeSdkVoice.GetSipRule
(
GetSipRule (..),
newGetSipRule,
getSipRule_sipRuleId,
GetSipRuleResponse (..),
newGetSipRuleResponse,
getSipRuleResponse_sipRule,
getSipRuleResponse_httpStatus,
)
where
import Amazonka.ChimeSdkVoice.Types
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data GetSipRule = GetSipRule'
{ GetSipRule -> Text
sipRuleId :: Prelude.Text
}
deriving (GetSipRule -> GetSipRule -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetSipRule -> GetSipRule -> Bool
$c/= :: GetSipRule -> GetSipRule -> Bool
== :: GetSipRule -> GetSipRule -> Bool
$c== :: GetSipRule -> GetSipRule -> Bool
Prelude.Eq, ReadPrec [GetSipRule]
ReadPrec GetSipRule
Int -> ReadS GetSipRule
ReadS [GetSipRule]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetSipRule]
$creadListPrec :: ReadPrec [GetSipRule]
readPrec :: ReadPrec GetSipRule
$creadPrec :: ReadPrec GetSipRule
readList :: ReadS [GetSipRule]
$creadList :: ReadS [GetSipRule]
readsPrec :: Int -> ReadS GetSipRule
$creadsPrec :: Int -> ReadS GetSipRule
Prelude.Read, Int -> GetSipRule -> ShowS
[GetSipRule] -> ShowS
GetSipRule -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetSipRule] -> ShowS
$cshowList :: [GetSipRule] -> ShowS
show :: GetSipRule -> String
$cshow :: GetSipRule -> String
showsPrec :: Int -> GetSipRule -> ShowS
$cshowsPrec :: Int -> GetSipRule -> ShowS
Prelude.Show, forall x. Rep GetSipRule x -> GetSipRule
forall x. GetSipRule -> Rep GetSipRule x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetSipRule x -> GetSipRule
$cfrom :: forall x. GetSipRule -> Rep GetSipRule x
Prelude.Generic)
newGetSipRule ::
Prelude.Text ->
GetSipRule
newGetSipRule :: Text -> GetSipRule
newGetSipRule Text
pSipRuleId_ =
GetSipRule' {$sel:sipRuleId:GetSipRule' :: Text
sipRuleId = Text
pSipRuleId_}
getSipRule_sipRuleId :: Lens.Lens' GetSipRule Prelude.Text
getSipRule_sipRuleId :: Lens' GetSipRule Text
getSipRule_sipRuleId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetSipRule' {Text
sipRuleId :: Text
$sel:sipRuleId:GetSipRule' :: GetSipRule -> Text
sipRuleId} -> Text
sipRuleId) (\s :: GetSipRule
s@GetSipRule' {} Text
a -> GetSipRule
s {$sel:sipRuleId:GetSipRule' :: Text
sipRuleId = Text
a} :: GetSipRule)
instance Core.AWSRequest GetSipRule where
type AWSResponse GetSipRule = GetSipRuleResponse
request :: (Service -> Service) -> GetSipRule -> Request GetSipRule
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 GetSipRule
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetSipRule)))
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 ->
Maybe SipRule -> Int -> GetSipRuleResponse
GetSipRuleResponse'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"SipRule")
forall (f :: * -> *) a b. Applicative f => 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))
)
instance Prelude.Hashable GetSipRule where
hashWithSalt :: Int -> GetSipRule -> Int
hashWithSalt Int
_salt GetSipRule' {Text
sipRuleId :: Text
$sel:sipRuleId:GetSipRule' :: GetSipRule -> Text
..} =
Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
sipRuleId
instance Prelude.NFData GetSipRule where
rnf :: GetSipRule -> ()
rnf GetSipRule' {Text
sipRuleId :: Text
$sel:sipRuleId:GetSipRule' :: GetSipRule -> Text
..} = forall a. NFData a => a -> ()
Prelude.rnf Text
sipRuleId
instance Data.ToHeaders GetSipRule where
toHeaders :: GetSipRule -> ResponseHeaders
toHeaders = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
instance Data.ToPath GetSipRule where
toPath :: GetSipRule -> ByteString
toPath GetSipRule' {Text
sipRuleId :: Text
$sel:sipRuleId:GetSipRule' :: GetSipRule -> Text
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ByteString
"/sip-rules/", forall a. ToByteString a => a -> ByteString
Data.toBS Text
sipRuleId]
instance Data.ToQuery GetSipRule where
toQuery :: GetSipRule -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data GetSipRuleResponse = GetSipRuleResponse'
{ GetSipRuleResponse -> Maybe SipRule
sipRule :: Prelude.Maybe SipRule,
GetSipRuleResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetSipRuleResponse -> GetSipRuleResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetSipRuleResponse -> GetSipRuleResponse -> Bool
$c/= :: GetSipRuleResponse -> GetSipRuleResponse -> Bool
== :: GetSipRuleResponse -> GetSipRuleResponse -> Bool
$c== :: GetSipRuleResponse -> GetSipRuleResponse -> Bool
Prelude.Eq, ReadPrec [GetSipRuleResponse]
ReadPrec GetSipRuleResponse
Int -> ReadS GetSipRuleResponse
ReadS [GetSipRuleResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetSipRuleResponse]
$creadListPrec :: ReadPrec [GetSipRuleResponse]
readPrec :: ReadPrec GetSipRuleResponse
$creadPrec :: ReadPrec GetSipRuleResponse
readList :: ReadS [GetSipRuleResponse]
$creadList :: ReadS [GetSipRuleResponse]
readsPrec :: Int -> ReadS GetSipRuleResponse
$creadsPrec :: Int -> ReadS GetSipRuleResponse
Prelude.Read, Int -> GetSipRuleResponse -> ShowS
[GetSipRuleResponse] -> ShowS
GetSipRuleResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetSipRuleResponse] -> ShowS
$cshowList :: [GetSipRuleResponse] -> ShowS
show :: GetSipRuleResponse -> String
$cshow :: GetSipRuleResponse -> String
showsPrec :: Int -> GetSipRuleResponse -> ShowS
$cshowsPrec :: Int -> GetSipRuleResponse -> ShowS
Prelude.Show, forall x. Rep GetSipRuleResponse x -> GetSipRuleResponse
forall x. GetSipRuleResponse -> Rep GetSipRuleResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetSipRuleResponse x -> GetSipRuleResponse
$cfrom :: forall x. GetSipRuleResponse -> Rep GetSipRuleResponse x
Prelude.Generic)
newGetSipRuleResponse ::
Prelude.Int ->
GetSipRuleResponse
newGetSipRuleResponse :: Int -> GetSipRuleResponse
newGetSipRuleResponse Int
pHttpStatus_ =
GetSipRuleResponse'
{ $sel:sipRule:GetSipRuleResponse' :: Maybe SipRule
sipRule = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetSipRuleResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getSipRuleResponse_sipRule :: Lens.Lens' GetSipRuleResponse (Prelude.Maybe SipRule)
getSipRuleResponse_sipRule :: Lens' GetSipRuleResponse (Maybe SipRule)
getSipRuleResponse_sipRule = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetSipRuleResponse' {Maybe SipRule
sipRule :: Maybe SipRule
$sel:sipRule:GetSipRuleResponse' :: GetSipRuleResponse -> Maybe SipRule
sipRule} -> Maybe SipRule
sipRule) (\s :: GetSipRuleResponse
s@GetSipRuleResponse' {} Maybe SipRule
a -> GetSipRuleResponse
s {$sel:sipRule:GetSipRuleResponse' :: Maybe SipRule
sipRule = Maybe SipRule
a} :: GetSipRuleResponse)
getSipRuleResponse_httpStatus :: Lens.Lens' GetSipRuleResponse Prelude.Int
getSipRuleResponse_httpStatus :: Lens' GetSipRuleResponse Int
getSipRuleResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetSipRuleResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetSipRuleResponse' :: GetSipRuleResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetSipRuleResponse
s@GetSipRuleResponse' {} Int
a -> GetSipRuleResponse
s {$sel:httpStatus:GetSipRuleResponse' :: Int
httpStatus = Int
a} :: GetSipRuleResponse)
instance Prelude.NFData GetSipRuleResponse where
rnf :: GetSipRuleResponse -> ()
rnf GetSipRuleResponse' {Int
Maybe SipRule
httpStatus :: Int
sipRule :: Maybe SipRule
$sel:httpStatus:GetSipRuleResponse' :: GetSipRuleResponse -> Int
$sel:sipRule:GetSipRuleResponse' :: GetSipRuleResponse -> Maybe SipRule
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe SipRule
sipRule
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus