{-# 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.IoTSiteWise.Types.MultiLayerStorage
-- 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.IoTSiteWise.Types.MultiLayerStorage where

import qualified Amazonka.Core as Core
import Amazonka.IoTSiteWise.Types.CustomerManagedS3Storage
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Contains information about the storage destination.
--
-- /See:/ 'newMultiLayerStorage' smart constructor.
data MultiLayerStorage = MultiLayerStorage'
  { -- | Contains information about a customer managed Amazon S3 bucket.
    MultiLayerStorage -> CustomerManagedS3Storage
customerManagedS3Storage :: CustomerManagedS3Storage
  }
  deriving (MultiLayerStorage -> MultiLayerStorage -> Bool
(MultiLayerStorage -> MultiLayerStorage -> Bool)
-> (MultiLayerStorage -> MultiLayerStorage -> Bool)
-> Eq MultiLayerStorage
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: MultiLayerStorage -> MultiLayerStorage -> Bool
$c/= :: MultiLayerStorage -> MultiLayerStorage -> Bool
== :: MultiLayerStorage -> MultiLayerStorage -> Bool
$c== :: MultiLayerStorage -> MultiLayerStorage -> Bool
Prelude.Eq, ReadPrec [MultiLayerStorage]
ReadPrec MultiLayerStorage
Int -> ReadS MultiLayerStorage
ReadS [MultiLayerStorage]
(Int -> ReadS MultiLayerStorage)
-> ReadS [MultiLayerStorage]
-> ReadPrec MultiLayerStorage
-> ReadPrec [MultiLayerStorage]
-> Read MultiLayerStorage
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [MultiLayerStorage]
$creadListPrec :: ReadPrec [MultiLayerStorage]
readPrec :: ReadPrec MultiLayerStorage
$creadPrec :: ReadPrec MultiLayerStorage
readList :: ReadS [MultiLayerStorage]
$creadList :: ReadS [MultiLayerStorage]
readsPrec :: Int -> ReadS MultiLayerStorage
$creadsPrec :: Int -> ReadS MultiLayerStorage
Prelude.Read, Int -> MultiLayerStorage -> ShowS
[MultiLayerStorage] -> ShowS
MultiLayerStorage -> String
(Int -> MultiLayerStorage -> ShowS)
-> (MultiLayerStorage -> String)
-> ([MultiLayerStorage] -> ShowS)
-> Show MultiLayerStorage
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [MultiLayerStorage] -> ShowS
$cshowList :: [MultiLayerStorage] -> ShowS
show :: MultiLayerStorage -> String
$cshow :: MultiLayerStorage -> String
showsPrec :: Int -> MultiLayerStorage -> ShowS
$cshowsPrec :: Int -> MultiLayerStorage -> ShowS
Prelude.Show, (forall x. MultiLayerStorage -> Rep MultiLayerStorage x)
-> (forall x. Rep MultiLayerStorage x -> MultiLayerStorage)
-> Generic MultiLayerStorage
forall x. Rep MultiLayerStorage x -> MultiLayerStorage
forall x. MultiLayerStorage -> Rep MultiLayerStorage x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep MultiLayerStorage x -> MultiLayerStorage
$cfrom :: forall x. MultiLayerStorage -> Rep MultiLayerStorage x
Prelude.Generic)

-- |
-- Create a value of 'MultiLayerStorage' 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:
--
-- 'customerManagedS3Storage', 'multiLayerStorage_customerManagedS3Storage' - Contains information about a customer managed Amazon S3 bucket.
newMultiLayerStorage ::
  -- | 'customerManagedS3Storage'
  CustomerManagedS3Storage ->
  MultiLayerStorage
newMultiLayerStorage :: CustomerManagedS3Storage -> MultiLayerStorage
newMultiLayerStorage CustomerManagedS3Storage
pCustomerManagedS3Storage_ =
  MultiLayerStorage' :: CustomerManagedS3Storage -> MultiLayerStorage
MultiLayerStorage'
    { $sel:customerManagedS3Storage:MultiLayerStorage' :: CustomerManagedS3Storage
customerManagedS3Storage =
        CustomerManagedS3Storage
pCustomerManagedS3Storage_
    }

-- | Contains information about a customer managed Amazon S3 bucket.
multiLayerStorage_customerManagedS3Storage :: Lens.Lens' MultiLayerStorage CustomerManagedS3Storage
multiLayerStorage_customerManagedS3Storage :: (CustomerManagedS3Storage -> f CustomerManagedS3Storage)
-> MultiLayerStorage -> f MultiLayerStorage
multiLayerStorage_customerManagedS3Storage = (MultiLayerStorage -> CustomerManagedS3Storage)
-> (MultiLayerStorage
    -> CustomerManagedS3Storage -> MultiLayerStorage)
-> Lens
     MultiLayerStorage
     MultiLayerStorage
     CustomerManagedS3Storage
     CustomerManagedS3Storage
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MultiLayerStorage' {CustomerManagedS3Storage
customerManagedS3Storage :: CustomerManagedS3Storage
$sel:customerManagedS3Storage:MultiLayerStorage' :: MultiLayerStorage -> CustomerManagedS3Storage
customerManagedS3Storage} -> CustomerManagedS3Storage
customerManagedS3Storage) (\s :: MultiLayerStorage
s@MultiLayerStorage' {} CustomerManagedS3Storage
a -> MultiLayerStorage
s {$sel:customerManagedS3Storage:MultiLayerStorage' :: CustomerManagedS3Storage
customerManagedS3Storage = CustomerManagedS3Storage
a} :: MultiLayerStorage)

instance Core.FromJSON MultiLayerStorage where
  parseJSON :: Value -> Parser MultiLayerStorage
parseJSON =
    String
-> (Object -> Parser MultiLayerStorage)
-> Value
-> Parser MultiLayerStorage
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"MultiLayerStorage"
      ( \Object
x ->
          CustomerManagedS3Storage -> MultiLayerStorage
MultiLayerStorage'
            (CustomerManagedS3Storage -> MultiLayerStorage)
-> Parser CustomerManagedS3Storage -> Parser MultiLayerStorage
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser CustomerManagedS3Storage
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"customerManagedS3Storage")
      )

instance Prelude.Hashable MultiLayerStorage

instance Prelude.NFData MultiLayerStorage

instance Core.ToJSON MultiLayerStorage where
  toJSON :: MultiLayerStorage -> Value
toJSON MultiLayerStorage' {CustomerManagedS3Storage
customerManagedS3Storage :: CustomerManagedS3Storage
$sel:customerManagedS3Storage:MultiLayerStorage' :: MultiLayerStorage -> CustomerManagedS3Storage
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              ( Text
"customerManagedS3Storage"
                  Text -> CustomerManagedS3Storage -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= CustomerManagedS3Storage
customerManagedS3Storage
              )
          ]
      )