{-# 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-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)
--
-- Disable portfolio sharing through AWS Organizations feature. This
-- feature will not delete your current shares but it will prevent you from
-- creating new shares throughout your organization. Current shares will
-- not be in sync with your organization structure if it changes after
-- calling this API. This API can only be called by the management account
-- in the organization.
--
-- This API can\'t be invoked if there are active delegated administrators
-- in the organization.
--
-- Note that a delegated administrator is not authorized to invoke
-- @DisableAWSOrganizationsAccess@.
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.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:/ 'newDisableAWSOrganizationsAccess' smart constructor.
data DisableAWSOrganizationsAccess = DisableAWSOrganizationsAccess'
  {
  }
  deriving (DisableAWSOrganizationsAccess
-> DisableAWSOrganizationsAccess -> Bool
(DisableAWSOrganizationsAccess
 -> DisableAWSOrganizationsAccess -> Bool)
-> (DisableAWSOrganizationsAccess
    -> DisableAWSOrganizationsAccess -> Bool)
-> Eq DisableAWSOrganizationsAccess
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]
(Int -> ReadS DisableAWSOrganizationsAccess)
-> ReadS [DisableAWSOrganizationsAccess]
-> ReadPrec DisableAWSOrganizationsAccess
-> ReadPrec [DisableAWSOrganizationsAccess]
-> Read 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
(Int -> DisableAWSOrganizationsAccess -> ShowS)
-> (DisableAWSOrganizationsAccess -> String)
-> ([DisableAWSOrganizationsAccess] -> ShowS)
-> Show DisableAWSOrganizationsAccess
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.
 DisableAWSOrganizationsAccess
 -> Rep DisableAWSOrganizationsAccess x)
-> (forall x.
    Rep DisableAWSOrganizationsAccess x
    -> DisableAWSOrganizationsAccess)
-> Generic DisableAWSOrganizationsAccess
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 :: DisableAWSOrganizationsAccess
-> Request DisableAWSOrganizationsAccess
request = Service
-> DisableAWSOrganizationsAccess
-> Request DisableAWSOrganizationsAccess
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy DisableAWSOrganizationsAccess
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DisableAWSOrganizationsAccess)))
response =
    (Int
 -> ResponseHeaders
 -> ()
 -> Either String (AWSResponse DisableAWSOrganizationsAccess))
-> Logger
-> Service
-> Proxy DisableAWSOrganizationsAccess
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DisableAWSOrganizationsAccess)))
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 -> DisableAWSOrganizationsAccessResponse
DisableAWSOrganizationsAccessResponse'
            (Int -> DisableAWSOrganizationsAccessResponse)
-> Either String Int
-> Either String DisableAWSOrganizationsAccessResponse
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
    DisableAWSOrganizationsAccess

instance Prelude.NFData DisableAWSOrganizationsAccess

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

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

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

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