{-# 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 #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.Organizations.ListHandshakesForAccount
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Lists the current handshakes that are associated with the account of the
-- requesting user.
--
-- Handshakes that are @ACCEPTED@, @DECLINED@, or @CANCELED@ appear in the
-- results of this API for only 30 days after changing to that state. After
-- that, they\'re deleted and no longer accessible.
--
-- Always check the @NextToken@ response parameter for a @null@ value when
-- calling a @List*@ operation. These operations can occasionally return an
-- empty set of results even when there are more results available. The
-- @NextToken@ response parameter value is @null@ /only/ when there are no
-- more results to display.
--
-- This operation can be called from any account in the organization.
--
-- This operation returns paginated results.
module Amazonka.Organizations.ListHandshakesForAccount
  ( -- * Creating a Request
    ListHandshakesForAccount (..),
    newListHandshakesForAccount,

    -- * Request Lenses
    listHandshakesForAccount_nextToken,
    listHandshakesForAccount_filter,
    listHandshakesForAccount_maxResults,

    -- * Destructuring the Response
    ListHandshakesForAccountResponse (..),
    newListHandshakesForAccountResponse,

    -- * Response Lenses
    listHandshakesForAccountResponse_handshakes,
    listHandshakesForAccountResponse_nextToken,
    listHandshakesForAccountResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.Organizations.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newListHandshakesForAccount' smart constructor.
data ListHandshakesForAccount = ListHandshakesForAccount'
  { -- | The parameter for receiving additional results if you receive a
    -- @NextToken@ response in a previous request. A @NextToken@ response
    -- indicates that more output is available. Set this parameter to the value
    -- of the previous call\'s @NextToken@ response to indicate where the
    -- output should continue from.
    ListHandshakesForAccount -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | Filters the handshakes that you want included in the response. The
    -- default is all types. Use the @ActionType@ element to limit the output
    -- to only a specified type, such as @INVITE@, @ENABLE_ALL_FEATURES@, or
    -- @APPROVE_ALL_FEATURES@. Alternatively, for the @ENABLE_ALL_FEATURES@
    -- handshake that generates a separate child handshake for each member
    -- account, you can specify @ParentHandshakeId@ to see only the handshakes
    -- that were generated by that parent request.
    ListHandshakesForAccount -> Maybe HandshakeFilter
filter' :: Prelude.Maybe HandshakeFilter,
    -- | The total number of results that you want included on each page of the
    -- response. If you do not include this parameter, it defaults to a value
    -- that is specific to the operation. If additional items exist beyond the
    -- maximum you specify, the @NextToken@ response element is present and has
    -- a value (is not null). Include that value as the @NextToken@ request
    -- parameter in the next call to the operation to get the next part of the
    -- results. Note that Organizations might return fewer results than the
    -- maximum even when there are more results available. You should check
    -- @NextToken@ after every operation to ensure that you receive all of the
    -- results.
    ListHandshakesForAccount -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural
  }
  deriving (ListHandshakesForAccount -> ListHandshakesForAccount -> Bool
(ListHandshakesForAccount -> ListHandshakesForAccount -> Bool)
-> (ListHandshakesForAccount -> ListHandshakesForAccount -> Bool)
-> Eq ListHandshakesForAccount
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]
(Int -> ReadS ListHandshakesForAccount)
-> ReadS [ListHandshakesForAccount]
-> ReadPrec ListHandshakesForAccount
-> ReadPrec [ListHandshakesForAccount]
-> Read 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
(Int -> ListHandshakesForAccount -> ShowS)
-> (ListHandshakesForAccount -> String)
-> ([ListHandshakesForAccount] -> ShowS)
-> Show ListHandshakesForAccount
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.
 ListHandshakesForAccount -> Rep ListHandshakesForAccount x)
-> (forall x.
    Rep ListHandshakesForAccount x -> ListHandshakesForAccount)
-> Generic ListHandshakesForAccount
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)

-- |
-- Create a value of 'ListHandshakesForAccount' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'nextToken', 'listHandshakesForAccount_nextToken' - The parameter for receiving additional results if you receive a
-- @NextToken@ response in a previous request. A @NextToken@ response
-- indicates that more output is available. Set this parameter to the value
-- of the previous call\'s @NextToken@ response to indicate where the
-- output should continue from.
--
-- 'filter'', 'listHandshakesForAccount_filter' - Filters the handshakes that you want included in the response. The
-- default is all types. Use the @ActionType@ element to limit the output
-- to only a specified type, such as @INVITE@, @ENABLE_ALL_FEATURES@, or
-- @APPROVE_ALL_FEATURES@. Alternatively, for the @ENABLE_ALL_FEATURES@
-- handshake that generates a separate child handshake for each member
-- account, you can specify @ParentHandshakeId@ to see only the handshakes
-- that were generated by that parent request.
--
-- 'maxResults', 'listHandshakesForAccount_maxResults' - The total number of results that you want included on each page of the
-- response. If you do not include this parameter, it defaults to a value
-- that is specific to the operation. If additional items exist beyond the
-- maximum you specify, the @NextToken@ response element is present and has
-- a value (is not null). Include that value as the @NextToken@ request
-- parameter in the next call to the operation to get the next part of the
-- results. Note that Organizations might return fewer results than the
-- maximum even when there are more results available. You should check
-- @NextToken@ after every operation to ensure that you receive all of the
-- results.
newListHandshakesForAccount ::
  ListHandshakesForAccount
newListHandshakesForAccount :: ListHandshakesForAccount
newListHandshakesForAccount =
  ListHandshakesForAccount' :: Maybe Text
-> Maybe HandshakeFilter
-> Maybe Natural
-> ListHandshakesForAccount
ListHandshakesForAccount'
    { $sel:nextToken:ListHandshakesForAccount' :: Maybe Text
nextToken =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:filter':ListHandshakesForAccount' :: Maybe HandshakeFilter
filter' = Maybe HandshakeFilter
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:ListHandshakesForAccount' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing
    }

-- | The parameter for receiving additional results if you receive a
-- @NextToken@ response in a previous request. A @NextToken@ response
-- indicates that more output is available. Set this parameter to the value
-- of the previous call\'s @NextToken@ response to indicate where the
-- output should continue from.
listHandshakesForAccount_nextToken :: Lens.Lens' ListHandshakesForAccount (Prelude.Maybe Prelude.Text)
listHandshakesForAccount_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListHandshakesForAccount -> f ListHandshakesForAccount
listHandshakesForAccount_nextToken = (ListHandshakesForAccount -> Maybe Text)
-> (ListHandshakesForAccount
    -> Maybe Text -> ListHandshakesForAccount)
-> Lens
     ListHandshakesForAccount
     ListHandshakesForAccount
     (Maybe Text)
     (Maybe Text)
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)

-- | Filters the handshakes that you want included in the response. The
-- default is all types. Use the @ActionType@ element to limit the output
-- to only a specified type, such as @INVITE@, @ENABLE_ALL_FEATURES@, or
-- @APPROVE_ALL_FEATURES@. Alternatively, for the @ENABLE_ALL_FEATURES@
-- handshake that generates a separate child handshake for each member
-- account, you can specify @ParentHandshakeId@ to see only the handshakes
-- that were generated by that parent request.
listHandshakesForAccount_filter :: Lens.Lens' ListHandshakesForAccount (Prelude.Maybe HandshakeFilter)
listHandshakesForAccount_filter :: (Maybe HandshakeFilter -> f (Maybe HandshakeFilter))
-> ListHandshakesForAccount -> f ListHandshakesForAccount
listHandshakesForAccount_filter = (ListHandshakesForAccount -> Maybe HandshakeFilter)
-> (ListHandshakesForAccount
    -> Maybe HandshakeFilter -> ListHandshakesForAccount)
-> Lens
     ListHandshakesForAccount
     ListHandshakesForAccount
     (Maybe HandshakeFilter)
     (Maybe HandshakeFilter)
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)

-- | The total number of results that you want included on each page of the
-- response. If you do not include this parameter, it defaults to a value
-- that is specific to the operation. If additional items exist beyond the
-- maximum you specify, the @NextToken@ response element is present and has
-- a value (is not null). Include that value as the @NextToken@ request
-- parameter in the next call to the operation to get the next part of the
-- results. Note that Organizations might return fewer results than the
-- maximum even when there are more results available. You should check
-- @NextToken@ after every operation to ensure that you receive all of the
-- results.
listHandshakesForAccount_maxResults :: Lens.Lens' ListHandshakesForAccount (Prelude.Maybe Prelude.Natural)
listHandshakesForAccount_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> ListHandshakesForAccount -> f ListHandshakesForAccount
listHandshakesForAccount_maxResults = (ListHandshakesForAccount -> Maybe Natural)
-> (ListHandshakesForAccount
    -> Maybe Natural -> ListHandshakesForAccount)
-> Lens
     ListHandshakesForAccount
     ListHandshakesForAccount
     (Maybe Natural)
     (Maybe Natural)
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)

instance Core.AWSPager ListHandshakesForAccount where
  page :: ListHandshakesForAccount
-> AWSResponse ListHandshakesForAccount
-> Maybe ListHandshakesForAccount
page ListHandshakesForAccount
rq AWSResponse ListHandshakesForAccount
rs
    | Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListHandshakesForAccount
ListHandshakesForAccountResponse
rs
            ListHandshakesForAccountResponse
-> Getting (First Text) ListHandshakesForAccountResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListHandshakesForAccountResponse
-> Const (First Text) ListHandshakesForAccountResponse
Lens' ListHandshakesForAccountResponse (Maybe Text)
listHandshakesForAccountResponse_nextToken
              ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListHandshakesForAccountResponse
 -> Const (First Text) ListHandshakesForAccountResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListHandshakesForAccountResponse Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe ListHandshakesForAccount
forall a. Maybe a
Prelude.Nothing
    | Maybe [Handshake] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListHandshakesForAccount
ListHandshakesForAccountResponse
rs
            ListHandshakesForAccountResponse
-> Getting
     (First [Handshake]) ListHandshakesForAccountResponse [Handshake]
-> Maybe [Handshake]
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe [Handshake]
 -> Const (First [Handshake]) (Maybe [Handshake]))
-> ListHandshakesForAccountResponse
-> Const (First [Handshake]) ListHandshakesForAccountResponse
Lens' ListHandshakesForAccountResponse (Maybe [Handshake])
listHandshakesForAccountResponse_handshakes
              ((Maybe [Handshake]
  -> Const (First [Handshake]) (Maybe [Handshake]))
 -> ListHandshakesForAccountResponse
 -> Const (First [Handshake]) ListHandshakesForAccountResponse)
-> (([Handshake] -> Const (First [Handshake]) [Handshake])
    -> Maybe [Handshake]
    -> Const (First [Handshake]) (Maybe [Handshake]))
-> Getting
     (First [Handshake]) ListHandshakesForAccountResponse [Handshake]
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([Handshake] -> Const (First [Handshake]) [Handshake])
-> Maybe [Handshake]
-> Const (First [Handshake]) (Maybe [Handshake])
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe ListHandshakesForAccount
forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
      ListHandshakesForAccount -> Maybe ListHandshakesForAccount
forall a. a -> Maybe a
Prelude.Just (ListHandshakesForAccount -> Maybe ListHandshakesForAccount)
-> ListHandshakesForAccount -> Maybe ListHandshakesForAccount
forall a b. (a -> b) -> a -> b
Prelude.$
        ListHandshakesForAccount
rq
          ListHandshakesForAccount
-> (ListHandshakesForAccount -> ListHandshakesForAccount)
-> ListHandshakesForAccount
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> ListHandshakesForAccount -> Identity ListHandshakesForAccount
Lens
  ListHandshakesForAccount
  ListHandshakesForAccount
  (Maybe Text)
  (Maybe Text)
listHandshakesForAccount_nextToken
          ((Maybe Text -> Identity (Maybe Text))
 -> ListHandshakesForAccount -> Identity ListHandshakesForAccount)
-> Maybe Text
-> ListHandshakesForAccount
-> ListHandshakesForAccount
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListHandshakesForAccount
ListHandshakesForAccountResponse
rs
          ListHandshakesForAccountResponse
-> Getting (First Text) ListHandshakesForAccountResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListHandshakesForAccountResponse
-> Const (First Text) ListHandshakesForAccountResponse
Lens' ListHandshakesForAccountResponse (Maybe Text)
listHandshakesForAccountResponse_nextToken
            ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListHandshakesForAccountResponse
 -> Const (First Text) ListHandshakesForAccountResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListHandshakesForAccountResponse Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just

instance Core.AWSRequest ListHandshakesForAccount where
  type
    AWSResponse ListHandshakesForAccount =
      ListHandshakesForAccountResponse
  request :: ListHandshakesForAccount -> Request ListHandshakesForAccount
request = Service
-> ListHandshakesForAccount -> Request ListHandshakesForAccount
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy ListHandshakesForAccount
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ListHandshakesForAccount)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse ListHandshakesForAccount))
-> Logger
-> Service
-> Proxy ListHandshakesForAccount
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ListHandshakesForAccount)))
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 [Handshake]
-> Maybe Text -> Int -> ListHandshakesForAccountResponse
ListHandshakesForAccountResponse'
            (Maybe [Handshake]
 -> Maybe Text -> Int -> ListHandshakesForAccountResponse)
-> Either String (Maybe [Handshake])
-> Either
     String (Maybe Text -> Int -> ListHandshakesForAccountResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe (Maybe [Handshake]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Handshakes" Either String (Maybe (Maybe [Handshake]))
-> Maybe [Handshake] -> Either String (Maybe [Handshake])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [Handshake]
forall a. Monoid a => a
Prelude.mempty)
            Either
  String (Maybe Text -> Int -> ListHandshakesForAccountResponse)
-> Either String (Maybe Text)
-> Either String (Int -> ListHandshakesForAccountResponse)
forall (f :: * -> *) a b. Applicative f => 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 -> ListHandshakesForAccountResponse)
-> Either String Int
-> Either String ListHandshakesForAccountResponse
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 ListHandshakesForAccount

instance Prelude.NFData ListHandshakesForAccount

instance Core.ToHeaders ListHandshakesForAccount where
  toHeaders :: ListHandshakesForAccount -> ResponseHeaders
toHeaders =
    ResponseHeaders -> ListHandshakesForAccount -> 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
"AWSOrganizationsV20161128.ListHandshakesForAccount" ::
                          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 ListHandshakesForAccount where
  toJSON :: ListHandshakesForAccount -> Value
toJSON ListHandshakesForAccount' {Maybe Natural
Maybe Text
Maybe HandshakeFilter
maxResults :: Maybe Natural
filter' :: Maybe HandshakeFilter
nextToken :: Maybe Text
$sel:maxResults:ListHandshakesForAccount' :: ListHandshakesForAccount -> Maybe Natural
$sel:filter':ListHandshakesForAccount' :: ListHandshakesForAccount -> Maybe HandshakeFilter
$sel:nextToken:ListHandshakesForAccount' :: ListHandshakesForAccount -> 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
"Filter" Text -> HandshakeFilter -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (HandshakeFilter -> Pair) -> Maybe HandshakeFilter -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe HandshakeFilter
filter',
            (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
          ]
      )

instance Core.ToPath ListHandshakesForAccount where
  toPath :: ListHandshakesForAccount -> ByteString
toPath = ByteString -> ListHandshakesForAccount -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

instance Core.ToQuery ListHandshakesForAccount where
  toQuery :: ListHandshakesForAccount -> QueryString
toQuery = QueryString -> ListHandshakesForAccount -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty

-- | /See:/ 'newListHandshakesForAccountResponse' smart constructor.
data ListHandshakesForAccountResponse = ListHandshakesForAccountResponse'
  { -- | A list of Handshake objects with details about each of the handshakes
    -- that is associated with the specified account.
    ListHandshakesForAccountResponse -> Maybe [Handshake]
handshakes :: Prelude.Maybe [Handshake],
    -- | If present, indicates that more output is available than is included in
    -- the current response. Use this value in the @NextToken@ request
    -- parameter in a subsequent call to the operation to get the next part of
    -- the output. You should repeat this until the @NextToken@ response
    -- element comes back as @null@.
    ListHandshakesForAccountResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    ListHandshakesForAccountResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ListHandshakesForAccountResponse
-> ListHandshakesForAccountResponse -> Bool
(ListHandshakesForAccountResponse
 -> ListHandshakesForAccountResponse -> Bool)
-> (ListHandshakesForAccountResponse
    -> ListHandshakesForAccountResponse -> Bool)
-> Eq ListHandshakesForAccountResponse
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
(Int -> ListHandshakesForAccountResponse -> ShowS)
-> (ListHandshakesForAccountResponse -> String)
-> ([ListHandshakesForAccountResponse] -> ShowS)
-> Show ListHandshakesForAccountResponse
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.
 ListHandshakesForAccountResponse
 -> Rep ListHandshakesForAccountResponse x)
-> (forall x.
    Rep ListHandshakesForAccountResponse x
    -> ListHandshakesForAccountResponse)
-> Generic ListHandshakesForAccountResponse
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)

-- |
-- Create a value of 'ListHandshakesForAccountResponse' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'handshakes', 'listHandshakesForAccountResponse_handshakes' - A list of Handshake objects with details about each of the handshakes
-- that is associated with the specified account.
--
-- 'nextToken', 'listHandshakesForAccountResponse_nextToken' - If present, indicates that more output is available than is included in
-- the current response. Use this value in the @NextToken@ request
-- parameter in a subsequent call to the operation to get the next part of
-- the output. You should repeat this until the @NextToken@ response
-- element comes back as @null@.
--
-- 'httpStatus', 'listHandshakesForAccountResponse_httpStatus' - The response's http status code.
newListHandshakesForAccountResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListHandshakesForAccountResponse
newListHandshakesForAccountResponse :: Int -> ListHandshakesForAccountResponse
newListHandshakesForAccountResponse Int
pHttpStatus_ =
  ListHandshakesForAccountResponse' :: Maybe [Handshake]
-> Maybe Text -> Int -> ListHandshakesForAccountResponse
ListHandshakesForAccountResponse'
    { $sel:handshakes:ListHandshakesForAccountResponse' :: Maybe [Handshake]
handshakes =
        Maybe [Handshake]
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListHandshakesForAccountResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListHandshakesForAccountResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | A list of Handshake objects with details about each of the handshakes
-- that is associated with the specified account.
listHandshakesForAccountResponse_handshakes :: Lens.Lens' ListHandshakesForAccountResponse (Prelude.Maybe [Handshake])
listHandshakesForAccountResponse_handshakes :: (Maybe [Handshake] -> f (Maybe [Handshake]))
-> ListHandshakesForAccountResponse
-> f ListHandshakesForAccountResponse
listHandshakesForAccountResponse_handshakes = (ListHandshakesForAccountResponse -> Maybe [Handshake])
-> (ListHandshakesForAccountResponse
    -> Maybe [Handshake] -> ListHandshakesForAccountResponse)
-> Lens' ListHandshakesForAccountResponse (Maybe [Handshake])
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) ((Maybe [Handshake] -> f (Maybe [Handshake]))
 -> ListHandshakesForAccountResponse
 -> f ListHandshakesForAccountResponse)
-> ((Maybe [Handshake] -> f (Maybe [Handshake]))
    -> Maybe [Handshake] -> f (Maybe [Handshake]))
-> (Maybe [Handshake] -> f (Maybe [Handshake]))
-> ListHandshakesForAccountResponse
-> f ListHandshakesForAccountResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Handshake] [Handshake] [Handshake] [Handshake]
-> Iso
     (Maybe [Handshake])
     (Maybe [Handshake])
     (Maybe [Handshake])
     (Maybe [Handshake])
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 [Handshake] [Handshake] [Handshake] [Handshake]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | If present, indicates that more output is available than is included in
-- the current response. Use this value in the @NextToken@ request
-- parameter in a subsequent call to the operation to get the next part of
-- the output. You should repeat this until the @NextToken@ response
-- element comes back as @null@.
listHandshakesForAccountResponse_nextToken :: Lens.Lens' ListHandshakesForAccountResponse (Prelude.Maybe Prelude.Text)
listHandshakesForAccountResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListHandshakesForAccountResponse
-> f ListHandshakesForAccountResponse
listHandshakesForAccountResponse_nextToken = (ListHandshakesForAccountResponse -> Maybe Text)
-> (ListHandshakesForAccountResponse
    -> Maybe Text -> ListHandshakesForAccountResponse)
-> Lens' ListHandshakesForAccountResponse (Maybe Text)
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)

-- | The response's http status code.
listHandshakesForAccountResponse_httpStatus :: Lens.Lens' ListHandshakesForAccountResponse Prelude.Int
listHandshakesForAccountResponse_httpStatus :: (Int -> f Int)
-> ListHandshakesForAccountResponse
-> f ListHandshakesForAccountResponse
listHandshakesForAccountResponse_httpStatus = (ListHandshakesForAccountResponse -> Int)
-> (ListHandshakesForAccountResponse
    -> Int -> ListHandshakesForAccountResponse)
-> Lens
     ListHandshakesForAccountResponse
     ListHandshakesForAccountResponse
     Int
     Int
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