{-# 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-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 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.Lens as Lens
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
(DescribeTagOption -> DescribeTagOption -> Bool)
-> (DescribeTagOption -> DescribeTagOption -> Bool)
-> Eq DescribeTagOption
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]
(Int -> ReadS DescribeTagOption)
-> ReadS [DescribeTagOption]
-> ReadPrec DescribeTagOption
-> ReadPrec [DescribeTagOption]
-> Read 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
(Int -> DescribeTagOption -> ShowS)
-> (DescribeTagOption -> String)
-> ([DescribeTagOption] -> ShowS)
-> Show DescribeTagOption
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. DescribeTagOption -> Rep DescribeTagOption x)
-> (forall x. Rep DescribeTagOption x -> DescribeTagOption)
-> Generic DescribeTagOption
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' :: Text -> DescribeTagOption
DescribeTagOption' {$sel:id:DescribeTagOption' :: Text
id = Text
pId_}

-- | The TagOption identifier.
describeTagOption_id :: Lens.Lens' DescribeTagOption Prelude.Text
describeTagOption_id :: (Text -> f Text) -> DescribeTagOption -> f DescribeTagOption
describeTagOption_id = (DescribeTagOption -> Text)
-> (DescribeTagOption -> Text -> DescribeTagOption)
-> Lens DescribeTagOption DescribeTagOption Text Text
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 :: DescribeTagOption -> Request DescribeTagOption
request = Service -> DescribeTagOption -> Request DescribeTagOption
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy DescribeTagOption
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeTagOption)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse DescribeTagOption))
-> Logger
-> Service
-> Proxy DescribeTagOption
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeTagOption)))
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 TagOptionDetail -> Int -> DescribeTagOptionResponse
DescribeTagOptionResponse'
            (Maybe TagOptionDetail -> Int -> DescribeTagOptionResponse)
-> Either String (Maybe TagOptionDetail)
-> Either String (Int -> DescribeTagOptionResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe TagOptionDetail)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"TagOptionDetail")
            Either String (Int -> DescribeTagOptionResponse)
-> Either String Int -> Either String DescribeTagOptionResponse
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 DescribeTagOption

instance Prelude.NFData DescribeTagOption

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

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

instance Core.ToQuery DescribeTagOption where
  toQuery :: DescribeTagOption -> QueryString
toQuery = QueryString -> DescribeTagOption -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
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
(DescribeTagOptionResponse -> DescribeTagOptionResponse -> Bool)
-> (DescribeTagOptionResponse -> DescribeTagOptionResponse -> Bool)
-> Eq DescribeTagOptionResponse
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]
(Int -> ReadS DescribeTagOptionResponse)
-> ReadS [DescribeTagOptionResponse]
-> ReadPrec DescribeTagOptionResponse
-> ReadPrec [DescribeTagOptionResponse]
-> Read 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
(Int -> DescribeTagOptionResponse -> ShowS)
-> (DescribeTagOptionResponse -> String)
-> ([DescribeTagOptionResponse] -> ShowS)
-> Show DescribeTagOptionResponse
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.
 DescribeTagOptionResponse -> Rep DescribeTagOptionResponse x)
-> (forall x.
    Rep DescribeTagOptionResponse x -> DescribeTagOptionResponse)
-> Generic DescribeTagOptionResponse
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' :: Maybe TagOptionDetail -> Int -> DescribeTagOptionResponse
DescribeTagOptionResponse'
    { $sel:tagOptionDetail:DescribeTagOptionResponse' :: Maybe TagOptionDetail
tagOptionDetail =
        Maybe 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 :: (Maybe TagOptionDetail -> f (Maybe TagOptionDetail))
-> DescribeTagOptionResponse -> f DescribeTagOptionResponse
describeTagOptionResponse_tagOptionDetail = (DescribeTagOptionResponse -> Maybe TagOptionDetail)
-> (DescribeTagOptionResponse
    -> Maybe TagOptionDetail -> DescribeTagOptionResponse)
-> Lens
     DescribeTagOptionResponse
     DescribeTagOptionResponse
     (Maybe TagOptionDetail)
     (Maybe 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 :: (Int -> f Int)
-> DescribeTagOptionResponse -> f DescribeTagOptionResponse
describeTagOptionResponse_httpStatus = (DescribeTagOptionResponse -> Int)
-> (DescribeTagOptionResponse -> Int -> DescribeTagOptionResponse)
-> Lens DescribeTagOptionResponse DescribeTagOptionResponse Int Int
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