{-# 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.IoTAnalytics.Types.DatastoreStorage
-- 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.IoTAnalytics.Types.DatastoreStorage where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.IoTAnalytics.Types.CustomerManagedDatastoreS3Storage
import Amazonka.IoTAnalytics.Types.DatastoreIotSiteWiseMultiLayerStorage
import Amazonka.IoTAnalytics.Types.ServiceManagedDatastoreS3Storage
import qualified Amazonka.Prelude as Prelude

-- | Where data in a data store is stored.. You can choose @serviceManagedS3@
-- storage, @customerManagedS3@ storage, or @iotSiteWiseMultiLayerStorage@
-- storage. The default is @serviceManagedS3@. You can\'t change the choice
-- of Amazon S3 storage after your data store is created.
--
-- /See:/ 'newDatastoreStorage' smart constructor.
data DatastoreStorage = DatastoreStorage'
  { -- | S3-customer-managed; When you choose customer-managed storage, the
    -- @retentionPeriod@ parameter is ignored. You can\'t change the choice of
    -- Amazon S3 storage after your data store is created.
    DatastoreStorage -> Maybe CustomerManagedDatastoreS3Storage
customerManagedS3 :: Prelude.Maybe CustomerManagedDatastoreS3Storage,
    -- | Used to store data used by IoT SiteWise in an Amazon S3 bucket that you
    -- manage. You can\'t change the choice of Amazon S3 storage after your
    -- data store is created.
    DatastoreStorage -> Maybe DatastoreIotSiteWiseMultiLayerStorage
iotSiteWiseMultiLayerStorage :: Prelude.Maybe DatastoreIotSiteWiseMultiLayerStorage,
    -- | Used to store data in an Amazon S3 bucket managed by IoT Analytics. You
    -- can\'t change the choice of Amazon S3 storage after your data store is
    -- created.
    DatastoreStorage -> Maybe ServiceManagedDatastoreS3Storage
serviceManagedS3 :: Prelude.Maybe ServiceManagedDatastoreS3Storage
  }
  deriving (DatastoreStorage -> DatastoreStorage -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DatastoreStorage -> DatastoreStorage -> Bool
$c/= :: DatastoreStorage -> DatastoreStorage -> Bool
== :: DatastoreStorage -> DatastoreStorage -> Bool
$c== :: DatastoreStorage -> DatastoreStorage -> Bool
Prelude.Eq, ReadPrec [DatastoreStorage]
ReadPrec DatastoreStorage
Int -> ReadS DatastoreStorage
ReadS [DatastoreStorage]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DatastoreStorage]
$creadListPrec :: ReadPrec [DatastoreStorage]
readPrec :: ReadPrec DatastoreStorage
$creadPrec :: ReadPrec DatastoreStorage
readList :: ReadS [DatastoreStorage]
$creadList :: ReadS [DatastoreStorage]
readsPrec :: Int -> ReadS DatastoreStorage
$creadsPrec :: Int -> ReadS DatastoreStorage
Prelude.Read, Int -> DatastoreStorage -> ShowS
[DatastoreStorage] -> ShowS
DatastoreStorage -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DatastoreStorage] -> ShowS
$cshowList :: [DatastoreStorage] -> ShowS
show :: DatastoreStorage -> String
$cshow :: DatastoreStorage -> String
showsPrec :: Int -> DatastoreStorage -> ShowS
$cshowsPrec :: Int -> DatastoreStorage -> ShowS
Prelude.Show, forall x. Rep DatastoreStorage x -> DatastoreStorage
forall x. DatastoreStorage -> Rep DatastoreStorage x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DatastoreStorage x -> DatastoreStorage
$cfrom :: forall x. DatastoreStorage -> Rep DatastoreStorage x
Prelude.Generic)

-- |
-- Create a value of 'DatastoreStorage' 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:
--
-- 'customerManagedS3', 'datastoreStorage_customerManagedS3' - S3-customer-managed; When you choose customer-managed storage, the
-- @retentionPeriod@ parameter is ignored. You can\'t change the choice of
-- Amazon S3 storage after your data store is created.
--
-- 'iotSiteWiseMultiLayerStorage', 'datastoreStorage_iotSiteWiseMultiLayerStorage' - Used to store data used by IoT SiteWise in an Amazon S3 bucket that you
-- manage. You can\'t change the choice of Amazon S3 storage after your
-- data store is created.
--
-- 'serviceManagedS3', 'datastoreStorage_serviceManagedS3' - Used to store data in an Amazon S3 bucket managed by IoT Analytics. You
-- can\'t change the choice of Amazon S3 storage after your data store is
-- created.
newDatastoreStorage ::
  DatastoreStorage
newDatastoreStorage :: DatastoreStorage
newDatastoreStorage =
  DatastoreStorage'
    { $sel:customerManagedS3:DatastoreStorage' :: Maybe CustomerManagedDatastoreS3Storage
customerManagedS3 =
        forall a. Maybe a
Prelude.Nothing,
      $sel:iotSiteWiseMultiLayerStorage:DatastoreStorage' :: Maybe DatastoreIotSiteWiseMultiLayerStorage
iotSiteWiseMultiLayerStorage = forall a. Maybe a
Prelude.Nothing,
      $sel:serviceManagedS3:DatastoreStorage' :: Maybe ServiceManagedDatastoreS3Storage
serviceManagedS3 = forall a. Maybe a
Prelude.Nothing
    }

-- | S3-customer-managed; When you choose customer-managed storage, the
-- @retentionPeriod@ parameter is ignored. You can\'t change the choice of
-- Amazon S3 storage after your data store is created.
datastoreStorage_customerManagedS3 :: Lens.Lens' DatastoreStorage (Prelude.Maybe CustomerManagedDatastoreS3Storage)
datastoreStorage_customerManagedS3 :: Lens' DatastoreStorage (Maybe CustomerManagedDatastoreS3Storage)
datastoreStorage_customerManagedS3 = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DatastoreStorage' {Maybe CustomerManagedDatastoreS3Storage
customerManagedS3 :: Maybe CustomerManagedDatastoreS3Storage
$sel:customerManagedS3:DatastoreStorage' :: DatastoreStorage -> Maybe CustomerManagedDatastoreS3Storage
customerManagedS3} -> Maybe CustomerManagedDatastoreS3Storage
customerManagedS3) (\s :: DatastoreStorage
s@DatastoreStorage' {} Maybe CustomerManagedDatastoreS3Storage
a -> DatastoreStorage
s {$sel:customerManagedS3:DatastoreStorage' :: Maybe CustomerManagedDatastoreS3Storage
customerManagedS3 = Maybe CustomerManagedDatastoreS3Storage
a} :: DatastoreStorage)

-- | Used to store data used by IoT SiteWise in an Amazon S3 bucket that you
-- manage. You can\'t change the choice of Amazon S3 storage after your
-- data store is created.
datastoreStorage_iotSiteWiseMultiLayerStorage :: Lens.Lens' DatastoreStorage (Prelude.Maybe DatastoreIotSiteWiseMultiLayerStorage)
datastoreStorage_iotSiteWiseMultiLayerStorage :: Lens'
  DatastoreStorage (Maybe DatastoreIotSiteWiseMultiLayerStorage)
datastoreStorage_iotSiteWiseMultiLayerStorage = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DatastoreStorage' {Maybe DatastoreIotSiteWiseMultiLayerStorage
iotSiteWiseMultiLayerStorage :: Maybe DatastoreIotSiteWiseMultiLayerStorage
$sel:iotSiteWiseMultiLayerStorage:DatastoreStorage' :: DatastoreStorage -> Maybe DatastoreIotSiteWiseMultiLayerStorage
iotSiteWiseMultiLayerStorage} -> Maybe DatastoreIotSiteWiseMultiLayerStorage
iotSiteWiseMultiLayerStorage) (\s :: DatastoreStorage
s@DatastoreStorage' {} Maybe DatastoreIotSiteWiseMultiLayerStorage
a -> DatastoreStorage
s {$sel:iotSiteWiseMultiLayerStorage:DatastoreStorage' :: Maybe DatastoreIotSiteWiseMultiLayerStorage
iotSiteWiseMultiLayerStorage = Maybe DatastoreIotSiteWiseMultiLayerStorage
a} :: DatastoreStorage)

-- | Used to store data in an Amazon S3 bucket managed by IoT Analytics. You
-- can\'t change the choice of Amazon S3 storage after your data store is
-- created.
datastoreStorage_serviceManagedS3 :: Lens.Lens' DatastoreStorage (Prelude.Maybe ServiceManagedDatastoreS3Storage)
datastoreStorage_serviceManagedS3 :: Lens' DatastoreStorage (Maybe ServiceManagedDatastoreS3Storage)
datastoreStorage_serviceManagedS3 = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DatastoreStorage' {Maybe ServiceManagedDatastoreS3Storage
serviceManagedS3 :: Maybe ServiceManagedDatastoreS3Storage
$sel:serviceManagedS3:DatastoreStorage' :: DatastoreStorage -> Maybe ServiceManagedDatastoreS3Storage
serviceManagedS3} -> Maybe ServiceManagedDatastoreS3Storage
serviceManagedS3) (\s :: DatastoreStorage
s@DatastoreStorage' {} Maybe ServiceManagedDatastoreS3Storage
a -> DatastoreStorage
s {$sel:serviceManagedS3:DatastoreStorage' :: Maybe ServiceManagedDatastoreS3Storage
serviceManagedS3 = Maybe ServiceManagedDatastoreS3Storage
a} :: DatastoreStorage)

instance Data.FromJSON DatastoreStorage where
  parseJSON :: Value -> Parser DatastoreStorage
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"DatastoreStorage"
      ( \Object
x ->
          Maybe CustomerManagedDatastoreS3Storage
-> Maybe DatastoreIotSiteWiseMultiLayerStorage
-> Maybe ServiceManagedDatastoreS3Storage
-> DatastoreStorage
DatastoreStorage'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"customerManagedS3")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"iotSiteWiseMultiLayerStorage")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"serviceManagedS3")
      )

instance Prelude.Hashable DatastoreStorage where
  hashWithSalt :: Int -> DatastoreStorage -> Int
hashWithSalt Int
_salt DatastoreStorage' {Maybe CustomerManagedDatastoreS3Storage
Maybe DatastoreIotSiteWiseMultiLayerStorage
Maybe ServiceManagedDatastoreS3Storage
serviceManagedS3 :: Maybe ServiceManagedDatastoreS3Storage
iotSiteWiseMultiLayerStorage :: Maybe DatastoreIotSiteWiseMultiLayerStorage
customerManagedS3 :: Maybe CustomerManagedDatastoreS3Storage
$sel:serviceManagedS3:DatastoreStorage' :: DatastoreStorage -> Maybe ServiceManagedDatastoreS3Storage
$sel:iotSiteWiseMultiLayerStorage:DatastoreStorage' :: DatastoreStorage -> Maybe DatastoreIotSiteWiseMultiLayerStorage
$sel:customerManagedS3:DatastoreStorage' :: DatastoreStorage -> Maybe CustomerManagedDatastoreS3Storage
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe CustomerManagedDatastoreS3Storage
customerManagedS3
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe DatastoreIotSiteWiseMultiLayerStorage
iotSiteWiseMultiLayerStorage
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ServiceManagedDatastoreS3Storage
serviceManagedS3

instance Prelude.NFData DatastoreStorage where
  rnf :: DatastoreStorage -> ()
rnf DatastoreStorage' {Maybe CustomerManagedDatastoreS3Storage
Maybe DatastoreIotSiteWiseMultiLayerStorage
Maybe ServiceManagedDatastoreS3Storage
serviceManagedS3 :: Maybe ServiceManagedDatastoreS3Storage
iotSiteWiseMultiLayerStorage :: Maybe DatastoreIotSiteWiseMultiLayerStorage
customerManagedS3 :: Maybe CustomerManagedDatastoreS3Storage
$sel:serviceManagedS3:DatastoreStorage' :: DatastoreStorage -> Maybe ServiceManagedDatastoreS3Storage
$sel:iotSiteWiseMultiLayerStorage:DatastoreStorage' :: DatastoreStorage -> Maybe DatastoreIotSiteWiseMultiLayerStorage
$sel:customerManagedS3:DatastoreStorage' :: DatastoreStorage -> Maybe CustomerManagedDatastoreS3Storage
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe CustomerManagedDatastoreS3Storage
customerManagedS3
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe DatastoreIotSiteWiseMultiLayerStorage
iotSiteWiseMultiLayerStorage
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ServiceManagedDatastoreS3Storage
serviceManagedS3

instance Data.ToJSON DatastoreStorage where
  toJSON :: DatastoreStorage -> Value
toJSON DatastoreStorage' {Maybe CustomerManagedDatastoreS3Storage
Maybe DatastoreIotSiteWiseMultiLayerStorage
Maybe ServiceManagedDatastoreS3Storage
serviceManagedS3 :: Maybe ServiceManagedDatastoreS3Storage
iotSiteWiseMultiLayerStorage :: Maybe DatastoreIotSiteWiseMultiLayerStorage
customerManagedS3 :: Maybe CustomerManagedDatastoreS3Storage
$sel:serviceManagedS3:DatastoreStorage' :: DatastoreStorage -> Maybe ServiceManagedDatastoreS3Storage
$sel:iotSiteWiseMultiLayerStorage:DatastoreStorage' :: DatastoreStorage -> Maybe DatastoreIotSiteWiseMultiLayerStorage
$sel:customerManagedS3:DatastoreStorage' :: DatastoreStorage -> Maybe CustomerManagedDatastoreS3Storage
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"customerManagedS3" 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 CustomerManagedDatastoreS3Storage
customerManagedS3,
            (Key
"iotSiteWiseMultiLayerStorage" 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 DatastoreIotSiteWiseMultiLayerStorage
iotSiteWiseMultiLayerStorage,
            (Key
"serviceManagedS3" 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 ServiceManagedDatastoreS3Storage
serviceManagedS3
          ]
      )