{-# 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.AbortEnvironmentUpdate
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Cancels in-progress environment configuration update or application
-- version deployment.
module Amazonka.ElasticBeanstalk.AbortEnvironmentUpdate
  ( -- * Creating a Request
    AbortEnvironmentUpdate (..),
    newAbortEnvironmentUpdate,

    -- * Request Lenses
    abortEnvironmentUpdate_environmentId,
    abortEnvironmentUpdate_environmentName,

    -- * Destructuring the Response
    AbortEnvironmentUpdateResponse (..),
    newAbortEnvironmentUpdateResponse,
  )
where

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

-- |
--
-- /See:/ 'newAbortEnvironmentUpdate' smart constructor.
data AbortEnvironmentUpdate = AbortEnvironmentUpdate'
  { -- | This specifies the ID of the environment with the in-progress update
    -- that you want to cancel.
    AbortEnvironmentUpdate -> Maybe Text
environmentId :: Prelude.Maybe Prelude.Text,
    -- | This specifies the name of the environment with the in-progress update
    -- that you want to cancel.
    AbortEnvironmentUpdate -> Maybe Text
environmentName :: Prelude.Maybe Prelude.Text
  }
  deriving (AbortEnvironmentUpdate -> AbortEnvironmentUpdate -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AbortEnvironmentUpdate -> AbortEnvironmentUpdate -> Bool
$c/= :: AbortEnvironmentUpdate -> AbortEnvironmentUpdate -> Bool
== :: AbortEnvironmentUpdate -> AbortEnvironmentUpdate -> Bool
$c== :: AbortEnvironmentUpdate -> AbortEnvironmentUpdate -> Bool
Prelude.Eq, ReadPrec [AbortEnvironmentUpdate]
ReadPrec AbortEnvironmentUpdate
Int -> ReadS AbortEnvironmentUpdate
ReadS [AbortEnvironmentUpdate]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AbortEnvironmentUpdate]
$creadListPrec :: ReadPrec [AbortEnvironmentUpdate]
readPrec :: ReadPrec AbortEnvironmentUpdate
$creadPrec :: ReadPrec AbortEnvironmentUpdate
readList :: ReadS [AbortEnvironmentUpdate]
$creadList :: ReadS [AbortEnvironmentUpdate]
readsPrec :: Int -> ReadS AbortEnvironmentUpdate
$creadsPrec :: Int -> ReadS AbortEnvironmentUpdate
Prelude.Read, Int -> AbortEnvironmentUpdate -> ShowS
[AbortEnvironmentUpdate] -> ShowS
AbortEnvironmentUpdate -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AbortEnvironmentUpdate] -> ShowS
$cshowList :: [AbortEnvironmentUpdate] -> ShowS
show :: AbortEnvironmentUpdate -> String
$cshow :: AbortEnvironmentUpdate -> String
showsPrec :: Int -> AbortEnvironmentUpdate -> ShowS
$cshowsPrec :: Int -> AbortEnvironmentUpdate -> ShowS
Prelude.Show, forall x. Rep AbortEnvironmentUpdate x -> AbortEnvironmentUpdate
forall x. AbortEnvironmentUpdate -> Rep AbortEnvironmentUpdate x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AbortEnvironmentUpdate x -> AbortEnvironmentUpdate
$cfrom :: forall x. AbortEnvironmentUpdate -> Rep AbortEnvironmentUpdate x
Prelude.Generic)

-- |
-- Create a value of 'AbortEnvironmentUpdate' 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:
--
-- 'environmentId', 'abortEnvironmentUpdate_environmentId' - This specifies the ID of the environment with the in-progress update
-- that you want to cancel.
--
-- 'environmentName', 'abortEnvironmentUpdate_environmentName' - This specifies the name of the environment with the in-progress update
-- that you want to cancel.
newAbortEnvironmentUpdate ::
  AbortEnvironmentUpdate
newAbortEnvironmentUpdate :: AbortEnvironmentUpdate
newAbortEnvironmentUpdate =
  AbortEnvironmentUpdate'
    { $sel:environmentId:AbortEnvironmentUpdate' :: Maybe Text
environmentId =
        forall a. Maybe a
Prelude.Nothing,
      $sel:environmentName:AbortEnvironmentUpdate' :: Maybe Text
environmentName = forall a. Maybe a
Prelude.Nothing
    }

-- | This specifies the ID of the environment with the in-progress update
-- that you want to cancel.
abortEnvironmentUpdate_environmentId :: Lens.Lens' AbortEnvironmentUpdate (Prelude.Maybe Prelude.Text)
abortEnvironmentUpdate_environmentId :: Lens' AbortEnvironmentUpdate (Maybe Text)
abortEnvironmentUpdate_environmentId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AbortEnvironmentUpdate' {Maybe Text
environmentId :: Maybe Text
$sel:environmentId:AbortEnvironmentUpdate' :: AbortEnvironmentUpdate -> Maybe Text
environmentId} -> Maybe Text
environmentId) (\s :: AbortEnvironmentUpdate
s@AbortEnvironmentUpdate' {} Maybe Text
a -> AbortEnvironmentUpdate
s {$sel:environmentId:AbortEnvironmentUpdate' :: Maybe Text
environmentId = Maybe Text
a} :: AbortEnvironmentUpdate)

-- | This specifies the name of the environment with the in-progress update
-- that you want to cancel.
abortEnvironmentUpdate_environmentName :: Lens.Lens' AbortEnvironmentUpdate (Prelude.Maybe Prelude.Text)
abortEnvironmentUpdate_environmentName :: Lens' AbortEnvironmentUpdate (Maybe Text)
abortEnvironmentUpdate_environmentName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AbortEnvironmentUpdate' {Maybe Text
environmentName :: Maybe Text
$sel:environmentName:AbortEnvironmentUpdate' :: AbortEnvironmentUpdate -> Maybe Text
environmentName} -> Maybe Text
environmentName) (\s :: AbortEnvironmentUpdate
s@AbortEnvironmentUpdate' {} Maybe Text
a -> AbortEnvironmentUpdate
s {$sel:environmentName:AbortEnvironmentUpdate' :: Maybe Text
environmentName = Maybe Text
a} :: AbortEnvironmentUpdate)

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

instance Prelude.Hashable AbortEnvironmentUpdate where
  hashWithSalt :: Int -> AbortEnvironmentUpdate -> Int
hashWithSalt Int
_salt AbortEnvironmentUpdate' {Maybe Text
environmentName :: Maybe Text
environmentId :: Maybe Text
$sel:environmentName:AbortEnvironmentUpdate' :: AbortEnvironmentUpdate -> Maybe Text
$sel:environmentId:AbortEnvironmentUpdate' :: AbortEnvironmentUpdate -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
environmentId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
environmentName

instance Prelude.NFData AbortEnvironmentUpdate where
  rnf :: AbortEnvironmentUpdate -> ()
rnf AbortEnvironmentUpdate' {Maybe Text
environmentName :: Maybe Text
environmentId :: Maybe Text
$sel:environmentName:AbortEnvironmentUpdate' :: AbortEnvironmentUpdate -> Maybe Text
$sel:environmentId:AbortEnvironmentUpdate' :: AbortEnvironmentUpdate -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
environmentId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
environmentName

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

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

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

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

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

instance
  Prelude.NFData
    AbortEnvironmentUpdateResponse
  where
  rnf :: AbortEnvironmentUpdateResponse -> ()
rnf AbortEnvironmentUpdateResponse
_ = ()