{-# 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.GetAWSOrganizationsAccessStatus
-- 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)
--
-- Get the Access Status for AWS Organization portfolio share feature. This
-- API can only be called by the management account in the organization or
-- by a delegated admin.
module Amazonka.ServiceCatalog.GetAWSOrganizationsAccessStatus
  ( -- * Creating a Request
    GetAWSOrganizationsAccessStatus (..),
    newGetAWSOrganizationsAccessStatus,

    -- * Destructuring the Response
    GetAWSOrganizationsAccessStatusResponse (..),
    newGetAWSOrganizationsAccessStatusResponse,

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

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

instance
  Core.AWSRequest
    GetAWSOrganizationsAccessStatus
  where
  type
    AWSResponse GetAWSOrganizationsAccessStatus =
      GetAWSOrganizationsAccessStatusResponse
  request :: GetAWSOrganizationsAccessStatus
-> Request GetAWSOrganizationsAccessStatus
request = Service
-> GetAWSOrganizationsAccessStatus
-> Request GetAWSOrganizationsAccessStatus
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy GetAWSOrganizationsAccessStatus
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse (AWSResponse GetAWSOrganizationsAccessStatus)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse GetAWSOrganizationsAccessStatus))
-> Logger
-> Service
-> Proxy GetAWSOrganizationsAccessStatus
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse (AWSResponse GetAWSOrganizationsAccessStatus)))
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 AccessStatus
-> Int -> GetAWSOrganizationsAccessStatusResponse
GetAWSOrganizationsAccessStatusResponse'
            (Maybe AccessStatus
 -> Int -> GetAWSOrganizationsAccessStatusResponse)
-> Either String (Maybe AccessStatus)
-> Either String (Int -> GetAWSOrganizationsAccessStatusResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Key -> Either String (Maybe AccessStatus)
forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Core..?> Key
"AccessStatus")
            Either String (Int -> GetAWSOrganizationsAccessStatusResponse)
-> Either String Int
-> Either String GetAWSOrganizationsAccessStatusResponse
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
    GetAWSOrganizationsAccessStatus

instance
  Prelude.NFData
    GetAWSOrganizationsAccessStatus

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

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

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

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

-- |
-- Create a value of 'GetAWSOrganizationsAccessStatusResponse' 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:
--
-- 'accessStatus', 'getAWSOrganizationsAccessStatusResponse_accessStatus' - The status of the portfolio share feature.
--
-- 'httpStatus', 'getAWSOrganizationsAccessStatusResponse_httpStatus' - The response's http status code.
newGetAWSOrganizationsAccessStatusResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetAWSOrganizationsAccessStatusResponse
newGetAWSOrganizationsAccessStatusResponse :: Int -> GetAWSOrganizationsAccessStatusResponse
newGetAWSOrganizationsAccessStatusResponse
  Int
pHttpStatus_ =
    GetAWSOrganizationsAccessStatusResponse' :: Maybe AccessStatus
-> Int -> GetAWSOrganizationsAccessStatusResponse
GetAWSOrganizationsAccessStatusResponse'
      { $sel:accessStatus:GetAWSOrganizationsAccessStatusResponse' :: Maybe AccessStatus
accessStatus =
          Maybe AccessStatus
forall a. Maybe a
Prelude.Nothing,
        $sel:httpStatus:GetAWSOrganizationsAccessStatusResponse' :: Int
httpStatus = Int
pHttpStatus_
      }

-- | The status of the portfolio share feature.
getAWSOrganizationsAccessStatusResponse_accessStatus :: Lens.Lens' GetAWSOrganizationsAccessStatusResponse (Prelude.Maybe AccessStatus)
getAWSOrganizationsAccessStatusResponse_accessStatus :: (Maybe AccessStatus -> f (Maybe AccessStatus))
-> GetAWSOrganizationsAccessStatusResponse
-> f GetAWSOrganizationsAccessStatusResponse
getAWSOrganizationsAccessStatusResponse_accessStatus = (GetAWSOrganizationsAccessStatusResponse -> Maybe AccessStatus)
-> (GetAWSOrganizationsAccessStatusResponse
    -> Maybe AccessStatus -> GetAWSOrganizationsAccessStatusResponse)
-> Lens
     GetAWSOrganizationsAccessStatusResponse
     GetAWSOrganizationsAccessStatusResponse
     (Maybe AccessStatus)
     (Maybe AccessStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetAWSOrganizationsAccessStatusResponse' {Maybe AccessStatus
accessStatus :: Maybe AccessStatus
$sel:accessStatus:GetAWSOrganizationsAccessStatusResponse' :: GetAWSOrganizationsAccessStatusResponse -> Maybe AccessStatus
accessStatus} -> Maybe AccessStatus
accessStatus) (\s :: GetAWSOrganizationsAccessStatusResponse
s@GetAWSOrganizationsAccessStatusResponse' {} Maybe AccessStatus
a -> GetAWSOrganizationsAccessStatusResponse
s {$sel:accessStatus:GetAWSOrganizationsAccessStatusResponse' :: Maybe AccessStatus
accessStatus = Maybe AccessStatus
a} :: GetAWSOrganizationsAccessStatusResponse)

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

instance
  Prelude.NFData
    GetAWSOrganizationsAccessStatusResponse