{-# 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.DataExchange.Types.AssetDetails
-- 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.DataExchange.Types.AssetDetails where

import qualified Amazonka.Core as Core
import Amazonka.DataExchange.Types.RedshiftDataShareAsset
import Amazonka.DataExchange.Types.S3SnapshotAsset
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Information about the asset.
--
-- /See:/ 'newAssetDetails' smart constructor.
data AssetDetails = AssetDetails'
  { -- | The S3 object that is the asset.
    AssetDetails -> Maybe S3SnapshotAsset
s3SnapshotAsset :: Prelude.Maybe S3SnapshotAsset,
    -- | The Amazon Redshift datashare that is the asset.
    AssetDetails -> Maybe RedshiftDataShareAsset
redshiftDataShareAsset :: Prelude.Maybe RedshiftDataShareAsset
  }
  deriving (AssetDetails -> AssetDetails -> Bool
(AssetDetails -> AssetDetails -> Bool)
-> (AssetDetails -> AssetDetails -> Bool) -> Eq AssetDetails
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AssetDetails -> AssetDetails -> Bool
$c/= :: AssetDetails -> AssetDetails -> Bool
== :: AssetDetails -> AssetDetails -> Bool
$c== :: AssetDetails -> AssetDetails -> Bool
Prelude.Eq, ReadPrec [AssetDetails]
ReadPrec AssetDetails
Int -> ReadS AssetDetails
ReadS [AssetDetails]
(Int -> ReadS AssetDetails)
-> ReadS [AssetDetails]
-> ReadPrec AssetDetails
-> ReadPrec [AssetDetails]
-> Read AssetDetails
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AssetDetails]
$creadListPrec :: ReadPrec [AssetDetails]
readPrec :: ReadPrec AssetDetails
$creadPrec :: ReadPrec AssetDetails
readList :: ReadS [AssetDetails]
$creadList :: ReadS [AssetDetails]
readsPrec :: Int -> ReadS AssetDetails
$creadsPrec :: Int -> ReadS AssetDetails
Prelude.Read, Int -> AssetDetails -> ShowS
[AssetDetails] -> ShowS
AssetDetails -> String
(Int -> AssetDetails -> ShowS)
-> (AssetDetails -> String)
-> ([AssetDetails] -> ShowS)
-> Show AssetDetails
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AssetDetails] -> ShowS
$cshowList :: [AssetDetails] -> ShowS
show :: AssetDetails -> String
$cshow :: AssetDetails -> String
showsPrec :: Int -> AssetDetails -> ShowS
$cshowsPrec :: Int -> AssetDetails -> ShowS
Prelude.Show, (forall x. AssetDetails -> Rep AssetDetails x)
-> (forall x. Rep AssetDetails x -> AssetDetails)
-> Generic AssetDetails
forall x. Rep AssetDetails x -> AssetDetails
forall x. AssetDetails -> Rep AssetDetails x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AssetDetails x -> AssetDetails
$cfrom :: forall x. AssetDetails -> Rep AssetDetails x
Prelude.Generic)

-- |
-- Create a value of 'AssetDetails' 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:
--
-- 's3SnapshotAsset', 'assetDetails_s3SnapshotAsset' - The S3 object that is the asset.
--
-- 'redshiftDataShareAsset', 'assetDetails_redshiftDataShareAsset' - The Amazon Redshift datashare that is the asset.
newAssetDetails ::
  AssetDetails
newAssetDetails :: AssetDetails
newAssetDetails =
  AssetDetails' :: Maybe S3SnapshotAsset
-> Maybe RedshiftDataShareAsset -> AssetDetails
AssetDetails'
    { $sel:s3SnapshotAsset:AssetDetails' :: Maybe S3SnapshotAsset
s3SnapshotAsset = Maybe S3SnapshotAsset
forall a. Maybe a
Prelude.Nothing,
      $sel:redshiftDataShareAsset:AssetDetails' :: Maybe RedshiftDataShareAsset
redshiftDataShareAsset = Maybe RedshiftDataShareAsset
forall a. Maybe a
Prelude.Nothing
    }

-- | The S3 object that is the asset.
assetDetails_s3SnapshotAsset :: Lens.Lens' AssetDetails (Prelude.Maybe S3SnapshotAsset)
assetDetails_s3SnapshotAsset :: (Maybe S3SnapshotAsset -> f (Maybe S3SnapshotAsset))
-> AssetDetails -> f AssetDetails
assetDetails_s3SnapshotAsset = (AssetDetails -> Maybe S3SnapshotAsset)
-> (AssetDetails -> Maybe S3SnapshotAsset -> AssetDetails)
-> Lens
     AssetDetails
     AssetDetails
     (Maybe S3SnapshotAsset)
     (Maybe S3SnapshotAsset)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssetDetails' {Maybe S3SnapshotAsset
s3SnapshotAsset :: Maybe S3SnapshotAsset
$sel:s3SnapshotAsset:AssetDetails' :: AssetDetails -> Maybe S3SnapshotAsset
s3SnapshotAsset} -> Maybe S3SnapshotAsset
s3SnapshotAsset) (\s :: AssetDetails
s@AssetDetails' {} Maybe S3SnapshotAsset
a -> AssetDetails
s {$sel:s3SnapshotAsset:AssetDetails' :: Maybe S3SnapshotAsset
s3SnapshotAsset = Maybe S3SnapshotAsset
a} :: AssetDetails)

-- | The Amazon Redshift datashare that is the asset.
assetDetails_redshiftDataShareAsset :: Lens.Lens' AssetDetails (Prelude.Maybe RedshiftDataShareAsset)
assetDetails_redshiftDataShareAsset :: (Maybe RedshiftDataShareAsset -> f (Maybe RedshiftDataShareAsset))
-> AssetDetails -> f AssetDetails
assetDetails_redshiftDataShareAsset = (AssetDetails -> Maybe RedshiftDataShareAsset)
-> (AssetDetails -> Maybe RedshiftDataShareAsset -> AssetDetails)
-> Lens
     AssetDetails
     AssetDetails
     (Maybe RedshiftDataShareAsset)
     (Maybe RedshiftDataShareAsset)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssetDetails' {Maybe RedshiftDataShareAsset
redshiftDataShareAsset :: Maybe RedshiftDataShareAsset
$sel:redshiftDataShareAsset:AssetDetails' :: AssetDetails -> Maybe RedshiftDataShareAsset
redshiftDataShareAsset} -> Maybe RedshiftDataShareAsset
redshiftDataShareAsset) (\s :: AssetDetails
s@AssetDetails' {} Maybe RedshiftDataShareAsset
a -> AssetDetails
s {$sel:redshiftDataShareAsset:AssetDetails' :: Maybe RedshiftDataShareAsset
redshiftDataShareAsset = Maybe RedshiftDataShareAsset
a} :: AssetDetails)

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

instance Prelude.Hashable AssetDetails

instance Prelude.NFData AssetDetails