{-# 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 #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.SSMIncidents.CreateResponsePlan
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Creates a response plan that automates the initial response to
-- incidents. A response plan engages contacts, starts chat channel
-- collaboration, and initiates runbooks at the beginning of an incident.
module Amazonka.SSMIncidents.CreateResponsePlan
  ( -- * Creating a Request
    CreateResponsePlan (..),
    newCreateResponsePlan,

    -- * Request Lenses
    createResponsePlan_clientToken,
    createResponsePlan_actions,
    createResponsePlan_displayName,
    createResponsePlan_chatChannel,
    createResponsePlan_engagements,
    createResponsePlan_tags,
    createResponsePlan_incidentTemplate,
    createResponsePlan_name,

    -- * Destructuring the Response
    CreateResponsePlanResponse (..),
    newCreateResponsePlanResponse,

    -- * Response Lenses
    createResponsePlanResponse_httpStatus,
    createResponsePlanResponse_arn,
  )
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

-- | /See:/ 'newCreateResponsePlan' smart constructor.
data CreateResponsePlan = CreateResponsePlan'
  { -- | A token ensuring that the action is called only once with the specified
    -- details.
    CreateResponsePlan -> Maybe Text
clientToken :: Prelude.Maybe Prelude.Text,
    -- | The actions that the response plan starts at the beginning of an
    -- incident.
    CreateResponsePlan -> Maybe [Action]
actions :: Prelude.Maybe [Action],
    -- | The long format of the response plan name. This field can contain
    -- spaces.
    CreateResponsePlan -> Maybe Text
displayName :: Prelude.Maybe Prelude.Text,
    -- | The AWS Chatbot chat channel used for collaboration during an incident.
    CreateResponsePlan -> Maybe ChatChannel
chatChannel :: Prelude.Maybe ChatChannel,
    -- | The contacts and escalation plans that the response plan engages during
    -- an incident.
    CreateResponsePlan -> Maybe [Text]
engagements :: Prelude.Maybe [Prelude.Text],
    -- | A list of tags that you are adding to the response plan.
    CreateResponsePlan -> Maybe (HashMap Text Text)
tags :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | Details used to create an incident when using this response plan.
    CreateResponsePlan -> IncidentTemplate
incidentTemplate :: IncidentTemplate,
    -- | The short format name of the response plan. Can\'t include spaces.
    CreateResponsePlan -> Text
name :: Prelude.Text
  }
  deriving (CreateResponsePlan -> CreateResponsePlan -> Bool
(CreateResponsePlan -> CreateResponsePlan -> Bool)
-> (CreateResponsePlan -> CreateResponsePlan -> Bool)
-> Eq CreateResponsePlan
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateResponsePlan -> CreateResponsePlan -> Bool
$c/= :: CreateResponsePlan -> CreateResponsePlan -> Bool
== :: CreateResponsePlan -> CreateResponsePlan -> Bool
$c== :: CreateResponsePlan -> CreateResponsePlan -> Bool
Prelude.Eq, ReadPrec [CreateResponsePlan]
ReadPrec CreateResponsePlan
Int -> ReadS CreateResponsePlan
ReadS [CreateResponsePlan]
(Int -> ReadS CreateResponsePlan)
-> ReadS [CreateResponsePlan]
-> ReadPrec CreateResponsePlan
-> ReadPrec [CreateResponsePlan]
-> Read CreateResponsePlan
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateResponsePlan]
$creadListPrec :: ReadPrec [CreateResponsePlan]
readPrec :: ReadPrec CreateResponsePlan
$creadPrec :: ReadPrec CreateResponsePlan
readList :: ReadS [CreateResponsePlan]
$creadList :: ReadS [CreateResponsePlan]
readsPrec :: Int -> ReadS CreateResponsePlan
$creadsPrec :: Int -> ReadS CreateResponsePlan
Prelude.Read, Int -> CreateResponsePlan -> ShowS
[CreateResponsePlan] -> ShowS
CreateResponsePlan -> String
(Int -> CreateResponsePlan -> ShowS)
-> (CreateResponsePlan -> String)
-> ([CreateResponsePlan] -> ShowS)
-> Show CreateResponsePlan
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateResponsePlan] -> ShowS
$cshowList :: [CreateResponsePlan] -> ShowS
show :: CreateResponsePlan -> String
$cshow :: CreateResponsePlan -> String
showsPrec :: Int -> CreateResponsePlan -> ShowS
$cshowsPrec :: Int -> CreateResponsePlan -> ShowS
Prelude.Show, (forall x. CreateResponsePlan -> Rep CreateResponsePlan x)
-> (forall x. Rep CreateResponsePlan x -> CreateResponsePlan)
-> Generic CreateResponsePlan
forall x. Rep CreateResponsePlan x -> CreateResponsePlan
forall x. CreateResponsePlan -> Rep CreateResponsePlan x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateResponsePlan x -> CreateResponsePlan
$cfrom :: forall x. CreateResponsePlan -> Rep CreateResponsePlan x
Prelude.Generic)

-- |
-- Create a value of 'CreateResponsePlan' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'clientToken', 'createResponsePlan_clientToken' - A token ensuring that the action is called only once with the specified
-- details.
--
-- 'actions', 'createResponsePlan_actions' - The actions that the response plan starts at the beginning of an
-- incident.
--
-- 'displayName', 'createResponsePlan_displayName' - The long format of the response plan name. This field can contain
-- spaces.
--
-- 'chatChannel', 'createResponsePlan_chatChannel' - The AWS Chatbot chat channel used for collaboration during an incident.
--
-- 'engagements', 'createResponsePlan_engagements' - The contacts and escalation plans that the response plan engages during
-- an incident.
--
-- 'tags', 'createResponsePlan_tags' - A list of tags that you are adding to the response plan.
--
-- 'incidentTemplate', 'createResponsePlan_incidentTemplate' - Details used to create an incident when using this response plan.
--
-- 'name', 'createResponsePlan_name' - The short format name of the response plan. Can\'t include spaces.
newCreateResponsePlan ::
  -- | 'incidentTemplate'
  IncidentTemplate ->
  -- | 'name'
  Prelude.Text ->
  CreateResponsePlan
newCreateResponsePlan :: IncidentTemplate -> Text -> CreateResponsePlan
newCreateResponsePlan IncidentTemplate
pIncidentTemplate_ Text
pName_ =
  CreateResponsePlan' :: Maybe Text
-> Maybe [Action]
-> Maybe Text
-> Maybe ChatChannel
-> Maybe [Text]
-> Maybe (HashMap Text Text)
-> IncidentTemplate
-> Text
-> CreateResponsePlan
CreateResponsePlan'
    { $sel:clientToken:CreateResponsePlan' :: Maybe Text
clientToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:actions:CreateResponsePlan' :: Maybe [Action]
actions = Maybe [Action]
forall a. Maybe a
Prelude.Nothing,
      $sel:displayName:CreateResponsePlan' :: Maybe Text
displayName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:chatChannel:CreateResponsePlan' :: Maybe ChatChannel
chatChannel = Maybe ChatChannel
forall a. Maybe a
Prelude.Nothing,
      $sel:engagements:CreateResponsePlan' :: Maybe [Text]
engagements = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:tags:CreateResponsePlan' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing,
      $sel:incidentTemplate:CreateResponsePlan' :: IncidentTemplate
incidentTemplate = IncidentTemplate
pIncidentTemplate_,
      $sel:name:CreateResponsePlan' :: Text
name = Text
pName_
    }

-- | A token ensuring that the action is called only once with the specified
-- details.
createResponsePlan_clientToken :: Lens.Lens' CreateResponsePlan (Prelude.Maybe Prelude.Text)
createResponsePlan_clientToken :: (Maybe Text -> f (Maybe Text))
-> CreateResponsePlan -> f CreateResponsePlan
createResponsePlan_clientToken = (CreateResponsePlan -> Maybe Text)
-> (CreateResponsePlan -> Maybe Text -> CreateResponsePlan)
-> Lens
     CreateResponsePlan CreateResponsePlan (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateResponsePlan' {Maybe Text
clientToken :: Maybe Text
$sel:clientToken:CreateResponsePlan' :: CreateResponsePlan -> Maybe Text
clientToken} -> Maybe Text
clientToken) (\s :: CreateResponsePlan
s@CreateResponsePlan' {} Maybe Text
a -> CreateResponsePlan
s {$sel:clientToken:CreateResponsePlan' :: Maybe Text
clientToken = Maybe Text
a} :: CreateResponsePlan)

-- | The actions that the response plan starts at the beginning of an
-- incident.
createResponsePlan_actions :: Lens.Lens' CreateResponsePlan (Prelude.Maybe [Action])
createResponsePlan_actions :: (Maybe [Action] -> f (Maybe [Action]))
-> CreateResponsePlan -> f CreateResponsePlan
createResponsePlan_actions = (CreateResponsePlan -> Maybe [Action])
-> (CreateResponsePlan -> Maybe [Action] -> CreateResponsePlan)
-> Lens
     CreateResponsePlan
     CreateResponsePlan
     (Maybe [Action])
     (Maybe [Action])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateResponsePlan' {Maybe [Action]
actions :: Maybe [Action]
$sel:actions:CreateResponsePlan' :: CreateResponsePlan -> Maybe [Action]
actions} -> Maybe [Action]
actions) (\s :: CreateResponsePlan
s@CreateResponsePlan' {} Maybe [Action]
a -> CreateResponsePlan
s {$sel:actions:CreateResponsePlan' :: Maybe [Action]
actions = Maybe [Action]
a} :: CreateResponsePlan) ((Maybe [Action] -> f (Maybe [Action]))
 -> CreateResponsePlan -> f CreateResponsePlan)
-> ((Maybe [Action] -> f (Maybe [Action]))
    -> Maybe [Action] -> f (Maybe [Action]))
-> (Maybe [Action] -> f (Maybe [Action]))
-> CreateResponsePlan
-> f CreateResponsePlan
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Action] [Action] [Action] [Action]
-> Iso
     (Maybe [Action]) (Maybe [Action]) (Maybe [Action]) (Maybe [Action])
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 [Action] [Action] [Action] [Action]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The long format of the response plan name. This field can contain
-- spaces.
createResponsePlan_displayName :: Lens.Lens' CreateResponsePlan (Prelude.Maybe Prelude.Text)
createResponsePlan_displayName :: (Maybe Text -> f (Maybe Text))
-> CreateResponsePlan -> f CreateResponsePlan
createResponsePlan_displayName = (CreateResponsePlan -> Maybe Text)
-> (CreateResponsePlan -> Maybe Text -> CreateResponsePlan)
-> Lens
     CreateResponsePlan CreateResponsePlan (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateResponsePlan' {Maybe Text
displayName :: Maybe Text
$sel:displayName:CreateResponsePlan' :: CreateResponsePlan -> Maybe Text
displayName} -> Maybe Text
displayName) (\s :: CreateResponsePlan
s@CreateResponsePlan' {} Maybe Text
a -> CreateResponsePlan
s {$sel:displayName:CreateResponsePlan' :: Maybe Text
displayName = Maybe Text
a} :: CreateResponsePlan)

-- | The AWS Chatbot chat channel used for collaboration during an incident.
createResponsePlan_chatChannel :: Lens.Lens' CreateResponsePlan (Prelude.Maybe ChatChannel)
createResponsePlan_chatChannel :: (Maybe ChatChannel -> f (Maybe ChatChannel))
-> CreateResponsePlan -> f CreateResponsePlan
createResponsePlan_chatChannel = (CreateResponsePlan -> Maybe ChatChannel)
-> (CreateResponsePlan -> Maybe ChatChannel -> CreateResponsePlan)
-> Lens
     CreateResponsePlan
     CreateResponsePlan
     (Maybe ChatChannel)
     (Maybe ChatChannel)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateResponsePlan' {Maybe ChatChannel
chatChannel :: Maybe ChatChannel
$sel:chatChannel:CreateResponsePlan' :: CreateResponsePlan -> Maybe ChatChannel
chatChannel} -> Maybe ChatChannel
chatChannel) (\s :: CreateResponsePlan
s@CreateResponsePlan' {} Maybe ChatChannel
a -> CreateResponsePlan
s {$sel:chatChannel:CreateResponsePlan' :: Maybe ChatChannel
chatChannel = Maybe ChatChannel
a} :: CreateResponsePlan)

-- | The contacts and escalation plans that the response plan engages during
-- an incident.
createResponsePlan_engagements :: Lens.Lens' CreateResponsePlan (Prelude.Maybe [Prelude.Text])
createResponsePlan_engagements :: (Maybe [Text] -> f (Maybe [Text]))
-> CreateResponsePlan -> f CreateResponsePlan
createResponsePlan_engagements = (CreateResponsePlan -> Maybe [Text])
-> (CreateResponsePlan -> Maybe [Text] -> CreateResponsePlan)
-> Lens
     CreateResponsePlan CreateResponsePlan (Maybe [Text]) (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateResponsePlan' {Maybe [Text]
engagements :: Maybe [Text]
$sel:engagements:CreateResponsePlan' :: CreateResponsePlan -> Maybe [Text]
engagements} -> Maybe [Text]
engagements) (\s :: CreateResponsePlan
s@CreateResponsePlan' {} Maybe [Text]
a -> CreateResponsePlan
s {$sel:engagements:CreateResponsePlan' :: Maybe [Text]
engagements = Maybe [Text]
a} :: CreateResponsePlan) ((Maybe [Text] -> f (Maybe [Text]))
 -> CreateResponsePlan -> f CreateResponsePlan)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> CreateResponsePlan
-> f CreateResponsePlan
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
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 [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | A list of tags that you are adding to the response plan.
createResponsePlan_tags :: Lens.Lens' CreateResponsePlan (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
createResponsePlan_tags :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> CreateResponsePlan -> f CreateResponsePlan
createResponsePlan_tags = (CreateResponsePlan -> Maybe (HashMap Text Text))
-> (CreateResponsePlan
    -> Maybe (HashMap Text Text) -> CreateResponsePlan)
-> Lens
     CreateResponsePlan
     CreateResponsePlan
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateResponsePlan' {Maybe (HashMap Text Text)
tags :: Maybe (HashMap Text Text)
$sel:tags:CreateResponsePlan' :: CreateResponsePlan -> Maybe (HashMap Text Text)
tags} -> Maybe (HashMap Text Text)
tags) (\s :: CreateResponsePlan
s@CreateResponsePlan' {} Maybe (HashMap Text Text)
a -> CreateResponsePlan
s {$sel:tags:CreateResponsePlan' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
a} :: CreateResponsePlan) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
 -> CreateResponsePlan -> f CreateResponsePlan)
-> ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
    -> Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> CreateResponsePlan
-> f CreateResponsePlan
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
-> Iso
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
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
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Details used to create an incident when using this response plan.
createResponsePlan_incidentTemplate :: Lens.Lens' CreateResponsePlan IncidentTemplate
createResponsePlan_incidentTemplate :: (IncidentTemplate -> f IncidentTemplate)
-> CreateResponsePlan -> f CreateResponsePlan
createResponsePlan_incidentTemplate = (CreateResponsePlan -> IncidentTemplate)
-> (CreateResponsePlan -> IncidentTemplate -> CreateResponsePlan)
-> Lens
     CreateResponsePlan
     CreateResponsePlan
     IncidentTemplate
     IncidentTemplate
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateResponsePlan' {IncidentTemplate
incidentTemplate :: IncidentTemplate
$sel:incidentTemplate:CreateResponsePlan' :: CreateResponsePlan -> IncidentTemplate
incidentTemplate} -> IncidentTemplate
incidentTemplate) (\s :: CreateResponsePlan
s@CreateResponsePlan' {} IncidentTemplate
a -> CreateResponsePlan
s {$sel:incidentTemplate:CreateResponsePlan' :: IncidentTemplate
incidentTemplate = IncidentTemplate
a} :: CreateResponsePlan)

-- | The short format name of the response plan. Can\'t include spaces.
createResponsePlan_name :: Lens.Lens' CreateResponsePlan Prelude.Text
createResponsePlan_name :: (Text -> f Text) -> CreateResponsePlan -> f CreateResponsePlan
createResponsePlan_name = (CreateResponsePlan -> Text)
-> (CreateResponsePlan -> Text -> CreateResponsePlan)
-> Lens CreateResponsePlan CreateResponsePlan Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateResponsePlan' {Text
name :: Text
$sel:name:CreateResponsePlan' :: CreateResponsePlan -> Text
name} -> Text
name) (\s :: CreateResponsePlan
s@CreateResponsePlan' {} Text
a -> CreateResponsePlan
s {$sel:name:CreateResponsePlan' :: Text
name = Text
a} :: CreateResponsePlan)

instance Core.AWSRequest CreateResponsePlan where
  type
    AWSResponse CreateResponsePlan =
      CreateResponsePlanResponse
  request :: CreateResponsePlan -> Request CreateResponsePlan
request = Service -> CreateResponsePlan -> Request CreateResponsePlan
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy CreateResponsePlan
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CreateResponsePlan)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse CreateResponsePlan))
-> Logger
-> Service
-> Proxy CreateResponsePlan
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CreateResponsePlan)))
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 -> CreateResponsePlanResponse
CreateResponsePlanResponse'
            (Int -> Text -> CreateResponsePlanResponse)
-> Either String Int
-> Either String (Text -> CreateResponsePlanResponse)
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 -> CreateResponsePlanResponse)
-> Either String Text -> Either String CreateResponsePlanResponse
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
"arn")
      )

instance Prelude.Hashable CreateResponsePlan

instance Prelude.NFData CreateResponsePlan

instance Core.ToHeaders CreateResponsePlan where
  toHeaders :: CreateResponsePlan -> ResponseHeaders
toHeaders =
    ResponseHeaders -> CreateResponsePlan -> 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 CreateResponsePlan where
  toJSON :: CreateResponsePlan -> Value
toJSON CreateResponsePlan' {Maybe [Text]
Maybe [Action]
Maybe Text
Maybe (HashMap Text Text)
Maybe ChatChannel
Text
IncidentTemplate
name :: Text
incidentTemplate :: IncidentTemplate
tags :: Maybe (HashMap Text Text)
engagements :: Maybe [Text]
chatChannel :: Maybe ChatChannel
displayName :: Maybe Text
actions :: Maybe [Action]
clientToken :: Maybe Text
$sel:name:CreateResponsePlan' :: CreateResponsePlan -> Text
$sel:incidentTemplate:CreateResponsePlan' :: CreateResponsePlan -> IncidentTemplate
$sel:tags:CreateResponsePlan' :: CreateResponsePlan -> Maybe (HashMap Text Text)
$sel:engagements:CreateResponsePlan' :: CreateResponsePlan -> Maybe [Text]
$sel:chatChannel:CreateResponsePlan' :: CreateResponsePlan -> Maybe ChatChannel
$sel:displayName:CreateResponsePlan' :: CreateResponsePlan -> Maybe Text
$sel:actions:CreateResponsePlan' :: CreateResponsePlan -> Maybe [Action]
$sel:clientToken:CreateResponsePlan' :: CreateResponsePlan -> 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
"actions" Text -> [Action] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([Action] -> Pair) -> Maybe [Action] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Action]
actions,
            (Text
"displayName" 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
displayName,
            (Text
"chatChannel" Text -> ChatChannel -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (ChatChannel -> Pair) -> Maybe ChatChannel -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ChatChannel
chatChannel,
            (Text
"engagements" 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]
engagements,
            (Text
"tags" Text -> HashMap Text Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (HashMap Text Text -> Pair)
-> Maybe (HashMap Text Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text Text)
tags,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"incidentTemplate" Text -> IncidentTemplate -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= IncidentTemplate
incidentTemplate),
            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 CreateResponsePlan where
  toPath :: CreateResponsePlan -> ByteString
toPath = ByteString -> CreateResponsePlan -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/createResponsePlan"

instance Core.ToQuery CreateResponsePlan where
  toQuery :: CreateResponsePlan -> QueryString
toQuery = QueryString -> CreateResponsePlan -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty

-- | /See:/ 'newCreateResponsePlanResponse' smart constructor.
data CreateResponsePlanResponse = CreateResponsePlanResponse'
  { -- | The response's http status code.
    CreateResponsePlanResponse -> Int
httpStatus :: Prelude.Int,
    -- | The Amazon Resource Name (ARN) of the response plan.
    CreateResponsePlanResponse -> Text
arn :: Prelude.Text
  }
  deriving (CreateResponsePlanResponse -> CreateResponsePlanResponse -> Bool
(CreateResponsePlanResponse -> CreateResponsePlanResponse -> Bool)
-> (CreateResponsePlanResponse
    -> CreateResponsePlanResponse -> Bool)
-> Eq CreateResponsePlanResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateResponsePlanResponse -> CreateResponsePlanResponse -> Bool
$c/= :: CreateResponsePlanResponse -> CreateResponsePlanResponse -> Bool
== :: CreateResponsePlanResponse -> CreateResponsePlanResponse -> Bool
$c== :: CreateResponsePlanResponse -> CreateResponsePlanResponse -> Bool
Prelude.Eq, ReadPrec [CreateResponsePlanResponse]
ReadPrec CreateResponsePlanResponse
Int -> ReadS CreateResponsePlanResponse
ReadS [CreateResponsePlanResponse]
(Int -> ReadS CreateResponsePlanResponse)
-> ReadS [CreateResponsePlanResponse]
-> ReadPrec CreateResponsePlanResponse
-> ReadPrec [CreateResponsePlanResponse]
-> Read CreateResponsePlanResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateResponsePlanResponse]
$creadListPrec :: ReadPrec [CreateResponsePlanResponse]
readPrec :: ReadPrec CreateResponsePlanResponse
$creadPrec :: ReadPrec CreateResponsePlanResponse
readList :: ReadS [CreateResponsePlanResponse]
$creadList :: ReadS [CreateResponsePlanResponse]
readsPrec :: Int -> ReadS CreateResponsePlanResponse
$creadsPrec :: Int -> ReadS CreateResponsePlanResponse
Prelude.Read, Int -> CreateResponsePlanResponse -> ShowS
[CreateResponsePlanResponse] -> ShowS
CreateResponsePlanResponse -> String
(Int -> CreateResponsePlanResponse -> ShowS)
-> (CreateResponsePlanResponse -> String)
-> ([CreateResponsePlanResponse] -> ShowS)
-> Show CreateResponsePlanResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateResponsePlanResponse] -> ShowS
$cshowList :: [CreateResponsePlanResponse] -> ShowS
show :: CreateResponsePlanResponse -> String
$cshow :: CreateResponsePlanResponse -> String
showsPrec :: Int -> CreateResponsePlanResponse -> ShowS
$cshowsPrec :: Int -> CreateResponsePlanResponse -> ShowS
Prelude.Show, (forall x.
 CreateResponsePlanResponse -> Rep CreateResponsePlanResponse x)
-> (forall x.
    Rep CreateResponsePlanResponse x -> CreateResponsePlanResponse)
-> Generic CreateResponsePlanResponse
forall x.
Rep CreateResponsePlanResponse x -> CreateResponsePlanResponse
forall x.
CreateResponsePlanResponse -> Rep CreateResponsePlanResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateResponsePlanResponse x -> CreateResponsePlanResponse
$cfrom :: forall x.
CreateResponsePlanResponse -> Rep CreateResponsePlanResponse x
Prelude.Generic)

-- |
-- Create a value of 'CreateResponsePlanResponse' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'httpStatus', 'createResponsePlanResponse_httpStatus' - The response's http status code.
--
-- 'arn', 'createResponsePlanResponse_arn' - The Amazon Resource Name (ARN) of the response plan.
newCreateResponsePlanResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  -- | 'arn'
  Prelude.Text ->
  CreateResponsePlanResponse
newCreateResponsePlanResponse :: Int -> Text -> CreateResponsePlanResponse
newCreateResponsePlanResponse Int
pHttpStatus_ Text
pArn_ =
  CreateResponsePlanResponse' :: Int -> Text -> CreateResponsePlanResponse
CreateResponsePlanResponse'
    { $sel:httpStatus:CreateResponsePlanResponse' :: Int
httpStatus =
        Int
pHttpStatus_,
      $sel:arn:CreateResponsePlanResponse' :: Text
arn = Text
pArn_
    }

-- | The response's http status code.
createResponsePlanResponse_httpStatus :: Lens.Lens' CreateResponsePlanResponse Prelude.Int
createResponsePlanResponse_httpStatus :: (Int -> f Int)
-> CreateResponsePlanResponse -> f CreateResponsePlanResponse
createResponsePlanResponse_httpStatus = (CreateResponsePlanResponse -> Int)
-> (CreateResponsePlanResponse
    -> Int -> CreateResponsePlanResponse)
-> Lens
     CreateResponsePlanResponse CreateResponsePlanResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateResponsePlanResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateResponsePlanResponse' :: CreateResponsePlanResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateResponsePlanResponse
s@CreateResponsePlanResponse' {} Int
a -> CreateResponsePlanResponse
s {$sel:httpStatus:CreateResponsePlanResponse' :: Int
httpStatus = Int
a} :: CreateResponsePlanResponse)

-- | The Amazon Resource Name (ARN) of the response plan.
createResponsePlanResponse_arn :: Lens.Lens' CreateResponsePlanResponse Prelude.Text
createResponsePlanResponse_arn :: (Text -> f Text)
-> CreateResponsePlanResponse -> f CreateResponsePlanResponse
createResponsePlanResponse_arn = (CreateResponsePlanResponse -> Text)
-> (CreateResponsePlanResponse
    -> Text -> CreateResponsePlanResponse)
-> Lens
     CreateResponsePlanResponse CreateResponsePlanResponse Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateResponsePlanResponse' {Text
arn :: Text
$sel:arn:CreateResponsePlanResponse' :: CreateResponsePlanResponse -> Text
arn} -> Text
arn) (\s :: CreateResponsePlanResponse
s@CreateResponsePlanResponse' {} Text
a -> CreateResponsePlanResponse
s {$sel:arn:CreateResponsePlanResponse' :: Text
arn = Text
a} :: CreateResponsePlanResponse)

instance Prelude.NFData CreateResponsePlanResponse