{-# 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.CloudSearchDomains.Types.SearchStatus
-- 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.CloudSearchDomains.Types.SearchStatus where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Contains the resource id (@rid@) and the time it took to process the
-- request (@timems@).
--
-- /See:/ 'newSearchStatus' smart constructor.
data SearchStatus = SearchStatus'
  { -- | The encrypted resource ID for the request.
    SearchStatus -> Maybe Text
rid :: Prelude.Maybe Prelude.Text,
    -- | How long it took to process the request, in milliseconds.
    SearchStatus -> Maybe Integer
timems :: Prelude.Maybe Prelude.Integer
  }
  deriving (SearchStatus -> SearchStatus -> Bool
(SearchStatus -> SearchStatus -> Bool)
-> (SearchStatus -> SearchStatus -> Bool) -> Eq SearchStatus
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SearchStatus -> SearchStatus -> Bool
$c/= :: SearchStatus -> SearchStatus -> Bool
== :: SearchStatus -> SearchStatus -> Bool
$c== :: SearchStatus -> SearchStatus -> Bool
Prelude.Eq, ReadPrec [SearchStatus]
ReadPrec SearchStatus
Int -> ReadS SearchStatus
ReadS [SearchStatus]
(Int -> ReadS SearchStatus)
-> ReadS [SearchStatus]
-> ReadPrec SearchStatus
-> ReadPrec [SearchStatus]
-> Read SearchStatus
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SearchStatus]
$creadListPrec :: ReadPrec [SearchStatus]
readPrec :: ReadPrec SearchStatus
$creadPrec :: ReadPrec SearchStatus
readList :: ReadS [SearchStatus]
$creadList :: ReadS [SearchStatus]
readsPrec :: Int -> ReadS SearchStatus
$creadsPrec :: Int -> ReadS SearchStatus
Prelude.Read, Int -> SearchStatus -> ShowS
[SearchStatus] -> ShowS
SearchStatus -> String
(Int -> SearchStatus -> ShowS)
-> (SearchStatus -> String)
-> ([SearchStatus] -> ShowS)
-> Show SearchStatus
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SearchStatus] -> ShowS
$cshowList :: [SearchStatus] -> ShowS
show :: SearchStatus -> String
$cshow :: SearchStatus -> String
showsPrec :: Int -> SearchStatus -> ShowS
$cshowsPrec :: Int -> SearchStatus -> ShowS
Prelude.Show, (forall x. SearchStatus -> Rep SearchStatus x)
-> (forall x. Rep SearchStatus x -> SearchStatus)
-> Generic SearchStatus
forall x. Rep SearchStatus x -> SearchStatus
forall x. SearchStatus -> Rep SearchStatus x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SearchStatus x -> SearchStatus
$cfrom :: forall x. SearchStatus -> Rep SearchStatus x
Prelude.Generic)

-- |
-- Create a value of 'SearchStatus' 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:
--
-- 'rid', 'searchStatus_rid' - The encrypted resource ID for the request.
--
-- 'timems', 'searchStatus_timems' - How long it took to process the request, in milliseconds.
newSearchStatus ::
  SearchStatus
newSearchStatus :: SearchStatus
newSearchStatus =
  SearchStatus' :: Maybe Text -> Maybe Integer -> SearchStatus
SearchStatus'
    { $sel:rid:SearchStatus' :: Maybe Text
rid = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:timems:SearchStatus' :: Maybe Integer
timems = Maybe Integer
forall a. Maybe a
Prelude.Nothing
    }

-- | The encrypted resource ID for the request.
searchStatus_rid :: Lens.Lens' SearchStatus (Prelude.Maybe Prelude.Text)
searchStatus_rid :: (Maybe Text -> f (Maybe Text)) -> SearchStatus -> f SearchStatus
searchStatus_rid = (SearchStatus -> Maybe Text)
-> (SearchStatus -> Maybe Text -> SearchStatus)
-> Lens SearchStatus SearchStatus (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SearchStatus' {Maybe Text
rid :: Maybe Text
$sel:rid:SearchStatus' :: SearchStatus -> Maybe Text
rid} -> Maybe Text
rid) (\s :: SearchStatus
s@SearchStatus' {} Maybe Text
a -> SearchStatus
s {$sel:rid:SearchStatus' :: Maybe Text
rid = Maybe Text
a} :: SearchStatus)

-- | How long it took to process the request, in milliseconds.
searchStatus_timems :: Lens.Lens' SearchStatus (Prelude.Maybe Prelude.Integer)
searchStatus_timems :: (Maybe Integer -> f (Maybe Integer))
-> SearchStatus -> f SearchStatus
searchStatus_timems = (SearchStatus -> Maybe Integer)
-> (SearchStatus -> Maybe Integer -> SearchStatus)
-> Lens SearchStatus SearchStatus (Maybe Integer) (Maybe Integer)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SearchStatus' {Maybe Integer
timems :: Maybe Integer
$sel:timems:SearchStatus' :: SearchStatus -> Maybe Integer
timems} -> Maybe Integer
timems) (\s :: SearchStatus
s@SearchStatus' {} Maybe Integer
a -> SearchStatus
s {$sel:timems:SearchStatus' :: Maybe Integer
timems = Maybe Integer
a} :: SearchStatus)

instance Core.FromJSON SearchStatus where
  parseJSON :: Value -> Parser SearchStatus
parseJSON =
    String
-> (Object -> Parser SearchStatus) -> Value -> Parser SearchStatus
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"SearchStatus"
      ( \Object
x ->
          Maybe Text -> Maybe Integer -> SearchStatus
SearchStatus'
            (Maybe Text -> Maybe Integer -> SearchStatus)
-> Parser (Maybe Text) -> Parser (Maybe Integer -> SearchStatus)
forall (f :: * -> *) a b. Functor 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
"rid") Parser (Maybe Integer -> SearchStatus)
-> Parser (Maybe Integer) -> Parser SearchStatus
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Integer)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"timems")
      )

instance Prelude.Hashable SearchStatus

instance Prelude.NFData SearchStatus