{-# 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.DescribeHealthServiceStatusForOrganization
-- 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)
--
-- This operation provides status information on enabling or disabling AWS
-- Health to work with your organization. To call this operation, you must
-- sign in as an IAM user, assume an IAM role, or sign in as the root user
-- (not recommended) in the organization\'s management account.
module Amazonka.AWSHealth.DescribeHealthServiceStatusForOrganization
  ( -- * Creating a Request
    DescribeHealthServiceStatusForOrganization (..),
    newDescribeHealthServiceStatusForOrganization,

    -- * Destructuring the Response
    DescribeHealthServiceStatusForOrganizationResponse (..),
    newDescribeHealthServiceStatusForOrganizationResponse,

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

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

instance
  Core.AWSRequest
    DescribeHealthServiceStatusForOrganization
  where
  type
    AWSResponse
      DescribeHealthServiceStatusForOrganization =
      DescribeHealthServiceStatusForOrganizationResponse
  request :: DescribeHealthServiceStatusForOrganization
-> Request DescribeHealthServiceStatusForOrganization
request = Service
-> DescribeHealthServiceStatusForOrganization
-> Request DescribeHealthServiceStatusForOrganization
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy DescribeHealthServiceStatusForOrganization
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse
           (AWSResponse DescribeHealthServiceStatusForOrganization)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either
      String (AWSResponse DescribeHealthServiceStatusForOrganization))
-> Logger
-> Service
-> Proxy DescribeHealthServiceStatusForOrganization
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse
           (AWSResponse DescribeHealthServiceStatusForOrganization)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe Text
-> Int -> DescribeHealthServiceStatusForOrganizationResponse
DescribeHealthServiceStatusForOrganizationResponse'
            (Maybe Text
 -> Int -> DescribeHealthServiceStatusForOrganizationResponse)
-> Either String (Maybe Text)
-> Either
     String (Int -> DescribeHealthServiceStatusForOrganizationResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( Object
x
                            Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"healthServiceAccessStatusForOrganization"
                        )
              Either
  String (Int -> DescribeHealthServiceStatusForOrganizationResponse)
-> Either String Int
-> Either String DescribeHealthServiceStatusForOrganizationResponse
forall (f :: * -> *) a b. Applicative f => 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
    DescribeHealthServiceStatusForOrganization

instance
  Prelude.NFData
    DescribeHealthServiceStatusForOrganization

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

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

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

-- | /See:/ 'newDescribeHealthServiceStatusForOrganizationResponse' smart constructor.
data DescribeHealthServiceStatusForOrganizationResponse = DescribeHealthServiceStatusForOrganizationResponse'
  { -- | Information about the status of enabling or disabling AWS Health
    -- Organizational View in your organization.
    --
    -- Valid values are @ENABLED | DISABLED | PENDING@.
    DescribeHealthServiceStatusForOrganizationResponse -> Maybe Text
healthServiceAccessStatusForOrganization :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    DescribeHealthServiceStatusForOrganizationResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DescribeHealthServiceStatusForOrganizationResponse
-> DescribeHealthServiceStatusForOrganizationResponse -> Bool
(DescribeHealthServiceStatusForOrganizationResponse
 -> DescribeHealthServiceStatusForOrganizationResponse -> Bool)
-> (DescribeHealthServiceStatusForOrganizationResponse
    -> DescribeHealthServiceStatusForOrganizationResponse -> Bool)
-> Eq DescribeHealthServiceStatusForOrganizationResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeHealthServiceStatusForOrganizationResponse
-> DescribeHealthServiceStatusForOrganizationResponse -> Bool
$c/= :: DescribeHealthServiceStatusForOrganizationResponse
-> DescribeHealthServiceStatusForOrganizationResponse -> Bool
== :: DescribeHealthServiceStatusForOrganizationResponse
-> DescribeHealthServiceStatusForOrganizationResponse -> Bool
$c== :: DescribeHealthServiceStatusForOrganizationResponse
-> DescribeHealthServiceStatusForOrganizationResponse -> Bool
Prelude.Eq, ReadPrec [DescribeHealthServiceStatusForOrganizationResponse]
ReadPrec DescribeHealthServiceStatusForOrganizationResponse
Int -> ReadS DescribeHealthServiceStatusForOrganizationResponse
ReadS [DescribeHealthServiceStatusForOrganizationResponse]
(Int -> ReadS DescribeHealthServiceStatusForOrganizationResponse)
-> ReadS [DescribeHealthServiceStatusForOrganizationResponse]
-> ReadPrec DescribeHealthServiceStatusForOrganizationResponse
-> ReadPrec [DescribeHealthServiceStatusForOrganizationResponse]
-> Read DescribeHealthServiceStatusForOrganizationResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeHealthServiceStatusForOrganizationResponse]
$creadListPrec :: ReadPrec [DescribeHealthServiceStatusForOrganizationResponse]
readPrec :: ReadPrec DescribeHealthServiceStatusForOrganizationResponse
$creadPrec :: ReadPrec DescribeHealthServiceStatusForOrganizationResponse
readList :: ReadS [DescribeHealthServiceStatusForOrganizationResponse]
$creadList :: ReadS [DescribeHealthServiceStatusForOrganizationResponse]
readsPrec :: Int -> ReadS DescribeHealthServiceStatusForOrganizationResponse
$creadsPrec :: Int -> ReadS DescribeHealthServiceStatusForOrganizationResponse
Prelude.Read, Int -> DescribeHealthServiceStatusForOrganizationResponse -> ShowS
[DescribeHealthServiceStatusForOrganizationResponse] -> ShowS
DescribeHealthServiceStatusForOrganizationResponse -> String
(Int
 -> DescribeHealthServiceStatusForOrganizationResponse -> ShowS)
-> (DescribeHealthServiceStatusForOrganizationResponse -> String)
-> ([DescribeHealthServiceStatusForOrganizationResponse] -> ShowS)
-> Show DescribeHealthServiceStatusForOrganizationResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeHealthServiceStatusForOrganizationResponse] -> ShowS
$cshowList :: [DescribeHealthServiceStatusForOrganizationResponse] -> ShowS
show :: DescribeHealthServiceStatusForOrganizationResponse -> String
$cshow :: DescribeHealthServiceStatusForOrganizationResponse -> String
showsPrec :: Int -> DescribeHealthServiceStatusForOrganizationResponse -> ShowS
$cshowsPrec :: Int -> DescribeHealthServiceStatusForOrganizationResponse -> ShowS
Prelude.Show, (forall x.
 DescribeHealthServiceStatusForOrganizationResponse
 -> Rep DescribeHealthServiceStatusForOrganizationResponse x)
-> (forall x.
    Rep DescribeHealthServiceStatusForOrganizationResponse x
    -> DescribeHealthServiceStatusForOrganizationResponse)
-> Generic DescribeHealthServiceStatusForOrganizationResponse
forall x.
Rep DescribeHealthServiceStatusForOrganizationResponse x
-> DescribeHealthServiceStatusForOrganizationResponse
forall x.
DescribeHealthServiceStatusForOrganizationResponse
-> Rep DescribeHealthServiceStatusForOrganizationResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeHealthServiceStatusForOrganizationResponse x
-> DescribeHealthServiceStatusForOrganizationResponse
$cfrom :: forall x.
DescribeHealthServiceStatusForOrganizationResponse
-> Rep DescribeHealthServiceStatusForOrganizationResponse x
Prelude.Generic)

-- |
-- Create a value of 'DescribeHealthServiceStatusForOrganizationResponse' 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:
--
-- 'healthServiceAccessStatusForOrganization', 'describeHealthServiceStatusForOrganizationResponse_healthServiceAccessStatusForOrganization' - Information about the status of enabling or disabling AWS Health
-- Organizational View in your organization.
--
-- Valid values are @ENABLED | DISABLED | PENDING@.
--
-- 'httpStatus', 'describeHealthServiceStatusForOrganizationResponse_httpStatus' - The response's http status code.
newDescribeHealthServiceStatusForOrganizationResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeHealthServiceStatusForOrganizationResponse
newDescribeHealthServiceStatusForOrganizationResponse :: Int -> DescribeHealthServiceStatusForOrganizationResponse
newDescribeHealthServiceStatusForOrganizationResponse
  Int
pHttpStatus_ =
    DescribeHealthServiceStatusForOrganizationResponse' :: Maybe Text
-> Int -> DescribeHealthServiceStatusForOrganizationResponse
DescribeHealthServiceStatusForOrganizationResponse'
      { $sel:healthServiceAccessStatusForOrganization:DescribeHealthServiceStatusForOrganizationResponse' :: Maybe Text
healthServiceAccessStatusForOrganization =
          Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:httpStatus:DescribeHealthServiceStatusForOrganizationResponse' :: Int
httpStatus =
          Int
pHttpStatus_
      }

-- | Information about the status of enabling or disabling AWS Health
-- Organizational View in your organization.
--
-- Valid values are @ENABLED | DISABLED | PENDING@.
describeHealthServiceStatusForOrganizationResponse_healthServiceAccessStatusForOrganization :: Lens.Lens' DescribeHealthServiceStatusForOrganizationResponse (Prelude.Maybe Prelude.Text)
describeHealthServiceStatusForOrganizationResponse_healthServiceAccessStatusForOrganization :: (Maybe Text -> f (Maybe Text))
-> DescribeHealthServiceStatusForOrganizationResponse
-> f DescribeHealthServiceStatusForOrganizationResponse
describeHealthServiceStatusForOrganizationResponse_healthServiceAccessStatusForOrganization = (DescribeHealthServiceStatusForOrganizationResponse -> Maybe Text)
-> (DescribeHealthServiceStatusForOrganizationResponse
    -> Maybe Text
    -> DescribeHealthServiceStatusForOrganizationResponse)
-> Lens
     DescribeHealthServiceStatusForOrganizationResponse
     DescribeHealthServiceStatusForOrganizationResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeHealthServiceStatusForOrganizationResponse' {Maybe Text
healthServiceAccessStatusForOrganization :: Maybe Text
$sel:healthServiceAccessStatusForOrganization:DescribeHealthServiceStatusForOrganizationResponse' :: DescribeHealthServiceStatusForOrganizationResponse -> Maybe Text
healthServiceAccessStatusForOrganization} -> Maybe Text
healthServiceAccessStatusForOrganization) (\s :: DescribeHealthServiceStatusForOrganizationResponse
s@DescribeHealthServiceStatusForOrganizationResponse' {} Maybe Text
a -> DescribeHealthServiceStatusForOrganizationResponse
s {$sel:healthServiceAccessStatusForOrganization:DescribeHealthServiceStatusForOrganizationResponse' :: Maybe Text
healthServiceAccessStatusForOrganization = Maybe Text
a} :: DescribeHealthServiceStatusForOrganizationResponse)

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

instance
  Prelude.NFData
    DescribeHealthServiceStatusForOrganizationResponse