{-# 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.SSMIncidents.StartIncident
(
StartIncident (..),
newStartIncident,
startIncident_clientToken,
startIncident_triggerDetails,
startIncident_relatedItems,
startIncident_impact,
startIncident_title,
startIncident_responsePlanArn,
StartIncidentResponse (..),
newStartIncidentResponse,
startIncidentResponse_httpStatus,
startIncidentResponse_incidentRecordArn,
)
where
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
import Amazonka.SSMIncidents.Types
data StartIncident = StartIncident'
{
StartIncident -> Maybe Text
clientToken :: Prelude.Maybe Prelude.Text,
StartIncident -> Maybe TriggerDetails
triggerDetails :: Prelude.Maybe TriggerDetails,
StartIncident -> Maybe [RelatedItem]
relatedItems :: Prelude.Maybe [RelatedItem],
StartIncident -> Maybe Natural
impact :: Prelude.Maybe Prelude.Natural,
StartIncident -> Maybe Text
title :: Prelude.Maybe Prelude.Text,
StartIncident -> Text
responsePlanArn :: Prelude.Text
}
deriving (StartIncident -> StartIncident -> Bool
(StartIncident -> StartIncident -> Bool)
-> (StartIncident -> StartIncident -> Bool) -> Eq StartIncident
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StartIncident -> StartIncident -> Bool
$c/= :: StartIncident -> StartIncident -> Bool
== :: StartIncident -> StartIncident -> Bool
$c== :: StartIncident -> StartIncident -> Bool
Prelude.Eq, ReadPrec [StartIncident]
ReadPrec StartIncident
Int -> ReadS StartIncident
ReadS [StartIncident]
(Int -> ReadS StartIncident)
-> ReadS [StartIncident]
-> ReadPrec StartIncident
-> ReadPrec [StartIncident]
-> Read StartIncident
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StartIncident]
$creadListPrec :: ReadPrec [StartIncident]
readPrec :: ReadPrec StartIncident
$creadPrec :: ReadPrec StartIncident
readList :: ReadS [StartIncident]
$creadList :: ReadS [StartIncident]
readsPrec :: Int -> ReadS StartIncident
$creadsPrec :: Int -> ReadS StartIncident
Prelude.Read, Int -> StartIncident -> ShowS
[StartIncident] -> ShowS
StartIncident -> String
(Int -> StartIncident -> ShowS)
-> (StartIncident -> String)
-> ([StartIncident] -> ShowS)
-> Show StartIncident
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StartIncident] -> ShowS
$cshowList :: [StartIncident] -> ShowS
show :: StartIncident -> String
$cshow :: StartIncident -> String
showsPrec :: Int -> StartIncident -> ShowS
$cshowsPrec :: Int -> StartIncident -> ShowS
Prelude.Show, (forall x. StartIncident -> Rep StartIncident x)
-> (forall x. Rep StartIncident x -> StartIncident)
-> Generic StartIncident
forall x. Rep StartIncident x -> StartIncident
forall x. StartIncident -> Rep StartIncident x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StartIncident x -> StartIncident
$cfrom :: forall x. StartIncident -> Rep StartIncident x
Prelude.Generic)
newStartIncident ::
Prelude.Text ->
StartIncident
newStartIncident :: Text -> StartIncident
newStartIncident Text
pResponsePlanArn_ =
StartIncident' :: Maybe Text
-> Maybe TriggerDetails
-> Maybe [RelatedItem]
-> Maybe Natural
-> Maybe Text
-> Text
-> StartIncident
StartIncident'
{ $sel:clientToken:StartIncident' :: Maybe Text
clientToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:triggerDetails:StartIncident' :: Maybe TriggerDetails
triggerDetails = Maybe TriggerDetails
forall a. Maybe a
Prelude.Nothing,
$sel:relatedItems:StartIncident' :: Maybe [RelatedItem]
relatedItems = Maybe [RelatedItem]
forall a. Maybe a
Prelude.Nothing,
$sel:impact:StartIncident' :: Maybe Natural
impact = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
$sel:title:StartIncident' :: Maybe Text
title = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:responsePlanArn:StartIncident' :: Text
responsePlanArn = Text
pResponsePlanArn_
}
startIncident_clientToken :: Lens.Lens' StartIncident (Prelude.Maybe Prelude.Text)
startIncident_clientToken :: (Maybe Text -> f (Maybe Text)) -> StartIncident -> f StartIncident
startIncident_clientToken = (StartIncident -> Maybe Text)
-> (StartIncident -> Maybe Text -> StartIncident)
-> Lens StartIncident StartIncident (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartIncident' {Maybe Text
clientToken :: Maybe Text
$sel:clientToken:StartIncident' :: StartIncident -> Maybe Text
clientToken} -> Maybe Text
clientToken) (\s :: StartIncident
s@StartIncident' {} Maybe Text
a -> StartIncident
s {$sel:clientToken:StartIncident' :: Maybe Text
clientToken = Maybe Text
a} :: StartIncident)
startIncident_triggerDetails :: Lens.Lens' StartIncident (Prelude.Maybe TriggerDetails)
startIncident_triggerDetails :: (Maybe TriggerDetails -> f (Maybe TriggerDetails))
-> StartIncident -> f StartIncident
startIncident_triggerDetails = (StartIncident -> Maybe TriggerDetails)
-> (StartIncident -> Maybe TriggerDetails -> StartIncident)
-> Lens
StartIncident
StartIncident
(Maybe TriggerDetails)
(Maybe TriggerDetails)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartIncident' {Maybe TriggerDetails
triggerDetails :: Maybe TriggerDetails
$sel:triggerDetails:StartIncident' :: StartIncident -> Maybe TriggerDetails
triggerDetails} -> Maybe TriggerDetails
triggerDetails) (\s :: StartIncident
s@StartIncident' {} Maybe TriggerDetails
a -> StartIncident
s {$sel:triggerDetails:StartIncident' :: Maybe TriggerDetails
triggerDetails = Maybe TriggerDetails
a} :: StartIncident)
startIncident_relatedItems :: Lens.Lens' StartIncident (Prelude.Maybe [RelatedItem])
startIncident_relatedItems :: (Maybe [RelatedItem] -> f (Maybe [RelatedItem]))
-> StartIncident -> f StartIncident
startIncident_relatedItems = (StartIncident -> Maybe [RelatedItem])
-> (StartIncident -> Maybe [RelatedItem] -> StartIncident)
-> Lens
StartIncident
StartIncident
(Maybe [RelatedItem])
(Maybe [RelatedItem])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartIncident' {Maybe [RelatedItem]
relatedItems :: Maybe [RelatedItem]
$sel:relatedItems:StartIncident' :: StartIncident -> Maybe [RelatedItem]
relatedItems} -> Maybe [RelatedItem]
relatedItems) (\s :: StartIncident
s@StartIncident' {} Maybe [RelatedItem]
a -> StartIncident
s {$sel:relatedItems:StartIncident' :: Maybe [RelatedItem]
relatedItems = Maybe [RelatedItem]
a} :: StartIncident) ((Maybe [RelatedItem] -> f (Maybe [RelatedItem]))
-> StartIncident -> f StartIncident)
-> ((Maybe [RelatedItem] -> f (Maybe [RelatedItem]))
-> Maybe [RelatedItem] -> f (Maybe [RelatedItem]))
-> (Maybe [RelatedItem] -> f (Maybe [RelatedItem]))
-> StartIncident
-> f StartIncident
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [RelatedItem] [RelatedItem] [RelatedItem] [RelatedItem]
-> Iso
(Maybe [RelatedItem])
(Maybe [RelatedItem])
(Maybe [RelatedItem])
(Maybe [RelatedItem])
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 [RelatedItem] [RelatedItem] [RelatedItem] [RelatedItem]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
startIncident_impact :: Lens.Lens' StartIncident (Prelude.Maybe Prelude.Natural)
startIncident_impact :: (Maybe Natural -> f (Maybe Natural))
-> StartIncident -> f StartIncident
startIncident_impact = (StartIncident -> Maybe Natural)
-> (StartIncident -> Maybe Natural -> StartIncident)
-> Lens StartIncident StartIncident (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartIncident' {Maybe Natural
impact :: Maybe Natural
$sel:impact:StartIncident' :: StartIncident -> Maybe Natural
impact} -> Maybe Natural
impact) (\s :: StartIncident
s@StartIncident' {} Maybe Natural
a -> StartIncident
s {$sel:impact:StartIncident' :: Maybe Natural
impact = Maybe Natural
a} :: StartIncident)
startIncident_title :: Lens.Lens' StartIncident (Prelude.Maybe Prelude.Text)
startIncident_title :: (Maybe Text -> f (Maybe Text)) -> StartIncident -> f StartIncident
startIncident_title = (StartIncident -> Maybe Text)
-> (StartIncident -> Maybe Text -> StartIncident)
-> Lens StartIncident StartIncident (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartIncident' {Maybe Text
title :: Maybe Text
$sel:title:StartIncident' :: StartIncident -> Maybe Text
title} -> Maybe Text
title) (\s :: StartIncident
s@StartIncident' {} Maybe Text
a -> StartIncident
s {$sel:title:StartIncident' :: Maybe Text
title = Maybe Text
a} :: StartIncident)
startIncident_responsePlanArn :: Lens.Lens' StartIncident Prelude.Text
startIncident_responsePlanArn :: (Text -> f Text) -> StartIncident -> f StartIncident
startIncident_responsePlanArn = (StartIncident -> Text)
-> (StartIncident -> Text -> StartIncident)
-> Lens StartIncident StartIncident Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartIncident' {Text
responsePlanArn :: Text
$sel:responsePlanArn:StartIncident' :: StartIncident -> Text
responsePlanArn} -> Text
responsePlanArn) (\s :: StartIncident
s@StartIncident' {} Text
a -> StartIncident
s {$sel:responsePlanArn:StartIncident' :: Text
responsePlanArn = Text
a} :: StartIncident)
instance Core.AWSRequest StartIncident where
type
AWSResponse StartIncident =
StartIncidentResponse
request :: StartIncident -> Request StartIncident
request = Service -> StartIncident -> Request StartIncident
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy StartIncident
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse StartIncident)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse StartIncident))
-> Logger
-> Service
-> Proxy StartIncident
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse StartIncident)))
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 -> Text -> StartIncidentResponse
StartIncidentResponse'
(Int -> Text -> StartIncidentResponse)
-> Either String Int
-> Either String (Text -> StartIncidentResponse)
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 (Text -> StartIncidentResponse)
-> Either String Text -> Either String StartIncidentResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String Text
forall a. FromJSON a => Object -> Text -> Either String a
Core..:> Text
"incidentRecordArn")
)
instance Prelude.Hashable StartIncident
instance Prelude.NFData StartIncident
instance Core.ToHeaders StartIncident where
toHeaders :: StartIncident -> ResponseHeaders
toHeaders =
ResponseHeaders -> StartIncident -> 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 StartIncident where
toJSON :: StartIncident -> Value
toJSON StartIncident' {Maybe Natural
Maybe [RelatedItem]
Maybe Text
Maybe TriggerDetails
Text
responsePlanArn :: Text
title :: Maybe Text
impact :: Maybe Natural
relatedItems :: Maybe [RelatedItem]
triggerDetails :: Maybe TriggerDetails
clientToken :: Maybe Text
$sel:responsePlanArn:StartIncident' :: StartIncident -> Text
$sel:title:StartIncident' :: StartIncident -> Maybe Text
$sel:impact:StartIncident' :: StartIncident -> Maybe Natural
$sel:relatedItems:StartIncident' :: StartIncident -> Maybe [RelatedItem]
$sel:triggerDetails:StartIncident' :: StartIncident -> Maybe TriggerDetails
$sel:clientToken:StartIncident' :: StartIncident -> 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,
(Text
"triggerDetails" Text -> TriggerDetails -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(TriggerDetails -> Pair) -> Maybe TriggerDetails -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe TriggerDetails
triggerDetails,
(Text
"relatedItems" Text -> [RelatedItem] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([RelatedItem] -> Pair) -> Maybe [RelatedItem] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [RelatedItem]
relatedItems,
(Text
"impact" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
impact,
(Text
"title" 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
title,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"responsePlanArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
responsePlanArn)
]
)
instance Core.ToPath StartIncident where
toPath :: StartIncident -> ByteString
toPath = ByteString -> StartIncident -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/startIncident"
instance Core.ToQuery StartIncident where
toQuery :: StartIncident -> QueryString
toQuery = QueryString -> StartIncident -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data StartIncidentResponse = StartIncidentResponse'
{
StartIncidentResponse -> Int
httpStatus :: Prelude.Int,
StartIncidentResponse -> Text
incidentRecordArn :: Prelude.Text
}
deriving (StartIncidentResponse -> StartIncidentResponse -> Bool
(StartIncidentResponse -> StartIncidentResponse -> Bool)
-> (StartIncidentResponse -> StartIncidentResponse -> Bool)
-> Eq StartIncidentResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StartIncidentResponse -> StartIncidentResponse -> Bool
$c/= :: StartIncidentResponse -> StartIncidentResponse -> Bool
== :: StartIncidentResponse -> StartIncidentResponse -> Bool
$c== :: StartIncidentResponse -> StartIncidentResponse -> Bool
Prelude.Eq, ReadPrec [StartIncidentResponse]
ReadPrec StartIncidentResponse
Int -> ReadS StartIncidentResponse
ReadS [StartIncidentResponse]
(Int -> ReadS StartIncidentResponse)
-> ReadS [StartIncidentResponse]
-> ReadPrec StartIncidentResponse
-> ReadPrec [StartIncidentResponse]
-> Read StartIncidentResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StartIncidentResponse]
$creadListPrec :: ReadPrec [StartIncidentResponse]
readPrec :: ReadPrec StartIncidentResponse
$creadPrec :: ReadPrec StartIncidentResponse
readList :: ReadS [StartIncidentResponse]
$creadList :: ReadS [StartIncidentResponse]
readsPrec :: Int -> ReadS StartIncidentResponse
$creadsPrec :: Int -> ReadS StartIncidentResponse
Prelude.Read, Int -> StartIncidentResponse -> ShowS
[StartIncidentResponse] -> ShowS
StartIncidentResponse -> String
(Int -> StartIncidentResponse -> ShowS)
-> (StartIncidentResponse -> String)
-> ([StartIncidentResponse] -> ShowS)
-> Show StartIncidentResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StartIncidentResponse] -> ShowS
$cshowList :: [StartIncidentResponse] -> ShowS
show :: StartIncidentResponse -> String
$cshow :: StartIncidentResponse -> String
showsPrec :: Int -> StartIncidentResponse -> ShowS
$cshowsPrec :: Int -> StartIncidentResponse -> ShowS
Prelude.Show, (forall x. StartIncidentResponse -> Rep StartIncidentResponse x)
-> (forall x. Rep StartIncidentResponse x -> StartIncidentResponse)
-> Generic StartIncidentResponse
forall x. Rep StartIncidentResponse x -> StartIncidentResponse
forall x. StartIncidentResponse -> Rep StartIncidentResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StartIncidentResponse x -> StartIncidentResponse
$cfrom :: forall x. StartIncidentResponse -> Rep StartIncidentResponse x
Prelude.Generic)
newStartIncidentResponse ::
Prelude.Int ->
Prelude.Text ->
StartIncidentResponse
newStartIncidentResponse :: Int -> Text -> StartIncidentResponse
newStartIncidentResponse
Int
pHttpStatus_
Text
pIncidentRecordArn_ =
StartIncidentResponse' :: Int -> Text -> StartIncidentResponse
StartIncidentResponse'
{ $sel:httpStatus:StartIncidentResponse' :: Int
httpStatus = Int
pHttpStatus_,
$sel:incidentRecordArn:StartIncidentResponse' :: Text
incidentRecordArn = Text
pIncidentRecordArn_
}
startIncidentResponse_httpStatus :: Lens.Lens' StartIncidentResponse Prelude.Int
startIncidentResponse_httpStatus :: (Int -> f Int) -> StartIncidentResponse -> f StartIncidentResponse
startIncidentResponse_httpStatus = (StartIncidentResponse -> Int)
-> (StartIncidentResponse -> Int -> StartIncidentResponse)
-> Lens StartIncidentResponse StartIncidentResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartIncidentResponse' {Int
httpStatus :: Int
$sel:httpStatus:StartIncidentResponse' :: StartIncidentResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: StartIncidentResponse
s@StartIncidentResponse' {} Int
a -> StartIncidentResponse
s {$sel:httpStatus:StartIncidentResponse' :: Int
httpStatus = Int
a} :: StartIncidentResponse)
startIncidentResponse_incidentRecordArn :: Lens.Lens' StartIncidentResponse Prelude.Text
startIncidentResponse_incidentRecordArn :: (Text -> f Text)
-> StartIncidentResponse -> f StartIncidentResponse
startIncidentResponse_incidentRecordArn = (StartIncidentResponse -> Text)
-> (StartIncidentResponse -> Text -> StartIncidentResponse)
-> Lens StartIncidentResponse StartIncidentResponse Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartIncidentResponse' {Text
incidentRecordArn :: Text
$sel:incidentRecordArn:StartIncidentResponse' :: StartIncidentResponse -> Text
incidentRecordArn} -> Text
incidentRecordArn) (\s :: StartIncidentResponse
s@StartIncidentResponse' {} Text
a -> StartIncidentResponse
s {$sel:incidentRecordArn:StartIncidentResponse' :: Text
incidentRecordArn = Text
a} :: StartIncidentResponse)
instance Prelude.NFData StartIncidentResponse