{-# 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.RolesAnywhere.DisableProfile
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Disables a profile. When disabled,
-- <https://docs.aws.amazon.com/rolesanywhere/latest/APIReference/API_CreateSession.html CreateSession>
-- requests with this profile fail.
--
-- __Required permissions:__ @rolesanywhere:DisableProfile@.
module Amazonka.RolesAnywhere.DisableProfile
  ( -- * Creating a Request
    DisableProfile (..),
    newDisableProfile,

    -- * Request Lenses
    disableProfile_profileId,

    -- * Destructuring the Response
    ProfileDetailResponse (..),
    newProfileDetailResponse,

    -- * Response Lenses
    profileDetailResponse_profile,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
import Amazonka.RolesAnywhere.Types

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

-- |
-- Create a value of 'DisableProfile' 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:
--
-- 'profileId', 'disableProfile_profileId' - The unique identifier of the profile.
newDisableProfile ::
  -- | 'profileId'
  Prelude.Text ->
  DisableProfile
newDisableProfile :: Text -> DisableProfile
newDisableProfile Text
pProfileId_ =
  DisableProfile' {$sel:profileId:DisableProfile' :: Text
profileId = Text
pProfileId_}

-- | The unique identifier of the profile.
disableProfile_profileId :: Lens.Lens' DisableProfile Prelude.Text
disableProfile_profileId :: Lens' DisableProfile Text
disableProfile_profileId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DisableProfile' {Text
profileId :: Text
$sel:profileId:DisableProfile' :: DisableProfile -> Text
profileId} -> Text
profileId) (\s :: DisableProfile
s@DisableProfile' {} Text
a -> DisableProfile
s {$sel:profileId:DisableProfile' :: Text
profileId = Text
a} :: DisableProfile)

instance Core.AWSRequest DisableProfile where
  type
    AWSResponse DisableProfile =
      ProfileDetailResponse
  request :: (Service -> Service) -> DisableProfile -> Request DisableProfile
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy DisableProfile
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DisableProfile)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      (\Int
s ResponseHeaders
h Object
x -> forall a. FromJSON a => Object -> Either String a
Data.eitherParseJSON Object
x)

instance Prelude.Hashable DisableProfile where
  hashWithSalt :: Int -> DisableProfile -> Int
hashWithSalt Int
_salt DisableProfile' {Text
profileId :: Text
$sel:profileId:DisableProfile' :: DisableProfile -> Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
profileId

instance Prelude.NFData DisableProfile where
  rnf :: DisableProfile -> ()
rnf DisableProfile' {Text
profileId :: Text
$sel:profileId:DisableProfile' :: DisableProfile -> Text
..} = forall a. NFData a => a -> ()
Prelude.rnf Text
profileId

instance Data.ToHeaders DisableProfile where
  toHeaders :: DisableProfile -> ResponseHeaders
toHeaders =
    forall a b. a -> b -> a
Prelude.const
      ( forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"Content-Type"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

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

instance Data.ToPath DisableProfile where
  toPath :: DisableProfile -> ByteString
toPath DisableProfile' {Text
profileId :: Text
$sel:profileId:DisableProfile' :: DisableProfile -> Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ByteString
"/profile/", forall a. ToByteString a => a -> ByteString
Data.toBS Text
profileId, ByteString
"/disable"]

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