{-# 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.Chime.ListSipRules
(
ListSipRules (..),
newListSipRules,
listSipRules_nextToken,
listSipRules_maxResults,
listSipRules_sipMediaApplicationId,
ListSipRulesResponse (..),
newListSipRulesResponse,
listSipRulesResponse_nextToken,
listSipRulesResponse_sipRules,
listSipRulesResponse_httpStatus,
)
where
import Amazonka.Chime.Types
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data ListSipRules = ListSipRules'
{
ListSipRules -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListSipRules -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
ListSipRules -> Maybe Text
sipMediaApplicationId :: Prelude.Maybe Prelude.Text
}
deriving (ListSipRules -> ListSipRules -> Bool
(ListSipRules -> ListSipRules -> Bool)
-> (ListSipRules -> ListSipRules -> Bool) -> Eq ListSipRules
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListSipRules -> ListSipRules -> Bool
$c/= :: ListSipRules -> ListSipRules -> Bool
== :: ListSipRules -> ListSipRules -> Bool
$c== :: ListSipRules -> ListSipRules -> Bool
Prelude.Eq, ReadPrec [ListSipRules]
ReadPrec ListSipRules
Int -> ReadS ListSipRules
ReadS [ListSipRules]
(Int -> ReadS ListSipRules)
-> ReadS [ListSipRules]
-> ReadPrec ListSipRules
-> ReadPrec [ListSipRules]
-> Read ListSipRules
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListSipRules]
$creadListPrec :: ReadPrec [ListSipRules]
readPrec :: ReadPrec ListSipRules
$creadPrec :: ReadPrec ListSipRules
readList :: ReadS [ListSipRules]
$creadList :: ReadS [ListSipRules]
readsPrec :: Int -> ReadS ListSipRules
$creadsPrec :: Int -> ReadS ListSipRules
Prelude.Read, Int -> ListSipRules -> ShowS
[ListSipRules] -> ShowS
ListSipRules -> String
(Int -> ListSipRules -> ShowS)
-> (ListSipRules -> String)
-> ([ListSipRules] -> ShowS)
-> Show ListSipRules
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListSipRules] -> ShowS
$cshowList :: [ListSipRules] -> ShowS
show :: ListSipRules -> String
$cshow :: ListSipRules -> String
showsPrec :: Int -> ListSipRules -> ShowS
$cshowsPrec :: Int -> ListSipRules -> ShowS
Prelude.Show, (forall x. ListSipRules -> Rep ListSipRules x)
-> (forall x. Rep ListSipRules x -> ListSipRules)
-> Generic ListSipRules
forall x. Rep ListSipRules x -> ListSipRules
forall x. ListSipRules -> Rep ListSipRules x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListSipRules x -> ListSipRules
$cfrom :: forall x. ListSipRules -> Rep ListSipRules x
Prelude.Generic)
newListSipRules ::
ListSipRules
newListSipRules :: ListSipRules
newListSipRules =
ListSipRules' :: Maybe Text -> Maybe Natural -> Maybe Text -> ListSipRules
ListSipRules'
{ $sel:nextToken:ListSipRules' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:maxResults:ListSipRules' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
$sel:sipMediaApplicationId:ListSipRules' :: Maybe Text
sipMediaApplicationId = Maybe Text
forall a. Maybe a
Prelude.Nothing
}
listSipRules_nextToken :: Lens.Lens' ListSipRules (Prelude.Maybe Prelude.Text)
listSipRules_nextToken :: (Maybe Text -> f (Maybe Text)) -> ListSipRules -> f ListSipRules
listSipRules_nextToken = (ListSipRules -> Maybe Text)
-> (ListSipRules -> Maybe Text -> ListSipRules)
-> Lens ListSipRules ListSipRules (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListSipRules' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListSipRules' :: ListSipRules -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListSipRules
s@ListSipRules' {} Maybe Text
a -> ListSipRules
s {$sel:nextToken:ListSipRules' :: Maybe Text
nextToken = Maybe Text
a} :: ListSipRules)
listSipRules_maxResults :: Lens.Lens' ListSipRules (Prelude.Maybe Prelude.Natural)
listSipRules_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> ListSipRules -> f ListSipRules
listSipRules_maxResults = (ListSipRules -> Maybe Natural)
-> (ListSipRules -> Maybe Natural -> ListSipRules)
-> Lens ListSipRules ListSipRules (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListSipRules' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListSipRules' :: ListSipRules -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListSipRules
s@ListSipRules' {} Maybe Natural
a -> ListSipRules
s {$sel:maxResults:ListSipRules' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListSipRules)
listSipRules_sipMediaApplicationId :: Lens.Lens' ListSipRules (Prelude.Maybe Prelude.Text)
listSipRules_sipMediaApplicationId :: (Maybe Text -> f (Maybe Text)) -> ListSipRules -> f ListSipRules
listSipRules_sipMediaApplicationId = (ListSipRules -> Maybe Text)
-> (ListSipRules -> Maybe Text -> ListSipRules)
-> Lens ListSipRules ListSipRules (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListSipRules' {Maybe Text
sipMediaApplicationId :: Maybe Text
$sel:sipMediaApplicationId:ListSipRules' :: ListSipRules -> Maybe Text
sipMediaApplicationId} -> Maybe Text
sipMediaApplicationId) (\s :: ListSipRules
s@ListSipRules' {} Maybe Text
a -> ListSipRules
s {$sel:sipMediaApplicationId:ListSipRules' :: Maybe Text
sipMediaApplicationId = Maybe Text
a} :: ListSipRules)
instance Core.AWSRequest ListSipRules where
type AWSResponse ListSipRules = ListSipRulesResponse
request :: ListSipRules -> Request ListSipRules
request = Service -> ListSipRules -> Request ListSipRules
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
response :: Logger
-> Service
-> Proxy ListSipRules
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListSipRules)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse ListSipRules))
-> Logger
-> Service
-> Proxy ListSipRules
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListSipRules)))
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 ->
Maybe Text -> Maybe [SipRule] -> Int -> ListSipRulesResponse
ListSipRulesResponse'
(Maybe Text -> Maybe [SipRule] -> Int -> ListSipRulesResponse)
-> Either String (Maybe Text)
-> Either String (Maybe [SipRule] -> Int -> ListSipRulesResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"NextToken")
Either String (Maybe [SipRule] -> Int -> ListSipRulesResponse)
-> Either String (Maybe [SipRule])
-> Either String (Int -> ListSipRulesResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe (Maybe [SipRule]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"SipRules" Either String (Maybe (Maybe [SipRule]))
-> Maybe [SipRule] -> Either String (Maybe [SipRule])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [SipRule]
forall a. Monoid a => a
Prelude.mempty)
Either String (Int -> ListSipRulesResponse)
-> Either String Int -> Either String ListSipRulesResponse
forall (f :: * -> *) a b. Applicative f => 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 ListSipRules
instance Prelude.NFData ListSipRules
instance Core.ToHeaders ListSipRules where
toHeaders :: ListSipRules -> ResponseHeaders
toHeaders = ResponseHeaders -> ListSipRules -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToPath ListSipRules where
toPath :: ListSipRules -> ByteString
toPath = ByteString -> ListSipRules -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/sip-rules"
instance Core.ToQuery ListSipRules where
toQuery :: ListSipRules -> QueryString
toQuery ListSipRules' {Maybe Natural
Maybe Text
sipMediaApplicationId :: Maybe Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
$sel:sipMediaApplicationId:ListSipRules' :: ListSipRules -> Maybe Text
$sel:maxResults:ListSipRules' :: ListSipRules -> Maybe Natural
$sel:nextToken:ListSipRules' :: ListSipRules -> Maybe Text
..} =
[QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"next-token" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
nextToken,
ByteString
"max-results" ByteString -> Maybe Natural -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Natural
maxResults,
ByteString
"sip-media-application"
ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
sipMediaApplicationId
]
data ListSipRulesResponse = ListSipRulesResponse'
{
ListSipRulesResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListSipRulesResponse -> Maybe [SipRule]
sipRules :: Prelude.Maybe [SipRule],
ListSipRulesResponse -> Int
httpStatus :: Prelude.Int
}
deriving (ListSipRulesResponse -> ListSipRulesResponse -> Bool
(ListSipRulesResponse -> ListSipRulesResponse -> Bool)
-> (ListSipRulesResponse -> ListSipRulesResponse -> Bool)
-> Eq ListSipRulesResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListSipRulesResponse -> ListSipRulesResponse -> Bool
$c/= :: ListSipRulesResponse -> ListSipRulesResponse -> Bool
== :: ListSipRulesResponse -> ListSipRulesResponse -> Bool
$c== :: ListSipRulesResponse -> ListSipRulesResponse -> Bool
Prelude.Eq, ReadPrec [ListSipRulesResponse]
ReadPrec ListSipRulesResponse
Int -> ReadS ListSipRulesResponse
ReadS [ListSipRulesResponse]
(Int -> ReadS ListSipRulesResponse)
-> ReadS [ListSipRulesResponse]
-> ReadPrec ListSipRulesResponse
-> ReadPrec [ListSipRulesResponse]
-> Read ListSipRulesResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListSipRulesResponse]
$creadListPrec :: ReadPrec [ListSipRulesResponse]
readPrec :: ReadPrec ListSipRulesResponse
$creadPrec :: ReadPrec ListSipRulesResponse
readList :: ReadS [ListSipRulesResponse]
$creadList :: ReadS [ListSipRulesResponse]
readsPrec :: Int -> ReadS ListSipRulesResponse
$creadsPrec :: Int -> ReadS ListSipRulesResponse
Prelude.Read, Int -> ListSipRulesResponse -> ShowS
[ListSipRulesResponse] -> ShowS
ListSipRulesResponse -> String
(Int -> ListSipRulesResponse -> ShowS)
-> (ListSipRulesResponse -> String)
-> ([ListSipRulesResponse] -> ShowS)
-> Show ListSipRulesResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListSipRulesResponse] -> ShowS
$cshowList :: [ListSipRulesResponse] -> ShowS
show :: ListSipRulesResponse -> String
$cshow :: ListSipRulesResponse -> String
showsPrec :: Int -> ListSipRulesResponse -> ShowS
$cshowsPrec :: Int -> ListSipRulesResponse -> ShowS
Prelude.Show, (forall x. ListSipRulesResponse -> Rep ListSipRulesResponse x)
-> (forall x. Rep ListSipRulesResponse x -> ListSipRulesResponse)
-> Generic ListSipRulesResponse
forall x. Rep ListSipRulesResponse x -> ListSipRulesResponse
forall x. ListSipRulesResponse -> Rep ListSipRulesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListSipRulesResponse x -> ListSipRulesResponse
$cfrom :: forall x. ListSipRulesResponse -> Rep ListSipRulesResponse x
Prelude.Generic)
newListSipRulesResponse ::
Prelude.Int ->
ListSipRulesResponse
newListSipRulesResponse :: Int -> ListSipRulesResponse
newListSipRulesResponse Int
pHttpStatus_ =
ListSipRulesResponse' :: Maybe Text -> Maybe [SipRule] -> Int -> ListSipRulesResponse
ListSipRulesResponse'
{ $sel:nextToken:ListSipRulesResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:sipRules:ListSipRulesResponse' :: Maybe [SipRule]
sipRules = Maybe [SipRule]
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ListSipRulesResponse' :: Int
httpStatus = Int
pHttpStatus_
}
listSipRulesResponse_nextToken :: Lens.Lens' ListSipRulesResponse (Prelude.Maybe Prelude.Text)
listSipRulesResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListSipRulesResponse -> f ListSipRulesResponse
listSipRulesResponse_nextToken = (ListSipRulesResponse -> Maybe Text)
-> (ListSipRulesResponse -> Maybe Text -> ListSipRulesResponse)
-> Lens
ListSipRulesResponse ListSipRulesResponse (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListSipRulesResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListSipRulesResponse' :: ListSipRulesResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListSipRulesResponse
s@ListSipRulesResponse' {} Maybe Text
a -> ListSipRulesResponse
s {$sel:nextToken:ListSipRulesResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListSipRulesResponse)
listSipRulesResponse_sipRules :: Lens.Lens' ListSipRulesResponse (Prelude.Maybe [SipRule])
listSipRulesResponse_sipRules :: (Maybe [SipRule] -> f (Maybe [SipRule]))
-> ListSipRulesResponse -> f ListSipRulesResponse
listSipRulesResponse_sipRules = (ListSipRulesResponse -> Maybe [SipRule])
-> (ListSipRulesResponse
-> Maybe [SipRule] -> ListSipRulesResponse)
-> Lens
ListSipRulesResponse
ListSipRulesResponse
(Maybe [SipRule])
(Maybe [SipRule])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListSipRulesResponse' {Maybe [SipRule]
sipRules :: Maybe [SipRule]
$sel:sipRules:ListSipRulesResponse' :: ListSipRulesResponse -> Maybe [SipRule]
sipRules} -> Maybe [SipRule]
sipRules) (\s :: ListSipRulesResponse
s@ListSipRulesResponse' {} Maybe [SipRule]
a -> ListSipRulesResponse
s {$sel:sipRules:ListSipRulesResponse' :: Maybe [SipRule]
sipRules = Maybe [SipRule]
a} :: ListSipRulesResponse) ((Maybe [SipRule] -> f (Maybe [SipRule]))
-> ListSipRulesResponse -> f ListSipRulesResponse)
-> ((Maybe [SipRule] -> f (Maybe [SipRule]))
-> Maybe [SipRule] -> f (Maybe [SipRule]))
-> (Maybe [SipRule] -> f (Maybe [SipRule]))
-> ListSipRulesResponse
-> f ListSipRulesResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [SipRule] [SipRule] [SipRule] [SipRule]
-> Iso
(Maybe [SipRule])
(Maybe [SipRule])
(Maybe [SipRule])
(Maybe [SipRule])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso [SipRule] [SipRule] [SipRule] [SipRule]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
listSipRulesResponse_httpStatus :: Lens.Lens' ListSipRulesResponse Prelude.Int
listSipRulesResponse_httpStatus :: (Int -> f Int) -> ListSipRulesResponse -> f ListSipRulesResponse
listSipRulesResponse_httpStatus = (ListSipRulesResponse -> Int)
-> (ListSipRulesResponse -> Int -> ListSipRulesResponse)
-> Lens ListSipRulesResponse ListSipRulesResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListSipRulesResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListSipRulesResponse' :: ListSipRulesResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListSipRulesResponse
s@ListSipRulesResponse' {} Int
a -> ListSipRulesResponse
s {$sel:httpStatus:ListSipRulesResponse' :: Int
httpStatus = Int
a} :: ListSipRulesResponse)
instance Prelude.NFData ListSipRulesResponse