{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}
module Amazonka.Redshift.AssociateDataShareConsumer
(
AssociateDataShareConsumer (..),
newAssociateDataShareConsumer,
associateDataShareConsumer_associateEntireAccount,
associateDataShareConsumer_consumerArn,
associateDataShareConsumer_dataShareArn,
DataShare (..),
newDataShare,
dataShare_producerArn,
dataShare_dataShareAssociations,
dataShare_dataShareArn,
dataShare_allowPubliclyAccessibleConsumers,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.Redshift.Types
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data AssociateDataShareConsumer = AssociateDataShareConsumer'
{
AssociateDataShareConsumer -> Maybe Bool
associateEntireAccount :: Prelude.Maybe Prelude.Bool,
AssociateDataShareConsumer -> Maybe Text
consumerArn :: Prelude.Maybe Prelude.Text,
AssociateDataShareConsumer -> Text
dataShareArn :: Prelude.Text
}
deriving (AssociateDataShareConsumer -> AssociateDataShareConsumer -> Bool
(AssociateDataShareConsumer -> AssociateDataShareConsumer -> Bool)
-> (AssociateDataShareConsumer
-> AssociateDataShareConsumer -> Bool)
-> Eq AssociateDataShareConsumer
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AssociateDataShareConsumer -> AssociateDataShareConsumer -> Bool
$c/= :: AssociateDataShareConsumer -> AssociateDataShareConsumer -> Bool
== :: AssociateDataShareConsumer -> AssociateDataShareConsumer -> Bool
$c== :: AssociateDataShareConsumer -> AssociateDataShareConsumer -> Bool
Prelude.Eq, ReadPrec [AssociateDataShareConsumer]
ReadPrec AssociateDataShareConsumer
Int -> ReadS AssociateDataShareConsumer
ReadS [AssociateDataShareConsumer]
(Int -> ReadS AssociateDataShareConsumer)
-> ReadS [AssociateDataShareConsumer]
-> ReadPrec AssociateDataShareConsumer
-> ReadPrec [AssociateDataShareConsumer]
-> Read AssociateDataShareConsumer
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AssociateDataShareConsumer]
$creadListPrec :: ReadPrec [AssociateDataShareConsumer]
readPrec :: ReadPrec AssociateDataShareConsumer
$creadPrec :: ReadPrec AssociateDataShareConsumer
readList :: ReadS [AssociateDataShareConsumer]
$creadList :: ReadS [AssociateDataShareConsumer]
readsPrec :: Int -> ReadS AssociateDataShareConsumer
$creadsPrec :: Int -> ReadS AssociateDataShareConsumer
Prelude.Read, Int -> AssociateDataShareConsumer -> ShowS
[AssociateDataShareConsumer] -> ShowS
AssociateDataShareConsumer -> String
(Int -> AssociateDataShareConsumer -> ShowS)
-> (AssociateDataShareConsumer -> String)
-> ([AssociateDataShareConsumer] -> ShowS)
-> Show AssociateDataShareConsumer
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AssociateDataShareConsumer] -> ShowS
$cshowList :: [AssociateDataShareConsumer] -> ShowS
show :: AssociateDataShareConsumer -> String
$cshow :: AssociateDataShareConsumer -> String
showsPrec :: Int -> AssociateDataShareConsumer -> ShowS
$cshowsPrec :: Int -> AssociateDataShareConsumer -> ShowS
Prelude.Show, (forall x.
AssociateDataShareConsumer -> Rep AssociateDataShareConsumer x)
-> (forall x.
Rep AssociateDataShareConsumer x -> AssociateDataShareConsumer)
-> Generic AssociateDataShareConsumer
forall x.
Rep AssociateDataShareConsumer x -> AssociateDataShareConsumer
forall x.
AssociateDataShareConsumer -> Rep AssociateDataShareConsumer x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AssociateDataShareConsumer x -> AssociateDataShareConsumer
$cfrom :: forall x.
AssociateDataShareConsumer -> Rep AssociateDataShareConsumer x
Prelude.Generic)
newAssociateDataShareConsumer ::
Prelude.Text ->
AssociateDataShareConsumer
newAssociateDataShareConsumer :: Text -> AssociateDataShareConsumer
newAssociateDataShareConsumer Text
pDataShareArn_ =
AssociateDataShareConsumer' :: Maybe Bool -> Maybe Text -> Text -> AssociateDataShareConsumer
AssociateDataShareConsumer'
{ $sel:associateEntireAccount:AssociateDataShareConsumer' :: Maybe Bool
associateEntireAccount =
Maybe Bool
forall a. Maybe a
Prelude.Nothing,
$sel:consumerArn:AssociateDataShareConsumer' :: Maybe Text
consumerArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:dataShareArn:AssociateDataShareConsumer' :: Text
dataShareArn = Text
pDataShareArn_
}
associateDataShareConsumer_associateEntireAccount :: Lens.Lens' AssociateDataShareConsumer (Prelude.Maybe Prelude.Bool)
associateDataShareConsumer_associateEntireAccount :: (Maybe Bool -> f (Maybe Bool))
-> AssociateDataShareConsumer -> f AssociateDataShareConsumer
associateDataShareConsumer_associateEntireAccount = (AssociateDataShareConsumer -> Maybe Bool)
-> (AssociateDataShareConsumer
-> Maybe Bool -> AssociateDataShareConsumer)
-> Lens
AssociateDataShareConsumer
AssociateDataShareConsumer
(Maybe Bool)
(Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociateDataShareConsumer' {Maybe Bool
associateEntireAccount :: Maybe Bool
$sel:associateEntireAccount:AssociateDataShareConsumer' :: AssociateDataShareConsumer -> Maybe Bool
associateEntireAccount} -> Maybe Bool
associateEntireAccount) (\s :: AssociateDataShareConsumer
s@AssociateDataShareConsumer' {} Maybe Bool
a -> AssociateDataShareConsumer
s {$sel:associateEntireAccount:AssociateDataShareConsumer' :: Maybe Bool
associateEntireAccount = Maybe Bool
a} :: AssociateDataShareConsumer)
associateDataShareConsumer_consumerArn :: Lens.Lens' AssociateDataShareConsumer (Prelude.Maybe Prelude.Text)
associateDataShareConsumer_consumerArn :: (Maybe Text -> f (Maybe Text))
-> AssociateDataShareConsumer -> f AssociateDataShareConsumer
associateDataShareConsumer_consumerArn = (AssociateDataShareConsumer -> Maybe Text)
-> (AssociateDataShareConsumer
-> Maybe Text -> AssociateDataShareConsumer)
-> Lens
AssociateDataShareConsumer
AssociateDataShareConsumer
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociateDataShareConsumer' {Maybe Text
consumerArn :: Maybe Text
$sel:consumerArn:AssociateDataShareConsumer' :: AssociateDataShareConsumer -> Maybe Text
consumerArn} -> Maybe Text
consumerArn) (\s :: AssociateDataShareConsumer
s@AssociateDataShareConsumer' {} Maybe Text
a -> AssociateDataShareConsumer
s {$sel:consumerArn:AssociateDataShareConsumer' :: Maybe Text
consumerArn = Maybe Text
a} :: AssociateDataShareConsumer)
associateDataShareConsumer_dataShareArn :: Lens.Lens' AssociateDataShareConsumer Prelude.Text
associateDataShareConsumer_dataShareArn :: (Text -> f Text)
-> AssociateDataShareConsumer -> f AssociateDataShareConsumer
associateDataShareConsumer_dataShareArn = (AssociateDataShareConsumer -> Text)
-> (AssociateDataShareConsumer
-> Text -> AssociateDataShareConsumer)
-> Lens
AssociateDataShareConsumer AssociateDataShareConsumer Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociateDataShareConsumer' {Text
dataShareArn :: Text
$sel:dataShareArn:AssociateDataShareConsumer' :: AssociateDataShareConsumer -> Text
dataShareArn} -> Text
dataShareArn) (\s :: AssociateDataShareConsumer
s@AssociateDataShareConsumer' {} Text
a -> AssociateDataShareConsumer
s {$sel:dataShareArn:AssociateDataShareConsumer' :: Text
dataShareArn = Text
a} :: AssociateDataShareConsumer)
instance Core.AWSRequest AssociateDataShareConsumer where
type
AWSResponse AssociateDataShareConsumer =
DataShare
request :: AssociateDataShareConsumer -> Request AssociateDataShareConsumer
request = Service
-> AssociateDataShareConsumer -> Request AssociateDataShareConsumer
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
response :: Logger
-> Service
-> Proxy AssociateDataShareConsumer
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse AssociateDataShareConsumer)))
response =
Text
-> (Int
-> ResponseHeaders
-> [Node]
-> Either String (AWSResponse AssociateDataShareConsumer))
-> Logger
-> Service
-> Proxy AssociateDataShareConsumer
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse AssociateDataShareConsumer)))
forall (m :: * -> *) a.
MonadResource m =>
Text
-> (Int
-> ResponseHeaders -> [Node] -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveXMLWrapper
Text
"AssociateDataShareConsumerResult"
(\Int
s ResponseHeaders
h [Node]
x -> [Node] -> Either String DataShare
forall a. FromXML a => [Node] -> Either String a
Core.parseXML [Node]
x)
instance Prelude.Hashable AssociateDataShareConsumer
instance Prelude.NFData AssociateDataShareConsumer
instance Core.ToHeaders AssociateDataShareConsumer where
toHeaders :: AssociateDataShareConsumer -> ResponseHeaders
toHeaders = ResponseHeaders -> AssociateDataShareConsumer -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToPath AssociateDataShareConsumer where
toPath :: AssociateDataShareConsumer -> ByteString
toPath = ByteString -> AssociateDataShareConsumer -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery AssociateDataShareConsumer where
toQuery :: AssociateDataShareConsumer -> QueryString
toQuery AssociateDataShareConsumer' {Maybe Bool
Maybe Text
Text
dataShareArn :: Text
consumerArn :: Maybe Text
associateEntireAccount :: Maybe Bool
$sel:dataShareArn:AssociateDataShareConsumer' :: AssociateDataShareConsumer -> Text
$sel:consumerArn:AssociateDataShareConsumer' :: AssociateDataShareConsumer -> Maybe Text
$sel:associateEntireAccount:AssociateDataShareConsumer' :: AssociateDataShareConsumer -> Maybe Bool
..} =
[QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"Action"
ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"AssociateDataShareConsumer" :: Prelude.ByteString),
ByteString
"Version"
ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2012-12-01" :: Prelude.ByteString),
ByteString
"AssociateEntireAccount"
ByteString -> Maybe Bool -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Bool
associateEntireAccount,
ByteString
"ConsumerArn" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
consumerArn,
ByteString
"DataShareArn" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
dataShareArn
]