{-# 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.ServiceQuotas.GetAssociationForServiceQuotaTemplate
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Retrieves the status of the association for the quota request template.
module Amazonka.ServiceQuotas.GetAssociationForServiceQuotaTemplate
  ( -- * Creating a Request
    GetAssociationForServiceQuotaTemplate (..),
    newGetAssociationForServiceQuotaTemplate,

    -- * Destructuring the Response
    GetAssociationForServiceQuotaTemplateResponse (..),
    newGetAssociationForServiceQuotaTemplateResponse,

    -- * Response Lenses
    getAssociationForServiceQuotaTemplateResponse_serviceQuotaTemplateAssociationStatus,
    getAssociationForServiceQuotaTemplateResponse_httpStatus,
  )
where

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

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

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

instance
  Core.AWSRequest
    GetAssociationForServiceQuotaTemplate
  where
  type
    AWSResponse
      GetAssociationForServiceQuotaTemplate =
      GetAssociationForServiceQuotaTemplateResponse
  request :: (Service -> Service)
-> GetAssociationForServiceQuotaTemplate
-> Request GetAssociationForServiceQuotaTemplate
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy GetAssociationForServiceQuotaTemplate
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse
           (AWSResponse GetAssociationForServiceQuotaTemplate)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe ServiceQuotaTemplateAssociationStatus
-> Int -> GetAssociationForServiceQuotaTemplateResponse
GetAssociationForServiceQuotaTemplateResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"ServiceQuotaTemplateAssociationStatus")
            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
    GetAssociationForServiceQuotaTemplate
  where
  hashWithSalt :: Int -> GetAssociationForServiceQuotaTemplate -> Int
hashWithSalt Int
_salt GetAssociationForServiceQuotaTemplate
_ =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` ()

instance
  Prelude.NFData
    GetAssociationForServiceQuotaTemplate
  where
  rnf :: GetAssociationForServiceQuotaTemplate -> ()
rnf GetAssociationForServiceQuotaTemplate
_ = ()

instance
  Data.ToHeaders
    GetAssociationForServiceQuotaTemplate
  where
  toHeaders :: GetAssociationForServiceQuotaTemplate -> ResponseHeaders
toHeaders =
    forall a b. a -> b -> a
Prelude.const
      ( forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"ServiceQuotasV20190624.GetAssociationForServiceQuotaTemplate" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance
  Data.ToJSON
    GetAssociationForServiceQuotaTemplate
  where
  toJSON :: GetAssociationForServiceQuotaTemplate -> Value
toJSON = forall a b. a -> b -> a
Prelude.const (Object -> Value
Data.Object forall a. Monoid a => a
Prelude.mempty)

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

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

-- | /See:/ 'newGetAssociationForServiceQuotaTemplateResponse' smart constructor.
data GetAssociationForServiceQuotaTemplateResponse = GetAssociationForServiceQuotaTemplateResponse'
  { -- | The association status. If the status is @ASSOCIATED@, the quota
    -- increase requests in the template are automatically applied to new
    -- accounts in your organization.
    GetAssociationForServiceQuotaTemplateResponse
-> Maybe ServiceQuotaTemplateAssociationStatus
serviceQuotaTemplateAssociationStatus :: Prelude.Maybe ServiceQuotaTemplateAssociationStatus,
    -- | The response's http status code.
    GetAssociationForServiceQuotaTemplateResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (GetAssociationForServiceQuotaTemplateResponse
-> GetAssociationForServiceQuotaTemplateResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetAssociationForServiceQuotaTemplateResponse
-> GetAssociationForServiceQuotaTemplateResponse -> Bool
$c/= :: GetAssociationForServiceQuotaTemplateResponse
-> GetAssociationForServiceQuotaTemplateResponse -> Bool
== :: GetAssociationForServiceQuotaTemplateResponse
-> GetAssociationForServiceQuotaTemplateResponse -> Bool
$c== :: GetAssociationForServiceQuotaTemplateResponse
-> GetAssociationForServiceQuotaTemplateResponse -> Bool
Prelude.Eq, ReadPrec [GetAssociationForServiceQuotaTemplateResponse]
ReadPrec GetAssociationForServiceQuotaTemplateResponse
Int -> ReadS GetAssociationForServiceQuotaTemplateResponse
ReadS [GetAssociationForServiceQuotaTemplateResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetAssociationForServiceQuotaTemplateResponse]
$creadListPrec :: ReadPrec [GetAssociationForServiceQuotaTemplateResponse]
readPrec :: ReadPrec GetAssociationForServiceQuotaTemplateResponse
$creadPrec :: ReadPrec GetAssociationForServiceQuotaTemplateResponse
readList :: ReadS [GetAssociationForServiceQuotaTemplateResponse]
$creadList :: ReadS [GetAssociationForServiceQuotaTemplateResponse]
readsPrec :: Int -> ReadS GetAssociationForServiceQuotaTemplateResponse
$creadsPrec :: Int -> ReadS GetAssociationForServiceQuotaTemplateResponse
Prelude.Read, Int -> GetAssociationForServiceQuotaTemplateResponse -> ShowS
[GetAssociationForServiceQuotaTemplateResponse] -> ShowS
GetAssociationForServiceQuotaTemplateResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetAssociationForServiceQuotaTemplateResponse] -> ShowS
$cshowList :: [GetAssociationForServiceQuotaTemplateResponse] -> ShowS
show :: GetAssociationForServiceQuotaTemplateResponse -> String
$cshow :: GetAssociationForServiceQuotaTemplateResponse -> String
showsPrec :: Int -> GetAssociationForServiceQuotaTemplateResponse -> ShowS
$cshowsPrec :: Int -> GetAssociationForServiceQuotaTemplateResponse -> ShowS
Prelude.Show, forall x.
Rep GetAssociationForServiceQuotaTemplateResponse x
-> GetAssociationForServiceQuotaTemplateResponse
forall x.
GetAssociationForServiceQuotaTemplateResponse
-> Rep GetAssociationForServiceQuotaTemplateResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetAssociationForServiceQuotaTemplateResponse x
-> GetAssociationForServiceQuotaTemplateResponse
$cfrom :: forall x.
GetAssociationForServiceQuotaTemplateResponse
-> Rep GetAssociationForServiceQuotaTemplateResponse x
Prelude.Generic)

-- |
-- Create a value of 'GetAssociationForServiceQuotaTemplateResponse' 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:
--
-- 'serviceQuotaTemplateAssociationStatus', 'getAssociationForServiceQuotaTemplateResponse_serviceQuotaTemplateAssociationStatus' - The association status. If the status is @ASSOCIATED@, the quota
-- increase requests in the template are automatically applied to new
-- accounts in your organization.
--
-- 'httpStatus', 'getAssociationForServiceQuotaTemplateResponse_httpStatus' - The response's http status code.
newGetAssociationForServiceQuotaTemplateResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetAssociationForServiceQuotaTemplateResponse
newGetAssociationForServiceQuotaTemplateResponse :: Int -> GetAssociationForServiceQuotaTemplateResponse
newGetAssociationForServiceQuotaTemplateResponse
  Int
pHttpStatus_ =
    GetAssociationForServiceQuotaTemplateResponse'
      { $sel:serviceQuotaTemplateAssociationStatus:GetAssociationForServiceQuotaTemplateResponse' :: Maybe ServiceQuotaTemplateAssociationStatus
serviceQuotaTemplateAssociationStatus =
          forall a. Maybe a
Prelude.Nothing,
        $sel:httpStatus:GetAssociationForServiceQuotaTemplateResponse' :: Int
httpStatus = Int
pHttpStatus_
      }

-- | The association status. If the status is @ASSOCIATED@, the quota
-- increase requests in the template are automatically applied to new
-- accounts in your organization.
getAssociationForServiceQuotaTemplateResponse_serviceQuotaTemplateAssociationStatus :: Lens.Lens' GetAssociationForServiceQuotaTemplateResponse (Prelude.Maybe ServiceQuotaTemplateAssociationStatus)
getAssociationForServiceQuotaTemplateResponse_serviceQuotaTemplateAssociationStatus :: Lens'
  GetAssociationForServiceQuotaTemplateResponse
  (Maybe ServiceQuotaTemplateAssociationStatus)
getAssociationForServiceQuotaTemplateResponse_serviceQuotaTemplateAssociationStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetAssociationForServiceQuotaTemplateResponse' {Maybe ServiceQuotaTemplateAssociationStatus
serviceQuotaTemplateAssociationStatus :: Maybe ServiceQuotaTemplateAssociationStatus
$sel:serviceQuotaTemplateAssociationStatus:GetAssociationForServiceQuotaTemplateResponse' :: GetAssociationForServiceQuotaTemplateResponse
-> Maybe ServiceQuotaTemplateAssociationStatus
serviceQuotaTemplateAssociationStatus} -> Maybe ServiceQuotaTemplateAssociationStatus
serviceQuotaTemplateAssociationStatus) (\s :: GetAssociationForServiceQuotaTemplateResponse
s@GetAssociationForServiceQuotaTemplateResponse' {} Maybe ServiceQuotaTemplateAssociationStatus
a -> GetAssociationForServiceQuotaTemplateResponse
s {$sel:serviceQuotaTemplateAssociationStatus:GetAssociationForServiceQuotaTemplateResponse' :: Maybe ServiceQuotaTemplateAssociationStatus
serviceQuotaTemplateAssociationStatus = Maybe ServiceQuotaTemplateAssociationStatus
a} :: GetAssociationForServiceQuotaTemplateResponse)

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

instance
  Prelude.NFData
    GetAssociationForServiceQuotaTemplateResponse
  where
  rnf :: GetAssociationForServiceQuotaTemplateResponse -> ()
rnf
    GetAssociationForServiceQuotaTemplateResponse' {Int
Maybe ServiceQuotaTemplateAssociationStatus
httpStatus :: Int
serviceQuotaTemplateAssociationStatus :: Maybe ServiceQuotaTemplateAssociationStatus
$sel:httpStatus:GetAssociationForServiceQuotaTemplateResponse' :: GetAssociationForServiceQuotaTemplateResponse -> Int
$sel:serviceQuotaTemplateAssociationStatus:GetAssociationForServiceQuotaTemplateResponse' :: GetAssociationForServiceQuotaTemplateResponse
-> Maybe ServiceQuotaTemplateAssociationStatus
..} =
      forall a. NFData a => a -> ()
Prelude.rnf Maybe ServiceQuotaTemplateAssociationStatus
serviceQuotaTemplateAssociationStatus
        seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus