{-# 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.Backup.Types.Framework
-- 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.Backup.Types.Framework where

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

-- | Contains detailed information about a framework. Frameworks contain
-- controls, which evaluate and report on your backup events and resources.
-- Frameworks generate daily compliance results.
--
-- /See:/ 'newFramework' smart constructor.
data Framework = Framework'
  { -- | The date and time that a framework is created, in Unix format and
    -- Coordinated Universal Time (UTC). The value of @CreationTime@ is
    -- accurate to milliseconds. For example, the value 1516925490.087
    -- represents Friday, January 26, 2018 12:11:30.087 AM.
    Framework -> Maybe POSIX
creationTime :: Prelude.Maybe Core.POSIX,
    -- | An optional description of the framework with a maximum 1,024
    -- characters.
    Framework -> Maybe Text
frameworkDescription :: Prelude.Maybe Prelude.Text,
    -- | The number of controls contained by the framework.
    Framework -> Maybe Int
numberOfControls :: Prelude.Maybe Prelude.Int,
    -- | An Amazon Resource Name (ARN) that uniquely identifies a resource. The
    -- format of the ARN depends on the resource type.
    Framework -> Maybe Text
frameworkArn :: Prelude.Maybe Prelude.Text,
    -- | The deployment status of a framework. The statuses are:
    --
    -- @CREATE_IN_PROGRESS | UPDATE_IN_PROGRESS | DELETE_IN_PROGRESS | COMPLETED | FAILED@
    Framework -> Maybe Text
deploymentStatus :: Prelude.Maybe Prelude.Text,
    -- | The unique name of a framework. This name is between 1 and 256
    -- characters, starting with a letter, and consisting of letters (a-z,
    -- A-Z), numbers (0-9), and underscores (_).
    Framework -> Maybe Text
frameworkName :: Prelude.Maybe Prelude.Text
  }
  deriving (Framework -> Framework -> Bool
(Framework -> Framework -> Bool)
-> (Framework -> Framework -> Bool) -> Eq Framework
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Framework -> Framework -> Bool
$c/= :: Framework -> Framework -> Bool
== :: Framework -> Framework -> Bool
$c== :: Framework -> Framework -> Bool
Prelude.Eq, ReadPrec [Framework]
ReadPrec Framework
Int -> ReadS Framework
ReadS [Framework]
(Int -> ReadS Framework)
-> ReadS [Framework]
-> ReadPrec Framework
-> ReadPrec [Framework]
-> Read Framework
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Framework]
$creadListPrec :: ReadPrec [Framework]
readPrec :: ReadPrec Framework
$creadPrec :: ReadPrec Framework
readList :: ReadS [Framework]
$creadList :: ReadS [Framework]
readsPrec :: Int -> ReadS Framework
$creadsPrec :: Int -> ReadS Framework
Prelude.Read, Int -> Framework -> ShowS
[Framework] -> ShowS
Framework -> String
(Int -> Framework -> ShowS)
-> (Framework -> String)
-> ([Framework] -> ShowS)
-> Show Framework
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Framework] -> ShowS
$cshowList :: [Framework] -> ShowS
show :: Framework -> String
$cshow :: Framework -> String
showsPrec :: Int -> Framework -> ShowS
$cshowsPrec :: Int -> Framework -> ShowS
Prelude.Show, (forall x. Framework -> Rep Framework x)
-> (forall x. Rep Framework x -> Framework) -> Generic Framework
forall x. Rep Framework x -> Framework
forall x. Framework -> Rep Framework x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Framework x -> Framework
$cfrom :: forall x. Framework -> Rep Framework x
Prelude.Generic)

-- |
-- Create a value of 'Framework' 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:
--
-- 'creationTime', 'framework_creationTime' - The date and time that a framework is created, in Unix format and
-- Coordinated Universal Time (UTC). The value of @CreationTime@ is
-- accurate to milliseconds. For example, the value 1516925490.087
-- represents Friday, January 26, 2018 12:11:30.087 AM.
--
-- 'frameworkDescription', 'framework_frameworkDescription' - An optional description of the framework with a maximum 1,024
-- characters.
--
-- 'numberOfControls', 'framework_numberOfControls' - The number of controls contained by the framework.
--
-- 'frameworkArn', 'framework_frameworkArn' - An Amazon Resource Name (ARN) that uniquely identifies a resource. The
-- format of the ARN depends on the resource type.
--
-- 'deploymentStatus', 'framework_deploymentStatus' - The deployment status of a framework. The statuses are:
--
-- @CREATE_IN_PROGRESS | UPDATE_IN_PROGRESS | DELETE_IN_PROGRESS | COMPLETED | FAILED@
--
-- 'frameworkName', 'framework_frameworkName' - The unique name of a framework. This name is between 1 and 256
-- characters, starting with a letter, and consisting of letters (a-z,
-- A-Z), numbers (0-9), and underscores (_).
newFramework ::
  Framework
newFramework :: Framework
newFramework =
  Framework' :: Maybe POSIX
-> Maybe Text
-> Maybe Int
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Framework
Framework'
    { $sel:creationTime:Framework' :: Maybe POSIX
creationTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:frameworkDescription:Framework' :: Maybe Text
frameworkDescription = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:numberOfControls:Framework' :: Maybe Int
numberOfControls = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:frameworkArn:Framework' :: Maybe Text
frameworkArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:deploymentStatus:Framework' :: Maybe Text
deploymentStatus = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:frameworkName:Framework' :: Maybe Text
frameworkName = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The date and time that a framework is created, in Unix format and
-- Coordinated Universal Time (UTC). The value of @CreationTime@ is
-- accurate to milliseconds. For example, the value 1516925490.087
-- represents Friday, January 26, 2018 12:11:30.087 AM.
framework_creationTime :: Lens.Lens' Framework (Prelude.Maybe Prelude.UTCTime)
framework_creationTime :: (Maybe UTCTime -> f (Maybe UTCTime)) -> Framework -> f Framework
framework_creationTime = (Framework -> Maybe POSIX)
-> (Framework -> Maybe POSIX -> Framework)
-> Lens Framework Framework (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Framework' {Maybe POSIX
creationTime :: Maybe POSIX
$sel:creationTime:Framework' :: Framework -> Maybe POSIX
creationTime} -> Maybe POSIX
creationTime) (\s :: Framework
s@Framework' {} Maybe POSIX
a -> Framework
s {$sel:creationTime:Framework' :: Maybe POSIX
creationTime = Maybe POSIX
a} :: Framework) ((Maybe POSIX -> f (Maybe POSIX)) -> Framework -> f Framework)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> Framework
-> f Framework
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

-- | An optional description of the framework with a maximum 1,024
-- characters.
framework_frameworkDescription :: Lens.Lens' Framework (Prelude.Maybe Prelude.Text)
framework_frameworkDescription :: (Maybe Text -> f (Maybe Text)) -> Framework -> f Framework
framework_frameworkDescription = (Framework -> Maybe Text)
-> (Framework -> Maybe Text -> Framework)
-> Lens Framework Framework (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Framework' {Maybe Text
frameworkDescription :: Maybe Text
$sel:frameworkDescription:Framework' :: Framework -> Maybe Text
frameworkDescription} -> Maybe Text
frameworkDescription) (\s :: Framework
s@Framework' {} Maybe Text
a -> Framework
s {$sel:frameworkDescription:Framework' :: Maybe Text
frameworkDescription = Maybe Text
a} :: Framework)

-- | The number of controls contained by the framework.
framework_numberOfControls :: Lens.Lens' Framework (Prelude.Maybe Prelude.Int)
framework_numberOfControls :: (Maybe Int -> f (Maybe Int)) -> Framework -> f Framework
framework_numberOfControls = (Framework -> Maybe Int)
-> (Framework -> Maybe Int -> Framework)
-> Lens Framework Framework (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Framework' {Maybe Int
numberOfControls :: Maybe Int
$sel:numberOfControls:Framework' :: Framework -> Maybe Int
numberOfControls} -> Maybe Int
numberOfControls) (\s :: Framework
s@Framework' {} Maybe Int
a -> Framework
s {$sel:numberOfControls:Framework' :: Maybe Int
numberOfControls = Maybe Int
a} :: Framework)

-- | An Amazon Resource Name (ARN) that uniquely identifies a resource. The
-- format of the ARN depends on the resource type.
framework_frameworkArn :: Lens.Lens' Framework (Prelude.Maybe Prelude.Text)
framework_frameworkArn :: (Maybe Text -> f (Maybe Text)) -> Framework -> f Framework
framework_frameworkArn = (Framework -> Maybe Text)
-> (Framework -> Maybe Text -> Framework)
-> Lens Framework Framework (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Framework' {Maybe Text
frameworkArn :: Maybe Text
$sel:frameworkArn:Framework' :: Framework -> Maybe Text
frameworkArn} -> Maybe Text
frameworkArn) (\s :: Framework
s@Framework' {} Maybe Text
a -> Framework
s {$sel:frameworkArn:Framework' :: Maybe Text
frameworkArn = Maybe Text
a} :: Framework)

-- | The deployment status of a framework. The statuses are:
--
-- @CREATE_IN_PROGRESS | UPDATE_IN_PROGRESS | DELETE_IN_PROGRESS | COMPLETED | FAILED@
framework_deploymentStatus :: Lens.Lens' Framework (Prelude.Maybe Prelude.Text)
framework_deploymentStatus :: (Maybe Text -> f (Maybe Text)) -> Framework -> f Framework
framework_deploymentStatus = (Framework -> Maybe Text)
-> (Framework -> Maybe Text -> Framework)
-> Lens Framework Framework (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Framework' {Maybe Text
deploymentStatus :: Maybe Text
$sel:deploymentStatus:Framework' :: Framework -> Maybe Text
deploymentStatus} -> Maybe Text
deploymentStatus) (\s :: Framework
s@Framework' {} Maybe Text
a -> Framework
s {$sel:deploymentStatus:Framework' :: Maybe Text
deploymentStatus = Maybe Text
a} :: Framework)

-- | The unique name of a framework. This name is between 1 and 256
-- characters, starting with a letter, and consisting of letters (a-z,
-- A-Z), numbers (0-9), and underscores (_).
framework_frameworkName :: Lens.Lens' Framework (Prelude.Maybe Prelude.Text)
framework_frameworkName :: (Maybe Text -> f (Maybe Text)) -> Framework -> f Framework
framework_frameworkName = (Framework -> Maybe Text)
-> (Framework -> Maybe Text -> Framework)
-> Lens Framework Framework (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Framework' {Maybe Text
frameworkName :: Maybe Text
$sel:frameworkName:Framework' :: Framework -> Maybe Text
frameworkName} -> Maybe Text
frameworkName) (\s :: Framework
s@Framework' {} Maybe Text
a -> Framework
s {$sel:frameworkName:Framework' :: Maybe Text
frameworkName = Maybe Text
a} :: Framework)

instance Core.FromJSON Framework where
  parseJSON :: Value -> Parser Framework
parseJSON =
    String -> (Object -> Parser Framework) -> Value -> Parser Framework
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"Framework"
      ( \Object
x ->
          Maybe POSIX
-> Maybe Text
-> Maybe Int
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Framework
Framework'
            (Maybe POSIX
 -> Maybe Text
 -> Maybe Int
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Framework)
-> Parser (Maybe POSIX)
-> Parser
     (Maybe Text
      -> Maybe Int
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Framework)
forall (f :: * -> *) a b. Functor 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
"CreationTime")
            Parser
  (Maybe Text
   -> Maybe Int
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Framework)
-> Parser (Maybe Text)
-> Parser
     (Maybe Int -> Maybe Text -> Maybe Text -> Maybe Text -> Framework)
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
"FrameworkDescription")
            Parser
  (Maybe Int -> Maybe Text -> Maybe Text -> Maybe Text -> Framework)
-> Parser (Maybe Int)
-> Parser (Maybe Text -> Maybe Text -> Maybe Text -> Framework)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"NumberOfControls")
            Parser (Maybe Text -> Maybe Text -> Maybe Text -> Framework)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe Text -> Framework)
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
"FrameworkArn")
            Parser (Maybe Text -> Maybe Text -> Framework)
-> Parser (Maybe Text) -> Parser (Maybe Text -> Framework)
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
"DeploymentStatus")
            Parser (Maybe Text -> Framework)
-> Parser (Maybe Text) -> Parser Framework
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
"FrameworkName")
      )

instance Prelude.Hashable Framework

instance Prelude.NFData Framework