{-# 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.Organizations.ListHandshakesForAccount
(
ListHandshakesForAccount (..),
newListHandshakesForAccount,
listHandshakesForAccount_filter,
listHandshakesForAccount_maxResults,
listHandshakesForAccount_nextToken,
ListHandshakesForAccountResponse (..),
newListHandshakesForAccountResponse,
listHandshakesForAccountResponse_handshakes,
listHandshakesForAccountResponse_nextToken,
listHandshakesForAccountResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.Organizations.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data ListHandshakesForAccount = ListHandshakesForAccount'
{
ListHandshakesForAccount -> Maybe HandshakeFilter
filter' :: Prelude.Maybe HandshakeFilter,
ListHandshakesForAccount -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
ListHandshakesForAccount -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text
}
deriving (ListHandshakesForAccount -> ListHandshakesForAccount -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListHandshakesForAccount -> ListHandshakesForAccount -> Bool
$c/= :: ListHandshakesForAccount -> ListHandshakesForAccount -> Bool
== :: ListHandshakesForAccount -> ListHandshakesForAccount -> Bool
$c== :: ListHandshakesForAccount -> ListHandshakesForAccount -> Bool
Prelude.Eq, ReadPrec [ListHandshakesForAccount]
ReadPrec ListHandshakesForAccount
Int -> ReadS ListHandshakesForAccount
ReadS [ListHandshakesForAccount]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListHandshakesForAccount]
$creadListPrec :: ReadPrec [ListHandshakesForAccount]
readPrec :: ReadPrec ListHandshakesForAccount
$creadPrec :: ReadPrec ListHandshakesForAccount
readList :: ReadS [ListHandshakesForAccount]
$creadList :: ReadS [ListHandshakesForAccount]
readsPrec :: Int -> ReadS ListHandshakesForAccount
$creadsPrec :: Int -> ReadS ListHandshakesForAccount
Prelude.Read, Int -> ListHandshakesForAccount -> ShowS
[ListHandshakesForAccount] -> ShowS
ListHandshakesForAccount -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListHandshakesForAccount] -> ShowS
$cshowList :: [ListHandshakesForAccount] -> ShowS
show :: ListHandshakesForAccount -> String
$cshow :: ListHandshakesForAccount -> String
showsPrec :: Int -> ListHandshakesForAccount -> ShowS
$cshowsPrec :: Int -> ListHandshakesForAccount -> ShowS
Prelude.Show, forall x.
Rep ListHandshakesForAccount x -> ListHandshakesForAccount
forall x.
ListHandshakesForAccount -> Rep ListHandshakesForAccount x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListHandshakesForAccount x -> ListHandshakesForAccount
$cfrom :: forall x.
ListHandshakesForAccount -> Rep ListHandshakesForAccount x
Prelude.Generic)
newListHandshakesForAccount ::
ListHandshakesForAccount
newListHandshakesForAccount :: ListHandshakesForAccount
newListHandshakesForAccount =
ListHandshakesForAccount'
{ $sel:filter':ListHandshakesForAccount' :: Maybe HandshakeFilter
filter' =
forall a. Maybe a
Prelude.Nothing,
$sel:maxResults:ListHandshakesForAccount' :: Maybe Natural
maxResults = forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:ListHandshakesForAccount' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing
}
listHandshakesForAccount_filter :: Lens.Lens' ListHandshakesForAccount (Prelude.Maybe HandshakeFilter)
listHandshakesForAccount_filter :: Lens' ListHandshakesForAccount (Maybe HandshakeFilter)
listHandshakesForAccount_filter = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListHandshakesForAccount' {Maybe HandshakeFilter
filter' :: Maybe HandshakeFilter
$sel:filter':ListHandshakesForAccount' :: ListHandshakesForAccount -> Maybe HandshakeFilter
filter'} -> Maybe HandshakeFilter
filter') (\s :: ListHandshakesForAccount
s@ListHandshakesForAccount' {} Maybe HandshakeFilter
a -> ListHandshakesForAccount
s {$sel:filter':ListHandshakesForAccount' :: Maybe HandshakeFilter
filter' = Maybe HandshakeFilter
a} :: ListHandshakesForAccount)
listHandshakesForAccount_maxResults :: Lens.Lens' ListHandshakesForAccount (Prelude.Maybe Prelude.Natural)
listHandshakesForAccount_maxResults :: Lens' ListHandshakesForAccount (Maybe Natural)
listHandshakesForAccount_maxResults = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListHandshakesForAccount' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListHandshakesForAccount' :: ListHandshakesForAccount -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListHandshakesForAccount
s@ListHandshakesForAccount' {} Maybe Natural
a -> ListHandshakesForAccount
s {$sel:maxResults:ListHandshakesForAccount' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListHandshakesForAccount)
listHandshakesForAccount_nextToken :: Lens.Lens' ListHandshakesForAccount (Prelude.Maybe Prelude.Text)
listHandshakesForAccount_nextToken :: Lens' ListHandshakesForAccount (Maybe Text)
listHandshakesForAccount_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListHandshakesForAccount' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListHandshakesForAccount' :: ListHandshakesForAccount -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListHandshakesForAccount
s@ListHandshakesForAccount' {} Maybe Text
a -> ListHandshakesForAccount
s {$sel:nextToken:ListHandshakesForAccount' :: Maybe Text
nextToken = Maybe Text
a} :: ListHandshakesForAccount)
instance Core.AWSPager ListHandshakesForAccount where
page :: ListHandshakesForAccount
-> AWSResponse ListHandshakesForAccount
-> Maybe ListHandshakesForAccount
page ListHandshakesForAccount
rq AWSResponse ListHandshakesForAccount
rs
| forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse ListHandshakesForAccount
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListHandshakesForAccountResponse (Maybe Text)
listHandshakesForAccountResponse_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 ListHandshakesForAccount
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListHandshakesForAccountResponse (Maybe [Handshake])
listHandshakesForAccountResponse_handshakes
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
| Bool
Prelude.otherwise =
forall a. a -> Maybe a
Prelude.Just
forall a b. (a -> b) -> a -> b
Prelude.$ ListHandshakesForAccount
rq
forall a b. a -> (a -> b) -> b
Prelude.& Lens' ListHandshakesForAccount (Maybe Text)
listHandshakesForAccount_nextToken
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListHandshakesForAccount
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListHandshakesForAccountResponse (Maybe Text)
listHandshakesForAccountResponse_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 ListHandshakesForAccount where
type
AWSResponse ListHandshakesForAccount =
ListHandshakesForAccountResponse
request :: (Service -> Service)
-> ListHandshakesForAccount -> Request ListHandshakesForAccount
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 ListHandshakesForAccount
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse ListHandshakesForAccount)))
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 [Handshake]
-> Maybe Text -> Int -> ListHandshakesForAccountResponse
ListHandshakesForAccountResponse'
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
"Handshakes" forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty)
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
"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))
)
instance Prelude.Hashable ListHandshakesForAccount where
hashWithSalt :: Int -> ListHandshakesForAccount -> Int
hashWithSalt Int
_salt ListHandshakesForAccount' {Maybe Natural
Maybe Text
Maybe HandshakeFilter
nextToken :: Maybe Text
maxResults :: Maybe Natural
filter' :: Maybe HandshakeFilter
$sel:nextToken:ListHandshakesForAccount' :: ListHandshakesForAccount -> Maybe Text
$sel:maxResults:ListHandshakesForAccount' :: ListHandshakesForAccount -> Maybe Natural
$sel:filter':ListHandshakesForAccount' :: ListHandshakesForAccount -> Maybe HandshakeFilter
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe HandshakeFilter
filter'
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
maxResults
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
nextToken
instance Prelude.NFData ListHandshakesForAccount where
rnf :: ListHandshakesForAccount -> ()
rnf ListHandshakesForAccount' {Maybe Natural
Maybe Text
Maybe HandshakeFilter
nextToken :: Maybe Text
maxResults :: Maybe Natural
filter' :: Maybe HandshakeFilter
$sel:nextToken:ListHandshakesForAccount' :: ListHandshakesForAccount -> Maybe Text
$sel:maxResults:ListHandshakesForAccount' :: ListHandshakesForAccount -> Maybe Natural
$sel:filter':ListHandshakesForAccount' :: ListHandshakesForAccount -> Maybe HandshakeFilter
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe HandshakeFilter
filter'
seq :: forall a b. a -> b -> b
`Prelude.seq` 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
instance Data.ToHeaders ListHandshakesForAccount where
toHeaders :: ListHandshakesForAccount -> 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
"AWSOrganizationsV20161128.ListHandshakesForAccount" ::
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 ListHandshakesForAccount where
toJSON :: ListHandshakesForAccount -> Value
toJSON ListHandshakesForAccount' {Maybe Natural
Maybe Text
Maybe HandshakeFilter
nextToken :: Maybe Text
maxResults :: Maybe Natural
filter' :: Maybe HandshakeFilter
$sel:nextToken:ListHandshakesForAccount' :: ListHandshakesForAccount -> Maybe Text
$sel:maxResults:ListHandshakesForAccount' :: ListHandshakesForAccount -> Maybe Natural
$sel:filter':ListHandshakesForAccount' :: ListHandshakesForAccount -> Maybe HandshakeFilter
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"Filter" 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 HandshakeFilter
filter',
(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
]
)
instance Data.ToPath ListHandshakesForAccount where
toPath :: ListHandshakesForAccount -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery ListHandshakesForAccount where
toQuery :: ListHandshakesForAccount -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data ListHandshakesForAccountResponse = ListHandshakesForAccountResponse'
{
ListHandshakesForAccountResponse -> Maybe [Handshake]
handshakes :: Prelude.Maybe [Handshake],
ListHandshakesForAccountResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListHandshakesForAccountResponse -> Int
httpStatus :: Prelude.Int
}
deriving (ListHandshakesForAccountResponse
-> ListHandshakesForAccountResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListHandshakesForAccountResponse
-> ListHandshakesForAccountResponse -> Bool
$c/= :: ListHandshakesForAccountResponse
-> ListHandshakesForAccountResponse -> Bool
== :: ListHandshakesForAccountResponse
-> ListHandshakesForAccountResponse -> Bool
$c== :: ListHandshakesForAccountResponse
-> ListHandshakesForAccountResponse -> Bool
Prelude.Eq, Int -> ListHandshakesForAccountResponse -> ShowS
[ListHandshakesForAccountResponse] -> ShowS
ListHandshakesForAccountResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListHandshakesForAccountResponse] -> ShowS
$cshowList :: [ListHandshakesForAccountResponse] -> ShowS
show :: ListHandshakesForAccountResponse -> String
$cshow :: ListHandshakesForAccountResponse -> String
showsPrec :: Int -> ListHandshakesForAccountResponse -> ShowS
$cshowsPrec :: Int -> ListHandshakesForAccountResponse -> ShowS
Prelude.Show, forall x.
Rep ListHandshakesForAccountResponse x
-> ListHandshakesForAccountResponse
forall x.
ListHandshakesForAccountResponse
-> Rep ListHandshakesForAccountResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListHandshakesForAccountResponse x
-> ListHandshakesForAccountResponse
$cfrom :: forall x.
ListHandshakesForAccountResponse
-> Rep ListHandshakesForAccountResponse x
Prelude.Generic)
newListHandshakesForAccountResponse ::
Prelude.Int ->
ListHandshakesForAccountResponse
newListHandshakesForAccountResponse :: Int -> ListHandshakesForAccountResponse
newListHandshakesForAccountResponse Int
pHttpStatus_ =
ListHandshakesForAccountResponse'
{ $sel:handshakes:ListHandshakesForAccountResponse' :: Maybe [Handshake]
handshakes =
forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:ListHandshakesForAccountResponse' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ListHandshakesForAccountResponse' :: Int
httpStatus = Int
pHttpStatus_
}
listHandshakesForAccountResponse_handshakes :: Lens.Lens' ListHandshakesForAccountResponse (Prelude.Maybe [Handshake])
listHandshakesForAccountResponse_handshakes :: Lens' ListHandshakesForAccountResponse (Maybe [Handshake])
listHandshakesForAccountResponse_handshakes = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListHandshakesForAccountResponse' {Maybe [Handshake]
handshakes :: Maybe [Handshake]
$sel:handshakes:ListHandshakesForAccountResponse' :: ListHandshakesForAccountResponse -> Maybe [Handshake]
handshakes} -> Maybe [Handshake]
handshakes) (\s :: ListHandshakesForAccountResponse
s@ListHandshakesForAccountResponse' {} Maybe [Handshake]
a -> ListHandshakesForAccountResponse
s {$sel:handshakes:ListHandshakesForAccountResponse' :: Maybe [Handshake]
handshakes = Maybe [Handshake]
a} :: ListHandshakesForAccountResponse) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
listHandshakesForAccountResponse_nextToken :: Lens.Lens' ListHandshakesForAccountResponse (Prelude.Maybe Prelude.Text)
listHandshakesForAccountResponse_nextToken :: Lens' ListHandshakesForAccountResponse (Maybe Text)
listHandshakesForAccountResponse_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListHandshakesForAccountResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListHandshakesForAccountResponse' :: ListHandshakesForAccountResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListHandshakesForAccountResponse
s@ListHandshakesForAccountResponse' {} Maybe Text
a -> ListHandshakesForAccountResponse
s {$sel:nextToken:ListHandshakesForAccountResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListHandshakesForAccountResponse)
listHandshakesForAccountResponse_httpStatus :: Lens.Lens' ListHandshakesForAccountResponse Prelude.Int
listHandshakesForAccountResponse_httpStatus :: Lens' ListHandshakesForAccountResponse Int
listHandshakesForAccountResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListHandshakesForAccountResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListHandshakesForAccountResponse' :: ListHandshakesForAccountResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListHandshakesForAccountResponse
s@ListHandshakesForAccountResponse' {} Int
a -> ListHandshakesForAccountResponse
s {$sel:httpStatus:ListHandshakesForAccountResponse' :: Int
httpStatus = Int
a} :: ListHandshakesForAccountResponse)
instance
Prelude.NFData
ListHandshakesForAccountResponse
where
rnf :: ListHandshakesForAccountResponse -> ()
rnf ListHandshakesForAccountResponse' {Int
Maybe [Handshake]
Maybe Text
httpStatus :: Int
nextToken :: Maybe Text
handshakes :: Maybe [Handshake]
$sel:httpStatus:ListHandshakesForAccountResponse' :: ListHandshakesForAccountResponse -> Int
$sel:nextToken:ListHandshakesForAccountResponse' :: ListHandshakesForAccountResponse -> Maybe Text
$sel:handshakes:ListHandshakesForAccountResponse' :: ListHandshakesForAccountResponse -> Maybe [Handshake]
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe [Handshake]
handshakes
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 Int
httpStatus