{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.FSx.Types.CreateOpenZFSOriginSnapshotConfiguration
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.FSx.Types.CreateOpenZFSOriginSnapshotConfiguration where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.FSx.Types.OpenZFSCopyStrategy
import qualified Amazonka.Prelude as Prelude

-- | The snapshot configuration to use when creating an OpenZFS volume from a
-- snapshot.
--
-- /See:/ 'newCreateOpenZFSOriginSnapshotConfiguration' smart constructor.
data CreateOpenZFSOriginSnapshotConfiguration = CreateOpenZFSOriginSnapshotConfiguration'
  { CreateOpenZFSOriginSnapshotConfiguration -> Text
snapshotARN :: Prelude.Text,
    -- | The strategy used when copying data from the snapshot to the new volume.
    --
    -- -   @CLONE@ - The new volume references the data in the origin snapshot.
    --     Cloning a snapshot is faster than copying data from the snapshot to
    --     a new volume and doesn\'t consume disk throughput. However, the
    --     origin snapshot can\'t be deleted if there is a volume using its
    --     copied data.
    --
    -- -   @FULL_COPY@ - Copies all data from the snapshot to the new volume.
    CreateOpenZFSOriginSnapshotConfiguration -> OpenZFSCopyStrategy
copyStrategy :: OpenZFSCopyStrategy
  }
  deriving (CreateOpenZFSOriginSnapshotConfiguration
-> CreateOpenZFSOriginSnapshotConfiguration -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateOpenZFSOriginSnapshotConfiguration
-> CreateOpenZFSOriginSnapshotConfiguration -> Bool
$c/= :: CreateOpenZFSOriginSnapshotConfiguration
-> CreateOpenZFSOriginSnapshotConfiguration -> Bool
== :: CreateOpenZFSOriginSnapshotConfiguration
-> CreateOpenZFSOriginSnapshotConfiguration -> Bool
$c== :: CreateOpenZFSOriginSnapshotConfiguration
-> CreateOpenZFSOriginSnapshotConfiguration -> Bool
Prelude.Eq, ReadPrec [CreateOpenZFSOriginSnapshotConfiguration]
ReadPrec CreateOpenZFSOriginSnapshotConfiguration
Int -> ReadS CreateOpenZFSOriginSnapshotConfiguration
ReadS [CreateOpenZFSOriginSnapshotConfiguration]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateOpenZFSOriginSnapshotConfiguration]
$creadListPrec :: ReadPrec [CreateOpenZFSOriginSnapshotConfiguration]
readPrec :: ReadPrec CreateOpenZFSOriginSnapshotConfiguration
$creadPrec :: ReadPrec CreateOpenZFSOriginSnapshotConfiguration
readList :: ReadS [CreateOpenZFSOriginSnapshotConfiguration]
$creadList :: ReadS [CreateOpenZFSOriginSnapshotConfiguration]
readsPrec :: Int -> ReadS CreateOpenZFSOriginSnapshotConfiguration
$creadsPrec :: Int -> ReadS CreateOpenZFSOriginSnapshotConfiguration
Prelude.Read, Int -> CreateOpenZFSOriginSnapshotConfiguration -> ShowS
[CreateOpenZFSOriginSnapshotConfiguration] -> ShowS
CreateOpenZFSOriginSnapshotConfiguration -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateOpenZFSOriginSnapshotConfiguration] -> ShowS
$cshowList :: [CreateOpenZFSOriginSnapshotConfiguration] -> ShowS
show :: CreateOpenZFSOriginSnapshotConfiguration -> String
$cshow :: CreateOpenZFSOriginSnapshotConfiguration -> String
showsPrec :: Int -> CreateOpenZFSOriginSnapshotConfiguration -> ShowS
$cshowsPrec :: Int -> CreateOpenZFSOriginSnapshotConfiguration -> ShowS
Prelude.Show, forall x.
Rep CreateOpenZFSOriginSnapshotConfiguration x
-> CreateOpenZFSOriginSnapshotConfiguration
forall x.
CreateOpenZFSOriginSnapshotConfiguration
-> Rep CreateOpenZFSOriginSnapshotConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateOpenZFSOriginSnapshotConfiguration x
-> CreateOpenZFSOriginSnapshotConfiguration
$cfrom :: forall x.
CreateOpenZFSOriginSnapshotConfiguration
-> Rep CreateOpenZFSOriginSnapshotConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'CreateOpenZFSOriginSnapshotConfiguration' 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:
--
-- 'snapshotARN', 'createOpenZFSOriginSnapshotConfiguration_snapshotARN' - Undocumented member.
--
-- 'copyStrategy', 'createOpenZFSOriginSnapshotConfiguration_copyStrategy' - The strategy used when copying data from the snapshot to the new volume.
--
-- -   @CLONE@ - The new volume references the data in the origin snapshot.
--     Cloning a snapshot is faster than copying data from the snapshot to
--     a new volume and doesn\'t consume disk throughput. However, the
--     origin snapshot can\'t be deleted if there is a volume using its
--     copied data.
--
-- -   @FULL_COPY@ - Copies all data from the snapshot to the new volume.
newCreateOpenZFSOriginSnapshotConfiguration ::
  -- | 'snapshotARN'
  Prelude.Text ->
  -- | 'copyStrategy'
  OpenZFSCopyStrategy ->
  CreateOpenZFSOriginSnapshotConfiguration
newCreateOpenZFSOriginSnapshotConfiguration :: Text
-> OpenZFSCopyStrategy -> CreateOpenZFSOriginSnapshotConfiguration
newCreateOpenZFSOriginSnapshotConfiguration
  Text
pSnapshotARN_
  OpenZFSCopyStrategy
pCopyStrategy_ =
    CreateOpenZFSOriginSnapshotConfiguration'
      { $sel:snapshotARN:CreateOpenZFSOriginSnapshotConfiguration' :: Text
snapshotARN =
          Text
pSnapshotARN_,
        $sel:copyStrategy:CreateOpenZFSOriginSnapshotConfiguration' :: OpenZFSCopyStrategy
copyStrategy = OpenZFSCopyStrategy
pCopyStrategy_
      }

-- | Undocumented member.
createOpenZFSOriginSnapshotConfiguration_snapshotARN :: Lens.Lens' CreateOpenZFSOriginSnapshotConfiguration Prelude.Text
createOpenZFSOriginSnapshotConfiguration_snapshotARN :: Lens' CreateOpenZFSOriginSnapshotConfiguration Text
createOpenZFSOriginSnapshotConfiguration_snapshotARN = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateOpenZFSOriginSnapshotConfiguration' {Text
snapshotARN :: Text
$sel:snapshotARN:CreateOpenZFSOriginSnapshotConfiguration' :: CreateOpenZFSOriginSnapshotConfiguration -> Text
snapshotARN} -> Text
snapshotARN) (\s :: CreateOpenZFSOriginSnapshotConfiguration
s@CreateOpenZFSOriginSnapshotConfiguration' {} Text
a -> CreateOpenZFSOriginSnapshotConfiguration
s {$sel:snapshotARN:CreateOpenZFSOriginSnapshotConfiguration' :: Text
snapshotARN = Text
a} :: CreateOpenZFSOriginSnapshotConfiguration)

-- | The strategy used when copying data from the snapshot to the new volume.
--
-- -   @CLONE@ - The new volume references the data in the origin snapshot.
--     Cloning a snapshot is faster than copying data from the snapshot to
--     a new volume and doesn\'t consume disk throughput. However, the
--     origin snapshot can\'t be deleted if there is a volume using its
--     copied data.
--
-- -   @FULL_COPY@ - Copies all data from the snapshot to the new volume.
createOpenZFSOriginSnapshotConfiguration_copyStrategy :: Lens.Lens' CreateOpenZFSOriginSnapshotConfiguration OpenZFSCopyStrategy
createOpenZFSOriginSnapshotConfiguration_copyStrategy :: Lens' CreateOpenZFSOriginSnapshotConfiguration OpenZFSCopyStrategy
createOpenZFSOriginSnapshotConfiguration_copyStrategy = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateOpenZFSOriginSnapshotConfiguration' {OpenZFSCopyStrategy
copyStrategy :: OpenZFSCopyStrategy
$sel:copyStrategy:CreateOpenZFSOriginSnapshotConfiguration' :: CreateOpenZFSOriginSnapshotConfiguration -> OpenZFSCopyStrategy
copyStrategy} -> OpenZFSCopyStrategy
copyStrategy) (\s :: CreateOpenZFSOriginSnapshotConfiguration
s@CreateOpenZFSOriginSnapshotConfiguration' {} OpenZFSCopyStrategy
a -> CreateOpenZFSOriginSnapshotConfiguration
s {$sel:copyStrategy:CreateOpenZFSOriginSnapshotConfiguration' :: OpenZFSCopyStrategy
copyStrategy = OpenZFSCopyStrategy
a} :: CreateOpenZFSOriginSnapshotConfiguration)

instance
  Prelude.Hashable
    CreateOpenZFSOriginSnapshotConfiguration
  where
  hashWithSalt :: Int -> CreateOpenZFSOriginSnapshotConfiguration -> Int
hashWithSalt
    Int
_salt
    CreateOpenZFSOriginSnapshotConfiguration' {Text
OpenZFSCopyStrategy
copyStrategy :: OpenZFSCopyStrategy
snapshotARN :: Text
$sel:copyStrategy:CreateOpenZFSOriginSnapshotConfiguration' :: CreateOpenZFSOriginSnapshotConfiguration -> OpenZFSCopyStrategy
$sel:snapshotARN:CreateOpenZFSOriginSnapshotConfiguration' :: CreateOpenZFSOriginSnapshotConfiguration -> Text
..} =
      Int
_salt
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
snapshotARN
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` OpenZFSCopyStrategy
copyStrategy

instance
  Prelude.NFData
    CreateOpenZFSOriginSnapshotConfiguration
  where
  rnf :: CreateOpenZFSOriginSnapshotConfiguration -> ()
rnf CreateOpenZFSOriginSnapshotConfiguration' {Text
OpenZFSCopyStrategy
copyStrategy :: OpenZFSCopyStrategy
snapshotARN :: Text
$sel:copyStrategy:CreateOpenZFSOriginSnapshotConfiguration' :: CreateOpenZFSOriginSnapshotConfiguration -> OpenZFSCopyStrategy
$sel:snapshotARN:CreateOpenZFSOriginSnapshotConfiguration' :: CreateOpenZFSOriginSnapshotConfiguration -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
snapshotARN
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf OpenZFSCopyStrategy
copyStrategy

instance
  Data.ToJSON
    CreateOpenZFSOriginSnapshotConfiguration
  where
  toJSON :: CreateOpenZFSOriginSnapshotConfiguration -> Value
toJSON CreateOpenZFSOriginSnapshotConfiguration' {Text
OpenZFSCopyStrategy
copyStrategy :: OpenZFSCopyStrategy
snapshotARN :: Text
$sel:copyStrategy:CreateOpenZFSOriginSnapshotConfiguration' :: CreateOpenZFSOriginSnapshotConfiguration -> OpenZFSCopyStrategy
$sel:snapshotARN:CreateOpenZFSOriginSnapshotConfiguration' :: CreateOpenZFSOriginSnapshotConfiguration -> Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ forall a. a -> Maybe a
Prelude.Just (Key
"SnapshotARN" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
snapshotARN),
            forall a. a -> Maybe a
Prelude.Just (Key
"CopyStrategy" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= OpenZFSCopyStrategy
copyStrategy)
          ]
      )