{-# 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 #-}
module Amazonka.Redshift.Types.DataShare where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.Redshift.Internal
import Amazonka.Redshift.Types.DataShareAssociation
data DataShare = DataShare'
{
DataShare -> Maybe Text
producerArn :: Prelude.Maybe Prelude.Text,
DataShare -> Maybe [DataShareAssociation]
dataShareAssociations :: Prelude.Maybe [DataShareAssociation],
DataShare -> Maybe Text
dataShareArn :: Prelude.Maybe Prelude.Text,
DataShare -> Maybe Bool
allowPubliclyAccessibleConsumers :: Prelude.Maybe Prelude.Bool
}
deriving (DataShare -> DataShare -> Bool
(DataShare -> DataShare -> Bool)
-> (DataShare -> DataShare -> Bool) -> Eq DataShare
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DataShare -> DataShare -> Bool
$c/= :: DataShare -> DataShare -> Bool
== :: DataShare -> DataShare -> Bool
$c== :: DataShare -> DataShare -> Bool
Prelude.Eq, ReadPrec [DataShare]
ReadPrec DataShare
Int -> ReadS DataShare
ReadS [DataShare]
(Int -> ReadS DataShare)
-> ReadS [DataShare]
-> ReadPrec DataShare
-> ReadPrec [DataShare]
-> Read DataShare
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DataShare]
$creadListPrec :: ReadPrec [DataShare]
readPrec :: ReadPrec DataShare
$creadPrec :: ReadPrec DataShare
readList :: ReadS [DataShare]
$creadList :: ReadS [DataShare]
readsPrec :: Int -> ReadS DataShare
$creadsPrec :: Int -> ReadS DataShare
Prelude.Read, Int -> DataShare -> ShowS
[DataShare] -> ShowS
DataShare -> String
(Int -> DataShare -> ShowS)
-> (DataShare -> String)
-> ([DataShare] -> ShowS)
-> Show DataShare
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DataShare] -> ShowS
$cshowList :: [DataShare] -> ShowS
show :: DataShare -> String
$cshow :: DataShare -> String
showsPrec :: Int -> DataShare -> ShowS
$cshowsPrec :: Int -> DataShare -> ShowS
Prelude.Show, (forall x. DataShare -> Rep DataShare x)
-> (forall x. Rep DataShare x -> DataShare) -> Generic DataShare
forall x. Rep DataShare x -> DataShare
forall x. DataShare -> Rep DataShare x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DataShare x -> DataShare
$cfrom :: forall x. DataShare -> Rep DataShare x
Prelude.Generic)
newDataShare ::
DataShare
newDataShare :: DataShare
newDataShare =
DataShare' :: Maybe Text
-> Maybe [DataShareAssociation]
-> Maybe Text
-> Maybe Bool
-> DataShare
DataShare'
{ $sel:producerArn:DataShare' :: Maybe Text
producerArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:dataShareAssociations:DataShare' :: Maybe [DataShareAssociation]
dataShareAssociations = Maybe [DataShareAssociation]
forall a. Maybe a
Prelude.Nothing,
$sel:dataShareArn:DataShare' :: Maybe Text
dataShareArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:allowPubliclyAccessibleConsumers:DataShare' :: Maybe Bool
allowPubliclyAccessibleConsumers = Maybe Bool
forall a. Maybe a
Prelude.Nothing
}
dataShare_producerArn :: Lens.Lens' DataShare (Prelude.Maybe Prelude.Text)
dataShare_producerArn :: (Maybe Text -> f (Maybe Text)) -> DataShare -> f DataShare
dataShare_producerArn = (DataShare -> Maybe Text)
-> (DataShare -> Maybe Text -> DataShare)
-> Lens DataShare DataShare (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DataShare' {Maybe Text
producerArn :: Maybe Text
$sel:producerArn:DataShare' :: DataShare -> Maybe Text
producerArn} -> Maybe Text
producerArn) (\s :: DataShare
s@DataShare' {} Maybe Text
a -> DataShare
s {$sel:producerArn:DataShare' :: Maybe Text
producerArn = Maybe Text
a} :: DataShare)
dataShare_dataShareAssociations :: Lens.Lens' DataShare (Prelude.Maybe [DataShareAssociation])
dataShare_dataShareAssociations :: (Maybe [DataShareAssociation] -> f (Maybe [DataShareAssociation]))
-> DataShare -> f DataShare
dataShare_dataShareAssociations = (DataShare -> Maybe [DataShareAssociation])
-> (DataShare -> Maybe [DataShareAssociation] -> DataShare)
-> Lens
DataShare
DataShare
(Maybe [DataShareAssociation])
(Maybe [DataShareAssociation])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DataShare' {Maybe [DataShareAssociation]
dataShareAssociations :: Maybe [DataShareAssociation]
$sel:dataShareAssociations:DataShare' :: DataShare -> Maybe [DataShareAssociation]
dataShareAssociations} -> Maybe [DataShareAssociation]
dataShareAssociations) (\s :: DataShare
s@DataShare' {} Maybe [DataShareAssociation]
a -> DataShare
s {$sel:dataShareAssociations:DataShare' :: Maybe [DataShareAssociation]
dataShareAssociations = Maybe [DataShareAssociation]
a} :: DataShare) ((Maybe [DataShareAssociation] -> f (Maybe [DataShareAssociation]))
-> DataShare -> f DataShare)
-> ((Maybe [DataShareAssociation]
-> f (Maybe [DataShareAssociation]))
-> Maybe [DataShareAssociation]
-> f (Maybe [DataShareAssociation]))
-> (Maybe [DataShareAssociation]
-> f (Maybe [DataShareAssociation]))
-> DataShare
-> f DataShare
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
[DataShareAssociation]
[DataShareAssociation]
[DataShareAssociation]
[DataShareAssociation]
-> Iso
(Maybe [DataShareAssociation])
(Maybe [DataShareAssociation])
(Maybe [DataShareAssociation])
(Maybe [DataShareAssociation])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
[DataShareAssociation]
[DataShareAssociation]
[DataShareAssociation]
[DataShareAssociation]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
dataShare_dataShareArn :: Lens.Lens' DataShare (Prelude.Maybe Prelude.Text)
dataShare_dataShareArn :: (Maybe Text -> f (Maybe Text)) -> DataShare -> f DataShare
dataShare_dataShareArn = (DataShare -> Maybe Text)
-> (DataShare -> Maybe Text -> DataShare)
-> Lens DataShare DataShare (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DataShare' {Maybe Text
dataShareArn :: Maybe Text
$sel:dataShareArn:DataShare' :: DataShare -> Maybe Text
dataShareArn} -> Maybe Text
dataShareArn) (\s :: DataShare
s@DataShare' {} Maybe Text
a -> DataShare
s {$sel:dataShareArn:DataShare' :: Maybe Text
dataShareArn = Maybe Text
a} :: DataShare)
dataShare_allowPubliclyAccessibleConsumers :: Lens.Lens' DataShare (Prelude.Maybe Prelude.Bool)
dataShare_allowPubliclyAccessibleConsumers :: (Maybe Bool -> f (Maybe Bool)) -> DataShare -> f DataShare
dataShare_allowPubliclyAccessibleConsumers = (DataShare -> Maybe Bool)
-> (DataShare -> Maybe Bool -> DataShare)
-> Lens DataShare DataShare (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DataShare' {Maybe Bool
allowPubliclyAccessibleConsumers :: Maybe Bool
$sel:allowPubliclyAccessibleConsumers:DataShare' :: DataShare -> Maybe Bool
allowPubliclyAccessibleConsumers} -> Maybe Bool
allowPubliclyAccessibleConsumers) (\s :: DataShare
s@DataShare' {} Maybe Bool
a -> DataShare
s {$sel:allowPubliclyAccessibleConsumers:DataShare' :: Maybe Bool
allowPubliclyAccessibleConsumers = Maybe Bool
a} :: DataShare)
instance Core.FromXML DataShare where
parseXML :: [Node] -> Either String DataShare
parseXML [Node]
x =
Maybe Text
-> Maybe [DataShareAssociation]
-> Maybe Text
-> Maybe Bool
-> DataShare
DataShare'
(Maybe Text
-> Maybe [DataShareAssociation]
-> Maybe Text
-> Maybe Bool
-> DataShare)
-> Either String (Maybe Text)
-> Either
String
(Maybe [DataShareAssociation]
-> Maybe Text -> Maybe Bool -> DataShare)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"ProducerArn")
Either
String
(Maybe [DataShareAssociation]
-> Maybe Text -> Maybe Bool -> DataShare)
-> Either String (Maybe [DataShareAssociation])
-> Either String (Maybe Text -> Maybe Bool -> DataShare)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( [Node]
x [Node] -> Text -> Either String (Maybe [Node])
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"DataShareAssociations"
Either String (Maybe [Node]) -> [Node] -> Either String [Node]
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ [Node]
forall a. Monoid a => a
Prelude.mempty
Either String [Node]
-> ([Node] -> Either String (Maybe [DataShareAssociation]))
-> Either String (Maybe [DataShareAssociation])
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= ([Node] -> Either String [DataShareAssociation])
-> [Node] -> Either String (Maybe [DataShareAssociation])
forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (Text -> [Node] -> Either String [DataShareAssociation]
forall a. FromXML a => Text -> [Node] -> Either String [a]
Core.parseXMLList Text
"member")
)
Either String (Maybe Text -> Maybe Bool -> DataShare)
-> Either String (Maybe Text)
-> Either String (Maybe Bool -> DataShare)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"DataShareArn")
Either String (Maybe Bool -> DataShare)
-> Either String (Maybe Bool) -> Either String DataShare
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Bool)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"AllowPubliclyAccessibleConsumers")
instance Prelude.Hashable DataShare
instance Prelude.NFData DataShare