{-# 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.ServiceCatalog.DescribeTagOption
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Gets information about the specified TagOption.
module Amazonka.ServiceCatalog.DescribeTagOption
  ( -- * Creating a Request
    DescribeTagOption (..),
    newDescribeTagOption,

    -- * Request Lenses
    describeTagOption_id,

    -- * Destructuring the Response
    DescribeTagOptionResponse (..),
    newDescribeTagOptionResponse,

    -- * Response Lenses
    describeTagOptionResponse_tagOptionDetail,
    describeTagOptionResponse_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.ServiceCatalog.Types

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

-- |
-- Create a value of 'DescribeTagOption' 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:
--
-- 'id', 'describeTagOption_id' - The TagOption identifier.
newDescribeTagOption ::
  -- | 'id'
  Prelude.Text ->
  DescribeTagOption
newDescribeTagOption :: Text -> DescribeTagOption
newDescribeTagOption Text
pId_ =
  DescribeTagOption' {$sel:id:DescribeTagOption' :: Text
id = Text
pId_}

-- | The TagOption identifier.
describeTagOption_id :: Lens.Lens' DescribeTagOption Prelude.Text
describeTagOption_id :: Lens' DescribeTagOption Text
describeTagOption_id = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeTagOption' {Text
id :: Text
$sel:id:DescribeTagOption' :: DescribeTagOption -> Text
id} -> Text
id) (\s :: DescribeTagOption
s@DescribeTagOption' {} Text
a -> DescribeTagOption
s {$sel:id:DescribeTagOption' :: Text
id = Text
a} :: DescribeTagOption)

instance Core.AWSRequest DescribeTagOption where
  type
    AWSResponse DescribeTagOption =
      DescribeTagOptionResponse
  request :: (Service -> Service)
-> DescribeTagOption -> Request DescribeTagOption
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 DescribeTagOption
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeTagOption)))
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 TagOptionDetail -> Int -> DescribeTagOptionResponse
DescribeTagOptionResponse'
            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
"TagOptionDetail")
            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 DescribeTagOption where
  hashWithSalt :: Int -> DescribeTagOption -> Int
hashWithSalt Int
_salt DescribeTagOption' {Text
id :: Text
$sel:id:DescribeTagOption' :: DescribeTagOption -> Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
id

instance Prelude.NFData DescribeTagOption where
  rnf :: DescribeTagOption -> ()
rnf DescribeTagOption' {Text
id :: Text
$sel:id:DescribeTagOption' :: DescribeTagOption -> Text
..} = forall a. NFData a => a -> ()
Prelude.rnf Text
id

instance Data.ToHeaders DescribeTagOption where
  toHeaders :: DescribeTagOption -> 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
"AWS242ServiceCatalogService.DescribeTagOption" ::
                          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 DescribeTagOption where
  toJSON :: DescribeTagOption -> Value
toJSON DescribeTagOption' {Text
id :: Text
$sel:id:DescribeTagOption' :: DescribeTagOption -> Text
..} =
    [Pair] -> Value
Data.object
      (forall a. [Maybe a] -> [a]
Prelude.catMaybes [forall a. a -> Maybe a
Prelude.Just (Key
"Id" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
id)])

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

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

-- | /See:/ 'newDescribeTagOptionResponse' smart constructor.
data DescribeTagOptionResponse = DescribeTagOptionResponse'
  { -- | Information about the TagOption.
    DescribeTagOptionResponse -> Maybe TagOptionDetail
tagOptionDetail :: Prelude.Maybe TagOptionDetail,
    -- | The response's http status code.
    DescribeTagOptionResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DescribeTagOptionResponse -> DescribeTagOptionResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeTagOptionResponse -> DescribeTagOptionResponse -> Bool
$c/= :: DescribeTagOptionResponse -> DescribeTagOptionResponse -> Bool
== :: DescribeTagOptionResponse -> DescribeTagOptionResponse -> Bool
$c== :: DescribeTagOptionResponse -> DescribeTagOptionResponse -> Bool
Prelude.Eq, ReadPrec [DescribeTagOptionResponse]
ReadPrec DescribeTagOptionResponse
Int -> ReadS DescribeTagOptionResponse
ReadS [DescribeTagOptionResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeTagOptionResponse]
$creadListPrec :: ReadPrec [DescribeTagOptionResponse]
readPrec :: ReadPrec DescribeTagOptionResponse
$creadPrec :: ReadPrec DescribeTagOptionResponse
readList :: ReadS [DescribeTagOptionResponse]
$creadList :: ReadS [DescribeTagOptionResponse]
readsPrec :: Int -> ReadS DescribeTagOptionResponse
$creadsPrec :: Int -> ReadS DescribeTagOptionResponse
Prelude.Read, Int -> DescribeTagOptionResponse -> ShowS
[DescribeTagOptionResponse] -> ShowS
DescribeTagOptionResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeTagOptionResponse] -> ShowS
$cshowList :: [DescribeTagOptionResponse] -> ShowS
show :: DescribeTagOptionResponse -> String
$cshow :: DescribeTagOptionResponse -> String
showsPrec :: Int -> DescribeTagOptionResponse -> ShowS
$cshowsPrec :: Int -> DescribeTagOptionResponse -> ShowS
Prelude.Show, forall x.
Rep DescribeTagOptionResponse x -> DescribeTagOptionResponse
forall x.
DescribeTagOptionResponse -> Rep DescribeTagOptionResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeTagOptionResponse x -> DescribeTagOptionResponse
$cfrom :: forall x.
DescribeTagOptionResponse -> Rep DescribeTagOptionResponse x
Prelude.Generic)

-- |
-- Create a value of 'DescribeTagOptionResponse' 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:
--
-- 'tagOptionDetail', 'describeTagOptionResponse_tagOptionDetail' - Information about the TagOption.
--
-- 'httpStatus', 'describeTagOptionResponse_httpStatus' - The response's http status code.
newDescribeTagOptionResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeTagOptionResponse
newDescribeTagOptionResponse :: Int -> DescribeTagOptionResponse
newDescribeTagOptionResponse Int
pHttpStatus_ =
  DescribeTagOptionResponse'
    { $sel:tagOptionDetail:DescribeTagOptionResponse' :: Maybe TagOptionDetail
tagOptionDetail =
        forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DescribeTagOptionResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | Information about the TagOption.
describeTagOptionResponse_tagOptionDetail :: Lens.Lens' DescribeTagOptionResponse (Prelude.Maybe TagOptionDetail)
describeTagOptionResponse_tagOptionDetail :: Lens' DescribeTagOptionResponse (Maybe TagOptionDetail)
describeTagOptionResponse_tagOptionDetail = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeTagOptionResponse' {Maybe TagOptionDetail
tagOptionDetail :: Maybe TagOptionDetail
$sel:tagOptionDetail:DescribeTagOptionResponse' :: DescribeTagOptionResponse -> Maybe TagOptionDetail
tagOptionDetail} -> Maybe TagOptionDetail
tagOptionDetail) (\s :: DescribeTagOptionResponse
s@DescribeTagOptionResponse' {} Maybe TagOptionDetail
a -> DescribeTagOptionResponse
s {$sel:tagOptionDetail:DescribeTagOptionResponse' :: Maybe TagOptionDetail
tagOptionDetail = Maybe TagOptionDetail
a} :: DescribeTagOptionResponse)

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

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