{-# 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.ElasticBeanstalk.DisassociateEnvironmentOperationsRole
-- 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)
--
-- Disassociate the operations role from an environment. After this call is
-- made, Elastic Beanstalk uses the caller\'s permissions for permissions
-- to downstream services during subsequent calls acting on this
-- environment. For more information, see
-- <https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/iam-operationsrole.html Operations roles>
-- in the /AWS Elastic Beanstalk Developer Guide/.
module Amazonka.ElasticBeanstalk.DisassociateEnvironmentOperationsRole
  ( -- * Creating a Request
    DisassociateEnvironmentOperationsRole (..),
    newDisassociateEnvironmentOperationsRole,

    -- * Request Lenses
    disassociateEnvironmentOperationsRole_environmentName,

    -- * Destructuring the Response
    DisassociateEnvironmentOperationsRoleResponse (..),
    newDisassociateEnvironmentOperationsRoleResponse,
  )
where

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

-- | Request to disassociate the operations role from an environment.
--
-- /See:/ 'newDisassociateEnvironmentOperationsRole' smart constructor.
data DisassociateEnvironmentOperationsRole = DisassociateEnvironmentOperationsRole'
  { -- | The name of the environment from which to disassociate the operations
    -- role.
    DisassociateEnvironmentOperationsRole -> Text
environmentName :: Prelude.Text
  }
  deriving (DisassociateEnvironmentOperationsRole
-> DisassociateEnvironmentOperationsRole -> Bool
(DisassociateEnvironmentOperationsRole
 -> DisassociateEnvironmentOperationsRole -> Bool)
-> (DisassociateEnvironmentOperationsRole
    -> DisassociateEnvironmentOperationsRole -> Bool)
-> Eq DisassociateEnvironmentOperationsRole
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DisassociateEnvironmentOperationsRole
-> DisassociateEnvironmentOperationsRole -> Bool
$c/= :: DisassociateEnvironmentOperationsRole
-> DisassociateEnvironmentOperationsRole -> Bool
== :: DisassociateEnvironmentOperationsRole
-> DisassociateEnvironmentOperationsRole -> Bool
$c== :: DisassociateEnvironmentOperationsRole
-> DisassociateEnvironmentOperationsRole -> Bool
Prelude.Eq, ReadPrec [DisassociateEnvironmentOperationsRole]
ReadPrec DisassociateEnvironmentOperationsRole
Int -> ReadS DisassociateEnvironmentOperationsRole
ReadS [DisassociateEnvironmentOperationsRole]
(Int -> ReadS DisassociateEnvironmentOperationsRole)
-> ReadS [DisassociateEnvironmentOperationsRole]
-> ReadPrec DisassociateEnvironmentOperationsRole
-> ReadPrec [DisassociateEnvironmentOperationsRole]
-> Read DisassociateEnvironmentOperationsRole
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DisassociateEnvironmentOperationsRole]
$creadListPrec :: ReadPrec [DisassociateEnvironmentOperationsRole]
readPrec :: ReadPrec DisassociateEnvironmentOperationsRole
$creadPrec :: ReadPrec DisassociateEnvironmentOperationsRole
readList :: ReadS [DisassociateEnvironmentOperationsRole]
$creadList :: ReadS [DisassociateEnvironmentOperationsRole]
readsPrec :: Int -> ReadS DisassociateEnvironmentOperationsRole
$creadsPrec :: Int -> ReadS DisassociateEnvironmentOperationsRole
Prelude.Read, Int -> DisassociateEnvironmentOperationsRole -> ShowS
[DisassociateEnvironmentOperationsRole] -> ShowS
DisassociateEnvironmentOperationsRole -> String
(Int -> DisassociateEnvironmentOperationsRole -> ShowS)
-> (DisassociateEnvironmentOperationsRole -> String)
-> ([DisassociateEnvironmentOperationsRole] -> ShowS)
-> Show DisassociateEnvironmentOperationsRole
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DisassociateEnvironmentOperationsRole] -> ShowS
$cshowList :: [DisassociateEnvironmentOperationsRole] -> ShowS
show :: DisassociateEnvironmentOperationsRole -> String
$cshow :: DisassociateEnvironmentOperationsRole -> String
showsPrec :: Int -> DisassociateEnvironmentOperationsRole -> ShowS
$cshowsPrec :: Int -> DisassociateEnvironmentOperationsRole -> ShowS
Prelude.Show, (forall x.
 DisassociateEnvironmentOperationsRole
 -> Rep DisassociateEnvironmentOperationsRole x)
-> (forall x.
    Rep DisassociateEnvironmentOperationsRole x
    -> DisassociateEnvironmentOperationsRole)
-> Generic DisassociateEnvironmentOperationsRole
forall x.
Rep DisassociateEnvironmentOperationsRole x
-> DisassociateEnvironmentOperationsRole
forall x.
DisassociateEnvironmentOperationsRole
-> Rep DisassociateEnvironmentOperationsRole x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DisassociateEnvironmentOperationsRole x
-> DisassociateEnvironmentOperationsRole
$cfrom :: forall x.
DisassociateEnvironmentOperationsRole
-> Rep DisassociateEnvironmentOperationsRole x
Prelude.Generic)

-- |
-- Create a value of 'DisassociateEnvironmentOperationsRole' 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:
--
-- 'environmentName', 'disassociateEnvironmentOperationsRole_environmentName' - The name of the environment from which to disassociate the operations
-- role.
newDisassociateEnvironmentOperationsRole ::
  -- | 'environmentName'
  Prelude.Text ->
  DisassociateEnvironmentOperationsRole
newDisassociateEnvironmentOperationsRole :: Text -> DisassociateEnvironmentOperationsRole
newDisassociateEnvironmentOperationsRole
  Text
pEnvironmentName_ =
    DisassociateEnvironmentOperationsRole' :: Text -> DisassociateEnvironmentOperationsRole
DisassociateEnvironmentOperationsRole'
      { $sel:environmentName:DisassociateEnvironmentOperationsRole' :: Text
environmentName =
          Text
pEnvironmentName_
      }

-- | The name of the environment from which to disassociate the operations
-- role.
disassociateEnvironmentOperationsRole_environmentName :: Lens.Lens' DisassociateEnvironmentOperationsRole Prelude.Text
disassociateEnvironmentOperationsRole_environmentName :: (Text -> f Text)
-> DisassociateEnvironmentOperationsRole
-> f DisassociateEnvironmentOperationsRole
disassociateEnvironmentOperationsRole_environmentName = (DisassociateEnvironmentOperationsRole -> Text)
-> (DisassociateEnvironmentOperationsRole
    -> Text -> DisassociateEnvironmentOperationsRole)
-> Lens
     DisassociateEnvironmentOperationsRole
     DisassociateEnvironmentOperationsRole
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DisassociateEnvironmentOperationsRole' {Text
environmentName :: Text
$sel:environmentName:DisassociateEnvironmentOperationsRole' :: DisassociateEnvironmentOperationsRole -> Text
environmentName} -> Text
environmentName) (\s :: DisassociateEnvironmentOperationsRole
s@DisassociateEnvironmentOperationsRole' {} Text
a -> DisassociateEnvironmentOperationsRole
s {$sel:environmentName:DisassociateEnvironmentOperationsRole' :: Text
environmentName = Text
a} :: DisassociateEnvironmentOperationsRole)

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

instance
  Prelude.Hashable
    DisassociateEnvironmentOperationsRole

instance
  Prelude.NFData
    DisassociateEnvironmentOperationsRole

instance
  Core.ToHeaders
    DisassociateEnvironmentOperationsRole
  where
  toHeaders :: DisassociateEnvironmentOperationsRole -> [Header]
toHeaders = [Header] -> DisassociateEnvironmentOperationsRole -> [Header]
forall a b. a -> b -> a
Prelude.const [Header]
forall a. Monoid a => a
Prelude.mempty

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

instance
  Core.ToQuery
    DisassociateEnvironmentOperationsRole
  where
  toQuery :: DisassociateEnvironmentOperationsRole -> QueryString
toQuery DisassociateEnvironmentOperationsRole' {Text
environmentName :: Text
$sel:environmentName:DisassociateEnvironmentOperationsRole' :: DisassociateEnvironmentOperationsRole -> Text
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"Action"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: ( ByteString
"DisassociateEnvironmentOperationsRole" ::
                      Prelude.ByteString
                  ),
        ByteString
"Version"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2010-12-01" :: Prelude.ByteString),
        ByteString
"EnvironmentName" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
environmentName
      ]

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

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

instance
  Prelude.NFData
    DisassociateEnvironmentOperationsRoleResponse