{-# 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.AMP.PutAlertManagerDefinition
(
PutAlertManagerDefinition (..),
newPutAlertManagerDefinition,
putAlertManagerDefinition_clientToken,
putAlertManagerDefinition_data,
putAlertManagerDefinition_workspaceId,
PutAlertManagerDefinitionResponse (..),
newPutAlertManagerDefinitionResponse,
putAlertManagerDefinitionResponse_httpStatus,
putAlertManagerDefinitionResponse_status,
)
where
import Amazonka.AMP.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 PutAlertManagerDefinition = PutAlertManagerDefinition'
{
PutAlertManagerDefinition -> Maybe Text
clientToken :: Prelude.Maybe Prelude.Text,
PutAlertManagerDefinition -> Base64
data' :: Core.Base64,
PutAlertManagerDefinition -> Text
workspaceId :: Prelude.Text
}
deriving (PutAlertManagerDefinition -> PutAlertManagerDefinition -> Bool
(PutAlertManagerDefinition -> PutAlertManagerDefinition -> Bool)
-> (PutAlertManagerDefinition -> PutAlertManagerDefinition -> Bool)
-> Eq PutAlertManagerDefinition
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PutAlertManagerDefinition -> PutAlertManagerDefinition -> Bool
$c/= :: PutAlertManagerDefinition -> PutAlertManagerDefinition -> Bool
== :: PutAlertManagerDefinition -> PutAlertManagerDefinition -> Bool
$c== :: PutAlertManagerDefinition -> PutAlertManagerDefinition -> Bool
Prelude.Eq, ReadPrec [PutAlertManagerDefinition]
ReadPrec PutAlertManagerDefinition
Int -> ReadS PutAlertManagerDefinition
ReadS [PutAlertManagerDefinition]
(Int -> ReadS PutAlertManagerDefinition)
-> ReadS [PutAlertManagerDefinition]
-> ReadPrec PutAlertManagerDefinition
-> ReadPrec [PutAlertManagerDefinition]
-> Read PutAlertManagerDefinition
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PutAlertManagerDefinition]
$creadListPrec :: ReadPrec [PutAlertManagerDefinition]
readPrec :: ReadPrec PutAlertManagerDefinition
$creadPrec :: ReadPrec PutAlertManagerDefinition
readList :: ReadS [PutAlertManagerDefinition]
$creadList :: ReadS [PutAlertManagerDefinition]
readsPrec :: Int -> ReadS PutAlertManagerDefinition
$creadsPrec :: Int -> ReadS PutAlertManagerDefinition
Prelude.Read, Int -> PutAlertManagerDefinition -> ShowS
[PutAlertManagerDefinition] -> ShowS
PutAlertManagerDefinition -> String
(Int -> PutAlertManagerDefinition -> ShowS)
-> (PutAlertManagerDefinition -> String)
-> ([PutAlertManagerDefinition] -> ShowS)
-> Show PutAlertManagerDefinition
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PutAlertManagerDefinition] -> ShowS
$cshowList :: [PutAlertManagerDefinition] -> ShowS
show :: PutAlertManagerDefinition -> String
$cshow :: PutAlertManagerDefinition -> String
showsPrec :: Int -> PutAlertManagerDefinition -> ShowS
$cshowsPrec :: Int -> PutAlertManagerDefinition -> ShowS
Prelude.Show, (forall x.
PutAlertManagerDefinition -> Rep PutAlertManagerDefinition x)
-> (forall x.
Rep PutAlertManagerDefinition x -> PutAlertManagerDefinition)
-> Generic PutAlertManagerDefinition
forall x.
Rep PutAlertManagerDefinition x -> PutAlertManagerDefinition
forall x.
PutAlertManagerDefinition -> Rep PutAlertManagerDefinition x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep PutAlertManagerDefinition x -> PutAlertManagerDefinition
$cfrom :: forall x.
PutAlertManagerDefinition -> Rep PutAlertManagerDefinition x
Prelude.Generic)
newPutAlertManagerDefinition ::
Prelude.ByteString ->
Prelude.Text ->
PutAlertManagerDefinition
newPutAlertManagerDefinition :: ByteString -> Text -> PutAlertManagerDefinition
newPutAlertManagerDefinition ByteString
pData_ Text
pWorkspaceId_ =
PutAlertManagerDefinition' :: Maybe Text -> Base64 -> Text -> PutAlertManagerDefinition
PutAlertManagerDefinition'
{ $sel:clientToken:PutAlertManagerDefinition' :: Maybe Text
clientToken =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:data':PutAlertManagerDefinition' :: Base64
data' = Tagged ByteString (Identity ByteString)
-> Tagged Base64 (Identity Base64)
Iso' Base64 ByteString
Core._Base64 (Tagged ByteString (Identity ByteString)
-> Tagged Base64 (Identity Base64))
-> ByteString -> Base64
forall t b. AReview t b -> b -> t
Lens.# ByteString
pData_,
$sel:workspaceId:PutAlertManagerDefinition' :: Text
workspaceId = Text
pWorkspaceId_
}
putAlertManagerDefinition_clientToken :: Lens.Lens' PutAlertManagerDefinition (Prelude.Maybe Prelude.Text)
putAlertManagerDefinition_clientToken :: (Maybe Text -> f (Maybe Text))
-> PutAlertManagerDefinition -> f PutAlertManagerDefinition
putAlertManagerDefinition_clientToken = (PutAlertManagerDefinition -> Maybe Text)
-> (PutAlertManagerDefinition
-> Maybe Text -> PutAlertManagerDefinition)
-> Lens
PutAlertManagerDefinition
PutAlertManagerDefinition
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutAlertManagerDefinition' {Maybe Text
clientToken :: Maybe Text
$sel:clientToken:PutAlertManagerDefinition' :: PutAlertManagerDefinition -> Maybe Text
clientToken} -> Maybe Text
clientToken) (\s :: PutAlertManagerDefinition
s@PutAlertManagerDefinition' {} Maybe Text
a -> PutAlertManagerDefinition
s {$sel:clientToken:PutAlertManagerDefinition' :: Maybe Text
clientToken = Maybe Text
a} :: PutAlertManagerDefinition)
putAlertManagerDefinition_data :: Lens.Lens' PutAlertManagerDefinition Prelude.ByteString
putAlertManagerDefinition_data :: (ByteString -> f ByteString)
-> PutAlertManagerDefinition -> f PutAlertManagerDefinition
putAlertManagerDefinition_data = (PutAlertManagerDefinition -> Base64)
-> (PutAlertManagerDefinition
-> Base64 -> PutAlertManagerDefinition)
-> Lens
PutAlertManagerDefinition PutAlertManagerDefinition Base64 Base64
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutAlertManagerDefinition' {Base64
data' :: Base64
$sel:data':PutAlertManagerDefinition' :: PutAlertManagerDefinition -> Base64
data'} -> Base64
data') (\s :: PutAlertManagerDefinition
s@PutAlertManagerDefinition' {} Base64
a -> PutAlertManagerDefinition
s {$sel:data':PutAlertManagerDefinition' :: Base64
data' = Base64
a} :: PutAlertManagerDefinition) ((Base64 -> f Base64)
-> PutAlertManagerDefinition -> f PutAlertManagerDefinition)
-> ((ByteString -> f ByteString) -> Base64 -> f Base64)
-> (ByteString -> f ByteString)
-> PutAlertManagerDefinition
-> f PutAlertManagerDefinition
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (ByteString -> f ByteString) -> Base64 -> f Base64
Iso' Base64 ByteString
Core._Base64
putAlertManagerDefinition_workspaceId :: Lens.Lens' PutAlertManagerDefinition Prelude.Text
putAlertManagerDefinition_workspaceId :: (Text -> f Text)
-> PutAlertManagerDefinition -> f PutAlertManagerDefinition
putAlertManagerDefinition_workspaceId = (PutAlertManagerDefinition -> Text)
-> (PutAlertManagerDefinition -> Text -> PutAlertManagerDefinition)
-> Lens
PutAlertManagerDefinition PutAlertManagerDefinition Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutAlertManagerDefinition' {Text
workspaceId :: Text
$sel:workspaceId:PutAlertManagerDefinition' :: PutAlertManagerDefinition -> Text
workspaceId} -> Text
workspaceId) (\s :: PutAlertManagerDefinition
s@PutAlertManagerDefinition' {} Text
a -> PutAlertManagerDefinition
s {$sel:workspaceId:PutAlertManagerDefinition' :: Text
workspaceId = Text
a} :: PutAlertManagerDefinition)
instance Core.AWSRequest PutAlertManagerDefinition where
type
AWSResponse PutAlertManagerDefinition =
PutAlertManagerDefinitionResponse
request :: PutAlertManagerDefinition -> Request PutAlertManagerDefinition
request = Service
-> PutAlertManagerDefinition -> Request PutAlertManagerDefinition
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.putJSON Service
defaultService
response :: Logger
-> Service
-> Proxy PutAlertManagerDefinition
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse PutAlertManagerDefinition)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse PutAlertManagerDefinition))
-> Logger
-> Service
-> Proxy PutAlertManagerDefinition
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse PutAlertManagerDefinition)))
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 ->
Int
-> AlertManagerDefinitionStatus
-> PutAlertManagerDefinitionResponse
PutAlertManagerDefinitionResponse'
(Int
-> AlertManagerDefinitionStatus
-> PutAlertManagerDefinitionResponse)
-> Either String Int
-> Either
String
(AlertManagerDefinitionStatus -> PutAlertManagerDefinitionResponse)
forall (f :: * -> *) a b. Functor 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))
Either
String
(AlertManagerDefinitionStatus -> PutAlertManagerDefinitionResponse)
-> Either String AlertManagerDefinitionStatus
-> Either String PutAlertManagerDefinitionResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String AlertManagerDefinitionStatus
forall a. FromJSON a => Object -> Text -> Either String a
Core..:> Text
"status")
)
instance Prelude.Hashable PutAlertManagerDefinition
instance Prelude.NFData PutAlertManagerDefinition
instance Core.ToHeaders PutAlertManagerDefinition where
toHeaders :: PutAlertManagerDefinition -> ResponseHeaders
toHeaders =
ResponseHeaders -> PutAlertManagerDefinition -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"Content-Type"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Core.ToJSON PutAlertManagerDefinition where
toJSON :: PutAlertManagerDefinition -> Value
toJSON PutAlertManagerDefinition' {Maybe Text
Text
Base64
workspaceId :: Text
data' :: Base64
clientToken :: Maybe Text
$sel:workspaceId:PutAlertManagerDefinition' :: PutAlertManagerDefinition -> Text
$sel:data':PutAlertManagerDefinition' :: PutAlertManagerDefinition -> Base64
$sel:clientToken:PutAlertManagerDefinition' :: PutAlertManagerDefinition -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"clientToken" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
clientToken,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"data" Text -> Base64 -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Base64
data')
]
)
instance Core.ToPath PutAlertManagerDefinition where
toPath :: PutAlertManagerDefinition -> ByteString
toPath PutAlertManagerDefinition' {Maybe Text
Text
Base64
workspaceId :: Text
data' :: Base64
clientToken :: Maybe Text
$sel:workspaceId:PutAlertManagerDefinition' :: PutAlertManagerDefinition -> Text
$sel:data':PutAlertManagerDefinition' :: PutAlertManagerDefinition -> Base64
$sel:clientToken:PutAlertManagerDefinition' :: PutAlertManagerDefinition -> Maybe Text
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"/workspaces/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
workspaceId,
ByteString
"/alertmanager/definition"
]
instance Core.ToQuery PutAlertManagerDefinition where
toQuery :: PutAlertManagerDefinition -> QueryString
toQuery = QueryString -> PutAlertManagerDefinition -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data PutAlertManagerDefinitionResponse = PutAlertManagerDefinitionResponse'
{
PutAlertManagerDefinitionResponse -> Int
httpStatus :: Prelude.Int,
PutAlertManagerDefinitionResponse -> AlertManagerDefinitionStatus
status :: AlertManagerDefinitionStatus
}
deriving (PutAlertManagerDefinitionResponse
-> PutAlertManagerDefinitionResponse -> Bool
(PutAlertManagerDefinitionResponse
-> PutAlertManagerDefinitionResponse -> Bool)
-> (PutAlertManagerDefinitionResponse
-> PutAlertManagerDefinitionResponse -> Bool)
-> Eq PutAlertManagerDefinitionResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PutAlertManagerDefinitionResponse
-> PutAlertManagerDefinitionResponse -> Bool
$c/= :: PutAlertManagerDefinitionResponse
-> PutAlertManagerDefinitionResponse -> Bool
== :: PutAlertManagerDefinitionResponse
-> PutAlertManagerDefinitionResponse -> Bool
$c== :: PutAlertManagerDefinitionResponse
-> PutAlertManagerDefinitionResponse -> Bool
Prelude.Eq, ReadPrec [PutAlertManagerDefinitionResponse]
ReadPrec PutAlertManagerDefinitionResponse
Int -> ReadS PutAlertManagerDefinitionResponse
ReadS [PutAlertManagerDefinitionResponse]
(Int -> ReadS PutAlertManagerDefinitionResponse)
-> ReadS [PutAlertManagerDefinitionResponse]
-> ReadPrec PutAlertManagerDefinitionResponse
-> ReadPrec [PutAlertManagerDefinitionResponse]
-> Read PutAlertManagerDefinitionResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PutAlertManagerDefinitionResponse]
$creadListPrec :: ReadPrec [PutAlertManagerDefinitionResponse]
readPrec :: ReadPrec PutAlertManagerDefinitionResponse
$creadPrec :: ReadPrec PutAlertManagerDefinitionResponse
readList :: ReadS [PutAlertManagerDefinitionResponse]
$creadList :: ReadS [PutAlertManagerDefinitionResponse]
readsPrec :: Int -> ReadS PutAlertManagerDefinitionResponse
$creadsPrec :: Int -> ReadS PutAlertManagerDefinitionResponse
Prelude.Read, Int -> PutAlertManagerDefinitionResponse -> ShowS
[PutAlertManagerDefinitionResponse] -> ShowS
PutAlertManagerDefinitionResponse -> String
(Int -> PutAlertManagerDefinitionResponse -> ShowS)
-> (PutAlertManagerDefinitionResponse -> String)
-> ([PutAlertManagerDefinitionResponse] -> ShowS)
-> Show PutAlertManagerDefinitionResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PutAlertManagerDefinitionResponse] -> ShowS
$cshowList :: [PutAlertManagerDefinitionResponse] -> ShowS
show :: PutAlertManagerDefinitionResponse -> String
$cshow :: PutAlertManagerDefinitionResponse -> String
showsPrec :: Int -> PutAlertManagerDefinitionResponse -> ShowS
$cshowsPrec :: Int -> PutAlertManagerDefinitionResponse -> ShowS
Prelude.Show, (forall x.
PutAlertManagerDefinitionResponse
-> Rep PutAlertManagerDefinitionResponse x)
-> (forall x.
Rep PutAlertManagerDefinitionResponse x
-> PutAlertManagerDefinitionResponse)
-> Generic PutAlertManagerDefinitionResponse
forall x.
Rep PutAlertManagerDefinitionResponse x
-> PutAlertManagerDefinitionResponse
forall x.
PutAlertManagerDefinitionResponse
-> Rep PutAlertManagerDefinitionResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep PutAlertManagerDefinitionResponse x
-> PutAlertManagerDefinitionResponse
$cfrom :: forall x.
PutAlertManagerDefinitionResponse
-> Rep PutAlertManagerDefinitionResponse x
Prelude.Generic)
newPutAlertManagerDefinitionResponse ::
Prelude.Int ->
AlertManagerDefinitionStatus ->
PutAlertManagerDefinitionResponse
newPutAlertManagerDefinitionResponse :: Int
-> AlertManagerDefinitionStatus
-> PutAlertManagerDefinitionResponse
newPutAlertManagerDefinitionResponse
Int
pHttpStatus_
AlertManagerDefinitionStatus
pStatus_ =
PutAlertManagerDefinitionResponse' :: Int
-> AlertManagerDefinitionStatus
-> PutAlertManagerDefinitionResponse
PutAlertManagerDefinitionResponse'
{ $sel:httpStatus:PutAlertManagerDefinitionResponse' :: Int
httpStatus =
Int
pHttpStatus_,
$sel:status:PutAlertManagerDefinitionResponse' :: AlertManagerDefinitionStatus
status = AlertManagerDefinitionStatus
pStatus_
}
putAlertManagerDefinitionResponse_httpStatus :: Lens.Lens' PutAlertManagerDefinitionResponse Prelude.Int
putAlertManagerDefinitionResponse_httpStatus :: (Int -> f Int)
-> PutAlertManagerDefinitionResponse
-> f PutAlertManagerDefinitionResponse
putAlertManagerDefinitionResponse_httpStatus = (PutAlertManagerDefinitionResponse -> Int)
-> (PutAlertManagerDefinitionResponse
-> Int -> PutAlertManagerDefinitionResponse)
-> Lens
PutAlertManagerDefinitionResponse
PutAlertManagerDefinitionResponse
Int
Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutAlertManagerDefinitionResponse' {Int
httpStatus :: Int
$sel:httpStatus:PutAlertManagerDefinitionResponse' :: PutAlertManagerDefinitionResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: PutAlertManagerDefinitionResponse
s@PutAlertManagerDefinitionResponse' {} Int
a -> PutAlertManagerDefinitionResponse
s {$sel:httpStatus:PutAlertManagerDefinitionResponse' :: Int
httpStatus = Int
a} :: PutAlertManagerDefinitionResponse)
putAlertManagerDefinitionResponse_status :: Lens.Lens' PutAlertManagerDefinitionResponse AlertManagerDefinitionStatus
putAlertManagerDefinitionResponse_status :: (AlertManagerDefinitionStatus -> f AlertManagerDefinitionStatus)
-> PutAlertManagerDefinitionResponse
-> f PutAlertManagerDefinitionResponse
putAlertManagerDefinitionResponse_status = (PutAlertManagerDefinitionResponse -> AlertManagerDefinitionStatus)
-> (PutAlertManagerDefinitionResponse
-> AlertManagerDefinitionStatus
-> PutAlertManagerDefinitionResponse)
-> Lens
PutAlertManagerDefinitionResponse
PutAlertManagerDefinitionResponse
AlertManagerDefinitionStatus
AlertManagerDefinitionStatus
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutAlertManagerDefinitionResponse' {AlertManagerDefinitionStatus
status :: AlertManagerDefinitionStatus
$sel:status:PutAlertManagerDefinitionResponse' :: PutAlertManagerDefinitionResponse -> AlertManagerDefinitionStatus
status} -> AlertManagerDefinitionStatus
status) (\s :: PutAlertManagerDefinitionResponse
s@PutAlertManagerDefinitionResponse' {} AlertManagerDefinitionStatus
a -> PutAlertManagerDefinitionResponse
s {$sel:status:PutAlertManagerDefinitionResponse' :: AlertManagerDefinitionStatus
status = AlertManagerDefinitionStatus
a} :: PutAlertManagerDefinitionResponse)
instance
Prelude.NFData
PutAlertManagerDefinitionResponse