{-# 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.WorkSpaces.ListAvailableManagementCidrRanges
-- 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)
--
-- Retrieves a list of IP address ranges, specified as IPv4 CIDR blocks,
-- that you can use for the network management interface when you enable
-- Bring Your Own License (BYOL).
--
-- This operation can be run only by Amazon Web Services accounts that are
-- enabled for BYOL. If your account isn\'t enabled for BYOL, you\'ll
-- receive an @AccessDeniedException@ error.
--
-- The management network interface is connected to a secure Amazon
-- WorkSpaces management network. It is used for interactive streaming of
-- the WorkSpace desktop to Amazon WorkSpaces clients, and to allow Amazon
-- WorkSpaces to manage the WorkSpace.
--
-- This operation returns paginated results.
module Amazonka.WorkSpaces.ListAvailableManagementCidrRanges
  ( -- * Creating a Request
    ListAvailableManagementCidrRanges (..),
    newListAvailableManagementCidrRanges,

    -- * Request Lenses
    listAvailableManagementCidrRanges_nextToken,
    listAvailableManagementCidrRanges_maxResults,
    listAvailableManagementCidrRanges_managementCidrRangeConstraint,

    -- * Destructuring the Response
    ListAvailableManagementCidrRangesResponse (..),
    newListAvailableManagementCidrRangesResponse,

    -- * Response Lenses
    listAvailableManagementCidrRangesResponse_managementCidrRanges,
    listAvailableManagementCidrRangesResponse_nextToken,
    listAvailableManagementCidrRangesResponse_httpStatus,
  )
where

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

-- | /See:/ 'newListAvailableManagementCidrRanges' smart constructor.
data ListAvailableManagementCidrRanges = ListAvailableManagementCidrRanges'
  { -- | If you received a @NextToken@ from a previous call that was paginated,
    -- provide this token to receive the next set of results.
    ListAvailableManagementCidrRanges -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of items to return.
    ListAvailableManagementCidrRanges -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | The IP address range to search. Specify an IP address range that is
    -- compatible with your network and in CIDR notation (that is, specify the
    -- range as an IPv4 CIDR block).
    ListAvailableManagementCidrRanges -> Text
managementCidrRangeConstraint :: Prelude.Text
  }
  deriving (ListAvailableManagementCidrRanges
-> ListAvailableManagementCidrRanges -> Bool
(ListAvailableManagementCidrRanges
 -> ListAvailableManagementCidrRanges -> Bool)
-> (ListAvailableManagementCidrRanges
    -> ListAvailableManagementCidrRanges -> Bool)
-> Eq ListAvailableManagementCidrRanges
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListAvailableManagementCidrRanges
-> ListAvailableManagementCidrRanges -> Bool
$c/= :: ListAvailableManagementCidrRanges
-> ListAvailableManagementCidrRanges -> Bool
== :: ListAvailableManagementCidrRanges
-> ListAvailableManagementCidrRanges -> Bool
$c== :: ListAvailableManagementCidrRanges
-> ListAvailableManagementCidrRanges -> Bool
Prelude.Eq, ReadPrec [ListAvailableManagementCidrRanges]
ReadPrec ListAvailableManagementCidrRanges
Int -> ReadS ListAvailableManagementCidrRanges
ReadS [ListAvailableManagementCidrRanges]
(Int -> ReadS ListAvailableManagementCidrRanges)
-> ReadS [ListAvailableManagementCidrRanges]
-> ReadPrec ListAvailableManagementCidrRanges
-> ReadPrec [ListAvailableManagementCidrRanges]
-> Read ListAvailableManagementCidrRanges
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListAvailableManagementCidrRanges]
$creadListPrec :: ReadPrec [ListAvailableManagementCidrRanges]
readPrec :: ReadPrec ListAvailableManagementCidrRanges
$creadPrec :: ReadPrec ListAvailableManagementCidrRanges
readList :: ReadS [ListAvailableManagementCidrRanges]
$creadList :: ReadS [ListAvailableManagementCidrRanges]
readsPrec :: Int -> ReadS ListAvailableManagementCidrRanges
$creadsPrec :: Int -> ReadS ListAvailableManagementCidrRanges
Prelude.Read, Int -> ListAvailableManagementCidrRanges -> ShowS
[ListAvailableManagementCidrRanges] -> ShowS
ListAvailableManagementCidrRanges -> String
(Int -> ListAvailableManagementCidrRanges -> ShowS)
-> (ListAvailableManagementCidrRanges -> String)
-> ([ListAvailableManagementCidrRanges] -> ShowS)
-> Show ListAvailableManagementCidrRanges
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListAvailableManagementCidrRanges] -> ShowS
$cshowList :: [ListAvailableManagementCidrRanges] -> ShowS
show :: ListAvailableManagementCidrRanges -> String
$cshow :: ListAvailableManagementCidrRanges -> String
showsPrec :: Int -> ListAvailableManagementCidrRanges -> ShowS
$cshowsPrec :: Int -> ListAvailableManagementCidrRanges -> ShowS
Prelude.Show, (forall x.
 ListAvailableManagementCidrRanges
 -> Rep ListAvailableManagementCidrRanges x)
-> (forall x.
    Rep ListAvailableManagementCidrRanges x
    -> ListAvailableManagementCidrRanges)
-> Generic ListAvailableManagementCidrRanges
forall x.
Rep ListAvailableManagementCidrRanges x
-> ListAvailableManagementCidrRanges
forall x.
ListAvailableManagementCidrRanges
-> Rep ListAvailableManagementCidrRanges x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListAvailableManagementCidrRanges x
-> ListAvailableManagementCidrRanges
$cfrom :: forall x.
ListAvailableManagementCidrRanges
-> Rep ListAvailableManagementCidrRanges x
Prelude.Generic)

-- |
-- Create a value of 'ListAvailableManagementCidrRanges' 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', 'listAvailableManagementCidrRanges_nextToken' - If you received a @NextToken@ from a previous call that was paginated,
-- provide this token to receive the next set of results.
--
-- 'maxResults', 'listAvailableManagementCidrRanges_maxResults' - The maximum number of items to return.
--
-- 'managementCidrRangeConstraint', 'listAvailableManagementCidrRanges_managementCidrRangeConstraint' - The IP address range to search. Specify an IP address range that is
-- compatible with your network and in CIDR notation (that is, specify the
-- range as an IPv4 CIDR block).
newListAvailableManagementCidrRanges ::
  -- | 'managementCidrRangeConstraint'
  Prelude.Text ->
  ListAvailableManagementCidrRanges
newListAvailableManagementCidrRanges :: Text -> ListAvailableManagementCidrRanges
newListAvailableManagementCidrRanges
  Text
pManagementCidrRangeConstraint_ =
    ListAvailableManagementCidrRanges' :: Maybe Text
-> Maybe Natural -> Text -> ListAvailableManagementCidrRanges
ListAvailableManagementCidrRanges'
      { $sel:nextToken:ListAvailableManagementCidrRanges' :: Maybe Text
nextToken =
          Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:maxResults:ListAvailableManagementCidrRanges' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
        $sel:managementCidrRangeConstraint:ListAvailableManagementCidrRanges' :: Text
managementCidrRangeConstraint =
          Text
pManagementCidrRangeConstraint_
      }

-- | If you received a @NextToken@ from a previous call that was paginated,
-- provide this token to receive the next set of results.
listAvailableManagementCidrRanges_nextToken :: Lens.Lens' ListAvailableManagementCidrRanges (Prelude.Maybe Prelude.Text)
listAvailableManagementCidrRanges_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListAvailableManagementCidrRanges
-> f ListAvailableManagementCidrRanges
listAvailableManagementCidrRanges_nextToken = (ListAvailableManagementCidrRanges -> Maybe Text)
-> (ListAvailableManagementCidrRanges
    -> Maybe Text -> ListAvailableManagementCidrRanges)
-> Lens
     ListAvailableManagementCidrRanges
     ListAvailableManagementCidrRanges
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAvailableManagementCidrRanges' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListAvailableManagementCidrRanges' :: ListAvailableManagementCidrRanges -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListAvailableManagementCidrRanges
s@ListAvailableManagementCidrRanges' {} Maybe Text
a -> ListAvailableManagementCidrRanges
s {$sel:nextToken:ListAvailableManagementCidrRanges' :: Maybe Text
nextToken = Maybe Text
a} :: ListAvailableManagementCidrRanges)

-- | The maximum number of items to return.
listAvailableManagementCidrRanges_maxResults :: Lens.Lens' ListAvailableManagementCidrRanges (Prelude.Maybe Prelude.Natural)
listAvailableManagementCidrRanges_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> ListAvailableManagementCidrRanges
-> f ListAvailableManagementCidrRanges
listAvailableManagementCidrRanges_maxResults = (ListAvailableManagementCidrRanges -> Maybe Natural)
-> (ListAvailableManagementCidrRanges
    -> Maybe Natural -> ListAvailableManagementCidrRanges)
-> Lens
     ListAvailableManagementCidrRanges
     ListAvailableManagementCidrRanges
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAvailableManagementCidrRanges' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListAvailableManagementCidrRanges' :: ListAvailableManagementCidrRanges -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListAvailableManagementCidrRanges
s@ListAvailableManagementCidrRanges' {} Maybe Natural
a -> ListAvailableManagementCidrRanges
s {$sel:maxResults:ListAvailableManagementCidrRanges' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListAvailableManagementCidrRanges)

-- | The IP address range to search. Specify an IP address range that is
-- compatible with your network and in CIDR notation (that is, specify the
-- range as an IPv4 CIDR block).
listAvailableManagementCidrRanges_managementCidrRangeConstraint :: Lens.Lens' ListAvailableManagementCidrRanges Prelude.Text
listAvailableManagementCidrRanges_managementCidrRangeConstraint :: (Text -> f Text)
-> ListAvailableManagementCidrRanges
-> f ListAvailableManagementCidrRanges
listAvailableManagementCidrRanges_managementCidrRangeConstraint = (ListAvailableManagementCidrRanges -> Text)
-> (ListAvailableManagementCidrRanges
    -> Text -> ListAvailableManagementCidrRanges)
-> Lens
     ListAvailableManagementCidrRanges
     ListAvailableManagementCidrRanges
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAvailableManagementCidrRanges' {Text
managementCidrRangeConstraint :: Text
$sel:managementCidrRangeConstraint:ListAvailableManagementCidrRanges' :: ListAvailableManagementCidrRanges -> Text
managementCidrRangeConstraint} -> Text
managementCidrRangeConstraint) (\s :: ListAvailableManagementCidrRanges
s@ListAvailableManagementCidrRanges' {} Text
a -> ListAvailableManagementCidrRanges
s {$sel:managementCidrRangeConstraint:ListAvailableManagementCidrRanges' :: Text
managementCidrRangeConstraint = Text
a} :: ListAvailableManagementCidrRanges)

instance
  Core.AWSPager
    ListAvailableManagementCidrRanges
  where
  page :: ListAvailableManagementCidrRanges
-> AWSResponse ListAvailableManagementCidrRanges
-> Maybe ListAvailableManagementCidrRanges
page ListAvailableManagementCidrRanges
rq AWSResponse ListAvailableManagementCidrRanges
rs
    | Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListAvailableManagementCidrRanges
ListAvailableManagementCidrRangesResponse
rs
            ListAvailableManagementCidrRangesResponse
-> Getting
     (First Text) ListAvailableManagementCidrRangesResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListAvailableManagementCidrRangesResponse
-> Const (First Text) ListAvailableManagementCidrRangesResponse
Lens' ListAvailableManagementCidrRangesResponse (Maybe Text)
listAvailableManagementCidrRangesResponse_nextToken
              ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListAvailableManagementCidrRangesResponse
 -> Const (First Text) ListAvailableManagementCidrRangesResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting
     (First Text) ListAvailableManagementCidrRangesResponse 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 ListAvailableManagementCidrRanges
forall a. Maybe a
Prelude.Nothing
    | Maybe [Text] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListAvailableManagementCidrRanges
ListAvailableManagementCidrRangesResponse
rs
            ListAvailableManagementCidrRangesResponse
-> Getting
     (First [Text]) ListAvailableManagementCidrRangesResponse [Text]
-> Maybe [Text]
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe [Text] -> Const (First [Text]) (Maybe [Text]))
-> ListAvailableManagementCidrRangesResponse
-> Const (First [Text]) ListAvailableManagementCidrRangesResponse
Lens' ListAvailableManagementCidrRangesResponse (Maybe [Text])
listAvailableManagementCidrRangesResponse_managementCidrRanges
              ((Maybe [Text] -> Const (First [Text]) (Maybe [Text]))
 -> ListAvailableManagementCidrRangesResponse
 -> Const (First [Text]) ListAvailableManagementCidrRangesResponse)
-> (([Text] -> Const (First [Text]) [Text])
    -> Maybe [Text] -> Const (First [Text]) (Maybe [Text]))
-> Getting
     (First [Text]) ListAvailableManagementCidrRangesResponse [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 ListAvailableManagementCidrRanges
forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
      ListAvailableManagementCidrRanges
-> Maybe ListAvailableManagementCidrRanges
forall a. a -> Maybe a
Prelude.Just (ListAvailableManagementCidrRanges
 -> Maybe ListAvailableManagementCidrRanges)
-> ListAvailableManagementCidrRanges
-> Maybe ListAvailableManagementCidrRanges
forall a b. (a -> b) -> a -> b
Prelude.$
        ListAvailableManagementCidrRanges
rq
          ListAvailableManagementCidrRanges
-> (ListAvailableManagementCidrRanges
    -> ListAvailableManagementCidrRanges)
-> ListAvailableManagementCidrRanges
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> ListAvailableManagementCidrRanges
-> Identity ListAvailableManagementCidrRanges
Lens
  ListAvailableManagementCidrRanges
  ListAvailableManagementCidrRanges
  (Maybe Text)
  (Maybe Text)
listAvailableManagementCidrRanges_nextToken
          ((Maybe Text -> Identity (Maybe Text))
 -> ListAvailableManagementCidrRanges
 -> Identity ListAvailableManagementCidrRanges)
-> Maybe Text
-> ListAvailableManagementCidrRanges
-> ListAvailableManagementCidrRanges
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListAvailableManagementCidrRanges
ListAvailableManagementCidrRangesResponse
rs
          ListAvailableManagementCidrRangesResponse
-> Getting
     (First Text) ListAvailableManagementCidrRangesResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListAvailableManagementCidrRangesResponse
-> Const (First Text) ListAvailableManagementCidrRangesResponse
Lens' ListAvailableManagementCidrRangesResponse (Maybe Text)
listAvailableManagementCidrRangesResponse_nextToken
            ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListAvailableManagementCidrRangesResponse
 -> Const (First Text) ListAvailableManagementCidrRangesResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting
     (First Text) ListAvailableManagementCidrRangesResponse 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
    ListAvailableManagementCidrRanges
  where
  type
    AWSResponse ListAvailableManagementCidrRanges =
      ListAvailableManagementCidrRangesResponse
  request :: ListAvailableManagementCidrRanges
-> Request ListAvailableManagementCidrRanges
request = Service
-> ListAvailableManagementCidrRanges
-> Request ListAvailableManagementCidrRanges
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy ListAvailableManagementCidrRanges
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse (AWSResponse ListAvailableManagementCidrRanges)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse ListAvailableManagementCidrRanges))
-> Logger
-> Service
-> Proxy ListAvailableManagementCidrRanges
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse (AWSResponse ListAvailableManagementCidrRanges)))
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 [Text]
-> Maybe Text -> Int -> ListAvailableManagementCidrRangesResponse
ListAvailableManagementCidrRangesResponse'
            (Maybe [Text]
 -> Maybe Text -> Int -> ListAvailableManagementCidrRangesResponse)
-> Either String (Maybe [Text])
-> Either
     String
     (Maybe Text -> Int -> ListAvailableManagementCidrRangesResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( Object
x Object -> Text -> Either String (Maybe (Maybe [Text]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"ManagementCidrRanges"
                            Either String (Maybe (Maybe [Text]))
-> Maybe [Text] -> Either String (Maybe [Text])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [Text]
forall a. Monoid a => a
Prelude.mempty
                        )
              Either
  String
  (Maybe Text -> Int -> ListAvailableManagementCidrRangesResponse)
-> Either String (Maybe Text)
-> Either String (Int -> ListAvailableManagementCidrRangesResponse)
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 -> ListAvailableManagementCidrRangesResponse)
-> Either String Int
-> Either String ListAvailableManagementCidrRangesResponse
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
    ListAvailableManagementCidrRanges

instance
  Prelude.NFData
    ListAvailableManagementCidrRanges

instance
  Core.ToHeaders
    ListAvailableManagementCidrRanges
  where
  toHeaders :: ListAvailableManagementCidrRanges -> ResponseHeaders
toHeaders =
    ResponseHeaders
-> ListAvailableManagementCidrRanges -> 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
"WorkspacesService.ListAvailableManagementCidrRanges" ::
                          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
    ListAvailableManagementCidrRanges
  where
  toJSON :: ListAvailableManagementCidrRanges -> Value
toJSON ListAvailableManagementCidrRanges' {Maybe Natural
Maybe Text
Text
managementCidrRangeConstraint :: Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
$sel:managementCidrRangeConstraint:ListAvailableManagementCidrRanges' :: ListAvailableManagementCidrRanges -> Text
$sel:maxResults:ListAvailableManagementCidrRanges' :: ListAvailableManagementCidrRanges -> Maybe Natural
$sel:nextToken:ListAvailableManagementCidrRanges' :: ListAvailableManagementCidrRanges -> 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
"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,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              ( Text
"ManagementCidrRangeConstraint"
                  Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
managementCidrRangeConstraint
              )
          ]
      )

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

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

-- | /See:/ 'newListAvailableManagementCidrRangesResponse' smart constructor.
data ListAvailableManagementCidrRangesResponse = ListAvailableManagementCidrRangesResponse'
  { -- | The list of available IP address ranges, specified as IPv4 CIDR blocks.
    ListAvailableManagementCidrRangesResponse -> Maybe [Text]
managementCidrRanges :: Prelude.Maybe [Prelude.Text],
    -- | The token to use to retrieve the next page of results. This value is
    -- null when there are no more results to return.
    ListAvailableManagementCidrRangesResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    ListAvailableManagementCidrRangesResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ListAvailableManagementCidrRangesResponse
-> ListAvailableManagementCidrRangesResponse -> Bool
(ListAvailableManagementCidrRangesResponse
 -> ListAvailableManagementCidrRangesResponse -> Bool)
-> (ListAvailableManagementCidrRangesResponse
    -> ListAvailableManagementCidrRangesResponse -> Bool)
-> Eq ListAvailableManagementCidrRangesResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListAvailableManagementCidrRangesResponse
-> ListAvailableManagementCidrRangesResponse -> Bool
$c/= :: ListAvailableManagementCidrRangesResponse
-> ListAvailableManagementCidrRangesResponse -> Bool
== :: ListAvailableManagementCidrRangesResponse
-> ListAvailableManagementCidrRangesResponse -> Bool
$c== :: ListAvailableManagementCidrRangesResponse
-> ListAvailableManagementCidrRangesResponse -> Bool
Prelude.Eq, ReadPrec [ListAvailableManagementCidrRangesResponse]
ReadPrec ListAvailableManagementCidrRangesResponse
Int -> ReadS ListAvailableManagementCidrRangesResponse
ReadS [ListAvailableManagementCidrRangesResponse]
(Int -> ReadS ListAvailableManagementCidrRangesResponse)
-> ReadS [ListAvailableManagementCidrRangesResponse]
-> ReadPrec ListAvailableManagementCidrRangesResponse
-> ReadPrec [ListAvailableManagementCidrRangesResponse]
-> Read ListAvailableManagementCidrRangesResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListAvailableManagementCidrRangesResponse]
$creadListPrec :: ReadPrec [ListAvailableManagementCidrRangesResponse]
readPrec :: ReadPrec ListAvailableManagementCidrRangesResponse
$creadPrec :: ReadPrec ListAvailableManagementCidrRangesResponse
readList :: ReadS [ListAvailableManagementCidrRangesResponse]
$creadList :: ReadS [ListAvailableManagementCidrRangesResponse]
readsPrec :: Int -> ReadS ListAvailableManagementCidrRangesResponse
$creadsPrec :: Int -> ReadS ListAvailableManagementCidrRangesResponse
Prelude.Read, Int -> ListAvailableManagementCidrRangesResponse -> ShowS
[ListAvailableManagementCidrRangesResponse] -> ShowS
ListAvailableManagementCidrRangesResponse -> String
(Int -> ListAvailableManagementCidrRangesResponse -> ShowS)
-> (ListAvailableManagementCidrRangesResponse -> String)
-> ([ListAvailableManagementCidrRangesResponse] -> ShowS)
-> Show ListAvailableManagementCidrRangesResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListAvailableManagementCidrRangesResponse] -> ShowS
$cshowList :: [ListAvailableManagementCidrRangesResponse] -> ShowS
show :: ListAvailableManagementCidrRangesResponse -> String
$cshow :: ListAvailableManagementCidrRangesResponse -> String
showsPrec :: Int -> ListAvailableManagementCidrRangesResponse -> ShowS
$cshowsPrec :: Int -> ListAvailableManagementCidrRangesResponse -> ShowS
Prelude.Show, (forall x.
 ListAvailableManagementCidrRangesResponse
 -> Rep ListAvailableManagementCidrRangesResponse x)
-> (forall x.
    Rep ListAvailableManagementCidrRangesResponse x
    -> ListAvailableManagementCidrRangesResponse)
-> Generic ListAvailableManagementCidrRangesResponse
forall x.
Rep ListAvailableManagementCidrRangesResponse x
-> ListAvailableManagementCidrRangesResponse
forall x.
ListAvailableManagementCidrRangesResponse
-> Rep ListAvailableManagementCidrRangesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListAvailableManagementCidrRangesResponse x
-> ListAvailableManagementCidrRangesResponse
$cfrom :: forall x.
ListAvailableManagementCidrRangesResponse
-> Rep ListAvailableManagementCidrRangesResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListAvailableManagementCidrRangesResponse' 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:
--
-- 'managementCidrRanges', 'listAvailableManagementCidrRangesResponse_managementCidrRanges' - The list of available IP address ranges, specified as IPv4 CIDR blocks.
--
-- 'nextToken', 'listAvailableManagementCidrRangesResponse_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', 'listAvailableManagementCidrRangesResponse_httpStatus' - The response's http status code.
newListAvailableManagementCidrRangesResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListAvailableManagementCidrRangesResponse
newListAvailableManagementCidrRangesResponse :: Int -> ListAvailableManagementCidrRangesResponse
newListAvailableManagementCidrRangesResponse
  Int
pHttpStatus_ =
    ListAvailableManagementCidrRangesResponse' :: Maybe [Text]
-> Maybe Text -> Int -> ListAvailableManagementCidrRangesResponse
ListAvailableManagementCidrRangesResponse'
      { $sel:managementCidrRanges:ListAvailableManagementCidrRangesResponse' :: Maybe [Text]
managementCidrRanges =
          Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
        $sel:nextToken:ListAvailableManagementCidrRangesResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:httpStatus:ListAvailableManagementCidrRangesResponse' :: Int
httpStatus = Int
pHttpStatus_
      }

-- | The list of available IP address ranges, specified as IPv4 CIDR blocks.
listAvailableManagementCidrRangesResponse_managementCidrRanges :: Lens.Lens' ListAvailableManagementCidrRangesResponse (Prelude.Maybe [Prelude.Text])
listAvailableManagementCidrRangesResponse_managementCidrRanges :: (Maybe [Text] -> f (Maybe [Text]))
-> ListAvailableManagementCidrRangesResponse
-> f ListAvailableManagementCidrRangesResponse
listAvailableManagementCidrRangesResponse_managementCidrRanges = (ListAvailableManagementCidrRangesResponse -> Maybe [Text])
-> (ListAvailableManagementCidrRangesResponse
    -> Maybe [Text] -> ListAvailableManagementCidrRangesResponse)
-> Lens' ListAvailableManagementCidrRangesResponse (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAvailableManagementCidrRangesResponse' {Maybe [Text]
managementCidrRanges :: Maybe [Text]
$sel:managementCidrRanges:ListAvailableManagementCidrRangesResponse' :: ListAvailableManagementCidrRangesResponse -> Maybe [Text]
managementCidrRanges} -> Maybe [Text]
managementCidrRanges) (\s :: ListAvailableManagementCidrRangesResponse
s@ListAvailableManagementCidrRangesResponse' {} Maybe [Text]
a -> ListAvailableManagementCidrRangesResponse
s {$sel:managementCidrRanges:ListAvailableManagementCidrRangesResponse' :: Maybe [Text]
managementCidrRanges = Maybe [Text]
a} :: ListAvailableManagementCidrRangesResponse) ((Maybe [Text] -> f (Maybe [Text]))
 -> ListAvailableManagementCidrRangesResponse
 -> f ListAvailableManagementCidrRangesResponse)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> ListAvailableManagementCidrRangesResponse
-> f ListAvailableManagementCidrRangesResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
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 [Text] [Text] [Text] [Text]
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.
listAvailableManagementCidrRangesResponse_nextToken :: Lens.Lens' ListAvailableManagementCidrRangesResponse (Prelude.Maybe Prelude.Text)
listAvailableManagementCidrRangesResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListAvailableManagementCidrRangesResponse
-> f ListAvailableManagementCidrRangesResponse
listAvailableManagementCidrRangesResponse_nextToken = (ListAvailableManagementCidrRangesResponse -> Maybe Text)
-> (ListAvailableManagementCidrRangesResponse
    -> Maybe Text -> ListAvailableManagementCidrRangesResponse)
-> Lens' ListAvailableManagementCidrRangesResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAvailableManagementCidrRangesResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListAvailableManagementCidrRangesResponse' :: ListAvailableManagementCidrRangesResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListAvailableManagementCidrRangesResponse
s@ListAvailableManagementCidrRangesResponse' {} Maybe Text
a -> ListAvailableManagementCidrRangesResponse
s {$sel:nextToken:ListAvailableManagementCidrRangesResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListAvailableManagementCidrRangesResponse)

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

instance
  Prelude.NFData
    ListAvailableManagementCidrRangesResponse