{-# 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.UpdateSipRule
(
UpdateSipRule (..),
newUpdateSipRule,
updateSipRule_disabled,
updateSipRule_targetApplications,
updateSipRule_sipRuleId,
updateSipRule_name,
UpdateSipRuleResponse (..),
newUpdateSipRuleResponse,
updateSipRuleResponse_sipRule,
updateSipRuleResponse_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 UpdateSipRule = UpdateSipRule'
{ UpdateSipRule -> Maybe Bool
disabled :: Prelude.Maybe Prelude.Bool,
UpdateSipRule -> Maybe (NonEmpty SipRuleTargetApplication)
targetApplications :: Prelude.Maybe (Prelude.NonEmpty SipRuleTargetApplication),
UpdateSipRule -> Text
sipRuleId :: Prelude.Text,
UpdateSipRule -> Text
name :: Prelude.Text
}
deriving (UpdateSipRule -> UpdateSipRule -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateSipRule -> UpdateSipRule -> Bool
$c/= :: UpdateSipRule -> UpdateSipRule -> Bool
== :: UpdateSipRule -> UpdateSipRule -> Bool
$c== :: UpdateSipRule -> UpdateSipRule -> Bool
Prelude.Eq, ReadPrec [UpdateSipRule]
ReadPrec UpdateSipRule
Int -> ReadS UpdateSipRule
ReadS [UpdateSipRule]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateSipRule]
$creadListPrec :: ReadPrec [UpdateSipRule]
readPrec :: ReadPrec UpdateSipRule
$creadPrec :: ReadPrec UpdateSipRule
readList :: ReadS [UpdateSipRule]
$creadList :: ReadS [UpdateSipRule]
readsPrec :: Int -> ReadS UpdateSipRule
$creadsPrec :: Int -> ReadS UpdateSipRule
Prelude.Read, Int -> UpdateSipRule -> ShowS
[UpdateSipRule] -> ShowS
UpdateSipRule -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateSipRule] -> ShowS
$cshowList :: [UpdateSipRule] -> ShowS
show :: UpdateSipRule -> String
$cshow :: UpdateSipRule -> String
showsPrec :: Int -> UpdateSipRule -> ShowS
$cshowsPrec :: Int -> UpdateSipRule -> ShowS
Prelude.Show, forall x. Rep UpdateSipRule x -> UpdateSipRule
forall x. UpdateSipRule -> Rep UpdateSipRule x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateSipRule x -> UpdateSipRule
$cfrom :: forall x. UpdateSipRule -> Rep UpdateSipRule x
Prelude.Generic)
newUpdateSipRule ::
Prelude.Text ->
Prelude.Text ->
UpdateSipRule
newUpdateSipRule :: Text -> Text -> UpdateSipRule
newUpdateSipRule Text
pSipRuleId_ Text
pName_ =
UpdateSipRule'
{ $sel:disabled:UpdateSipRule' :: Maybe Bool
disabled = forall a. Maybe a
Prelude.Nothing,
$sel:targetApplications:UpdateSipRule' :: Maybe (NonEmpty SipRuleTargetApplication)
targetApplications = forall a. Maybe a
Prelude.Nothing,
$sel:sipRuleId:UpdateSipRule' :: Text
sipRuleId = Text
pSipRuleId_,
$sel:name:UpdateSipRule' :: Text
name = Text
pName_
}
updateSipRule_disabled :: Lens.Lens' UpdateSipRule (Prelude.Maybe Prelude.Bool)
updateSipRule_disabled :: Lens' UpdateSipRule (Maybe Bool)
updateSipRule_disabled = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateSipRule' {Maybe Bool
disabled :: Maybe Bool
$sel:disabled:UpdateSipRule' :: UpdateSipRule -> Maybe Bool
disabled} -> Maybe Bool
disabled) (\s :: UpdateSipRule
s@UpdateSipRule' {} Maybe Bool
a -> UpdateSipRule
s {$sel:disabled:UpdateSipRule' :: Maybe Bool
disabled = Maybe Bool
a} :: UpdateSipRule)
updateSipRule_targetApplications :: Lens.Lens' UpdateSipRule (Prelude.Maybe (Prelude.NonEmpty SipRuleTargetApplication))
updateSipRule_targetApplications :: Lens' UpdateSipRule (Maybe (NonEmpty SipRuleTargetApplication))
updateSipRule_targetApplications = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateSipRule' {Maybe (NonEmpty SipRuleTargetApplication)
targetApplications :: Maybe (NonEmpty SipRuleTargetApplication)
$sel:targetApplications:UpdateSipRule' :: UpdateSipRule -> Maybe (NonEmpty SipRuleTargetApplication)
targetApplications} -> Maybe (NonEmpty SipRuleTargetApplication)
targetApplications) (\s :: UpdateSipRule
s@UpdateSipRule' {} Maybe (NonEmpty SipRuleTargetApplication)
a -> UpdateSipRule
s {$sel:targetApplications:UpdateSipRule' :: Maybe (NonEmpty SipRuleTargetApplication)
targetApplications = Maybe (NonEmpty SipRuleTargetApplication)
a} :: UpdateSipRule) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
updateSipRule_sipRuleId :: Lens.Lens' UpdateSipRule Prelude.Text
updateSipRule_sipRuleId :: Lens' UpdateSipRule Text
updateSipRule_sipRuleId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateSipRule' {Text
sipRuleId :: Text
$sel:sipRuleId:UpdateSipRule' :: UpdateSipRule -> Text
sipRuleId} -> Text
sipRuleId) (\s :: UpdateSipRule
s@UpdateSipRule' {} Text
a -> UpdateSipRule
s {$sel:sipRuleId:UpdateSipRule' :: Text
sipRuleId = Text
a} :: UpdateSipRule)
updateSipRule_name :: Lens.Lens' UpdateSipRule Prelude.Text
updateSipRule_name :: Lens' UpdateSipRule Text
updateSipRule_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateSipRule' {Text
name :: Text
$sel:name:UpdateSipRule' :: UpdateSipRule -> Text
name} -> Text
name) (\s :: UpdateSipRule
s@UpdateSipRule' {} Text
a -> UpdateSipRule
s {$sel:name:UpdateSipRule' :: Text
name = Text
a} :: UpdateSipRule)
instance Core.AWSRequest UpdateSipRule where
type
AWSResponse UpdateSipRule =
UpdateSipRuleResponse
request :: (Service -> Service) -> UpdateSipRule -> Request UpdateSipRule
request Service -> Service
overrides =
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.putJSON (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy UpdateSipRule
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateSipRule)))
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 -> UpdateSipRuleResponse
UpdateSipRuleResponse'
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 UpdateSipRule where
hashWithSalt :: Int -> UpdateSipRule -> Int
hashWithSalt Int
_salt UpdateSipRule' {Maybe Bool
Maybe (NonEmpty SipRuleTargetApplication)
Text
name :: Text
sipRuleId :: Text
targetApplications :: Maybe (NonEmpty SipRuleTargetApplication)
disabled :: Maybe Bool
$sel:name:UpdateSipRule' :: UpdateSipRule -> Text
$sel:sipRuleId:UpdateSipRule' :: UpdateSipRule -> Text
$sel:targetApplications:UpdateSipRule' :: UpdateSipRule -> Maybe (NonEmpty SipRuleTargetApplication)
$sel:disabled:UpdateSipRule' :: UpdateSipRule -> Maybe Bool
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
disabled
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (NonEmpty SipRuleTargetApplication)
targetApplications
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
sipRuleId
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
name
instance Prelude.NFData UpdateSipRule where
rnf :: UpdateSipRule -> ()
rnf UpdateSipRule' {Maybe Bool
Maybe (NonEmpty SipRuleTargetApplication)
Text
name :: Text
sipRuleId :: Text
targetApplications :: Maybe (NonEmpty SipRuleTargetApplication)
disabled :: Maybe Bool
$sel:name:UpdateSipRule' :: UpdateSipRule -> Text
$sel:sipRuleId:UpdateSipRule' :: UpdateSipRule -> Text
$sel:targetApplications:UpdateSipRule' :: UpdateSipRule -> Maybe (NonEmpty SipRuleTargetApplication)
$sel:disabled:UpdateSipRule' :: UpdateSipRule -> Maybe Bool
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
disabled
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (NonEmpty SipRuleTargetApplication)
targetApplications
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
sipRuleId
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
name
instance Data.ToHeaders UpdateSipRule where
toHeaders :: UpdateSipRule -> ResponseHeaders
toHeaders = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
instance Data.ToJSON UpdateSipRule where
toJSON :: UpdateSipRule -> Value
toJSON UpdateSipRule' {Maybe Bool
Maybe (NonEmpty SipRuleTargetApplication)
Text
name :: Text
sipRuleId :: Text
targetApplications :: Maybe (NonEmpty SipRuleTargetApplication)
disabled :: Maybe Bool
$sel:name:UpdateSipRule' :: UpdateSipRule -> Text
$sel:sipRuleId:UpdateSipRule' :: UpdateSipRule -> Text
$sel:targetApplications:UpdateSipRule' :: UpdateSipRule -> Maybe (NonEmpty SipRuleTargetApplication)
$sel:disabled:UpdateSipRule' :: UpdateSipRule -> Maybe Bool
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"Disabled" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
disabled,
(Key
"TargetApplications" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (NonEmpty SipRuleTargetApplication)
targetApplications,
forall a. a -> Maybe a
Prelude.Just (Key
"Name" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
name)
]
)
instance Data.ToPath UpdateSipRule where
toPath :: UpdateSipRule -> ByteString
toPath UpdateSipRule' {Maybe Bool
Maybe (NonEmpty SipRuleTargetApplication)
Text
name :: Text
sipRuleId :: Text
targetApplications :: Maybe (NonEmpty SipRuleTargetApplication)
disabled :: Maybe Bool
$sel:name:UpdateSipRule' :: UpdateSipRule -> Text
$sel:sipRuleId:UpdateSipRule' :: UpdateSipRule -> Text
$sel:targetApplications:UpdateSipRule' :: UpdateSipRule -> Maybe (NonEmpty SipRuleTargetApplication)
$sel:disabled:UpdateSipRule' :: UpdateSipRule -> Maybe Bool
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ByteString
"/sip-rules/", forall a. ToByteString a => a -> ByteString
Data.toBS Text
sipRuleId]
instance Data.ToQuery UpdateSipRule where
toQuery :: UpdateSipRule -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data UpdateSipRuleResponse = UpdateSipRuleResponse'
{ UpdateSipRuleResponse -> Maybe SipRule
sipRule :: Prelude.Maybe SipRule,
UpdateSipRuleResponse -> Int
httpStatus :: Prelude.Int
}
deriving (UpdateSipRuleResponse -> UpdateSipRuleResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateSipRuleResponse -> UpdateSipRuleResponse -> Bool
$c/= :: UpdateSipRuleResponse -> UpdateSipRuleResponse -> Bool
== :: UpdateSipRuleResponse -> UpdateSipRuleResponse -> Bool
$c== :: UpdateSipRuleResponse -> UpdateSipRuleResponse -> Bool
Prelude.Eq, ReadPrec [UpdateSipRuleResponse]
ReadPrec UpdateSipRuleResponse
Int -> ReadS UpdateSipRuleResponse
ReadS [UpdateSipRuleResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateSipRuleResponse]
$creadListPrec :: ReadPrec [UpdateSipRuleResponse]
readPrec :: ReadPrec UpdateSipRuleResponse
$creadPrec :: ReadPrec UpdateSipRuleResponse
readList :: ReadS [UpdateSipRuleResponse]
$creadList :: ReadS [UpdateSipRuleResponse]
readsPrec :: Int -> ReadS UpdateSipRuleResponse
$creadsPrec :: Int -> ReadS UpdateSipRuleResponse
Prelude.Read, Int -> UpdateSipRuleResponse -> ShowS
[UpdateSipRuleResponse] -> ShowS
UpdateSipRuleResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateSipRuleResponse] -> ShowS
$cshowList :: [UpdateSipRuleResponse] -> ShowS
show :: UpdateSipRuleResponse -> String
$cshow :: UpdateSipRuleResponse -> String
showsPrec :: Int -> UpdateSipRuleResponse -> ShowS
$cshowsPrec :: Int -> UpdateSipRuleResponse -> ShowS
Prelude.Show, forall x. Rep UpdateSipRuleResponse x -> UpdateSipRuleResponse
forall x. UpdateSipRuleResponse -> Rep UpdateSipRuleResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateSipRuleResponse x -> UpdateSipRuleResponse
$cfrom :: forall x. UpdateSipRuleResponse -> Rep UpdateSipRuleResponse x
Prelude.Generic)
newUpdateSipRuleResponse ::
Prelude.Int ->
UpdateSipRuleResponse
newUpdateSipRuleResponse :: Int -> UpdateSipRuleResponse
newUpdateSipRuleResponse Int
pHttpStatus_ =
UpdateSipRuleResponse'
{ $sel:sipRule:UpdateSipRuleResponse' :: Maybe SipRule
sipRule = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:UpdateSipRuleResponse' :: Int
httpStatus = Int
pHttpStatus_
}
updateSipRuleResponse_sipRule :: Lens.Lens' UpdateSipRuleResponse (Prelude.Maybe SipRule)
updateSipRuleResponse_sipRule :: Lens' UpdateSipRuleResponse (Maybe SipRule)
updateSipRuleResponse_sipRule = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateSipRuleResponse' {Maybe SipRule
sipRule :: Maybe SipRule
$sel:sipRule:UpdateSipRuleResponse' :: UpdateSipRuleResponse -> Maybe SipRule
sipRule} -> Maybe SipRule
sipRule) (\s :: UpdateSipRuleResponse
s@UpdateSipRuleResponse' {} Maybe SipRule
a -> UpdateSipRuleResponse
s {$sel:sipRule:UpdateSipRuleResponse' :: Maybe SipRule
sipRule = Maybe SipRule
a} :: UpdateSipRuleResponse)
updateSipRuleResponse_httpStatus :: Lens.Lens' UpdateSipRuleResponse Prelude.Int
updateSipRuleResponse_httpStatus :: Lens' UpdateSipRuleResponse Int
updateSipRuleResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateSipRuleResponse' {Int
httpStatus :: Int
$sel:httpStatus:UpdateSipRuleResponse' :: UpdateSipRuleResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: UpdateSipRuleResponse
s@UpdateSipRuleResponse' {} Int
a -> UpdateSipRuleResponse
s {$sel:httpStatus:UpdateSipRuleResponse' :: Int
httpStatus = Int
a} :: UpdateSipRuleResponse)
instance Prelude.NFData UpdateSipRuleResponse where
rnf :: UpdateSipRuleResponse -> ()
rnf UpdateSipRuleResponse' {Int
Maybe SipRule
httpStatus :: Int
sipRule :: Maybe SipRule
$sel:httpStatus:UpdateSipRuleResponse' :: UpdateSipRuleResponse -> Int
$sel:sipRule:UpdateSipRuleResponse' :: UpdateSipRuleResponse -> 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