{-# 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.RecoveryPointCreator
-- 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.RecoveryPointCreator where

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

-- | Contains information about the backup plan and rule that Backup used to
-- initiate the recovery point backup.
--
-- /See:/ 'newRecoveryPointCreator' smart constructor.
data RecoveryPointCreator = RecoveryPointCreator'
  { -- | Uniquely identifies a backup plan.
    RecoveryPointCreator -> Maybe Text
backupPlanId :: Prelude.Maybe Prelude.Text,
    -- | An Amazon Resource Name (ARN) that uniquely identifies a backup plan;
    -- for example,
    -- @arn:aws:backup:us-east-1:123456789012:plan:8F81F553-3A74-4A3F-B93D-B3360DC80C50@.
    RecoveryPointCreator -> Maybe Text
backupPlanArn :: Prelude.Maybe Prelude.Text,
    -- | Version IDs are unique, randomly generated, Unicode, UTF-8 encoded
    -- strings that are at most 1,024 bytes long. They cannot be edited.
    RecoveryPointCreator -> Maybe Text
backupPlanVersion :: Prelude.Maybe Prelude.Text,
    -- | Uniquely identifies a rule used to schedule the backup of a selection of
    -- resources.
    RecoveryPointCreator -> Maybe Text
backupRuleId :: Prelude.Maybe Prelude.Text
  }
  deriving (RecoveryPointCreator -> RecoveryPointCreator -> Bool
(RecoveryPointCreator -> RecoveryPointCreator -> Bool)
-> (RecoveryPointCreator -> RecoveryPointCreator -> Bool)
-> Eq RecoveryPointCreator
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RecoveryPointCreator -> RecoveryPointCreator -> Bool
$c/= :: RecoveryPointCreator -> RecoveryPointCreator -> Bool
== :: RecoveryPointCreator -> RecoveryPointCreator -> Bool
$c== :: RecoveryPointCreator -> RecoveryPointCreator -> Bool
Prelude.Eq, ReadPrec [RecoveryPointCreator]
ReadPrec RecoveryPointCreator
Int -> ReadS RecoveryPointCreator
ReadS [RecoveryPointCreator]
(Int -> ReadS RecoveryPointCreator)
-> ReadS [RecoveryPointCreator]
-> ReadPrec RecoveryPointCreator
-> ReadPrec [RecoveryPointCreator]
-> Read RecoveryPointCreator
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RecoveryPointCreator]
$creadListPrec :: ReadPrec [RecoveryPointCreator]
readPrec :: ReadPrec RecoveryPointCreator
$creadPrec :: ReadPrec RecoveryPointCreator
readList :: ReadS [RecoveryPointCreator]
$creadList :: ReadS [RecoveryPointCreator]
readsPrec :: Int -> ReadS RecoveryPointCreator
$creadsPrec :: Int -> ReadS RecoveryPointCreator
Prelude.Read, Int -> RecoveryPointCreator -> ShowS
[RecoveryPointCreator] -> ShowS
RecoveryPointCreator -> String
(Int -> RecoveryPointCreator -> ShowS)
-> (RecoveryPointCreator -> String)
-> ([RecoveryPointCreator] -> ShowS)
-> Show RecoveryPointCreator
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RecoveryPointCreator] -> ShowS
$cshowList :: [RecoveryPointCreator] -> ShowS
show :: RecoveryPointCreator -> String
$cshow :: RecoveryPointCreator -> String
showsPrec :: Int -> RecoveryPointCreator -> ShowS
$cshowsPrec :: Int -> RecoveryPointCreator -> ShowS
Prelude.Show, (forall x. RecoveryPointCreator -> Rep RecoveryPointCreator x)
-> (forall x. Rep RecoveryPointCreator x -> RecoveryPointCreator)
-> Generic RecoveryPointCreator
forall x. Rep RecoveryPointCreator x -> RecoveryPointCreator
forall x. RecoveryPointCreator -> Rep RecoveryPointCreator x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RecoveryPointCreator x -> RecoveryPointCreator
$cfrom :: forall x. RecoveryPointCreator -> Rep RecoveryPointCreator x
Prelude.Generic)

-- |
-- Create a value of 'RecoveryPointCreator' 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:
--
-- 'backupPlanId', 'recoveryPointCreator_backupPlanId' - Uniquely identifies a backup plan.
--
-- 'backupPlanArn', 'recoveryPointCreator_backupPlanArn' - An Amazon Resource Name (ARN) that uniquely identifies a backup plan;
-- for example,
-- @arn:aws:backup:us-east-1:123456789012:plan:8F81F553-3A74-4A3F-B93D-B3360DC80C50@.
--
-- 'backupPlanVersion', 'recoveryPointCreator_backupPlanVersion' - Version IDs are unique, randomly generated, Unicode, UTF-8 encoded
-- strings that are at most 1,024 bytes long. They cannot be edited.
--
-- 'backupRuleId', 'recoveryPointCreator_backupRuleId' - Uniquely identifies a rule used to schedule the backup of a selection of
-- resources.
newRecoveryPointCreator ::
  RecoveryPointCreator
newRecoveryPointCreator :: RecoveryPointCreator
newRecoveryPointCreator =
  RecoveryPointCreator' :: Maybe Text
-> Maybe Text -> Maybe Text -> Maybe Text -> RecoveryPointCreator
RecoveryPointCreator'
    { $sel:backupPlanId:RecoveryPointCreator' :: Maybe Text
backupPlanId =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:backupPlanArn:RecoveryPointCreator' :: Maybe Text
backupPlanArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:backupPlanVersion:RecoveryPointCreator' :: Maybe Text
backupPlanVersion = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:backupRuleId:RecoveryPointCreator' :: Maybe Text
backupRuleId = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | Uniquely identifies a backup plan.
recoveryPointCreator_backupPlanId :: Lens.Lens' RecoveryPointCreator (Prelude.Maybe Prelude.Text)
recoveryPointCreator_backupPlanId :: (Maybe Text -> f (Maybe Text))
-> RecoveryPointCreator -> f RecoveryPointCreator
recoveryPointCreator_backupPlanId = (RecoveryPointCreator -> Maybe Text)
-> (RecoveryPointCreator -> Maybe Text -> RecoveryPointCreator)
-> Lens
     RecoveryPointCreator RecoveryPointCreator (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RecoveryPointCreator' {Maybe Text
backupPlanId :: Maybe Text
$sel:backupPlanId:RecoveryPointCreator' :: RecoveryPointCreator -> Maybe Text
backupPlanId} -> Maybe Text
backupPlanId) (\s :: RecoveryPointCreator
s@RecoveryPointCreator' {} Maybe Text
a -> RecoveryPointCreator
s {$sel:backupPlanId:RecoveryPointCreator' :: Maybe Text
backupPlanId = Maybe Text
a} :: RecoveryPointCreator)

-- | An Amazon Resource Name (ARN) that uniquely identifies a backup plan;
-- for example,
-- @arn:aws:backup:us-east-1:123456789012:plan:8F81F553-3A74-4A3F-B93D-B3360DC80C50@.
recoveryPointCreator_backupPlanArn :: Lens.Lens' RecoveryPointCreator (Prelude.Maybe Prelude.Text)
recoveryPointCreator_backupPlanArn :: (Maybe Text -> f (Maybe Text))
-> RecoveryPointCreator -> f RecoveryPointCreator
recoveryPointCreator_backupPlanArn = (RecoveryPointCreator -> Maybe Text)
-> (RecoveryPointCreator -> Maybe Text -> RecoveryPointCreator)
-> Lens
     RecoveryPointCreator RecoveryPointCreator (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RecoveryPointCreator' {Maybe Text
backupPlanArn :: Maybe Text
$sel:backupPlanArn:RecoveryPointCreator' :: RecoveryPointCreator -> Maybe Text
backupPlanArn} -> Maybe Text
backupPlanArn) (\s :: RecoveryPointCreator
s@RecoveryPointCreator' {} Maybe Text
a -> RecoveryPointCreator
s {$sel:backupPlanArn:RecoveryPointCreator' :: Maybe Text
backupPlanArn = Maybe Text
a} :: RecoveryPointCreator)

-- | Version IDs are unique, randomly generated, Unicode, UTF-8 encoded
-- strings that are at most 1,024 bytes long. They cannot be edited.
recoveryPointCreator_backupPlanVersion :: Lens.Lens' RecoveryPointCreator (Prelude.Maybe Prelude.Text)
recoveryPointCreator_backupPlanVersion :: (Maybe Text -> f (Maybe Text))
-> RecoveryPointCreator -> f RecoveryPointCreator
recoveryPointCreator_backupPlanVersion = (RecoveryPointCreator -> Maybe Text)
-> (RecoveryPointCreator -> Maybe Text -> RecoveryPointCreator)
-> Lens
     RecoveryPointCreator RecoveryPointCreator (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RecoveryPointCreator' {Maybe Text
backupPlanVersion :: Maybe Text
$sel:backupPlanVersion:RecoveryPointCreator' :: RecoveryPointCreator -> Maybe Text
backupPlanVersion} -> Maybe Text
backupPlanVersion) (\s :: RecoveryPointCreator
s@RecoveryPointCreator' {} Maybe Text
a -> RecoveryPointCreator
s {$sel:backupPlanVersion:RecoveryPointCreator' :: Maybe Text
backupPlanVersion = Maybe Text
a} :: RecoveryPointCreator)

-- | Uniquely identifies a rule used to schedule the backup of a selection of
-- resources.
recoveryPointCreator_backupRuleId :: Lens.Lens' RecoveryPointCreator (Prelude.Maybe Prelude.Text)
recoveryPointCreator_backupRuleId :: (Maybe Text -> f (Maybe Text))
-> RecoveryPointCreator -> f RecoveryPointCreator
recoveryPointCreator_backupRuleId = (RecoveryPointCreator -> Maybe Text)
-> (RecoveryPointCreator -> Maybe Text -> RecoveryPointCreator)
-> Lens
     RecoveryPointCreator RecoveryPointCreator (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RecoveryPointCreator' {Maybe Text
backupRuleId :: Maybe Text
$sel:backupRuleId:RecoveryPointCreator' :: RecoveryPointCreator -> Maybe Text
backupRuleId} -> Maybe Text
backupRuleId) (\s :: RecoveryPointCreator
s@RecoveryPointCreator' {} Maybe Text
a -> RecoveryPointCreator
s {$sel:backupRuleId:RecoveryPointCreator' :: Maybe Text
backupRuleId = Maybe Text
a} :: RecoveryPointCreator)

instance Core.FromJSON RecoveryPointCreator where
  parseJSON :: Value -> Parser RecoveryPointCreator
parseJSON =
    String
-> (Object -> Parser RecoveryPointCreator)
-> Value
-> Parser RecoveryPointCreator
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"RecoveryPointCreator"
      ( \Object
x ->
          Maybe Text
-> Maybe Text -> Maybe Text -> Maybe Text -> RecoveryPointCreator
RecoveryPointCreator'
            (Maybe Text
 -> Maybe Text -> Maybe Text -> Maybe Text -> RecoveryPointCreator)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text -> Maybe Text -> Maybe Text -> RecoveryPointCreator)
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
"BackupPlanId")
            Parser
  (Maybe Text -> Maybe Text -> Maybe Text -> RecoveryPointCreator)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe Text -> RecoveryPointCreator)
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
"BackupPlanArn")
            Parser (Maybe Text -> Maybe Text -> RecoveryPointCreator)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> RecoveryPointCreator)
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
"BackupPlanVersion")
            Parser (Maybe Text -> RecoveryPointCreator)
-> Parser (Maybe Text) -> Parser RecoveryPointCreator
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
"BackupRuleId")
      )

instance Prelude.Hashable RecoveryPointCreator

instance Prelude.NFData RecoveryPointCreator