{-# 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.RejectPortfolioShare
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Rejects an offer to share the specified portfolio.
module Amazonka.ServiceCatalog.RejectPortfolioShare
  ( -- * Creating a Request
    RejectPortfolioShare (..),
    newRejectPortfolioShare,

    -- * Request Lenses
    rejectPortfolioShare_acceptLanguage,
    rejectPortfolioShare_portfolioShareType,
    rejectPortfolioShare_portfolioId,

    -- * Destructuring the Response
    RejectPortfolioShareResponse (..),
    newRejectPortfolioShareResponse,

    -- * Response Lenses
    rejectPortfolioShareResponse_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:/ 'newRejectPortfolioShare' smart constructor.
data RejectPortfolioShare = RejectPortfolioShare'
  { -- | The language code.
    --
    -- -   @en@ - English (default)
    --
    -- -   @jp@ - Japanese
    --
    -- -   @zh@ - Chinese
    RejectPortfolioShare -> Maybe Text
acceptLanguage :: Prelude.Maybe Prelude.Text,
    -- | The type of shared portfolios to reject. The default is to reject
    -- imported portfolios.
    --
    -- -   @AWS_ORGANIZATIONS@ - Reject portfolios shared by the management
    --     account of your organization.
    --
    -- -   @IMPORTED@ - Reject imported portfolios.
    --
    -- -   @AWS_SERVICECATALOG@ - Not supported. (Throws
    --     ResourceNotFoundException.)
    --
    -- For example,
    -- @aws servicecatalog reject-portfolio-share --portfolio-id \"port-2qwzkwxt3y5fk\" --portfolio-share-type AWS_ORGANIZATIONS@
    RejectPortfolioShare -> Maybe PortfolioShareType
portfolioShareType :: Prelude.Maybe PortfolioShareType,
    -- | The portfolio identifier.
    RejectPortfolioShare -> Text
portfolioId :: Prelude.Text
  }
  deriving (RejectPortfolioShare -> RejectPortfolioShare -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RejectPortfolioShare -> RejectPortfolioShare -> Bool
$c/= :: RejectPortfolioShare -> RejectPortfolioShare -> Bool
== :: RejectPortfolioShare -> RejectPortfolioShare -> Bool
$c== :: RejectPortfolioShare -> RejectPortfolioShare -> Bool
Prelude.Eq, ReadPrec [RejectPortfolioShare]
ReadPrec RejectPortfolioShare
Int -> ReadS RejectPortfolioShare
ReadS [RejectPortfolioShare]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RejectPortfolioShare]
$creadListPrec :: ReadPrec [RejectPortfolioShare]
readPrec :: ReadPrec RejectPortfolioShare
$creadPrec :: ReadPrec RejectPortfolioShare
readList :: ReadS [RejectPortfolioShare]
$creadList :: ReadS [RejectPortfolioShare]
readsPrec :: Int -> ReadS RejectPortfolioShare
$creadsPrec :: Int -> ReadS RejectPortfolioShare
Prelude.Read, Int -> RejectPortfolioShare -> ShowS
[RejectPortfolioShare] -> ShowS
RejectPortfolioShare -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RejectPortfolioShare] -> ShowS
$cshowList :: [RejectPortfolioShare] -> ShowS
show :: RejectPortfolioShare -> String
$cshow :: RejectPortfolioShare -> String
showsPrec :: Int -> RejectPortfolioShare -> ShowS
$cshowsPrec :: Int -> RejectPortfolioShare -> ShowS
Prelude.Show, forall x. Rep RejectPortfolioShare x -> RejectPortfolioShare
forall x. RejectPortfolioShare -> Rep RejectPortfolioShare x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RejectPortfolioShare x -> RejectPortfolioShare
$cfrom :: forall x. RejectPortfolioShare -> Rep RejectPortfolioShare x
Prelude.Generic)

-- |
-- Create a value of 'RejectPortfolioShare' 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', 'rejectPortfolioShare_acceptLanguage' - The language code.
--
-- -   @en@ - English (default)
--
-- -   @jp@ - Japanese
--
-- -   @zh@ - Chinese
--
-- 'portfolioShareType', 'rejectPortfolioShare_portfolioShareType' - The type of shared portfolios to reject. The default is to reject
-- imported portfolios.
--
-- -   @AWS_ORGANIZATIONS@ - Reject portfolios shared by the management
--     account of your organization.
--
-- -   @IMPORTED@ - Reject imported portfolios.
--
-- -   @AWS_SERVICECATALOG@ - Not supported. (Throws
--     ResourceNotFoundException.)
--
-- For example,
-- @aws servicecatalog reject-portfolio-share --portfolio-id \"port-2qwzkwxt3y5fk\" --portfolio-share-type AWS_ORGANIZATIONS@
--
-- 'portfolioId', 'rejectPortfolioShare_portfolioId' - The portfolio identifier.
newRejectPortfolioShare ::
  -- | 'portfolioId'
  Prelude.Text ->
  RejectPortfolioShare
newRejectPortfolioShare :: Text -> RejectPortfolioShare
newRejectPortfolioShare Text
pPortfolioId_ =
  RejectPortfolioShare'
    { $sel:acceptLanguage:RejectPortfolioShare' :: Maybe Text
acceptLanguage =
        forall a. Maybe a
Prelude.Nothing,
      $sel:portfolioShareType:RejectPortfolioShare' :: Maybe PortfolioShareType
portfolioShareType = forall a. Maybe a
Prelude.Nothing,
      $sel:portfolioId:RejectPortfolioShare' :: Text
portfolioId = Text
pPortfolioId_
    }

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

-- | The type of shared portfolios to reject. The default is to reject
-- imported portfolios.
--
-- -   @AWS_ORGANIZATIONS@ - Reject portfolios shared by the management
--     account of your organization.
--
-- -   @IMPORTED@ - Reject imported portfolios.
--
-- -   @AWS_SERVICECATALOG@ - Not supported. (Throws
--     ResourceNotFoundException.)
--
-- For example,
-- @aws servicecatalog reject-portfolio-share --portfolio-id \"port-2qwzkwxt3y5fk\" --portfolio-share-type AWS_ORGANIZATIONS@
rejectPortfolioShare_portfolioShareType :: Lens.Lens' RejectPortfolioShare (Prelude.Maybe PortfolioShareType)
rejectPortfolioShare_portfolioShareType :: Lens' RejectPortfolioShare (Maybe PortfolioShareType)
rejectPortfolioShare_portfolioShareType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RejectPortfolioShare' {Maybe PortfolioShareType
portfolioShareType :: Maybe PortfolioShareType
$sel:portfolioShareType:RejectPortfolioShare' :: RejectPortfolioShare -> Maybe PortfolioShareType
portfolioShareType} -> Maybe PortfolioShareType
portfolioShareType) (\s :: RejectPortfolioShare
s@RejectPortfolioShare' {} Maybe PortfolioShareType
a -> RejectPortfolioShare
s {$sel:portfolioShareType:RejectPortfolioShare' :: Maybe PortfolioShareType
portfolioShareType = Maybe PortfolioShareType
a} :: RejectPortfolioShare)

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

instance Core.AWSRequest RejectPortfolioShare where
  type
    AWSResponse RejectPortfolioShare =
      RejectPortfolioShareResponse
  request :: (Service -> Service)
-> RejectPortfolioShare -> Request RejectPortfolioShare
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 RejectPortfolioShare
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse RejectPortfolioShare)))
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 -> RejectPortfolioShareResponse
RejectPortfolioShareResponse'
            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 RejectPortfolioShare where
  hashWithSalt :: Int -> RejectPortfolioShare -> Int
hashWithSalt Int
_salt RejectPortfolioShare' {Maybe Text
Maybe PortfolioShareType
Text
portfolioId :: Text
portfolioShareType :: Maybe PortfolioShareType
acceptLanguage :: Maybe Text
$sel:portfolioId:RejectPortfolioShare' :: RejectPortfolioShare -> Text
$sel:portfolioShareType:RejectPortfolioShare' :: RejectPortfolioShare -> Maybe PortfolioShareType
$sel:acceptLanguage:RejectPortfolioShare' :: RejectPortfolioShare -> 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` Maybe PortfolioShareType
portfolioShareType
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
portfolioId

instance Prelude.NFData RejectPortfolioShare where
  rnf :: RejectPortfolioShare -> ()
rnf RejectPortfolioShare' {Maybe Text
Maybe PortfolioShareType
Text
portfolioId :: Text
portfolioShareType :: Maybe PortfolioShareType
acceptLanguage :: Maybe Text
$sel:portfolioId:RejectPortfolioShare' :: RejectPortfolioShare -> Text
$sel:portfolioShareType:RejectPortfolioShare' :: RejectPortfolioShare -> Maybe PortfolioShareType
$sel:acceptLanguage:RejectPortfolioShare' :: RejectPortfolioShare -> 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 Maybe PortfolioShareType
portfolioShareType
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
portfolioId

instance Data.ToHeaders RejectPortfolioShare where
  toHeaders :: RejectPortfolioShare -> 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.RejectPortfolioShare" ::
                          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 RejectPortfolioShare where
  toJSON :: RejectPortfolioShare -> Value
toJSON RejectPortfolioShare' {Maybe Text
Maybe PortfolioShareType
Text
portfolioId :: Text
portfolioShareType :: Maybe PortfolioShareType
acceptLanguage :: Maybe Text
$sel:portfolioId:RejectPortfolioShare' :: RejectPortfolioShare -> Text
$sel:portfolioShareType:RejectPortfolioShare' :: RejectPortfolioShare -> Maybe PortfolioShareType
$sel:acceptLanguage:RejectPortfolioShare' :: RejectPortfolioShare -> 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,
            (Key
"PortfolioShareType" 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 PortfolioShareType
portfolioShareType,
            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 RejectPortfolioShare where
  toPath :: RejectPortfolioShare -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"

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

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

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

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

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