{-# 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.Config.Types.OrganizationConformancePackStatus
-- 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.Config.Types.OrganizationConformancePackStatus where

import Amazonka.Config.Types.OrganizationResourceStatus
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Returns the status for an organization conformance pack in an
-- organization.
--
-- /See:/ 'newOrganizationConformancePackStatus' smart constructor.
data OrganizationConformancePackStatus = OrganizationConformancePackStatus'
  { -- | An error code that is returned when organization conformance pack
    -- creation or deletion has failed in a member account.
    OrganizationConformancePackStatus -> Maybe Text
errorCode :: Prelude.Maybe Prelude.Text,
    -- | An error message indicating that organization conformance pack creation
    -- or deletion failed due to an error.
    OrganizationConformancePackStatus -> Maybe Text
errorMessage :: Prelude.Maybe Prelude.Text,
    -- | The timestamp of the last update.
    OrganizationConformancePackStatus -> Maybe POSIX
lastUpdateTime :: Prelude.Maybe Core.POSIX,
    -- | The name that you assign to organization conformance pack.
    OrganizationConformancePackStatus -> Text
organizationConformancePackName :: Prelude.Text,
    -- | Indicates deployment status of an organization conformance pack. When
    -- master account calls PutOrganizationConformancePack for the first time,
    -- conformance pack status is created in all the member accounts. When
    -- master account calls PutOrganizationConformancePack for the second time,
    -- conformance pack status is updated in all the member accounts.
    -- Additionally, conformance pack status is updated when one or more member
    -- accounts join or leave an organization. Conformance pack status is
    -- deleted when the master account deletes OrganizationConformancePack in
    -- all the member accounts and disables service access for
    -- @config-multiaccountsetup.amazonaws.com@.
    --
    -- Config sets the state of the conformance pack to:
    --
    -- -   @CREATE_SUCCESSFUL@ when an organization conformance pack has been
    --     successfully created in all the member accounts.
    --
    -- -   @CREATE_IN_PROGRESS@ when an organization conformance pack creation
    --     is in progress.
    --
    -- -   @CREATE_FAILED@ when an organization conformance pack creation
    --     failed in one or more member accounts within that organization.
    --
    -- -   @DELETE_FAILED@ when an organization conformance pack deletion
    --     failed in one or more member accounts within that organization.
    --
    -- -   @DELETE_IN_PROGRESS@ when an organization conformance pack deletion
    --     is in progress.
    --
    -- -   @DELETE_SUCCESSFUL@ when an organization conformance pack has been
    --     successfully deleted from all the member accounts.
    --
    -- -   @UPDATE_SUCCESSFUL@ when an organization conformance pack has been
    --     successfully updated in all the member accounts.
    --
    -- -   @UPDATE_IN_PROGRESS@ when an organization conformance pack update is
    --     in progress.
    --
    -- -   @UPDATE_FAILED@ when an organization conformance pack update failed
    --     in one or more member accounts within that organization.
    OrganizationConformancePackStatus -> OrganizationResourceStatus
status :: OrganizationResourceStatus
  }
  deriving (OrganizationConformancePackStatus
-> OrganizationConformancePackStatus -> Bool
(OrganizationConformancePackStatus
 -> OrganizationConformancePackStatus -> Bool)
-> (OrganizationConformancePackStatus
    -> OrganizationConformancePackStatus -> Bool)
-> Eq OrganizationConformancePackStatus
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: OrganizationConformancePackStatus
-> OrganizationConformancePackStatus -> Bool
$c/= :: OrganizationConformancePackStatus
-> OrganizationConformancePackStatus -> Bool
== :: OrganizationConformancePackStatus
-> OrganizationConformancePackStatus -> Bool
$c== :: OrganizationConformancePackStatus
-> OrganizationConformancePackStatus -> Bool
Prelude.Eq, ReadPrec [OrganizationConformancePackStatus]
ReadPrec OrganizationConformancePackStatus
Int -> ReadS OrganizationConformancePackStatus
ReadS [OrganizationConformancePackStatus]
(Int -> ReadS OrganizationConformancePackStatus)
-> ReadS [OrganizationConformancePackStatus]
-> ReadPrec OrganizationConformancePackStatus
-> ReadPrec [OrganizationConformancePackStatus]
-> Read OrganizationConformancePackStatus
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [OrganizationConformancePackStatus]
$creadListPrec :: ReadPrec [OrganizationConformancePackStatus]
readPrec :: ReadPrec OrganizationConformancePackStatus
$creadPrec :: ReadPrec OrganizationConformancePackStatus
readList :: ReadS [OrganizationConformancePackStatus]
$creadList :: ReadS [OrganizationConformancePackStatus]
readsPrec :: Int -> ReadS OrganizationConformancePackStatus
$creadsPrec :: Int -> ReadS OrganizationConformancePackStatus
Prelude.Read, Int -> OrganizationConformancePackStatus -> ShowS
[OrganizationConformancePackStatus] -> ShowS
OrganizationConformancePackStatus -> String
(Int -> OrganizationConformancePackStatus -> ShowS)
-> (OrganizationConformancePackStatus -> String)
-> ([OrganizationConformancePackStatus] -> ShowS)
-> Show OrganizationConformancePackStatus
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [OrganizationConformancePackStatus] -> ShowS
$cshowList :: [OrganizationConformancePackStatus] -> ShowS
show :: OrganizationConformancePackStatus -> String
$cshow :: OrganizationConformancePackStatus -> String
showsPrec :: Int -> OrganizationConformancePackStatus -> ShowS
$cshowsPrec :: Int -> OrganizationConformancePackStatus -> ShowS
Prelude.Show, (forall x.
 OrganizationConformancePackStatus
 -> Rep OrganizationConformancePackStatus x)
-> (forall x.
    Rep OrganizationConformancePackStatus x
    -> OrganizationConformancePackStatus)
-> Generic OrganizationConformancePackStatus
forall x.
Rep OrganizationConformancePackStatus x
-> OrganizationConformancePackStatus
forall x.
OrganizationConformancePackStatus
-> Rep OrganizationConformancePackStatus x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep OrganizationConformancePackStatus x
-> OrganizationConformancePackStatus
$cfrom :: forall x.
OrganizationConformancePackStatus
-> Rep OrganizationConformancePackStatus x
Prelude.Generic)

-- |
-- Create a value of 'OrganizationConformancePackStatus' 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:
--
-- 'errorCode', 'organizationConformancePackStatus_errorCode' - An error code that is returned when organization conformance pack
-- creation or deletion has failed in a member account.
--
-- 'errorMessage', 'organizationConformancePackStatus_errorMessage' - An error message indicating that organization conformance pack creation
-- or deletion failed due to an error.
--
-- 'lastUpdateTime', 'organizationConformancePackStatus_lastUpdateTime' - The timestamp of the last update.
--
-- 'organizationConformancePackName', 'organizationConformancePackStatus_organizationConformancePackName' - The name that you assign to organization conformance pack.
--
-- 'status', 'organizationConformancePackStatus_status' - Indicates deployment status of an organization conformance pack. When
-- master account calls PutOrganizationConformancePack for the first time,
-- conformance pack status is created in all the member accounts. When
-- master account calls PutOrganizationConformancePack for the second time,
-- conformance pack status is updated in all the member accounts.
-- Additionally, conformance pack status is updated when one or more member
-- accounts join or leave an organization. Conformance pack status is
-- deleted when the master account deletes OrganizationConformancePack in
-- all the member accounts and disables service access for
-- @config-multiaccountsetup.amazonaws.com@.
--
-- Config sets the state of the conformance pack to:
--
-- -   @CREATE_SUCCESSFUL@ when an organization conformance pack has been
--     successfully created in all the member accounts.
--
-- -   @CREATE_IN_PROGRESS@ when an organization conformance pack creation
--     is in progress.
--
-- -   @CREATE_FAILED@ when an organization conformance pack creation
--     failed in one or more member accounts within that organization.
--
-- -   @DELETE_FAILED@ when an organization conformance pack deletion
--     failed in one or more member accounts within that organization.
--
-- -   @DELETE_IN_PROGRESS@ when an organization conformance pack deletion
--     is in progress.
--
-- -   @DELETE_SUCCESSFUL@ when an organization conformance pack has been
--     successfully deleted from all the member accounts.
--
-- -   @UPDATE_SUCCESSFUL@ when an organization conformance pack has been
--     successfully updated in all the member accounts.
--
-- -   @UPDATE_IN_PROGRESS@ when an organization conformance pack update is
--     in progress.
--
-- -   @UPDATE_FAILED@ when an organization conformance pack update failed
--     in one or more member accounts within that organization.
newOrganizationConformancePackStatus ::
  -- | 'organizationConformancePackName'
  Prelude.Text ->
  -- | 'status'
  OrganizationResourceStatus ->
  OrganizationConformancePackStatus
newOrganizationConformancePackStatus :: Text
-> OrganizationResourceStatus -> OrganizationConformancePackStatus
newOrganizationConformancePackStatus
  Text
pOrganizationConformancePackName_
  OrganizationResourceStatus
pStatus_ =
    OrganizationConformancePackStatus' :: Maybe Text
-> Maybe Text
-> Maybe POSIX
-> Text
-> OrganizationResourceStatus
-> OrganizationConformancePackStatus
OrganizationConformancePackStatus'
      { $sel:errorCode:OrganizationConformancePackStatus' :: Maybe Text
errorCode =
          Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:errorMessage:OrganizationConformancePackStatus' :: Maybe Text
errorMessage = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:lastUpdateTime:OrganizationConformancePackStatus' :: Maybe POSIX
lastUpdateTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
        $sel:organizationConformancePackName:OrganizationConformancePackStatus' :: Text
organizationConformancePackName =
          Text
pOrganizationConformancePackName_,
        $sel:status:OrganizationConformancePackStatus' :: OrganizationResourceStatus
status = OrganizationResourceStatus
pStatus_
      }

-- | An error code that is returned when organization conformance pack
-- creation or deletion has failed in a member account.
organizationConformancePackStatus_errorCode :: Lens.Lens' OrganizationConformancePackStatus (Prelude.Maybe Prelude.Text)
organizationConformancePackStatus_errorCode :: (Maybe Text -> f (Maybe Text))
-> OrganizationConformancePackStatus
-> f OrganizationConformancePackStatus
organizationConformancePackStatus_errorCode = (OrganizationConformancePackStatus -> Maybe Text)
-> (OrganizationConformancePackStatus
    -> Maybe Text -> OrganizationConformancePackStatus)
-> Lens
     OrganizationConformancePackStatus
     OrganizationConformancePackStatus
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OrganizationConformancePackStatus' {Maybe Text
errorCode :: Maybe Text
$sel:errorCode:OrganizationConformancePackStatus' :: OrganizationConformancePackStatus -> Maybe Text
errorCode} -> Maybe Text
errorCode) (\s :: OrganizationConformancePackStatus
s@OrganizationConformancePackStatus' {} Maybe Text
a -> OrganizationConformancePackStatus
s {$sel:errorCode:OrganizationConformancePackStatus' :: Maybe Text
errorCode = Maybe Text
a} :: OrganizationConformancePackStatus)

-- | An error message indicating that organization conformance pack creation
-- or deletion failed due to an error.
organizationConformancePackStatus_errorMessage :: Lens.Lens' OrganizationConformancePackStatus (Prelude.Maybe Prelude.Text)
organizationConformancePackStatus_errorMessage :: (Maybe Text -> f (Maybe Text))
-> OrganizationConformancePackStatus
-> f OrganizationConformancePackStatus
organizationConformancePackStatus_errorMessage = (OrganizationConformancePackStatus -> Maybe Text)
-> (OrganizationConformancePackStatus
    -> Maybe Text -> OrganizationConformancePackStatus)
-> Lens
     OrganizationConformancePackStatus
     OrganizationConformancePackStatus
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OrganizationConformancePackStatus' {Maybe Text
errorMessage :: Maybe Text
$sel:errorMessage:OrganizationConformancePackStatus' :: OrganizationConformancePackStatus -> Maybe Text
errorMessage} -> Maybe Text
errorMessage) (\s :: OrganizationConformancePackStatus
s@OrganizationConformancePackStatus' {} Maybe Text
a -> OrganizationConformancePackStatus
s {$sel:errorMessage:OrganizationConformancePackStatus' :: Maybe Text
errorMessage = Maybe Text
a} :: OrganizationConformancePackStatus)

-- | The timestamp of the last update.
organizationConformancePackStatus_lastUpdateTime :: Lens.Lens' OrganizationConformancePackStatus (Prelude.Maybe Prelude.UTCTime)
organizationConformancePackStatus_lastUpdateTime :: (Maybe UTCTime -> f (Maybe UTCTime))
-> OrganizationConformancePackStatus
-> f OrganizationConformancePackStatus
organizationConformancePackStatus_lastUpdateTime = (OrganizationConformancePackStatus -> Maybe POSIX)
-> (OrganizationConformancePackStatus
    -> Maybe POSIX -> OrganizationConformancePackStatus)
-> Lens
     OrganizationConformancePackStatus
     OrganizationConformancePackStatus
     (Maybe POSIX)
     (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OrganizationConformancePackStatus' {Maybe POSIX
lastUpdateTime :: Maybe POSIX
$sel:lastUpdateTime:OrganizationConformancePackStatus' :: OrganizationConformancePackStatus -> Maybe POSIX
lastUpdateTime} -> Maybe POSIX
lastUpdateTime) (\s :: OrganizationConformancePackStatus
s@OrganizationConformancePackStatus' {} Maybe POSIX
a -> OrganizationConformancePackStatus
s {$sel:lastUpdateTime:OrganizationConformancePackStatus' :: Maybe POSIX
lastUpdateTime = Maybe POSIX
a} :: OrganizationConformancePackStatus) ((Maybe POSIX -> f (Maybe POSIX))
 -> OrganizationConformancePackStatus
 -> f OrganizationConformancePackStatus)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> OrganizationConformancePackStatus
-> f OrganizationConformancePackStatus
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 name that you assign to organization conformance pack.
organizationConformancePackStatus_organizationConformancePackName :: Lens.Lens' OrganizationConformancePackStatus Prelude.Text
organizationConformancePackStatus_organizationConformancePackName :: (Text -> f Text)
-> OrganizationConformancePackStatus
-> f OrganizationConformancePackStatus
organizationConformancePackStatus_organizationConformancePackName = (OrganizationConformancePackStatus -> Text)
-> (OrganizationConformancePackStatus
    -> Text -> OrganizationConformancePackStatus)
-> Lens
     OrganizationConformancePackStatus
     OrganizationConformancePackStatus
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OrganizationConformancePackStatus' {Text
organizationConformancePackName :: Text
$sel:organizationConformancePackName:OrganizationConformancePackStatus' :: OrganizationConformancePackStatus -> Text
organizationConformancePackName} -> Text
organizationConformancePackName) (\s :: OrganizationConformancePackStatus
s@OrganizationConformancePackStatus' {} Text
a -> OrganizationConformancePackStatus
s {$sel:organizationConformancePackName:OrganizationConformancePackStatus' :: Text
organizationConformancePackName = Text
a} :: OrganizationConformancePackStatus)

-- | Indicates deployment status of an organization conformance pack. When
-- master account calls PutOrganizationConformancePack for the first time,
-- conformance pack status is created in all the member accounts. When
-- master account calls PutOrganizationConformancePack for the second time,
-- conformance pack status is updated in all the member accounts.
-- Additionally, conformance pack status is updated when one or more member
-- accounts join or leave an organization. Conformance pack status is
-- deleted when the master account deletes OrganizationConformancePack in
-- all the member accounts and disables service access for
-- @config-multiaccountsetup.amazonaws.com@.
--
-- Config sets the state of the conformance pack to:
--
-- -   @CREATE_SUCCESSFUL@ when an organization conformance pack has been
--     successfully created in all the member accounts.
--
-- -   @CREATE_IN_PROGRESS@ when an organization conformance pack creation
--     is in progress.
--
-- -   @CREATE_FAILED@ when an organization conformance pack creation
--     failed in one or more member accounts within that organization.
--
-- -   @DELETE_FAILED@ when an organization conformance pack deletion
--     failed in one or more member accounts within that organization.
--
-- -   @DELETE_IN_PROGRESS@ when an organization conformance pack deletion
--     is in progress.
--
-- -   @DELETE_SUCCESSFUL@ when an organization conformance pack has been
--     successfully deleted from all the member accounts.
--
-- -   @UPDATE_SUCCESSFUL@ when an organization conformance pack has been
--     successfully updated in all the member accounts.
--
-- -   @UPDATE_IN_PROGRESS@ when an organization conformance pack update is
--     in progress.
--
-- -   @UPDATE_FAILED@ when an organization conformance pack update failed
--     in one or more member accounts within that organization.
organizationConformancePackStatus_status :: Lens.Lens' OrganizationConformancePackStatus OrganizationResourceStatus
organizationConformancePackStatus_status :: (OrganizationResourceStatus -> f OrganizationResourceStatus)
-> OrganizationConformancePackStatus
-> f OrganizationConformancePackStatus
organizationConformancePackStatus_status = (OrganizationConformancePackStatus -> OrganizationResourceStatus)
-> (OrganizationConformancePackStatus
    -> OrganizationResourceStatus -> OrganizationConformancePackStatus)
-> Lens
     OrganizationConformancePackStatus
     OrganizationConformancePackStatus
     OrganizationResourceStatus
     OrganizationResourceStatus
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OrganizationConformancePackStatus' {OrganizationResourceStatus
status :: OrganizationResourceStatus
$sel:status:OrganizationConformancePackStatus' :: OrganizationConformancePackStatus -> OrganizationResourceStatus
status} -> OrganizationResourceStatus
status) (\s :: OrganizationConformancePackStatus
s@OrganizationConformancePackStatus' {} OrganizationResourceStatus
a -> OrganizationConformancePackStatus
s {$sel:status:OrganizationConformancePackStatus' :: OrganizationResourceStatus
status = OrganizationResourceStatus
a} :: OrganizationConformancePackStatus)

instance
  Core.FromJSON
    OrganizationConformancePackStatus
  where
  parseJSON :: Value -> Parser OrganizationConformancePackStatus
parseJSON =
    String
-> (Object -> Parser OrganizationConformancePackStatus)
-> Value
-> Parser OrganizationConformancePackStatus
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"OrganizationConformancePackStatus"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe POSIX
-> Text
-> OrganizationResourceStatus
-> OrganizationConformancePackStatus
OrganizationConformancePackStatus'
            (Maybe Text
 -> Maybe Text
 -> Maybe POSIX
 -> Text
 -> OrganizationResourceStatus
 -> OrganizationConformancePackStatus)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe POSIX
      -> Text
      -> OrganizationResourceStatus
      -> OrganizationConformancePackStatus)
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
"ErrorCode")
            Parser
  (Maybe Text
   -> Maybe POSIX
   -> Text
   -> OrganizationResourceStatus
   -> OrganizationConformancePackStatus)
-> Parser (Maybe Text)
-> Parser
     (Maybe POSIX
      -> Text
      -> OrganizationResourceStatus
      -> OrganizationConformancePackStatus)
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
"ErrorMessage")
            Parser
  (Maybe POSIX
   -> Text
   -> OrganizationResourceStatus
   -> OrganizationConformancePackStatus)
-> Parser (Maybe POSIX)
-> Parser
     (Text
      -> OrganizationResourceStatus -> OrganizationConformancePackStatus)
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
"LastUpdateTime")
            Parser
  (Text
   -> OrganizationResourceStatus -> OrganizationConformancePackStatus)
-> Parser Text
-> Parser
     (OrganizationResourceStatus -> OrganizationConformancePackStatus)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"OrganizationConformancePackName")
            Parser
  (OrganizationResourceStatus -> OrganizationConformancePackStatus)
-> Parser OrganizationResourceStatus
-> Parser OrganizationConformancePackStatus
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser OrganizationResourceStatus
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"Status")
      )

instance
  Prelude.Hashable
    OrganizationConformancePackStatus

instance
  Prelude.NFData
    OrganizationConformancePackStatus