{-# 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.CreateBackupSelection
-- 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 JSON document that specifies a set of resources to assign to a
-- backup plan. Resources can be included by specifying patterns for a
-- @ListOfTags@ and selected @Resources@.
--
-- For example, consider the following patterns:
--
-- -   @Resources: \"arn:aws:ec2:region:account-id:volume\/volume-id\"@
--
-- -   @ConditionKey:\"department\"@
--
--     @ConditionValue:\"finance\"@
--
--     @ConditionType:\"StringEquals\"@
--
-- -   @ConditionKey:\"importance\"@
--
--     @ConditionValue:\"critical\"@
--
--     @ConditionType:\"StringEquals\"@
--
-- Using these patterns would back up all Amazon Elastic Block Store
-- (Amazon EBS) volumes that are tagged as @\"department=finance\"@,
-- @\"importance=critical\"@, in addition to an EBS volume with the
-- specified volume ID.
--
-- Resources and conditions are additive in that all resources that match
-- the pattern are selected. This shouldn\'t be confused with a logical
-- AND, where all conditions must match. The matching patterns are
-- logically put together using the OR operator. In other words, all
-- patterns that match are selected for backup.
module Amazonka.Backup.CreateBackupSelection
  ( -- * Creating a Request
    CreateBackupSelection (..),
    newCreateBackupSelection,

    -- * Request Lenses
    createBackupSelection_creatorRequestId,
    createBackupSelection_backupPlanId,
    createBackupSelection_backupSelection,

    -- * Destructuring the Response
    CreateBackupSelectionResponse (..),
    newCreateBackupSelectionResponse,

    -- * Response Lenses
    createBackupSelectionResponse_selectionId,
    createBackupSelectionResponse_backupPlanId,
    createBackupSelectionResponse_creationDate,
    createBackupSelectionResponse_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:/ 'newCreateBackupSelection' smart constructor.
data CreateBackupSelection = CreateBackupSelection'
  { -- | A unique string that identifies the request and allows failed requests
    -- to be retried without the risk of running the operation twice.
    CreateBackupSelection -> Maybe Text
creatorRequestId :: Prelude.Maybe Prelude.Text,
    -- | Uniquely identifies the backup plan to be associated with the selection
    -- of resources.
    CreateBackupSelection -> Text
backupPlanId :: Prelude.Text,
    -- | Specifies the body of a request to assign a set of resources to a backup
    -- plan.
    CreateBackupSelection -> BackupSelection
backupSelection :: BackupSelection
  }
  deriving (CreateBackupSelection -> CreateBackupSelection -> Bool
(CreateBackupSelection -> CreateBackupSelection -> Bool)
-> (CreateBackupSelection -> CreateBackupSelection -> Bool)
-> Eq CreateBackupSelection
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateBackupSelection -> CreateBackupSelection -> Bool
$c/= :: CreateBackupSelection -> CreateBackupSelection -> Bool
== :: CreateBackupSelection -> CreateBackupSelection -> Bool
$c== :: CreateBackupSelection -> CreateBackupSelection -> Bool
Prelude.Eq, ReadPrec [CreateBackupSelection]
ReadPrec CreateBackupSelection
Int -> ReadS CreateBackupSelection
ReadS [CreateBackupSelection]
(Int -> ReadS CreateBackupSelection)
-> ReadS [CreateBackupSelection]
-> ReadPrec CreateBackupSelection
-> ReadPrec [CreateBackupSelection]
-> Read CreateBackupSelection
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateBackupSelection]
$creadListPrec :: ReadPrec [CreateBackupSelection]
readPrec :: ReadPrec CreateBackupSelection
$creadPrec :: ReadPrec CreateBackupSelection
readList :: ReadS [CreateBackupSelection]
$creadList :: ReadS [CreateBackupSelection]
readsPrec :: Int -> ReadS CreateBackupSelection
$creadsPrec :: Int -> ReadS CreateBackupSelection
Prelude.Read, Int -> CreateBackupSelection -> ShowS
[CreateBackupSelection] -> ShowS
CreateBackupSelection -> String
(Int -> CreateBackupSelection -> ShowS)
-> (CreateBackupSelection -> String)
-> ([CreateBackupSelection] -> ShowS)
-> Show CreateBackupSelection
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateBackupSelection] -> ShowS
$cshowList :: [CreateBackupSelection] -> ShowS
show :: CreateBackupSelection -> String
$cshow :: CreateBackupSelection -> String
showsPrec :: Int -> CreateBackupSelection -> ShowS
$cshowsPrec :: Int -> CreateBackupSelection -> ShowS
Prelude.Show, (forall x. CreateBackupSelection -> Rep CreateBackupSelection x)
-> (forall x. Rep CreateBackupSelection x -> CreateBackupSelection)
-> Generic CreateBackupSelection
forall x. Rep CreateBackupSelection x -> CreateBackupSelection
forall x. CreateBackupSelection -> Rep CreateBackupSelection x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateBackupSelection x -> CreateBackupSelection
$cfrom :: forall x. CreateBackupSelection -> Rep CreateBackupSelection x
Prelude.Generic)

-- |
-- Create a value of 'CreateBackupSelection' 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:
--
-- 'creatorRequestId', 'createBackupSelection_creatorRequestId' - A unique string that identifies the request and allows failed requests
-- to be retried without the risk of running the operation twice.
--
-- 'backupPlanId', 'createBackupSelection_backupPlanId' - Uniquely identifies the backup plan to be associated with the selection
-- of resources.
--
-- 'backupSelection', 'createBackupSelection_backupSelection' - Specifies the body of a request to assign a set of resources to a backup
-- plan.
newCreateBackupSelection ::
  -- | 'backupPlanId'
  Prelude.Text ->
  -- | 'backupSelection'
  BackupSelection ->
  CreateBackupSelection
newCreateBackupSelection :: Text -> BackupSelection -> CreateBackupSelection
newCreateBackupSelection
  Text
pBackupPlanId_
  BackupSelection
pBackupSelection_ =
    CreateBackupSelection' :: Maybe Text -> Text -> BackupSelection -> CreateBackupSelection
CreateBackupSelection'
      { $sel:creatorRequestId:CreateBackupSelection' :: Maybe Text
creatorRequestId =
          Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:backupPlanId:CreateBackupSelection' :: Text
backupPlanId = Text
pBackupPlanId_,
        $sel:backupSelection:CreateBackupSelection' :: BackupSelection
backupSelection = BackupSelection
pBackupSelection_
      }

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

-- | Uniquely identifies the backup plan to be associated with the selection
-- of resources.
createBackupSelection_backupPlanId :: Lens.Lens' CreateBackupSelection Prelude.Text
createBackupSelection_backupPlanId :: (Text -> f Text)
-> CreateBackupSelection -> f CreateBackupSelection
createBackupSelection_backupPlanId = (CreateBackupSelection -> Text)
-> (CreateBackupSelection -> Text -> CreateBackupSelection)
-> Lens CreateBackupSelection CreateBackupSelection Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateBackupSelection' {Text
backupPlanId :: Text
$sel:backupPlanId:CreateBackupSelection' :: CreateBackupSelection -> Text
backupPlanId} -> Text
backupPlanId) (\s :: CreateBackupSelection
s@CreateBackupSelection' {} Text
a -> CreateBackupSelection
s {$sel:backupPlanId:CreateBackupSelection' :: Text
backupPlanId = Text
a} :: CreateBackupSelection)

-- | Specifies the body of a request to assign a set of resources to a backup
-- plan.
createBackupSelection_backupSelection :: Lens.Lens' CreateBackupSelection BackupSelection
createBackupSelection_backupSelection :: (BackupSelection -> f BackupSelection)
-> CreateBackupSelection -> f CreateBackupSelection
createBackupSelection_backupSelection = (CreateBackupSelection -> BackupSelection)
-> (CreateBackupSelection
    -> BackupSelection -> CreateBackupSelection)
-> Lens
     CreateBackupSelection
     CreateBackupSelection
     BackupSelection
     BackupSelection
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateBackupSelection' {BackupSelection
backupSelection :: BackupSelection
$sel:backupSelection:CreateBackupSelection' :: CreateBackupSelection -> BackupSelection
backupSelection} -> BackupSelection
backupSelection) (\s :: CreateBackupSelection
s@CreateBackupSelection' {} BackupSelection
a -> CreateBackupSelection
s {$sel:backupSelection:CreateBackupSelection' :: BackupSelection
backupSelection = BackupSelection
a} :: CreateBackupSelection)

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

instance Prelude.NFData CreateBackupSelection

instance Core.ToHeaders CreateBackupSelection where
  toHeaders :: CreateBackupSelection -> ResponseHeaders
toHeaders =
    ResponseHeaders -> CreateBackupSelection -> 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 CreateBackupSelection where
  toJSON :: CreateBackupSelection -> Value
toJSON CreateBackupSelection' {Maybe Text
Text
BackupSelection
backupSelection :: BackupSelection
backupPlanId :: Text
creatorRequestId :: Maybe Text
$sel:backupSelection:CreateBackupSelection' :: CreateBackupSelection -> BackupSelection
$sel:backupPlanId:CreateBackupSelection' :: CreateBackupSelection -> Text
$sel:creatorRequestId:CreateBackupSelection' :: CreateBackupSelection -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (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
"BackupSelection" Text -> BackupSelection -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= BackupSelection
backupSelection)
          ]
      )

instance Core.ToPath CreateBackupSelection where
  toPath :: CreateBackupSelection -> ByteString
toPath CreateBackupSelection' {Maybe Text
Text
BackupSelection
backupSelection :: BackupSelection
backupPlanId :: Text
creatorRequestId :: Maybe Text
$sel:backupSelection:CreateBackupSelection' :: CreateBackupSelection -> BackupSelection
$sel:backupPlanId:CreateBackupSelection' :: CreateBackupSelection -> Text
$sel:creatorRequestId:CreateBackupSelection' :: CreateBackupSelection -> 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
"/selections/"
      ]

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

-- | /See:/ 'newCreateBackupSelectionResponse' smart constructor.
data CreateBackupSelectionResponse = CreateBackupSelectionResponse'
  { -- | Uniquely identifies the body of a request to assign a set of resources
    -- to a backup plan.
    CreateBackupSelectionResponse -> Maybe Text
selectionId :: Prelude.Maybe Prelude.Text,
    -- | Uniquely identifies a backup plan.
    CreateBackupSelectionResponse -> Maybe Text
backupPlanId :: Prelude.Maybe Prelude.Text,
    -- | The date and time a backup selection 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.
    CreateBackupSelectionResponse -> Maybe POSIX
creationDate :: Prelude.Maybe Core.POSIX,
    -- | The response's http status code.
    CreateBackupSelectionResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (CreateBackupSelectionResponse
-> CreateBackupSelectionResponse -> Bool
(CreateBackupSelectionResponse
 -> CreateBackupSelectionResponse -> Bool)
-> (CreateBackupSelectionResponse
    -> CreateBackupSelectionResponse -> Bool)
-> Eq CreateBackupSelectionResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateBackupSelectionResponse
-> CreateBackupSelectionResponse -> Bool
$c/= :: CreateBackupSelectionResponse
-> CreateBackupSelectionResponse -> Bool
== :: CreateBackupSelectionResponse
-> CreateBackupSelectionResponse -> Bool
$c== :: CreateBackupSelectionResponse
-> CreateBackupSelectionResponse -> Bool
Prelude.Eq, ReadPrec [CreateBackupSelectionResponse]
ReadPrec CreateBackupSelectionResponse
Int -> ReadS CreateBackupSelectionResponse
ReadS [CreateBackupSelectionResponse]
(Int -> ReadS CreateBackupSelectionResponse)
-> ReadS [CreateBackupSelectionResponse]
-> ReadPrec CreateBackupSelectionResponse
-> ReadPrec [CreateBackupSelectionResponse]
-> Read CreateBackupSelectionResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateBackupSelectionResponse]
$creadListPrec :: ReadPrec [CreateBackupSelectionResponse]
readPrec :: ReadPrec CreateBackupSelectionResponse
$creadPrec :: ReadPrec CreateBackupSelectionResponse
readList :: ReadS [CreateBackupSelectionResponse]
$creadList :: ReadS [CreateBackupSelectionResponse]
readsPrec :: Int -> ReadS CreateBackupSelectionResponse
$creadsPrec :: Int -> ReadS CreateBackupSelectionResponse
Prelude.Read, Int -> CreateBackupSelectionResponse -> ShowS
[CreateBackupSelectionResponse] -> ShowS
CreateBackupSelectionResponse -> String
(Int -> CreateBackupSelectionResponse -> ShowS)
-> (CreateBackupSelectionResponse -> String)
-> ([CreateBackupSelectionResponse] -> ShowS)
-> Show CreateBackupSelectionResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateBackupSelectionResponse] -> ShowS
$cshowList :: [CreateBackupSelectionResponse] -> ShowS
show :: CreateBackupSelectionResponse -> String
$cshow :: CreateBackupSelectionResponse -> String
showsPrec :: Int -> CreateBackupSelectionResponse -> ShowS
$cshowsPrec :: Int -> CreateBackupSelectionResponse -> ShowS
Prelude.Show, (forall x.
 CreateBackupSelectionResponse
 -> Rep CreateBackupSelectionResponse x)
-> (forall x.
    Rep CreateBackupSelectionResponse x
    -> CreateBackupSelectionResponse)
-> Generic CreateBackupSelectionResponse
forall x.
Rep CreateBackupSelectionResponse x
-> CreateBackupSelectionResponse
forall x.
CreateBackupSelectionResponse
-> Rep CreateBackupSelectionResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateBackupSelectionResponse x
-> CreateBackupSelectionResponse
$cfrom :: forall x.
CreateBackupSelectionResponse
-> Rep CreateBackupSelectionResponse x
Prelude.Generic)

-- |
-- Create a value of 'CreateBackupSelectionResponse' 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:
--
-- 'selectionId', 'createBackupSelectionResponse_selectionId' - Uniquely identifies the body of a request to assign a set of resources
-- to a backup plan.
--
-- 'backupPlanId', 'createBackupSelectionResponse_backupPlanId' - Uniquely identifies a backup plan.
--
-- 'creationDate', 'createBackupSelectionResponse_creationDate' - The date and time a backup selection 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', 'createBackupSelectionResponse_httpStatus' - The response's http status code.
newCreateBackupSelectionResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  CreateBackupSelectionResponse
newCreateBackupSelectionResponse :: Int -> CreateBackupSelectionResponse
newCreateBackupSelectionResponse Int
pHttpStatus_ =
  CreateBackupSelectionResponse' :: Maybe Text
-> Maybe Text
-> Maybe POSIX
-> Int
-> CreateBackupSelectionResponse
CreateBackupSelectionResponse'
    { $sel:selectionId:CreateBackupSelectionResponse' :: Maybe Text
selectionId =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:backupPlanId:CreateBackupSelectionResponse' :: Maybe Text
backupPlanId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:creationDate:CreateBackupSelectionResponse' :: Maybe POSIX
creationDate = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:CreateBackupSelectionResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | Uniquely identifies the body of a request to assign a set of resources
-- to a backup plan.
createBackupSelectionResponse_selectionId :: Lens.Lens' CreateBackupSelectionResponse (Prelude.Maybe Prelude.Text)
createBackupSelectionResponse_selectionId :: (Maybe Text -> f (Maybe Text))
-> CreateBackupSelectionResponse -> f CreateBackupSelectionResponse
createBackupSelectionResponse_selectionId = (CreateBackupSelectionResponse -> Maybe Text)
-> (CreateBackupSelectionResponse
    -> Maybe Text -> CreateBackupSelectionResponse)
-> Lens
     CreateBackupSelectionResponse
     CreateBackupSelectionResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateBackupSelectionResponse' {Maybe Text
selectionId :: Maybe Text
$sel:selectionId:CreateBackupSelectionResponse' :: CreateBackupSelectionResponse -> Maybe Text
selectionId} -> Maybe Text
selectionId) (\s :: CreateBackupSelectionResponse
s@CreateBackupSelectionResponse' {} Maybe Text
a -> CreateBackupSelectionResponse
s {$sel:selectionId:CreateBackupSelectionResponse' :: Maybe Text
selectionId = Maybe Text
a} :: CreateBackupSelectionResponse)

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

-- | The date and time a backup selection 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.
createBackupSelectionResponse_creationDate :: Lens.Lens' CreateBackupSelectionResponse (Prelude.Maybe Prelude.UTCTime)
createBackupSelectionResponse_creationDate :: (Maybe UTCTime -> f (Maybe UTCTime))
-> CreateBackupSelectionResponse -> f CreateBackupSelectionResponse
createBackupSelectionResponse_creationDate = (CreateBackupSelectionResponse -> Maybe POSIX)
-> (CreateBackupSelectionResponse
    -> Maybe POSIX -> CreateBackupSelectionResponse)
-> Lens
     CreateBackupSelectionResponse
     CreateBackupSelectionResponse
     (Maybe POSIX)
     (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateBackupSelectionResponse' {Maybe POSIX
creationDate :: Maybe POSIX
$sel:creationDate:CreateBackupSelectionResponse' :: CreateBackupSelectionResponse -> Maybe POSIX
creationDate} -> Maybe POSIX
creationDate) (\s :: CreateBackupSelectionResponse
s@CreateBackupSelectionResponse' {} Maybe POSIX
a -> CreateBackupSelectionResponse
s {$sel:creationDate:CreateBackupSelectionResponse' :: Maybe POSIX
creationDate = Maybe POSIX
a} :: CreateBackupSelectionResponse) ((Maybe POSIX -> f (Maybe POSIX))
 -> CreateBackupSelectionResponse
 -> f CreateBackupSelectionResponse)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> CreateBackupSelectionResponse
-> f CreateBackupSelectionResponse
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.
createBackupSelectionResponse_httpStatus :: Lens.Lens' CreateBackupSelectionResponse Prelude.Int
createBackupSelectionResponse_httpStatus :: (Int -> f Int)
-> CreateBackupSelectionResponse -> f CreateBackupSelectionResponse
createBackupSelectionResponse_httpStatus = (CreateBackupSelectionResponse -> Int)
-> (CreateBackupSelectionResponse
    -> Int -> CreateBackupSelectionResponse)
-> Lens
     CreateBackupSelectionResponse CreateBackupSelectionResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateBackupSelectionResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateBackupSelectionResponse' :: CreateBackupSelectionResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateBackupSelectionResponse
s@CreateBackupSelectionResponse' {} Int
a -> CreateBackupSelectionResponse
s {$sel:httpStatus:CreateBackupSelectionResponse' :: Int
httpStatus = Int
a} :: CreateBackupSelectionResponse)

instance Prelude.NFData CreateBackupSelectionResponse