{-# 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-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)
module Amazonka.Route53AutoNaming.Types.OperationSummary where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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 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,
    -- | The ID for an operation.
    OperationSummary -> Maybe Text
id :: Prelude.Maybe Prelude.Text
  }
  deriving (OperationSummary -> OperationSummary -> Bool
(OperationSummary -> OperationSummary -> Bool)
-> (OperationSummary -> OperationSummary -> Bool)
-> Eq OperationSummary
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]
(Int -> ReadS OperationSummary)
-> ReadS [OperationSummary]
-> ReadPrec OperationSummary
-> ReadPrec [OperationSummary]
-> Read 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
(Int -> OperationSummary -> ShowS)
-> (OperationSummary -> String)
-> ([OperationSummary] -> ShowS)
-> Show OperationSummary
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. OperationSummary -> Rep OperationSummary x)
-> (forall x. Rep OperationSummary x -> OperationSummary)
-> Generic OperationSummary
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:
--
-- '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@.
--
-- 'id', 'operationSummary_id' - The ID for an operation.
newOperationSummary ::
  OperationSummary
newOperationSummary :: OperationSummary
newOperationSummary =
  OperationSummary' :: Maybe OperationStatus -> Maybe Text -> OperationSummary
OperationSummary'
    { $sel:status:OperationSummary' :: Maybe OperationStatus
status = Maybe OperationStatus
forall a. Maybe a
Prelude.Nothing,
      $sel:id:OperationSummary' :: Maybe Text
id = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | 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 :: (Maybe OperationStatus -> f (Maybe OperationStatus))
-> OperationSummary -> f OperationSummary
operationSummary_status = (OperationSummary -> Maybe OperationStatus)
-> (OperationSummary -> Maybe OperationStatus -> OperationSummary)
-> Lens
     OperationSummary
     OperationSummary
     (Maybe OperationStatus)
     (Maybe OperationStatus)
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)

-- | The ID for an operation.
operationSummary_id :: Lens.Lens' OperationSummary (Prelude.Maybe Prelude.Text)
operationSummary_id :: (Maybe Text -> f (Maybe Text))
-> OperationSummary -> f OperationSummary
operationSummary_id = (OperationSummary -> Maybe Text)
-> (OperationSummary -> Maybe Text -> OperationSummary)
-> Lens OperationSummary OperationSummary (Maybe Text) (Maybe Text)
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)

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

instance Prelude.Hashable OperationSummary

instance Prelude.NFData OperationSummary