{-# 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.RedshiftDataShareAssetSourceEntry
-- 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.RedshiftDataShareAssetSourceEntry where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | The source of the Amazon Redshift datashare asset.
--
-- /See:/ 'newRedshiftDataShareAssetSourceEntry' smart constructor.
data RedshiftDataShareAssetSourceEntry = RedshiftDataShareAssetSourceEntry'
  { -- | The Amazon Resource Name (ARN) of the datashare asset.
    RedshiftDataShareAssetSourceEntry -> Text
dataShareArn :: Prelude.Text
  }
  deriving (RedshiftDataShareAssetSourceEntry
-> RedshiftDataShareAssetSourceEntry -> Bool
(RedshiftDataShareAssetSourceEntry
 -> RedshiftDataShareAssetSourceEntry -> Bool)
-> (RedshiftDataShareAssetSourceEntry
    -> RedshiftDataShareAssetSourceEntry -> Bool)
-> Eq RedshiftDataShareAssetSourceEntry
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RedshiftDataShareAssetSourceEntry
-> RedshiftDataShareAssetSourceEntry -> Bool
$c/= :: RedshiftDataShareAssetSourceEntry
-> RedshiftDataShareAssetSourceEntry -> Bool
== :: RedshiftDataShareAssetSourceEntry
-> RedshiftDataShareAssetSourceEntry -> Bool
$c== :: RedshiftDataShareAssetSourceEntry
-> RedshiftDataShareAssetSourceEntry -> Bool
Prelude.Eq, ReadPrec [RedshiftDataShareAssetSourceEntry]
ReadPrec RedshiftDataShareAssetSourceEntry
Int -> ReadS RedshiftDataShareAssetSourceEntry
ReadS [RedshiftDataShareAssetSourceEntry]
(Int -> ReadS RedshiftDataShareAssetSourceEntry)
-> ReadS [RedshiftDataShareAssetSourceEntry]
-> ReadPrec RedshiftDataShareAssetSourceEntry
-> ReadPrec [RedshiftDataShareAssetSourceEntry]
-> Read RedshiftDataShareAssetSourceEntry
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RedshiftDataShareAssetSourceEntry]
$creadListPrec :: ReadPrec [RedshiftDataShareAssetSourceEntry]
readPrec :: ReadPrec RedshiftDataShareAssetSourceEntry
$creadPrec :: ReadPrec RedshiftDataShareAssetSourceEntry
readList :: ReadS [RedshiftDataShareAssetSourceEntry]
$creadList :: ReadS [RedshiftDataShareAssetSourceEntry]
readsPrec :: Int -> ReadS RedshiftDataShareAssetSourceEntry
$creadsPrec :: Int -> ReadS RedshiftDataShareAssetSourceEntry
Prelude.Read, Int -> RedshiftDataShareAssetSourceEntry -> ShowS
[RedshiftDataShareAssetSourceEntry] -> ShowS
RedshiftDataShareAssetSourceEntry -> String
(Int -> RedshiftDataShareAssetSourceEntry -> ShowS)
-> (RedshiftDataShareAssetSourceEntry -> String)
-> ([RedshiftDataShareAssetSourceEntry] -> ShowS)
-> Show RedshiftDataShareAssetSourceEntry
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RedshiftDataShareAssetSourceEntry] -> ShowS
$cshowList :: [RedshiftDataShareAssetSourceEntry] -> ShowS
show :: RedshiftDataShareAssetSourceEntry -> String
$cshow :: RedshiftDataShareAssetSourceEntry -> String
showsPrec :: Int -> RedshiftDataShareAssetSourceEntry -> ShowS
$cshowsPrec :: Int -> RedshiftDataShareAssetSourceEntry -> ShowS
Prelude.Show, (forall x.
 RedshiftDataShareAssetSourceEntry
 -> Rep RedshiftDataShareAssetSourceEntry x)
-> (forall x.
    Rep RedshiftDataShareAssetSourceEntry x
    -> RedshiftDataShareAssetSourceEntry)
-> Generic RedshiftDataShareAssetSourceEntry
forall x.
Rep RedshiftDataShareAssetSourceEntry x
-> RedshiftDataShareAssetSourceEntry
forall x.
RedshiftDataShareAssetSourceEntry
-> Rep RedshiftDataShareAssetSourceEntry x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep RedshiftDataShareAssetSourceEntry x
-> RedshiftDataShareAssetSourceEntry
$cfrom :: forall x.
RedshiftDataShareAssetSourceEntry
-> Rep RedshiftDataShareAssetSourceEntry x
Prelude.Generic)

-- |
-- Create a value of 'RedshiftDataShareAssetSourceEntry' 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:
--
-- 'dataShareArn', 'redshiftDataShareAssetSourceEntry_dataShareArn' - The Amazon Resource Name (ARN) of the datashare asset.
newRedshiftDataShareAssetSourceEntry ::
  -- | 'dataShareArn'
  Prelude.Text ->
  RedshiftDataShareAssetSourceEntry
newRedshiftDataShareAssetSourceEntry :: Text -> RedshiftDataShareAssetSourceEntry
newRedshiftDataShareAssetSourceEntry Text
pDataShareArn_ =
  RedshiftDataShareAssetSourceEntry' :: Text -> RedshiftDataShareAssetSourceEntry
RedshiftDataShareAssetSourceEntry'
    { $sel:dataShareArn:RedshiftDataShareAssetSourceEntry' :: Text
dataShareArn =
        Text
pDataShareArn_
    }

-- | The Amazon Resource Name (ARN) of the datashare asset.
redshiftDataShareAssetSourceEntry_dataShareArn :: Lens.Lens' RedshiftDataShareAssetSourceEntry Prelude.Text
redshiftDataShareAssetSourceEntry_dataShareArn :: (Text -> f Text)
-> RedshiftDataShareAssetSourceEntry
-> f RedshiftDataShareAssetSourceEntry
redshiftDataShareAssetSourceEntry_dataShareArn = (RedshiftDataShareAssetSourceEntry -> Text)
-> (RedshiftDataShareAssetSourceEntry
    -> Text -> RedshiftDataShareAssetSourceEntry)
-> Lens
     RedshiftDataShareAssetSourceEntry
     RedshiftDataShareAssetSourceEntry
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RedshiftDataShareAssetSourceEntry' {Text
dataShareArn :: Text
$sel:dataShareArn:RedshiftDataShareAssetSourceEntry' :: RedshiftDataShareAssetSourceEntry -> Text
dataShareArn} -> Text
dataShareArn) (\s :: RedshiftDataShareAssetSourceEntry
s@RedshiftDataShareAssetSourceEntry' {} Text
a -> RedshiftDataShareAssetSourceEntry
s {$sel:dataShareArn:RedshiftDataShareAssetSourceEntry' :: Text
dataShareArn = Text
a} :: RedshiftDataShareAssetSourceEntry)

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

instance
  Prelude.Hashable
    RedshiftDataShareAssetSourceEntry

instance
  Prelude.NFData
    RedshiftDataShareAssetSourceEntry

instance
  Core.ToJSON
    RedshiftDataShareAssetSourceEntry
  where
  toJSON :: RedshiftDataShareAssetSourceEntry -> Value
toJSON RedshiftDataShareAssetSourceEntry' {Text
dataShareArn :: Text
$sel:dataShareArn:RedshiftDataShareAssetSourceEntry' :: RedshiftDataShareAssetSourceEntry -> Text
..} =
    [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
"DataShareArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
dataShareArn)]
      )