{-# 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.CreateBackupPlan
-- 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)
--
-- Creates a backup plan using a backup plan name and backup rules. A
-- backup plan is a document that contains information that Backup uses to
-- schedule tasks that create recovery points for resources.
--
-- If you call @CreateBackupPlan@ with a plan that already exists, you
-- receive an @AlreadyExistsException@ exception.
module Amazonka.Backup.CreateBackupPlan
  ( -- * Creating a Request
    CreateBackupPlan (..),
    newCreateBackupPlan,

    -- * Request Lenses
    createBackupPlan_backupPlanTags,
    createBackupPlan_creatorRequestId,
    createBackupPlan_backupPlan,

    -- * Destructuring the Response
    CreateBackupPlanResponse (..),
    newCreateBackupPlanResponse,

    -- * Response Lenses
    createBackupPlanResponse_versionId,
    createBackupPlanResponse_advancedBackupSettings,
    createBackupPlanResponse_backupPlanId,
    createBackupPlanResponse_backupPlanArn,
    createBackupPlanResponse_creationDate,
    createBackupPlanResponse_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:/ 'newCreateBackupPlan' smart constructor.
data CreateBackupPlan = CreateBackupPlan'
  { -- | To help organize your resources, you can assign your own metadata to the
    -- resources that you create. Each tag is a key-value pair. The specified
    -- tags are assigned to all backups created with this plan.
    CreateBackupPlan -> Maybe (Sensitive (HashMap Text Text))
backupPlanTags :: Prelude.Maybe (Core.Sensitive (Prelude.HashMap Prelude.Text Prelude.Text)),
    -- | Identifies the request and allows failed requests to be retried without
    -- the risk of running the operation twice. If the request includes a
    -- @CreatorRequestId@ that matches an existing backup plan, that plan is
    -- returned. This parameter is optional.
    CreateBackupPlan -> Maybe Text
creatorRequestId :: Prelude.Maybe Prelude.Text,
    -- | Specifies the body of a backup plan. Includes a @BackupPlanName@ and one
    -- or more sets of @Rules@.
    CreateBackupPlan -> BackupPlanInput
backupPlan :: BackupPlanInput
  }
  deriving (CreateBackupPlan -> CreateBackupPlan -> Bool
(CreateBackupPlan -> CreateBackupPlan -> Bool)
-> (CreateBackupPlan -> CreateBackupPlan -> Bool)
-> Eq CreateBackupPlan
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateBackupPlan -> CreateBackupPlan -> Bool
$c/= :: CreateBackupPlan -> CreateBackupPlan -> Bool
== :: CreateBackupPlan -> CreateBackupPlan -> Bool
$c== :: CreateBackupPlan -> CreateBackupPlan -> Bool
Prelude.Eq, Int -> CreateBackupPlan -> ShowS
[CreateBackupPlan] -> ShowS
CreateBackupPlan -> String
(Int -> CreateBackupPlan -> ShowS)
-> (CreateBackupPlan -> String)
-> ([CreateBackupPlan] -> ShowS)
-> Show CreateBackupPlan
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateBackupPlan] -> ShowS
$cshowList :: [CreateBackupPlan] -> ShowS
show :: CreateBackupPlan -> String
$cshow :: CreateBackupPlan -> String
showsPrec :: Int -> CreateBackupPlan -> ShowS
$cshowsPrec :: Int -> CreateBackupPlan -> ShowS
Prelude.Show, (forall x. CreateBackupPlan -> Rep CreateBackupPlan x)
-> (forall x. Rep CreateBackupPlan x -> CreateBackupPlan)
-> Generic CreateBackupPlan
forall x. Rep CreateBackupPlan x -> CreateBackupPlan
forall x. CreateBackupPlan -> Rep CreateBackupPlan x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateBackupPlan x -> CreateBackupPlan
$cfrom :: forall x. CreateBackupPlan -> Rep CreateBackupPlan x
Prelude.Generic)

-- |
-- Create a value of 'CreateBackupPlan' 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:
--
-- 'backupPlanTags', 'createBackupPlan_backupPlanTags' - To help organize your resources, you can assign your own metadata to the
-- resources that you create. Each tag is a key-value pair. The specified
-- tags are assigned to all backups created with this plan.
--
-- 'creatorRequestId', 'createBackupPlan_creatorRequestId' - Identifies the request and allows failed requests to be retried without
-- the risk of running the operation twice. If the request includes a
-- @CreatorRequestId@ that matches an existing backup plan, that plan is
-- returned. This parameter is optional.
--
-- 'backupPlan', 'createBackupPlan_backupPlan' - Specifies the body of a backup plan. Includes a @BackupPlanName@ and one
-- or more sets of @Rules@.
newCreateBackupPlan ::
  -- | 'backupPlan'
  BackupPlanInput ->
  CreateBackupPlan
newCreateBackupPlan :: BackupPlanInput -> CreateBackupPlan
newCreateBackupPlan BackupPlanInput
pBackupPlan_ =
  CreateBackupPlan' :: Maybe (Sensitive (HashMap Text Text))
-> Maybe Text -> BackupPlanInput -> CreateBackupPlan
CreateBackupPlan'
    { $sel:backupPlanTags:CreateBackupPlan' :: Maybe (Sensitive (HashMap Text Text))
backupPlanTags = Maybe (Sensitive (HashMap Text Text))
forall a. Maybe a
Prelude.Nothing,
      $sel:creatorRequestId:CreateBackupPlan' :: Maybe Text
creatorRequestId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:backupPlan:CreateBackupPlan' :: BackupPlanInput
backupPlan = BackupPlanInput
pBackupPlan_
    }

-- | To help organize your resources, you can assign your own metadata to the
-- resources that you create. Each tag is a key-value pair. The specified
-- tags are assigned to all backups created with this plan.
createBackupPlan_backupPlanTags :: Lens.Lens' CreateBackupPlan (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
createBackupPlan_backupPlanTags :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> CreateBackupPlan -> f CreateBackupPlan
createBackupPlan_backupPlanTags = (CreateBackupPlan -> Maybe (Sensitive (HashMap Text Text)))
-> (CreateBackupPlan
    -> Maybe (Sensitive (HashMap Text Text)) -> CreateBackupPlan)
-> Lens
     CreateBackupPlan
     CreateBackupPlan
     (Maybe (Sensitive (HashMap Text Text)))
     (Maybe (Sensitive (HashMap Text Text)))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateBackupPlan' {Maybe (Sensitive (HashMap Text Text))
backupPlanTags :: Maybe (Sensitive (HashMap Text Text))
$sel:backupPlanTags:CreateBackupPlan' :: CreateBackupPlan -> Maybe (Sensitive (HashMap Text Text))
backupPlanTags} -> Maybe (Sensitive (HashMap Text Text))
backupPlanTags) (\s :: CreateBackupPlan
s@CreateBackupPlan' {} Maybe (Sensitive (HashMap Text Text))
a -> CreateBackupPlan
s {$sel:backupPlanTags:CreateBackupPlan' :: Maybe (Sensitive (HashMap Text Text))
backupPlanTags = Maybe (Sensitive (HashMap Text Text))
a} :: CreateBackupPlan) ((Maybe (Sensitive (HashMap Text Text))
  -> f (Maybe (Sensitive (HashMap Text Text))))
 -> CreateBackupPlan -> f CreateBackupPlan)
-> ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
    -> Maybe (Sensitive (HashMap Text Text))
    -> f (Maybe (Sensitive (HashMap Text Text))))
-> (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> CreateBackupPlan
-> f CreateBackupPlan
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (Sensitive (HashMap Text Text))
  (Sensitive (HashMap Text Text))
  (HashMap Text Text)
  (HashMap Text Text)
-> Iso
     (Maybe (Sensitive (HashMap Text Text)))
     (Maybe (Sensitive (HashMap Text Text)))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
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
  (Sensitive (HashMap Text Text))
  (Sensitive (HashMap Text Text))
  (HashMap Text Text)
  (HashMap Text Text)
forall a. Iso' (Sensitive a) a
Core._Sensitive AnIso
  (Sensitive (HashMap Text Text))
  (Sensitive (HashMap Text Text))
  (HashMap Text Text)
  (HashMap Text Text)
-> (Exchange
      (HashMap Text Text)
      (HashMap Text Text)
      (HashMap Text Text)
      (Identity (HashMap Text Text))
    -> Exchange
         (HashMap Text Text)
         (HashMap Text Text)
         (HashMap Text Text)
         (Identity (HashMap Text Text)))
-> AnIso
     (Sensitive (HashMap Text Text))
     (Sensitive (HashMap Text Text))
     (HashMap Text Text)
     (HashMap Text Text)
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. Exchange
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (Identity (HashMap Text Text))
-> Exchange
     (HashMap Text Text)
     (HashMap Text Text)
     (HashMap Text Text)
     (Identity (HashMap Text Text))
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced)

-- | Identifies the request and allows failed requests to be retried without
-- the risk of running the operation twice. If the request includes a
-- @CreatorRequestId@ that matches an existing backup plan, that plan is
-- returned. This parameter is optional.
createBackupPlan_creatorRequestId :: Lens.Lens' CreateBackupPlan (Prelude.Maybe Prelude.Text)
createBackupPlan_creatorRequestId :: (Maybe Text -> f (Maybe Text))
-> CreateBackupPlan -> f CreateBackupPlan
createBackupPlan_creatorRequestId = (CreateBackupPlan -> Maybe Text)
-> (CreateBackupPlan -> Maybe Text -> CreateBackupPlan)
-> Lens CreateBackupPlan CreateBackupPlan (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateBackupPlan' {Maybe Text
creatorRequestId :: Maybe Text
$sel:creatorRequestId:CreateBackupPlan' :: CreateBackupPlan -> Maybe Text
creatorRequestId} -> Maybe Text
creatorRequestId) (\s :: CreateBackupPlan
s@CreateBackupPlan' {} Maybe Text
a -> CreateBackupPlan
s {$sel:creatorRequestId:CreateBackupPlan' :: Maybe Text
creatorRequestId = Maybe Text
a} :: CreateBackupPlan)

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

instance Core.AWSRequest CreateBackupPlan where
  type
    AWSResponse CreateBackupPlan =
      CreateBackupPlanResponse
  request :: CreateBackupPlan -> Request CreateBackupPlan
request = Service -> CreateBackupPlan -> Request CreateBackupPlan
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.putJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy CreateBackupPlan
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateBackupPlan)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse CreateBackupPlan))
-> Logger
-> Service
-> Proxy CreateBackupPlan
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateBackupPlan)))
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 POSIX
-> Int
-> CreateBackupPlanResponse
CreateBackupPlanResponse'
            (Maybe Text
 -> Maybe [AdvancedBackupSetting]
 -> Maybe Text
 -> Maybe Text
 -> Maybe POSIX
 -> Int
 -> CreateBackupPlanResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe [AdvancedBackupSetting]
      -> Maybe Text
      -> Maybe Text
      -> Maybe POSIX
      -> Int
      -> CreateBackupPlanResponse)
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 POSIX
   -> Int
   -> CreateBackupPlanResponse)
-> Either String (Maybe [AdvancedBackupSetting])
-> Either
     String
     (Maybe Text
      -> Maybe Text -> Maybe POSIX -> Int -> CreateBackupPlanResponse)
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 POSIX -> Int -> CreateBackupPlanResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe Text -> Maybe POSIX -> Int -> CreateBackupPlanResponse)
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 POSIX -> Int -> CreateBackupPlanResponse)
-> Either String (Maybe Text)
-> Either String (Maybe POSIX -> Int -> CreateBackupPlanResponse)
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 -> Int -> CreateBackupPlanResponse)
-> Either String (Maybe POSIX)
-> Either String (Int -> CreateBackupPlanResponse)
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 (Int -> CreateBackupPlanResponse)
-> Either String Int -> Either String CreateBackupPlanResponse
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 CreateBackupPlan

instance Prelude.NFData CreateBackupPlan

instance Core.ToHeaders CreateBackupPlan where
  toHeaders :: CreateBackupPlan -> ResponseHeaders
toHeaders =
    ResponseHeaders -> CreateBackupPlan -> 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.ToJSON CreateBackupPlan where
  toJSON :: CreateBackupPlan -> Value
toJSON CreateBackupPlan' {Maybe Text
Maybe (Sensitive (HashMap Text Text))
BackupPlanInput
backupPlan :: BackupPlanInput
creatorRequestId :: Maybe Text
backupPlanTags :: Maybe (Sensitive (HashMap Text Text))
$sel:backupPlan:CreateBackupPlan' :: CreateBackupPlan -> BackupPlanInput
$sel:creatorRequestId:CreateBackupPlan' :: CreateBackupPlan -> Maybe Text
$sel:backupPlanTags:CreateBackupPlan' :: CreateBackupPlan -> Maybe (Sensitive (HashMap Text Text))
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"BackupPlanTags" Text -> Sensitive (HashMap Text Text) -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Sensitive (HashMap Text Text) -> Pair)
-> Maybe (Sensitive (HashMap Text Text)) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (Sensitive (HashMap Text Text))
backupPlanTags,
            (Text
"CreatorRequestId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
creatorRequestId,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"BackupPlan" Text -> BackupPlanInput -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= BackupPlanInput
backupPlan)
          ]
      )

instance Core.ToPath CreateBackupPlan where
  toPath :: CreateBackupPlan -> ByteString
toPath = ByteString -> CreateBackupPlan -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/backup/plans/"

instance Core.ToQuery CreateBackupPlan where
  toQuery :: CreateBackupPlan -> QueryString
toQuery = QueryString -> CreateBackupPlan -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty

-- | /See:/ 'newCreateBackupPlanResponse' smart constructor.
data CreateBackupPlanResponse = CreateBackupPlanResponse'
  { -- | Unique, randomly generated, Unicode, UTF-8 encoded strings that are at
    -- most 1,024 bytes long. They cannot be edited.
    CreateBackupPlanResponse -> Maybe Text
versionId :: Prelude.Maybe Prelude.Text,
    -- | A list of @BackupOptions@ settings for a resource type. This option is
    -- only available for Windows Volume Shadow Copy Service (VSS) backup jobs.
    CreateBackupPlanResponse -> Maybe [AdvancedBackupSetting]
advancedBackupSettings :: Prelude.Maybe [AdvancedBackupSetting],
    -- | Uniquely identifies a backup plan.
    CreateBackupPlanResponse -> 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@.
    CreateBackupPlanResponse -> Maybe Text
backupPlanArn :: Prelude.Maybe Prelude.Text,
    -- | 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.
    CreateBackupPlanResponse -> Maybe POSIX
creationDate :: Prelude.Maybe Core.POSIX,
    -- | The response's http status code.
    CreateBackupPlanResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (CreateBackupPlanResponse -> CreateBackupPlanResponse -> Bool
(CreateBackupPlanResponse -> CreateBackupPlanResponse -> Bool)
-> (CreateBackupPlanResponse -> CreateBackupPlanResponse -> Bool)
-> Eq CreateBackupPlanResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateBackupPlanResponse -> CreateBackupPlanResponse -> Bool
$c/= :: CreateBackupPlanResponse -> CreateBackupPlanResponse -> Bool
== :: CreateBackupPlanResponse -> CreateBackupPlanResponse -> Bool
$c== :: CreateBackupPlanResponse -> CreateBackupPlanResponse -> Bool
Prelude.Eq, ReadPrec [CreateBackupPlanResponse]
ReadPrec CreateBackupPlanResponse
Int -> ReadS CreateBackupPlanResponse
ReadS [CreateBackupPlanResponse]
(Int -> ReadS CreateBackupPlanResponse)
-> ReadS [CreateBackupPlanResponse]
-> ReadPrec CreateBackupPlanResponse
-> ReadPrec [CreateBackupPlanResponse]
-> Read CreateBackupPlanResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateBackupPlanResponse]
$creadListPrec :: ReadPrec [CreateBackupPlanResponse]
readPrec :: ReadPrec CreateBackupPlanResponse
$creadPrec :: ReadPrec CreateBackupPlanResponse
readList :: ReadS [CreateBackupPlanResponse]
$creadList :: ReadS [CreateBackupPlanResponse]
readsPrec :: Int -> ReadS CreateBackupPlanResponse
$creadsPrec :: Int -> ReadS CreateBackupPlanResponse
Prelude.Read, Int -> CreateBackupPlanResponse -> ShowS
[CreateBackupPlanResponse] -> ShowS
CreateBackupPlanResponse -> String
(Int -> CreateBackupPlanResponse -> ShowS)
-> (CreateBackupPlanResponse -> String)
-> ([CreateBackupPlanResponse] -> ShowS)
-> Show CreateBackupPlanResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateBackupPlanResponse] -> ShowS
$cshowList :: [CreateBackupPlanResponse] -> ShowS
show :: CreateBackupPlanResponse -> String
$cshow :: CreateBackupPlanResponse -> String
showsPrec :: Int -> CreateBackupPlanResponse -> ShowS
$cshowsPrec :: Int -> CreateBackupPlanResponse -> ShowS
Prelude.Show, (forall x.
 CreateBackupPlanResponse -> Rep CreateBackupPlanResponse x)
-> (forall x.
    Rep CreateBackupPlanResponse x -> CreateBackupPlanResponse)
-> Generic CreateBackupPlanResponse
forall x.
Rep CreateBackupPlanResponse x -> CreateBackupPlanResponse
forall x.
CreateBackupPlanResponse -> Rep CreateBackupPlanResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateBackupPlanResponse x -> CreateBackupPlanResponse
$cfrom :: forall x.
CreateBackupPlanResponse -> Rep CreateBackupPlanResponse x
Prelude.Generic)

-- |
-- Create a value of 'CreateBackupPlanResponse' 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', 'createBackupPlanResponse_versionId' - Unique, randomly generated, Unicode, UTF-8 encoded strings that are at
-- most 1,024 bytes long. They cannot be edited.
--
-- 'advancedBackupSettings', 'createBackupPlanResponse_advancedBackupSettings' - A list of @BackupOptions@ settings for a resource type. This option is
-- only available for Windows Volume Shadow Copy Service (VSS) backup jobs.
--
-- 'backupPlanId', 'createBackupPlanResponse_backupPlanId' - Uniquely identifies a backup plan.
--
-- 'backupPlanArn', 'createBackupPlanResponse_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@.
--
-- 'creationDate', 'createBackupPlanResponse_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.
--
-- 'httpStatus', 'createBackupPlanResponse_httpStatus' - The response's http status code.
newCreateBackupPlanResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  CreateBackupPlanResponse
newCreateBackupPlanResponse :: Int -> CreateBackupPlanResponse
newCreateBackupPlanResponse Int
pHttpStatus_ =
  CreateBackupPlanResponse' :: Maybe Text
-> Maybe [AdvancedBackupSetting]
-> Maybe Text
-> Maybe Text
-> Maybe POSIX
-> Int
-> CreateBackupPlanResponse
CreateBackupPlanResponse'
    { $sel:versionId:CreateBackupPlanResponse' :: Maybe Text
versionId =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:advancedBackupSettings:CreateBackupPlanResponse' :: Maybe [AdvancedBackupSetting]
advancedBackupSettings = Maybe [AdvancedBackupSetting]
forall a. Maybe a
Prelude.Nothing,
      $sel:backupPlanId:CreateBackupPlanResponse' :: Maybe Text
backupPlanId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:backupPlanArn:CreateBackupPlanResponse' :: Maybe Text
backupPlanArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:creationDate:CreateBackupPlanResponse' :: Maybe POSIX
creationDate = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:CreateBackupPlanResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

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

-- | A list of @BackupOptions@ settings for a resource type. This option is
-- only available for Windows Volume Shadow Copy Service (VSS) backup jobs.
createBackupPlanResponse_advancedBackupSettings :: Lens.Lens' CreateBackupPlanResponse (Prelude.Maybe [AdvancedBackupSetting])
createBackupPlanResponse_advancedBackupSettings :: (Maybe [AdvancedBackupSetting]
 -> f (Maybe [AdvancedBackupSetting]))
-> CreateBackupPlanResponse -> f CreateBackupPlanResponse
createBackupPlanResponse_advancedBackupSettings = (CreateBackupPlanResponse -> Maybe [AdvancedBackupSetting])
-> (CreateBackupPlanResponse
    -> Maybe [AdvancedBackupSetting] -> CreateBackupPlanResponse)
-> Lens
     CreateBackupPlanResponse
     CreateBackupPlanResponse
     (Maybe [AdvancedBackupSetting])
     (Maybe [AdvancedBackupSetting])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateBackupPlanResponse' {Maybe [AdvancedBackupSetting]
advancedBackupSettings :: Maybe [AdvancedBackupSetting]
$sel:advancedBackupSettings:CreateBackupPlanResponse' :: CreateBackupPlanResponse -> Maybe [AdvancedBackupSetting]
advancedBackupSettings} -> Maybe [AdvancedBackupSetting]
advancedBackupSettings) (\s :: CreateBackupPlanResponse
s@CreateBackupPlanResponse' {} Maybe [AdvancedBackupSetting]
a -> CreateBackupPlanResponse
s {$sel:advancedBackupSettings:CreateBackupPlanResponse' :: Maybe [AdvancedBackupSetting]
advancedBackupSettings = Maybe [AdvancedBackupSetting]
a} :: CreateBackupPlanResponse) ((Maybe [AdvancedBackupSetting]
  -> f (Maybe [AdvancedBackupSetting]))
 -> CreateBackupPlanResponse -> f CreateBackupPlanResponse)
-> ((Maybe [AdvancedBackupSetting]
     -> f (Maybe [AdvancedBackupSetting]))
    -> Maybe [AdvancedBackupSetting]
    -> f (Maybe [AdvancedBackupSetting]))
-> (Maybe [AdvancedBackupSetting]
    -> f (Maybe [AdvancedBackupSetting]))
-> CreateBackupPlanResponse
-> f CreateBackupPlanResponse
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.
createBackupPlanResponse_backupPlanId :: Lens.Lens' CreateBackupPlanResponse (Prelude.Maybe Prelude.Text)
createBackupPlanResponse_backupPlanId :: (Maybe Text -> f (Maybe Text))
-> CreateBackupPlanResponse -> f CreateBackupPlanResponse
createBackupPlanResponse_backupPlanId = (CreateBackupPlanResponse -> Maybe Text)
-> (CreateBackupPlanResponse
    -> Maybe Text -> CreateBackupPlanResponse)
-> Lens
     CreateBackupPlanResponse
     CreateBackupPlanResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateBackupPlanResponse' {Maybe Text
backupPlanId :: Maybe Text
$sel:backupPlanId:CreateBackupPlanResponse' :: CreateBackupPlanResponse -> Maybe Text
backupPlanId} -> Maybe Text
backupPlanId) (\s :: CreateBackupPlanResponse
s@CreateBackupPlanResponse' {} Maybe Text
a -> CreateBackupPlanResponse
s {$sel:backupPlanId:CreateBackupPlanResponse' :: Maybe Text
backupPlanId = Maybe Text
a} :: CreateBackupPlanResponse)

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

-- | 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.
createBackupPlanResponse_creationDate :: Lens.Lens' CreateBackupPlanResponse (Prelude.Maybe Prelude.UTCTime)
createBackupPlanResponse_creationDate :: (Maybe UTCTime -> f (Maybe UTCTime))
-> CreateBackupPlanResponse -> f CreateBackupPlanResponse
createBackupPlanResponse_creationDate = (CreateBackupPlanResponse -> Maybe POSIX)
-> (CreateBackupPlanResponse
    -> Maybe POSIX -> CreateBackupPlanResponse)
-> Lens
     CreateBackupPlanResponse
     CreateBackupPlanResponse
     (Maybe POSIX)
     (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateBackupPlanResponse' {Maybe POSIX
creationDate :: Maybe POSIX
$sel:creationDate:CreateBackupPlanResponse' :: CreateBackupPlanResponse -> Maybe POSIX
creationDate} -> Maybe POSIX
creationDate) (\s :: CreateBackupPlanResponse
s@CreateBackupPlanResponse' {} Maybe POSIX
a -> CreateBackupPlanResponse
s {$sel:creationDate:CreateBackupPlanResponse' :: Maybe POSIX
creationDate = Maybe POSIX
a} :: CreateBackupPlanResponse) ((Maybe POSIX -> f (Maybe POSIX))
 -> CreateBackupPlanResponse -> f CreateBackupPlanResponse)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> CreateBackupPlanResponse
-> f CreateBackupPlanResponse
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.
createBackupPlanResponse_httpStatus :: Lens.Lens' CreateBackupPlanResponse Prelude.Int
createBackupPlanResponse_httpStatus :: (Int -> f Int)
-> CreateBackupPlanResponse -> f CreateBackupPlanResponse
createBackupPlanResponse_httpStatus = (CreateBackupPlanResponse -> Int)
-> (CreateBackupPlanResponse -> Int -> CreateBackupPlanResponse)
-> Lens CreateBackupPlanResponse CreateBackupPlanResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateBackupPlanResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateBackupPlanResponse' :: CreateBackupPlanResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateBackupPlanResponse
s@CreateBackupPlanResponse' {} Int
a -> CreateBackupPlanResponse
s {$sel:httpStatus:CreateBackupPlanResponse' :: Int
httpStatus = Int
a} :: CreateBackupPlanResponse)

instance Prelude.NFData CreateBackupPlanResponse