{-# 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-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)
--
-- Cancels in-progress environment configuration update or application
-- version deployment.
module Amazonka.ElasticBeanstalk.AbortEnvironmentUpdate
  ( -- * Creating a Request
    AbortEnvironmentUpdate (..),
    newAbortEnvironmentUpdate,

    -- * Request Lenses
    abortEnvironmentUpdate_environmentName,
    abortEnvironmentUpdate_environmentId,

    -- * Destructuring the Response
    AbortEnvironmentUpdateResponse (..),
    newAbortEnvironmentUpdateResponse,
  )
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

-- |
--
-- /See:/ 'newAbortEnvironmentUpdate' smart constructor.
data AbortEnvironmentUpdate = AbortEnvironmentUpdate'
  { -- | 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,
    -- | 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
  }
  deriving (AbortEnvironmentUpdate -> AbortEnvironmentUpdate -> Bool
(AbortEnvironmentUpdate -> AbortEnvironmentUpdate -> Bool)
-> (AbortEnvironmentUpdate -> AbortEnvironmentUpdate -> Bool)
-> Eq AbortEnvironmentUpdate
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]
(Int -> ReadS AbortEnvironmentUpdate)
-> ReadS [AbortEnvironmentUpdate]
-> ReadPrec AbortEnvironmentUpdate
-> ReadPrec [AbortEnvironmentUpdate]
-> Read 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
(Int -> AbortEnvironmentUpdate -> ShowS)
-> (AbortEnvironmentUpdate -> String)
-> ([AbortEnvironmentUpdate] -> ShowS)
-> Show AbortEnvironmentUpdate
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. AbortEnvironmentUpdate -> Rep AbortEnvironmentUpdate x)
-> (forall x.
    Rep AbortEnvironmentUpdate x -> AbortEnvironmentUpdate)
-> Generic AbortEnvironmentUpdate
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:
--
-- 'environmentName', 'abortEnvironmentUpdate_environmentName' - This specifies the name of the environment with the in-progress update
-- that you want to cancel.
--
-- 'environmentId', 'abortEnvironmentUpdate_environmentId' - This specifies the ID of the environment with the in-progress update
-- that you want to cancel.
newAbortEnvironmentUpdate ::
  AbortEnvironmentUpdate
newAbortEnvironmentUpdate :: AbortEnvironmentUpdate
newAbortEnvironmentUpdate =
  AbortEnvironmentUpdate' :: Maybe Text -> Maybe Text -> AbortEnvironmentUpdate
AbortEnvironmentUpdate'
    { $sel:environmentName:AbortEnvironmentUpdate' :: Maybe Text
environmentName =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:environmentId:AbortEnvironmentUpdate' :: Maybe Text
environmentId = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | 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 :: (Maybe Text -> f (Maybe Text))
-> AbortEnvironmentUpdate -> f AbortEnvironmentUpdate
abortEnvironmentUpdate_environmentName = (AbortEnvironmentUpdate -> Maybe Text)
-> (AbortEnvironmentUpdate -> Maybe Text -> AbortEnvironmentUpdate)
-> Lens
     AbortEnvironmentUpdate
     AbortEnvironmentUpdate
     (Maybe Text)
     (Maybe Text)
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)

-- | 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 :: (Maybe Text -> f (Maybe Text))
-> AbortEnvironmentUpdate -> f AbortEnvironmentUpdate
abortEnvironmentUpdate_environmentId = (AbortEnvironmentUpdate -> Maybe Text)
-> (AbortEnvironmentUpdate -> Maybe Text -> AbortEnvironmentUpdate)
-> Lens
     AbortEnvironmentUpdate
     AbortEnvironmentUpdate
     (Maybe Text)
     (Maybe Text)
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)

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

instance Prelude.Hashable AbortEnvironmentUpdate

instance Prelude.NFData AbortEnvironmentUpdate

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

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

instance Core.ToQuery AbortEnvironmentUpdate where
  toQuery :: AbortEnvironmentUpdate -> QueryString
toQuery AbortEnvironmentUpdate' {Maybe Text
environmentId :: Maybe Text
environmentName :: Maybe Text
$sel:environmentId:AbortEnvironmentUpdate' :: AbortEnvironmentUpdate -> Maybe Text
$sel:environmentName:AbortEnvironmentUpdate' :: AbortEnvironmentUpdate -> Maybe 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
"AbortEnvironmentUpdate" :: Prelude.ByteString),
        ByteString
"Version"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2010-12-01" :: Prelude.ByteString),
        ByteString
"EnvironmentName" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
environmentName,
        ByteString
"EnvironmentId" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
environmentId
      ]

-- | /See:/ 'newAbortEnvironmentUpdateResponse' smart constructor.
data AbortEnvironmentUpdateResponse = AbortEnvironmentUpdateResponse'
  {
  }
  deriving (AbortEnvironmentUpdateResponse
-> AbortEnvironmentUpdateResponse -> Bool
(AbortEnvironmentUpdateResponse
 -> AbortEnvironmentUpdateResponse -> Bool)
-> (AbortEnvironmentUpdateResponse
    -> AbortEnvironmentUpdateResponse -> Bool)
-> Eq AbortEnvironmentUpdateResponse
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]
(Int -> ReadS AbortEnvironmentUpdateResponse)
-> ReadS [AbortEnvironmentUpdateResponse]
-> ReadPrec AbortEnvironmentUpdateResponse
-> ReadPrec [AbortEnvironmentUpdateResponse]
-> Read 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
(Int -> AbortEnvironmentUpdateResponse -> ShowS)
-> (AbortEnvironmentUpdateResponse -> String)
-> ([AbortEnvironmentUpdateResponse] -> ShowS)
-> Show AbortEnvironmentUpdateResponse
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.
 AbortEnvironmentUpdateResponse
 -> Rep AbortEnvironmentUpdateResponse x)
-> (forall x.
    Rep AbortEnvironmentUpdateResponse x
    -> AbortEnvironmentUpdateResponse)
-> Generic AbortEnvironmentUpdateResponse
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