{-# 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.DeleteTagOption
-- 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)
--
-- Deletes the specified TagOption.
--
-- You cannot delete a TagOption if it is associated with a product or
-- portfolio.
module Amazonka.ServiceCatalog.DeleteTagOption
  ( -- * Creating a Request
    DeleteTagOption (..),
    newDeleteTagOption,

    -- * Request Lenses
    deleteTagOption_id,

    -- * Destructuring the Response
    DeleteTagOptionResponse (..),
    newDeleteTagOptionResponse,

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

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

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

instance Core.AWSRequest DeleteTagOption where
  type
    AWSResponse DeleteTagOption =
      DeleteTagOptionResponse
  request :: DeleteTagOption -> Request DeleteTagOption
request = Service -> DeleteTagOption -> Request DeleteTagOption
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy DeleteTagOption
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteTagOption)))
response =
    (Int
 -> ResponseHeaders
 -> ()
 -> Either String (AWSResponse DeleteTagOption))
-> Logger
-> Service
-> Proxy DeleteTagOption
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteTagOption)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
      ( \Int
s ResponseHeaders
h ()
x ->
          Int -> DeleteTagOptionResponse
DeleteTagOptionResponse'
            (Int -> DeleteTagOptionResponse)
-> Either String Int -> Either String DeleteTagOptionResponse
forall (f :: * -> *) a b. Functor 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 DeleteTagOption

instance Prelude.NFData DeleteTagOption

instance Core.ToHeaders DeleteTagOption where
  toHeaders :: DeleteTagOption -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DeleteTagOption -> 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.DeleteTagOption" ::
                          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 DeleteTagOption where
  toJSON :: DeleteTagOption -> Value
toJSON DeleteTagOption' {Text
id :: Text
$sel:id:DeleteTagOption' :: DeleteTagOption -> 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 DeleteTagOption where
  toPath :: DeleteTagOption -> ByteString
toPath = ByteString -> DeleteTagOption -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

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

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

-- |
-- Create a value of 'DeleteTagOptionResponse' 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:
--
-- 'httpStatus', 'deleteTagOptionResponse_httpStatus' - The response's http status code.
newDeleteTagOptionResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DeleteTagOptionResponse
newDeleteTagOptionResponse :: Int -> DeleteTagOptionResponse
newDeleteTagOptionResponse Int
pHttpStatus_ =
  DeleteTagOptionResponse' :: Int -> DeleteTagOptionResponse
DeleteTagOptionResponse' {$sel:httpStatus:DeleteTagOptionResponse' :: Int
httpStatus = Int
pHttpStatus_}

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

instance Prelude.NFData DeleteTagOptionResponse