{-# 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.AWSHealth.DisableHealthServiceAccessForOrganization
-- 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)
--
-- Disables AWS Health from working with AWS Organizations. To call this
-- operation, you must sign in as an AWS Identity and Access Management
-- (IAM) user, assume an IAM role, or sign in as the root user (not
-- recommended) in the organization\'s management account. For more
-- information, see
-- <https://docs.aws.amazon.com/health/latest/ug/aggregate-events.html Aggregating AWS Health events>
-- in the /AWS Health User Guide/.
--
-- This operation doesn\'t remove the service-linked role from the
-- management account in your organization. You must use the IAM console,
-- API, or AWS Command Line Interface (AWS CLI) to remove the
-- service-linked role. For more information, see
-- <https://docs.aws.amazon.com/IAM/latest/UserGuide/using-service-linked-roles.html#delete-service-linked-role Deleting a Service-Linked Role>
-- in the /IAM User Guide/.
--
-- You can also disable the organizational feature by using the
-- Organizations
-- <https://docs.aws.amazon.com/organizations/latest/APIReference/API_DisableAWSServiceAccess.html DisableAWSServiceAccess>
-- API operation. After you call this operation, AWS Health stops
-- aggregating events for all other AWS accounts in your organization. If
-- you call the AWS Health API operations for organizational view, AWS
-- Health returns an error. AWS Health continues to aggregate health events
-- for your AWS account.
module Amazonka.AWSHealth.DisableHealthServiceAccessForOrganization
  ( -- * Creating a Request
    DisableHealthServiceAccessForOrganization (..),
    newDisableHealthServiceAccessForOrganization,

    -- * Destructuring the Response
    DisableHealthServiceAccessForOrganizationResponse (..),
    newDisableHealthServiceAccessForOrganizationResponse,
  )
where

import Amazonka.AWSHealth.Types
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

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

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

instance
  Core.AWSRequest
    DisableHealthServiceAccessForOrganization
  where
  type
    AWSResponse
      DisableHealthServiceAccessForOrganization =
      DisableHealthServiceAccessForOrganizationResponse
  request :: DisableHealthServiceAccessForOrganization
-> Request DisableHealthServiceAccessForOrganization
request = Service
-> DisableHealthServiceAccessForOrganization
-> Request DisableHealthServiceAccessForOrganization
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy DisableHealthServiceAccessForOrganization
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse
           (AWSResponse DisableHealthServiceAccessForOrganization)))
response =
    AWSResponse DisableHealthServiceAccessForOrganization
-> Logger
-> Service
-> Proxy DisableHealthServiceAccessForOrganization
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse
           (AWSResponse DisableHealthServiceAccessForOrganization)))
forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull
      AWSResponse DisableHealthServiceAccessForOrganization
DisableHealthServiceAccessForOrganizationResponse
DisableHealthServiceAccessForOrganizationResponse'

instance
  Prelude.Hashable
    DisableHealthServiceAccessForOrganization

instance
  Prelude.NFData
    DisableHealthServiceAccessForOrganization

instance
  Core.ToHeaders
    DisableHealthServiceAccessForOrganization
  where
  toHeaders :: DisableHealthServiceAccessForOrganization -> [Header]
toHeaders =
    [Header] -> DisableHealthServiceAccessForOrganization -> [Header]
forall a b. a -> b -> a
Prelude.const
      ( [[Header]] -> [Header]
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              HeaderName -> ByteString -> [Header]
forall a. ToHeader a => HeaderName -> a -> [Header]
Core.=# ( ByteString
"AWSHealth_20160804.DisableHealthServiceAccessForOrganization" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              HeaderName -> ByteString -> [Header]
forall a. ToHeader a => HeaderName -> a -> [Header]
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance
  Core.ToJSON
    DisableHealthServiceAccessForOrganization
  where
  toJSON :: DisableHealthServiceAccessForOrganization -> Value
toJSON = Value -> DisableHealthServiceAccessForOrganization -> Value
forall a b. a -> b -> a
Prelude.const (Object -> Value
Core.Object Object
forall a. Monoid a => a
Prelude.mempty)

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

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

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

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

instance
  Prelude.NFData
    DisableHealthServiceAccessForOrganizationResponse