{-# 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-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 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.Lens as Lens
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
(GetAssociationForServiceQuotaTemplate
 -> GetAssociationForServiceQuotaTemplate -> Bool)
-> (GetAssociationForServiceQuotaTemplate
    -> GetAssociationForServiceQuotaTemplate -> Bool)
-> Eq GetAssociationForServiceQuotaTemplate
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]
(Int -> ReadS GetAssociationForServiceQuotaTemplate)
-> ReadS [GetAssociationForServiceQuotaTemplate]
-> ReadPrec GetAssociationForServiceQuotaTemplate
-> ReadPrec [GetAssociationForServiceQuotaTemplate]
-> Read 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
(Int -> GetAssociationForServiceQuotaTemplate -> ShowS)
-> (GetAssociationForServiceQuotaTemplate -> String)
-> ([GetAssociationForServiceQuotaTemplate] -> ShowS)
-> Show GetAssociationForServiceQuotaTemplate
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.
 GetAssociationForServiceQuotaTemplate
 -> Rep GetAssociationForServiceQuotaTemplate x)
-> (forall x.
    Rep GetAssociationForServiceQuotaTemplate x
    -> GetAssociationForServiceQuotaTemplate)
-> Generic GetAssociationForServiceQuotaTemplate
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 :: GetAssociationForServiceQuotaTemplate
-> Request GetAssociationForServiceQuotaTemplate
request = Service
-> GetAssociationForServiceQuotaTemplate
-> Request GetAssociationForServiceQuotaTemplate
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy GetAssociationForServiceQuotaTemplate
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse
           (AWSResponse GetAssociationForServiceQuotaTemplate)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either
      String (AWSResponse GetAssociationForServiceQuotaTemplate))
-> Logger
-> Service
-> Proxy GetAssociationForServiceQuotaTemplate
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse
           (AWSResponse GetAssociationForServiceQuotaTemplate)))
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 ServiceQuotaTemplateAssociationStatus
-> Int -> GetAssociationForServiceQuotaTemplateResponse
GetAssociationForServiceQuotaTemplateResponse'
            (Maybe ServiceQuotaTemplateAssociationStatus
 -> Int -> GetAssociationForServiceQuotaTemplateResponse)
-> Either String (Maybe ServiceQuotaTemplateAssociationStatus)
-> Either
     String (Int -> GetAssociationForServiceQuotaTemplateResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object
-> Key
-> Either String (Maybe ServiceQuotaTemplateAssociationStatus)
forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Core..?> Key
"ServiceQuotaTemplateAssociationStatus")
              Either
  String (Int -> GetAssociationForServiceQuotaTemplateResponse)
-> Either String Int
-> Either String GetAssociationForServiceQuotaTemplateResponse
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
    GetAssociationForServiceQuotaTemplate

instance
  Prelude.NFData
    GetAssociationForServiceQuotaTemplate

instance
  Core.ToHeaders
    GetAssociationForServiceQuotaTemplate
  where
  toHeaders :: GetAssociationForServiceQuotaTemplate -> ResponseHeaders
toHeaders =
    ResponseHeaders
-> GetAssociationForServiceQuotaTemplate -> 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
"ServiceQuotasV20190624.GetAssociationForServiceQuotaTemplate" ::
                          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
    GetAssociationForServiceQuotaTemplate
  where
  toJSON :: GetAssociationForServiceQuotaTemplate -> Value
toJSON = Value -> GetAssociationForServiceQuotaTemplate -> Value
forall a b. a -> b -> a
Prelude.const (Object -> Value
Core.Object Object
forall a. Monoid a => a
Prelude.mempty)

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

instance
  Core.ToQuery
    GetAssociationForServiceQuotaTemplate
  where
  toQuery :: GetAssociationForServiceQuotaTemplate -> QueryString
toQuery = QueryString -> GetAssociationForServiceQuotaTemplate -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
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
(GetAssociationForServiceQuotaTemplateResponse
 -> GetAssociationForServiceQuotaTemplateResponse -> Bool)
-> (GetAssociationForServiceQuotaTemplateResponse
    -> GetAssociationForServiceQuotaTemplateResponse -> Bool)
-> Eq GetAssociationForServiceQuotaTemplateResponse
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]
(Int -> ReadS GetAssociationForServiceQuotaTemplateResponse)
-> ReadS [GetAssociationForServiceQuotaTemplateResponse]
-> ReadPrec GetAssociationForServiceQuotaTemplateResponse
-> ReadPrec [GetAssociationForServiceQuotaTemplateResponse]
-> Read 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
(Int -> GetAssociationForServiceQuotaTemplateResponse -> ShowS)
-> (GetAssociationForServiceQuotaTemplateResponse -> String)
-> ([GetAssociationForServiceQuotaTemplateResponse] -> ShowS)
-> Show GetAssociationForServiceQuotaTemplateResponse
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.
 GetAssociationForServiceQuotaTemplateResponse
 -> Rep GetAssociationForServiceQuotaTemplateResponse x)
-> (forall x.
    Rep GetAssociationForServiceQuotaTemplateResponse x
    -> GetAssociationForServiceQuotaTemplateResponse)
-> Generic GetAssociationForServiceQuotaTemplateResponse
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' :: Maybe ServiceQuotaTemplateAssociationStatus
-> Int -> GetAssociationForServiceQuotaTemplateResponse
GetAssociationForServiceQuotaTemplateResponse'
      { $sel:serviceQuotaTemplateAssociationStatus:GetAssociationForServiceQuotaTemplateResponse' :: Maybe ServiceQuotaTemplateAssociationStatus
serviceQuotaTemplateAssociationStatus =
          Maybe 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 :: (Maybe ServiceQuotaTemplateAssociationStatus
 -> f (Maybe ServiceQuotaTemplateAssociationStatus))
-> GetAssociationForServiceQuotaTemplateResponse
-> f GetAssociationForServiceQuotaTemplateResponse
getAssociationForServiceQuotaTemplateResponse_serviceQuotaTemplateAssociationStatus = (GetAssociationForServiceQuotaTemplateResponse
 -> Maybe ServiceQuotaTemplateAssociationStatus)
-> (GetAssociationForServiceQuotaTemplateResponse
    -> Maybe ServiceQuotaTemplateAssociationStatus
    -> GetAssociationForServiceQuotaTemplateResponse)
-> Lens
     GetAssociationForServiceQuotaTemplateResponse
     GetAssociationForServiceQuotaTemplateResponse
     (Maybe ServiceQuotaTemplateAssociationStatus)
     (Maybe 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 :: (Int -> f Int)
-> GetAssociationForServiceQuotaTemplateResponse
-> f GetAssociationForServiceQuotaTemplateResponse
getAssociationForServiceQuotaTemplateResponse_httpStatus = (GetAssociationForServiceQuotaTemplateResponse -> Int)
-> (GetAssociationForServiceQuotaTemplateResponse
    -> Int -> GetAssociationForServiceQuotaTemplateResponse)
-> Lens
     GetAssociationForServiceQuotaTemplateResponse
     GetAssociationForServiceQuotaTemplateResponse
     Int
     Int
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