{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}

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

-- |
-- Module      : Amazonka.Route53AutoNaming.Types.OperationSummary
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.Route53AutoNaming.Types.OperationSummary where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
import Amazonka.Route53AutoNaming.Types.OperationStatus

-- | A complex type that contains information about an operation that matches
-- the criteria that you specified in a
-- <https://docs.aws.amazon.com/cloud-map/latest/api/API_ListOperations.html ListOperations>
-- request.
--
-- /See:/ 'newOperationSummary' smart constructor.
data OperationSummary = OperationSummary'
  { -- | The ID for an operation.
    OperationSummary -> Maybe Text
id :: Prelude.Maybe Prelude.Text,
    -- | The status of the operation. Values include the following:
    --
    -- -   __SUBMITTED__: This is the initial state immediately after you
    --     submit a request.
    --
    -- -   __PENDING__: Cloud Map is performing the operation.
    --
    -- -   __SUCCESS__: The operation succeeded.
    --
    -- -   __FAIL__: The operation failed. For the failure reason, see
    --     @ErrorMessage@.
    OperationSummary -> Maybe OperationStatus
status :: Prelude.Maybe OperationStatus
  }
  deriving (OperationSummary -> OperationSummary -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: OperationSummary -> OperationSummary -> Bool
$c/= :: OperationSummary -> OperationSummary -> Bool
== :: OperationSummary -> OperationSummary -> Bool
$c== :: OperationSummary -> OperationSummary -> Bool
Prelude.Eq, ReadPrec [OperationSummary]
ReadPrec OperationSummary
Int -> ReadS OperationSummary
ReadS [OperationSummary]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [OperationSummary]
$creadListPrec :: ReadPrec [OperationSummary]
readPrec :: ReadPrec OperationSummary
$creadPrec :: ReadPrec OperationSummary
readList :: ReadS [OperationSummary]
$creadList :: ReadS [OperationSummary]
readsPrec :: Int -> ReadS OperationSummary
$creadsPrec :: Int -> ReadS OperationSummary
Prelude.Read, Int -> OperationSummary -> ShowS
[OperationSummary] -> ShowS
OperationSummary -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [OperationSummary] -> ShowS
$cshowList :: [OperationSummary] -> ShowS
show :: OperationSummary -> String
$cshow :: OperationSummary -> String
showsPrec :: Int -> OperationSummary -> ShowS
$cshowsPrec :: Int -> OperationSummary -> ShowS
Prelude.Show, forall x. Rep OperationSummary x -> OperationSummary
forall x. OperationSummary -> Rep OperationSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep OperationSummary x -> OperationSummary
$cfrom :: forall x. OperationSummary -> Rep OperationSummary x
Prelude.Generic)

-- |
-- Create a value of 'OperationSummary' 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:
--
-- 'id', 'operationSummary_id' - The ID for an operation.
--
-- 'status', 'operationSummary_status' - The status of the operation. Values include the following:
--
-- -   __SUBMITTED__: This is the initial state immediately after you
--     submit a request.
--
-- -   __PENDING__: Cloud Map is performing the operation.
--
-- -   __SUCCESS__: The operation succeeded.
--
-- -   __FAIL__: The operation failed. For the failure reason, see
--     @ErrorMessage@.
newOperationSummary ::
  OperationSummary
newOperationSummary :: OperationSummary
newOperationSummary =
  OperationSummary'
    { $sel:id:OperationSummary' :: Maybe Text
id = forall a. Maybe a
Prelude.Nothing,
      $sel:status:OperationSummary' :: Maybe OperationStatus
status = forall a. Maybe a
Prelude.Nothing
    }

-- | The ID for an operation.
operationSummary_id :: Lens.Lens' OperationSummary (Prelude.Maybe Prelude.Text)
operationSummary_id :: Lens' OperationSummary (Maybe Text)
operationSummary_id = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OperationSummary' {Maybe Text
id :: Maybe Text
$sel:id:OperationSummary' :: OperationSummary -> Maybe Text
id} -> Maybe Text
id) (\s :: OperationSummary
s@OperationSummary' {} Maybe Text
a -> OperationSummary
s {$sel:id:OperationSummary' :: Maybe Text
id = Maybe Text
a} :: OperationSummary)

-- | The status of the operation. Values include the following:
--
-- -   __SUBMITTED__: This is the initial state immediately after you
--     submit a request.
--
-- -   __PENDING__: Cloud Map is performing the operation.
--
-- -   __SUCCESS__: The operation succeeded.
--
-- -   __FAIL__: The operation failed. For the failure reason, see
--     @ErrorMessage@.
operationSummary_status :: Lens.Lens' OperationSummary (Prelude.Maybe OperationStatus)
operationSummary_status :: Lens' OperationSummary (Maybe OperationStatus)
operationSummary_status = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OperationSummary' {Maybe OperationStatus
status :: Maybe OperationStatus
$sel:status:OperationSummary' :: OperationSummary -> Maybe OperationStatus
status} -> Maybe OperationStatus
status) (\s :: OperationSummary
s@OperationSummary' {} Maybe OperationStatus
a -> OperationSummary
s {$sel:status:OperationSummary' :: Maybe OperationStatus
status = Maybe OperationStatus
a} :: OperationSummary)

instance Data.FromJSON OperationSummary where
  parseJSON :: Value -> Parser OperationSummary
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"OperationSummary"
      ( \Object
x ->
          Maybe Text -> Maybe OperationStatus -> OperationSummary
OperationSummary'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Id")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Status")
      )

instance Prelude.Hashable OperationSummary where
  hashWithSalt :: Int -> OperationSummary -> Int
hashWithSalt Int
_salt OperationSummary' {Maybe Text
Maybe OperationStatus
status :: Maybe OperationStatus
id :: Maybe Text
$sel:status:OperationSummary' :: OperationSummary -> Maybe OperationStatus
$sel:id:OperationSummary' :: OperationSummary -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
id
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe OperationStatus
status

instance Prelude.NFData OperationSummary where
  rnf :: OperationSummary -> ()
rnf OperationSummary' {Maybe Text
Maybe OperationStatus
status :: Maybe OperationStatus
id :: Maybe Text
$sel:status:OperationSummary' :: OperationSummary -> Maybe OperationStatus
$sel:id:OperationSummary' :: OperationSummary -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
id seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe OperationStatus
status