{-# 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.SESV2.ListDedicatedIpPools
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- List all of the dedicated IP pools that exist in your Amazon Web
-- Services account in the current Region.
module Amazonka.SESV2.ListDedicatedIpPools
  ( -- * Creating a Request
    ListDedicatedIpPools (..),
    newListDedicatedIpPools,

    -- * Request Lenses
    listDedicatedIpPools_nextToken,
    listDedicatedIpPools_pageSize,

    -- * Destructuring the Response
    ListDedicatedIpPoolsResponse (..),
    newListDedicatedIpPoolsResponse,

    -- * Response Lenses
    listDedicatedIpPoolsResponse_dedicatedIpPools,
    listDedicatedIpPoolsResponse_nextToken,
    listDedicatedIpPoolsResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
import Amazonka.SESV2.Types

-- | A request to obtain a list of dedicated IP pools.
--
-- /See:/ 'newListDedicatedIpPools' smart constructor.
data ListDedicatedIpPools = ListDedicatedIpPools'
  { -- | A token returned from a previous call to @ListDedicatedIpPools@ to
    -- indicate the position in the list of dedicated IP pools.
    ListDedicatedIpPools -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The number of results to show in a single call to
    -- @ListDedicatedIpPools@. If the number of results is larger than the
    -- number you specified in this parameter, then the response includes a
    -- @NextToken@ element, which you can use to obtain additional results.
    ListDedicatedIpPools -> Maybe Int
pageSize :: Prelude.Maybe Prelude.Int
  }
  deriving (ListDedicatedIpPools -> ListDedicatedIpPools -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListDedicatedIpPools -> ListDedicatedIpPools -> Bool
$c/= :: ListDedicatedIpPools -> ListDedicatedIpPools -> Bool
== :: ListDedicatedIpPools -> ListDedicatedIpPools -> Bool
$c== :: ListDedicatedIpPools -> ListDedicatedIpPools -> Bool
Prelude.Eq, ReadPrec [ListDedicatedIpPools]
ReadPrec ListDedicatedIpPools
Int -> ReadS ListDedicatedIpPools
ReadS [ListDedicatedIpPools]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListDedicatedIpPools]
$creadListPrec :: ReadPrec [ListDedicatedIpPools]
readPrec :: ReadPrec ListDedicatedIpPools
$creadPrec :: ReadPrec ListDedicatedIpPools
readList :: ReadS [ListDedicatedIpPools]
$creadList :: ReadS [ListDedicatedIpPools]
readsPrec :: Int -> ReadS ListDedicatedIpPools
$creadsPrec :: Int -> ReadS ListDedicatedIpPools
Prelude.Read, Int -> ListDedicatedIpPools -> ShowS
[ListDedicatedIpPools] -> ShowS
ListDedicatedIpPools -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListDedicatedIpPools] -> ShowS
$cshowList :: [ListDedicatedIpPools] -> ShowS
show :: ListDedicatedIpPools -> String
$cshow :: ListDedicatedIpPools -> String
showsPrec :: Int -> ListDedicatedIpPools -> ShowS
$cshowsPrec :: Int -> ListDedicatedIpPools -> ShowS
Prelude.Show, forall x. Rep ListDedicatedIpPools x -> ListDedicatedIpPools
forall x. ListDedicatedIpPools -> Rep ListDedicatedIpPools x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListDedicatedIpPools x -> ListDedicatedIpPools
$cfrom :: forall x. ListDedicatedIpPools -> Rep ListDedicatedIpPools x
Prelude.Generic)

-- |
-- Create a value of 'ListDedicatedIpPools' 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', 'listDedicatedIpPools_nextToken' - A token returned from a previous call to @ListDedicatedIpPools@ to
-- indicate the position in the list of dedicated IP pools.
--
-- 'pageSize', 'listDedicatedIpPools_pageSize' - The number of results to show in a single call to
-- @ListDedicatedIpPools@. If the number of results is larger than the
-- number you specified in this parameter, then the response includes a
-- @NextToken@ element, which you can use to obtain additional results.
newListDedicatedIpPools ::
  ListDedicatedIpPools
newListDedicatedIpPools :: ListDedicatedIpPools
newListDedicatedIpPools =
  ListDedicatedIpPools'
    { $sel:nextToken:ListDedicatedIpPools' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
      $sel:pageSize:ListDedicatedIpPools' :: Maybe Int
pageSize = forall a. Maybe a
Prelude.Nothing
    }

-- | A token returned from a previous call to @ListDedicatedIpPools@ to
-- indicate the position in the list of dedicated IP pools.
listDedicatedIpPools_nextToken :: Lens.Lens' ListDedicatedIpPools (Prelude.Maybe Prelude.Text)
listDedicatedIpPools_nextToken :: Lens' ListDedicatedIpPools (Maybe Text)
listDedicatedIpPools_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListDedicatedIpPools' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListDedicatedIpPools' :: ListDedicatedIpPools -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListDedicatedIpPools
s@ListDedicatedIpPools' {} Maybe Text
a -> ListDedicatedIpPools
s {$sel:nextToken:ListDedicatedIpPools' :: Maybe Text
nextToken = Maybe Text
a} :: ListDedicatedIpPools)

-- | The number of results to show in a single call to
-- @ListDedicatedIpPools@. If the number of results is larger than the
-- number you specified in this parameter, then the response includes a
-- @NextToken@ element, which you can use to obtain additional results.
listDedicatedIpPools_pageSize :: Lens.Lens' ListDedicatedIpPools (Prelude.Maybe Prelude.Int)
listDedicatedIpPools_pageSize :: Lens' ListDedicatedIpPools (Maybe Int)
listDedicatedIpPools_pageSize = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListDedicatedIpPools' {Maybe Int
pageSize :: Maybe Int
$sel:pageSize:ListDedicatedIpPools' :: ListDedicatedIpPools -> Maybe Int
pageSize} -> Maybe Int
pageSize) (\s :: ListDedicatedIpPools
s@ListDedicatedIpPools' {} Maybe Int
a -> ListDedicatedIpPools
s {$sel:pageSize:ListDedicatedIpPools' :: Maybe Int
pageSize = Maybe Int
a} :: ListDedicatedIpPools)

instance Core.AWSRequest ListDedicatedIpPools where
  type
    AWSResponse ListDedicatedIpPools =
      ListDedicatedIpPoolsResponse
  request :: (Service -> Service)
-> ListDedicatedIpPools -> Request ListDedicatedIpPools
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 ListDedicatedIpPools
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ListDedicatedIpPools)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe [Text] -> Maybe Text -> Int -> ListDedicatedIpPoolsResponse
ListDedicatedIpPoolsResponse'
            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
"DedicatedIpPools"
                            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 ListDedicatedIpPools where
  hashWithSalt :: Int -> ListDedicatedIpPools -> Int
hashWithSalt Int
_salt ListDedicatedIpPools' {Maybe Int
Maybe Text
pageSize :: Maybe Int
nextToken :: Maybe Text
$sel:pageSize:ListDedicatedIpPools' :: ListDedicatedIpPools -> Maybe Int
$sel:nextToken:ListDedicatedIpPools' :: ListDedicatedIpPools -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
nextToken
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
pageSize

instance Prelude.NFData ListDedicatedIpPools where
  rnf :: ListDedicatedIpPools -> ()
rnf ListDedicatedIpPools' {Maybe Int
Maybe Text
pageSize :: Maybe Int
nextToken :: Maybe Text
$sel:pageSize:ListDedicatedIpPools' :: ListDedicatedIpPools -> Maybe Int
$sel:nextToken:ListDedicatedIpPools' :: ListDedicatedIpPools -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextToken
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
pageSize

instance Data.ToHeaders ListDedicatedIpPools where
  toHeaders :: ListDedicatedIpPools -> 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 ListDedicatedIpPools where
  toPath :: ListDedicatedIpPools -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/v2/email/dedicated-ip-pools"

instance Data.ToQuery ListDedicatedIpPools where
  toQuery :: ListDedicatedIpPools -> QueryString
toQuery ListDedicatedIpPools' {Maybe Int
Maybe Text
pageSize :: Maybe Int
nextToken :: Maybe Text
$sel:pageSize:ListDedicatedIpPools' :: ListDedicatedIpPools -> Maybe Int
$sel:nextToken:ListDedicatedIpPools' :: ListDedicatedIpPools -> Maybe Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"NextToken" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
nextToken,
        ByteString
"PageSize" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Int
pageSize
      ]

-- | A list of dedicated IP pools.
--
-- /See:/ 'newListDedicatedIpPoolsResponse' smart constructor.
data ListDedicatedIpPoolsResponse = ListDedicatedIpPoolsResponse'
  { -- | A list of all of the dedicated IP pools that are associated with your
    -- Amazon Web Services account in the current Region.
    ListDedicatedIpPoolsResponse -> Maybe [Text]
dedicatedIpPools :: Prelude.Maybe [Prelude.Text],
    -- | A token that indicates that there are additional IP pools to list. To
    -- view additional IP pools, issue another request to
    -- @ListDedicatedIpPools@, passing this token in the @NextToken@ parameter.
    ListDedicatedIpPoolsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    ListDedicatedIpPoolsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ListDedicatedIpPoolsResponse
-> ListDedicatedIpPoolsResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListDedicatedIpPoolsResponse
-> ListDedicatedIpPoolsResponse -> Bool
$c/= :: ListDedicatedIpPoolsResponse
-> ListDedicatedIpPoolsResponse -> Bool
== :: ListDedicatedIpPoolsResponse
-> ListDedicatedIpPoolsResponse -> Bool
$c== :: ListDedicatedIpPoolsResponse
-> ListDedicatedIpPoolsResponse -> Bool
Prelude.Eq, ReadPrec [ListDedicatedIpPoolsResponse]
ReadPrec ListDedicatedIpPoolsResponse
Int -> ReadS ListDedicatedIpPoolsResponse
ReadS [ListDedicatedIpPoolsResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListDedicatedIpPoolsResponse]
$creadListPrec :: ReadPrec [ListDedicatedIpPoolsResponse]
readPrec :: ReadPrec ListDedicatedIpPoolsResponse
$creadPrec :: ReadPrec ListDedicatedIpPoolsResponse
readList :: ReadS [ListDedicatedIpPoolsResponse]
$creadList :: ReadS [ListDedicatedIpPoolsResponse]
readsPrec :: Int -> ReadS ListDedicatedIpPoolsResponse
$creadsPrec :: Int -> ReadS ListDedicatedIpPoolsResponse
Prelude.Read, Int -> ListDedicatedIpPoolsResponse -> ShowS
[ListDedicatedIpPoolsResponse] -> ShowS
ListDedicatedIpPoolsResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListDedicatedIpPoolsResponse] -> ShowS
$cshowList :: [ListDedicatedIpPoolsResponse] -> ShowS
show :: ListDedicatedIpPoolsResponse -> String
$cshow :: ListDedicatedIpPoolsResponse -> String
showsPrec :: Int -> ListDedicatedIpPoolsResponse -> ShowS
$cshowsPrec :: Int -> ListDedicatedIpPoolsResponse -> ShowS
Prelude.Show, forall x.
Rep ListDedicatedIpPoolsResponse x -> ListDedicatedIpPoolsResponse
forall x.
ListDedicatedIpPoolsResponse -> Rep ListDedicatedIpPoolsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListDedicatedIpPoolsResponse x -> ListDedicatedIpPoolsResponse
$cfrom :: forall x.
ListDedicatedIpPoolsResponse -> Rep ListDedicatedIpPoolsResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListDedicatedIpPoolsResponse' 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:
--
-- 'dedicatedIpPools', 'listDedicatedIpPoolsResponse_dedicatedIpPools' - A list of all of the dedicated IP pools that are associated with your
-- Amazon Web Services account in the current Region.
--
-- 'nextToken', 'listDedicatedIpPoolsResponse_nextToken' - A token that indicates that there are additional IP pools to list. To
-- view additional IP pools, issue another request to
-- @ListDedicatedIpPools@, passing this token in the @NextToken@ parameter.
--
-- 'httpStatus', 'listDedicatedIpPoolsResponse_httpStatus' - The response's http status code.
newListDedicatedIpPoolsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListDedicatedIpPoolsResponse
newListDedicatedIpPoolsResponse :: Int -> ListDedicatedIpPoolsResponse
newListDedicatedIpPoolsResponse Int
pHttpStatus_ =
  ListDedicatedIpPoolsResponse'
    { $sel:dedicatedIpPools:ListDedicatedIpPoolsResponse' :: Maybe [Text]
dedicatedIpPools =
        forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListDedicatedIpPoolsResponse' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListDedicatedIpPoolsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | A list of all of the dedicated IP pools that are associated with your
-- Amazon Web Services account in the current Region.
listDedicatedIpPoolsResponse_dedicatedIpPools :: Lens.Lens' ListDedicatedIpPoolsResponse (Prelude.Maybe [Prelude.Text])
listDedicatedIpPoolsResponse_dedicatedIpPools :: Lens' ListDedicatedIpPoolsResponse (Maybe [Text])
listDedicatedIpPoolsResponse_dedicatedIpPools = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListDedicatedIpPoolsResponse' {Maybe [Text]
dedicatedIpPools :: Maybe [Text]
$sel:dedicatedIpPools:ListDedicatedIpPoolsResponse' :: ListDedicatedIpPoolsResponse -> Maybe [Text]
dedicatedIpPools} -> Maybe [Text]
dedicatedIpPools) (\s :: ListDedicatedIpPoolsResponse
s@ListDedicatedIpPoolsResponse' {} Maybe [Text]
a -> ListDedicatedIpPoolsResponse
s {$sel:dedicatedIpPools:ListDedicatedIpPoolsResponse' :: Maybe [Text]
dedicatedIpPools = Maybe [Text]
a} :: ListDedicatedIpPoolsResponse) 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

-- | A token that indicates that there are additional IP pools to list. To
-- view additional IP pools, issue another request to
-- @ListDedicatedIpPools@, passing this token in the @NextToken@ parameter.
listDedicatedIpPoolsResponse_nextToken :: Lens.Lens' ListDedicatedIpPoolsResponse (Prelude.Maybe Prelude.Text)
listDedicatedIpPoolsResponse_nextToken :: Lens' ListDedicatedIpPoolsResponse (Maybe Text)
listDedicatedIpPoolsResponse_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListDedicatedIpPoolsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListDedicatedIpPoolsResponse' :: ListDedicatedIpPoolsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListDedicatedIpPoolsResponse
s@ListDedicatedIpPoolsResponse' {} Maybe Text
a -> ListDedicatedIpPoolsResponse
s {$sel:nextToken:ListDedicatedIpPoolsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListDedicatedIpPoolsResponse)

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

instance Prelude.NFData ListDedicatedIpPoolsResponse where
  rnf :: ListDedicatedIpPoolsResponse -> ()
rnf ListDedicatedIpPoolsResponse' {Int
Maybe [Text]
Maybe Text
httpStatus :: Int
nextToken :: Maybe Text
dedicatedIpPools :: Maybe [Text]
$sel:httpStatus:ListDedicatedIpPoolsResponse' :: ListDedicatedIpPoolsResponse -> Int
$sel:nextToken:ListDedicatedIpPoolsResponse' :: ListDedicatedIpPoolsResponse -> Maybe Text
$sel:dedicatedIpPools:ListDedicatedIpPoolsResponse' :: ListDedicatedIpPoolsResponse -> Maybe [Text]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
dedicatedIpPools
      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