{-# 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.Route53.GetCheckerIpRanges
-- 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)
--
-- Route 53 does not perform authorization for this API because it
-- retrieves information that is already available to the public.
--
-- @GetCheckerIpRanges@ still works, but we recommend that you download
-- ip-ranges.json, which includes IP address ranges for all Amazon Web
-- Services services. For more information, see
-- <https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/route-53-ip-addresses.html IP Address Ranges of Amazon Route 53 Servers>
-- in the /Amazon Route 53 Developer Guide/.
module Amazonka.Route53.GetCheckerIpRanges
  ( -- * Creating a Request
    GetCheckerIpRanges (..),
    newGetCheckerIpRanges,

    -- * Destructuring the Response
    GetCheckerIpRangesResponse (..),
    newGetCheckerIpRangesResponse,

    -- * Response Lenses
    getCheckerIpRangesResponse_httpStatus,
    getCheckerIpRangesResponse_checkerIpRanges,
  )
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.Route53.Types

-- | Empty request.
--
-- /See:/ 'newGetCheckerIpRanges' smart constructor.
data GetCheckerIpRanges = GetCheckerIpRanges'
  {
  }
  deriving (GetCheckerIpRanges -> GetCheckerIpRanges -> Bool
(GetCheckerIpRanges -> GetCheckerIpRanges -> Bool)
-> (GetCheckerIpRanges -> GetCheckerIpRanges -> Bool)
-> Eq GetCheckerIpRanges
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetCheckerIpRanges -> GetCheckerIpRanges -> Bool
$c/= :: GetCheckerIpRanges -> GetCheckerIpRanges -> Bool
== :: GetCheckerIpRanges -> GetCheckerIpRanges -> Bool
$c== :: GetCheckerIpRanges -> GetCheckerIpRanges -> Bool
Prelude.Eq, ReadPrec [GetCheckerIpRanges]
ReadPrec GetCheckerIpRanges
Int -> ReadS GetCheckerIpRanges
ReadS [GetCheckerIpRanges]
(Int -> ReadS GetCheckerIpRanges)
-> ReadS [GetCheckerIpRanges]
-> ReadPrec GetCheckerIpRanges
-> ReadPrec [GetCheckerIpRanges]
-> Read GetCheckerIpRanges
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetCheckerIpRanges]
$creadListPrec :: ReadPrec [GetCheckerIpRanges]
readPrec :: ReadPrec GetCheckerIpRanges
$creadPrec :: ReadPrec GetCheckerIpRanges
readList :: ReadS [GetCheckerIpRanges]
$creadList :: ReadS [GetCheckerIpRanges]
readsPrec :: Int -> ReadS GetCheckerIpRanges
$creadsPrec :: Int -> ReadS GetCheckerIpRanges
Prelude.Read, Int -> GetCheckerIpRanges -> ShowS
[GetCheckerIpRanges] -> ShowS
GetCheckerIpRanges -> String
(Int -> GetCheckerIpRanges -> ShowS)
-> (GetCheckerIpRanges -> String)
-> ([GetCheckerIpRanges] -> ShowS)
-> Show GetCheckerIpRanges
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetCheckerIpRanges] -> ShowS
$cshowList :: [GetCheckerIpRanges] -> ShowS
show :: GetCheckerIpRanges -> String
$cshow :: GetCheckerIpRanges -> String
showsPrec :: Int -> GetCheckerIpRanges -> ShowS
$cshowsPrec :: Int -> GetCheckerIpRanges -> ShowS
Prelude.Show, (forall x. GetCheckerIpRanges -> Rep GetCheckerIpRanges x)
-> (forall x. Rep GetCheckerIpRanges x -> GetCheckerIpRanges)
-> Generic GetCheckerIpRanges
forall x. Rep GetCheckerIpRanges x -> GetCheckerIpRanges
forall x. GetCheckerIpRanges -> Rep GetCheckerIpRanges x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetCheckerIpRanges x -> GetCheckerIpRanges
$cfrom :: forall x. GetCheckerIpRanges -> Rep GetCheckerIpRanges x
Prelude.Generic)

-- |
-- Create a value of 'GetCheckerIpRanges' 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.
newGetCheckerIpRanges ::
  GetCheckerIpRanges
newGetCheckerIpRanges :: GetCheckerIpRanges
newGetCheckerIpRanges = GetCheckerIpRanges
GetCheckerIpRanges'

instance Core.AWSRequest GetCheckerIpRanges where
  type
    AWSResponse GetCheckerIpRanges =
      GetCheckerIpRangesResponse
  request :: GetCheckerIpRanges -> Request GetCheckerIpRanges
request = Service -> GetCheckerIpRanges -> Request GetCheckerIpRanges
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
  response :: Logger
-> Service
-> Proxy GetCheckerIpRanges
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse GetCheckerIpRanges)))
response =
    (Int
 -> ResponseHeaders
 -> [Node]
 -> Either String (AWSResponse GetCheckerIpRanges))
-> Logger
-> Service
-> Proxy GetCheckerIpRanges
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse GetCheckerIpRanges)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> [Node] -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveXML
      ( \Int
s ResponseHeaders
h [Node]
x ->
          Int -> [Text] -> GetCheckerIpRangesResponse
GetCheckerIpRangesResponse'
            (Int -> [Text] -> GetCheckerIpRangesResponse)
-> Either String Int
-> Either String ([Text] -> GetCheckerIpRangesResponse)
forall (f :: * -> *) a b. Functor 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))
            Either String ([Text] -> GetCheckerIpRangesResponse)
-> Either String [Text] -> Either String GetCheckerIpRangesResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( [Node]
x [Node] -> Text -> Either String (Maybe [Node])
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"CheckerIpRanges" Either String (Maybe [Node]) -> [Node] -> Either String [Node]
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ [Node]
forall a. Monoid a => a
Prelude.mempty
                            Either String [Node]
-> ([Node] -> Either String [Text]) -> Either String [Text]
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= Text -> [Node] -> Either String [Text]
forall a. FromXML a => Text -> [Node] -> Either String [a]
Core.parseXMLList Text
"member"
                        )
      )

instance Prelude.Hashable GetCheckerIpRanges

instance Prelude.NFData GetCheckerIpRanges

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

instance Core.ToPath GetCheckerIpRanges where
  toPath :: GetCheckerIpRanges -> ByteString
toPath = ByteString -> GetCheckerIpRanges -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/2013-04-01/checkeripranges"

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

-- | A complex type that contains the @CheckerIpRanges@ element.
--
-- /See:/ 'newGetCheckerIpRangesResponse' smart constructor.
data GetCheckerIpRangesResponse = GetCheckerIpRangesResponse'
  { -- | The response's http status code.
    GetCheckerIpRangesResponse -> Int
httpStatus :: Prelude.Int,
    -- | A complex type that contains sorted list of IP ranges in CIDR format for
    -- Amazon Route 53 health checkers.
    GetCheckerIpRangesResponse -> [Text]
checkerIpRanges :: [Prelude.Text]
  }
  deriving (GetCheckerIpRangesResponse -> GetCheckerIpRangesResponse -> Bool
(GetCheckerIpRangesResponse -> GetCheckerIpRangesResponse -> Bool)
-> (GetCheckerIpRangesResponse
    -> GetCheckerIpRangesResponse -> Bool)
-> Eq GetCheckerIpRangesResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetCheckerIpRangesResponse -> GetCheckerIpRangesResponse -> Bool
$c/= :: GetCheckerIpRangesResponse -> GetCheckerIpRangesResponse -> Bool
== :: GetCheckerIpRangesResponse -> GetCheckerIpRangesResponse -> Bool
$c== :: GetCheckerIpRangesResponse -> GetCheckerIpRangesResponse -> Bool
Prelude.Eq, ReadPrec [GetCheckerIpRangesResponse]
ReadPrec GetCheckerIpRangesResponse
Int -> ReadS GetCheckerIpRangesResponse
ReadS [GetCheckerIpRangesResponse]
(Int -> ReadS GetCheckerIpRangesResponse)
-> ReadS [GetCheckerIpRangesResponse]
-> ReadPrec GetCheckerIpRangesResponse
-> ReadPrec [GetCheckerIpRangesResponse]
-> Read GetCheckerIpRangesResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetCheckerIpRangesResponse]
$creadListPrec :: ReadPrec [GetCheckerIpRangesResponse]
readPrec :: ReadPrec GetCheckerIpRangesResponse
$creadPrec :: ReadPrec GetCheckerIpRangesResponse
readList :: ReadS [GetCheckerIpRangesResponse]
$creadList :: ReadS [GetCheckerIpRangesResponse]
readsPrec :: Int -> ReadS GetCheckerIpRangesResponse
$creadsPrec :: Int -> ReadS GetCheckerIpRangesResponse
Prelude.Read, Int -> GetCheckerIpRangesResponse -> ShowS
[GetCheckerIpRangesResponse] -> ShowS
GetCheckerIpRangesResponse -> String
(Int -> GetCheckerIpRangesResponse -> ShowS)
-> (GetCheckerIpRangesResponse -> String)
-> ([GetCheckerIpRangesResponse] -> ShowS)
-> Show GetCheckerIpRangesResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetCheckerIpRangesResponse] -> ShowS
$cshowList :: [GetCheckerIpRangesResponse] -> ShowS
show :: GetCheckerIpRangesResponse -> String
$cshow :: GetCheckerIpRangesResponse -> String
showsPrec :: Int -> GetCheckerIpRangesResponse -> ShowS
$cshowsPrec :: Int -> GetCheckerIpRangesResponse -> ShowS
Prelude.Show, (forall x.
 GetCheckerIpRangesResponse -> Rep GetCheckerIpRangesResponse x)
-> (forall x.
    Rep GetCheckerIpRangesResponse x -> GetCheckerIpRangesResponse)
-> Generic GetCheckerIpRangesResponse
forall x.
Rep GetCheckerIpRangesResponse x -> GetCheckerIpRangesResponse
forall x.
GetCheckerIpRangesResponse -> Rep GetCheckerIpRangesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetCheckerIpRangesResponse x -> GetCheckerIpRangesResponse
$cfrom :: forall x.
GetCheckerIpRangesResponse -> Rep GetCheckerIpRangesResponse x
Prelude.Generic)

-- |
-- Create a value of 'GetCheckerIpRangesResponse' 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:
--
-- 'httpStatus', 'getCheckerIpRangesResponse_httpStatus' - The response's http status code.
--
-- 'checkerIpRanges', 'getCheckerIpRangesResponse_checkerIpRanges' - A complex type that contains sorted list of IP ranges in CIDR format for
-- Amazon Route 53 health checkers.
newGetCheckerIpRangesResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetCheckerIpRangesResponse
newGetCheckerIpRangesResponse :: Int -> GetCheckerIpRangesResponse
newGetCheckerIpRangesResponse Int
pHttpStatus_ =
  GetCheckerIpRangesResponse' :: Int -> [Text] -> GetCheckerIpRangesResponse
GetCheckerIpRangesResponse'
    { $sel:httpStatus:GetCheckerIpRangesResponse' :: Int
httpStatus =
        Int
pHttpStatus_,
      $sel:checkerIpRanges:GetCheckerIpRangesResponse' :: [Text]
checkerIpRanges = [Text]
forall a. Monoid a => a
Prelude.mempty
    }

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

-- | A complex type that contains sorted list of IP ranges in CIDR format for
-- Amazon Route 53 health checkers.
getCheckerIpRangesResponse_checkerIpRanges :: Lens.Lens' GetCheckerIpRangesResponse [Prelude.Text]
getCheckerIpRangesResponse_checkerIpRanges :: ([Text] -> f [Text])
-> GetCheckerIpRangesResponse -> f GetCheckerIpRangesResponse
getCheckerIpRangesResponse_checkerIpRanges = (GetCheckerIpRangesResponse -> [Text])
-> (GetCheckerIpRangesResponse
    -> [Text] -> GetCheckerIpRangesResponse)
-> Lens
     GetCheckerIpRangesResponse GetCheckerIpRangesResponse [Text] [Text]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetCheckerIpRangesResponse' {[Text]
checkerIpRanges :: [Text]
$sel:checkerIpRanges:GetCheckerIpRangesResponse' :: GetCheckerIpRangesResponse -> [Text]
checkerIpRanges} -> [Text]
checkerIpRanges) (\s :: GetCheckerIpRangesResponse
s@GetCheckerIpRangesResponse' {} [Text]
a -> GetCheckerIpRangesResponse
s {$sel:checkerIpRanges:GetCheckerIpRangesResponse' :: [Text]
checkerIpRanges = [Text]
a} :: GetCheckerIpRangesResponse) (([Text] -> f [Text])
 -> GetCheckerIpRangesResponse -> f GetCheckerIpRangesResponse)
-> (([Text] -> f [Text]) -> [Text] -> f [Text])
-> ([Text] -> f [Text])
-> GetCheckerIpRangesResponse
-> f GetCheckerIpRangesResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([Text] -> f [Text]) -> [Text] -> f [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Prelude.NFData GetCheckerIpRangesResponse