{-# 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.SageMaker.Types.OfflineStoreConfig
-- 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)
module Amazonka.SageMaker.Types.OfflineStoreConfig where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.SageMaker.Types.DataCatalogConfig
import Amazonka.SageMaker.Types.S3StorageConfig

-- | The configuration of an @OfflineStore@.
--
-- Provide an @OfflineStoreConfig@ in a request to @CreateFeatureGroup@ to
-- create an @OfflineStore@.
--
-- To encrypt an @OfflineStore@ using at rest data encryption, specify
-- Amazon Web Services Key Management Service (KMS) key ID, or @KMSKeyId@,
-- in @S3StorageConfig@.
--
-- /See:/ 'newOfflineStoreConfig' smart constructor.
data OfflineStoreConfig = OfflineStoreConfig'
  { -- | Set to @True@ to disable the automatic creation of an Amazon Web
    -- Services Glue table when configuring an @OfflineStore@.
    OfflineStoreConfig -> Maybe Bool
disableGlueTableCreation :: Prelude.Maybe Prelude.Bool,
    -- | The meta data of the Glue table that is autogenerated when an
    -- @OfflineStore@ is created.
    OfflineStoreConfig -> Maybe DataCatalogConfig
dataCatalogConfig :: Prelude.Maybe DataCatalogConfig,
    -- | The Amazon Simple Storage (Amazon S3) location of @OfflineStore@.
    OfflineStoreConfig -> S3StorageConfig
s3StorageConfig :: S3StorageConfig
  }
  deriving (OfflineStoreConfig -> OfflineStoreConfig -> Bool
(OfflineStoreConfig -> OfflineStoreConfig -> Bool)
-> (OfflineStoreConfig -> OfflineStoreConfig -> Bool)
-> Eq OfflineStoreConfig
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: OfflineStoreConfig -> OfflineStoreConfig -> Bool
$c/= :: OfflineStoreConfig -> OfflineStoreConfig -> Bool
== :: OfflineStoreConfig -> OfflineStoreConfig -> Bool
$c== :: OfflineStoreConfig -> OfflineStoreConfig -> Bool
Prelude.Eq, ReadPrec [OfflineStoreConfig]
ReadPrec OfflineStoreConfig
Int -> ReadS OfflineStoreConfig
ReadS [OfflineStoreConfig]
(Int -> ReadS OfflineStoreConfig)
-> ReadS [OfflineStoreConfig]
-> ReadPrec OfflineStoreConfig
-> ReadPrec [OfflineStoreConfig]
-> Read OfflineStoreConfig
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [OfflineStoreConfig]
$creadListPrec :: ReadPrec [OfflineStoreConfig]
readPrec :: ReadPrec OfflineStoreConfig
$creadPrec :: ReadPrec OfflineStoreConfig
readList :: ReadS [OfflineStoreConfig]
$creadList :: ReadS [OfflineStoreConfig]
readsPrec :: Int -> ReadS OfflineStoreConfig
$creadsPrec :: Int -> ReadS OfflineStoreConfig
Prelude.Read, Int -> OfflineStoreConfig -> ShowS
[OfflineStoreConfig] -> ShowS
OfflineStoreConfig -> String
(Int -> OfflineStoreConfig -> ShowS)
-> (OfflineStoreConfig -> String)
-> ([OfflineStoreConfig] -> ShowS)
-> Show OfflineStoreConfig
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [OfflineStoreConfig] -> ShowS
$cshowList :: [OfflineStoreConfig] -> ShowS
show :: OfflineStoreConfig -> String
$cshow :: OfflineStoreConfig -> String
showsPrec :: Int -> OfflineStoreConfig -> ShowS
$cshowsPrec :: Int -> OfflineStoreConfig -> ShowS
Prelude.Show, (forall x. OfflineStoreConfig -> Rep OfflineStoreConfig x)
-> (forall x. Rep OfflineStoreConfig x -> OfflineStoreConfig)
-> Generic OfflineStoreConfig
forall x. Rep OfflineStoreConfig x -> OfflineStoreConfig
forall x. OfflineStoreConfig -> Rep OfflineStoreConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep OfflineStoreConfig x -> OfflineStoreConfig
$cfrom :: forall x. OfflineStoreConfig -> Rep OfflineStoreConfig x
Prelude.Generic)

-- |
-- Create a value of 'OfflineStoreConfig' 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:
--
-- 'disableGlueTableCreation', 'offlineStoreConfig_disableGlueTableCreation' - Set to @True@ to disable the automatic creation of an Amazon Web
-- Services Glue table when configuring an @OfflineStore@.
--
-- 'dataCatalogConfig', 'offlineStoreConfig_dataCatalogConfig' - The meta data of the Glue table that is autogenerated when an
-- @OfflineStore@ is created.
--
-- 's3StorageConfig', 'offlineStoreConfig_s3StorageConfig' - The Amazon Simple Storage (Amazon S3) location of @OfflineStore@.
newOfflineStoreConfig ::
  -- | 's3StorageConfig'
  S3StorageConfig ->
  OfflineStoreConfig
newOfflineStoreConfig :: S3StorageConfig -> OfflineStoreConfig
newOfflineStoreConfig S3StorageConfig
pS3StorageConfig_ =
  OfflineStoreConfig' :: Maybe Bool
-> Maybe DataCatalogConfig -> S3StorageConfig -> OfflineStoreConfig
OfflineStoreConfig'
    { $sel:disableGlueTableCreation:OfflineStoreConfig' :: Maybe Bool
disableGlueTableCreation =
        Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:dataCatalogConfig:OfflineStoreConfig' :: Maybe DataCatalogConfig
dataCatalogConfig = Maybe DataCatalogConfig
forall a. Maybe a
Prelude.Nothing,
      $sel:s3StorageConfig:OfflineStoreConfig' :: S3StorageConfig
s3StorageConfig = S3StorageConfig
pS3StorageConfig_
    }

-- | Set to @True@ to disable the automatic creation of an Amazon Web
-- Services Glue table when configuring an @OfflineStore@.
offlineStoreConfig_disableGlueTableCreation :: Lens.Lens' OfflineStoreConfig (Prelude.Maybe Prelude.Bool)
offlineStoreConfig_disableGlueTableCreation :: (Maybe Bool -> f (Maybe Bool))
-> OfflineStoreConfig -> f OfflineStoreConfig
offlineStoreConfig_disableGlueTableCreation = (OfflineStoreConfig -> Maybe Bool)
-> (OfflineStoreConfig -> Maybe Bool -> OfflineStoreConfig)
-> Lens
     OfflineStoreConfig OfflineStoreConfig (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OfflineStoreConfig' {Maybe Bool
disableGlueTableCreation :: Maybe Bool
$sel:disableGlueTableCreation:OfflineStoreConfig' :: OfflineStoreConfig -> Maybe Bool
disableGlueTableCreation} -> Maybe Bool
disableGlueTableCreation) (\s :: OfflineStoreConfig
s@OfflineStoreConfig' {} Maybe Bool
a -> OfflineStoreConfig
s {$sel:disableGlueTableCreation:OfflineStoreConfig' :: Maybe Bool
disableGlueTableCreation = Maybe Bool
a} :: OfflineStoreConfig)

-- | The meta data of the Glue table that is autogenerated when an
-- @OfflineStore@ is created.
offlineStoreConfig_dataCatalogConfig :: Lens.Lens' OfflineStoreConfig (Prelude.Maybe DataCatalogConfig)
offlineStoreConfig_dataCatalogConfig :: (Maybe DataCatalogConfig -> f (Maybe DataCatalogConfig))
-> OfflineStoreConfig -> f OfflineStoreConfig
offlineStoreConfig_dataCatalogConfig = (OfflineStoreConfig -> Maybe DataCatalogConfig)
-> (OfflineStoreConfig
    -> Maybe DataCatalogConfig -> OfflineStoreConfig)
-> Lens
     OfflineStoreConfig
     OfflineStoreConfig
     (Maybe DataCatalogConfig)
     (Maybe DataCatalogConfig)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OfflineStoreConfig' {Maybe DataCatalogConfig
dataCatalogConfig :: Maybe DataCatalogConfig
$sel:dataCatalogConfig:OfflineStoreConfig' :: OfflineStoreConfig -> Maybe DataCatalogConfig
dataCatalogConfig} -> Maybe DataCatalogConfig
dataCatalogConfig) (\s :: OfflineStoreConfig
s@OfflineStoreConfig' {} Maybe DataCatalogConfig
a -> OfflineStoreConfig
s {$sel:dataCatalogConfig:OfflineStoreConfig' :: Maybe DataCatalogConfig
dataCatalogConfig = Maybe DataCatalogConfig
a} :: OfflineStoreConfig)

-- | The Amazon Simple Storage (Amazon S3) location of @OfflineStore@.
offlineStoreConfig_s3StorageConfig :: Lens.Lens' OfflineStoreConfig S3StorageConfig
offlineStoreConfig_s3StorageConfig :: (S3StorageConfig -> f S3StorageConfig)
-> OfflineStoreConfig -> f OfflineStoreConfig
offlineStoreConfig_s3StorageConfig = (OfflineStoreConfig -> S3StorageConfig)
-> (OfflineStoreConfig -> S3StorageConfig -> OfflineStoreConfig)
-> Lens
     OfflineStoreConfig
     OfflineStoreConfig
     S3StorageConfig
     S3StorageConfig
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OfflineStoreConfig' {S3StorageConfig
s3StorageConfig :: S3StorageConfig
$sel:s3StorageConfig:OfflineStoreConfig' :: OfflineStoreConfig -> S3StorageConfig
s3StorageConfig} -> S3StorageConfig
s3StorageConfig) (\s :: OfflineStoreConfig
s@OfflineStoreConfig' {} S3StorageConfig
a -> OfflineStoreConfig
s {$sel:s3StorageConfig:OfflineStoreConfig' :: S3StorageConfig
s3StorageConfig = S3StorageConfig
a} :: OfflineStoreConfig)

instance Core.FromJSON OfflineStoreConfig where
  parseJSON :: Value -> Parser OfflineStoreConfig
parseJSON =
    String
-> (Object -> Parser OfflineStoreConfig)
-> Value
-> Parser OfflineStoreConfig
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"OfflineStoreConfig"
      ( \Object
x ->
          Maybe Bool
-> Maybe DataCatalogConfig -> S3StorageConfig -> OfflineStoreConfig
OfflineStoreConfig'
            (Maybe Bool
 -> Maybe DataCatalogConfig
 -> S3StorageConfig
 -> OfflineStoreConfig)
-> Parser (Maybe Bool)
-> Parser
     (Maybe DataCatalogConfig -> S3StorageConfig -> OfflineStoreConfig)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"DisableGlueTableCreation")
            Parser
  (Maybe DataCatalogConfig -> S3StorageConfig -> OfflineStoreConfig)
-> Parser (Maybe DataCatalogConfig)
-> Parser (S3StorageConfig -> OfflineStoreConfig)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe DataCatalogConfig)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"DataCatalogConfig")
            Parser (S3StorageConfig -> OfflineStoreConfig)
-> Parser S3StorageConfig -> Parser OfflineStoreConfig
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser S3StorageConfig
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"S3StorageConfig")
      )

instance Prelude.Hashable OfflineStoreConfig

instance Prelude.NFData OfflineStoreConfig

instance Core.ToJSON OfflineStoreConfig where
  toJSON :: OfflineStoreConfig -> Value
toJSON OfflineStoreConfig' {Maybe Bool
Maybe DataCatalogConfig
S3StorageConfig
s3StorageConfig :: S3StorageConfig
dataCatalogConfig :: Maybe DataCatalogConfig
disableGlueTableCreation :: Maybe Bool
$sel:s3StorageConfig:OfflineStoreConfig' :: OfflineStoreConfig -> S3StorageConfig
$sel:dataCatalogConfig:OfflineStoreConfig' :: OfflineStoreConfig -> Maybe DataCatalogConfig
$sel:disableGlueTableCreation:OfflineStoreConfig' :: OfflineStoreConfig -> Maybe Bool
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"DisableGlueTableCreation" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
disableGlueTableCreation,
            (Text
"DataCatalogConfig" Text -> DataCatalogConfig -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (DataCatalogConfig -> Pair)
-> Maybe DataCatalogConfig -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe DataCatalogConfig
dataCatalogConfig,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"S3StorageConfig" Text -> S3StorageConfig -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= S3StorageConfig
s3StorageConfig)
          ]
      )