{-# 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.DisableAWSOrganizationsAccess
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Disable portfolio sharing through the Organizations service. This
-- command will not delete your current shares, but prevents you from
-- creating new shares throughout your organization. Current shares are not
-- kept in sync with your organization structure if the structure changes
-- after calling this API. Only the management account in the organization
-- can call this API.
--
-- You cannot call this API if there are active delegated administrators in
-- the organization.
--
-- Note that a delegated administrator is not authorized to invoke
-- @DisableAWSOrganizationsAccess@.
--
-- If you share an Service Catalog portfolio in an organization within
-- Organizations, and then disable Organizations access for Service
-- Catalog, the portfolio access permissions will not sync with the latest
-- changes to the organization structure. Specifically, accounts that you
-- removed from the organization after disabling Service Catalog access
-- will retain access to the previously shared portfolio.
module Amazonka.ServiceCatalog.DisableAWSOrganizationsAccess
  ( -- * Creating a Request
    DisableAWSOrganizationsAccess (..),
    newDisableAWSOrganizationsAccess,

    -- * Destructuring the Response
    DisableAWSOrganizationsAccessResponse (..),
    newDisableAWSOrganizationsAccessResponse,

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

-- |
-- Create a value of 'DisableAWSOrganizationsAccess' 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.
newDisableAWSOrganizationsAccess ::
  DisableAWSOrganizationsAccess
newDisableAWSOrganizationsAccess :: DisableAWSOrganizationsAccess
newDisableAWSOrganizationsAccess =
  DisableAWSOrganizationsAccess
DisableAWSOrganizationsAccess'

instance
  Core.AWSRequest
    DisableAWSOrganizationsAccess
  where
  type
    AWSResponse DisableAWSOrganizationsAccess =
      DisableAWSOrganizationsAccessResponse
  request :: (Service -> Service)
-> DisableAWSOrganizationsAccess
-> Request DisableAWSOrganizationsAccess
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 DisableAWSOrganizationsAccess
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DisableAWSOrganizationsAccess)))
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 -> DisableAWSOrganizationsAccessResponse
DisableAWSOrganizationsAccessResponse'
            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
    DisableAWSOrganizationsAccess
  where
  hashWithSalt :: Int -> DisableAWSOrganizationsAccess -> Int
hashWithSalt Int
_salt DisableAWSOrganizationsAccess
_ =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` ()

instance Prelude.NFData DisableAWSOrganizationsAccess where
  rnf :: DisableAWSOrganizationsAccess -> ()
rnf DisableAWSOrganizationsAccess
_ = ()

instance Data.ToHeaders DisableAWSOrganizationsAccess where
  toHeaders :: DisableAWSOrganizationsAccess -> 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.DisableAWSOrganizationsAccess" ::
                          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 DisableAWSOrganizationsAccess where
  toJSON :: DisableAWSOrganizationsAccess -> Value
toJSON = forall a b. a -> b -> a
Prelude.const (Object -> Value
Data.Object forall a. Monoid a => a
Prelude.mempty)

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

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

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

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

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

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