{-# 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.DisassociateProductFromPortfolio
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Disassociates the specified product from the specified portfolio.
--
-- A delegated admin is authorized to invoke this command.
module Amazonka.ServiceCatalog.DisassociateProductFromPortfolio
  ( -- * Creating a Request
    DisassociateProductFromPortfolio (..),
    newDisassociateProductFromPortfolio,

    -- * Request Lenses
    disassociateProductFromPortfolio_acceptLanguage,
    disassociateProductFromPortfolio_productId,
    disassociateProductFromPortfolio_portfolioId,

    -- * Destructuring the Response
    DisassociateProductFromPortfolioResponse (..),
    newDisassociateProductFromPortfolioResponse,

    -- * Response Lenses
    disassociateProductFromPortfolioResponse_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:/ 'newDisassociateProductFromPortfolio' smart constructor.
data DisassociateProductFromPortfolio = DisassociateProductFromPortfolio'
  { -- | The language code.
    --
    -- -   @en@ - English (default)
    --
    -- -   @jp@ - Japanese
    --
    -- -   @zh@ - Chinese
    DisassociateProductFromPortfolio -> Maybe Text
acceptLanguage :: Prelude.Maybe Prelude.Text,
    -- | The product identifier.
    DisassociateProductFromPortfolio -> Text
productId :: Prelude.Text,
    -- | The portfolio identifier.
    DisassociateProductFromPortfolio -> Text
portfolioId :: Prelude.Text
  }
  deriving (DisassociateProductFromPortfolio
-> DisassociateProductFromPortfolio -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DisassociateProductFromPortfolio
-> DisassociateProductFromPortfolio -> Bool
$c/= :: DisassociateProductFromPortfolio
-> DisassociateProductFromPortfolio -> Bool
== :: DisassociateProductFromPortfolio
-> DisassociateProductFromPortfolio -> Bool
$c== :: DisassociateProductFromPortfolio
-> DisassociateProductFromPortfolio -> Bool
Prelude.Eq, ReadPrec [DisassociateProductFromPortfolio]
ReadPrec DisassociateProductFromPortfolio
Int -> ReadS DisassociateProductFromPortfolio
ReadS [DisassociateProductFromPortfolio]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DisassociateProductFromPortfolio]
$creadListPrec :: ReadPrec [DisassociateProductFromPortfolio]
readPrec :: ReadPrec DisassociateProductFromPortfolio
$creadPrec :: ReadPrec DisassociateProductFromPortfolio
readList :: ReadS [DisassociateProductFromPortfolio]
$creadList :: ReadS [DisassociateProductFromPortfolio]
readsPrec :: Int -> ReadS DisassociateProductFromPortfolio
$creadsPrec :: Int -> ReadS DisassociateProductFromPortfolio
Prelude.Read, Int -> DisassociateProductFromPortfolio -> ShowS
[DisassociateProductFromPortfolio] -> ShowS
DisassociateProductFromPortfolio -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DisassociateProductFromPortfolio] -> ShowS
$cshowList :: [DisassociateProductFromPortfolio] -> ShowS
show :: DisassociateProductFromPortfolio -> String
$cshow :: DisassociateProductFromPortfolio -> String
showsPrec :: Int -> DisassociateProductFromPortfolio -> ShowS
$cshowsPrec :: Int -> DisassociateProductFromPortfolio -> ShowS
Prelude.Show, forall x.
Rep DisassociateProductFromPortfolio x
-> DisassociateProductFromPortfolio
forall x.
DisassociateProductFromPortfolio
-> Rep DisassociateProductFromPortfolio x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DisassociateProductFromPortfolio x
-> DisassociateProductFromPortfolio
$cfrom :: forall x.
DisassociateProductFromPortfolio
-> Rep DisassociateProductFromPortfolio x
Prelude.Generic)

-- |
-- Create a value of 'DisassociateProductFromPortfolio' 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:
--
-- 'acceptLanguage', 'disassociateProductFromPortfolio_acceptLanguage' - The language code.
--
-- -   @en@ - English (default)
--
-- -   @jp@ - Japanese
--
-- -   @zh@ - Chinese
--
-- 'productId', 'disassociateProductFromPortfolio_productId' - The product identifier.
--
-- 'portfolioId', 'disassociateProductFromPortfolio_portfolioId' - The portfolio identifier.
newDisassociateProductFromPortfolio ::
  -- | 'productId'
  Prelude.Text ->
  -- | 'portfolioId'
  Prelude.Text ->
  DisassociateProductFromPortfolio
newDisassociateProductFromPortfolio :: Text -> Text -> DisassociateProductFromPortfolio
newDisassociateProductFromPortfolio
  Text
pProductId_
  Text
pPortfolioId_ =
    DisassociateProductFromPortfolio'
      { $sel:acceptLanguage:DisassociateProductFromPortfolio' :: Maybe Text
acceptLanguage =
          forall a. Maybe a
Prelude.Nothing,
        $sel:productId:DisassociateProductFromPortfolio' :: Text
productId = Text
pProductId_,
        $sel:portfolioId:DisassociateProductFromPortfolio' :: Text
portfolioId = Text
pPortfolioId_
      }

-- | The language code.
--
-- -   @en@ - English (default)
--
-- -   @jp@ - Japanese
--
-- -   @zh@ - Chinese
disassociateProductFromPortfolio_acceptLanguage :: Lens.Lens' DisassociateProductFromPortfolio (Prelude.Maybe Prelude.Text)
disassociateProductFromPortfolio_acceptLanguage :: Lens' DisassociateProductFromPortfolio (Maybe Text)
disassociateProductFromPortfolio_acceptLanguage = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DisassociateProductFromPortfolio' {Maybe Text
acceptLanguage :: Maybe Text
$sel:acceptLanguage:DisassociateProductFromPortfolio' :: DisassociateProductFromPortfolio -> Maybe Text
acceptLanguage} -> Maybe Text
acceptLanguage) (\s :: DisassociateProductFromPortfolio
s@DisassociateProductFromPortfolio' {} Maybe Text
a -> DisassociateProductFromPortfolio
s {$sel:acceptLanguage:DisassociateProductFromPortfolio' :: Maybe Text
acceptLanguage = Maybe Text
a} :: DisassociateProductFromPortfolio)

-- | The product identifier.
disassociateProductFromPortfolio_productId :: Lens.Lens' DisassociateProductFromPortfolio Prelude.Text
disassociateProductFromPortfolio_productId :: Lens' DisassociateProductFromPortfolio Text
disassociateProductFromPortfolio_productId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DisassociateProductFromPortfolio' {Text
productId :: Text
$sel:productId:DisassociateProductFromPortfolio' :: DisassociateProductFromPortfolio -> Text
productId} -> Text
productId) (\s :: DisassociateProductFromPortfolio
s@DisassociateProductFromPortfolio' {} Text
a -> DisassociateProductFromPortfolio
s {$sel:productId:DisassociateProductFromPortfolio' :: Text
productId = Text
a} :: DisassociateProductFromPortfolio)

-- | The portfolio identifier.
disassociateProductFromPortfolio_portfolioId :: Lens.Lens' DisassociateProductFromPortfolio Prelude.Text
disassociateProductFromPortfolio_portfolioId :: Lens' DisassociateProductFromPortfolio Text
disassociateProductFromPortfolio_portfolioId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DisassociateProductFromPortfolio' {Text
portfolioId :: Text
$sel:portfolioId:DisassociateProductFromPortfolio' :: DisassociateProductFromPortfolio -> Text
portfolioId} -> Text
portfolioId) (\s :: DisassociateProductFromPortfolio
s@DisassociateProductFromPortfolio' {} Text
a -> DisassociateProductFromPortfolio
s {$sel:portfolioId:DisassociateProductFromPortfolio' :: Text
portfolioId = Text
a} :: DisassociateProductFromPortfolio)

instance
  Core.AWSRequest
    DisassociateProductFromPortfolio
  where
  type
    AWSResponse DisassociateProductFromPortfolio =
      DisassociateProductFromPortfolioResponse
  request :: (Service -> Service)
-> DisassociateProductFromPortfolio
-> Request DisassociateProductFromPortfolio
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 DisassociateProductFromPortfolio
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse (AWSResponse DisassociateProductFromPortfolio)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
      ( \Int
s ResponseHeaders
h ()
x ->
          Int -> DisassociateProductFromPortfolioResponse
DisassociateProductFromPortfolioResponse'
            forall (f :: * -> *) a b. Functor 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
    DisassociateProductFromPortfolio
  where
  hashWithSalt :: Int -> DisassociateProductFromPortfolio -> Int
hashWithSalt
    Int
_salt
    DisassociateProductFromPortfolio' {Maybe Text
Text
portfolioId :: Text
productId :: Text
acceptLanguage :: Maybe Text
$sel:portfolioId:DisassociateProductFromPortfolio' :: DisassociateProductFromPortfolio -> Text
$sel:productId:DisassociateProductFromPortfolio' :: DisassociateProductFromPortfolio -> Text
$sel:acceptLanguage:DisassociateProductFromPortfolio' :: DisassociateProductFromPortfolio -> Maybe Text
..} =
      Int
_salt
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
acceptLanguage
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
productId
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
portfolioId

instance
  Prelude.NFData
    DisassociateProductFromPortfolio
  where
  rnf :: DisassociateProductFromPortfolio -> ()
rnf DisassociateProductFromPortfolio' {Maybe Text
Text
portfolioId :: Text
productId :: Text
acceptLanguage :: Maybe Text
$sel:portfolioId:DisassociateProductFromPortfolio' :: DisassociateProductFromPortfolio -> Text
$sel:productId:DisassociateProductFromPortfolio' :: DisassociateProductFromPortfolio -> Text
$sel:acceptLanguage:DisassociateProductFromPortfolio' :: DisassociateProductFromPortfolio -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
acceptLanguage
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
productId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
portfolioId

instance
  Data.ToHeaders
    DisassociateProductFromPortfolio
  where
  toHeaders :: DisassociateProductFromPortfolio -> 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.DisassociateProductFromPortfolio" ::
                          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 DisassociateProductFromPortfolio where
  toJSON :: DisassociateProductFromPortfolio -> Value
toJSON DisassociateProductFromPortfolio' {Maybe Text
Text
portfolioId :: Text
productId :: Text
acceptLanguage :: Maybe Text
$sel:portfolioId:DisassociateProductFromPortfolio' :: DisassociateProductFromPortfolio -> Text
$sel:productId:DisassociateProductFromPortfolio' :: DisassociateProductFromPortfolio -> Text
$sel:acceptLanguage:DisassociateProductFromPortfolio' :: DisassociateProductFromPortfolio -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"AcceptLanguage" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
acceptLanguage,
            forall a. a -> Maybe a
Prelude.Just (Key
"ProductId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
productId),
            forall a. a -> Maybe a
Prelude.Just (Key
"PortfolioId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
portfolioId)
          ]
      )

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

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

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

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

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

instance
  Prelude.NFData
    DisassociateProductFromPortfolioResponse
  where
  rnf :: DisassociateProductFromPortfolioResponse -> ()
rnf DisassociateProductFromPortfolioResponse' {Int
httpStatus :: Int
$sel:httpStatus:DisassociateProductFromPortfolioResponse' :: DisassociateProductFromPortfolioResponse -> Int
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus