{-# 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.UpdateSipRule
(
UpdateSipRule (..),
newUpdateSipRule,
updateSipRule_disabled,
updateSipRule_targetApplications,
updateSipRule_sipRuleId,
updateSipRule_name,
UpdateSipRuleResponse (..),
newUpdateSipRuleResponse,
updateSipRuleResponse_sipRule,
updateSipRuleResponse_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 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
(UpdateSipRule -> UpdateSipRule -> Bool)
-> (UpdateSipRule -> UpdateSipRule -> Bool) -> Eq UpdateSipRule
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]
(Int -> ReadS UpdateSipRule)
-> ReadS [UpdateSipRule]
-> ReadPrec UpdateSipRule
-> ReadPrec [UpdateSipRule]
-> Read 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
(Int -> UpdateSipRule -> ShowS)
-> (UpdateSipRule -> String)
-> ([UpdateSipRule] -> ShowS)
-> Show UpdateSipRule
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. UpdateSipRule -> Rep UpdateSipRule x)
-> (forall x. Rep UpdateSipRule x -> UpdateSipRule)
-> Generic UpdateSipRule
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' :: Maybe Bool
-> Maybe (NonEmpty SipRuleTargetApplication)
-> Text
-> Text
-> UpdateSipRule
UpdateSipRule'
{ $sel:disabled:UpdateSipRule' :: Maybe Bool
disabled = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
$sel:targetApplications:UpdateSipRule' :: Maybe (NonEmpty SipRuleTargetApplication)
targetApplications = Maybe (NonEmpty SipRuleTargetApplication)
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 :: (Maybe Bool -> f (Maybe Bool)) -> UpdateSipRule -> f UpdateSipRule
updateSipRule_disabled = (UpdateSipRule -> Maybe Bool)
-> (UpdateSipRule -> Maybe Bool -> UpdateSipRule)
-> Lens UpdateSipRule UpdateSipRule (Maybe Bool) (Maybe Bool)
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 :: (Maybe (NonEmpty SipRuleTargetApplication)
-> f (Maybe (NonEmpty SipRuleTargetApplication)))
-> UpdateSipRule -> f UpdateSipRule
updateSipRule_targetApplications = (UpdateSipRule -> Maybe (NonEmpty SipRuleTargetApplication))
-> (UpdateSipRule
-> Maybe (NonEmpty SipRuleTargetApplication) -> UpdateSipRule)
-> Lens
UpdateSipRule
UpdateSipRule
(Maybe (NonEmpty SipRuleTargetApplication))
(Maybe (NonEmpty SipRuleTargetApplication))
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) ((Maybe (NonEmpty SipRuleTargetApplication)
-> f (Maybe (NonEmpty SipRuleTargetApplication)))
-> UpdateSipRule -> f UpdateSipRule)
-> ((Maybe (NonEmpty SipRuleTargetApplication)
-> f (Maybe (NonEmpty SipRuleTargetApplication)))
-> Maybe (NonEmpty SipRuleTargetApplication)
-> f (Maybe (NonEmpty SipRuleTargetApplication)))
-> (Maybe (NonEmpty SipRuleTargetApplication)
-> f (Maybe (NonEmpty SipRuleTargetApplication)))
-> UpdateSipRule
-> f UpdateSipRule
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
(NonEmpty SipRuleTargetApplication)
(NonEmpty SipRuleTargetApplication)
(NonEmpty SipRuleTargetApplication)
(NonEmpty SipRuleTargetApplication)
-> Iso
(Maybe (NonEmpty SipRuleTargetApplication))
(Maybe (NonEmpty SipRuleTargetApplication))
(Maybe (NonEmpty SipRuleTargetApplication))
(Maybe (NonEmpty SipRuleTargetApplication))
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
(NonEmpty SipRuleTargetApplication)
(NonEmpty SipRuleTargetApplication)
(NonEmpty SipRuleTargetApplication)
(NonEmpty SipRuleTargetApplication)
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 :: (Text -> f Text) -> UpdateSipRule -> f UpdateSipRule
updateSipRule_sipRuleId = (UpdateSipRule -> Text)
-> (UpdateSipRule -> Text -> UpdateSipRule)
-> Lens UpdateSipRule UpdateSipRule Text Text
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 :: (Text -> f Text) -> UpdateSipRule -> f UpdateSipRule
updateSipRule_name = (UpdateSipRule -> Text)
-> (UpdateSipRule -> Text -> UpdateSipRule)
-> Lens UpdateSipRule UpdateSipRule Text Text
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 :: UpdateSipRule -> Request UpdateSipRule
request = Service -> UpdateSipRule -> Request UpdateSipRule
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.putJSON Service
defaultService
response :: Logger
-> Service
-> Proxy UpdateSipRule
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateSipRule)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse UpdateSipRule))
-> Logger
-> Service
-> Proxy UpdateSipRule
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateSipRule)))
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 SipRule -> Int -> UpdateSipRuleResponse
UpdateSipRuleResponse'
(Maybe SipRule -> Int -> UpdateSipRuleResponse)
-> Either String (Maybe SipRule)
-> Either String (Int -> UpdateSipRuleResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe SipRule)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"SipRule")
Either String (Int -> UpdateSipRuleResponse)
-> Either String Int -> Either String UpdateSipRuleResponse
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 UpdateSipRule
instance Prelude.NFData UpdateSipRule
instance Core.ToHeaders UpdateSipRule where
toHeaders :: UpdateSipRule -> ResponseHeaders
toHeaders = ResponseHeaders -> UpdateSipRule -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.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
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"Disabled" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
disabled,
(Text
"TargetApplications" Text -> NonEmpty SipRuleTargetApplication -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(NonEmpty SipRuleTargetApplication -> Pair)
-> Maybe (NonEmpty SipRuleTargetApplication) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (NonEmpty SipRuleTargetApplication)
targetApplications,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Name" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
name)
]
)
instance Core.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
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ByteString
"/sip-rules/", Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
sipRuleId]
instance Core.ToQuery UpdateSipRule where
toQuery :: UpdateSipRule -> QueryString
toQuery = QueryString -> UpdateSipRule -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
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
(UpdateSipRuleResponse -> UpdateSipRuleResponse -> Bool)
-> (UpdateSipRuleResponse -> UpdateSipRuleResponse -> Bool)
-> Eq UpdateSipRuleResponse
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]
(Int -> ReadS UpdateSipRuleResponse)
-> ReadS [UpdateSipRuleResponse]
-> ReadPrec UpdateSipRuleResponse
-> ReadPrec [UpdateSipRuleResponse]
-> Read 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
(Int -> UpdateSipRuleResponse -> ShowS)
-> (UpdateSipRuleResponse -> String)
-> ([UpdateSipRuleResponse] -> ShowS)
-> Show UpdateSipRuleResponse
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. UpdateSipRuleResponse -> Rep UpdateSipRuleResponse x)
-> (forall x. Rep UpdateSipRuleResponse x -> UpdateSipRuleResponse)
-> Generic UpdateSipRuleResponse
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' :: Maybe SipRule -> Int -> UpdateSipRuleResponse
UpdateSipRuleResponse'
{ $sel:sipRule:UpdateSipRuleResponse' :: Maybe SipRule
sipRule = Maybe SipRule
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:UpdateSipRuleResponse' :: Int
httpStatus = Int
pHttpStatus_
}
updateSipRuleResponse_sipRule :: Lens.Lens' UpdateSipRuleResponse (Prelude.Maybe SipRule)
updateSipRuleResponse_sipRule :: (Maybe SipRule -> f (Maybe SipRule))
-> UpdateSipRuleResponse -> f UpdateSipRuleResponse
updateSipRuleResponse_sipRule = (UpdateSipRuleResponse -> Maybe SipRule)
-> (UpdateSipRuleResponse
-> Maybe SipRule -> UpdateSipRuleResponse)
-> Lens
UpdateSipRuleResponse
UpdateSipRuleResponse
(Maybe SipRule)
(Maybe 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 :: (Int -> f Int) -> UpdateSipRuleResponse -> f UpdateSipRuleResponse
updateSipRuleResponse_httpStatus = (UpdateSipRuleResponse -> Int)
-> (UpdateSipRuleResponse -> Int -> UpdateSipRuleResponse)
-> Lens UpdateSipRuleResponse UpdateSipRuleResponse Int Int
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