{-# 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.ServiceCatalogAppRegistry.GetConfiguration
-- 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 a @TagKey@ configuration from an account.
module Amazonka.ServiceCatalogAppRegistry.GetConfiguration
  ( -- * Creating a Request
    GetConfiguration (..),
    newGetConfiguration,

    -- * Destructuring the Response
    GetConfigurationResponse (..),
    newGetConfigurationResponse,

    -- * Response Lenses
    getConfigurationResponse_configuration,
    getConfigurationResponse_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.ServiceCatalogAppRegistry.Types

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

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

instance Core.AWSRequest GetConfiguration where
  type
    AWSResponse GetConfiguration =
      GetConfigurationResponse
  request :: (Service -> Service)
-> GetConfiguration -> Request GetConfiguration
request Service -> Service
overrides =
    forall a. ToRequest a => Service -> a -> Request a
Request.get (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy GetConfiguration
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetConfiguration)))
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 AppRegistryConfiguration -> Int -> GetConfigurationResponse
GetConfigurationResponse'
            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
"configuration")
            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 GetConfiguration where
  hashWithSalt :: Int -> GetConfiguration -> Int
hashWithSalt Int
_salt GetConfiguration
_ =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` ()

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

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

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

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

-- | /See:/ 'newGetConfigurationResponse' smart constructor.
data GetConfigurationResponse = GetConfigurationResponse'
  { -- | Retrieves @TagKey@ configuration from an account.
    GetConfigurationResponse -> Maybe AppRegistryConfiguration
configuration :: Prelude.Maybe AppRegistryConfiguration,
    -- | The response's http status code.
    GetConfigurationResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (GetConfigurationResponse -> GetConfigurationResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetConfigurationResponse -> GetConfigurationResponse -> Bool
$c/= :: GetConfigurationResponse -> GetConfigurationResponse -> Bool
== :: GetConfigurationResponse -> GetConfigurationResponse -> Bool
$c== :: GetConfigurationResponse -> GetConfigurationResponse -> Bool
Prelude.Eq, ReadPrec [GetConfigurationResponse]
ReadPrec GetConfigurationResponse
Int -> ReadS GetConfigurationResponse
ReadS [GetConfigurationResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetConfigurationResponse]
$creadListPrec :: ReadPrec [GetConfigurationResponse]
readPrec :: ReadPrec GetConfigurationResponse
$creadPrec :: ReadPrec GetConfigurationResponse
readList :: ReadS [GetConfigurationResponse]
$creadList :: ReadS [GetConfigurationResponse]
readsPrec :: Int -> ReadS GetConfigurationResponse
$creadsPrec :: Int -> ReadS GetConfigurationResponse
Prelude.Read, Int -> GetConfigurationResponse -> ShowS
[GetConfigurationResponse] -> ShowS
GetConfigurationResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetConfigurationResponse] -> ShowS
$cshowList :: [GetConfigurationResponse] -> ShowS
show :: GetConfigurationResponse -> String
$cshow :: GetConfigurationResponse -> String
showsPrec :: Int -> GetConfigurationResponse -> ShowS
$cshowsPrec :: Int -> GetConfigurationResponse -> ShowS
Prelude.Show, forall x.
Rep GetConfigurationResponse x -> GetConfigurationResponse
forall x.
GetConfigurationResponse -> Rep GetConfigurationResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetConfigurationResponse x -> GetConfigurationResponse
$cfrom :: forall x.
GetConfigurationResponse -> Rep GetConfigurationResponse x
Prelude.Generic)

-- |
-- Create a value of 'GetConfigurationResponse' 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:
--
-- 'configuration', 'getConfigurationResponse_configuration' - Retrieves @TagKey@ configuration from an account.
--
-- 'httpStatus', 'getConfigurationResponse_httpStatus' - The response's http status code.
newGetConfigurationResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetConfigurationResponse
newGetConfigurationResponse :: Int -> GetConfigurationResponse
newGetConfigurationResponse Int
pHttpStatus_ =
  GetConfigurationResponse'
    { $sel:configuration:GetConfigurationResponse' :: Maybe AppRegistryConfiguration
configuration =
        forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:GetConfigurationResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | Retrieves @TagKey@ configuration from an account.
getConfigurationResponse_configuration :: Lens.Lens' GetConfigurationResponse (Prelude.Maybe AppRegistryConfiguration)
getConfigurationResponse_configuration :: Lens' GetConfigurationResponse (Maybe AppRegistryConfiguration)
getConfigurationResponse_configuration = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetConfigurationResponse' {Maybe AppRegistryConfiguration
configuration :: Maybe AppRegistryConfiguration
$sel:configuration:GetConfigurationResponse' :: GetConfigurationResponse -> Maybe AppRegistryConfiguration
configuration} -> Maybe AppRegistryConfiguration
configuration) (\s :: GetConfigurationResponse
s@GetConfigurationResponse' {} Maybe AppRegistryConfiguration
a -> GetConfigurationResponse
s {$sel:configuration:GetConfigurationResponse' :: Maybe AppRegistryConfiguration
configuration = Maybe AppRegistryConfiguration
a} :: GetConfigurationResponse)

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

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