{-# 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.EFS.Types.DestinationToCreate
-- 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.EFS.Types.DestinationToCreate where

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

-- | Describes the destination file system to create in the replication
-- configuration.
--
-- /See:/ 'newDestinationToCreate' smart constructor.
data DestinationToCreate = DestinationToCreate'
  { -- | To create a file system that uses EFS One Zone storage, specify the name
    -- of the Availability Zone in which to create the destination file system.
    DestinationToCreate -> Maybe Text
availabilityZoneName :: Prelude.Maybe Prelude.Text,
    -- | Specifies the Key Management Service (KMS) key that you want to use to
    -- encrypt the destination file system. If you do not specify a KMS key,
    -- Amazon EFS uses your default KMS key for Amazon EFS,
    -- @\/aws\/elasticfilesystem@. This ID can be in one of the following
    -- formats:
    --
    -- -   Key ID - The unique identifier of the key, for example
    --     @1234abcd-12ab-34cd-56ef-1234567890ab@.
    --
    -- -   ARN - The Amazon Resource Name (ARN) for the key, for example
    --     @arn:aws:kms:us-west-2:111122223333:key\/1234abcd-12ab-34cd-56ef-1234567890ab@.
    --
    -- -   Key alias - A previously created display name for a key, for example
    --     @alias\/projectKey1@.
    --
    -- -   Key alias ARN - The ARN for a key alias, for example
    --     @arn:aws:kms:us-west-2:444455556666:alias\/projectKey1@.
    DestinationToCreate -> Maybe Text
kmsKeyId :: Prelude.Maybe Prelude.Text,
    -- | To create a file system that uses Regional storage, specify the Amazon
    -- Web Services Region in which to create the destination file system.
    DestinationToCreate -> Maybe Text
region :: Prelude.Maybe Prelude.Text
  }
  deriving (DestinationToCreate -> DestinationToCreate -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DestinationToCreate -> DestinationToCreate -> Bool
$c/= :: DestinationToCreate -> DestinationToCreate -> Bool
== :: DestinationToCreate -> DestinationToCreate -> Bool
$c== :: DestinationToCreate -> DestinationToCreate -> Bool
Prelude.Eq, ReadPrec [DestinationToCreate]
ReadPrec DestinationToCreate
Int -> ReadS DestinationToCreate
ReadS [DestinationToCreate]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DestinationToCreate]
$creadListPrec :: ReadPrec [DestinationToCreate]
readPrec :: ReadPrec DestinationToCreate
$creadPrec :: ReadPrec DestinationToCreate
readList :: ReadS [DestinationToCreate]
$creadList :: ReadS [DestinationToCreate]
readsPrec :: Int -> ReadS DestinationToCreate
$creadsPrec :: Int -> ReadS DestinationToCreate
Prelude.Read, Int -> DestinationToCreate -> ShowS
[DestinationToCreate] -> ShowS
DestinationToCreate -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DestinationToCreate] -> ShowS
$cshowList :: [DestinationToCreate] -> ShowS
show :: DestinationToCreate -> String
$cshow :: DestinationToCreate -> String
showsPrec :: Int -> DestinationToCreate -> ShowS
$cshowsPrec :: Int -> DestinationToCreate -> ShowS
Prelude.Show, forall x. Rep DestinationToCreate x -> DestinationToCreate
forall x. DestinationToCreate -> Rep DestinationToCreate x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DestinationToCreate x -> DestinationToCreate
$cfrom :: forall x. DestinationToCreate -> Rep DestinationToCreate x
Prelude.Generic)

-- |
-- Create a value of 'DestinationToCreate' 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:
--
-- 'availabilityZoneName', 'destinationToCreate_availabilityZoneName' - To create a file system that uses EFS One Zone storage, specify the name
-- of the Availability Zone in which to create the destination file system.
--
-- 'kmsKeyId', 'destinationToCreate_kmsKeyId' - Specifies the Key Management Service (KMS) key that you want to use to
-- encrypt the destination file system. If you do not specify a KMS key,
-- Amazon EFS uses your default KMS key for Amazon EFS,
-- @\/aws\/elasticfilesystem@. This ID can be in one of the following
-- formats:
--
-- -   Key ID - The unique identifier of the key, for example
--     @1234abcd-12ab-34cd-56ef-1234567890ab@.
--
-- -   ARN - The Amazon Resource Name (ARN) for the key, for example
--     @arn:aws:kms:us-west-2:111122223333:key\/1234abcd-12ab-34cd-56ef-1234567890ab@.
--
-- -   Key alias - A previously created display name for a key, for example
--     @alias\/projectKey1@.
--
-- -   Key alias ARN - The ARN for a key alias, for example
--     @arn:aws:kms:us-west-2:444455556666:alias\/projectKey1@.
--
-- 'region', 'destinationToCreate_region' - To create a file system that uses Regional storage, specify the Amazon
-- Web Services Region in which to create the destination file system.
newDestinationToCreate ::
  DestinationToCreate
newDestinationToCreate :: DestinationToCreate
newDestinationToCreate =
  DestinationToCreate'
    { $sel:availabilityZoneName:DestinationToCreate' :: Maybe Text
availabilityZoneName =
        forall a. Maybe a
Prelude.Nothing,
      $sel:kmsKeyId:DestinationToCreate' :: Maybe Text
kmsKeyId = forall a. Maybe a
Prelude.Nothing,
      $sel:region:DestinationToCreate' :: Maybe Text
region = forall a. Maybe a
Prelude.Nothing
    }

-- | To create a file system that uses EFS One Zone storage, specify the name
-- of the Availability Zone in which to create the destination file system.
destinationToCreate_availabilityZoneName :: Lens.Lens' DestinationToCreate (Prelude.Maybe Prelude.Text)
destinationToCreate_availabilityZoneName :: Lens' DestinationToCreate (Maybe Text)
destinationToCreate_availabilityZoneName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DestinationToCreate' {Maybe Text
availabilityZoneName :: Maybe Text
$sel:availabilityZoneName:DestinationToCreate' :: DestinationToCreate -> Maybe Text
availabilityZoneName} -> Maybe Text
availabilityZoneName) (\s :: DestinationToCreate
s@DestinationToCreate' {} Maybe Text
a -> DestinationToCreate
s {$sel:availabilityZoneName:DestinationToCreate' :: Maybe Text
availabilityZoneName = Maybe Text
a} :: DestinationToCreate)

-- | Specifies the Key Management Service (KMS) key that you want to use to
-- encrypt the destination file system. If you do not specify a KMS key,
-- Amazon EFS uses your default KMS key for Amazon EFS,
-- @\/aws\/elasticfilesystem@. This ID can be in one of the following
-- formats:
--
-- -   Key ID - The unique identifier of the key, for example
--     @1234abcd-12ab-34cd-56ef-1234567890ab@.
--
-- -   ARN - The Amazon Resource Name (ARN) for the key, for example
--     @arn:aws:kms:us-west-2:111122223333:key\/1234abcd-12ab-34cd-56ef-1234567890ab@.
--
-- -   Key alias - A previously created display name for a key, for example
--     @alias\/projectKey1@.
--
-- -   Key alias ARN - The ARN for a key alias, for example
--     @arn:aws:kms:us-west-2:444455556666:alias\/projectKey1@.
destinationToCreate_kmsKeyId :: Lens.Lens' DestinationToCreate (Prelude.Maybe Prelude.Text)
destinationToCreate_kmsKeyId :: Lens' DestinationToCreate (Maybe Text)
destinationToCreate_kmsKeyId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DestinationToCreate' {Maybe Text
kmsKeyId :: Maybe Text
$sel:kmsKeyId:DestinationToCreate' :: DestinationToCreate -> Maybe Text
kmsKeyId} -> Maybe Text
kmsKeyId) (\s :: DestinationToCreate
s@DestinationToCreate' {} Maybe Text
a -> DestinationToCreate
s {$sel:kmsKeyId:DestinationToCreate' :: Maybe Text
kmsKeyId = Maybe Text
a} :: DestinationToCreate)

-- | To create a file system that uses Regional storage, specify the Amazon
-- Web Services Region in which to create the destination file system.
destinationToCreate_region :: Lens.Lens' DestinationToCreate (Prelude.Maybe Prelude.Text)
destinationToCreate_region :: Lens' DestinationToCreate (Maybe Text)
destinationToCreate_region = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DestinationToCreate' {Maybe Text
region :: Maybe Text
$sel:region:DestinationToCreate' :: DestinationToCreate -> Maybe Text
region} -> Maybe Text
region) (\s :: DestinationToCreate
s@DestinationToCreate' {} Maybe Text
a -> DestinationToCreate
s {$sel:region:DestinationToCreate' :: Maybe Text
region = Maybe Text
a} :: DestinationToCreate)

instance Prelude.Hashable DestinationToCreate where
  hashWithSalt :: Int -> DestinationToCreate -> Int
hashWithSalt Int
_salt DestinationToCreate' {Maybe Text
region :: Maybe Text
kmsKeyId :: Maybe Text
availabilityZoneName :: Maybe Text
$sel:region:DestinationToCreate' :: DestinationToCreate -> Maybe Text
$sel:kmsKeyId:DestinationToCreate' :: DestinationToCreate -> Maybe Text
$sel:availabilityZoneName:DestinationToCreate' :: DestinationToCreate -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
availabilityZoneName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
kmsKeyId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
region

instance Prelude.NFData DestinationToCreate where
  rnf :: DestinationToCreate -> ()
rnf DestinationToCreate' {Maybe Text
region :: Maybe Text
kmsKeyId :: Maybe Text
availabilityZoneName :: Maybe Text
$sel:region:DestinationToCreate' :: DestinationToCreate -> Maybe Text
$sel:kmsKeyId:DestinationToCreate' :: DestinationToCreate -> Maybe Text
$sel:availabilityZoneName:DestinationToCreate' :: DestinationToCreate -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
availabilityZoneName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
kmsKeyId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
region

instance Data.ToJSON DestinationToCreate where
  toJSON :: DestinationToCreate -> Value
toJSON DestinationToCreate' {Maybe Text
region :: Maybe Text
kmsKeyId :: Maybe Text
availabilityZoneName :: Maybe Text
$sel:region:DestinationToCreate' :: DestinationToCreate -> Maybe Text
$sel:kmsKeyId:DestinationToCreate' :: DestinationToCreate -> Maybe Text
$sel:availabilityZoneName:DestinationToCreate' :: DestinationToCreate -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"AvailabilityZoneName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
availabilityZoneName,
            (Key
"KmsKeyId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
kmsKeyId,
            (Key
"Region" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
region
          ]
      )