{-# 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.ListHandshakesForOrganization
-- 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 handshakes that are associated with the organization that the
-- requesting user is part of. The @ListHandshakesForOrganization@
-- operation returns a list of handshake structures. Each structure
-- contains details and status about a handshake.
--
-- 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 only from the organization\'s management
-- account or by a member account that is a delegated administrator for an
-- AWS service.
--
-- This operation returns paginated results.
module Amazonka.Organizations.ListHandshakesForOrganization
  ( -- * Creating a Request
    ListHandshakesForOrganization (..),
    newListHandshakesForOrganization,

    -- * Request Lenses
    listHandshakesForOrganization_nextToken,
    listHandshakesForOrganization_filter,
    listHandshakesForOrganization_maxResults,

    -- * Destructuring the Response
    ListHandshakesForOrganizationResponse (..),
    newListHandshakesForOrganizationResponse,

    -- * Response Lenses
    listHandshakesForOrganizationResponse_handshakes,
    listHandshakesForOrganizationResponse_nextToken,
    listHandshakesForOrganizationResponse_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:/ 'newListHandshakesForOrganization' smart constructor.
data ListHandshakesForOrganization = ListHandshakesForOrganization'
  { -- | 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.
    ListHandshakesForOrganization -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | A filter of 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 the @ParentHandshakeId@ to see only the
    -- handshakes that were generated by that parent request.
    ListHandshakesForOrganization -> 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.
    ListHandshakesForOrganization -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural
  }
  deriving (ListHandshakesForOrganization
-> ListHandshakesForOrganization -> Bool
(ListHandshakesForOrganization
 -> ListHandshakesForOrganization -> Bool)
-> (ListHandshakesForOrganization
    -> ListHandshakesForOrganization -> Bool)
-> Eq ListHandshakesForOrganization
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListHandshakesForOrganization
-> ListHandshakesForOrganization -> Bool
$c/= :: ListHandshakesForOrganization
-> ListHandshakesForOrganization -> Bool
== :: ListHandshakesForOrganization
-> ListHandshakesForOrganization -> Bool
$c== :: ListHandshakesForOrganization
-> ListHandshakesForOrganization -> Bool
Prelude.Eq, ReadPrec [ListHandshakesForOrganization]
ReadPrec ListHandshakesForOrganization
Int -> ReadS ListHandshakesForOrganization
ReadS [ListHandshakesForOrganization]
(Int -> ReadS ListHandshakesForOrganization)
-> ReadS [ListHandshakesForOrganization]
-> ReadPrec ListHandshakesForOrganization
-> ReadPrec [ListHandshakesForOrganization]
-> Read ListHandshakesForOrganization
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListHandshakesForOrganization]
$creadListPrec :: ReadPrec [ListHandshakesForOrganization]
readPrec :: ReadPrec ListHandshakesForOrganization
$creadPrec :: ReadPrec ListHandshakesForOrganization
readList :: ReadS [ListHandshakesForOrganization]
$creadList :: ReadS [ListHandshakesForOrganization]
readsPrec :: Int -> ReadS ListHandshakesForOrganization
$creadsPrec :: Int -> ReadS ListHandshakesForOrganization
Prelude.Read, Int -> ListHandshakesForOrganization -> ShowS
[ListHandshakesForOrganization] -> ShowS
ListHandshakesForOrganization -> String
(Int -> ListHandshakesForOrganization -> ShowS)
-> (ListHandshakesForOrganization -> String)
-> ([ListHandshakesForOrganization] -> ShowS)
-> Show ListHandshakesForOrganization
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListHandshakesForOrganization] -> ShowS
$cshowList :: [ListHandshakesForOrganization] -> ShowS
show :: ListHandshakesForOrganization -> String
$cshow :: ListHandshakesForOrganization -> String
showsPrec :: Int -> ListHandshakesForOrganization -> ShowS
$cshowsPrec :: Int -> ListHandshakesForOrganization -> ShowS
Prelude.Show, (forall x.
 ListHandshakesForOrganization
 -> Rep ListHandshakesForOrganization x)
-> (forall x.
    Rep ListHandshakesForOrganization x
    -> ListHandshakesForOrganization)
-> Generic ListHandshakesForOrganization
forall x.
Rep ListHandshakesForOrganization x
-> ListHandshakesForOrganization
forall x.
ListHandshakesForOrganization
-> Rep ListHandshakesForOrganization x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListHandshakesForOrganization x
-> ListHandshakesForOrganization
$cfrom :: forall x.
ListHandshakesForOrganization
-> Rep ListHandshakesForOrganization x
Prelude.Generic)

-- |
-- Create a value of 'ListHandshakesForOrganization' 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', 'listHandshakesForOrganization_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'', 'listHandshakesForOrganization_filter' - A filter of 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 the @ParentHandshakeId@ to see only the
-- handshakes that were generated by that parent request.
--
-- 'maxResults', 'listHandshakesForOrganization_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.
newListHandshakesForOrganization ::
  ListHandshakesForOrganization
newListHandshakesForOrganization :: ListHandshakesForOrganization
newListHandshakesForOrganization =
  ListHandshakesForOrganization' :: Maybe Text
-> Maybe HandshakeFilter
-> Maybe Natural
-> ListHandshakesForOrganization
ListHandshakesForOrganization'
    { $sel:nextToken:ListHandshakesForOrganization' :: Maybe Text
nextToken =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:filter':ListHandshakesForOrganization' :: Maybe HandshakeFilter
filter' = Maybe HandshakeFilter
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:ListHandshakesForOrganization' :: 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.
listHandshakesForOrganization_nextToken :: Lens.Lens' ListHandshakesForOrganization (Prelude.Maybe Prelude.Text)
listHandshakesForOrganization_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListHandshakesForOrganization -> f ListHandshakesForOrganization
listHandshakesForOrganization_nextToken = (ListHandshakesForOrganization -> Maybe Text)
-> (ListHandshakesForOrganization
    -> Maybe Text -> ListHandshakesForOrganization)
-> Lens
     ListHandshakesForOrganization
     ListHandshakesForOrganization
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListHandshakesForOrganization' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListHandshakesForOrganization' :: ListHandshakesForOrganization -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListHandshakesForOrganization
s@ListHandshakesForOrganization' {} Maybe Text
a -> ListHandshakesForOrganization
s {$sel:nextToken:ListHandshakesForOrganization' :: Maybe Text
nextToken = Maybe Text
a} :: ListHandshakesForOrganization)

-- | A filter of 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 the @ParentHandshakeId@ to see only the
-- handshakes that were generated by that parent request.
listHandshakesForOrganization_filter :: Lens.Lens' ListHandshakesForOrganization (Prelude.Maybe HandshakeFilter)
listHandshakesForOrganization_filter :: (Maybe HandshakeFilter -> f (Maybe HandshakeFilter))
-> ListHandshakesForOrganization -> f ListHandshakesForOrganization
listHandshakesForOrganization_filter = (ListHandshakesForOrganization -> Maybe HandshakeFilter)
-> (ListHandshakesForOrganization
    -> Maybe HandshakeFilter -> ListHandshakesForOrganization)
-> Lens
     ListHandshakesForOrganization
     ListHandshakesForOrganization
     (Maybe HandshakeFilter)
     (Maybe HandshakeFilter)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListHandshakesForOrganization' {Maybe HandshakeFilter
filter' :: Maybe HandshakeFilter
$sel:filter':ListHandshakesForOrganization' :: ListHandshakesForOrganization -> Maybe HandshakeFilter
filter'} -> Maybe HandshakeFilter
filter') (\s :: ListHandshakesForOrganization
s@ListHandshakesForOrganization' {} Maybe HandshakeFilter
a -> ListHandshakesForOrganization
s {$sel:filter':ListHandshakesForOrganization' :: Maybe HandshakeFilter
filter' = Maybe HandshakeFilter
a} :: ListHandshakesForOrganization)

-- | 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.
listHandshakesForOrganization_maxResults :: Lens.Lens' ListHandshakesForOrganization (Prelude.Maybe Prelude.Natural)
listHandshakesForOrganization_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> ListHandshakesForOrganization -> f ListHandshakesForOrganization
listHandshakesForOrganization_maxResults = (ListHandshakesForOrganization -> Maybe Natural)
-> (ListHandshakesForOrganization
    -> Maybe Natural -> ListHandshakesForOrganization)
-> Lens
     ListHandshakesForOrganization
     ListHandshakesForOrganization
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListHandshakesForOrganization' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListHandshakesForOrganization' :: ListHandshakesForOrganization -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListHandshakesForOrganization
s@ListHandshakesForOrganization' {} Maybe Natural
a -> ListHandshakesForOrganization
s {$sel:maxResults:ListHandshakesForOrganization' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListHandshakesForOrganization)

instance Core.AWSPager ListHandshakesForOrganization where
  page :: ListHandshakesForOrganization
-> AWSResponse ListHandshakesForOrganization
-> Maybe ListHandshakesForOrganization
page ListHandshakesForOrganization
rq AWSResponse ListHandshakesForOrganization
rs
    | Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListHandshakesForOrganization
ListHandshakesForOrganizationResponse
rs
            ListHandshakesForOrganizationResponse
-> Getting (First Text) ListHandshakesForOrganizationResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListHandshakesForOrganizationResponse
-> Const (First Text) ListHandshakesForOrganizationResponse
Lens' ListHandshakesForOrganizationResponse (Maybe Text)
listHandshakesForOrganizationResponse_nextToken
              ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListHandshakesForOrganizationResponse
 -> Const (First Text) ListHandshakesForOrganizationResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListHandshakesForOrganizationResponse 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 ListHandshakesForOrganization
forall a. Maybe a
Prelude.Nothing
    | Maybe [Handshake] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListHandshakesForOrganization
ListHandshakesForOrganizationResponse
rs
            ListHandshakesForOrganizationResponse
-> Getting
     (First [Handshake])
     ListHandshakesForOrganizationResponse
     [Handshake]
-> Maybe [Handshake]
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe [Handshake]
 -> Const (First [Handshake]) (Maybe [Handshake]))
-> ListHandshakesForOrganizationResponse
-> Const (First [Handshake]) ListHandshakesForOrganizationResponse
Lens' ListHandshakesForOrganizationResponse (Maybe [Handshake])
listHandshakesForOrganizationResponse_handshakes
              ((Maybe [Handshake]
  -> Const (First [Handshake]) (Maybe [Handshake]))
 -> ListHandshakesForOrganizationResponse
 -> Const (First [Handshake]) ListHandshakesForOrganizationResponse)
-> (([Handshake] -> Const (First [Handshake]) [Handshake])
    -> Maybe [Handshake]
    -> Const (First [Handshake]) (Maybe [Handshake]))
-> Getting
     (First [Handshake])
     ListHandshakesForOrganizationResponse
     [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 ListHandshakesForOrganization
forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
      ListHandshakesForOrganization
-> Maybe ListHandshakesForOrganization
forall a. a -> Maybe a
Prelude.Just (ListHandshakesForOrganization
 -> Maybe ListHandshakesForOrganization)
-> ListHandshakesForOrganization
-> Maybe ListHandshakesForOrganization
forall a b. (a -> b) -> a -> b
Prelude.$
        ListHandshakesForOrganization
rq
          ListHandshakesForOrganization
-> (ListHandshakesForOrganization -> ListHandshakesForOrganization)
-> ListHandshakesForOrganization
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> ListHandshakesForOrganization
-> Identity ListHandshakesForOrganization
Lens
  ListHandshakesForOrganization
  ListHandshakesForOrganization
  (Maybe Text)
  (Maybe Text)
listHandshakesForOrganization_nextToken
          ((Maybe Text -> Identity (Maybe Text))
 -> ListHandshakesForOrganization
 -> Identity ListHandshakesForOrganization)
-> Maybe Text
-> ListHandshakesForOrganization
-> ListHandshakesForOrganization
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListHandshakesForOrganization
ListHandshakesForOrganizationResponse
rs
          ListHandshakesForOrganizationResponse
-> Getting (First Text) ListHandshakesForOrganizationResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListHandshakesForOrganizationResponse
-> Const (First Text) ListHandshakesForOrganizationResponse
Lens' ListHandshakesForOrganizationResponse (Maybe Text)
listHandshakesForOrganizationResponse_nextToken
            ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListHandshakesForOrganizationResponse
 -> Const (First Text) ListHandshakesForOrganizationResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListHandshakesForOrganizationResponse 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
    ListHandshakesForOrganization
  where
  type
    AWSResponse ListHandshakesForOrganization =
      ListHandshakesForOrganizationResponse
  request :: ListHandshakesForOrganization
-> Request ListHandshakesForOrganization
request = Service
-> ListHandshakesForOrganization
-> Request ListHandshakesForOrganization
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy ListHandshakesForOrganization
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ListHandshakesForOrganization)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse ListHandshakesForOrganization))
-> Logger
-> Service
-> Proxy ListHandshakesForOrganization
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ListHandshakesForOrganization)))
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 -> ListHandshakesForOrganizationResponse
ListHandshakesForOrganizationResponse'
            (Maybe [Handshake]
 -> Maybe Text -> Int -> ListHandshakesForOrganizationResponse)
-> Either String (Maybe [Handshake])
-> Either
     String (Maybe Text -> Int -> ListHandshakesForOrganizationResponse)
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 -> ListHandshakesForOrganizationResponse)
-> Either String (Maybe Text)
-> Either String (Int -> ListHandshakesForOrganizationResponse)
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 -> ListHandshakesForOrganizationResponse)
-> Either String Int
-> Either String ListHandshakesForOrganizationResponse
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
    ListHandshakesForOrganization

instance Prelude.NFData ListHandshakesForOrganization

instance Core.ToHeaders ListHandshakesForOrganization where
  toHeaders :: ListHandshakesForOrganization -> ResponseHeaders
toHeaders =
    ResponseHeaders -> ListHandshakesForOrganization -> 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.ListHandshakesForOrganization" ::
                          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 ListHandshakesForOrganization where
  toJSON :: ListHandshakesForOrganization -> Value
toJSON ListHandshakesForOrganization' {Maybe Natural
Maybe Text
Maybe HandshakeFilter
maxResults :: Maybe Natural
filter' :: Maybe HandshakeFilter
nextToken :: Maybe Text
$sel:maxResults:ListHandshakesForOrganization' :: ListHandshakesForOrganization -> Maybe Natural
$sel:filter':ListHandshakesForOrganization' :: ListHandshakesForOrganization -> Maybe HandshakeFilter
$sel:nextToken:ListHandshakesForOrganization' :: ListHandshakesForOrganization -> 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 ListHandshakesForOrganization where
  toPath :: ListHandshakesForOrganization -> ByteString
toPath = ByteString -> ListHandshakesForOrganization -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

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

-- | /See:/ 'newListHandshakesForOrganizationResponse' smart constructor.
data ListHandshakesForOrganizationResponse = ListHandshakesForOrganizationResponse'
  { -- | A list of Handshake objects with details about each of the handshakes
    -- that are associated with an organization.
    ListHandshakesForOrganizationResponse -> 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@.
    ListHandshakesForOrganizationResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    ListHandshakesForOrganizationResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ListHandshakesForOrganizationResponse
-> ListHandshakesForOrganizationResponse -> Bool
(ListHandshakesForOrganizationResponse
 -> ListHandshakesForOrganizationResponse -> Bool)
-> (ListHandshakesForOrganizationResponse
    -> ListHandshakesForOrganizationResponse -> Bool)
-> Eq ListHandshakesForOrganizationResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListHandshakesForOrganizationResponse
-> ListHandshakesForOrganizationResponse -> Bool
$c/= :: ListHandshakesForOrganizationResponse
-> ListHandshakesForOrganizationResponse -> Bool
== :: ListHandshakesForOrganizationResponse
-> ListHandshakesForOrganizationResponse -> Bool
$c== :: ListHandshakesForOrganizationResponse
-> ListHandshakesForOrganizationResponse -> Bool
Prelude.Eq, Int -> ListHandshakesForOrganizationResponse -> ShowS
[ListHandshakesForOrganizationResponse] -> ShowS
ListHandshakesForOrganizationResponse -> String
(Int -> ListHandshakesForOrganizationResponse -> ShowS)
-> (ListHandshakesForOrganizationResponse -> String)
-> ([ListHandshakesForOrganizationResponse] -> ShowS)
-> Show ListHandshakesForOrganizationResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListHandshakesForOrganizationResponse] -> ShowS
$cshowList :: [ListHandshakesForOrganizationResponse] -> ShowS
show :: ListHandshakesForOrganizationResponse -> String
$cshow :: ListHandshakesForOrganizationResponse -> String
showsPrec :: Int -> ListHandshakesForOrganizationResponse -> ShowS
$cshowsPrec :: Int -> ListHandshakesForOrganizationResponse -> ShowS
Prelude.Show, (forall x.
 ListHandshakesForOrganizationResponse
 -> Rep ListHandshakesForOrganizationResponse x)
-> (forall x.
    Rep ListHandshakesForOrganizationResponse x
    -> ListHandshakesForOrganizationResponse)
-> Generic ListHandshakesForOrganizationResponse
forall x.
Rep ListHandshakesForOrganizationResponse x
-> ListHandshakesForOrganizationResponse
forall x.
ListHandshakesForOrganizationResponse
-> Rep ListHandshakesForOrganizationResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListHandshakesForOrganizationResponse x
-> ListHandshakesForOrganizationResponse
$cfrom :: forall x.
ListHandshakesForOrganizationResponse
-> Rep ListHandshakesForOrganizationResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListHandshakesForOrganizationResponse' 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', 'listHandshakesForOrganizationResponse_handshakes' - A list of Handshake objects with details about each of the handshakes
-- that are associated with an organization.
--
-- 'nextToken', 'listHandshakesForOrganizationResponse_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', 'listHandshakesForOrganizationResponse_httpStatus' - The response's http status code.
newListHandshakesForOrganizationResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListHandshakesForOrganizationResponse
newListHandshakesForOrganizationResponse :: Int -> ListHandshakesForOrganizationResponse
newListHandshakesForOrganizationResponse Int
pHttpStatus_ =
  ListHandshakesForOrganizationResponse' :: Maybe [Handshake]
-> Maybe Text -> Int -> ListHandshakesForOrganizationResponse
ListHandshakesForOrganizationResponse'
    { $sel:handshakes:ListHandshakesForOrganizationResponse' :: Maybe [Handshake]
handshakes =
        Maybe [Handshake]
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListHandshakesForOrganizationResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListHandshakesForOrganizationResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | A list of Handshake objects with details about each of the handshakes
-- that are associated with an organization.
listHandshakesForOrganizationResponse_handshakes :: Lens.Lens' ListHandshakesForOrganizationResponse (Prelude.Maybe [Handshake])
listHandshakesForOrganizationResponse_handshakes :: (Maybe [Handshake] -> f (Maybe [Handshake]))
-> ListHandshakesForOrganizationResponse
-> f ListHandshakesForOrganizationResponse
listHandshakesForOrganizationResponse_handshakes = (ListHandshakesForOrganizationResponse -> Maybe [Handshake])
-> (ListHandshakesForOrganizationResponse
    -> Maybe [Handshake] -> ListHandshakesForOrganizationResponse)
-> Lens' ListHandshakesForOrganizationResponse (Maybe [Handshake])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListHandshakesForOrganizationResponse' {Maybe [Handshake]
handshakes :: Maybe [Handshake]
$sel:handshakes:ListHandshakesForOrganizationResponse' :: ListHandshakesForOrganizationResponse -> Maybe [Handshake]
handshakes} -> Maybe [Handshake]
handshakes) (\s :: ListHandshakesForOrganizationResponse
s@ListHandshakesForOrganizationResponse' {} Maybe [Handshake]
a -> ListHandshakesForOrganizationResponse
s {$sel:handshakes:ListHandshakesForOrganizationResponse' :: Maybe [Handshake]
handshakes = Maybe [Handshake]
a} :: ListHandshakesForOrganizationResponse) ((Maybe [Handshake] -> f (Maybe [Handshake]))
 -> ListHandshakesForOrganizationResponse
 -> f ListHandshakesForOrganizationResponse)
-> ((Maybe [Handshake] -> f (Maybe [Handshake]))
    -> Maybe [Handshake] -> f (Maybe [Handshake]))
-> (Maybe [Handshake] -> f (Maybe [Handshake]))
-> ListHandshakesForOrganizationResponse
-> f ListHandshakesForOrganizationResponse
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@.
listHandshakesForOrganizationResponse_nextToken :: Lens.Lens' ListHandshakesForOrganizationResponse (Prelude.Maybe Prelude.Text)
listHandshakesForOrganizationResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListHandshakesForOrganizationResponse
-> f ListHandshakesForOrganizationResponse
listHandshakesForOrganizationResponse_nextToken = (ListHandshakesForOrganizationResponse -> Maybe Text)
-> (ListHandshakesForOrganizationResponse
    -> Maybe Text -> ListHandshakesForOrganizationResponse)
-> Lens' ListHandshakesForOrganizationResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListHandshakesForOrganizationResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListHandshakesForOrganizationResponse' :: ListHandshakesForOrganizationResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListHandshakesForOrganizationResponse
s@ListHandshakesForOrganizationResponse' {} Maybe Text
a -> ListHandshakesForOrganizationResponse
s {$sel:nextToken:ListHandshakesForOrganizationResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListHandshakesForOrganizationResponse)

-- | The response's http status code.
listHandshakesForOrganizationResponse_httpStatus :: Lens.Lens' ListHandshakesForOrganizationResponse Prelude.Int
listHandshakesForOrganizationResponse_httpStatus :: (Int -> f Int)
-> ListHandshakesForOrganizationResponse
-> f ListHandshakesForOrganizationResponse
listHandshakesForOrganizationResponse_httpStatus = (ListHandshakesForOrganizationResponse -> Int)
-> (ListHandshakesForOrganizationResponse
    -> Int -> ListHandshakesForOrganizationResponse)
-> Lens
     ListHandshakesForOrganizationResponse
     ListHandshakesForOrganizationResponse
     Int
     Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListHandshakesForOrganizationResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListHandshakesForOrganizationResponse' :: ListHandshakesForOrganizationResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListHandshakesForOrganizationResponse
s@ListHandshakesForOrganizationResponse' {} Int
a -> ListHandshakesForOrganizationResponse
s {$sel:httpStatus:ListHandshakesForOrganizationResponse' :: Int
httpStatus = Int
a} :: ListHandshakesForOrganizationResponse)

instance
  Prelude.NFData
    ListHandshakesForOrganizationResponse