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

import qualified Amazonka.Core as Core
import Amazonka.IoTAnalytics.Types.CustomerManagedChannelS3StorageSummary
import Amazonka.IoTAnalytics.Types.ServiceManagedChannelS3StorageSummary
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Where channel data is stored.
--
-- /See:/ 'newChannelStorageSummary' smart constructor.
data ChannelStorageSummary = ChannelStorageSummary'
  { -- | Used to store channel data in an S3 bucket managed by IoT Analytics.
    ChannelStorageSummary
-> Maybe ServiceManagedChannelS3StorageSummary
serviceManagedS3 :: Prelude.Maybe ServiceManagedChannelS3StorageSummary,
    -- | Used to store channel data in an S3 bucket that you manage.
    ChannelStorageSummary
-> Maybe CustomerManagedChannelS3StorageSummary
customerManagedS3 :: Prelude.Maybe CustomerManagedChannelS3StorageSummary
  }
  deriving (ChannelStorageSummary -> ChannelStorageSummary -> Bool
(ChannelStorageSummary -> ChannelStorageSummary -> Bool)
-> (ChannelStorageSummary -> ChannelStorageSummary -> Bool)
-> Eq ChannelStorageSummary
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ChannelStorageSummary -> ChannelStorageSummary -> Bool
$c/= :: ChannelStorageSummary -> ChannelStorageSummary -> Bool
== :: ChannelStorageSummary -> ChannelStorageSummary -> Bool
$c== :: ChannelStorageSummary -> ChannelStorageSummary -> Bool
Prelude.Eq, ReadPrec [ChannelStorageSummary]
ReadPrec ChannelStorageSummary
Int -> ReadS ChannelStorageSummary
ReadS [ChannelStorageSummary]
(Int -> ReadS ChannelStorageSummary)
-> ReadS [ChannelStorageSummary]
-> ReadPrec ChannelStorageSummary
-> ReadPrec [ChannelStorageSummary]
-> Read ChannelStorageSummary
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ChannelStorageSummary]
$creadListPrec :: ReadPrec [ChannelStorageSummary]
readPrec :: ReadPrec ChannelStorageSummary
$creadPrec :: ReadPrec ChannelStorageSummary
readList :: ReadS [ChannelStorageSummary]
$creadList :: ReadS [ChannelStorageSummary]
readsPrec :: Int -> ReadS ChannelStorageSummary
$creadsPrec :: Int -> ReadS ChannelStorageSummary
Prelude.Read, Int -> ChannelStorageSummary -> ShowS
[ChannelStorageSummary] -> ShowS
ChannelStorageSummary -> String
(Int -> ChannelStorageSummary -> ShowS)
-> (ChannelStorageSummary -> String)
-> ([ChannelStorageSummary] -> ShowS)
-> Show ChannelStorageSummary
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ChannelStorageSummary] -> ShowS
$cshowList :: [ChannelStorageSummary] -> ShowS
show :: ChannelStorageSummary -> String
$cshow :: ChannelStorageSummary -> String
showsPrec :: Int -> ChannelStorageSummary -> ShowS
$cshowsPrec :: Int -> ChannelStorageSummary -> ShowS
Prelude.Show, (forall x. ChannelStorageSummary -> Rep ChannelStorageSummary x)
-> (forall x. Rep ChannelStorageSummary x -> ChannelStorageSummary)
-> Generic ChannelStorageSummary
forall x. Rep ChannelStorageSummary x -> ChannelStorageSummary
forall x. ChannelStorageSummary -> Rep ChannelStorageSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ChannelStorageSummary x -> ChannelStorageSummary
$cfrom :: forall x. ChannelStorageSummary -> Rep ChannelStorageSummary x
Prelude.Generic)

-- |
-- Create a value of 'ChannelStorageSummary' 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:
--
-- 'serviceManagedS3', 'channelStorageSummary_serviceManagedS3' - Used to store channel data in an S3 bucket managed by IoT Analytics.
--
-- 'customerManagedS3', 'channelStorageSummary_customerManagedS3' - Used to store channel data in an S3 bucket that you manage.
newChannelStorageSummary ::
  ChannelStorageSummary
newChannelStorageSummary :: ChannelStorageSummary
newChannelStorageSummary =
  ChannelStorageSummary' :: Maybe ServiceManagedChannelS3StorageSummary
-> Maybe CustomerManagedChannelS3StorageSummary
-> ChannelStorageSummary
ChannelStorageSummary'
    { $sel:serviceManagedS3:ChannelStorageSummary' :: Maybe ServiceManagedChannelS3StorageSummary
serviceManagedS3 =
        Maybe ServiceManagedChannelS3StorageSummary
forall a. Maybe a
Prelude.Nothing,
      $sel:customerManagedS3:ChannelStorageSummary' :: Maybe CustomerManagedChannelS3StorageSummary
customerManagedS3 = Maybe CustomerManagedChannelS3StorageSummary
forall a. Maybe a
Prelude.Nothing
    }

-- | Used to store channel data in an S3 bucket managed by IoT Analytics.
channelStorageSummary_serviceManagedS3 :: Lens.Lens' ChannelStorageSummary (Prelude.Maybe ServiceManagedChannelS3StorageSummary)
channelStorageSummary_serviceManagedS3 :: (Maybe ServiceManagedChannelS3StorageSummary
 -> f (Maybe ServiceManagedChannelS3StorageSummary))
-> ChannelStorageSummary -> f ChannelStorageSummary
channelStorageSummary_serviceManagedS3 = (ChannelStorageSummary
 -> Maybe ServiceManagedChannelS3StorageSummary)
-> (ChannelStorageSummary
    -> Maybe ServiceManagedChannelS3StorageSummary
    -> ChannelStorageSummary)
-> Lens
     ChannelStorageSummary
     ChannelStorageSummary
     (Maybe ServiceManagedChannelS3StorageSummary)
     (Maybe ServiceManagedChannelS3StorageSummary)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ChannelStorageSummary' {Maybe ServiceManagedChannelS3StorageSummary
serviceManagedS3 :: Maybe ServiceManagedChannelS3StorageSummary
$sel:serviceManagedS3:ChannelStorageSummary' :: ChannelStorageSummary
-> Maybe ServiceManagedChannelS3StorageSummary
serviceManagedS3} -> Maybe ServiceManagedChannelS3StorageSummary
serviceManagedS3) (\s :: ChannelStorageSummary
s@ChannelStorageSummary' {} Maybe ServiceManagedChannelS3StorageSummary
a -> ChannelStorageSummary
s {$sel:serviceManagedS3:ChannelStorageSummary' :: Maybe ServiceManagedChannelS3StorageSummary
serviceManagedS3 = Maybe ServiceManagedChannelS3StorageSummary
a} :: ChannelStorageSummary)

-- | Used to store channel data in an S3 bucket that you manage.
channelStorageSummary_customerManagedS3 :: Lens.Lens' ChannelStorageSummary (Prelude.Maybe CustomerManagedChannelS3StorageSummary)
channelStorageSummary_customerManagedS3 :: (Maybe CustomerManagedChannelS3StorageSummary
 -> f (Maybe CustomerManagedChannelS3StorageSummary))
-> ChannelStorageSummary -> f ChannelStorageSummary
channelStorageSummary_customerManagedS3 = (ChannelStorageSummary
 -> Maybe CustomerManagedChannelS3StorageSummary)
-> (ChannelStorageSummary
    -> Maybe CustomerManagedChannelS3StorageSummary
    -> ChannelStorageSummary)
-> Lens
     ChannelStorageSummary
     ChannelStorageSummary
     (Maybe CustomerManagedChannelS3StorageSummary)
     (Maybe CustomerManagedChannelS3StorageSummary)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ChannelStorageSummary' {Maybe CustomerManagedChannelS3StorageSummary
customerManagedS3 :: Maybe CustomerManagedChannelS3StorageSummary
$sel:customerManagedS3:ChannelStorageSummary' :: ChannelStorageSummary
-> Maybe CustomerManagedChannelS3StorageSummary
customerManagedS3} -> Maybe CustomerManagedChannelS3StorageSummary
customerManagedS3) (\s :: ChannelStorageSummary
s@ChannelStorageSummary' {} Maybe CustomerManagedChannelS3StorageSummary
a -> ChannelStorageSummary
s {$sel:customerManagedS3:ChannelStorageSummary' :: Maybe CustomerManagedChannelS3StorageSummary
customerManagedS3 = Maybe CustomerManagedChannelS3StorageSummary
a} :: ChannelStorageSummary)

instance Core.FromJSON ChannelStorageSummary where
  parseJSON :: Value -> Parser ChannelStorageSummary
parseJSON =
    String
-> (Object -> Parser ChannelStorageSummary)
-> Value
-> Parser ChannelStorageSummary
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ChannelStorageSummary"
      ( \Object
x ->
          Maybe ServiceManagedChannelS3StorageSummary
-> Maybe CustomerManagedChannelS3StorageSummary
-> ChannelStorageSummary
ChannelStorageSummary'
            (Maybe ServiceManagedChannelS3StorageSummary
 -> Maybe CustomerManagedChannelS3StorageSummary
 -> ChannelStorageSummary)
-> Parser (Maybe ServiceManagedChannelS3StorageSummary)
-> Parser
     (Maybe CustomerManagedChannelS3StorageSummary
      -> ChannelStorageSummary)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object
-> Text -> Parser (Maybe ServiceManagedChannelS3StorageSummary)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"serviceManagedS3")
            Parser
  (Maybe CustomerManagedChannelS3StorageSummary
   -> ChannelStorageSummary)
-> Parser (Maybe CustomerManagedChannelS3StorageSummary)
-> Parser ChannelStorageSummary
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object
-> Text -> Parser (Maybe CustomerManagedChannelS3StorageSummary)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"customerManagedS3")
      )

instance Prelude.Hashable ChannelStorageSummary

instance Prelude.NFData ChannelStorageSummary