{-# 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.EC2.GetIpamPoolAllocations
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Get a list of all the CIDR allocations in an IPAM pool.
--
-- This operation returns paginated results.
module Amazonka.EC2.GetIpamPoolAllocations
  ( -- * Creating a Request
    GetIpamPoolAllocations (..),
    newGetIpamPoolAllocations,

    -- * Request Lenses
    getIpamPoolAllocations_dryRun,
    getIpamPoolAllocations_filters,
    getIpamPoolAllocations_ipamPoolAllocationId,
    getIpamPoolAllocations_maxResults,
    getIpamPoolAllocations_nextToken,
    getIpamPoolAllocations_ipamPoolId,

    -- * Destructuring the Response
    GetIpamPoolAllocationsResponse (..),
    newGetIpamPoolAllocationsResponse,

    -- * Response Lenses
    getIpamPoolAllocationsResponse_ipamPoolAllocations,
    getIpamPoolAllocationsResponse_nextToken,
    getIpamPoolAllocationsResponse_httpStatus,
  )
where

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

-- | /See:/ 'newGetIpamPoolAllocations' smart constructor.
data GetIpamPoolAllocations = GetIpamPoolAllocations'
  { -- | A check for whether you have the required permissions for the action
    -- without actually making the request and provides an error response. If
    -- you have the required permissions, the error response is
    -- @DryRunOperation@. Otherwise, it is @UnauthorizedOperation@.
    GetIpamPoolAllocations -> Maybe Bool
dryRun :: Prelude.Maybe Prelude.Bool,
    -- | One or more filters for the request. For more information about
    -- filtering, see
    -- <https://docs.aws.amazon.com/cli/latest/userguide/cli-usage-filter.html Filtering CLI output>.
    GetIpamPoolAllocations -> Maybe [Filter]
filters :: Prelude.Maybe [Filter],
    -- | The ID of the allocation.
    GetIpamPoolAllocations -> Maybe Text
ipamPoolAllocationId :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of results you would like returned per page.
    GetIpamPoolAllocations -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | The token for the next page of results.
    GetIpamPoolAllocations -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The ID of the IPAM pool you want to see the allocations for.
    GetIpamPoolAllocations -> Text
ipamPoolId :: Prelude.Text
  }
  deriving (GetIpamPoolAllocations -> GetIpamPoolAllocations -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetIpamPoolAllocations -> GetIpamPoolAllocations -> Bool
$c/= :: GetIpamPoolAllocations -> GetIpamPoolAllocations -> Bool
== :: GetIpamPoolAllocations -> GetIpamPoolAllocations -> Bool
$c== :: GetIpamPoolAllocations -> GetIpamPoolAllocations -> Bool
Prelude.Eq, ReadPrec [GetIpamPoolAllocations]
ReadPrec GetIpamPoolAllocations
Int -> ReadS GetIpamPoolAllocations
ReadS [GetIpamPoolAllocations]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetIpamPoolAllocations]
$creadListPrec :: ReadPrec [GetIpamPoolAllocations]
readPrec :: ReadPrec GetIpamPoolAllocations
$creadPrec :: ReadPrec GetIpamPoolAllocations
readList :: ReadS [GetIpamPoolAllocations]
$creadList :: ReadS [GetIpamPoolAllocations]
readsPrec :: Int -> ReadS GetIpamPoolAllocations
$creadsPrec :: Int -> ReadS GetIpamPoolAllocations
Prelude.Read, Int -> GetIpamPoolAllocations -> ShowS
[GetIpamPoolAllocations] -> ShowS
GetIpamPoolAllocations -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetIpamPoolAllocations] -> ShowS
$cshowList :: [GetIpamPoolAllocations] -> ShowS
show :: GetIpamPoolAllocations -> String
$cshow :: GetIpamPoolAllocations -> String
showsPrec :: Int -> GetIpamPoolAllocations -> ShowS
$cshowsPrec :: Int -> GetIpamPoolAllocations -> ShowS
Prelude.Show, forall x. Rep GetIpamPoolAllocations x -> GetIpamPoolAllocations
forall x. GetIpamPoolAllocations -> Rep GetIpamPoolAllocations x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetIpamPoolAllocations x -> GetIpamPoolAllocations
$cfrom :: forall x. GetIpamPoolAllocations -> Rep GetIpamPoolAllocations x
Prelude.Generic)

-- |
-- Create a value of 'GetIpamPoolAllocations' 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:
--
-- 'dryRun', 'getIpamPoolAllocations_dryRun' - A check for whether you have the required permissions for the action
-- without actually making the request and provides an error response. If
-- you have the required permissions, the error response is
-- @DryRunOperation@. Otherwise, it is @UnauthorizedOperation@.
--
-- 'filters', 'getIpamPoolAllocations_filters' - One or more filters for the request. For more information about
-- filtering, see
-- <https://docs.aws.amazon.com/cli/latest/userguide/cli-usage-filter.html Filtering CLI output>.
--
-- 'ipamPoolAllocationId', 'getIpamPoolAllocations_ipamPoolAllocationId' - The ID of the allocation.
--
-- 'maxResults', 'getIpamPoolAllocations_maxResults' - The maximum number of results you would like returned per page.
--
-- 'nextToken', 'getIpamPoolAllocations_nextToken' - The token for the next page of results.
--
-- 'ipamPoolId', 'getIpamPoolAllocations_ipamPoolId' - The ID of the IPAM pool you want to see the allocations for.
newGetIpamPoolAllocations ::
  -- | 'ipamPoolId'
  Prelude.Text ->
  GetIpamPoolAllocations
newGetIpamPoolAllocations :: Text -> GetIpamPoolAllocations
newGetIpamPoolAllocations Text
pIpamPoolId_ =
  GetIpamPoolAllocations'
    { $sel:dryRun:GetIpamPoolAllocations' :: Maybe Bool
dryRun = forall a. Maybe a
Prelude.Nothing,
      $sel:filters:GetIpamPoolAllocations' :: Maybe [Filter]
filters = forall a. Maybe a
Prelude.Nothing,
      $sel:ipamPoolAllocationId:GetIpamPoolAllocations' :: Maybe Text
ipamPoolAllocationId = forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:GetIpamPoolAllocations' :: Maybe Natural
maxResults = forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:GetIpamPoolAllocations' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
      $sel:ipamPoolId:GetIpamPoolAllocations' :: Text
ipamPoolId = Text
pIpamPoolId_
    }

-- | A check for whether you have the required permissions for the action
-- without actually making the request and provides an error response. If
-- you have the required permissions, the error response is
-- @DryRunOperation@. Otherwise, it is @UnauthorizedOperation@.
getIpamPoolAllocations_dryRun :: Lens.Lens' GetIpamPoolAllocations (Prelude.Maybe Prelude.Bool)
getIpamPoolAllocations_dryRun :: Lens' GetIpamPoolAllocations (Maybe Bool)
getIpamPoolAllocations_dryRun = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetIpamPoolAllocations' {Maybe Bool
dryRun :: Maybe Bool
$sel:dryRun:GetIpamPoolAllocations' :: GetIpamPoolAllocations -> Maybe Bool
dryRun} -> Maybe Bool
dryRun) (\s :: GetIpamPoolAllocations
s@GetIpamPoolAllocations' {} Maybe Bool
a -> GetIpamPoolAllocations
s {$sel:dryRun:GetIpamPoolAllocations' :: Maybe Bool
dryRun = Maybe Bool
a} :: GetIpamPoolAllocations)

-- | One or more filters for the request. For more information about
-- filtering, see
-- <https://docs.aws.amazon.com/cli/latest/userguide/cli-usage-filter.html Filtering CLI output>.
getIpamPoolAllocations_filters :: Lens.Lens' GetIpamPoolAllocations (Prelude.Maybe [Filter])
getIpamPoolAllocations_filters :: Lens' GetIpamPoolAllocations (Maybe [Filter])
getIpamPoolAllocations_filters = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetIpamPoolAllocations' {Maybe [Filter]
filters :: Maybe [Filter]
$sel:filters:GetIpamPoolAllocations' :: GetIpamPoolAllocations -> Maybe [Filter]
filters} -> Maybe [Filter]
filters) (\s :: GetIpamPoolAllocations
s@GetIpamPoolAllocations' {} Maybe [Filter]
a -> GetIpamPoolAllocations
s {$sel:filters:GetIpamPoolAllocations' :: Maybe [Filter]
filters = Maybe [Filter]
a} :: GetIpamPoolAllocations) 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

-- | The ID of the allocation.
getIpamPoolAllocations_ipamPoolAllocationId :: Lens.Lens' GetIpamPoolAllocations (Prelude.Maybe Prelude.Text)
getIpamPoolAllocations_ipamPoolAllocationId :: Lens' GetIpamPoolAllocations (Maybe Text)
getIpamPoolAllocations_ipamPoolAllocationId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetIpamPoolAllocations' {Maybe Text
ipamPoolAllocationId :: Maybe Text
$sel:ipamPoolAllocationId:GetIpamPoolAllocations' :: GetIpamPoolAllocations -> Maybe Text
ipamPoolAllocationId} -> Maybe Text
ipamPoolAllocationId) (\s :: GetIpamPoolAllocations
s@GetIpamPoolAllocations' {} Maybe Text
a -> GetIpamPoolAllocations
s {$sel:ipamPoolAllocationId:GetIpamPoolAllocations' :: Maybe Text
ipamPoolAllocationId = Maybe Text
a} :: GetIpamPoolAllocations)

-- | The maximum number of results you would like returned per page.
getIpamPoolAllocations_maxResults :: Lens.Lens' GetIpamPoolAllocations (Prelude.Maybe Prelude.Natural)
getIpamPoolAllocations_maxResults :: Lens' GetIpamPoolAllocations (Maybe Natural)
getIpamPoolAllocations_maxResults = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetIpamPoolAllocations' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:GetIpamPoolAllocations' :: GetIpamPoolAllocations -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: GetIpamPoolAllocations
s@GetIpamPoolAllocations' {} Maybe Natural
a -> GetIpamPoolAllocations
s {$sel:maxResults:GetIpamPoolAllocations' :: Maybe Natural
maxResults = Maybe Natural
a} :: GetIpamPoolAllocations)

-- | The token for the next page of results.
getIpamPoolAllocations_nextToken :: Lens.Lens' GetIpamPoolAllocations (Prelude.Maybe Prelude.Text)
getIpamPoolAllocations_nextToken :: Lens' GetIpamPoolAllocations (Maybe Text)
getIpamPoolAllocations_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetIpamPoolAllocations' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:GetIpamPoolAllocations' :: GetIpamPoolAllocations -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: GetIpamPoolAllocations
s@GetIpamPoolAllocations' {} Maybe Text
a -> GetIpamPoolAllocations
s {$sel:nextToken:GetIpamPoolAllocations' :: Maybe Text
nextToken = Maybe Text
a} :: GetIpamPoolAllocations)

-- | The ID of the IPAM pool you want to see the allocations for.
getIpamPoolAllocations_ipamPoolId :: Lens.Lens' GetIpamPoolAllocations Prelude.Text
getIpamPoolAllocations_ipamPoolId :: Lens' GetIpamPoolAllocations Text
getIpamPoolAllocations_ipamPoolId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetIpamPoolAllocations' {Text
ipamPoolId :: Text
$sel:ipamPoolId:GetIpamPoolAllocations' :: GetIpamPoolAllocations -> Text
ipamPoolId} -> Text
ipamPoolId) (\s :: GetIpamPoolAllocations
s@GetIpamPoolAllocations' {} Text
a -> GetIpamPoolAllocations
s {$sel:ipamPoolId:GetIpamPoolAllocations' :: Text
ipamPoolId = Text
a} :: GetIpamPoolAllocations)

instance Core.AWSPager GetIpamPoolAllocations where
  page :: GetIpamPoolAllocations
-> AWSResponse GetIpamPoolAllocations
-> Maybe GetIpamPoolAllocations
page GetIpamPoolAllocations
rq AWSResponse GetIpamPoolAllocations
rs
    | forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse GetIpamPoolAllocations
rs
            forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' GetIpamPoolAllocationsResponse (Maybe Text)
getIpamPoolAllocationsResponse_nextToken
            forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
        forall a. Maybe a
Prelude.Nothing
    | forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse GetIpamPoolAllocations
rs
            forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' GetIpamPoolAllocationsResponse (Maybe [IpamPoolAllocation])
getIpamPoolAllocationsResponse_ipamPoolAllocations
            forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
        forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
        forall a. a -> Maybe a
Prelude.Just
          forall a b. (a -> b) -> a -> b
Prelude.$ GetIpamPoolAllocations
rq
          forall a b. a -> (a -> b) -> b
Prelude.& Lens' GetIpamPoolAllocations (Maybe Text)
getIpamPoolAllocations_nextToken
          forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse GetIpamPoolAllocations
rs
          forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' GetIpamPoolAllocationsResponse (Maybe Text)
getIpamPoolAllocationsResponse_nextToken
          forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just

instance Core.AWSRequest GetIpamPoolAllocations where
  type
    AWSResponse GetIpamPoolAllocations =
      GetIpamPoolAllocationsResponse
  request :: (Service -> Service)
-> GetIpamPoolAllocations -> Request GetIpamPoolAllocations
request Service -> Service
overrides =
    forall a. ToRequest a => Service -> a -> Request a
Request.postQuery (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy GetIpamPoolAllocations
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse GetIpamPoolAllocations)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> [Node] -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveXML
      ( \Int
s ResponseHeaders
h [Node]
x ->
          Maybe [IpamPoolAllocation]
-> Maybe Text -> Int -> GetIpamPoolAllocationsResponse
GetIpamPoolAllocationsResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( [Node]
x
                            forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"ipamPoolAllocationSet"
                            forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty
                            forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (forall a. FromXML a => Text -> [Node] -> Either String [a]
Data.parseXMLList Text
"item")
                        )
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"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 GetIpamPoolAllocations where
  hashWithSalt :: Int -> GetIpamPoolAllocations -> Int
hashWithSalt Int
_salt GetIpamPoolAllocations' {Maybe Bool
Maybe Natural
Maybe [Filter]
Maybe Text
Text
ipamPoolId :: Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
ipamPoolAllocationId :: Maybe Text
filters :: Maybe [Filter]
dryRun :: Maybe Bool
$sel:ipamPoolId:GetIpamPoolAllocations' :: GetIpamPoolAllocations -> Text
$sel:nextToken:GetIpamPoolAllocations' :: GetIpamPoolAllocations -> Maybe Text
$sel:maxResults:GetIpamPoolAllocations' :: GetIpamPoolAllocations -> Maybe Natural
$sel:ipamPoolAllocationId:GetIpamPoolAllocations' :: GetIpamPoolAllocations -> Maybe Text
$sel:filters:GetIpamPoolAllocations' :: GetIpamPoolAllocations -> Maybe [Filter]
$sel:dryRun:GetIpamPoolAllocations' :: GetIpamPoolAllocations -> Maybe Bool
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
dryRun
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Filter]
filters
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
ipamPoolAllocationId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
maxResults
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
nextToken
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
ipamPoolId

instance Prelude.NFData GetIpamPoolAllocations where
  rnf :: GetIpamPoolAllocations -> ()
rnf GetIpamPoolAllocations' {Maybe Bool
Maybe Natural
Maybe [Filter]
Maybe Text
Text
ipamPoolId :: Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
ipamPoolAllocationId :: Maybe Text
filters :: Maybe [Filter]
dryRun :: Maybe Bool
$sel:ipamPoolId:GetIpamPoolAllocations' :: GetIpamPoolAllocations -> Text
$sel:nextToken:GetIpamPoolAllocations' :: GetIpamPoolAllocations -> Maybe Text
$sel:maxResults:GetIpamPoolAllocations' :: GetIpamPoolAllocations -> Maybe Natural
$sel:ipamPoolAllocationId:GetIpamPoolAllocations' :: GetIpamPoolAllocations -> Maybe Text
$sel:filters:GetIpamPoolAllocations' :: GetIpamPoolAllocations -> Maybe [Filter]
$sel:dryRun:GetIpamPoolAllocations' :: GetIpamPoolAllocations -> Maybe Bool
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
dryRun
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Filter]
filters
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
ipamPoolAllocationId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
maxResults
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextToken
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
ipamPoolId

instance Data.ToHeaders GetIpamPoolAllocations where
  toHeaders :: GetIpamPoolAllocations -> ResponseHeaders
toHeaders = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty

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

instance Data.ToQuery GetIpamPoolAllocations where
  toQuery :: GetIpamPoolAllocations -> QueryString
toQuery GetIpamPoolAllocations' {Maybe Bool
Maybe Natural
Maybe [Filter]
Maybe Text
Text
ipamPoolId :: Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
ipamPoolAllocationId :: Maybe Text
filters :: Maybe [Filter]
dryRun :: Maybe Bool
$sel:ipamPoolId:GetIpamPoolAllocations' :: GetIpamPoolAllocations -> Text
$sel:nextToken:GetIpamPoolAllocations' :: GetIpamPoolAllocations -> Maybe Text
$sel:maxResults:GetIpamPoolAllocations' :: GetIpamPoolAllocations -> Maybe Natural
$sel:ipamPoolAllocationId:GetIpamPoolAllocations' :: GetIpamPoolAllocations -> Maybe Text
$sel:filters:GetIpamPoolAllocations' :: GetIpamPoolAllocations -> Maybe [Filter]
$sel:dryRun:GetIpamPoolAllocations' :: GetIpamPoolAllocations -> Maybe Bool
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"Action"
          forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: (ByteString
"GetIpamPoolAllocations" :: Prelude.ByteString),
        ByteString
"Version"
          forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: (ByteString
"2016-11-15" :: Prelude.ByteString),
        ByteString
"DryRun" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Bool
dryRun,
        forall a. ToQuery a => a -> QueryString
Data.toQuery
          (forall a.
(IsList a, ToQuery (Item a)) =>
ByteString -> a -> QueryString
Data.toQueryList ByteString
"Filter" forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Filter]
filters),
        ByteString
"IpamPoolAllocationId" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
ipamPoolAllocationId,
        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,
        ByteString
"IpamPoolId" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Text
ipamPoolId
      ]

-- | /See:/ 'newGetIpamPoolAllocationsResponse' smart constructor.
data GetIpamPoolAllocationsResponse = GetIpamPoolAllocationsResponse'
  { -- | The IPAM pool allocations you want information on.
    GetIpamPoolAllocationsResponse -> Maybe [IpamPoolAllocation]
ipamPoolAllocations :: Prelude.Maybe [IpamPoolAllocation],
    -- | The token to use to retrieve the next page of results. This value is
    -- @null@ when there are no more results to return.
    GetIpamPoolAllocationsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    GetIpamPoolAllocationsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (GetIpamPoolAllocationsResponse
-> GetIpamPoolAllocationsResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetIpamPoolAllocationsResponse
-> GetIpamPoolAllocationsResponse -> Bool
$c/= :: GetIpamPoolAllocationsResponse
-> GetIpamPoolAllocationsResponse -> Bool
== :: GetIpamPoolAllocationsResponse
-> GetIpamPoolAllocationsResponse -> Bool
$c== :: GetIpamPoolAllocationsResponse
-> GetIpamPoolAllocationsResponse -> Bool
Prelude.Eq, ReadPrec [GetIpamPoolAllocationsResponse]
ReadPrec GetIpamPoolAllocationsResponse
Int -> ReadS GetIpamPoolAllocationsResponse
ReadS [GetIpamPoolAllocationsResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetIpamPoolAllocationsResponse]
$creadListPrec :: ReadPrec [GetIpamPoolAllocationsResponse]
readPrec :: ReadPrec GetIpamPoolAllocationsResponse
$creadPrec :: ReadPrec GetIpamPoolAllocationsResponse
readList :: ReadS [GetIpamPoolAllocationsResponse]
$creadList :: ReadS [GetIpamPoolAllocationsResponse]
readsPrec :: Int -> ReadS GetIpamPoolAllocationsResponse
$creadsPrec :: Int -> ReadS GetIpamPoolAllocationsResponse
Prelude.Read, Int -> GetIpamPoolAllocationsResponse -> ShowS
[GetIpamPoolAllocationsResponse] -> ShowS
GetIpamPoolAllocationsResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetIpamPoolAllocationsResponse] -> ShowS
$cshowList :: [GetIpamPoolAllocationsResponse] -> ShowS
show :: GetIpamPoolAllocationsResponse -> String
$cshow :: GetIpamPoolAllocationsResponse -> String
showsPrec :: Int -> GetIpamPoolAllocationsResponse -> ShowS
$cshowsPrec :: Int -> GetIpamPoolAllocationsResponse -> ShowS
Prelude.Show, forall x.
Rep GetIpamPoolAllocationsResponse x
-> GetIpamPoolAllocationsResponse
forall x.
GetIpamPoolAllocationsResponse
-> Rep GetIpamPoolAllocationsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetIpamPoolAllocationsResponse x
-> GetIpamPoolAllocationsResponse
$cfrom :: forall x.
GetIpamPoolAllocationsResponse
-> Rep GetIpamPoolAllocationsResponse x
Prelude.Generic)

-- |
-- Create a value of 'GetIpamPoolAllocationsResponse' 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:
--
-- 'ipamPoolAllocations', 'getIpamPoolAllocationsResponse_ipamPoolAllocations' - The IPAM pool allocations you want information on.
--
-- 'nextToken', 'getIpamPoolAllocationsResponse_nextToken' - The token to use to retrieve the next page of results. This value is
-- @null@ when there are no more results to return.
--
-- 'httpStatus', 'getIpamPoolAllocationsResponse_httpStatus' - The response's http status code.
newGetIpamPoolAllocationsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetIpamPoolAllocationsResponse
newGetIpamPoolAllocationsResponse :: Int -> GetIpamPoolAllocationsResponse
newGetIpamPoolAllocationsResponse Int
pHttpStatus_ =
  GetIpamPoolAllocationsResponse'
    { $sel:ipamPoolAllocations:GetIpamPoolAllocationsResponse' :: Maybe [IpamPoolAllocation]
ipamPoolAllocations =
        forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:GetIpamPoolAllocationsResponse' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:GetIpamPoolAllocationsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The IPAM pool allocations you want information on.
getIpamPoolAllocationsResponse_ipamPoolAllocations :: Lens.Lens' GetIpamPoolAllocationsResponse (Prelude.Maybe [IpamPoolAllocation])
getIpamPoolAllocationsResponse_ipamPoolAllocations :: Lens' GetIpamPoolAllocationsResponse (Maybe [IpamPoolAllocation])
getIpamPoolAllocationsResponse_ipamPoolAllocations = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetIpamPoolAllocationsResponse' {Maybe [IpamPoolAllocation]
ipamPoolAllocations :: Maybe [IpamPoolAllocation]
$sel:ipamPoolAllocations:GetIpamPoolAllocationsResponse' :: GetIpamPoolAllocationsResponse -> Maybe [IpamPoolAllocation]
ipamPoolAllocations} -> Maybe [IpamPoolAllocation]
ipamPoolAllocations) (\s :: GetIpamPoolAllocationsResponse
s@GetIpamPoolAllocationsResponse' {} Maybe [IpamPoolAllocation]
a -> GetIpamPoolAllocationsResponse
s {$sel:ipamPoolAllocations:GetIpamPoolAllocationsResponse' :: Maybe [IpamPoolAllocation]
ipamPoolAllocations = Maybe [IpamPoolAllocation]
a} :: GetIpamPoolAllocationsResponse) 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

-- | The token to use to retrieve the next page of results. This value is
-- @null@ when there are no more results to return.
getIpamPoolAllocationsResponse_nextToken :: Lens.Lens' GetIpamPoolAllocationsResponse (Prelude.Maybe Prelude.Text)
getIpamPoolAllocationsResponse_nextToken :: Lens' GetIpamPoolAllocationsResponse (Maybe Text)
getIpamPoolAllocationsResponse_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetIpamPoolAllocationsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:GetIpamPoolAllocationsResponse' :: GetIpamPoolAllocationsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: GetIpamPoolAllocationsResponse
s@GetIpamPoolAllocationsResponse' {} Maybe Text
a -> GetIpamPoolAllocationsResponse
s {$sel:nextToken:GetIpamPoolAllocationsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: GetIpamPoolAllocationsResponse)

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

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