{-# 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.ComputeOptimizer.Types.AccountEnrollmentStatus
-- 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.ComputeOptimizer.Types.AccountEnrollmentStatus where

import Amazonka.ComputeOptimizer.Types.Status
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Describes the enrollment status of an organization\'s member accounts in
-- Compute Optimizer.
--
-- /See:/ 'newAccountEnrollmentStatus' smart constructor.
data AccountEnrollmentStatus = AccountEnrollmentStatus'
  { -- | The account enrollment status.
    AccountEnrollmentStatus -> Maybe Status
status :: Prelude.Maybe Status,
    -- | The Amazon Web Services account ID.
    AccountEnrollmentStatus -> Maybe Text
accountId :: Prelude.Maybe Prelude.Text,
    -- | The reason for the account enrollment status.
    --
    -- For example, an account might show a status of @Pending@ because member
    -- accounts of an organization require more time to be enrolled in the
    -- service.
    AccountEnrollmentStatus -> Maybe Text
statusReason :: Prelude.Maybe Prelude.Text,
    -- | The Unix epoch timestamp, in seconds, of when the account enrollment
    -- status was last updated.
    AccountEnrollmentStatus -> Maybe POSIX
lastUpdatedTimestamp :: Prelude.Maybe Core.POSIX
  }
  deriving (AccountEnrollmentStatus -> AccountEnrollmentStatus -> Bool
(AccountEnrollmentStatus -> AccountEnrollmentStatus -> Bool)
-> (AccountEnrollmentStatus -> AccountEnrollmentStatus -> Bool)
-> Eq AccountEnrollmentStatus
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AccountEnrollmentStatus -> AccountEnrollmentStatus -> Bool
$c/= :: AccountEnrollmentStatus -> AccountEnrollmentStatus -> Bool
== :: AccountEnrollmentStatus -> AccountEnrollmentStatus -> Bool
$c== :: AccountEnrollmentStatus -> AccountEnrollmentStatus -> Bool
Prelude.Eq, ReadPrec [AccountEnrollmentStatus]
ReadPrec AccountEnrollmentStatus
Int -> ReadS AccountEnrollmentStatus
ReadS [AccountEnrollmentStatus]
(Int -> ReadS AccountEnrollmentStatus)
-> ReadS [AccountEnrollmentStatus]
-> ReadPrec AccountEnrollmentStatus
-> ReadPrec [AccountEnrollmentStatus]
-> Read AccountEnrollmentStatus
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AccountEnrollmentStatus]
$creadListPrec :: ReadPrec [AccountEnrollmentStatus]
readPrec :: ReadPrec AccountEnrollmentStatus
$creadPrec :: ReadPrec AccountEnrollmentStatus
readList :: ReadS [AccountEnrollmentStatus]
$creadList :: ReadS [AccountEnrollmentStatus]
readsPrec :: Int -> ReadS AccountEnrollmentStatus
$creadsPrec :: Int -> ReadS AccountEnrollmentStatus
Prelude.Read, Int -> AccountEnrollmentStatus -> ShowS
[AccountEnrollmentStatus] -> ShowS
AccountEnrollmentStatus -> String
(Int -> AccountEnrollmentStatus -> ShowS)
-> (AccountEnrollmentStatus -> String)
-> ([AccountEnrollmentStatus] -> ShowS)
-> Show AccountEnrollmentStatus
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AccountEnrollmentStatus] -> ShowS
$cshowList :: [AccountEnrollmentStatus] -> ShowS
show :: AccountEnrollmentStatus -> String
$cshow :: AccountEnrollmentStatus -> String
showsPrec :: Int -> AccountEnrollmentStatus -> ShowS
$cshowsPrec :: Int -> AccountEnrollmentStatus -> ShowS
Prelude.Show, (forall x.
 AccountEnrollmentStatus -> Rep AccountEnrollmentStatus x)
-> (forall x.
    Rep AccountEnrollmentStatus x -> AccountEnrollmentStatus)
-> Generic AccountEnrollmentStatus
forall x. Rep AccountEnrollmentStatus x -> AccountEnrollmentStatus
forall x. AccountEnrollmentStatus -> Rep AccountEnrollmentStatus x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AccountEnrollmentStatus x -> AccountEnrollmentStatus
$cfrom :: forall x. AccountEnrollmentStatus -> Rep AccountEnrollmentStatus x
Prelude.Generic)

-- |
-- Create a value of 'AccountEnrollmentStatus' 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', 'accountEnrollmentStatus_status' - The account enrollment status.
--
-- 'accountId', 'accountEnrollmentStatus_accountId' - The Amazon Web Services account ID.
--
-- 'statusReason', 'accountEnrollmentStatus_statusReason' - The reason for the account enrollment status.
--
-- For example, an account might show a status of @Pending@ because member
-- accounts of an organization require more time to be enrolled in the
-- service.
--
-- 'lastUpdatedTimestamp', 'accountEnrollmentStatus_lastUpdatedTimestamp' - The Unix epoch timestamp, in seconds, of when the account enrollment
-- status was last updated.
newAccountEnrollmentStatus ::
  AccountEnrollmentStatus
newAccountEnrollmentStatus :: AccountEnrollmentStatus
newAccountEnrollmentStatus =
  AccountEnrollmentStatus' :: Maybe Status
-> Maybe Text
-> Maybe Text
-> Maybe POSIX
-> AccountEnrollmentStatus
AccountEnrollmentStatus'
    { $sel:status:AccountEnrollmentStatus' :: Maybe Status
status = Maybe Status
forall a. Maybe a
Prelude.Nothing,
      $sel:accountId:AccountEnrollmentStatus' :: Maybe Text
accountId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:statusReason:AccountEnrollmentStatus' :: Maybe Text
statusReason = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:lastUpdatedTimestamp:AccountEnrollmentStatus' :: Maybe POSIX
lastUpdatedTimestamp = Maybe POSIX
forall a. Maybe a
Prelude.Nothing
    }

-- | The account enrollment status.
accountEnrollmentStatus_status :: Lens.Lens' AccountEnrollmentStatus (Prelude.Maybe Status)
accountEnrollmentStatus_status :: (Maybe Status -> f (Maybe Status))
-> AccountEnrollmentStatus -> f AccountEnrollmentStatus
accountEnrollmentStatus_status = (AccountEnrollmentStatus -> Maybe Status)
-> (AccountEnrollmentStatus
    -> Maybe Status -> AccountEnrollmentStatus)
-> Lens
     AccountEnrollmentStatus
     AccountEnrollmentStatus
     (Maybe Status)
     (Maybe Status)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AccountEnrollmentStatus' {Maybe Status
status :: Maybe Status
$sel:status:AccountEnrollmentStatus' :: AccountEnrollmentStatus -> Maybe Status
status} -> Maybe Status
status) (\s :: AccountEnrollmentStatus
s@AccountEnrollmentStatus' {} Maybe Status
a -> AccountEnrollmentStatus
s {$sel:status:AccountEnrollmentStatus' :: Maybe Status
status = Maybe Status
a} :: AccountEnrollmentStatus)

-- | The Amazon Web Services account ID.
accountEnrollmentStatus_accountId :: Lens.Lens' AccountEnrollmentStatus (Prelude.Maybe Prelude.Text)
accountEnrollmentStatus_accountId :: (Maybe Text -> f (Maybe Text))
-> AccountEnrollmentStatus -> f AccountEnrollmentStatus
accountEnrollmentStatus_accountId = (AccountEnrollmentStatus -> Maybe Text)
-> (AccountEnrollmentStatus
    -> Maybe Text -> AccountEnrollmentStatus)
-> Lens
     AccountEnrollmentStatus
     AccountEnrollmentStatus
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AccountEnrollmentStatus' {Maybe Text
accountId :: Maybe Text
$sel:accountId:AccountEnrollmentStatus' :: AccountEnrollmentStatus -> Maybe Text
accountId} -> Maybe Text
accountId) (\s :: AccountEnrollmentStatus
s@AccountEnrollmentStatus' {} Maybe Text
a -> AccountEnrollmentStatus
s {$sel:accountId:AccountEnrollmentStatus' :: Maybe Text
accountId = Maybe Text
a} :: AccountEnrollmentStatus)

-- | The reason for the account enrollment status.
--
-- For example, an account might show a status of @Pending@ because member
-- accounts of an organization require more time to be enrolled in the
-- service.
accountEnrollmentStatus_statusReason :: Lens.Lens' AccountEnrollmentStatus (Prelude.Maybe Prelude.Text)
accountEnrollmentStatus_statusReason :: (Maybe Text -> f (Maybe Text))
-> AccountEnrollmentStatus -> f AccountEnrollmentStatus
accountEnrollmentStatus_statusReason = (AccountEnrollmentStatus -> Maybe Text)
-> (AccountEnrollmentStatus
    -> Maybe Text -> AccountEnrollmentStatus)
-> Lens
     AccountEnrollmentStatus
     AccountEnrollmentStatus
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AccountEnrollmentStatus' {Maybe Text
statusReason :: Maybe Text
$sel:statusReason:AccountEnrollmentStatus' :: AccountEnrollmentStatus -> Maybe Text
statusReason} -> Maybe Text
statusReason) (\s :: AccountEnrollmentStatus
s@AccountEnrollmentStatus' {} Maybe Text
a -> AccountEnrollmentStatus
s {$sel:statusReason:AccountEnrollmentStatus' :: Maybe Text
statusReason = Maybe Text
a} :: AccountEnrollmentStatus)

-- | The Unix epoch timestamp, in seconds, of when the account enrollment
-- status was last updated.
accountEnrollmentStatus_lastUpdatedTimestamp :: Lens.Lens' AccountEnrollmentStatus (Prelude.Maybe Prelude.UTCTime)
accountEnrollmentStatus_lastUpdatedTimestamp :: (Maybe UTCTime -> f (Maybe UTCTime))
-> AccountEnrollmentStatus -> f AccountEnrollmentStatus
accountEnrollmentStatus_lastUpdatedTimestamp = (AccountEnrollmentStatus -> Maybe POSIX)
-> (AccountEnrollmentStatus
    -> Maybe POSIX -> AccountEnrollmentStatus)
-> Lens
     AccountEnrollmentStatus
     AccountEnrollmentStatus
     (Maybe POSIX)
     (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AccountEnrollmentStatus' {Maybe POSIX
lastUpdatedTimestamp :: Maybe POSIX
$sel:lastUpdatedTimestamp:AccountEnrollmentStatus' :: AccountEnrollmentStatus -> Maybe POSIX
lastUpdatedTimestamp} -> Maybe POSIX
lastUpdatedTimestamp) (\s :: AccountEnrollmentStatus
s@AccountEnrollmentStatus' {} Maybe POSIX
a -> AccountEnrollmentStatus
s {$sel:lastUpdatedTimestamp:AccountEnrollmentStatus' :: Maybe POSIX
lastUpdatedTimestamp = Maybe POSIX
a} :: AccountEnrollmentStatus) ((Maybe POSIX -> f (Maybe POSIX))
 -> AccountEnrollmentStatus -> f AccountEnrollmentStatus)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> AccountEnrollmentStatus
-> f AccountEnrollmentStatus
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

instance Core.FromJSON AccountEnrollmentStatus where
  parseJSON :: Value -> Parser AccountEnrollmentStatus
parseJSON =
    String
-> (Object -> Parser AccountEnrollmentStatus)
-> Value
-> Parser AccountEnrollmentStatus
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"AccountEnrollmentStatus"
      ( \Object
x ->
          Maybe Status
-> Maybe Text
-> Maybe Text
-> Maybe POSIX
-> AccountEnrollmentStatus
AccountEnrollmentStatus'
            (Maybe Status
 -> Maybe Text
 -> Maybe Text
 -> Maybe POSIX
 -> AccountEnrollmentStatus)
-> Parser (Maybe Status)
-> Parser
     (Maybe Text
      -> Maybe Text -> Maybe POSIX -> AccountEnrollmentStatus)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Status)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"status")
            Parser
  (Maybe Text
   -> Maybe Text -> Maybe POSIX -> AccountEnrollmentStatus)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe POSIX -> AccountEnrollmentStatus)
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
"accountId")
            Parser (Maybe Text -> Maybe POSIX -> AccountEnrollmentStatus)
-> Parser (Maybe Text)
-> Parser (Maybe POSIX -> AccountEnrollmentStatus)
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
"statusReason")
            Parser (Maybe POSIX -> AccountEnrollmentStatus)
-> Parser (Maybe POSIX) -> Parser AccountEnrollmentStatus
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"lastUpdatedTimestamp")
      )

instance Prelude.Hashable AccountEnrollmentStatus

instance Prelude.NFData AccountEnrollmentStatus