{-# 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.DisassociateTagOptionFromResource
-- 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)
--
-- Disassociates the specified TagOption from the specified resource.
module Amazonka.ServiceCatalog.DisassociateTagOptionFromResource
  ( -- * Creating a Request
    DisassociateTagOptionFromResource (..),
    newDisassociateTagOptionFromResource,

    -- * Request Lenses
    disassociateTagOptionFromResource_resourceId,
    disassociateTagOptionFromResource_tagOptionId,

    -- * Destructuring the Response
    DisassociateTagOptionFromResourceResponse (..),
    newDisassociateTagOptionFromResourceResponse,

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

-- |
-- Create a value of 'DisassociateTagOptionFromResource' 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:
--
-- 'resourceId', 'disassociateTagOptionFromResource_resourceId' - The resource identifier.
--
-- 'tagOptionId', 'disassociateTagOptionFromResource_tagOptionId' - The TagOption identifier.
newDisassociateTagOptionFromResource ::
  -- | 'resourceId'
  Prelude.Text ->
  -- | 'tagOptionId'
  Prelude.Text ->
  DisassociateTagOptionFromResource
newDisassociateTagOptionFromResource :: Text -> Text -> DisassociateTagOptionFromResource
newDisassociateTagOptionFromResource
  Text
pResourceId_
  Text
pTagOptionId_ =
    DisassociateTagOptionFromResource' :: Text -> Text -> DisassociateTagOptionFromResource
DisassociateTagOptionFromResource'
      { $sel:resourceId:DisassociateTagOptionFromResource' :: Text
resourceId =
          Text
pResourceId_,
        $sel:tagOptionId:DisassociateTagOptionFromResource' :: Text
tagOptionId = Text
pTagOptionId_
      }

-- | The resource identifier.
disassociateTagOptionFromResource_resourceId :: Lens.Lens' DisassociateTagOptionFromResource Prelude.Text
disassociateTagOptionFromResource_resourceId :: (Text -> f Text)
-> DisassociateTagOptionFromResource
-> f DisassociateTagOptionFromResource
disassociateTagOptionFromResource_resourceId = (DisassociateTagOptionFromResource -> Text)
-> (DisassociateTagOptionFromResource
    -> Text -> DisassociateTagOptionFromResource)
-> Lens
     DisassociateTagOptionFromResource
     DisassociateTagOptionFromResource
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DisassociateTagOptionFromResource' {Text
resourceId :: Text
$sel:resourceId:DisassociateTagOptionFromResource' :: DisassociateTagOptionFromResource -> Text
resourceId} -> Text
resourceId) (\s :: DisassociateTagOptionFromResource
s@DisassociateTagOptionFromResource' {} Text
a -> DisassociateTagOptionFromResource
s {$sel:resourceId:DisassociateTagOptionFromResource' :: Text
resourceId = Text
a} :: DisassociateTagOptionFromResource)

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

instance
  Core.AWSRequest
    DisassociateTagOptionFromResource
  where
  type
    AWSResponse DisassociateTagOptionFromResource =
      DisassociateTagOptionFromResourceResponse
  request :: DisassociateTagOptionFromResource
-> Request DisassociateTagOptionFromResource
request = Service
-> DisassociateTagOptionFromResource
-> Request DisassociateTagOptionFromResource
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy DisassociateTagOptionFromResource
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse (AWSResponse DisassociateTagOptionFromResource)))
response =
    (Int
 -> ResponseHeaders
 -> ()
 -> Either String (AWSResponse DisassociateTagOptionFromResource))
-> Logger
-> Service
-> Proxy DisassociateTagOptionFromResource
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse (AWSResponse DisassociateTagOptionFromResource)))
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 -> DisassociateTagOptionFromResourceResponse
DisassociateTagOptionFromResourceResponse'
            (Int -> DisassociateTagOptionFromResourceResponse)
-> Either String Int
-> Either String DisassociateTagOptionFromResourceResponse
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
    DisassociateTagOptionFromResource

instance
  Prelude.NFData
    DisassociateTagOptionFromResource

instance
  Core.ToHeaders
    DisassociateTagOptionFromResource
  where
  toHeaders :: DisassociateTagOptionFromResource -> ResponseHeaders
toHeaders =
    ResponseHeaders
-> DisassociateTagOptionFromResource -> 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.DisassociateTagOptionFromResource" ::
                          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
    DisassociateTagOptionFromResource
  where
  toJSON :: DisassociateTagOptionFromResource -> Value
toJSON DisassociateTagOptionFromResource' {Text
tagOptionId :: Text
resourceId :: Text
$sel:tagOptionId:DisassociateTagOptionFromResource' :: DisassociateTagOptionFromResource -> Text
$sel:resourceId:DisassociateTagOptionFromResource' :: DisassociateTagOptionFromResource -> 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
"ResourceId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
resourceId),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"TagOptionId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
tagOptionId)
          ]
      )

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

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

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

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

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

instance
  Prelude.NFData
    DisassociateTagOptionFromResourceResponse