{-# 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.DescribeDataShares
(
DescribeDataShares (..),
newDescribeDataShares,
describeDataShares_marker,
describeDataShares_maxRecords,
describeDataShares_dataShareArn,
DescribeDataSharesResponse (..),
newDescribeDataSharesResponse,
describeDataSharesResponse_marker,
describeDataSharesResponse_dataShares,
describeDataSharesResponse_httpStatus,
)
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 DescribeDataShares = DescribeDataShares'
{
DescribeDataShares -> Maybe Text
marker :: Prelude.Maybe Prelude.Text,
DescribeDataShares -> Maybe Int
maxRecords :: Prelude.Maybe Prelude.Int,
DescribeDataShares -> Maybe Text
dataShareArn :: Prelude.Maybe Prelude.Text
}
deriving (DescribeDataShares -> DescribeDataShares -> Bool
(DescribeDataShares -> DescribeDataShares -> Bool)
-> (DescribeDataShares -> DescribeDataShares -> Bool)
-> Eq DescribeDataShares
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeDataShares -> DescribeDataShares -> Bool
$c/= :: DescribeDataShares -> DescribeDataShares -> Bool
== :: DescribeDataShares -> DescribeDataShares -> Bool
$c== :: DescribeDataShares -> DescribeDataShares -> Bool
Prelude.Eq, ReadPrec [DescribeDataShares]
ReadPrec DescribeDataShares
Int -> ReadS DescribeDataShares
ReadS [DescribeDataShares]
(Int -> ReadS DescribeDataShares)
-> ReadS [DescribeDataShares]
-> ReadPrec DescribeDataShares
-> ReadPrec [DescribeDataShares]
-> Read DescribeDataShares
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeDataShares]
$creadListPrec :: ReadPrec [DescribeDataShares]
readPrec :: ReadPrec DescribeDataShares
$creadPrec :: ReadPrec DescribeDataShares
readList :: ReadS [DescribeDataShares]
$creadList :: ReadS [DescribeDataShares]
readsPrec :: Int -> ReadS DescribeDataShares
$creadsPrec :: Int -> ReadS DescribeDataShares
Prelude.Read, Int -> DescribeDataShares -> ShowS
[DescribeDataShares] -> ShowS
DescribeDataShares -> String
(Int -> DescribeDataShares -> ShowS)
-> (DescribeDataShares -> String)
-> ([DescribeDataShares] -> ShowS)
-> Show DescribeDataShares
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeDataShares] -> ShowS
$cshowList :: [DescribeDataShares] -> ShowS
show :: DescribeDataShares -> String
$cshow :: DescribeDataShares -> String
showsPrec :: Int -> DescribeDataShares -> ShowS
$cshowsPrec :: Int -> DescribeDataShares -> ShowS
Prelude.Show, (forall x. DescribeDataShares -> Rep DescribeDataShares x)
-> (forall x. Rep DescribeDataShares x -> DescribeDataShares)
-> Generic DescribeDataShares
forall x. Rep DescribeDataShares x -> DescribeDataShares
forall x. DescribeDataShares -> Rep DescribeDataShares x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeDataShares x -> DescribeDataShares
$cfrom :: forall x. DescribeDataShares -> Rep DescribeDataShares x
Prelude.Generic)
newDescribeDataShares ::
DescribeDataShares
newDescribeDataShares :: DescribeDataShares
newDescribeDataShares =
DescribeDataShares' :: Maybe Text -> Maybe Int -> Maybe Text -> DescribeDataShares
DescribeDataShares'
{ $sel:marker:DescribeDataShares' :: Maybe Text
marker = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:maxRecords:DescribeDataShares' :: Maybe Int
maxRecords = Maybe Int
forall a. Maybe a
Prelude.Nothing,
$sel:dataShareArn:DescribeDataShares' :: Maybe Text
dataShareArn = Maybe Text
forall a. Maybe a
Prelude.Nothing
}
describeDataShares_marker :: Lens.Lens' DescribeDataShares (Prelude.Maybe Prelude.Text)
describeDataShares_marker :: (Maybe Text -> f (Maybe Text))
-> DescribeDataShares -> f DescribeDataShares
describeDataShares_marker = (DescribeDataShares -> Maybe Text)
-> (DescribeDataShares -> Maybe Text -> DescribeDataShares)
-> Lens
DescribeDataShares DescribeDataShares (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeDataShares' {Maybe Text
marker :: Maybe Text
$sel:marker:DescribeDataShares' :: DescribeDataShares -> Maybe Text
marker} -> Maybe Text
marker) (\s :: DescribeDataShares
s@DescribeDataShares' {} Maybe Text
a -> DescribeDataShares
s {$sel:marker:DescribeDataShares' :: Maybe Text
marker = Maybe Text
a} :: DescribeDataShares)
describeDataShares_maxRecords :: Lens.Lens' DescribeDataShares (Prelude.Maybe Prelude.Int)
describeDataShares_maxRecords :: (Maybe Int -> f (Maybe Int))
-> DescribeDataShares -> f DescribeDataShares
describeDataShares_maxRecords = (DescribeDataShares -> Maybe Int)
-> (DescribeDataShares -> Maybe Int -> DescribeDataShares)
-> Lens
DescribeDataShares DescribeDataShares (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeDataShares' {Maybe Int
maxRecords :: Maybe Int
$sel:maxRecords:DescribeDataShares' :: DescribeDataShares -> Maybe Int
maxRecords} -> Maybe Int
maxRecords) (\s :: DescribeDataShares
s@DescribeDataShares' {} Maybe Int
a -> DescribeDataShares
s {$sel:maxRecords:DescribeDataShares' :: Maybe Int
maxRecords = Maybe Int
a} :: DescribeDataShares)
describeDataShares_dataShareArn :: Lens.Lens' DescribeDataShares (Prelude.Maybe Prelude.Text)
describeDataShares_dataShareArn :: (Maybe Text -> f (Maybe Text))
-> DescribeDataShares -> f DescribeDataShares
describeDataShares_dataShareArn = (DescribeDataShares -> Maybe Text)
-> (DescribeDataShares -> Maybe Text -> DescribeDataShares)
-> Lens
DescribeDataShares DescribeDataShares (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeDataShares' {Maybe Text
dataShareArn :: Maybe Text
$sel:dataShareArn:DescribeDataShares' :: DescribeDataShares -> Maybe Text
dataShareArn} -> Maybe Text
dataShareArn) (\s :: DescribeDataShares
s@DescribeDataShares' {} Maybe Text
a -> DescribeDataShares
s {$sel:dataShareArn:DescribeDataShares' :: Maybe Text
dataShareArn = Maybe Text
a} :: DescribeDataShares)
instance Core.AWSRequest DescribeDataShares where
type
AWSResponse DescribeDataShares =
DescribeDataSharesResponse
request :: DescribeDataShares -> Request DescribeDataShares
request = Service -> DescribeDataShares -> Request DescribeDataShares
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
response :: Logger
-> Service
-> Proxy DescribeDataShares
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse DescribeDataShares)))
response =
Text
-> (Int
-> ResponseHeaders
-> [Node]
-> Either String (AWSResponse DescribeDataShares))
-> Logger
-> Service
-> Proxy DescribeDataShares
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse DescribeDataShares)))
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
"DescribeDataSharesResult"
( \Int
s ResponseHeaders
h [Node]
x ->
Maybe Text
-> Maybe [DataShare] -> Int -> DescribeDataSharesResponse
DescribeDataSharesResponse'
(Maybe Text
-> Maybe [DataShare] -> Int -> DescribeDataSharesResponse)
-> Either String (Maybe Text)
-> Either
String (Maybe [DataShare] -> Int -> DescribeDataSharesResponse)
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
"Marker")
Either
String (Maybe [DataShare] -> Int -> DescribeDataSharesResponse)
-> Either String (Maybe [DataShare])
-> Either String (Int -> DescribeDataSharesResponse)
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
"DataShares" 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 [DataShare]))
-> Either String (Maybe [DataShare])
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= ([Node] -> Either String [DataShare])
-> [Node] -> Either String (Maybe [DataShare])
forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (Text -> [Node] -> Either String [DataShare]
forall a. FromXML a => Text -> [Node] -> Either String [a]
Core.parseXMLList Text
"member")
)
Either String (Int -> DescribeDataSharesResponse)
-> Either String Int -> Either String DescribeDataSharesResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable DescribeDataShares
instance Prelude.NFData DescribeDataShares
instance Core.ToHeaders DescribeDataShares where
toHeaders :: DescribeDataShares -> ResponseHeaders
toHeaders = ResponseHeaders -> DescribeDataShares -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToPath DescribeDataShares where
toPath :: DescribeDataShares -> ByteString
toPath = ByteString -> DescribeDataShares -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery DescribeDataShares where
toQuery :: DescribeDataShares -> QueryString
toQuery DescribeDataShares' {Maybe Int
Maybe Text
dataShareArn :: Maybe Text
maxRecords :: Maybe Int
marker :: Maybe Text
$sel:dataShareArn:DescribeDataShares' :: DescribeDataShares -> Maybe Text
$sel:maxRecords:DescribeDataShares' :: DescribeDataShares -> Maybe Int
$sel:marker:DescribeDataShares' :: DescribeDataShares -> Maybe Text
..} =
[QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"Action"
ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"DescribeDataShares" :: Prelude.ByteString),
ByteString
"Version"
ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2012-12-01" :: Prelude.ByteString),
ByteString
"Marker" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
marker,
ByteString
"MaxRecords" ByteString -> Maybe Int -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Int
maxRecords,
ByteString
"DataShareArn" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
dataShareArn
]
data DescribeDataSharesResponse = DescribeDataSharesResponse'
{
DescribeDataSharesResponse -> Maybe Text
marker :: Prelude.Maybe Prelude.Text,
DescribeDataSharesResponse -> Maybe [DataShare]
dataShares :: Prelude.Maybe [DataShare],
DescribeDataSharesResponse -> Int
httpStatus :: Prelude.Int
}
deriving (DescribeDataSharesResponse -> DescribeDataSharesResponse -> Bool
(DescribeDataSharesResponse -> DescribeDataSharesResponse -> Bool)
-> (DescribeDataSharesResponse
-> DescribeDataSharesResponse -> Bool)
-> Eq DescribeDataSharesResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeDataSharesResponse -> DescribeDataSharesResponse -> Bool
$c/= :: DescribeDataSharesResponse -> DescribeDataSharesResponse -> Bool
== :: DescribeDataSharesResponse -> DescribeDataSharesResponse -> Bool
$c== :: DescribeDataSharesResponse -> DescribeDataSharesResponse -> Bool
Prelude.Eq, ReadPrec [DescribeDataSharesResponse]
ReadPrec DescribeDataSharesResponse
Int -> ReadS DescribeDataSharesResponse
ReadS [DescribeDataSharesResponse]
(Int -> ReadS DescribeDataSharesResponse)
-> ReadS [DescribeDataSharesResponse]
-> ReadPrec DescribeDataSharesResponse
-> ReadPrec [DescribeDataSharesResponse]
-> Read DescribeDataSharesResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeDataSharesResponse]
$creadListPrec :: ReadPrec [DescribeDataSharesResponse]
readPrec :: ReadPrec DescribeDataSharesResponse
$creadPrec :: ReadPrec DescribeDataSharesResponse
readList :: ReadS [DescribeDataSharesResponse]
$creadList :: ReadS [DescribeDataSharesResponse]
readsPrec :: Int -> ReadS DescribeDataSharesResponse
$creadsPrec :: Int -> ReadS DescribeDataSharesResponse
Prelude.Read, Int -> DescribeDataSharesResponse -> ShowS
[DescribeDataSharesResponse] -> ShowS
DescribeDataSharesResponse -> String
(Int -> DescribeDataSharesResponse -> ShowS)
-> (DescribeDataSharesResponse -> String)
-> ([DescribeDataSharesResponse] -> ShowS)
-> Show DescribeDataSharesResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeDataSharesResponse] -> ShowS
$cshowList :: [DescribeDataSharesResponse] -> ShowS
show :: DescribeDataSharesResponse -> String
$cshow :: DescribeDataSharesResponse -> String
showsPrec :: Int -> DescribeDataSharesResponse -> ShowS
$cshowsPrec :: Int -> DescribeDataSharesResponse -> ShowS
Prelude.Show, (forall x.
DescribeDataSharesResponse -> Rep DescribeDataSharesResponse x)
-> (forall x.
Rep DescribeDataSharesResponse x -> DescribeDataSharesResponse)
-> Generic DescribeDataSharesResponse
forall x.
Rep DescribeDataSharesResponse x -> DescribeDataSharesResponse
forall x.
DescribeDataSharesResponse -> Rep DescribeDataSharesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeDataSharesResponse x -> DescribeDataSharesResponse
$cfrom :: forall x.
DescribeDataSharesResponse -> Rep DescribeDataSharesResponse x
Prelude.Generic)
newDescribeDataSharesResponse ::
Prelude.Int ->
DescribeDataSharesResponse
newDescribeDataSharesResponse :: Int -> DescribeDataSharesResponse
newDescribeDataSharesResponse Int
pHttpStatus_ =
DescribeDataSharesResponse' :: Maybe Text
-> Maybe [DataShare] -> Int -> DescribeDataSharesResponse
DescribeDataSharesResponse'
{ $sel:marker:DescribeDataSharesResponse' :: Maybe Text
marker =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:dataShares:DescribeDataSharesResponse' :: Maybe [DataShare]
dataShares = Maybe [DataShare]
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:DescribeDataSharesResponse' :: Int
httpStatus = Int
pHttpStatus_
}
describeDataSharesResponse_marker :: Lens.Lens' DescribeDataSharesResponse (Prelude.Maybe Prelude.Text)
describeDataSharesResponse_marker :: (Maybe Text -> f (Maybe Text))
-> DescribeDataSharesResponse -> f DescribeDataSharesResponse
describeDataSharesResponse_marker = (DescribeDataSharesResponse -> Maybe Text)
-> (DescribeDataSharesResponse
-> Maybe Text -> DescribeDataSharesResponse)
-> Lens
DescribeDataSharesResponse
DescribeDataSharesResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeDataSharesResponse' {Maybe Text
marker :: Maybe Text
$sel:marker:DescribeDataSharesResponse' :: DescribeDataSharesResponse -> Maybe Text
marker} -> Maybe Text
marker) (\s :: DescribeDataSharesResponse
s@DescribeDataSharesResponse' {} Maybe Text
a -> DescribeDataSharesResponse
s {$sel:marker:DescribeDataSharesResponse' :: Maybe Text
marker = Maybe Text
a} :: DescribeDataSharesResponse)
describeDataSharesResponse_dataShares :: Lens.Lens' DescribeDataSharesResponse (Prelude.Maybe [DataShare])
describeDataSharesResponse_dataShares :: (Maybe [DataShare] -> f (Maybe [DataShare]))
-> DescribeDataSharesResponse -> f DescribeDataSharesResponse
describeDataSharesResponse_dataShares = (DescribeDataSharesResponse -> Maybe [DataShare])
-> (DescribeDataSharesResponse
-> Maybe [DataShare] -> DescribeDataSharesResponse)
-> Lens
DescribeDataSharesResponse
DescribeDataSharesResponse
(Maybe [DataShare])
(Maybe [DataShare])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeDataSharesResponse' {Maybe [DataShare]
dataShares :: Maybe [DataShare]
$sel:dataShares:DescribeDataSharesResponse' :: DescribeDataSharesResponse -> Maybe [DataShare]
dataShares} -> Maybe [DataShare]
dataShares) (\s :: DescribeDataSharesResponse
s@DescribeDataSharesResponse' {} Maybe [DataShare]
a -> DescribeDataSharesResponse
s {$sel:dataShares:DescribeDataSharesResponse' :: Maybe [DataShare]
dataShares = Maybe [DataShare]
a} :: DescribeDataSharesResponse) ((Maybe [DataShare] -> f (Maybe [DataShare]))
-> DescribeDataSharesResponse -> f DescribeDataSharesResponse)
-> ((Maybe [DataShare] -> f (Maybe [DataShare]))
-> Maybe [DataShare] -> f (Maybe [DataShare]))
-> (Maybe [DataShare] -> f (Maybe [DataShare]))
-> DescribeDataSharesResponse
-> f DescribeDataSharesResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [DataShare] [DataShare] [DataShare] [DataShare]
-> Iso
(Maybe [DataShare])
(Maybe [DataShare])
(Maybe [DataShare])
(Maybe [DataShare])
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 [DataShare] [DataShare] [DataShare] [DataShare]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
describeDataSharesResponse_httpStatus :: Lens.Lens' DescribeDataSharesResponse Prelude.Int
describeDataSharesResponse_httpStatus :: (Int -> f Int)
-> DescribeDataSharesResponse -> f DescribeDataSharesResponse
describeDataSharesResponse_httpStatus = (DescribeDataSharesResponse -> Int)
-> (DescribeDataSharesResponse
-> Int -> DescribeDataSharesResponse)
-> Lens
DescribeDataSharesResponse DescribeDataSharesResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeDataSharesResponse' {Int
httpStatus :: Int
$sel:httpStatus:DescribeDataSharesResponse' :: DescribeDataSharesResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DescribeDataSharesResponse
s@DescribeDataSharesResponse' {} Int
a -> DescribeDataSharesResponse
s {$sel:httpStatus:DescribeDataSharesResponse' :: Int
httpStatus = Int
a} :: DescribeDataSharesResponse)
instance Prelude.NFData DescribeDataSharesResponse