{-# 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.DescribeAccess
(
DescribeAccess (..),
newDescribeAccess,
describeAccess_serverId,
describeAccess_externalId,
DescribeAccessResponse (..),
newDescribeAccessResponse,
describeAccessResponse_httpStatus,
describeAccessResponse_serverId,
describeAccessResponse_access,
)
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 DescribeAccess = DescribeAccess'
{
DescribeAccess -> Text
serverId :: Prelude.Text,
DescribeAccess -> Text
externalId :: Prelude.Text
}
deriving (DescribeAccess -> DescribeAccess -> Bool
(DescribeAccess -> DescribeAccess -> Bool)
-> (DescribeAccess -> DescribeAccess -> Bool) -> Eq DescribeAccess
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeAccess -> DescribeAccess -> Bool
$c/= :: DescribeAccess -> DescribeAccess -> Bool
== :: DescribeAccess -> DescribeAccess -> Bool
$c== :: DescribeAccess -> DescribeAccess -> Bool
Prelude.Eq, ReadPrec [DescribeAccess]
ReadPrec DescribeAccess
Int -> ReadS DescribeAccess
ReadS [DescribeAccess]
(Int -> ReadS DescribeAccess)
-> ReadS [DescribeAccess]
-> ReadPrec DescribeAccess
-> ReadPrec [DescribeAccess]
-> Read DescribeAccess
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeAccess]
$creadListPrec :: ReadPrec [DescribeAccess]
readPrec :: ReadPrec DescribeAccess
$creadPrec :: ReadPrec DescribeAccess
readList :: ReadS [DescribeAccess]
$creadList :: ReadS [DescribeAccess]
readsPrec :: Int -> ReadS DescribeAccess
$creadsPrec :: Int -> ReadS DescribeAccess
Prelude.Read, Int -> DescribeAccess -> ShowS
[DescribeAccess] -> ShowS
DescribeAccess -> String
(Int -> DescribeAccess -> ShowS)
-> (DescribeAccess -> String)
-> ([DescribeAccess] -> ShowS)
-> Show DescribeAccess
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeAccess] -> ShowS
$cshowList :: [DescribeAccess] -> ShowS
show :: DescribeAccess -> String
$cshow :: DescribeAccess -> String
showsPrec :: Int -> DescribeAccess -> ShowS
$cshowsPrec :: Int -> DescribeAccess -> ShowS
Prelude.Show, (forall x. DescribeAccess -> Rep DescribeAccess x)
-> (forall x. Rep DescribeAccess x -> DescribeAccess)
-> Generic DescribeAccess
forall x. Rep DescribeAccess x -> DescribeAccess
forall x. DescribeAccess -> Rep DescribeAccess x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeAccess x -> DescribeAccess
$cfrom :: forall x. DescribeAccess -> Rep DescribeAccess x
Prelude.Generic)
newDescribeAccess ::
Prelude.Text ->
Prelude.Text ->
DescribeAccess
newDescribeAccess :: Text -> Text -> DescribeAccess
newDescribeAccess Text
pServerId_ Text
pExternalId_ =
DescribeAccess' :: Text -> Text -> DescribeAccess
DescribeAccess'
{ $sel:serverId:DescribeAccess' :: Text
serverId = Text
pServerId_,
$sel:externalId:DescribeAccess' :: Text
externalId = Text
pExternalId_
}
describeAccess_serverId :: Lens.Lens' DescribeAccess Prelude.Text
describeAccess_serverId :: (Text -> f Text) -> DescribeAccess -> f DescribeAccess
describeAccess_serverId = (DescribeAccess -> Text)
-> (DescribeAccess -> Text -> DescribeAccess)
-> Lens DescribeAccess DescribeAccess Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeAccess' {Text
serverId :: Text
$sel:serverId:DescribeAccess' :: DescribeAccess -> Text
serverId} -> Text
serverId) (\s :: DescribeAccess
s@DescribeAccess' {} Text
a -> DescribeAccess
s {$sel:serverId:DescribeAccess' :: Text
serverId = Text
a} :: DescribeAccess)
describeAccess_externalId :: Lens.Lens' DescribeAccess Prelude.Text
describeAccess_externalId :: (Text -> f Text) -> DescribeAccess -> f DescribeAccess
describeAccess_externalId = (DescribeAccess -> Text)
-> (DescribeAccess -> Text -> DescribeAccess)
-> Lens DescribeAccess DescribeAccess Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeAccess' {Text
externalId :: Text
$sel:externalId:DescribeAccess' :: DescribeAccess -> Text
externalId} -> Text
externalId) (\s :: DescribeAccess
s@DescribeAccess' {} Text
a -> DescribeAccess
s {$sel:externalId:DescribeAccess' :: Text
externalId = Text
a} :: DescribeAccess)
instance Core.AWSRequest DescribeAccess where
type
AWSResponse DescribeAccess =
DescribeAccessResponse
request :: DescribeAccess -> Request DescribeAccess
request = Service -> DescribeAccess -> Request DescribeAccess
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy DescribeAccess
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DescribeAccess)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse DescribeAccess))
-> Logger
-> Service
-> Proxy DescribeAccess
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DescribeAccess)))
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 ->
Int -> Text -> DescribedAccess -> DescribeAccessResponse
DescribeAccessResponse'
(Int -> Text -> DescribedAccess -> DescribeAccessResponse)
-> Either String Int
-> Either
String (Text -> DescribedAccess -> DescribeAccessResponse)
forall (f :: * -> *) a b. Functor 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 -> DescribedAccess -> DescribeAccessResponse)
-> Either String Text
-> Either String (DescribedAccess -> DescribeAccessResponse)
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 (DescribedAccess -> DescribeAccessResponse)
-> Either String DescribedAccess
-> Either String DescribeAccessResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String DescribedAccess
forall a. FromJSON a => Object -> Text -> Either String a
Core..:> Text
"Access")
)
instance Prelude.Hashable DescribeAccess
instance Prelude.NFData DescribeAccess
instance Core.ToHeaders DescribeAccess where
toHeaders :: DescribeAccess -> ResponseHeaders
toHeaders =
ResponseHeaders -> DescribeAccess -> 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.DescribeAccess" ::
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 DescribeAccess where
toJSON :: DescribeAccess -> Value
toJSON DescribeAccess' {Text
externalId :: Text
serverId :: Text
$sel:externalId:DescribeAccess' :: DescribeAccess -> Text
$sel:serverId:DescribeAccess' :: DescribeAccess -> 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
"ServerId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
serverId),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"ExternalId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
externalId)
]
)
instance Core.ToPath DescribeAccess where
toPath :: DescribeAccess -> ByteString
toPath = ByteString -> DescribeAccess -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery DescribeAccess where
toQuery :: DescribeAccess -> QueryString
toQuery = QueryString -> DescribeAccess -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data DescribeAccessResponse = DescribeAccessResponse'
{
DescribeAccessResponse -> Int
httpStatus :: Prelude.Int,
DescribeAccessResponse -> Text
serverId :: Prelude.Text,
DescribeAccessResponse -> DescribedAccess
access :: DescribedAccess
}
deriving (DescribeAccessResponse -> DescribeAccessResponse -> Bool
(DescribeAccessResponse -> DescribeAccessResponse -> Bool)
-> (DescribeAccessResponse -> DescribeAccessResponse -> Bool)
-> Eq DescribeAccessResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeAccessResponse -> DescribeAccessResponse -> Bool
$c/= :: DescribeAccessResponse -> DescribeAccessResponse -> Bool
== :: DescribeAccessResponse -> DescribeAccessResponse -> Bool
$c== :: DescribeAccessResponse -> DescribeAccessResponse -> Bool
Prelude.Eq, ReadPrec [DescribeAccessResponse]
ReadPrec DescribeAccessResponse
Int -> ReadS DescribeAccessResponse
ReadS [DescribeAccessResponse]
(Int -> ReadS DescribeAccessResponse)
-> ReadS [DescribeAccessResponse]
-> ReadPrec DescribeAccessResponse
-> ReadPrec [DescribeAccessResponse]
-> Read DescribeAccessResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeAccessResponse]
$creadListPrec :: ReadPrec [DescribeAccessResponse]
readPrec :: ReadPrec DescribeAccessResponse
$creadPrec :: ReadPrec DescribeAccessResponse
readList :: ReadS [DescribeAccessResponse]
$creadList :: ReadS [DescribeAccessResponse]
readsPrec :: Int -> ReadS DescribeAccessResponse
$creadsPrec :: Int -> ReadS DescribeAccessResponse
Prelude.Read, Int -> DescribeAccessResponse -> ShowS
[DescribeAccessResponse] -> ShowS
DescribeAccessResponse -> String
(Int -> DescribeAccessResponse -> ShowS)
-> (DescribeAccessResponse -> String)
-> ([DescribeAccessResponse] -> ShowS)
-> Show DescribeAccessResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeAccessResponse] -> ShowS
$cshowList :: [DescribeAccessResponse] -> ShowS
show :: DescribeAccessResponse -> String
$cshow :: DescribeAccessResponse -> String
showsPrec :: Int -> DescribeAccessResponse -> ShowS
$cshowsPrec :: Int -> DescribeAccessResponse -> ShowS
Prelude.Show, (forall x. DescribeAccessResponse -> Rep DescribeAccessResponse x)
-> (forall x.
Rep DescribeAccessResponse x -> DescribeAccessResponse)
-> Generic DescribeAccessResponse
forall x. Rep DescribeAccessResponse x -> DescribeAccessResponse
forall x. DescribeAccessResponse -> Rep DescribeAccessResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeAccessResponse x -> DescribeAccessResponse
$cfrom :: forall x. DescribeAccessResponse -> Rep DescribeAccessResponse x
Prelude.Generic)
newDescribeAccessResponse ::
Prelude.Int ->
Prelude.Text ->
DescribedAccess ->
DescribeAccessResponse
newDescribeAccessResponse :: Int -> Text -> DescribedAccess -> DescribeAccessResponse
newDescribeAccessResponse
Int
pHttpStatus_
Text
pServerId_
DescribedAccess
pAccess_ =
DescribeAccessResponse' :: Int -> Text -> DescribedAccess -> DescribeAccessResponse
DescribeAccessResponse'
{ $sel:httpStatus:DescribeAccessResponse' :: Int
httpStatus = Int
pHttpStatus_,
$sel:serverId:DescribeAccessResponse' :: Text
serverId = Text
pServerId_,
$sel:access:DescribeAccessResponse' :: DescribedAccess
access = DescribedAccess
pAccess_
}
describeAccessResponse_httpStatus :: Lens.Lens' DescribeAccessResponse Prelude.Int
describeAccessResponse_httpStatus :: (Int -> f Int)
-> DescribeAccessResponse -> f DescribeAccessResponse
describeAccessResponse_httpStatus = (DescribeAccessResponse -> Int)
-> (DescribeAccessResponse -> Int -> DescribeAccessResponse)
-> Lens DescribeAccessResponse DescribeAccessResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeAccessResponse' {Int
httpStatus :: Int
$sel:httpStatus:DescribeAccessResponse' :: DescribeAccessResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DescribeAccessResponse
s@DescribeAccessResponse' {} Int
a -> DescribeAccessResponse
s {$sel:httpStatus:DescribeAccessResponse' :: Int
httpStatus = Int
a} :: DescribeAccessResponse)
describeAccessResponse_serverId :: Lens.Lens' DescribeAccessResponse Prelude.Text
describeAccessResponse_serverId :: (Text -> f Text)
-> DescribeAccessResponse -> f DescribeAccessResponse
describeAccessResponse_serverId = (DescribeAccessResponse -> Text)
-> (DescribeAccessResponse -> Text -> DescribeAccessResponse)
-> Lens DescribeAccessResponse DescribeAccessResponse Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeAccessResponse' {Text
serverId :: Text
$sel:serverId:DescribeAccessResponse' :: DescribeAccessResponse -> Text
serverId} -> Text
serverId) (\s :: DescribeAccessResponse
s@DescribeAccessResponse' {} Text
a -> DescribeAccessResponse
s {$sel:serverId:DescribeAccessResponse' :: Text
serverId = Text
a} :: DescribeAccessResponse)
describeAccessResponse_access :: Lens.Lens' DescribeAccessResponse DescribedAccess
describeAccessResponse_access :: (DescribedAccess -> f DescribedAccess)
-> DescribeAccessResponse -> f DescribeAccessResponse
describeAccessResponse_access = (DescribeAccessResponse -> DescribedAccess)
-> (DescribeAccessResponse
-> DescribedAccess -> DescribeAccessResponse)
-> Lens
DescribeAccessResponse
DescribeAccessResponse
DescribedAccess
DescribedAccess
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeAccessResponse' {DescribedAccess
access :: DescribedAccess
$sel:access:DescribeAccessResponse' :: DescribeAccessResponse -> DescribedAccess
access} -> DescribedAccess
access) (\s :: DescribeAccessResponse
s@DescribeAccessResponse' {} DescribedAccess
a -> DescribeAccessResponse
s {$sel:access:DescribeAccessResponse' :: DescribedAccess
access = DescribedAccess
a} :: DescribeAccessResponse)
instance Prelude.NFData DescribeAccessResponse