{-# 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.GetHealthCheckCount
-- 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 the number of health checks that are associated with the
-- current Amazon Web Services account.
module Amazonka.Route53.GetHealthCheckCount
  ( -- * Creating a Request
    GetHealthCheckCount (..),
    newGetHealthCheckCount,

    -- * Destructuring the Response
    GetHealthCheckCountResponse (..),
    newGetHealthCheckCountResponse,

    -- * Response Lenses
    getHealthCheckCountResponse_httpStatus,
    getHealthCheckCountResponse_healthCheckCount,
  )
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

-- | A request for the number of health checks that are associated with the
-- current Amazon Web Services account.
--
-- /See:/ 'newGetHealthCheckCount' smart constructor.
data GetHealthCheckCount = GetHealthCheckCount'
  {
  }
  deriving (GetHealthCheckCount -> GetHealthCheckCount -> Bool
(GetHealthCheckCount -> GetHealthCheckCount -> Bool)
-> (GetHealthCheckCount -> GetHealthCheckCount -> Bool)
-> Eq GetHealthCheckCount
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetHealthCheckCount -> GetHealthCheckCount -> Bool
$c/= :: GetHealthCheckCount -> GetHealthCheckCount -> Bool
== :: GetHealthCheckCount -> GetHealthCheckCount -> Bool
$c== :: GetHealthCheckCount -> GetHealthCheckCount -> Bool
Prelude.Eq, ReadPrec [GetHealthCheckCount]
ReadPrec GetHealthCheckCount
Int -> ReadS GetHealthCheckCount
ReadS [GetHealthCheckCount]
(Int -> ReadS GetHealthCheckCount)
-> ReadS [GetHealthCheckCount]
-> ReadPrec GetHealthCheckCount
-> ReadPrec [GetHealthCheckCount]
-> Read GetHealthCheckCount
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetHealthCheckCount]
$creadListPrec :: ReadPrec [GetHealthCheckCount]
readPrec :: ReadPrec GetHealthCheckCount
$creadPrec :: ReadPrec GetHealthCheckCount
readList :: ReadS [GetHealthCheckCount]
$creadList :: ReadS [GetHealthCheckCount]
readsPrec :: Int -> ReadS GetHealthCheckCount
$creadsPrec :: Int -> ReadS GetHealthCheckCount
Prelude.Read, Int -> GetHealthCheckCount -> ShowS
[GetHealthCheckCount] -> ShowS
GetHealthCheckCount -> String
(Int -> GetHealthCheckCount -> ShowS)
-> (GetHealthCheckCount -> String)
-> ([GetHealthCheckCount] -> ShowS)
-> Show GetHealthCheckCount
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetHealthCheckCount] -> ShowS
$cshowList :: [GetHealthCheckCount] -> ShowS
show :: GetHealthCheckCount -> String
$cshow :: GetHealthCheckCount -> String
showsPrec :: Int -> GetHealthCheckCount -> ShowS
$cshowsPrec :: Int -> GetHealthCheckCount -> ShowS
Prelude.Show, (forall x. GetHealthCheckCount -> Rep GetHealthCheckCount x)
-> (forall x. Rep GetHealthCheckCount x -> GetHealthCheckCount)
-> Generic GetHealthCheckCount
forall x. Rep GetHealthCheckCount x -> GetHealthCheckCount
forall x. GetHealthCheckCount -> Rep GetHealthCheckCount x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetHealthCheckCount x -> GetHealthCheckCount
$cfrom :: forall x. GetHealthCheckCount -> Rep GetHealthCheckCount x
Prelude.Generic)

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

instance Core.AWSRequest GetHealthCheckCount where
  type
    AWSResponse GetHealthCheckCount =
      GetHealthCheckCountResponse
  request :: GetHealthCheckCount -> Request GetHealthCheckCount
request = Service -> GetHealthCheckCount -> Request GetHealthCheckCount
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
  response :: Logger
-> Service
-> Proxy GetHealthCheckCount
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse GetHealthCheckCount)))
response =
    (Int
 -> ResponseHeaders
 -> [Node]
 -> Either String (AWSResponse GetHealthCheckCount))
-> Logger
-> Service
-> Proxy GetHealthCheckCount
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse GetHealthCheckCount)))
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 -> Integer -> GetHealthCheckCountResponse
GetHealthCheckCountResponse'
            (Int -> Integer -> GetHealthCheckCountResponse)
-> Either String Int
-> Either String (Integer -> GetHealthCheckCountResponse)
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 (Integer -> GetHealthCheckCountResponse)
-> Either String Integer
-> Either String GetHealthCheckCountResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String Integer
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"HealthCheckCount")
      )

instance Prelude.Hashable GetHealthCheckCount

instance Prelude.NFData GetHealthCheckCount

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

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

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

-- | A complex type that contains the response to a @GetHealthCheckCount@
-- request.
--
-- /See:/ 'newGetHealthCheckCountResponse' smart constructor.
data GetHealthCheckCountResponse = GetHealthCheckCountResponse'
  { -- | The response's http status code.
    GetHealthCheckCountResponse -> Int
httpStatus :: Prelude.Int,
    -- | The number of health checks associated with the current Amazon Web
    -- Services account.
    GetHealthCheckCountResponse -> Integer
healthCheckCount :: Prelude.Integer
  }
  deriving (GetHealthCheckCountResponse -> GetHealthCheckCountResponse -> Bool
(GetHealthCheckCountResponse
 -> GetHealthCheckCountResponse -> Bool)
-> (GetHealthCheckCountResponse
    -> GetHealthCheckCountResponse -> Bool)
-> Eq GetHealthCheckCountResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetHealthCheckCountResponse -> GetHealthCheckCountResponse -> Bool
$c/= :: GetHealthCheckCountResponse -> GetHealthCheckCountResponse -> Bool
== :: GetHealthCheckCountResponse -> GetHealthCheckCountResponse -> Bool
$c== :: GetHealthCheckCountResponse -> GetHealthCheckCountResponse -> Bool
Prelude.Eq, ReadPrec [GetHealthCheckCountResponse]
ReadPrec GetHealthCheckCountResponse
Int -> ReadS GetHealthCheckCountResponse
ReadS [GetHealthCheckCountResponse]
(Int -> ReadS GetHealthCheckCountResponse)
-> ReadS [GetHealthCheckCountResponse]
-> ReadPrec GetHealthCheckCountResponse
-> ReadPrec [GetHealthCheckCountResponse]
-> Read GetHealthCheckCountResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetHealthCheckCountResponse]
$creadListPrec :: ReadPrec [GetHealthCheckCountResponse]
readPrec :: ReadPrec GetHealthCheckCountResponse
$creadPrec :: ReadPrec GetHealthCheckCountResponse
readList :: ReadS [GetHealthCheckCountResponse]
$creadList :: ReadS [GetHealthCheckCountResponse]
readsPrec :: Int -> ReadS GetHealthCheckCountResponse
$creadsPrec :: Int -> ReadS GetHealthCheckCountResponse
Prelude.Read, Int -> GetHealthCheckCountResponse -> ShowS
[GetHealthCheckCountResponse] -> ShowS
GetHealthCheckCountResponse -> String
(Int -> GetHealthCheckCountResponse -> ShowS)
-> (GetHealthCheckCountResponse -> String)
-> ([GetHealthCheckCountResponse] -> ShowS)
-> Show GetHealthCheckCountResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetHealthCheckCountResponse] -> ShowS
$cshowList :: [GetHealthCheckCountResponse] -> ShowS
show :: GetHealthCheckCountResponse -> String
$cshow :: GetHealthCheckCountResponse -> String
showsPrec :: Int -> GetHealthCheckCountResponse -> ShowS
$cshowsPrec :: Int -> GetHealthCheckCountResponse -> ShowS
Prelude.Show, (forall x.
 GetHealthCheckCountResponse -> Rep GetHealthCheckCountResponse x)
-> (forall x.
    Rep GetHealthCheckCountResponse x -> GetHealthCheckCountResponse)
-> Generic GetHealthCheckCountResponse
forall x.
Rep GetHealthCheckCountResponse x -> GetHealthCheckCountResponse
forall x.
GetHealthCheckCountResponse -> Rep GetHealthCheckCountResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetHealthCheckCountResponse x -> GetHealthCheckCountResponse
$cfrom :: forall x.
GetHealthCheckCountResponse -> Rep GetHealthCheckCountResponse x
Prelude.Generic)

-- |
-- Create a value of 'GetHealthCheckCountResponse' 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', 'getHealthCheckCountResponse_httpStatus' - The response's http status code.
--
-- 'healthCheckCount', 'getHealthCheckCountResponse_healthCheckCount' - The number of health checks associated with the current Amazon Web
-- Services account.
newGetHealthCheckCountResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  -- | 'healthCheckCount'
  Prelude.Integer ->
  GetHealthCheckCountResponse
newGetHealthCheckCountResponse :: Int -> Integer -> GetHealthCheckCountResponse
newGetHealthCheckCountResponse
  Int
pHttpStatus_
  Integer
pHealthCheckCount_ =
    GetHealthCheckCountResponse' :: Int -> Integer -> GetHealthCheckCountResponse
GetHealthCheckCountResponse'
      { $sel:httpStatus:GetHealthCheckCountResponse' :: Int
httpStatus =
          Int
pHttpStatus_,
        $sel:healthCheckCount:GetHealthCheckCountResponse' :: Integer
healthCheckCount = Integer
pHealthCheckCount_
      }

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

-- | The number of health checks associated with the current Amazon Web
-- Services account.
getHealthCheckCountResponse_healthCheckCount :: Lens.Lens' GetHealthCheckCountResponse Prelude.Integer
getHealthCheckCountResponse_healthCheckCount :: (Integer -> f Integer)
-> GetHealthCheckCountResponse -> f GetHealthCheckCountResponse
getHealthCheckCountResponse_healthCheckCount = (GetHealthCheckCountResponse -> Integer)
-> (GetHealthCheckCountResponse
    -> Integer -> GetHealthCheckCountResponse)
-> Lens
     GetHealthCheckCountResponse
     GetHealthCheckCountResponse
     Integer
     Integer
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetHealthCheckCountResponse' {Integer
healthCheckCount :: Integer
$sel:healthCheckCount:GetHealthCheckCountResponse' :: GetHealthCheckCountResponse -> Integer
healthCheckCount} -> Integer
healthCheckCount) (\s :: GetHealthCheckCountResponse
s@GetHealthCheckCountResponse' {} Integer
a -> GetHealthCheckCountResponse
s {$sel:healthCheckCount:GetHealthCheckCountResponse' :: Integer
healthCheckCount = Integer
a} :: GetHealthCheckCountResponse)

instance Prelude.NFData GetHealthCheckCountResponse