{-# 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-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 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.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:/ '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
(DisassociateProductFromPortfolio
 -> DisassociateProductFromPortfolio -> Bool)
-> (DisassociateProductFromPortfolio
    -> DisassociateProductFromPortfolio -> Bool)
-> Eq DisassociateProductFromPortfolio
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]
(Int -> ReadS DisassociateProductFromPortfolio)
-> ReadS [DisassociateProductFromPortfolio]
-> ReadPrec DisassociateProductFromPortfolio
-> ReadPrec [DisassociateProductFromPortfolio]
-> Read 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
(Int -> DisassociateProductFromPortfolio -> ShowS)
-> (DisassociateProductFromPortfolio -> String)
-> ([DisassociateProductFromPortfolio] -> ShowS)
-> Show DisassociateProductFromPortfolio
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.
 DisassociateProductFromPortfolio
 -> Rep DisassociateProductFromPortfolio x)
-> (forall x.
    Rep DisassociateProductFromPortfolio x
    -> DisassociateProductFromPortfolio)
-> Generic DisassociateProductFromPortfolio
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' :: Maybe Text -> Text -> Text -> DisassociateProductFromPortfolio
DisassociateProductFromPortfolio'
      { $sel:acceptLanguage:DisassociateProductFromPortfolio' :: Maybe Text
acceptLanguage =
          Maybe Text
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 :: (Maybe Text -> f (Maybe Text))
-> DisassociateProductFromPortfolio
-> f DisassociateProductFromPortfolio
disassociateProductFromPortfolio_acceptLanguage = (DisassociateProductFromPortfolio -> Maybe Text)
-> (DisassociateProductFromPortfolio
    -> Maybe Text -> DisassociateProductFromPortfolio)
-> Lens
     DisassociateProductFromPortfolio
     DisassociateProductFromPortfolio
     (Maybe Text)
     (Maybe Text)
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 :: (Text -> f Text)
-> DisassociateProductFromPortfolio
-> f DisassociateProductFromPortfolio
disassociateProductFromPortfolio_productId = (DisassociateProductFromPortfolio -> Text)
-> (DisassociateProductFromPortfolio
    -> Text -> DisassociateProductFromPortfolio)
-> Lens
     DisassociateProductFromPortfolio
     DisassociateProductFromPortfolio
     Text
     Text
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 :: (Text -> f Text)
-> DisassociateProductFromPortfolio
-> f DisassociateProductFromPortfolio
disassociateProductFromPortfolio_portfolioId = (DisassociateProductFromPortfolio -> Text)
-> (DisassociateProductFromPortfolio
    -> Text -> DisassociateProductFromPortfolio)
-> Lens
     DisassociateProductFromPortfolio
     DisassociateProductFromPortfolio
     Text
     Text
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 :: DisassociateProductFromPortfolio
-> Request DisassociateProductFromPortfolio
request = Service
-> DisassociateProductFromPortfolio
-> Request DisassociateProductFromPortfolio
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy DisassociateProductFromPortfolio
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse (AWSResponse DisassociateProductFromPortfolio)))
response =
    (Int
 -> ResponseHeaders
 -> ()
 -> Either String (AWSResponse DisassociateProductFromPortfolio))
-> Logger
-> Service
-> Proxy DisassociateProductFromPortfolio
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse (AWSResponse DisassociateProductFromPortfolio)))
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 -> DisassociateProductFromPortfolioResponse
DisassociateProductFromPortfolioResponse'
            (Int -> DisassociateProductFromPortfolioResponse)
-> Either String Int
-> Either String DisassociateProductFromPortfolioResponse
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
    DisassociateProductFromPortfolio

instance
  Prelude.NFData
    DisassociateProductFromPortfolio

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

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

instance
  Core.ToQuery
    DisassociateProductFromPortfolio
  where
  toQuery :: DisassociateProductFromPortfolio -> QueryString
toQuery = QueryString -> DisassociateProductFromPortfolio -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
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
(DisassociateProductFromPortfolioResponse
 -> DisassociateProductFromPortfolioResponse -> Bool)
-> (DisassociateProductFromPortfolioResponse
    -> DisassociateProductFromPortfolioResponse -> Bool)
-> Eq DisassociateProductFromPortfolioResponse
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]
(Int -> ReadS DisassociateProductFromPortfolioResponse)
-> ReadS [DisassociateProductFromPortfolioResponse]
-> ReadPrec DisassociateProductFromPortfolioResponse
-> ReadPrec [DisassociateProductFromPortfolioResponse]
-> Read 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
(Int -> DisassociateProductFromPortfolioResponse -> ShowS)
-> (DisassociateProductFromPortfolioResponse -> String)
-> ([DisassociateProductFromPortfolioResponse] -> ShowS)
-> Show DisassociateProductFromPortfolioResponse
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.
 DisassociateProductFromPortfolioResponse
 -> Rep DisassociateProductFromPortfolioResponse x)
-> (forall x.
    Rep DisassociateProductFromPortfolioResponse x
    -> DisassociateProductFromPortfolioResponse)
-> Generic DisassociateProductFromPortfolioResponse
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' :: Int -> DisassociateProductFromPortfolioResponse
DisassociateProductFromPortfolioResponse'
      { $sel:httpStatus:DisassociateProductFromPortfolioResponse' :: Int
httpStatus =
          Int
pHttpStatus_
      }

-- | The response's http status code.
disassociateProductFromPortfolioResponse_httpStatus :: Lens.Lens' DisassociateProductFromPortfolioResponse Prelude.Int
disassociateProductFromPortfolioResponse_httpStatus :: (Int -> f Int)
-> DisassociateProductFromPortfolioResponse
-> f DisassociateProductFromPortfolioResponse
disassociateProductFromPortfolioResponse_httpStatus = (DisassociateProductFromPortfolioResponse -> Int)
-> (DisassociateProductFromPortfolioResponse
    -> Int -> DisassociateProductFromPortfolioResponse)
-> Lens
     DisassociateProductFromPortfolioResponse
     DisassociateProductFromPortfolioResponse
     Int
     Int
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