{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# 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.GetBackupPlan
-- 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)
--
-- Returns @BackupPlan@ details for the specified @BackupPlanId@. The
-- details are the body of a backup plan in JSON format, in addition to
-- plan metadata.
module Amazonka.Backup.GetBackupPlan
  ( -- * Creating a Request
    GetBackupPlan (..),
    newGetBackupPlan,

    -- * Request Lenses
    getBackupPlan_versionId,
    getBackupPlan_backupPlanId,

    -- * Destructuring the Response
    GetBackupPlanResponse (..),
    newGetBackupPlanResponse,

    -- * Response Lenses
    getBackupPlanResponse_versionId,
    getBackupPlanResponse_advancedBackupSettings,
    getBackupPlanResponse_backupPlanId,
    getBackupPlanResponse_creatorRequestId,
    getBackupPlanResponse_backupPlanArn,
    getBackupPlanResponse_lastExecutionDate,
    getBackupPlanResponse_backupPlan,
    getBackupPlanResponse_creationDate,
    getBackupPlanResponse_deletionDate,
    getBackupPlanResponse_httpStatus,
  )
where

import Amazonka.Backup.Types
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newGetBackupPlan' smart constructor.
data GetBackupPlan = GetBackupPlan'
  { -- | Unique, randomly generated, Unicode, UTF-8 encoded strings that are at
    -- most 1,024 bytes long. Version IDs cannot be edited.
    GetBackupPlan -> Maybe Text
versionId :: Prelude.Maybe Prelude.Text,
    -- | Uniquely identifies a backup plan.
    GetBackupPlan -> Text
backupPlanId :: Prelude.Text
  }
  deriving (GetBackupPlan -> GetBackupPlan -> Bool
(GetBackupPlan -> GetBackupPlan -> Bool)
-> (GetBackupPlan -> GetBackupPlan -> Bool) -> Eq GetBackupPlan
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetBackupPlan -> GetBackupPlan -> Bool
$c/= :: GetBackupPlan -> GetBackupPlan -> Bool
== :: GetBackupPlan -> GetBackupPlan -> Bool
$c== :: GetBackupPlan -> GetBackupPlan -> Bool
Prelude.Eq, ReadPrec [GetBackupPlan]
ReadPrec GetBackupPlan
Int -> ReadS GetBackupPlan
ReadS [GetBackupPlan]
(Int -> ReadS GetBackupPlan)
-> ReadS [GetBackupPlan]
-> ReadPrec GetBackupPlan
-> ReadPrec [GetBackupPlan]
-> Read GetBackupPlan
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetBackupPlan]
$creadListPrec :: ReadPrec [GetBackupPlan]
readPrec :: ReadPrec GetBackupPlan
$creadPrec :: ReadPrec GetBackupPlan
readList :: ReadS [GetBackupPlan]
$creadList :: ReadS [GetBackupPlan]
readsPrec :: Int -> ReadS GetBackupPlan
$creadsPrec :: Int -> ReadS GetBackupPlan
Prelude.Read, Int -> GetBackupPlan -> ShowS
[GetBackupPlan] -> ShowS
GetBackupPlan -> String
(Int -> GetBackupPlan -> ShowS)
-> (GetBackupPlan -> String)
-> ([GetBackupPlan] -> ShowS)
-> Show GetBackupPlan
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetBackupPlan] -> ShowS
$cshowList :: [GetBackupPlan] -> ShowS
show :: GetBackupPlan -> String
$cshow :: GetBackupPlan -> String
showsPrec :: Int -> GetBackupPlan -> ShowS
$cshowsPrec :: Int -> GetBackupPlan -> ShowS
Prelude.Show, (forall x. GetBackupPlan -> Rep GetBackupPlan x)
-> (forall x. Rep GetBackupPlan x -> GetBackupPlan)
-> Generic GetBackupPlan
forall x. Rep GetBackupPlan x -> GetBackupPlan
forall x. GetBackupPlan -> Rep GetBackupPlan x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetBackupPlan x -> GetBackupPlan
$cfrom :: forall x. GetBackupPlan -> Rep GetBackupPlan x
Prelude.Generic)

-- |
-- Create a value of 'GetBackupPlan' 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:
--
-- 'versionId', 'getBackupPlan_versionId' - Unique, randomly generated, Unicode, UTF-8 encoded strings that are at
-- most 1,024 bytes long. Version IDs cannot be edited.
--
-- 'backupPlanId', 'getBackupPlan_backupPlanId' - Uniquely identifies a backup plan.
newGetBackupPlan ::
  -- | 'backupPlanId'
  Prelude.Text ->
  GetBackupPlan
newGetBackupPlan :: Text -> GetBackupPlan
newGetBackupPlan Text
pBackupPlanId_ =
  GetBackupPlan' :: Maybe Text -> Text -> GetBackupPlan
GetBackupPlan'
    { $sel:versionId:GetBackupPlan' :: Maybe Text
versionId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:backupPlanId:GetBackupPlan' :: Text
backupPlanId = Text
pBackupPlanId_
    }

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

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

instance Core.AWSRequest GetBackupPlan where
  type
    AWSResponse GetBackupPlan =
      GetBackupPlanResponse
  request :: GetBackupPlan -> Request GetBackupPlan
request = Service -> GetBackupPlan -> Request GetBackupPlan
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
  response :: Logger
-> Service
-> Proxy GetBackupPlan
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetBackupPlan)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse GetBackupPlan))
-> Logger
-> Service
-> Proxy GetBackupPlan
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetBackupPlan)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe Text
-> Maybe [AdvancedBackupSetting]
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe POSIX
-> Maybe BackupPlan
-> Maybe POSIX
-> Maybe POSIX
-> Int
-> GetBackupPlanResponse
GetBackupPlanResponse'
            (Maybe Text
 -> Maybe [AdvancedBackupSetting]
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe POSIX
 -> Maybe BackupPlan
 -> Maybe POSIX
 -> Maybe POSIX
 -> Int
 -> GetBackupPlanResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe [AdvancedBackupSetting]
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe POSIX
      -> Maybe BackupPlan
      -> Maybe POSIX
      -> Maybe POSIX
      -> Int
      -> GetBackupPlanResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"VersionId")
            Either
  String
  (Maybe [AdvancedBackupSetting]
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe POSIX
   -> Maybe BackupPlan
   -> Maybe POSIX
   -> Maybe POSIX
   -> Int
   -> GetBackupPlanResponse)
-> Either String (Maybe [AdvancedBackupSetting])
-> Either
     String
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe POSIX
      -> Maybe BackupPlan
      -> Maybe POSIX
      -> Maybe POSIX
      -> Int
      -> GetBackupPlanResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object
-> Text -> Either String (Maybe (Maybe [AdvancedBackupSetting]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"AdvancedBackupSettings"
                            Either String (Maybe (Maybe [AdvancedBackupSetting]))
-> Maybe [AdvancedBackupSetting]
-> Either String (Maybe [AdvancedBackupSetting])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [AdvancedBackupSetting]
forall a. Monoid a => a
Prelude.mempty
                        )
            Either
  String
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe POSIX
   -> Maybe BackupPlan
   -> Maybe POSIX
   -> Maybe POSIX
   -> Int
   -> GetBackupPlanResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe Text
      -> Maybe Text
      -> Maybe POSIX
      -> Maybe BackupPlan
      -> Maybe POSIX
      -> Maybe POSIX
      -> Int
      -> GetBackupPlanResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"BackupPlanId")
            Either
  String
  (Maybe Text
   -> Maybe Text
   -> Maybe POSIX
   -> Maybe BackupPlan
   -> Maybe POSIX
   -> Maybe POSIX
   -> Int
   -> GetBackupPlanResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe Text
      -> Maybe POSIX
      -> Maybe BackupPlan
      -> Maybe POSIX
      -> Maybe POSIX
      -> Int
      -> GetBackupPlanResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"CreatorRequestId")
            Either
  String
  (Maybe Text
   -> Maybe POSIX
   -> Maybe BackupPlan
   -> Maybe POSIX
   -> Maybe POSIX
   -> Int
   -> GetBackupPlanResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe POSIX
      -> Maybe BackupPlan
      -> Maybe POSIX
      -> Maybe POSIX
      -> Int
      -> GetBackupPlanResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"BackupPlanArn")
            Either
  String
  (Maybe POSIX
   -> Maybe BackupPlan
   -> Maybe POSIX
   -> Maybe POSIX
   -> Int
   -> GetBackupPlanResponse)
-> Either String (Maybe POSIX)
-> Either
     String
     (Maybe BackupPlan
      -> Maybe POSIX -> Maybe POSIX -> Int -> GetBackupPlanResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"LastExecutionDate")
            Either
  String
  (Maybe BackupPlan
   -> Maybe POSIX -> Maybe POSIX -> Int -> GetBackupPlanResponse)
-> Either String (Maybe BackupPlan)
-> Either
     String (Maybe POSIX -> Maybe POSIX -> Int -> GetBackupPlanResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe BackupPlan)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"BackupPlan")
            Either
  String (Maybe POSIX -> Maybe POSIX -> Int -> GetBackupPlanResponse)
-> Either String (Maybe POSIX)
-> Either String (Maybe POSIX -> Int -> GetBackupPlanResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"CreationDate")
            Either String (Maybe POSIX -> Int -> GetBackupPlanResponse)
-> Either String (Maybe POSIX)
-> Either String (Int -> GetBackupPlanResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"DeletionDate")
            Either String (Int -> GetBackupPlanResponse)
-> Either String Int -> Either String GetBackupPlanResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable GetBackupPlan

instance Prelude.NFData GetBackupPlan

instance Core.ToHeaders GetBackupPlan where
  toHeaders :: GetBackupPlan -> ResponseHeaders
toHeaders =
    ResponseHeaders -> GetBackupPlan -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"Content-Type"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Core.ToPath GetBackupPlan where
  toPath :: GetBackupPlan -> ByteString
toPath GetBackupPlan' {Maybe Text
Text
backupPlanId :: Text
versionId :: Maybe Text
$sel:backupPlanId:GetBackupPlan' :: GetBackupPlan -> Text
$sel:versionId:GetBackupPlan' :: GetBackupPlan -> Maybe Text
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ByteString
"/backup/plans/", Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
backupPlanId, ByteString
"/"]

instance Core.ToQuery GetBackupPlan where
  toQuery :: GetBackupPlan -> QueryString
toQuery GetBackupPlan' {Maybe Text
Text
backupPlanId :: Text
versionId :: Maybe Text
$sel:backupPlanId:GetBackupPlan' :: GetBackupPlan -> Text
$sel:versionId:GetBackupPlan' :: GetBackupPlan -> Maybe Text
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat [ByteString
"versionId" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
versionId]

-- | /See:/ 'newGetBackupPlanResponse' smart constructor.
data GetBackupPlanResponse = GetBackupPlanResponse'
  { -- | Unique, randomly generated, Unicode, UTF-8 encoded strings that are at
    -- most 1,024 bytes long. Version IDs cannot be edited.
    GetBackupPlanResponse -> Maybe Text
versionId :: Prelude.Maybe Prelude.Text,
    -- | Contains a list of @BackupOptions@ for each resource type. The list is
    -- populated only if the advanced option is set for the backup plan.
    GetBackupPlanResponse -> Maybe [AdvancedBackupSetting]
advancedBackupSettings :: Prelude.Maybe [AdvancedBackupSetting],
    -- | Uniquely identifies a backup plan.
    GetBackupPlanResponse -> Maybe Text
backupPlanId :: Prelude.Maybe Prelude.Text,
    -- | A unique string that identifies the request and allows failed requests
    -- to be retried without the risk of running the operation twice.
    GetBackupPlanResponse -> Maybe Text
creatorRequestId :: 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@.
    GetBackupPlanResponse -> Maybe Text
backupPlanArn :: Prelude.Maybe Prelude.Text,
    -- | The last time a job to back up resources was run with this backup plan.
    -- A date and time, in Unix format and Coordinated Universal Time (UTC).
    -- The value of @LastExecutionDate@ is accurate to milliseconds. For
    -- example, the value 1516925490.087 represents Friday, January 26, 2018
    -- 12:11:30.087 AM.
    GetBackupPlanResponse -> Maybe POSIX
lastExecutionDate :: Prelude.Maybe Core.POSIX,
    -- | Specifies the body of a backup plan. Includes a @BackupPlanName@ and one
    -- or more sets of @Rules@.
    GetBackupPlanResponse -> Maybe BackupPlan
backupPlan :: Prelude.Maybe BackupPlan,
    -- | The date and time that a backup plan is created, in Unix format and
    -- Coordinated Universal Time (UTC). The value of @CreationDate@ is
    -- accurate to milliseconds. For example, the value 1516925490.087
    -- represents Friday, January 26, 2018 12:11:30.087 AM.
    GetBackupPlanResponse -> Maybe POSIX
creationDate :: Prelude.Maybe Core.POSIX,
    -- | The date and time that a backup plan is deleted, in Unix format and
    -- Coordinated Universal Time (UTC). The value of @DeletionDate@ is
    -- accurate to milliseconds. For example, the value 1516925490.087
    -- represents Friday, January 26, 2018 12:11:30.087 AM.
    GetBackupPlanResponse -> Maybe POSIX
deletionDate :: Prelude.Maybe Core.POSIX,
    -- | The response's http status code.
    GetBackupPlanResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (GetBackupPlanResponse -> GetBackupPlanResponse -> Bool
(GetBackupPlanResponse -> GetBackupPlanResponse -> Bool)
-> (GetBackupPlanResponse -> GetBackupPlanResponse -> Bool)
-> Eq GetBackupPlanResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetBackupPlanResponse -> GetBackupPlanResponse -> Bool
$c/= :: GetBackupPlanResponse -> GetBackupPlanResponse -> Bool
== :: GetBackupPlanResponse -> GetBackupPlanResponse -> Bool
$c== :: GetBackupPlanResponse -> GetBackupPlanResponse -> Bool
Prelude.Eq, Int -> GetBackupPlanResponse -> ShowS
[GetBackupPlanResponse] -> ShowS
GetBackupPlanResponse -> String
(Int -> GetBackupPlanResponse -> ShowS)
-> (GetBackupPlanResponse -> String)
-> ([GetBackupPlanResponse] -> ShowS)
-> Show GetBackupPlanResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetBackupPlanResponse] -> ShowS
$cshowList :: [GetBackupPlanResponse] -> ShowS
show :: GetBackupPlanResponse -> String
$cshow :: GetBackupPlanResponse -> String
showsPrec :: Int -> GetBackupPlanResponse -> ShowS
$cshowsPrec :: Int -> GetBackupPlanResponse -> ShowS
Prelude.Show, (forall x. GetBackupPlanResponse -> Rep GetBackupPlanResponse x)
-> (forall x. Rep GetBackupPlanResponse x -> GetBackupPlanResponse)
-> Generic GetBackupPlanResponse
forall x. Rep GetBackupPlanResponse x -> GetBackupPlanResponse
forall x. GetBackupPlanResponse -> Rep GetBackupPlanResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetBackupPlanResponse x -> GetBackupPlanResponse
$cfrom :: forall x. GetBackupPlanResponse -> Rep GetBackupPlanResponse x
Prelude.Generic)

-- |
-- Create a value of 'GetBackupPlanResponse' 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:
--
-- 'versionId', 'getBackupPlanResponse_versionId' - Unique, randomly generated, Unicode, UTF-8 encoded strings that are at
-- most 1,024 bytes long. Version IDs cannot be edited.
--
-- 'advancedBackupSettings', 'getBackupPlanResponse_advancedBackupSettings' - Contains a list of @BackupOptions@ for each resource type. The list is
-- populated only if the advanced option is set for the backup plan.
--
-- 'backupPlanId', 'getBackupPlanResponse_backupPlanId' - Uniquely identifies a backup plan.
--
-- 'creatorRequestId', 'getBackupPlanResponse_creatorRequestId' - A unique string that identifies the request and allows failed requests
-- to be retried without the risk of running the operation twice.
--
-- 'backupPlanArn', 'getBackupPlanResponse_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@.
--
-- 'lastExecutionDate', 'getBackupPlanResponse_lastExecutionDate' - The last time a job to back up resources was run with this backup plan.
-- A date and time, in Unix format and Coordinated Universal Time (UTC).
-- The value of @LastExecutionDate@ is accurate to milliseconds. For
-- example, the value 1516925490.087 represents Friday, January 26, 2018
-- 12:11:30.087 AM.
--
-- 'backupPlan', 'getBackupPlanResponse_backupPlan' - Specifies the body of a backup plan. Includes a @BackupPlanName@ and one
-- or more sets of @Rules@.
--
-- 'creationDate', 'getBackupPlanResponse_creationDate' - The date and time that a backup plan is created, in Unix format and
-- Coordinated Universal Time (UTC). The value of @CreationDate@ is
-- accurate to milliseconds. For example, the value 1516925490.087
-- represents Friday, January 26, 2018 12:11:30.087 AM.
--
-- 'deletionDate', 'getBackupPlanResponse_deletionDate' - The date and time that a backup plan is deleted, in Unix format and
-- Coordinated Universal Time (UTC). The value of @DeletionDate@ is
-- accurate to milliseconds. For example, the value 1516925490.087
-- represents Friday, January 26, 2018 12:11:30.087 AM.
--
-- 'httpStatus', 'getBackupPlanResponse_httpStatus' - The response's http status code.
newGetBackupPlanResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetBackupPlanResponse
newGetBackupPlanResponse :: Int -> GetBackupPlanResponse
newGetBackupPlanResponse Int
pHttpStatus_ =
  GetBackupPlanResponse' :: Maybe Text
-> Maybe [AdvancedBackupSetting]
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe POSIX
-> Maybe BackupPlan
-> Maybe POSIX
-> Maybe POSIX
-> Int
-> GetBackupPlanResponse
GetBackupPlanResponse'
    { $sel:versionId:GetBackupPlanResponse' :: Maybe Text
versionId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:advancedBackupSettings:GetBackupPlanResponse' :: Maybe [AdvancedBackupSetting]
advancedBackupSettings = Maybe [AdvancedBackupSetting]
forall a. Maybe a
Prelude.Nothing,
      $sel:backupPlanId:GetBackupPlanResponse' :: Maybe Text
backupPlanId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:creatorRequestId:GetBackupPlanResponse' :: Maybe Text
creatorRequestId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:backupPlanArn:GetBackupPlanResponse' :: Maybe Text
backupPlanArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:lastExecutionDate:GetBackupPlanResponse' :: Maybe POSIX
lastExecutionDate = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:backupPlan:GetBackupPlanResponse' :: Maybe BackupPlan
backupPlan = Maybe BackupPlan
forall a. Maybe a
Prelude.Nothing,
      $sel:creationDate:GetBackupPlanResponse' :: Maybe POSIX
creationDate = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:deletionDate:GetBackupPlanResponse' :: Maybe POSIX
deletionDate = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:GetBackupPlanResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

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

-- | Contains a list of @BackupOptions@ for each resource type. The list is
-- populated only if the advanced option is set for the backup plan.
getBackupPlanResponse_advancedBackupSettings :: Lens.Lens' GetBackupPlanResponse (Prelude.Maybe [AdvancedBackupSetting])
getBackupPlanResponse_advancedBackupSettings :: (Maybe [AdvancedBackupSetting]
 -> f (Maybe [AdvancedBackupSetting]))
-> GetBackupPlanResponse -> f GetBackupPlanResponse
getBackupPlanResponse_advancedBackupSettings = (GetBackupPlanResponse -> Maybe [AdvancedBackupSetting])
-> (GetBackupPlanResponse
    -> Maybe [AdvancedBackupSetting] -> GetBackupPlanResponse)
-> Lens
     GetBackupPlanResponse
     GetBackupPlanResponse
     (Maybe [AdvancedBackupSetting])
     (Maybe [AdvancedBackupSetting])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetBackupPlanResponse' {Maybe [AdvancedBackupSetting]
advancedBackupSettings :: Maybe [AdvancedBackupSetting]
$sel:advancedBackupSettings:GetBackupPlanResponse' :: GetBackupPlanResponse -> Maybe [AdvancedBackupSetting]
advancedBackupSettings} -> Maybe [AdvancedBackupSetting]
advancedBackupSettings) (\s :: GetBackupPlanResponse
s@GetBackupPlanResponse' {} Maybe [AdvancedBackupSetting]
a -> GetBackupPlanResponse
s {$sel:advancedBackupSettings:GetBackupPlanResponse' :: Maybe [AdvancedBackupSetting]
advancedBackupSettings = Maybe [AdvancedBackupSetting]
a} :: GetBackupPlanResponse) ((Maybe [AdvancedBackupSetting]
  -> f (Maybe [AdvancedBackupSetting]))
 -> GetBackupPlanResponse -> f GetBackupPlanResponse)
-> ((Maybe [AdvancedBackupSetting]
     -> f (Maybe [AdvancedBackupSetting]))
    -> Maybe [AdvancedBackupSetting]
    -> f (Maybe [AdvancedBackupSetting]))
-> (Maybe [AdvancedBackupSetting]
    -> f (Maybe [AdvancedBackupSetting]))
-> GetBackupPlanResponse
-> f GetBackupPlanResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [AdvancedBackupSetting]
  [AdvancedBackupSetting]
  [AdvancedBackupSetting]
  [AdvancedBackupSetting]
-> Iso
     (Maybe [AdvancedBackupSetting])
     (Maybe [AdvancedBackupSetting])
     (Maybe [AdvancedBackupSetting])
     (Maybe [AdvancedBackupSetting])
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
  [AdvancedBackupSetting]
  [AdvancedBackupSetting]
  [AdvancedBackupSetting]
  [AdvancedBackupSetting]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

-- | A unique string that identifies the request and allows failed requests
-- to be retried without the risk of running the operation twice.
getBackupPlanResponse_creatorRequestId :: Lens.Lens' GetBackupPlanResponse (Prelude.Maybe Prelude.Text)
getBackupPlanResponse_creatorRequestId :: (Maybe Text -> f (Maybe Text))
-> GetBackupPlanResponse -> f GetBackupPlanResponse
getBackupPlanResponse_creatorRequestId = (GetBackupPlanResponse -> Maybe Text)
-> (GetBackupPlanResponse -> Maybe Text -> GetBackupPlanResponse)
-> Lens
     GetBackupPlanResponse
     GetBackupPlanResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetBackupPlanResponse' {Maybe Text
creatorRequestId :: Maybe Text
$sel:creatorRequestId:GetBackupPlanResponse' :: GetBackupPlanResponse -> Maybe Text
creatorRequestId} -> Maybe Text
creatorRequestId) (\s :: GetBackupPlanResponse
s@GetBackupPlanResponse' {} Maybe Text
a -> GetBackupPlanResponse
s {$sel:creatorRequestId:GetBackupPlanResponse' :: Maybe Text
creatorRequestId = Maybe Text
a} :: GetBackupPlanResponse)

-- | 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@.
getBackupPlanResponse_backupPlanArn :: Lens.Lens' GetBackupPlanResponse (Prelude.Maybe Prelude.Text)
getBackupPlanResponse_backupPlanArn :: (Maybe Text -> f (Maybe Text))
-> GetBackupPlanResponse -> f GetBackupPlanResponse
getBackupPlanResponse_backupPlanArn = (GetBackupPlanResponse -> Maybe Text)
-> (GetBackupPlanResponse -> Maybe Text -> GetBackupPlanResponse)
-> Lens
     GetBackupPlanResponse
     GetBackupPlanResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetBackupPlanResponse' {Maybe Text
backupPlanArn :: Maybe Text
$sel:backupPlanArn:GetBackupPlanResponse' :: GetBackupPlanResponse -> Maybe Text
backupPlanArn} -> Maybe Text
backupPlanArn) (\s :: GetBackupPlanResponse
s@GetBackupPlanResponse' {} Maybe Text
a -> GetBackupPlanResponse
s {$sel:backupPlanArn:GetBackupPlanResponse' :: Maybe Text
backupPlanArn = Maybe Text
a} :: GetBackupPlanResponse)

-- | The last time a job to back up resources was run with this backup plan.
-- A date and time, in Unix format and Coordinated Universal Time (UTC).
-- The value of @LastExecutionDate@ is accurate to milliseconds. For
-- example, the value 1516925490.087 represents Friday, January 26, 2018
-- 12:11:30.087 AM.
getBackupPlanResponse_lastExecutionDate :: Lens.Lens' GetBackupPlanResponse (Prelude.Maybe Prelude.UTCTime)
getBackupPlanResponse_lastExecutionDate :: (Maybe UTCTime -> f (Maybe UTCTime))
-> GetBackupPlanResponse -> f GetBackupPlanResponse
getBackupPlanResponse_lastExecutionDate = (GetBackupPlanResponse -> Maybe POSIX)
-> (GetBackupPlanResponse -> Maybe POSIX -> GetBackupPlanResponse)
-> Lens
     GetBackupPlanResponse
     GetBackupPlanResponse
     (Maybe POSIX)
     (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetBackupPlanResponse' {Maybe POSIX
lastExecutionDate :: Maybe POSIX
$sel:lastExecutionDate:GetBackupPlanResponse' :: GetBackupPlanResponse -> Maybe POSIX
lastExecutionDate} -> Maybe POSIX
lastExecutionDate) (\s :: GetBackupPlanResponse
s@GetBackupPlanResponse' {} Maybe POSIX
a -> GetBackupPlanResponse
s {$sel:lastExecutionDate:GetBackupPlanResponse' :: Maybe POSIX
lastExecutionDate = Maybe POSIX
a} :: GetBackupPlanResponse) ((Maybe POSIX -> f (Maybe POSIX))
 -> GetBackupPlanResponse -> f GetBackupPlanResponse)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> GetBackupPlanResponse
-> f GetBackupPlanResponse
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

-- | Specifies the body of a backup plan. Includes a @BackupPlanName@ and one
-- or more sets of @Rules@.
getBackupPlanResponse_backupPlan :: Lens.Lens' GetBackupPlanResponse (Prelude.Maybe BackupPlan)
getBackupPlanResponse_backupPlan :: (Maybe BackupPlan -> f (Maybe BackupPlan))
-> GetBackupPlanResponse -> f GetBackupPlanResponse
getBackupPlanResponse_backupPlan = (GetBackupPlanResponse -> Maybe BackupPlan)
-> (GetBackupPlanResponse
    -> Maybe BackupPlan -> GetBackupPlanResponse)
-> Lens
     GetBackupPlanResponse
     GetBackupPlanResponse
     (Maybe BackupPlan)
     (Maybe BackupPlan)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetBackupPlanResponse' {Maybe BackupPlan
backupPlan :: Maybe BackupPlan
$sel:backupPlan:GetBackupPlanResponse' :: GetBackupPlanResponse -> Maybe BackupPlan
backupPlan} -> Maybe BackupPlan
backupPlan) (\s :: GetBackupPlanResponse
s@GetBackupPlanResponse' {} Maybe BackupPlan
a -> GetBackupPlanResponse
s {$sel:backupPlan:GetBackupPlanResponse' :: Maybe BackupPlan
backupPlan = Maybe BackupPlan
a} :: GetBackupPlanResponse)

-- | The date and time that a backup plan is created, in Unix format and
-- Coordinated Universal Time (UTC). The value of @CreationDate@ is
-- accurate to milliseconds. For example, the value 1516925490.087
-- represents Friday, January 26, 2018 12:11:30.087 AM.
getBackupPlanResponse_creationDate :: Lens.Lens' GetBackupPlanResponse (Prelude.Maybe Prelude.UTCTime)
getBackupPlanResponse_creationDate :: (Maybe UTCTime -> f (Maybe UTCTime))
-> GetBackupPlanResponse -> f GetBackupPlanResponse
getBackupPlanResponse_creationDate = (GetBackupPlanResponse -> Maybe POSIX)
-> (GetBackupPlanResponse -> Maybe POSIX -> GetBackupPlanResponse)
-> Lens
     GetBackupPlanResponse
     GetBackupPlanResponse
     (Maybe POSIX)
     (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetBackupPlanResponse' {Maybe POSIX
creationDate :: Maybe POSIX
$sel:creationDate:GetBackupPlanResponse' :: GetBackupPlanResponse -> Maybe POSIX
creationDate} -> Maybe POSIX
creationDate) (\s :: GetBackupPlanResponse
s@GetBackupPlanResponse' {} Maybe POSIX
a -> GetBackupPlanResponse
s {$sel:creationDate:GetBackupPlanResponse' :: Maybe POSIX
creationDate = Maybe POSIX
a} :: GetBackupPlanResponse) ((Maybe POSIX -> f (Maybe POSIX))
 -> GetBackupPlanResponse -> f GetBackupPlanResponse)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> GetBackupPlanResponse
-> f GetBackupPlanResponse
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 date and time that a backup plan is deleted, in Unix format and
-- Coordinated Universal Time (UTC). The value of @DeletionDate@ is
-- accurate to milliseconds. For example, the value 1516925490.087
-- represents Friday, January 26, 2018 12:11:30.087 AM.
getBackupPlanResponse_deletionDate :: Lens.Lens' GetBackupPlanResponse (Prelude.Maybe Prelude.UTCTime)
getBackupPlanResponse_deletionDate :: (Maybe UTCTime -> f (Maybe UTCTime))
-> GetBackupPlanResponse -> f GetBackupPlanResponse
getBackupPlanResponse_deletionDate = (GetBackupPlanResponse -> Maybe POSIX)
-> (GetBackupPlanResponse -> Maybe POSIX -> GetBackupPlanResponse)
-> Lens
     GetBackupPlanResponse
     GetBackupPlanResponse
     (Maybe POSIX)
     (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetBackupPlanResponse' {Maybe POSIX
deletionDate :: Maybe POSIX
$sel:deletionDate:GetBackupPlanResponse' :: GetBackupPlanResponse -> Maybe POSIX
deletionDate} -> Maybe POSIX
deletionDate) (\s :: GetBackupPlanResponse
s@GetBackupPlanResponse' {} Maybe POSIX
a -> GetBackupPlanResponse
s {$sel:deletionDate:GetBackupPlanResponse' :: Maybe POSIX
deletionDate = Maybe POSIX
a} :: GetBackupPlanResponse) ((Maybe POSIX -> f (Maybe POSIX))
 -> GetBackupPlanResponse -> f GetBackupPlanResponse)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> GetBackupPlanResponse
-> f GetBackupPlanResponse
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 response's http status code.
getBackupPlanResponse_httpStatus :: Lens.Lens' GetBackupPlanResponse Prelude.Int
getBackupPlanResponse_httpStatus :: (Int -> f Int) -> GetBackupPlanResponse -> f GetBackupPlanResponse
getBackupPlanResponse_httpStatus = (GetBackupPlanResponse -> Int)
-> (GetBackupPlanResponse -> Int -> GetBackupPlanResponse)
-> Lens GetBackupPlanResponse GetBackupPlanResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetBackupPlanResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetBackupPlanResponse' :: GetBackupPlanResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetBackupPlanResponse
s@GetBackupPlanResponse' {} Int
a -> GetBackupPlanResponse
s {$sel:httpStatus:GetBackupPlanResponse' :: Int
httpStatus = Int
a} :: GetBackupPlanResponse)

instance Prelude.NFData GetBackupPlanResponse