{-# 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.CodeStarNotifications.UpdateNotificationRule
(
UpdateNotificationRule (..),
newUpdateNotificationRule,
updateNotificationRule_detailType,
updateNotificationRule_eventTypeIds,
updateNotificationRule_name,
updateNotificationRule_status,
updateNotificationRule_targets,
updateNotificationRule_arn,
UpdateNotificationRuleResponse (..),
newUpdateNotificationRuleResponse,
updateNotificationRuleResponse_httpStatus,
)
where
import Amazonka.CodeStarNotifications.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 UpdateNotificationRule = UpdateNotificationRule'
{
UpdateNotificationRule -> Maybe DetailType
detailType :: Prelude.Maybe DetailType,
UpdateNotificationRule -> Maybe [Text]
eventTypeIds :: Prelude.Maybe [Prelude.Text],
UpdateNotificationRule -> Maybe (Sensitive Text)
name :: Prelude.Maybe (Data.Sensitive Prelude.Text),
UpdateNotificationRule -> Maybe NotificationRuleStatus
status :: Prelude.Maybe NotificationRuleStatus,
UpdateNotificationRule -> Maybe [Target]
targets :: Prelude.Maybe [Target],
UpdateNotificationRule -> Text
arn :: Prelude.Text
}
deriving (UpdateNotificationRule -> UpdateNotificationRule -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateNotificationRule -> UpdateNotificationRule -> Bool
$c/= :: UpdateNotificationRule -> UpdateNotificationRule -> Bool
== :: UpdateNotificationRule -> UpdateNotificationRule -> Bool
$c== :: UpdateNotificationRule -> UpdateNotificationRule -> Bool
Prelude.Eq, Int -> UpdateNotificationRule -> ShowS
[UpdateNotificationRule] -> ShowS
UpdateNotificationRule -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateNotificationRule] -> ShowS
$cshowList :: [UpdateNotificationRule] -> ShowS
show :: UpdateNotificationRule -> String
$cshow :: UpdateNotificationRule -> String
showsPrec :: Int -> UpdateNotificationRule -> ShowS
$cshowsPrec :: Int -> UpdateNotificationRule -> ShowS
Prelude.Show, forall x. Rep UpdateNotificationRule x -> UpdateNotificationRule
forall x. UpdateNotificationRule -> Rep UpdateNotificationRule x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateNotificationRule x -> UpdateNotificationRule
$cfrom :: forall x. UpdateNotificationRule -> Rep UpdateNotificationRule x
Prelude.Generic)
newUpdateNotificationRule ::
Prelude.Text ->
UpdateNotificationRule
newUpdateNotificationRule :: Text -> UpdateNotificationRule
newUpdateNotificationRule Text
pArn_ =
UpdateNotificationRule'
{ $sel:detailType:UpdateNotificationRule' :: Maybe DetailType
detailType =
forall a. Maybe a
Prelude.Nothing,
$sel:eventTypeIds:UpdateNotificationRule' :: Maybe [Text]
eventTypeIds = forall a. Maybe a
Prelude.Nothing,
$sel:name:UpdateNotificationRule' :: Maybe (Sensitive Text)
name = forall a. Maybe a
Prelude.Nothing,
$sel:status:UpdateNotificationRule' :: Maybe NotificationRuleStatus
status = forall a. Maybe a
Prelude.Nothing,
$sel:targets:UpdateNotificationRule' :: Maybe [Target]
targets = forall a. Maybe a
Prelude.Nothing,
$sel:arn:UpdateNotificationRule' :: Text
arn = Text
pArn_
}
updateNotificationRule_detailType :: Lens.Lens' UpdateNotificationRule (Prelude.Maybe DetailType)
updateNotificationRule_detailType :: Lens' UpdateNotificationRule (Maybe DetailType)
updateNotificationRule_detailType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateNotificationRule' {Maybe DetailType
detailType :: Maybe DetailType
$sel:detailType:UpdateNotificationRule' :: UpdateNotificationRule -> Maybe DetailType
detailType} -> Maybe DetailType
detailType) (\s :: UpdateNotificationRule
s@UpdateNotificationRule' {} Maybe DetailType
a -> UpdateNotificationRule
s {$sel:detailType:UpdateNotificationRule' :: Maybe DetailType
detailType = Maybe DetailType
a} :: UpdateNotificationRule)
updateNotificationRule_eventTypeIds :: Lens.Lens' UpdateNotificationRule (Prelude.Maybe [Prelude.Text])
updateNotificationRule_eventTypeIds :: Lens' UpdateNotificationRule (Maybe [Text])
updateNotificationRule_eventTypeIds = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateNotificationRule' {Maybe [Text]
eventTypeIds :: Maybe [Text]
$sel:eventTypeIds:UpdateNotificationRule' :: UpdateNotificationRule -> Maybe [Text]
eventTypeIds} -> Maybe [Text]
eventTypeIds) (\s :: UpdateNotificationRule
s@UpdateNotificationRule' {} Maybe [Text]
a -> UpdateNotificationRule
s {$sel:eventTypeIds:UpdateNotificationRule' :: Maybe [Text]
eventTypeIds = Maybe [Text]
a} :: UpdateNotificationRule) 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
updateNotificationRule_name :: Lens.Lens' UpdateNotificationRule (Prelude.Maybe Prelude.Text)
updateNotificationRule_name :: Lens' UpdateNotificationRule (Maybe Text)
updateNotificationRule_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateNotificationRule' {Maybe (Sensitive Text)
name :: Maybe (Sensitive Text)
$sel:name:UpdateNotificationRule' :: UpdateNotificationRule -> Maybe (Sensitive Text)
name} -> Maybe (Sensitive Text)
name) (\s :: UpdateNotificationRule
s@UpdateNotificationRule' {} Maybe (Sensitive Text)
a -> UpdateNotificationRule
s {$sel:name:UpdateNotificationRule' :: Maybe (Sensitive Text)
name = Maybe (Sensitive Text)
a} :: UpdateNotificationRule) 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 a. Iso' (Sensitive a) a
Data._Sensitive
updateNotificationRule_status :: Lens.Lens' UpdateNotificationRule (Prelude.Maybe NotificationRuleStatus)
updateNotificationRule_status :: Lens' UpdateNotificationRule (Maybe NotificationRuleStatus)
updateNotificationRule_status = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateNotificationRule' {Maybe NotificationRuleStatus
status :: Maybe NotificationRuleStatus
$sel:status:UpdateNotificationRule' :: UpdateNotificationRule -> Maybe NotificationRuleStatus
status} -> Maybe NotificationRuleStatus
status) (\s :: UpdateNotificationRule
s@UpdateNotificationRule' {} Maybe NotificationRuleStatus
a -> UpdateNotificationRule
s {$sel:status:UpdateNotificationRule' :: Maybe NotificationRuleStatus
status = Maybe NotificationRuleStatus
a} :: UpdateNotificationRule)
updateNotificationRule_targets :: Lens.Lens' UpdateNotificationRule (Prelude.Maybe [Target])
updateNotificationRule_targets :: Lens' UpdateNotificationRule (Maybe [Target])
updateNotificationRule_targets = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateNotificationRule' {Maybe [Target]
targets :: Maybe [Target]
$sel:targets:UpdateNotificationRule' :: UpdateNotificationRule -> Maybe [Target]
targets} -> Maybe [Target]
targets) (\s :: UpdateNotificationRule
s@UpdateNotificationRule' {} Maybe [Target]
a -> UpdateNotificationRule
s {$sel:targets:UpdateNotificationRule' :: Maybe [Target]
targets = Maybe [Target]
a} :: UpdateNotificationRule) 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
updateNotificationRule_arn :: Lens.Lens' UpdateNotificationRule Prelude.Text
updateNotificationRule_arn :: Lens' UpdateNotificationRule Text
updateNotificationRule_arn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateNotificationRule' {Text
arn :: Text
$sel:arn:UpdateNotificationRule' :: UpdateNotificationRule -> Text
arn} -> Text
arn) (\s :: UpdateNotificationRule
s@UpdateNotificationRule' {} Text
a -> UpdateNotificationRule
s {$sel:arn:UpdateNotificationRule' :: Text
arn = Text
a} :: UpdateNotificationRule)
instance Core.AWSRequest UpdateNotificationRule where
type
AWSResponse UpdateNotificationRule =
UpdateNotificationRuleResponse
request :: (Service -> Service)
-> UpdateNotificationRule -> Request UpdateNotificationRule
request Service -> Service
overrides =
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy UpdateNotificationRule
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse UpdateNotificationRule)))
response =
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
( \Int
s ResponseHeaders
h ()
x ->
Int -> UpdateNotificationRuleResponse
UpdateNotificationRuleResponse'
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))
)
instance Prelude.Hashable UpdateNotificationRule where
hashWithSalt :: Int -> UpdateNotificationRule -> Int
hashWithSalt Int
_salt UpdateNotificationRule' {Maybe [Text]
Maybe [Target]
Maybe (Sensitive Text)
Maybe DetailType
Maybe NotificationRuleStatus
Text
arn :: Text
targets :: Maybe [Target]
status :: Maybe NotificationRuleStatus
name :: Maybe (Sensitive Text)
eventTypeIds :: Maybe [Text]
detailType :: Maybe DetailType
$sel:arn:UpdateNotificationRule' :: UpdateNotificationRule -> Text
$sel:targets:UpdateNotificationRule' :: UpdateNotificationRule -> Maybe [Target]
$sel:status:UpdateNotificationRule' :: UpdateNotificationRule -> Maybe NotificationRuleStatus
$sel:name:UpdateNotificationRule' :: UpdateNotificationRule -> Maybe (Sensitive Text)
$sel:eventTypeIds:UpdateNotificationRule' :: UpdateNotificationRule -> Maybe [Text]
$sel:detailType:UpdateNotificationRule' :: UpdateNotificationRule -> Maybe DetailType
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe DetailType
detailType
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Text]
eventTypeIds
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (Sensitive Text)
name
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe NotificationRuleStatus
status
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Target]
targets
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
arn
instance Prelude.NFData UpdateNotificationRule where
rnf :: UpdateNotificationRule -> ()
rnf UpdateNotificationRule' {Maybe [Text]
Maybe [Target]
Maybe (Sensitive Text)
Maybe DetailType
Maybe NotificationRuleStatus
Text
arn :: Text
targets :: Maybe [Target]
status :: Maybe NotificationRuleStatus
name :: Maybe (Sensitive Text)
eventTypeIds :: Maybe [Text]
detailType :: Maybe DetailType
$sel:arn:UpdateNotificationRule' :: UpdateNotificationRule -> Text
$sel:targets:UpdateNotificationRule' :: UpdateNotificationRule -> Maybe [Target]
$sel:status:UpdateNotificationRule' :: UpdateNotificationRule -> Maybe NotificationRuleStatus
$sel:name:UpdateNotificationRule' :: UpdateNotificationRule -> Maybe (Sensitive Text)
$sel:eventTypeIds:UpdateNotificationRule' :: UpdateNotificationRule -> Maybe [Text]
$sel:detailType:UpdateNotificationRule' :: UpdateNotificationRule -> Maybe DetailType
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe DetailType
detailType
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
eventTypeIds
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (Sensitive Text)
name
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe NotificationRuleStatus
status
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Target]
targets
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
arn
instance Data.ToHeaders UpdateNotificationRule where
toHeaders :: UpdateNotificationRule -> 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.ToJSON UpdateNotificationRule where
toJSON :: UpdateNotificationRule -> Value
toJSON UpdateNotificationRule' {Maybe [Text]
Maybe [Target]
Maybe (Sensitive Text)
Maybe DetailType
Maybe NotificationRuleStatus
Text
arn :: Text
targets :: Maybe [Target]
status :: Maybe NotificationRuleStatus
name :: Maybe (Sensitive Text)
eventTypeIds :: Maybe [Text]
detailType :: Maybe DetailType
$sel:arn:UpdateNotificationRule' :: UpdateNotificationRule -> Text
$sel:targets:UpdateNotificationRule' :: UpdateNotificationRule -> Maybe [Target]
$sel:status:UpdateNotificationRule' :: UpdateNotificationRule -> Maybe NotificationRuleStatus
$sel:name:UpdateNotificationRule' :: UpdateNotificationRule -> Maybe (Sensitive Text)
$sel:eventTypeIds:UpdateNotificationRule' :: UpdateNotificationRule -> Maybe [Text]
$sel:detailType:UpdateNotificationRule' :: UpdateNotificationRule -> Maybe DetailType
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"DetailType" 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 DetailType
detailType,
(Key
"EventTypeIds" 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 [Text]
eventTypeIds,
(Key
"Name" 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 (Sensitive Text)
name,
(Key
"Status" 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 NotificationRuleStatus
status,
(Key
"Targets" 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 [Target]
targets,
forall a. a -> Maybe a
Prelude.Just (Key
"Arn" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
arn)
]
)
instance Data.ToPath UpdateNotificationRule where
toPath :: UpdateNotificationRule -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/updateNotificationRule"
instance Data.ToQuery UpdateNotificationRule where
toQuery :: UpdateNotificationRule -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data UpdateNotificationRuleResponse = UpdateNotificationRuleResponse'
{
UpdateNotificationRuleResponse -> Int
httpStatus :: Prelude.Int
}
deriving (UpdateNotificationRuleResponse
-> UpdateNotificationRuleResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateNotificationRuleResponse
-> UpdateNotificationRuleResponse -> Bool
$c/= :: UpdateNotificationRuleResponse
-> UpdateNotificationRuleResponse -> Bool
== :: UpdateNotificationRuleResponse
-> UpdateNotificationRuleResponse -> Bool
$c== :: UpdateNotificationRuleResponse
-> UpdateNotificationRuleResponse -> Bool
Prelude.Eq, ReadPrec [UpdateNotificationRuleResponse]
ReadPrec UpdateNotificationRuleResponse
Int -> ReadS UpdateNotificationRuleResponse
ReadS [UpdateNotificationRuleResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateNotificationRuleResponse]
$creadListPrec :: ReadPrec [UpdateNotificationRuleResponse]
readPrec :: ReadPrec UpdateNotificationRuleResponse
$creadPrec :: ReadPrec UpdateNotificationRuleResponse
readList :: ReadS [UpdateNotificationRuleResponse]
$creadList :: ReadS [UpdateNotificationRuleResponse]
readsPrec :: Int -> ReadS UpdateNotificationRuleResponse
$creadsPrec :: Int -> ReadS UpdateNotificationRuleResponse
Prelude.Read, Int -> UpdateNotificationRuleResponse -> ShowS
[UpdateNotificationRuleResponse] -> ShowS
UpdateNotificationRuleResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateNotificationRuleResponse] -> ShowS
$cshowList :: [UpdateNotificationRuleResponse] -> ShowS
show :: UpdateNotificationRuleResponse -> String
$cshow :: UpdateNotificationRuleResponse -> String
showsPrec :: Int -> UpdateNotificationRuleResponse -> ShowS
$cshowsPrec :: Int -> UpdateNotificationRuleResponse -> ShowS
Prelude.Show, forall x.
Rep UpdateNotificationRuleResponse x
-> UpdateNotificationRuleResponse
forall x.
UpdateNotificationRuleResponse
-> Rep UpdateNotificationRuleResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UpdateNotificationRuleResponse x
-> UpdateNotificationRuleResponse
$cfrom :: forall x.
UpdateNotificationRuleResponse
-> Rep UpdateNotificationRuleResponse x
Prelude.Generic)
newUpdateNotificationRuleResponse ::
Prelude.Int ->
UpdateNotificationRuleResponse
newUpdateNotificationRuleResponse :: Int -> UpdateNotificationRuleResponse
newUpdateNotificationRuleResponse Int
pHttpStatus_ =
UpdateNotificationRuleResponse'
{ $sel:httpStatus:UpdateNotificationRuleResponse' :: Int
httpStatus =
Int
pHttpStatus_
}
updateNotificationRuleResponse_httpStatus :: Lens.Lens' UpdateNotificationRuleResponse Prelude.Int
updateNotificationRuleResponse_httpStatus :: Lens' UpdateNotificationRuleResponse Int
updateNotificationRuleResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateNotificationRuleResponse' {Int
httpStatus :: Int
$sel:httpStatus:UpdateNotificationRuleResponse' :: UpdateNotificationRuleResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: UpdateNotificationRuleResponse
s@UpdateNotificationRuleResponse' {} Int
a -> UpdateNotificationRuleResponse
s {$sel:httpStatus:UpdateNotificationRuleResponse' :: Int
httpStatus = Int
a} :: UpdateNotificationRuleResponse)
instance
Prelude.NFData
UpdateNotificationRuleResponse
where
rnf :: UpdateNotificationRuleResponse -> ()
rnf UpdateNotificationRuleResponse' {Int
httpStatus :: Int
$sel:httpStatus:UpdateNotificationRuleResponse' :: UpdateNotificationRuleResponse -> Int
..} =
forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus