{-# 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.RAM.EnableSharingWithAwsOrganization
-- 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)
--
-- Enables resource sharing within your organization in Organizations.
--
-- The caller must be the master account for the organization.
module Amazonka.RAM.EnableSharingWithAwsOrganization
  ( -- * Creating a Request
    EnableSharingWithAwsOrganization (..),
    newEnableSharingWithAwsOrganization,

    -- * Destructuring the Response
    EnableSharingWithAwsOrganizationResponse (..),
    newEnableSharingWithAwsOrganizationResponse,

    -- * Response Lenses
    enableSharingWithAwsOrganizationResponse_returnValue,
    enableSharingWithAwsOrganizationResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.RAM.Types
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

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

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

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

instance
  Prelude.NFData
    EnableSharingWithAwsOrganization

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

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

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

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

-- |
-- Create a value of 'EnableSharingWithAwsOrganizationResponse' 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:
--
-- 'returnValue', 'enableSharingWithAwsOrganizationResponse_returnValue' - Indicates whether the request succeeded.
--
-- 'httpStatus', 'enableSharingWithAwsOrganizationResponse_httpStatus' - The response's http status code.
newEnableSharingWithAwsOrganizationResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  EnableSharingWithAwsOrganizationResponse
newEnableSharingWithAwsOrganizationResponse :: Int -> EnableSharingWithAwsOrganizationResponse
newEnableSharingWithAwsOrganizationResponse
  Int
pHttpStatus_ =
    EnableSharingWithAwsOrganizationResponse' :: Maybe Bool -> Int -> EnableSharingWithAwsOrganizationResponse
EnableSharingWithAwsOrganizationResponse'
      { $sel:returnValue:EnableSharingWithAwsOrganizationResponse' :: Maybe Bool
returnValue =
          Maybe Bool
forall a. Maybe a
Prelude.Nothing,
        $sel:httpStatus:EnableSharingWithAwsOrganizationResponse' :: Int
httpStatus = Int
pHttpStatus_
      }

-- | Indicates whether the request succeeded.
enableSharingWithAwsOrganizationResponse_returnValue :: Lens.Lens' EnableSharingWithAwsOrganizationResponse (Prelude.Maybe Prelude.Bool)
enableSharingWithAwsOrganizationResponse_returnValue :: (Maybe Bool -> f (Maybe Bool))
-> EnableSharingWithAwsOrganizationResponse
-> f EnableSharingWithAwsOrganizationResponse
enableSharingWithAwsOrganizationResponse_returnValue = (EnableSharingWithAwsOrganizationResponse -> Maybe Bool)
-> (EnableSharingWithAwsOrganizationResponse
    -> Maybe Bool -> EnableSharingWithAwsOrganizationResponse)
-> Lens
     EnableSharingWithAwsOrganizationResponse
     EnableSharingWithAwsOrganizationResponse
     (Maybe Bool)
     (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EnableSharingWithAwsOrganizationResponse' {Maybe Bool
returnValue :: Maybe Bool
$sel:returnValue:EnableSharingWithAwsOrganizationResponse' :: EnableSharingWithAwsOrganizationResponse -> Maybe Bool
returnValue} -> Maybe Bool
returnValue) (\s :: EnableSharingWithAwsOrganizationResponse
s@EnableSharingWithAwsOrganizationResponse' {} Maybe Bool
a -> EnableSharingWithAwsOrganizationResponse
s {$sel:returnValue:EnableSharingWithAwsOrganizationResponse' :: Maybe Bool
returnValue = Maybe Bool
a} :: EnableSharingWithAwsOrganizationResponse)

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

instance
  Prelude.NFData
    EnableSharingWithAwsOrganizationResponse