{-# 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.Transfer.ListAccesses
(
ListAccesses (..),
newListAccesses,
listAccesses_nextToken,
listAccesses_maxResults,
listAccesses_serverId,
ListAccessesResponse (..),
newListAccessesResponse,
listAccessesResponse_nextToken,
listAccessesResponse_httpStatus,
listAccessesResponse_serverId,
listAccessesResponse_accesses,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
import Amazonka.Transfer.Types
data ListAccesses = ListAccesses'
{
ListAccesses -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListAccesses -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
ListAccesses -> Text
serverId :: Prelude.Text
}
deriving (ListAccesses -> ListAccesses -> Bool
(ListAccesses -> ListAccesses -> Bool)
-> (ListAccesses -> ListAccesses -> Bool) -> Eq ListAccesses
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListAccesses -> ListAccesses -> Bool
$c/= :: ListAccesses -> ListAccesses -> Bool
== :: ListAccesses -> ListAccesses -> Bool
$c== :: ListAccesses -> ListAccesses -> Bool
Prelude.Eq, ReadPrec [ListAccesses]
ReadPrec ListAccesses
Int -> ReadS ListAccesses
ReadS [ListAccesses]
(Int -> ReadS ListAccesses)
-> ReadS [ListAccesses]
-> ReadPrec ListAccesses
-> ReadPrec [ListAccesses]
-> Read ListAccesses
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListAccesses]
$creadListPrec :: ReadPrec [ListAccesses]
readPrec :: ReadPrec ListAccesses
$creadPrec :: ReadPrec ListAccesses
readList :: ReadS [ListAccesses]
$creadList :: ReadS [ListAccesses]
readsPrec :: Int -> ReadS ListAccesses
$creadsPrec :: Int -> ReadS ListAccesses
Prelude.Read, Int -> ListAccesses -> ShowS
[ListAccesses] -> ShowS
ListAccesses -> String
(Int -> ListAccesses -> ShowS)
-> (ListAccesses -> String)
-> ([ListAccesses] -> ShowS)
-> Show ListAccesses
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListAccesses] -> ShowS
$cshowList :: [ListAccesses] -> ShowS
show :: ListAccesses -> String
$cshow :: ListAccesses -> String
showsPrec :: Int -> ListAccesses -> ShowS
$cshowsPrec :: Int -> ListAccesses -> ShowS
Prelude.Show, (forall x. ListAccesses -> Rep ListAccesses x)
-> (forall x. Rep ListAccesses x -> ListAccesses)
-> Generic ListAccesses
forall x. Rep ListAccesses x -> ListAccesses
forall x. ListAccesses -> Rep ListAccesses x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListAccesses x -> ListAccesses
$cfrom :: forall x. ListAccesses -> Rep ListAccesses x
Prelude.Generic)
newListAccesses ::
Prelude.Text ->
ListAccesses
newListAccesses :: Text -> ListAccesses
newListAccesses Text
pServerId_ =
ListAccesses' :: Maybe Text -> Maybe Natural -> Text -> ListAccesses
ListAccesses'
{ $sel:nextToken:ListAccesses' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:maxResults:ListAccesses' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
$sel:serverId:ListAccesses' :: Text
serverId = Text
pServerId_
}
listAccesses_nextToken :: Lens.Lens' ListAccesses (Prelude.Maybe Prelude.Text)
listAccesses_nextToken :: (Maybe Text -> f (Maybe Text)) -> ListAccesses -> f ListAccesses
listAccesses_nextToken = (ListAccesses -> Maybe Text)
-> (ListAccesses -> Maybe Text -> ListAccesses)
-> Lens ListAccesses ListAccesses (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAccesses' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListAccesses' :: ListAccesses -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListAccesses
s@ListAccesses' {} Maybe Text
a -> ListAccesses
s {$sel:nextToken:ListAccesses' :: Maybe Text
nextToken = Maybe Text
a} :: ListAccesses)
listAccesses_maxResults :: Lens.Lens' ListAccesses (Prelude.Maybe Prelude.Natural)
listAccesses_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> ListAccesses -> f ListAccesses
listAccesses_maxResults = (ListAccesses -> Maybe Natural)
-> (ListAccesses -> Maybe Natural -> ListAccesses)
-> Lens ListAccesses ListAccesses (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAccesses' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListAccesses' :: ListAccesses -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListAccesses
s@ListAccesses' {} Maybe Natural
a -> ListAccesses
s {$sel:maxResults:ListAccesses' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListAccesses)
listAccesses_serverId :: Lens.Lens' ListAccesses Prelude.Text
listAccesses_serverId :: (Text -> f Text) -> ListAccesses -> f ListAccesses
listAccesses_serverId = (ListAccesses -> Text)
-> (ListAccesses -> Text -> ListAccesses)
-> Lens ListAccesses ListAccesses Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAccesses' {Text
serverId :: Text
$sel:serverId:ListAccesses' :: ListAccesses -> Text
serverId} -> Text
serverId) (\s :: ListAccesses
s@ListAccesses' {} Text
a -> ListAccesses
s {$sel:serverId:ListAccesses' :: Text
serverId = Text
a} :: ListAccesses)
instance Core.AWSRequest ListAccesses where
type AWSResponse ListAccesses = ListAccessesResponse
request :: ListAccesses -> Request ListAccesses
request = Service -> ListAccesses -> Request ListAccesses
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy ListAccesses
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListAccesses)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse ListAccesses))
-> Logger
-> Service
-> Proxy ListAccesses
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListAccesses)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Maybe Text -> Int -> Text -> [ListedAccess] -> ListAccessesResponse
ListAccessesResponse'
(Maybe Text
-> Int -> Text -> [ListedAccess] -> ListAccessesResponse)
-> Either String (Maybe Text)
-> Either
String (Int -> Text -> [ListedAccess] -> ListAccessesResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"NextToken")
Either
String (Int -> Text -> [ListedAccess] -> ListAccessesResponse)
-> Either String Int
-> Either String (Text -> [ListedAccess] -> ListAccessesResponse)
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))
Either String (Text -> [ListedAccess] -> ListAccessesResponse)
-> Either String Text
-> Either String ([ListedAccess] -> ListAccessesResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String Text
forall a. FromJSON a => Object -> Text -> Either String a
Core..:> Text
"ServerId")
Either String ([ListedAccess] -> ListAccessesResponse)
-> Either String [ListedAccess]
-> Either String ListAccessesResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe [ListedAccess])
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Accesses" Either String (Maybe [ListedAccess])
-> [ListedAccess] -> Either String [ListedAccess]
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ [ListedAccess]
forall a. Monoid a => a
Prelude.mempty)
)
instance Prelude.Hashable ListAccesses
instance Prelude.NFData ListAccesses
instance Core.ToHeaders ListAccesses where
toHeaders :: ListAccesses -> ResponseHeaders
toHeaders =
ResponseHeaders -> ListAccesses -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"TransferService.ListAccesses" ::
Prelude.ByteString
),
HeaderName
"Content-Type"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Core.ToJSON ListAccesses where
toJSON :: ListAccesses -> Value
toJSON ListAccesses' {Maybe Natural
Maybe Text
Text
serverId :: Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
$sel:serverId:ListAccesses' :: ListAccesses -> Text
$sel:maxResults:ListAccesses' :: ListAccesses -> Maybe Natural
$sel:nextToken:ListAccesses' :: ListAccesses -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"NextToken" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
nextToken,
(Text
"MaxResults" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
maxResults,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"ServerId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
serverId)
]
)
instance Core.ToPath ListAccesses where
toPath :: ListAccesses -> ByteString
toPath = ByteString -> ListAccesses -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery ListAccesses where
toQuery :: ListAccesses -> QueryString
toQuery = QueryString -> ListAccesses -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data ListAccessesResponse = ListAccessesResponse'
{
ListAccessesResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListAccessesResponse -> Int
httpStatus :: Prelude.Int,
ListAccessesResponse -> Text
serverId :: Prelude.Text,
ListAccessesResponse -> [ListedAccess]
accesses :: [ListedAccess]
}
deriving (ListAccessesResponse -> ListAccessesResponse -> Bool
(ListAccessesResponse -> ListAccessesResponse -> Bool)
-> (ListAccessesResponse -> ListAccessesResponse -> Bool)
-> Eq ListAccessesResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListAccessesResponse -> ListAccessesResponse -> Bool
$c/= :: ListAccessesResponse -> ListAccessesResponse -> Bool
== :: ListAccessesResponse -> ListAccessesResponse -> Bool
$c== :: ListAccessesResponse -> ListAccessesResponse -> Bool
Prelude.Eq, ReadPrec [ListAccessesResponse]
ReadPrec ListAccessesResponse
Int -> ReadS ListAccessesResponse
ReadS [ListAccessesResponse]
(Int -> ReadS ListAccessesResponse)
-> ReadS [ListAccessesResponse]
-> ReadPrec ListAccessesResponse
-> ReadPrec [ListAccessesResponse]
-> Read ListAccessesResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListAccessesResponse]
$creadListPrec :: ReadPrec [ListAccessesResponse]
readPrec :: ReadPrec ListAccessesResponse
$creadPrec :: ReadPrec ListAccessesResponse
readList :: ReadS [ListAccessesResponse]
$creadList :: ReadS [ListAccessesResponse]
readsPrec :: Int -> ReadS ListAccessesResponse
$creadsPrec :: Int -> ReadS ListAccessesResponse
Prelude.Read, Int -> ListAccessesResponse -> ShowS
[ListAccessesResponse] -> ShowS
ListAccessesResponse -> String
(Int -> ListAccessesResponse -> ShowS)
-> (ListAccessesResponse -> String)
-> ([ListAccessesResponse] -> ShowS)
-> Show ListAccessesResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListAccessesResponse] -> ShowS
$cshowList :: [ListAccessesResponse] -> ShowS
show :: ListAccessesResponse -> String
$cshow :: ListAccessesResponse -> String
showsPrec :: Int -> ListAccessesResponse -> ShowS
$cshowsPrec :: Int -> ListAccessesResponse -> ShowS
Prelude.Show, (forall x. ListAccessesResponse -> Rep ListAccessesResponse x)
-> (forall x. Rep ListAccessesResponse x -> ListAccessesResponse)
-> Generic ListAccessesResponse
forall x. Rep ListAccessesResponse x -> ListAccessesResponse
forall x. ListAccessesResponse -> Rep ListAccessesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListAccessesResponse x -> ListAccessesResponse
$cfrom :: forall x. ListAccessesResponse -> Rep ListAccessesResponse x
Prelude.Generic)
newListAccessesResponse ::
Prelude.Int ->
Prelude.Text ->
ListAccessesResponse
newListAccessesResponse :: Int -> Text -> ListAccessesResponse
newListAccessesResponse Int
pHttpStatus_ Text
pServerId_ =
ListAccessesResponse' :: Maybe Text -> Int -> Text -> [ListedAccess] -> ListAccessesResponse
ListAccessesResponse'
{ $sel:nextToken:ListAccessesResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ListAccessesResponse' :: Int
httpStatus = Int
pHttpStatus_,
$sel:serverId:ListAccessesResponse' :: Text
serverId = Text
pServerId_,
$sel:accesses:ListAccessesResponse' :: [ListedAccess]
accesses = [ListedAccess]
forall a. Monoid a => a
Prelude.mempty
}
listAccessesResponse_nextToken :: Lens.Lens' ListAccessesResponse (Prelude.Maybe Prelude.Text)
listAccessesResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListAccessesResponse -> f ListAccessesResponse
listAccessesResponse_nextToken = (ListAccessesResponse -> Maybe Text)
-> (ListAccessesResponse -> Maybe Text -> ListAccessesResponse)
-> Lens
ListAccessesResponse ListAccessesResponse (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAccessesResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListAccessesResponse' :: ListAccessesResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListAccessesResponse
s@ListAccessesResponse' {} Maybe Text
a -> ListAccessesResponse
s {$sel:nextToken:ListAccessesResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListAccessesResponse)
listAccessesResponse_httpStatus :: Lens.Lens' ListAccessesResponse Prelude.Int
listAccessesResponse_httpStatus :: (Int -> f Int) -> ListAccessesResponse -> f ListAccessesResponse
listAccessesResponse_httpStatus = (ListAccessesResponse -> Int)
-> (ListAccessesResponse -> Int -> ListAccessesResponse)
-> Lens ListAccessesResponse ListAccessesResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAccessesResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListAccessesResponse' :: ListAccessesResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListAccessesResponse
s@ListAccessesResponse' {} Int
a -> ListAccessesResponse
s {$sel:httpStatus:ListAccessesResponse' :: Int
httpStatus = Int
a} :: ListAccessesResponse)
listAccessesResponse_serverId :: Lens.Lens' ListAccessesResponse Prelude.Text
listAccessesResponse_serverId :: (Text -> f Text) -> ListAccessesResponse -> f ListAccessesResponse
listAccessesResponse_serverId = (ListAccessesResponse -> Text)
-> (ListAccessesResponse -> Text -> ListAccessesResponse)
-> Lens ListAccessesResponse ListAccessesResponse Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAccessesResponse' {Text
serverId :: Text
$sel:serverId:ListAccessesResponse' :: ListAccessesResponse -> Text
serverId} -> Text
serverId) (\s :: ListAccessesResponse
s@ListAccessesResponse' {} Text
a -> ListAccessesResponse
s {$sel:serverId:ListAccessesResponse' :: Text
serverId = Text
a} :: ListAccessesResponse)
listAccessesResponse_accesses :: Lens.Lens' ListAccessesResponse [ListedAccess]
listAccessesResponse_accesses :: ([ListedAccess] -> f [ListedAccess])
-> ListAccessesResponse -> f ListAccessesResponse
listAccessesResponse_accesses = (ListAccessesResponse -> [ListedAccess])
-> (ListAccessesResponse -> [ListedAccess] -> ListAccessesResponse)
-> Lens
ListAccessesResponse
ListAccessesResponse
[ListedAccess]
[ListedAccess]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAccessesResponse' {[ListedAccess]
accesses :: [ListedAccess]
$sel:accesses:ListAccessesResponse' :: ListAccessesResponse -> [ListedAccess]
accesses} -> [ListedAccess]
accesses) (\s :: ListAccessesResponse
s@ListAccessesResponse' {} [ListedAccess]
a -> ListAccessesResponse
s {$sel:accesses:ListAccessesResponse' :: [ListedAccess]
accesses = [ListedAccess]
a} :: ListAccessesResponse) (([ListedAccess] -> f [ListedAccess])
-> ListAccessesResponse -> f ListAccessesResponse)
-> (([ListedAccess] -> f [ListedAccess])
-> [ListedAccess] -> f [ListedAccess])
-> ([ListedAccess] -> f [ListedAccess])
-> ListAccessesResponse
-> f ListAccessesResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([ListedAccess] -> f [ListedAccess])
-> [ListedAccess] -> f [ListedAccess]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Prelude.NFData ListAccessesResponse