{-# 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.ListProfiles
(
ListProfiles (..),
newListProfiles,
listProfiles_maxResults,
listProfiles_nextToken,
listProfiles_profileType,
ListProfilesResponse (..),
newListProfilesResponse,
listProfilesResponse_nextToken,
listProfilesResponse_httpStatus,
listProfilesResponse_profiles,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
import Amazonka.Transfer.Types
data ListProfiles = ListProfiles'
{
ListProfiles -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
ListProfiles -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListProfiles -> Maybe ProfileType
profileType :: Prelude.Maybe ProfileType
}
deriving (ListProfiles -> ListProfiles -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListProfiles -> ListProfiles -> Bool
$c/= :: ListProfiles -> ListProfiles -> Bool
== :: ListProfiles -> ListProfiles -> Bool
$c== :: ListProfiles -> ListProfiles -> Bool
Prelude.Eq, ReadPrec [ListProfiles]
ReadPrec ListProfiles
Int -> ReadS ListProfiles
ReadS [ListProfiles]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListProfiles]
$creadListPrec :: ReadPrec [ListProfiles]
readPrec :: ReadPrec ListProfiles
$creadPrec :: ReadPrec ListProfiles
readList :: ReadS [ListProfiles]
$creadList :: ReadS [ListProfiles]
readsPrec :: Int -> ReadS ListProfiles
$creadsPrec :: Int -> ReadS ListProfiles
Prelude.Read, Int -> ListProfiles -> ShowS
[ListProfiles] -> ShowS
ListProfiles -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListProfiles] -> ShowS
$cshowList :: [ListProfiles] -> ShowS
show :: ListProfiles -> String
$cshow :: ListProfiles -> String
showsPrec :: Int -> ListProfiles -> ShowS
$cshowsPrec :: Int -> ListProfiles -> ShowS
Prelude.Show, forall x. Rep ListProfiles x -> ListProfiles
forall x. ListProfiles -> Rep ListProfiles x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListProfiles x -> ListProfiles
$cfrom :: forall x. ListProfiles -> Rep ListProfiles x
Prelude.Generic)
newListProfiles ::
ListProfiles
newListProfiles :: ListProfiles
newListProfiles =
ListProfiles'
{ $sel:maxResults:ListProfiles' :: Maybe Natural
maxResults = forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:ListProfiles' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
$sel:profileType:ListProfiles' :: Maybe ProfileType
profileType = forall a. Maybe a
Prelude.Nothing
}
listProfiles_maxResults :: Lens.Lens' ListProfiles (Prelude.Maybe Prelude.Natural)
listProfiles_maxResults :: Lens' ListProfiles (Maybe Natural)
listProfiles_maxResults = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListProfiles' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListProfiles' :: ListProfiles -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListProfiles
s@ListProfiles' {} Maybe Natural
a -> ListProfiles
s {$sel:maxResults:ListProfiles' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListProfiles)
listProfiles_nextToken :: Lens.Lens' ListProfiles (Prelude.Maybe Prelude.Text)
listProfiles_nextToken :: Lens' ListProfiles (Maybe Text)
listProfiles_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListProfiles' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListProfiles' :: ListProfiles -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListProfiles
s@ListProfiles' {} Maybe Text
a -> ListProfiles
s {$sel:nextToken:ListProfiles' :: Maybe Text
nextToken = Maybe Text
a} :: ListProfiles)
listProfiles_profileType :: Lens.Lens' ListProfiles (Prelude.Maybe ProfileType)
listProfiles_profileType :: Lens' ListProfiles (Maybe ProfileType)
listProfiles_profileType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListProfiles' {Maybe ProfileType
profileType :: Maybe ProfileType
$sel:profileType:ListProfiles' :: ListProfiles -> Maybe ProfileType
profileType} -> Maybe ProfileType
profileType) (\s :: ListProfiles
s@ListProfiles' {} Maybe ProfileType
a -> ListProfiles
s {$sel:profileType:ListProfiles' :: Maybe ProfileType
profileType = Maybe ProfileType
a} :: ListProfiles)
instance Core.AWSPager ListProfiles where
page :: ListProfiles -> AWSResponse ListProfiles -> Maybe ListProfiles
page ListProfiles
rq AWSResponse ListProfiles
rs
| forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse ListProfiles
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListProfilesResponse (Maybe Text)
listProfilesResponse_nextToken
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
) =
forall a. Maybe a
Prelude.Nothing
| forall a. AWSTruncated a => a -> Bool
Core.stop
(AWSResponse ListProfiles
rs forall s a. s -> Getting a s a -> a
Lens.^. Lens' ListProfilesResponse [ListedProfile]
listProfilesResponse_profiles) =
forall a. Maybe a
Prelude.Nothing
| Bool
Prelude.otherwise =
forall a. a -> Maybe a
Prelude.Just
forall a b. (a -> b) -> a -> b
Prelude.$ ListProfiles
rq
forall a b. a -> (a -> b) -> b
Prelude.& Lens' ListProfiles (Maybe Text)
listProfiles_nextToken
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListProfiles
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListProfilesResponse (Maybe Text)
listProfilesResponse_nextToken
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
instance Core.AWSRequest ListProfiles where
type AWSResponse ListProfiles = ListProfilesResponse
request :: (Service -> Service) -> ListProfiles -> Request ListProfiles
request Service -> Service
overrides =
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy ListProfiles
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListProfiles)))
response =
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Maybe Text -> Int -> [ListedProfile] -> ListProfilesResponse
ListProfilesResponse'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"NextToken")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"Profiles" forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty)
)
instance Prelude.Hashable ListProfiles where
hashWithSalt :: Int -> ListProfiles -> Int
hashWithSalt Int
_salt ListProfiles' {Maybe Natural
Maybe Text
Maybe ProfileType
profileType :: Maybe ProfileType
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:profileType:ListProfiles' :: ListProfiles -> Maybe ProfileType
$sel:nextToken:ListProfiles' :: ListProfiles -> Maybe Text
$sel:maxResults:ListProfiles' :: ListProfiles -> Maybe Natural
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
maxResults
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
nextToken
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ProfileType
profileType
instance Prelude.NFData ListProfiles where
rnf :: ListProfiles -> ()
rnf ListProfiles' {Maybe Natural
Maybe Text
Maybe ProfileType
profileType :: Maybe ProfileType
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:profileType:ListProfiles' :: ListProfiles -> Maybe ProfileType
$sel:nextToken:ListProfiles' :: ListProfiles -> Maybe Text
$sel:maxResults:ListProfiles' :: ListProfiles -> Maybe Natural
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
maxResults
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextToken
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ProfileType
profileType
instance Data.ToHeaders ListProfiles where
toHeaders :: ListProfiles -> ResponseHeaders
toHeaders =
forall a b. a -> b -> a
Prelude.const
( forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"TransferService.ListProfiles" ::
Prelude.ByteString
),
HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Data.ToJSON ListProfiles where
toJSON :: ListProfiles -> Value
toJSON ListProfiles' {Maybe Natural
Maybe Text
Maybe ProfileType
profileType :: Maybe ProfileType
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:profileType:ListProfiles' :: ListProfiles -> Maybe ProfileType
$sel:nextToken:ListProfiles' :: ListProfiles -> Maybe Text
$sel:maxResults:ListProfiles' :: ListProfiles -> Maybe Natural
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"MaxResults" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
maxResults,
(Key
"NextToken" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
nextToken,
(Key
"ProfileType" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ProfileType
profileType
]
)
instance Data.ToPath ListProfiles where
toPath :: ListProfiles -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery ListProfiles where
toQuery :: ListProfiles -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data ListProfilesResponse = ListProfilesResponse'
{
ListProfilesResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListProfilesResponse -> Int
httpStatus :: Prelude.Int,
ListProfilesResponse -> [ListedProfile]
profiles :: [ListedProfile]
}
deriving (ListProfilesResponse -> ListProfilesResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListProfilesResponse -> ListProfilesResponse -> Bool
$c/= :: ListProfilesResponse -> ListProfilesResponse -> Bool
== :: ListProfilesResponse -> ListProfilesResponse -> Bool
$c== :: ListProfilesResponse -> ListProfilesResponse -> Bool
Prelude.Eq, ReadPrec [ListProfilesResponse]
ReadPrec ListProfilesResponse
Int -> ReadS ListProfilesResponse
ReadS [ListProfilesResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListProfilesResponse]
$creadListPrec :: ReadPrec [ListProfilesResponse]
readPrec :: ReadPrec ListProfilesResponse
$creadPrec :: ReadPrec ListProfilesResponse
readList :: ReadS [ListProfilesResponse]
$creadList :: ReadS [ListProfilesResponse]
readsPrec :: Int -> ReadS ListProfilesResponse
$creadsPrec :: Int -> ReadS ListProfilesResponse
Prelude.Read, Int -> ListProfilesResponse -> ShowS
[ListProfilesResponse] -> ShowS
ListProfilesResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListProfilesResponse] -> ShowS
$cshowList :: [ListProfilesResponse] -> ShowS
show :: ListProfilesResponse -> String
$cshow :: ListProfilesResponse -> String
showsPrec :: Int -> ListProfilesResponse -> ShowS
$cshowsPrec :: Int -> ListProfilesResponse -> ShowS
Prelude.Show, forall x. Rep ListProfilesResponse x -> ListProfilesResponse
forall x. ListProfilesResponse -> Rep ListProfilesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListProfilesResponse x -> ListProfilesResponse
$cfrom :: forall x. ListProfilesResponse -> Rep ListProfilesResponse x
Prelude.Generic)
newListProfilesResponse ::
Prelude.Int ->
ListProfilesResponse
newListProfilesResponse :: Int -> ListProfilesResponse
newListProfilesResponse Int
pHttpStatus_ =
ListProfilesResponse'
{ $sel:nextToken:ListProfilesResponse' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ListProfilesResponse' :: Int
httpStatus = Int
pHttpStatus_,
$sel:profiles:ListProfilesResponse' :: [ListedProfile]
profiles = forall a. Monoid a => a
Prelude.mempty
}
listProfilesResponse_nextToken :: Lens.Lens' ListProfilesResponse (Prelude.Maybe Prelude.Text)
listProfilesResponse_nextToken :: Lens' ListProfilesResponse (Maybe Text)
listProfilesResponse_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListProfilesResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListProfilesResponse' :: ListProfilesResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListProfilesResponse
s@ListProfilesResponse' {} Maybe Text
a -> ListProfilesResponse
s {$sel:nextToken:ListProfilesResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListProfilesResponse)
listProfilesResponse_httpStatus :: Lens.Lens' ListProfilesResponse Prelude.Int
listProfilesResponse_httpStatus :: Lens' ListProfilesResponse Int
listProfilesResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListProfilesResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListProfilesResponse' :: ListProfilesResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListProfilesResponse
s@ListProfilesResponse' {} Int
a -> ListProfilesResponse
s {$sel:httpStatus:ListProfilesResponse' :: Int
httpStatus = Int
a} :: ListProfilesResponse)
listProfilesResponse_profiles :: Lens.Lens' ListProfilesResponse [ListedProfile]
listProfilesResponse_profiles :: Lens' ListProfilesResponse [ListedProfile]
listProfilesResponse_profiles = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListProfilesResponse' {[ListedProfile]
profiles :: [ListedProfile]
$sel:profiles:ListProfilesResponse' :: ListProfilesResponse -> [ListedProfile]
profiles} -> [ListedProfile]
profiles) (\s :: ListProfilesResponse
s@ListProfilesResponse' {} [ListedProfile]
a -> ListProfilesResponse
s {$sel:profiles:ListProfilesResponse' :: [ListedProfile]
profiles = [ListedProfile]
a} :: ListProfilesResponse) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Prelude.NFData ListProfilesResponse where
rnf :: ListProfilesResponse -> ()
rnf ListProfilesResponse' {Int
[ListedProfile]
Maybe Text
profiles :: [ListedProfile]
httpStatus :: Int
nextToken :: Maybe Text
$sel:profiles:ListProfilesResponse' :: ListProfilesResponse -> [ListedProfile]
$sel:httpStatus:ListProfilesResponse' :: ListProfilesResponse -> Int
$sel:nextToken:ListProfilesResponse' :: ListProfilesResponse -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextToken
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf [ListedProfile]
profiles