{-# 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.SSM.CreateOpsItem
-- 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 new OpsItem. You must have permission in Identity and Access
-- Management (IAM) to create a new OpsItem. For more information, see
-- <https://docs.aws.amazon.com/systems-manager/latest/userguide/OpsCenter-getting-started.html Getting started with OpsCenter>
-- in the /Amazon Web Services Systems Manager User Guide/.
--
-- Operations engineers and IT professionals use Amazon Web Services
-- Systems Manager OpsCenter to view, investigate, and remediate
-- operational issues impacting the performance and health of their Amazon
-- Web Services resources. For more information, see
-- <https://docs.aws.amazon.com/systems-manager/latest/userguide/OpsCenter.html Amazon Web Services Systems Manager OpsCenter>
-- in the /Amazon Web Services Systems Manager User Guide/.
module Amazonka.SSM.CreateOpsItem
  ( -- * Creating a Request
    CreateOpsItem (..),
    newCreateOpsItem,

    -- * Request Lenses
    createOpsItem_actualEndTime,
    createOpsItem_priority,
    createOpsItem_category,
    createOpsItem_severity,
    createOpsItem_opsItemType,
    createOpsItem_relatedOpsItems,
    createOpsItem_operationalData,
    createOpsItem_actualStartTime,
    createOpsItem_plannedEndTime,
    createOpsItem_notifications,
    createOpsItem_tags,
    createOpsItem_plannedStartTime,
    createOpsItem_description,
    createOpsItem_source,
    createOpsItem_title,

    -- * Destructuring the Response
    CreateOpsItemResponse (..),
    newCreateOpsItemResponse,

    -- * Response Lenses
    createOpsItemResponse_opsItemId,
    createOpsItemResponse_httpStatus,
  )
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.SSM.Types

-- | /See:/ 'newCreateOpsItem' smart constructor.
data CreateOpsItem = CreateOpsItem'
  { -- | The time a runbook workflow ended. Currently reported only for the
    -- OpsItem type @\/aws\/changerequest@.
    CreateOpsItem -> Maybe POSIX
actualEndTime :: Prelude.Maybe Core.POSIX,
    -- | The importance of this OpsItem in relation to other OpsItems in the
    -- system.
    CreateOpsItem -> Maybe Natural
priority :: Prelude.Maybe Prelude.Natural,
    -- | Specify a category to assign to an OpsItem.
    CreateOpsItem -> Maybe Text
category :: Prelude.Maybe Prelude.Text,
    -- | Specify a severity to assign to an OpsItem.
    CreateOpsItem -> Maybe Text
severity :: Prelude.Maybe Prelude.Text,
    -- | The type of OpsItem to create. Currently, the only valid values are
    -- @\/aws\/changerequest@ and @\/aws\/issue@.
    CreateOpsItem -> Maybe Text
opsItemType :: Prelude.Maybe Prelude.Text,
    -- | One or more OpsItems that share something in common with the current
    -- OpsItems. For example, related OpsItems can include OpsItems with
    -- similar error messages, impacted resources, or statuses for the impacted
    -- resource.
    CreateOpsItem -> Maybe [RelatedOpsItem]
relatedOpsItems :: Prelude.Maybe [RelatedOpsItem],
    -- | Operational data is custom data that provides useful reference details
    -- about the OpsItem. For example, you can specify log files, error
    -- strings, license keys, troubleshooting tips, or other relevant data. You
    -- enter operational data as key-value pairs. The key has a maximum length
    -- of 128 characters. The value has a maximum size of 20 KB.
    --
    -- Operational data keys /can\'t/ begin with the following: @amazon@,
    -- @aws@, @amzn@, @ssm@, @\/amazon@, @\/aws@, @\/amzn@, @\/ssm@.
    --
    -- You can choose to make the data searchable by other users in the account
    -- or you can restrict search access. Searchable data means that all users
    -- with access to the OpsItem Overview page (as provided by the
    -- DescribeOpsItems API operation) can view and search on the specified
    -- data. Operational data that isn\'t searchable is only viewable by users
    -- who have access to the OpsItem (as provided by the GetOpsItem API
    -- operation).
    --
    -- Use the @\/aws\/resources@ key in OperationalData to specify a related
    -- resource in the request. Use the @\/aws\/automations@ key in
    -- OperationalData to associate an Automation runbook with the OpsItem. To
    -- view Amazon Web Services CLI example commands that use these keys, see
    -- <https://docs.aws.amazon.com/systems-manager/latest/userguide/OpsCenter-creating-OpsItems.html#OpsCenter-manually-create-OpsItems Creating OpsItems manually>
    -- in the /Amazon Web Services Systems Manager User Guide/.
    CreateOpsItem -> Maybe (HashMap Text OpsItemDataValue)
operationalData :: Prelude.Maybe (Prelude.HashMap Prelude.Text OpsItemDataValue),
    -- | The time a runbook workflow started. Currently reported only for the
    -- OpsItem type @\/aws\/changerequest@.
    CreateOpsItem -> Maybe POSIX
actualStartTime :: Prelude.Maybe Core.POSIX,
    -- | The time specified in a change request for a runbook workflow to end.
    -- Currently supported only for the OpsItem type @\/aws\/changerequest@.
    CreateOpsItem -> Maybe POSIX
plannedEndTime :: Prelude.Maybe Core.POSIX,
    -- | The Amazon Resource Name (ARN) of an SNS topic where notifications are
    -- sent when this OpsItem is edited or changed.
    CreateOpsItem -> Maybe [OpsItemNotification]
notifications :: Prelude.Maybe [OpsItemNotification],
    -- | Optional metadata that you assign to a resource. You can restrict access
    -- to OpsItems by using an inline IAM policy that specifies tags. For more
    -- information, see
    -- <https://docs.aws.amazon.com/systems-manager/latest/userguide/OpsCenter-getting-started.html#OpsCenter-getting-started-user-permissions Getting started with OpsCenter>
    -- in the /Amazon Web Services Systems Manager User Guide/.
    --
    -- Tags use a key-value pair. For example:
    --
    -- @Key=Department,Value=Finance@
    --
    -- To add tags to a new OpsItem, a user must have IAM permissions for both
    -- the @ssm:CreateOpsItems@ operation and the @ssm:AddTagsToResource@
    -- operation. To add tags to an existing OpsItem, use the AddTagsToResource
    -- operation.
    CreateOpsItem -> Maybe [Tag]
tags :: Prelude.Maybe [Tag],
    -- | The time specified in a change request for a runbook workflow to start.
    -- Currently supported only for the OpsItem type @\/aws\/changerequest@.
    CreateOpsItem -> Maybe POSIX
plannedStartTime :: Prelude.Maybe Core.POSIX,
    -- | Information about the OpsItem.
    CreateOpsItem -> Text
description :: Prelude.Text,
    -- | The origin of the OpsItem, such as Amazon EC2 or Systems Manager.
    --
    -- The source name can\'t contain the following strings: @aws@, @amazon@,
    -- and @amzn@.
    CreateOpsItem -> Text
source :: Prelude.Text,
    -- | A short heading that describes the nature of the OpsItem and the
    -- impacted resource.
    CreateOpsItem -> Text
title :: Prelude.Text
  }
  deriving (CreateOpsItem -> CreateOpsItem -> Bool
(CreateOpsItem -> CreateOpsItem -> Bool)
-> (CreateOpsItem -> CreateOpsItem -> Bool) -> Eq CreateOpsItem
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateOpsItem -> CreateOpsItem -> Bool
$c/= :: CreateOpsItem -> CreateOpsItem -> Bool
== :: CreateOpsItem -> CreateOpsItem -> Bool
$c== :: CreateOpsItem -> CreateOpsItem -> Bool
Prelude.Eq, ReadPrec [CreateOpsItem]
ReadPrec CreateOpsItem
Int -> ReadS CreateOpsItem
ReadS [CreateOpsItem]
(Int -> ReadS CreateOpsItem)
-> ReadS [CreateOpsItem]
-> ReadPrec CreateOpsItem
-> ReadPrec [CreateOpsItem]
-> Read CreateOpsItem
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateOpsItem]
$creadListPrec :: ReadPrec [CreateOpsItem]
readPrec :: ReadPrec CreateOpsItem
$creadPrec :: ReadPrec CreateOpsItem
readList :: ReadS [CreateOpsItem]
$creadList :: ReadS [CreateOpsItem]
readsPrec :: Int -> ReadS CreateOpsItem
$creadsPrec :: Int -> ReadS CreateOpsItem
Prelude.Read, Int -> CreateOpsItem -> ShowS
[CreateOpsItem] -> ShowS
CreateOpsItem -> String
(Int -> CreateOpsItem -> ShowS)
-> (CreateOpsItem -> String)
-> ([CreateOpsItem] -> ShowS)
-> Show CreateOpsItem
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateOpsItem] -> ShowS
$cshowList :: [CreateOpsItem] -> ShowS
show :: CreateOpsItem -> String
$cshow :: CreateOpsItem -> String
showsPrec :: Int -> CreateOpsItem -> ShowS
$cshowsPrec :: Int -> CreateOpsItem -> ShowS
Prelude.Show, (forall x. CreateOpsItem -> Rep CreateOpsItem x)
-> (forall x. Rep CreateOpsItem x -> CreateOpsItem)
-> Generic CreateOpsItem
forall x. Rep CreateOpsItem x -> CreateOpsItem
forall x. CreateOpsItem -> Rep CreateOpsItem x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateOpsItem x -> CreateOpsItem
$cfrom :: forall x. CreateOpsItem -> Rep CreateOpsItem x
Prelude.Generic)

-- |
-- Create a value of 'CreateOpsItem' 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:
--
-- 'actualEndTime', 'createOpsItem_actualEndTime' - The time a runbook workflow ended. Currently reported only for the
-- OpsItem type @\/aws\/changerequest@.
--
-- 'priority', 'createOpsItem_priority' - The importance of this OpsItem in relation to other OpsItems in the
-- system.
--
-- 'category', 'createOpsItem_category' - Specify a category to assign to an OpsItem.
--
-- 'severity', 'createOpsItem_severity' - Specify a severity to assign to an OpsItem.
--
-- 'opsItemType', 'createOpsItem_opsItemType' - The type of OpsItem to create. Currently, the only valid values are
-- @\/aws\/changerequest@ and @\/aws\/issue@.
--
-- 'relatedOpsItems', 'createOpsItem_relatedOpsItems' - One or more OpsItems that share something in common with the current
-- OpsItems. For example, related OpsItems can include OpsItems with
-- similar error messages, impacted resources, or statuses for the impacted
-- resource.
--
-- 'operationalData', 'createOpsItem_operationalData' - Operational data is custom data that provides useful reference details
-- about the OpsItem. For example, you can specify log files, error
-- strings, license keys, troubleshooting tips, or other relevant data. You
-- enter operational data as key-value pairs. The key has a maximum length
-- of 128 characters. The value has a maximum size of 20 KB.
--
-- Operational data keys /can\'t/ begin with the following: @amazon@,
-- @aws@, @amzn@, @ssm@, @\/amazon@, @\/aws@, @\/amzn@, @\/ssm@.
--
-- You can choose to make the data searchable by other users in the account
-- or you can restrict search access. Searchable data means that all users
-- with access to the OpsItem Overview page (as provided by the
-- DescribeOpsItems API operation) can view and search on the specified
-- data. Operational data that isn\'t searchable is only viewable by users
-- who have access to the OpsItem (as provided by the GetOpsItem API
-- operation).
--
-- Use the @\/aws\/resources@ key in OperationalData to specify a related
-- resource in the request. Use the @\/aws\/automations@ key in
-- OperationalData to associate an Automation runbook with the OpsItem. To
-- view Amazon Web Services CLI example commands that use these keys, see
-- <https://docs.aws.amazon.com/systems-manager/latest/userguide/OpsCenter-creating-OpsItems.html#OpsCenter-manually-create-OpsItems Creating OpsItems manually>
-- in the /Amazon Web Services Systems Manager User Guide/.
--
-- 'actualStartTime', 'createOpsItem_actualStartTime' - The time a runbook workflow started. Currently reported only for the
-- OpsItem type @\/aws\/changerequest@.
--
-- 'plannedEndTime', 'createOpsItem_plannedEndTime' - The time specified in a change request for a runbook workflow to end.
-- Currently supported only for the OpsItem type @\/aws\/changerequest@.
--
-- 'notifications', 'createOpsItem_notifications' - The Amazon Resource Name (ARN) of an SNS topic where notifications are
-- sent when this OpsItem is edited or changed.
--
-- 'tags', 'createOpsItem_tags' - Optional metadata that you assign to a resource. You can restrict access
-- to OpsItems by using an inline IAM policy that specifies tags. For more
-- information, see
-- <https://docs.aws.amazon.com/systems-manager/latest/userguide/OpsCenter-getting-started.html#OpsCenter-getting-started-user-permissions Getting started with OpsCenter>
-- in the /Amazon Web Services Systems Manager User Guide/.
--
-- Tags use a key-value pair. For example:
--
-- @Key=Department,Value=Finance@
--
-- To add tags to a new OpsItem, a user must have IAM permissions for both
-- the @ssm:CreateOpsItems@ operation and the @ssm:AddTagsToResource@
-- operation. To add tags to an existing OpsItem, use the AddTagsToResource
-- operation.
--
-- 'plannedStartTime', 'createOpsItem_plannedStartTime' - The time specified in a change request for a runbook workflow to start.
-- Currently supported only for the OpsItem type @\/aws\/changerequest@.
--
-- 'description', 'createOpsItem_description' - Information about the OpsItem.
--
-- 'source', 'createOpsItem_source' - The origin of the OpsItem, such as Amazon EC2 or Systems Manager.
--
-- The source name can\'t contain the following strings: @aws@, @amazon@,
-- and @amzn@.
--
-- 'title', 'createOpsItem_title' - A short heading that describes the nature of the OpsItem and the
-- impacted resource.
newCreateOpsItem ::
  -- | 'description'
  Prelude.Text ->
  -- | 'source'
  Prelude.Text ->
  -- | 'title'
  Prelude.Text ->
  CreateOpsItem
newCreateOpsItem :: Text -> Text -> Text -> CreateOpsItem
newCreateOpsItem Text
pDescription_ Text
pSource_ Text
pTitle_ =
  CreateOpsItem' :: Maybe POSIX
-> Maybe Natural
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe [RelatedOpsItem]
-> Maybe (HashMap Text OpsItemDataValue)
-> Maybe POSIX
-> Maybe POSIX
-> Maybe [OpsItemNotification]
-> Maybe [Tag]
-> Maybe POSIX
-> Text
-> Text
-> Text
-> CreateOpsItem
CreateOpsItem'
    { $sel:actualEndTime:CreateOpsItem' :: Maybe POSIX
actualEndTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:priority:CreateOpsItem' :: Maybe Natural
priority = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:category:CreateOpsItem' :: Maybe Text
category = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:severity:CreateOpsItem' :: Maybe Text
severity = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:opsItemType:CreateOpsItem' :: Maybe Text
opsItemType = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:relatedOpsItems:CreateOpsItem' :: Maybe [RelatedOpsItem]
relatedOpsItems = Maybe [RelatedOpsItem]
forall a. Maybe a
Prelude.Nothing,
      $sel:operationalData:CreateOpsItem' :: Maybe (HashMap Text OpsItemDataValue)
operationalData = Maybe (HashMap Text OpsItemDataValue)
forall a. Maybe a
Prelude.Nothing,
      $sel:actualStartTime:CreateOpsItem' :: Maybe POSIX
actualStartTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:plannedEndTime:CreateOpsItem' :: Maybe POSIX
plannedEndTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:notifications:CreateOpsItem' :: Maybe [OpsItemNotification]
notifications = Maybe [OpsItemNotification]
forall a. Maybe a
Prelude.Nothing,
      $sel:tags:CreateOpsItem' :: Maybe [Tag]
tags = Maybe [Tag]
forall a. Maybe a
Prelude.Nothing,
      $sel:plannedStartTime:CreateOpsItem' :: Maybe POSIX
plannedStartTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:description:CreateOpsItem' :: Text
description = Text
pDescription_,
      $sel:source:CreateOpsItem' :: Text
source = Text
pSource_,
      $sel:title:CreateOpsItem' :: Text
title = Text
pTitle_
    }

-- | The time a runbook workflow ended. Currently reported only for the
-- OpsItem type @\/aws\/changerequest@.
createOpsItem_actualEndTime :: Lens.Lens' CreateOpsItem (Prelude.Maybe Prelude.UTCTime)
createOpsItem_actualEndTime :: (Maybe UTCTime -> f (Maybe UTCTime))
-> CreateOpsItem -> f CreateOpsItem
createOpsItem_actualEndTime = (CreateOpsItem -> Maybe POSIX)
-> (CreateOpsItem -> Maybe POSIX -> CreateOpsItem)
-> Lens CreateOpsItem CreateOpsItem (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateOpsItem' {Maybe POSIX
actualEndTime :: Maybe POSIX
$sel:actualEndTime:CreateOpsItem' :: CreateOpsItem -> Maybe POSIX
actualEndTime} -> Maybe POSIX
actualEndTime) (\s :: CreateOpsItem
s@CreateOpsItem' {} Maybe POSIX
a -> CreateOpsItem
s {$sel:actualEndTime:CreateOpsItem' :: Maybe POSIX
actualEndTime = Maybe POSIX
a} :: CreateOpsItem) ((Maybe POSIX -> f (Maybe POSIX))
 -> CreateOpsItem -> f CreateOpsItem)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> CreateOpsItem
-> f CreateOpsItem
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The importance of this OpsItem in relation to other OpsItems in the
-- system.
createOpsItem_priority :: Lens.Lens' CreateOpsItem (Prelude.Maybe Prelude.Natural)
createOpsItem_priority :: (Maybe Natural -> f (Maybe Natural))
-> CreateOpsItem -> f CreateOpsItem
createOpsItem_priority = (CreateOpsItem -> Maybe Natural)
-> (CreateOpsItem -> Maybe Natural -> CreateOpsItem)
-> Lens CreateOpsItem CreateOpsItem (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateOpsItem' {Maybe Natural
priority :: Maybe Natural
$sel:priority:CreateOpsItem' :: CreateOpsItem -> Maybe Natural
priority} -> Maybe Natural
priority) (\s :: CreateOpsItem
s@CreateOpsItem' {} Maybe Natural
a -> CreateOpsItem
s {$sel:priority:CreateOpsItem' :: Maybe Natural
priority = Maybe Natural
a} :: CreateOpsItem)

-- | Specify a category to assign to an OpsItem.
createOpsItem_category :: Lens.Lens' CreateOpsItem (Prelude.Maybe Prelude.Text)
createOpsItem_category :: (Maybe Text -> f (Maybe Text)) -> CreateOpsItem -> f CreateOpsItem
createOpsItem_category = (CreateOpsItem -> Maybe Text)
-> (CreateOpsItem -> Maybe Text -> CreateOpsItem)
-> Lens CreateOpsItem CreateOpsItem (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateOpsItem' {Maybe Text
category :: Maybe Text
$sel:category:CreateOpsItem' :: CreateOpsItem -> Maybe Text
category} -> Maybe Text
category) (\s :: CreateOpsItem
s@CreateOpsItem' {} Maybe Text
a -> CreateOpsItem
s {$sel:category:CreateOpsItem' :: Maybe Text
category = Maybe Text
a} :: CreateOpsItem)

-- | Specify a severity to assign to an OpsItem.
createOpsItem_severity :: Lens.Lens' CreateOpsItem (Prelude.Maybe Prelude.Text)
createOpsItem_severity :: (Maybe Text -> f (Maybe Text)) -> CreateOpsItem -> f CreateOpsItem
createOpsItem_severity = (CreateOpsItem -> Maybe Text)
-> (CreateOpsItem -> Maybe Text -> CreateOpsItem)
-> Lens CreateOpsItem CreateOpsItem (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateOpsItem' {Maybe Text
severity :: Maybe Text
$sel:severity:CreateOpsItem' :: CreateOpsItem -> Maybe Text
severity} -> Maybe Text
severity) (\s :: CreateOpsItem
s@CreateOpsItem' {} Maybe Text
a -> CreateOpsItem
s {$sel:severity:CreateOpsItem' :: Maybe Text
severity = Maybe Text
a} :: CreateOpsItem)

-- | The type of OpsItem to create. Currently, the only valid values are
-- @\/aws\/changerequest@ and @\/aws\/issue@.
createOpsItem_opsItemType :: Lens.Lens' CreateOpsItem (Prelude.Maybe Prelude.Text)
createOpsItem_opsItemType :: (Maybe Text -> f (Maybe Text)) -> CreateOpsItem -> f CreateOpsItem
createOpsItem_opsItemType = (CreateOpsItem -> Maybe Text)
-> (CreateOpsItem -> Maybe Text -> CreateOpsItem)
-> Lens CreateOpsItem CreateOpsItem (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateOpsItem' {Maybe Text
opsItemType :: Maybe Text
$sel:opsItemType:CreateOpsItem' :: CreateOpsItem -> Maybe Text
opsItemType} -> Maybe Text
opsItemType) (\s :: CreateOpsItem
s@CreateOpsItem' {} Maybe Text
a -> CreateOpsItem
s {$sel:opsItemType:CreateOpsItem' :: Maybe Text
opsItemType = Maybe Text
a} :: CreateOpsItem)

-- | One or more OpsItems that share something in common with the current
-- OpsItems. For example, related OpsItems can include OpsItems with
-- similar error messages, impacted resources, or statuses for the impacted
-- resource.
createOpsItem_relatedOpsItems :: Lens.Lens' CreateOpsItem (Prelude.Maybe [RelatedOpsItem])
createOpsItem_relatedOpsItems :: (Maybe [RelatedOpsItem] -> f (Maybe [RelatedOpsItem]))
-> CreateOpsItem -> f CreateOpsItem
createOpsItem_relatedOpsItems = (CreateOpsItem -> Maybe [RelatedOpsItem])
-> (CreateOpsItem -> Maybe [RelatedOpsItem] -> CreateOpsItem)
-> Lens
     CreateOpsItem
     CreateOpsItem
     (Maybe [RelatedOpsItem])
     (Maybe [RelatedOpsItem])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateOpsItem' {Maybe [RelatedOpsItem]
relatedOpsItems :: Maybe [RelatedOpsItem]
$sel:relatedOpsItems:CreateOpsItem' :: CreateOpsItem -> Maybe [RelatedOpsItem]
relatedOpsItems} -> Maybe [RelatedOpsItem]
relatedOpsItems) (\s :: CreateOpsItem
s@CreateOpsItem' {} Maybe [RelatedOpsItem]
a -> CreateOpsItem
s {$sel:relatedOpsItems:CreateOpsItem' :: Maybe [RelatedOpsItem]
relatedOpsItems = Maybe [RelatedOpsItem]
a} :: CreateOpsItem) ((Maybe [RelatedOpsItem] -> f (Maybe [RelatedOpsItem]))
 -> CreateOpsItem -> f CreateOpsItem)
-> ((Maybe [RelatedOpsItem] -> f (Maybe [RelatedOpsItem]))
    -> Maybe [RelatedOpsItem] -> f (Maybe [RelatedOpsItem]))
-> (Maybe [RelatedOpsItem] -> f (Maybe [RelatedOpsItem]))
-> CreateOpsItem
-> f CreateOpsItem
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [RelatedOpsItem] [RelatedOpsItem] [RelatedOpsItem] [RelatedOpsItem]
-> Iso
     (Maybe [RelatedOpsItem])
     (Maybe [RelatedOpsItem])
     (Maybe [RelatedOpsItem])
     (Maybe [RelatedOpsItem])
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
  [RelatedOpsItem] [RelatedOpsItem] [RelatedOpsItem] [RelatedOpsItem]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Operational data is custom data that provides useful reference details
-- about the OpsItem. For example, you can specify log files, error
-- strings, license keys, troubleshooting tips, or other relevant data. You
-- enter operational data as key-value pairs. The key has a maximum length
-- of 128 characters. The value has a maximum size of 20 KB.
--
-- Operational data keys /can\'t/ begin with the following: @amazon@,
-- @aws@, @amzn@, @ssm@, @\/amazon@, @\/aws@, @\/amzn@, @\/ssm@.
--
-- You can choose to make the data searchable by other users in the account
-- or you can restrict search access. Searchable data means that all users
-- with access to the OpsItem Overview page (as provided by the
-- DescribeOpsItems API operation) can view and search on the specified
-- data. Operational data that isn\'t searchable is only viewable by users
-- who have access to the OpsItem (as provided by the GetOpsItem API
-- operation).
--
-- Use the @\/aws\/resources@ key in OperationalData to specify a related
-- resource in the request. Use the @\/aws\/automations@ key in
-- OperationalData to associate an Automation runbook with the OpsItem. To
-- view Amazon Web Services CLI example commands that use these keys, see
-- <https://docs.aws.amazon.com/systems-manager/latest/userguide/OpsCenter-creating-OpsItems.html#OpsCenter-manually-create-OpsItems Creating OpsItems manually>
-- in the /Amazon Web Services Systems Manager User Guide/.
createOpsItem_operationalData :: Lens.Lens' CreateOpsItem (Prelude.Maybe (Prelude.HashMap Prelude.Text OpsItemDataValue))
createOpsItem_operationalData :: (Maybe (HashMap Text OpsItemDataValue)
 -> f (Maybe (HashMap Text OpsItemDataValue)))
-> CreateOpsItem -> f CreateOpsItem
createOpsItem_operationalData = (CreateOpsItem -> Maybe (HashMap Text OpsItemDataValue))
-> (CreateOpsItem
    -> Maybe (HashMap Text OpsItemDataValue) -> CreateOpsItem)
-> Lens
     CreateOpsItem
     CreateOpsItem
     (Maybe (HashMap Text OpsItemDataValue))
     (Maybe (HashMap Text OpsItemDataValue))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateOpsItem' {Maybe (HashMap Text OpsItemDataValue)
operationalData :: Maybe (HashMap Text OpsItemDataValue)
$sel:operationalData:CreateOpsItem' :: CreateOpsItem -> Maybe (HashMap Text OpsItemDataValue)
operationalData} -> Maybe (HashMap Text OpsItemDataValue)
operationalData) (\s :: CreateOpsItem
s@CreateOpsItem' {} Maybe (HashMap Text OpsItemDataValue)
a -> CreateOpsItem
s {$sel:operationalData:CreateOpsItem' :: Maybe (HashMap Text OpsItemDataValue)
operationalData = Maybe (HashMap Text OpsItemDataValue)
a} :: CreateOpsItem) ((Maybe (HashMap Text OpsItemDataValue)
  -> f (Maybe (HashMap Text OpsItemDataValue)))
 -> CreateOpsItem -> f CreateOpsItem)
-> ((Maybe (HashMap Text OpsItemDataValue)
     -> f (Maybe (HashMap Text OpsItemDataValue)))
    -> Maybe (HashMap Text OpsItemDataValue)
    -> f (Maybe (HashMap Text OpsItemDataValue)))
-> (Maybe (HashMap Text OpsItemDataValue)
    -> f (Maybe (HashMap Text OpsItemDataValue)))
-> CreateOpsItem
-> f CreateOpsItem
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (HashMap Text OpsItemDataValue)
  (HashMap Text OpsItemDataValue)
  (HashMap Text OpsItemDataValue)
  (HashMap Text OpsItemDataValue)
-> Iso
     (Maybe (HashMap Text OpsItemDataValue))
     (Maybe (HashMap Text OpsItemDataValue))
     (Maybe (HashMap Text OpsItemDataValue))
     (Maybe (HashMap Text OpsItemDataValue))
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 OpsItemDataValue)
  (HashMap Text OpsItemDataValue)
  (HashMap Text OpsItemDataValue)
  (HashMap Text OpsItemDataValue)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The time a runbook workflow started. Currently reported only for the
-- OpsItem type @\/aws\/changerequest@.
createOpsItem_actualStartTime :: Lens.Lens' CreateOpsItem (Prelude.Maybe Prelude.UTCTime)
createOpsItem_actualStartTime :: (Maybe UTCTime -> f (Maybe UTCTime))
-> CreateOpsItem -> f CreateOpsItem
createOpsItem_actualStartTime = (CreateOpsItem -> Maybe POSIX)
-> (CreateOpsItem -> Maybe POSIX -> CreateOpsItem)
-> Lens CreateOpsItem CreateOpsItem (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateOpsItem' {Maybe POSIX
actualStartTime :: Maybe POSIX
$sel:actualStartTime:CreateOpsItem' :: CreateOpsItem -> Maybe POSIX
actualStartTime} -> Maybe POSIX
actualStartTime) (\s :: CreateOpsItem
s@CreateOpsItem' {} Maybe POSIX
a -> CreateOpsItem
s {$sel:actualStartTime:CreateOpsItem' :: Maybe POSIX
actualStartTime = Maybe POSIX
a} :: CreateOpsItem) ((Maybe POSIX -> f (Maybe POSIX))
 -> CreateOpsItem -> f CreateOpsItem)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> CreateOpsItem
-> f CreateOpsItem
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The time specified in a change request for a runbook workflow to end.
-- Currently supported only for the OpsItem type @\/aws\/changerequest@.
createOpsItem_plannedEndTime :: Lens.Lens' CreateOpsItem (Prelude.Maybe Prelude.UTCTime)
createOpsItem_plannedEndTime :: (Maybe UTCTime -> f (Maybe UTCTime))
-> CreateOpsItem -> f CreateOpsItem
createOpsItem_plannedEndTime = (CreateOpsItem -> Maybe POSIX)
-> (CreateOpsItem -> Maybe POSIX -> CreateOpsItem)
-> Lens CreateOpsItem CreateOpsItem (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateOpsItem' {Maybe POSIX
plannedEndTime :: Maybe POSIX
$sel:plannedEndTime:CreateOpsItem' :: CreateOpsItem -> Maybe POSIX
plannedEndTime} -> Maybe POSIX
plannedEndTime) (\s :: CreateOpsItem
s@CreateOpsItem' {} Maybe POSIX
a -> CreateOpsItem
s {$sel:plannedEndTime:CreateOpsItem' :: Maybe POSIX
plannedEndTime = Maybe POSIX
a} :: CreateOpsItem) ((Maybe POSIX -> f (Maybe POSIX))
 -> CreateOpsItem -> f CreateOpsItem)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> CreateOpsItem
-> f CreateOpsItem
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The Amazon Resource Name (ARN) of an SNS topic where notifications are
-- sent when this OpsItem is edited or changed.
createOpsItem_notifications :: Lens.Lens' CreateOpsItem (Prelude.Maybe [OpsItemNotification])
createOpsItem_notifications :: (Maybe [OpsItemNotification] -> f (Maybe [OpsItemNotification]))
-> CreateOpsItem -> f CreateOpsItem
createOpsItem_notifications = (CreateOpsItem -> Maybe [OpsItemNotification])
-> (CreateOpsItem -> Maybe [OpsItemNotification] -> CreateOpsItem)
-> Lens
     CreateOpsItem
     CreateOpsItem
     (Maybe [OpsItemNotification])
     (Maybe [OpsItemNotification])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateOpsItem' {Maybe [OpsItemNotification]
notifications :: Maybe [OpsItemNotification]
$sel:notifications:CreateOpsItem' :: CreateOpsItem -> Maybe [OpsItemNotification]
notifications} -> Maybe [OpsItemNotification]
notifications) (\s :: CreateOpsItem
s@CreateOpsItem' {} Maybe [OpsItemNotification]
a -> CreateOpsItem
s {$sel:notifications:CreateOpsItem' :: Maybe [OpsItemNotification]
notifications = Maybe [OpsItemNotification]
a} :: CreateOpsItem) ((Maybe [OpsItemNotification] -> f (Maybe [OpsItemNotification]))
 -> CreateOpsItem -> f CreateOpsItem)
-> ((Maybe [OpsItemNotification]
     -> f (Maybe [OpsItemNotification]))
    -> Maybe [OpsItemNotification] -> f (Maybe [OpsItemNotification]))
-> (Maybe [OpsItemNotification] -> f (Maybe [OpsItemNotification]))
-> CreateOpsItem
-> f CreateOpsItem
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [OpsItemNotification]
  [OpsItemNotification]
  [OpsItemNotification]
  [OpsItemNotification]
-> Iso
     (Maybe [OpsItemNotification])
     (Maybe [OpsItemNotification])
     (Maybe [OpsItemNotification])
     (Maybe [OpsItemNotification])
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
  [OpsItemNotification]
  [OpsItemNotification]
  [OpsItemNotification]
  [OpsItemNotification]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Optional metadata that you assign to a resource. You can restrict access
-- to OpsItems by using an inline IAM policy that specifies tags. For more
-- information, see
-- <https://docs.aws.amazon.com/systems-manager/latest/userguide/OpsCenter-getting-started.html#OpsCenter-getting-started-user-permissions Getting started with OpsCenter>
-- in the /Amazon Web Services Systems Manager User Guide/.
--
-- Tags use a key-value pair. For example:
--
-- @Key=Department,Value=Finance@
--
-- To add tags to a new OpsItem, a user must have IAM permissions for both
-- the @ssm:CreateOpsItems@ operation and the @ssm:AddTagsToResource@
-- operation. To add tags to an existing OpsItem, use the AddTagsToResource
-- operation.
createOpsItem_tags :: Lens.Lens' CreateOpsItem (Prelude.Maybe [Tag])
createOpsItem_tags :: (Maybe [Tag] -> f (Maybe [Tag]))
-> CreateOpsItem -> f CreateOpsItem
createOpsItem_tags = (CreateOpsItem -> Maybe [Tag])
-> (CreateOpsItem -> Maybe [Tag] -> CreateOpsItem)
-> Lens CreateOpsItem CreateOpsItem (Maybe [Tag]) (Maybe [Tag])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateOpsItem' {Maybe [Tag]
tags :: Maybe [Tag]
$sel:tags:CreateOpsItem' :: CreateOpsItem -> Maybe [Tag]
tags} -> Maybe [Tag]
tags) (\s :: CreateOpsItem
s@CreateOpsItem' {} Maybe [Tag]
a -> CreateOpsItem
s {$sel:tags:CreateOpsItem' :: Maybe [Tag]
tags = Maybe [Tag]
a} :: CreateOpsItem) ((Maybe [Tag] -> f (Maybe [Tag]))
 -> CreateOpsItem -> f CreateOpsItem)
-> ((Maybe [Tag] -> f (Maybe [Tag]))
    -> Maybe [Tag] -> f (Maybe [Tag]))
-> (Maybe [Tag] -> f (Maybe [Tag]))
-> CreateOpsItem
-> f CreateOpsItem
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Tag] [Tag] [Tag] [Tag]
-> Iso (Maybe [Tag]) (Maybe [Tag]) (Maybe [Tag]) (Maybe [Tag])
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 [Tag] [Tag] [Tag] [Tag]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The time specified in a change request for a runbook workflow to start.
-- Currently supported only for the OpsItem type @\/aws\/changerequest@.
createOpsItem_plannedStartTime :: Lens.Lens' CreateOpsItem (Prelude.Maybe Prelude.UTCTime)
createOpsItem_plannedStartTime :: (Maybe UTCTime -> f (Maybe UTCTime))
-> CreateOpsItem -> f CreateOpsItem
createOpsItem_plannedStartTime = (CreateOpsItem -> Maybe POSIX)
-> (CreateOpsItem -> Maybe POSIX -> CreateOpsItem)
-> Lens CreateOpsItem CreateOpsItem (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateOpsItem' {Maybe POSIX
plannedStartTime :: Maybe POSIX
$sel:plannedStartTime:CreateOpsItem' :: CreateOpsItem -> Maybe POSIX
plannedStartTime} -> Maybe POSIX
plannedStartTime) (\s :: CreateOpsItem
s@CreateOpsItem' {} Maybe POSIX
a -> CreateOpsItem
s {$sel:plannedStartTime:CreateOpsItem' :: Maybe POSIX
plannedStartTime = Maybe POSIX
a} :: CreateOpsItem) ((Maybe POSIX -> f (Maybe POSIX))
 -> CreateOpsItem -> f CreateOpsItem)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> CreateOpsItem
-> f CreateOpsItem
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | Information about the OpsItem.
createOpsItem_description :: Lens.Lens' CreateOpsItem Prelude.Text
createOpsItem_description :: (Text -> f Text) -> CreateOpsItem -> f CreateOpsItem
createOpsItem_description = (CreateOpsItem -> Text)
-> (CreateOpsItem -> Text -> CreateOpsItem)
-> Lens CreateOpsItem CreateOpsItem Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateOpsItem' {Text
description :: Text
$sel:description:CreateOpsItem' :: CreateOpsItem -> Text
description} -> Text
description) (\s :: CreateOpsItem
s@CreateOpsItem' {} Text
a -> CreateOpsItem
s {$sel:description:CreateOpsItem' :: Text
description = Text
a} :: CreateOpsItem)

-- | The origin of the OpsItem, such as Amazon EC2 or Systems Manager.
--
-- The source name can\'t contain the following strings: @aws@, @amazon@,
-- and @amzn@.
createOpsItem_source :: Lens.Lens' CreateOpsItem Prelude.Text
createOpsItem_source :: (Text -> f Text) -> CreateOpsItem -> f CreateOpsItem
createOpsItem_source = (CreateOpsItem -> Text)
-> (CreateOpsItem -> Text -> CreateOpsItem)
-> Lens CreateOpsItem CreateOpsItem Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateOpsItem' {Text
source :: Text
$sel:source:CreateOpsItem' :: CreateOpsItem -> Text
source} -> Text
source) (\s :: CreateOpsItem
s@CreateOpsItem' {} Text
a -> CreateOpsItem
s {$sel:source:CreateOpsItem' :: Text
source = Text
a} :: CreateOpsItem)

-- | A short heading that describes the nature of the OpsItem and the
-- impacted resource.
createOpsItem_title :: Lens.Lens' CreateOpsItem Prelude.Text
createOpsItem_title :: (Text -> f Text) -> CreateOpsItem -> f CreateOpsItem
createOpsItem_title = (CreateOpsItem -> Text)
-> (CreateOpsItem -> Text -> CreateOpsItem)
-> Lens CreateOpsItem CreateOpsItem Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateOpsItem' {Text
title :: Text
$sel:title:CreateOpsItem' :: CreateOpsItem -> Text
title} -> Text
title) (\s :: CreateOpsItem
s@CreateOpsItem' {} Text
a -> CreateOpsItem
s {$sel:title:CreateOpsItem' :: Text
title = Text
a} :: CreateOpsItem)

instance Core.AWSRequest CreateOpsItem where
  type
    AWSResponse CreateOpsItem =
      CreateOpsItemResponse
  request :: CreateOpsItem -> Request CreateOpsItem
request = Service -> CreateOpsItem -> Request CreateOpsItem
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy CreateOpsItem
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateOpsItem)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse CreateOpsItem))
-> Logger
-> Service
-> Proxy CreateOpsItem
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateOpsItem)))
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 Text -> Int -> CreateOpsItemResponse
CreateOpsItemResponse'
            (Maybe Text -> Int -> CreateOpsItemResponse)
-> Either String (Maybe Text)
-> Either String (Int -> CreateOpsItemResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"OpsItemId")
            Either String (Int -> CreateOpsItemResponse)
-> Either String Int -> Either String CreateOpsItemResponse
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 CreateOpsItem

instance Prelude.NFData CreateOpsItem

instance Core.ToHeaders CreateOpsItem where
  toHeaders :: CreateOpsItem -> ResponseHeaders
toHeaders =
    ResponseHeaders -> CreateOpsItem -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# (ByteString
"AmazonSSM.CreateOpsItem" :: Prelude.ByteString),
            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 CreateOpsItem where
  toJSON :: CreateOpsItem -> Value
toJSON CreateOpsItem' {Maybe Natural
Maybe [OpsItemNotification]
Maybe [RelatedOpsItem]
Maybe [Tag]
Maybe Text
Maybe (HashMap Text OpsItemDataValue)
Maybe POSIX
Text
title :: Text
source :: Text
description :: Text
plannedStartTime :: Maybe POSIX
tags :: Maybe [Tag]
notifications :: Maybe [OpsItemNotification]
plannedEndTime :: Maybe POSIX
actualStartTime :: Maybe POSIX
operationalData :: Maybe (HashMap Text OpsItemDataValue)
relatedOpsItems :: Maybe [RelatedOpsItem]
opsItemType :: Maybe Text
severity :: Maybe Text
category :: Maybe Text
priority :: Maybe Natural
actualEndTime :: Maybe POSIX
$sel:title:CreateOpsItem' :: CreateOpsItem -> Text
$sel:source:CreateOpsItem' :: CreateOpsItem -> Text
$sel:description:CreateOpsItem' :: CreateOpsItem -> Text
$sel:plannedStartTime:CreateOpsItem' :: CreateOpsItem -> Maybe POSIX
$sel:tags:CreateOpsItem' :: CreateOpsItem -> Maybe [Tag]
$sel:notifications:CreateOpsItem' :: CreateOpsItem -> Maybe [OpsItemNotification]
$sel:plannedEndTime:CreateOpsItem' :: CreateOpsItem -> Maybe POSIX
$sel:actualStartTime:CreateOpsItem' :: CreateOpsItem -> Maybe POSIX
$sel:operationalData:CreateOpsItem' :: CreateOpsItem -> Maybe (HashMap Text OpsItemDataValue)
$sel:relatedOpsItems:CreateOpsItem' :: CreateOpsItem -> Maybe [RelatedOpsItem]
$sel:opsItemType:CreateOpsItem' :: CreateOpsItem -> Maybe Text
$sel:severity:CreateOpsItem' :: CreateOpsItem -> Maybe Text
$sel:category:CreateOpsItem' :: CreateOpsItem -> Maybe Text
$sel:priority:CreateOpsItem' :: CreateOpsItem -> Maybe Natural
$sel:actualEndTime:CreateOpsItem' :: CreateOpsItem -> Maybe POSIX
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"ActualEndTime" Text -> POSIX -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (POSIX -> Pair) -> Maybe POSIX -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe POSIX
actualEndTime,
            (Text
"Priority" 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
priority,
            (Text
"Category" 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
category,
            (Text
"Severity" 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
severity,
            (Text
"OpsItemType" 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
opsItemType,
            (Text
"RelatedOpsItems" Text -> [RelatedOpsItem] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              ([RelatedOpsItem] -> Pair) -> Maybe [RelatedOpsItem] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [RelatedOpsItem]
relatedOpsItems,
            (Text
"OperationalData" Text -> HashMap Text OpsItemDataValue -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (HashMap Text OpsItemDataValue -> Pair)
-> Maybe (HashMap Text OpsItemDataValue) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text OpsItemDataValue)
operationalData,
            (Text
"ActualStartTime" Text -> POSIX -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (POSIX -> Pair) -> Maybe POSIX -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe POSIX
actualStartTime,
            (Text
"PlannedEndTime" Text -> POSIX -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (POSIX -> Pair) -> Maybe POSIX -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe POSIX
plannedEndTime,
            (Text
"Notifications" Text -> [OpsItemNotification] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([OpsItemNotification] -> Pair)
-> Maybe [OpsItemNotification] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [OpsItemNotification]
notifications,
            (Text
"Tags" Text -> [Tag] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([Tag] -> Pair) -> Maybe [Tag] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Tag]
tags,
            (Text
"PlannedStartTime" Text -> POSIX -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (POSIX -> Pair) -> Maybe POSIX -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe POSIX
plannedStartTime,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Description" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
description),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Source" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
source),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Title" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
title)
          ]
      )

instance Core.ToPath CreateOpsItem where
  toPath :: CreateOpsItem -> ByteString
toPath = ByteString -> CreateOpsItem -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

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

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

-- |
-- Create a value of 'CreateOpsItemResponse' 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:
--
-- 'opsItemId', 'createOpsItemResponse_opsItemId' - The ID of the OpsItem.
--
-- 'httpStatus', 'createOpsItemResponse_httpStatus' - The response's http status code.
newCreateOpsItemResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  CreateOpsItemResponse
newCreateOpsItemResponse :: Int -> CreateOpsItemResponse
newCreateOpsItemResponse Int
pHttpStatus_ =
  CreateOpsItemResponse' :: Maybe Text -> Int -> CreateOpsItemResponse
CreateOpsItemResponse'
    { $sel:opsItemId:CreateOpsItemResponse' :: Maybe Text
opsItemId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:CreateOpsItemResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The ID of the OpsItem.
createOpsItemResponse_opsItemId :: Lens.Lens' CreateOpsItemResponse (Prelude.Maybe Prelude.Text)
createOpsItemResponse_opsItemId :: (Maybe Text -> f (Maybe Text))
-> CreateOpsItemResponse -> f CreateOpsItemResponse
createOpsItemResponse_opsItemId = (CreateOpsItemResponse -> Maybe Text)
-> (CreateOpsItemResponse -> Maybe Text -> CreateOpsItemResponse)
-> Lens
     CreateOpsItemResponse
     CreateOpsItemResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateOpsItemResponse' {Maybe Text
opsItemId :: Maybe Text
$sel:opsItemId:CreateOpsItemResponse' :: CreateOpsItemResponse -> Maybe Text
opsItemId} -> Maybe Text
opsItemId) (\s :: CreateOpsItemResponse
s@CreateOpsItemResponse' {} Maybe Text
a -> CreateOpsItemResponse
s {$sel:opsItemId:CreateOpsItemResponse' :: Maybe Text
opsItemId = Maybe Text
a} :: CreateOpsItemResponse)

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

instance Prelude.NFData CreateOpsItemResponse