{-# 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.HealthLake.Types.S3Configuration
-- 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.HealthLake.Types.S3Configuration 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

-- | The configuration of the S3 bucket for either an import or export job.
-- This includes assigning permissions for access.
--
-- /See:/ 'newS3Configuration' smart constructor.
data S3Configuration = S3Configuration'
  { -- | The S3Uri is the user specified S3 location of the FHIR data to be
    -- imported into Amazon HealthLake.
    S3Configuration -> Text
s3Uri :: Prelude.Text,
    -- | The KMS key ID used to access the S3 bucket.
    S3Configuration -> Text
kmsKeyId :: Prelude.Text
  }
  deriving (S3Configuration -> S3Configuration -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: S3Configuration -> S3Configuration -> Bool
$c/= :: S3Configuration -> S3Configuration -> Bool
== :: S3Configuration -> S3Configuration -> Bool
$c== :: S3Configuration -> S3Configuration -> Bool
Prelude.Eq, ReadPrec [S3Configuration]
ReadPrec S3Configuration
Int -> ReadS S3Configuration
ReadS [S3Configuration]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [S3Configuration]
$creadListPrec :: ReadPrec [S3Configuration]
readPrec :: ReadPrec S3Configuration
$creadPrec :: ReadPrec S3Configuration
readList :: ReadS [S3Configuration]
$creadList :: ReadS [S3Configuration]
readsPrec :: Int -> ReadS S3Configuration
$creadsPrec :: Int -> ReadS S3Configuration
Prelude.Read, Int -> S3Configuration -> ShowS
[S3Configuration] -> ShowS
S3Configuration -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [S3Configuration] -> ShowS
$cshowList :: [S3Configuration] -> ShowS
show :: S3Configuration -> String
$cshow :: S3Configuration -> String
showsPrec :: Int -> S3Configuration -> ShowS
$cshowsPrec :: Int -> S3Configuration -> ShowS
Prelude.Show, forall x. Rep S3Configuration x -> S3Configuration
forall x. S3Configuration -> Rep S3Configuration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep S3Configuration x -> S3Configuration
$cfrom :: forall x. S3Configuration -> Rep S3Configuration x
Prelude.Generic)

-- |
-- Create a value of 'S3Configuration' 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:
--
-- 's3Uri', 's3Configuration_s3Uri' - The S3Uri is the user specified S3 location of the FHIR data to be
-- imported into Amazon HealthLake.
--
-- 'kmsKeyId', 's3Configuration_kmsKeyId' - The KMS key ID used to access the S3 bucket.
newS3Configuration ::
  -- | 's3Uri'
  Prelude.Text ->
  -- | 'kmsKeyId'
  Prelude.Text ->
  S3Configuration
newS3Configuration :: Text -> Text -> S3Configuration
newS3Configuration Text
pS3Uri_ Text
pKmsKeyId_ =
  S3Configuration'
    { $sel:s3Uri:S3Configuration' :: Text
s3Uri = Text
pS3Uri_,
      $sel:kmsKeyId:S3Configuration' :: Text
kmsKeyId = Text
pKmsKeyId_
    }

-- | The S3Uri is the user specified S3 location of the FHIR data to be
-- imported into Amazon HealthLake.
s3Configuration_s3Uri :: Lens.Lens' S3Configuration Prelude.Text
s3Configuration_s3Uri :: Lens' S3Configuration Text
s3Configuration_s3Uri = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\S3Configuration' {Text
s3Uri :: Text
$sel:s3Uri:S3Configuration' :: S3Configuration -> Text
s3Uri} -> Text
s3Uri) (\s :: S3Configuration
s@S3Configuration' {} Text
a -> S3Configuration
s {$sel:s3Uri:S3Configuration' :: Text
s3Uri = Text
a} :: S3Configuration)

-- | The KMS key ID used to access the S3 bucket.
s3Configuration_kmsKeyId :: Lens.Lens' S3Configuration Prelude.Text
s3Configuration_kmsKeyId :: Lens' S3Configuration Text
s3Configuration_kmsKeyId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\S3Configuration' {Text
kmsKeyId :: Text
$sel:kmsKeyId:S3Configuration' :: S3Configuration -> Text
kmsKeyId} -> Text
kmsKeyId) (\s :: S3Configuration
s@S3Configuration' {} Text
a -> S3Configuration
s {$sel:kmsKeyId:S3Configuration' :: Text
kmsKeyId = Text
a} :: S3Configuration)

instance Data.FromJSON S3Configuration where
  parseJSON :: Value -> Parser S3Configuration
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"S3Configuration"
      ( \Object
x ->
          Text -> Text -> S3Configuration
S3Configuration'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"S3Uri")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"KmsKeyId")
      )

instance Prelude.Hashable S3Configuration where
  hashWithSalt :: Int -> S3Configuration -> Int
hashWithSalt Int
_salt S3Configuration' {Text
kmsKeyId :: Text
s3Uri :: Text
$sel:kmsKeyId:S3Configuration' :: S3Configuration -> Text
$sel:s3Uri:S3Configuration' :: S3Configuration -> Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
s3Uri
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
kmsKeyId

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

instance Data.ToJSON S3Configuration where
  toJSON :: S3Configuration -> Value
toJSON S3Configuration' {Text
kmsKeyId :: Text
s3Uri :: Text
$sel:kmsKeyId:S3Configuration' :: S3Configuration -> Text
$sel:s3Uri:S3Configuration' :: S3Configuration -> Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ forall a. a -> Maybe a
Prelude.Just (Key
"S3Uri" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
s3Uri),
            forall a. a -> Maybe a
Prelude.Just (Key
"KmsKeyId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
kmsKeyId)
          ]
      )