{-# 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.AppIntegrationS.ListEventIntegrations
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Returns a paginated list of event integrations in the account.
module Amazonka.AppIntegrationS.ListEventIntegrations
  ( -- * Creating a Request
    ListEventIntegrations (..),
    newListEventIntegrations,

    -- * Request Lenses
    listEventIntegrations_maxResults,
    listEventIntegrations_nextToken,

    -- * Destructuring the Response
    ListEventIntegrationsResponse (..),
    newListEventIntegrationsResponse,

    -- * Response Lenses
    listEventIntegrationsResponse_eventIntegrations,
    listEventIntegrationsResponse_nextToken,
    listEventIntegrationsResponse_httpStatus,
  )
where

import Amazonka.AppIntegrationS.Types
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

-- | /See:/ 'newListEventIntegrations' smart constructor.
data ListEventIntegrations = ListEventIntegrations'
  { -- | The maximum number of results to return per page.
    ListEventIntegrations -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | The token for the next set of results. Use the value returned in the
    -- previous response in the next request to retrieve the next set of
    -- results.
    ListEventIntegrations -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text
  }
  deriving (ListEventIntegrations -> ListEventIntegrations -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListEventIntegrations -> ListEventIntegrations -> Bool
$c/= :: ListEventIntegrations -> ListEventIntegrations -> Bool
== :: ListEventIntegrations -> ListEventIntegrations -> Bool
$c== :: ListEventIntegrations -> ListEventIntegrations -> Bool
Prelude.Eq, ReadPrec [ListEventIntegrations]
ReadPrec ListEventIntegrations
Int -> ReadS ListEventIntegrations
ReadS [ListEventIntegrations]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListEventIntegrations]
$creadListPrec :: ReadPrec [ListEventIntegrations]
readPrec :: ReadPrec ListEventIntegrations
$creadPrec :: ReadPrec ListEventIntegrations
readList :: ReadS [ListEventIntegrations]
$creadList :: ReadS [ListEventIntegrations]
readsPrec :: Int -> ReadS ListEventIntegrations
$creadsPrec :: Int -> ReadS ListEventIntegrations
Prelude.Read, Int -> ListEventIntegrations -> ShowS
[ListEventIntegrations] -> ShowS
ListEventIntegrations -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListEventIntegrations] -> ShowS
$cshowList :: [ListEventIntegrations] -> ShowS
show :: ListEventIntegrations -> String
$cshow :: ListEventIntegrations -> String
showsPrec :: Int -> ListEventIntegrations -> ShowS
$cshowsPrec :: Int -> ListEventIntegrations -> ShowS
Prelude.Show, forall x. Rep ListEventIntegrations x -> ListEventIntegrations
forall x. ListEventIntegrations -> Rep ListEventIntegrations x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListEventIntegrations x -> ListEventIntegrations
$cfrom :: forall x. ListEventIntegrations -> Rep ListEventIntegrations x
Prelude.Generic)

-- |
-- Create a value of 'ListEventIntegrations' 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:
--
-- 'maxResults', 'listEventIntegrations_maxResults' - The maximum number of results to return per page.
--
-- 'nextToken', 'listEventIntegrations_nextToken' - The token for the next set of results. Use the value returned in the
-- previous response in the next request to retrieve the next set of
-- results.
newListEventIntegrations ::
  ListEventIntegrations
newListEventIntegrations :: ListEventIntegrations
newListEventIntegrations =
  ListEventIntegrations'
    { $sel:maxResults:ListEventIntegrations' :: Maybe Natural
maxResults =
        forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListEventIntegrations' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing
    }

-- | The maximum number of results to return per page.
listEventIntegrations_maxResults :: Lens.Lens' ListEventIntegrations (Prelude.Maybe Prelude.Natural)
listEventIntegrations_maxResults :: Lens' ListEventIntegrations (Maybe Natural)
listEventIntegrations_maxResults = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListEventIntegrations' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListEventIntegrations' :: ListEventIntegrations -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListEventIntegrations
s@ListEventIntegrations' {} Maybe Natural
a -> ListEventIntegrations
s {$sel:maxResults:ListEventIntegrations' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListEventIntegrations)

-- | The token for the next set of results. Use the value returned in the
-- previous response in the next request to retrieve the next set of
-- results.
listEventIntegrations_nextToken :: Lens.Lens' ListEventIntegrations (Prelude.Maybe Prelude.Text)
listEventIntegrations_nextToken :: Lens' ListEventIntegrations (Maybe Text)
listEventIntegrations_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListEventIntegrations' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListEventIntegrations' :: ListEventIntegrations -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListEventIntegrations
s@ListEventIntegrations' {} Maybe Text
a -> ListEventIntegrations
s {$sel:nextToken:ListEventIntegrations' :: Maybe Text
nextToken = Maybe Text
a} :: ListEventIntegrations)

instance Core.AWSRequest ListEventIntegrations where
  type
    AWSResponse ListEventIntegrations =
      ListEventIntegrationsResponse
  request :: (Service -> Service)
-> ListEventIntegrations -> Request ListEventIntegrations
request Service -> Service
overrides =
    forall a. ToRequest a => Service -> a -> Request a
Request.get (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy ListEventIntegrations
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ListEventIntegrations)))
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 (NonEmpty EventIntegration)
-> Maybe Text -> Int -> ListEventIntegrationsResponse
ListEventIntegrationsResponse'
            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
"EventIntegrations")
            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 ListEventIntegrations where
  hashWithSalt :: Int -> ListEventIntegrations -> Int
hashWithSalt Int
_salt ListEventIntegrations' {Maybe Natural
Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:nextToken:ListEventIntegrations' :: ListEventIntegrations -> Maybe Text
$sel:maxResults:ListEventIntegrations' :: ListEventIntegrations -> 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

instance Prelude.NFData ListEventIntegrations where
  rnf :: ListEventIntegrations -> ()
rnf ListEventIntegrations' {Maybe Natural
Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:nextToken:ListEventIntegrations' :: ListEventIntegrations -> Maybe Text
$sel:maxResults:ListEventIntegrations' :: ListEventIntegrations -> 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

instance Data.ToHeaders ListEventIntegrations where
  toHeaders :: ListEventIntegrations -> ResponseHeaders
toHeaders =
    forall a b. a -> b -> a
Prelude.const
      ( forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"Content-Type"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Data.ToPath ListEventIntegrations where
  toPath :: ListEventIntegrations -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/eventIntegrations"

instance Data.ToQuery ListEventIntegrations where
  toQuery :: ListEventIntegrations -> QueryString
toQuery ListEventIntegrations' {Maybe Natural
Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:nextToken:ListEventIntegrations' :: ListEventIntegrations -> Maybe Text
$sel:maxResults:ListEventIntegrations' :: ListEventIntegrations -> Maybe Natural
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"maxResults" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Natural
maxResults,
        ByteString
"nextToken" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
nextToken
      ]

-- | /See:/ 'newListEventIntegrationsResponse' smart constructor.
data ListEventIntegrationsResponse = ListEventIntegrationsResponse'
  { -- | The event integrations.
    ListEventIntegrationsResponse -> Maybe (NonEmpty EventIntegration)
eventIntegrations :: Prelude.Maybe (Prelude.NonEmpty EventIntegration),
    -- | If there are additional results, this is the token for the next set of
    -- results.
    ListEventIntegrationsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    ListEventIntegrationsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ListEventIntegrationsResponse
-> ListEventIntegrationsResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListEventIntegrationsResponse
-> ListEventIntegrationsResponse -> Bool
$c/= :: ListEventIntegrationsResponse
-> ListEventIntegrationsResponse -> Bool
== :: ListEventIntegrationsResponse
-> ListEventIntegrationsResponse -> Bool
$c== :: ListEventIntegrationsResponse
-> ListEventIntegrationsResponse -> Bool
Prelude.Eq, ReadPrec [ListEventIntegrationsResponse]
ReadPrec ListEventIntegrationsResponse
Int -> ReadS ListEventIntegrationsResponse
ReadS [ListEventIntegrationsResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListEventIntegrationsResponse]
$creadListPrec :: ReadPrec [ListEventIntegrationsResponse]
readPrec :: ReadPrec ListEventIntegrationsResponse
$creadPrec :: ReadPrec ListEventIntegrationsResponse
readList :: ReadS [ListEventIntegrationsResponse]
$creadList :: ReadS [ListEventIntegrationsResponse]
readsPrec :: Int -> ReadS ListEventIntegrationsResponse
$creadsPrec :: Int -> ReadS ListEventIntegrationsResponse
Prelude.Read, Int -> ListEventIntegrationsResponse -> ShowS
[ListEventIntegrationsResponse] -> ShowS
ListEventIntegrationsResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListEventIntegrationsResponse] -> ShowS
$cshowList :: [ListEventIntegrationsResponse] -> ShowS
show :: ListEventIntegrationsResponse -> String
$cshow :: ListEventIntegrationsResponse -> String
showsPrec :: Int -> ListEventIntegrationsResponse -> ShowS
$cshowsPrec :: Int -> ListEventIntegrationsResponse -> ShowS
Prelude.Show, forall x.
Rep ListEventIntegrationsResponse x
-> ListEventIntegrationsResponse
forall x.
ListEventIntegrationsResponse
-> Rep ListEventIntegrationsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListEventIntegrationsResponse x
-> ListEventIntegrationsResponse
$cfrom :: forall x.
ListEventIntegrationsResponse
-> Rep ListEventIntegrationsResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListEventIntegrationsResponse' 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:
--
-- 'eventIntegrations', 'listEventIntegrationsResponse_eventIntegrations' - The event integrations.
--
-- 'nextToken', 'listEventIntegrationsResponse_nextToken' - If there are additional results, this is the token for the next set of
-- results.
--
-- 'httpStatus', 'listEventIntegrationsResponse_httpStatus' - The response's http status code.
newListEventIntegrationsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListEventIntegrationsResponse
newListEventIntegrationsResponse :: Int -> ListEventIntegrationsResponse
newListEventIntegrationsResponse Int
pHttpStatus_ =
  ListEventIntegrationsResponse'
    { $sel:eventIntegrations:ListEventIntegrationsResponse' :: Maybe (NonEmpty EventIntegration)
eventIntegrations =
        forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListEventIntegrationsResponse' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListEventIntegrationsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The event integrations.
listEventIntegrationsResponse_eventIntegrations :: Lens.Lens' ListEventIntegrationsResponse (Prelude.Maybe (Prelude.NonEmpty EventIntegration))
listEventIntegrationsResponse_eventIntegrations :: Lens'
  ListEventIntegrationsResponse (Maybe (NonEmpty EventIntegration))
listEventIntegrationsResponse_eventIntegrations = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListEventIntegrationsResponse' {Maybe (NonEmpty EventIntegration)
eventIntegrations :: Maybe (NonEmpty EventIntegration)
$sel:eventIntegrations:ListEventIntegrationsResponse' :: ListEventIntegrationsResponse -> Maybe (NonEmpty EventIntegration)
eventIntegrations} -> Maybe (NonEmpty EventIntegration)
eventIntegrations) (\s :: ListEventIntegrationsResponse
s@ListEventIntegrationsResponse' {} Maybe (NonEmpty EventIntegration)
a -> ListEventIntegrationsResponse
s {$sel:eventIntegrations:ListEventIntegrationsResponse' :: Maybe (NonEmpty EventIntegration)
eventIntegrations = Maybe (NonEmpty EventIntegration)
a} :: ListEventIntegrationsResponse) 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

-- | If there are additional results, this is the token for the next set of
-- results.
listEventIntegrationsResponse_nextToken :: Lens.Lens' ListEventIntegrationsResponse (Prelude.Maybe Prelude.Text)
listEventIntegrationsResponse_nextToken :: Lens' ListEventIntegrationsResponse (Maybe Text)
listEventIntegrationsResponse_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListEventIntegrationsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListEventIntegrationsResponse' :: ListEventIntegrationsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListEventIntegrationsResponse
s@ListEventIntegrationsResponse' {} Maybe Text
a -> ListEventIntegrationsResponse
s {$sel:nextToken:ListEventIntegrationsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListEventIntegrationsResponse)

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

instance Prelude.NFData ListEventIntegrationsResponse where
  rnf :: ListEventIntegrationsResponse -> ()
rnf ListEventIntegrationsResponse' {Int
Maybe (NonEmpty EventIntegration)
Maybe Text
httpStatus :: Int
nextToken :: Maybe Text
eventIntegrations :: Maybe (NonEmpty EventIntegration)
$sel:httpStatus:ListEventIntegrationsResponse' :: ListEventIntegrationsResponse -> Int
$sel:nextToken:ListEventIntegrationsResponse' :: ListEventIntegrationsResponse -> Maybe Text
$sel:eventIntegrations:ListEventIntegrationsResponse' :: ListEventIntegrationsResponse -> Maybe (NonEmpty EventIntegration)
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe (NonEmpty EventIntegration)
eventIntegrations
      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