{-# 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.GetTrafficPolicyInstanceCount
-- 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)
--
-- Gets the number of traffic policy instances that are associated with the
-- current Amazon Web Services account.
module Amazonka.Route53.GetTrafficPolicyInstanceCount
  ( -- * Creating a Request
    GetTrafficPolicyInstanceCount (..),
    newGetTrafficPolicyInstanceCount,

    -- * Destructuring the Response
    GetTrafficPolicyInstanceCountResponse (..),
    newGetTrafficPolicyInstanceCountResponse,

    -- * Response Lenses
    getTrafficPolicyInstanceCountResponse_httpStatus,
    getTrafficPolicyInstanceCountResponse_trafficPolicyInstanceCount,
  )
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

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

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

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

instance
  Prelude.Hashable
    GetTrafficPolicyInstanceCount

instance Prelude.NFData GetTrafficPolicyInstanceCount

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

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

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

-- | A complex type that contains information about the resource record sets
-- that Amazon Route 53 created based on a specified traffic policy.
--
-- /See:/ 'newGetTrafficPolicyInstanceCountResponse' smart constructor.
data GetTrafficPolicyInstanceCountResponse = GetTrafficPolicyInstanceCountResponse'
  { -- | The response's http status code.
    GetTrafficPolicyInstanceCountResponse -> Int
httpStatus :: Prelude.Int,
    -- | The number of traffic policy instances that are associated with the
    -- current Amazon Web Services account.
    GetTrafficPolicyInstanceCountResponse -> Int
trafficPolicyInstanceCount :: Prelude.Int
  }
  deriving (GetTrafficPolicyInstanceCountResponse
-> GetTrafficPolicyInstanceCountResponse -> Bool
(GetTrafficPolicyInstanceCountResponse
 -> GetTrafficPolicyInstanceCountResponse -> Bool)
-> (GetTrafficPolicyInstanceCountResponse
    -> GetTrafficPolicyInstanceCountResponse -> Bool)
-> Eq GetTrafficPolicyInstanceCountResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetTrafficPolicyInstanceCountResponse
-> GetTrafficPolicyInstanceCountResponse -> Bool
$c/= :: GetTrafficPolicyInstanceCountResponse
-> GetTrafficPolicyInstanceCountResponse -> Bool
== :: GetTrafficPolicyInstanceCountResponse
-> GetTrafficPolicyInstanceCountResponse -> Bool
$c== :: GetTrafficPolicyInstanceCountResponse
-> GetTrafficPolicyInstanceCountResponse -> Bool
Prelude.Eq, ReadPrec [GetTrafficPolicyInstanceCountResponse]
ReadPrec GetTrafficPolicyInstanceCountResponse
Int -> ReadS GetTrafficPolicyInstanceCountResponse
ReadS [GetTrafficPolicyInstanceCountResponse]
(Int -> ReadS GetTrafficPolicyInstanceCountResponse)
-> ReadS [GetTrafficPolicyInstanceCountResponse]
-> ReadPrec GetTrafficPolicyInstanceCountResponse
-> ReadPrec [GetTrafficPolicyInstanceCountResponse]
-> Read GetTrafficPolicyInstanceCountResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetTrafficPolicyInstanceCountResponse]
$creadListPrec :: ReadPrec [GetTrafficPolicyInstanceCountResponse]
readPrec :: ReadPrec GetTrafficPolicyInstanceCountResponse
$creadPrec :: ReadPrec GetTrafficPolicyInstanceCountResponse
readList :: ReadS [GetTrafficPolicyInstanceCountResponse]
$creadList :: ReadS [GetTrafficPolicyInstanceCountResponse]
readsPrec :: Int -> ReadS GetTrafficPolicyInstanceCountResponse
$creadsPrec :: Int -> ReadS GetTrafficPolicyInstanceCountResponse
Prelude.Read, Int -> GetTrafficPolicyInstanceCountResponse -> ShowS
[GetTrafficPolicyInstanceCountResponse] -> ShowS
GetTrafficPolicyInstanceCountResponse -> String
(Int -> GetTrafficPolicyInstanceCountResponse -> ShowS)
-> (GetTrafficPolicyInstanceCountResponse -> String)
-> ([GetTrafficPolicyInstanceCountResponse] -> ShowS)
-> Show GetTrafficPolicyInstanceCountResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetTrafficPolicyInstanceCountResponse] -> ShowS
$cshowList :: [GetTrafficPolicyInstanceCountResponse] -> ShowS
show :: GetTrafficPolicyInstanceCountResponse -> String
$cshow :: GetTrafficPolicyInstanceCountResponse -> String
showsPrec :: Int -> GetTrafficPolicyInstanceCountResponse -> ShowS
$cshowsPrec :: Int -> GetTrafficPolicyInstanceCountResponse -> ShowS
Prelude.Show, (forall x.
 GetTrafficPolicyInstanceCountResponse
 -> Rep GetTrafficPolicyInstanceCountResponse x)
-> (forall x.
    Rep GetTrafficPolicyInstanceCountResponse x
    -> GetTrafficPolicyInstanceCountResponse)
-> Generic GetTrafficPolicyInstanceCountResponse
forall x.
Rep GetTrafficPolicyInstanceCountResponse x
-> GetTrafficPolicyInstanceCountResponse
forall x.
GetTrafficPolicyInstanceCountResponse
-> Rep GetTrafficPolicyInstanceCountResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetTrafficPolicyInstanceCountResponse x
-> GetTrafficPolicyInstanceCountResponse
$cfrom :: forall x.
GetTrafficPolicyInstanceCountResponse
-> Rep GetTrafficPolicyInstanceCountResponse x
Prelude.Generic)

-- |
-- Create a value of 'GetTrafficPolicyInstanceCountResponse' 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', 'getTrafficPolicyInstanceCountResponse_httpStatus' - The response's http status code.
--
-- 'trafficPolicyInstanceCount', 'getTrafficPolicyInstanceCountResponse_trafficPolicyInstanceCount' - The number of traffic policy instances that are associated with the
-- current Amazon Web Services account.
newGetTrafficPolicyInstanceCountResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  -- | 'trafficPolicyInstanceCount'
  Prelude.Int ->
  GetTrafficPolicyInstanceCountResponse
newGetTrafficPolicyInstanceCountResponse :: Int -> Int -> GetTrafficPolicyInstanceCountResponse
newGetTrafficPolicyInstanceCountResponse
  Int
pHttpStatus_
  Int
pTrafficPolicyInstanceCount_ =
    GetTrafficPolicyInstanceCountResponse' :: Int -> Int -> GetTrafficPolicyInstanceCountResponse
GetTrafficPolicyInstanceCountResponse'
      { $sel:httpStatus:GetTrafficPolicyInstanceCountResponse' :: Int
httpStatus =
          Int
pHttpStatus_,
        $sel:trafficPolicyInstanceCount:GetTrafficPolicyInstanceCountResponse' :: Int
trafficPolicyInstanceCount =
          Int
pTrafficPolicyInstanceCount_
      }

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

-- | The number of traffic policy instances that are associated with the
-- current Amazon Web Services account.
getTrafficPolicyInstanceCountResponse_trafficPolicyInstanceCount :: Lens.Lens' GetTrafficPolicyInstanceCountResponse Prelude.Int
getTrafficPolicyInstanceCountResponse_trafficPolicyInstanceCount :: (Int -> f Int)
-> GetTrafficPolicyInstanceCountResponse
-> f GetTrafficPolicyInstanceCountResponse
getTrafficPolicyInstanceCountResponse_trafficPolicyInstanceCount = (GetTrafficPolicyInstanceCountResponse -> Int)
-> (GetTrafficPolicyInstanceCountResponse
    -> Int -> GetTrafficPolicyInstanceCountResponse)
-> Lens
     GetTrafficPolicyInstanceCountResponse
     GetTrafficPolicyInstanceCountResponse
     Int
     Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetTrafficPolicyInstanceCountResponse' {Int
trafficPolicyInstanceCount :: Int
$sel:trafficPolicyInstanceCount:GetTrafficPolicyInstanceCountResponse' :: GetTrafficPolicyInstanceCountResponse -> Int
trafficPolicyInstanceCount} -> Int
trafficPolicyInstanceCount) (\s :: GetTrafficPolicyInstanceCountResponse
s@GetTrafficPolicyInstanceCountResponse' {} Int
a -> GetTrafficPolicyInstanceCountResponse
s {$sel:trafficPolicyInstanceCount:GetTrafficPolicyInstanceCountResponse' :: Int
trafficPolicyInstanceCount = Int
a} :: GetTrafficPolicyInstanceCountResponse)

instance
  Prelude.NFData
    GetTrafficPolicyInstanceCountResponse