{-# 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.DeletePlatformVersion
-- 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)
--
-- Deletes the specified version of a custom platform.
module Amazonka.ElasticBeanstalk.DeletePlatformVersion
  ( -- * Creating a Request
    DeletePlatformVersion (..),
    newDeletePlatformVersion,

    -- * Request Lenses
    deletePlatformVersion_platformArn,

    -- * Destructuring the Response
    DeletePlatformVersionResponse (..),
    newDeletePlatformVersionResponse,

    -- * Response Lenses
    deletePlatformVersionResponse_platformSummary,
    deletePlatformVersionResponse_httpStatus,
  )
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:/ 'newDeletePlatformVersion' smart constructor.
data DeletePlatformVersion = DeletePlatformVersion'
  { -- | The ARN of the version of the custom platform.
    DeletePlatformVersion -> Maybe Text
platformArn :: Prelude.Maybe Prelude.Text
  }
  deriving (DeletePlatformVersion -> DeletePlatformVersion -> Bool
(DeletePlatformVersion -> DeletePlatformVersion -> Bool)
-> (DeletePlatformVersion -> DeletePlatformVersion -> Bool)
-> Eq DeletePlatformVersion
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeletePlatformVersion -> DeletePlatformVersion -> Bool
$c/= :: DeletePlatformVersion -> DeletePlatformVersion -> Bool
== :: DeletePlatformVersion -> DeletePlatformVersion -> Bool
$c== :: DeletePlatformVersion -> DeletePlatformVersion -> Bool
Prelude.Eq, ReadPrec [DeletePlatformVersion]
ReadPrec DeletePlatformVersion
Int -> ReadS DeletePlatformVersion
ReadS [DeletePlatformVersion]
(Int -> ReadS DeletePlatformVersion)
-> ReadS [DeletePlatformVersion]
-> ReadPrec DeletePlatformVersion
-> ReadPrec [DeletePlatformVersion]
-> Read DeletePlatformVersion
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeletePlatformVersion]
$creadListPrec :: ReadPrec [DeletePlatformVersion]
readPrec :: ReadPrec DeletePlatformVersion
$creadPrec :: ReadPrec DeletePlatformVersion
readList :: ReadS [DeletePlatformVersion]
$creadList :: ReadS [DeletePlatformVersion]
readsPrec :: Int -> ReadS DeletePlatformVersion
$creadsPrec :: Int -> ReadS DeletePlatformVersion
Prelude.Read, Int -> DeletePlatformVersion -> ShowS
[DeletePlatformVersion] -> ShowS
DeletePlatformVersion -> String
(Int -> DeletePlatformVersion -> ShowS)
-> (DeletePlatformVersion -> String)
-> ([DeletePlatformVersion] -> ShowS)
-> Show DeletePlatformVersion
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeletePlatformVersion] -> ShowS
$cshowList :: [DeletePlatformVersion] -> ShowS
show :: DeletePlatformVersion -> String
$cshow :: DeletePlatformVersion -> String
showsPrec :: Int -> DeletePlatformVersion -> ShowS
$cshowsPrec :: Int -> DeletePlatformVersion -> ShowS
Prelude.Show, (forall x. DeletePlatformVersion -> Rep DeletePlatformVersion x)
-> (forall x. Rep DeletePlatformVersion x -> DeletePlatformVersion)
-> Generic DeletePlatformVersion
forall x. Rep DeletePlatformVersion x -> DeletePlatformVersion
forall x. DeletePlatformVersion -> Rep DeletePlatformVersion x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeletePlatformVersion x -> DeletePlatformVersion
$cfrom :: forall x. DeletePlatformVersion -> Rep DeletePlatformVersion x
Prelude.Generic)

-- |
-- Create a value of 'DeletePlatformVersion' 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:
--
-- 'platformArn', 'deletePlatformVersion_platformArn' - The ARN of the version of the custom platform.
newDeletePlatformVersion ::
  DeletePlatformVersion
newDeletePlatformVersion :: DeletePlatformVersion
newDeletePlatformVersion =
  DeletePlatformVersion' :: Maybe Text -> DeletePlatformVersion
DeletePlatformVersion'
    { $sel:platformArn:DeletePlatformVersion' :: Maybe Text
platformArn =
        Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The ARN of the version of the custom platform.
deletePlatformVersion_platformArn :: Lens.Lens' DeletePlatformVersion (Prelude.Maybe Prelude.Text)
deletePlatformVersion_platformArn :: (Maybe Text -> f (Maybe Text))
-> DeletePlatformVersion -> f DeletePlatformVersion
deletePlatformVersion_platformArn = (DeletePlatformVersion -> Maybe Text)
-> (DeletePlatformVersion -> Maybe Text -> DeletePlatformVersion)
-> Lens
     DeletePlatformVersion
     DeletePlatformVersion
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeletePlatformVersion' {Maybe Text
platformArn :: Maybe Text
$sel:platformArn:DeletePlatformVersion' :: DeletePlatformVersion -> Maybe Text
platformArn} -> Maybe Text
platformArn) (\s :: DeletePlatformVersion
s@DeletePlatformVersion' {} Maybe Text
a -> DeletePlatformVersion
s {$sel:platformArn:DeletePlatformVersion' :: Maybe Text
platformArn = Maybe Text
a} :: DeletePlatformVersion)

instance Core.AWSRequest DeletePlatformVersion where
  type
    AWSResponse DeletePlatformVersion =
      DeletePlatformVersionResponse
  request :: DeletePlatformVersion -> Request DeletePlatformVersion
request = Service -> DeletePlatformVersion -> Request DeletePlatformVersion
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
  response :: Logger
-> Service
-> Proxy DeletePlatformVersion
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeletePlatformVersion)))
response =
    Text
-> (Int
    -> ResponseHeaders
    -> [Node]
    -> Either String (AWSResponse DeletePlatformVersion))
-> Logger
-> Service
-> Proxy DeletePlatformVersion
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeletePlatformVersion)))
forall (m :: * -> *) a.
MonadResource m =>
Text
-> (Int
    -> ResponseHeaders -> [Node] -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveXMLWrapper
      Text
"DeletePlatformVersionResult"
      ( \Int
s ResponseHeaders
h [Node]
x ->
          Maybe PlatformSummary -> Int -> DeletePlatformVersionResponse
DeletePlatformVersionResponse'
            (Maybe PlatformSummary -> Int -> DeletePlatformVersionResponse)
-> Either String (Maybe PlatformSummary)
-> Either String (Int -> DeletePlatformVersionResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String (Maybe PlatformSummary)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"PlatformSummary")
            Either String (Int -> DeletePlatformVersionResponse)
-> Either String Int -> Either String DeletePlatformVersionResponse
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 DeletePlatformVersion

instance Prelude.NFData DeletePlatformVersion

instance Core.ToHeaders DeletePlatformVersion where
  toHeaders :: DeletePlatformVersion -> ResponseHeaders
toHeaders = ResponseHeaders -> DeletePlatformVersion -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty

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

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

-- | /See:/ 'newDeletePlatformVersionResponse' smart constructor.
data DeletePlatformVersionResponse = DeletePlatformVersionResponse'
  { -- | Detailed information about the version of the custom platform.
    DeletePlatformVersionResponse -> Maybe PlatformSummary
platformSummary :: Prelude.Maybe PlatformSummary,
    -- | The response's http status code.
    DeletePlatformVersionResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DeletePlatformVersionResponse
-> DeletePlatformVersionResponse -> Bool
(DeletePlatformVersionResponse
 -> DeletePlatformVersionResponse -> Bool)
-> (DeletePlatformVersionResponse
    -> DeletePlatformVersionResponse -> Bool)
-> Eq DeletePlatformVersionResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeletePlatformVersionResponse
-> DeletePlatformVersionResponse -> Bool
$c/= :: DeletePlatformVersionResponse
-> DeletePlatformVersionResponse -> Bool
== :: DeletePlatformVersionResponse
-> DeletePlatformVersionResponse -> Bool
$c== :: DeletePlatformVersionResponse
-> DeletePlatformVersionResponse -> Bool
Prelude.Eq, ReadPrec [DeletePlatformVersionResponse]
ReadPrec DeletePlatformVersionResponse
Int -> ReadS DeletePlatformVersionResponse
ReadS [DeletePlatformVersionResponse]
(Int -> ReadS DeletePlatformVersionResponse)
-> ReadS [DeletePlatformVersionResponse]
-> ReadPrec DeletePlatformVersionResponse
-> ReadPrec [DeletePlatformVersionResponse]
-> Read DeletePlatformVersionResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeletePlatformVersionResponse]
$creadListPrec :: ReadPrec [DeletePlatformVersionResponse]
readPrec :: ReadPrec DeletePlatformVersionResponse
$creadPrec :: ReadPrec DeletePlatformVersionResponse
readList :: ReadS [DeletePlatformVersionResponse]
$creadList :: ReadS [DeletePlatformVersionResponse]
readsPrec :: Int -> ReadS DeletePlatformVersionResponse
$creadsPrec :: Int -> ReadS DeletePlatformVersionResponse
Prelude.Read, Int -> DeletePlatformVersionResponse -> ShowS
[DeletePlatformVersionResponse] -> ShowS
DeletePlatformVersionResponse -> String
(Int -> DeletePlatformVersionResponse -> ShowS)
-> (DeletePlatformVersionResponse -> String)
-> ([DeletePlatformVersionResponse] -> ShowS)
-> Show DeletePlatformVersionResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeletePlatformVersionResponse] -> ShowS
$cshowList :: [DeletePlatformVersionResponse] -> ShowS
show :: DeletePlatformVersionResponse -> String
$cshow :: DeletePlatformVersionResponse -> String
showsPrec :: Int -> DeletePlatformVersionResponse -> ShowS
$cshowsPrec :: Int -> DeletePlatformVersionResponse -> ShowS
Prelude.Show, (forall x.
 DeletePlatformVersionResponse
 -> Rep DeletePlatformVersionResponse x)
-> (forall x.
    Rep DeletePlatformVersionResponse x
    -> DeletePlatformVersionResponse)
-> Generic DeletePlatformVersionResponse
forall x.
Rep DeletePlatformVersionResponse x
-> DeletePlatformVersionResponse
forall x.
DeletePlatformVersionResponse
-> Rep DeletePlatformVersionResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DeletePlatformVersionResponse x
-> DeletePlatformVersionResponse
$cfrom :: forall x.
DeletePlatformVersionResponse
-> Rep DeletePlatformVersionResponse x
Prelude.Generic)

-- |
-- Create a value of 'DeletePlatformVersionResponse' 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:
--
-- 'platformSummary', 'deletePlatformVersionResponse_platformSummary' - Detailed information about the version of the custom platform.
--
-- 'httpStatus', 'deletePlatformVersionResponse_httpStatus' - The response's http status code.
newDeletePlatformVersionResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DeletePlatformVersionResponse
newDeletePlatformVersionResponse :: Int -> DeletePlatformVersionResponse
newDeletePlatformVersionResponse Int
pHttpStatus_ =
  DeletePlatformVersionResponse' :: Maybe PlatformSummary -> Int -> DeletePlatformVersionResponse
DeletePlatformVersionResponse'
    { $sel:platformSummary:DeletePlatformVersionResponse' :: Maybe PlatformSummary
platformSummary =
        Maybe PlatformSummary
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DeletePlatformVersionResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | Detailed information about the version of the custom platform.
deletePlatformVersionResponse_platformSummary :: Lens.Lens' DeletePlatformVersionResponse (Prelude.Maybe PlatformSummary)
deletePlatformVersionResponse_platformSummary :: (Maybe PlatformSummary -> f (Maybe PlatformSummary))
-> DeletePlatformVersionResponse -> f DeletePlatformVersionResponse
deletePlatformVersionResponse_platformSummary = (DeletePlatformVersionResponse -> Maybe PlatformSummary)
-> (DeletePlatformVersionResponse
    -> Maybe PlatformSummary -> DeletePlatformVersionResponse)
-> Lens
     DeletePlatformVersionResponse
     DeletePlatformVersionResponse
     (Maybe PlatformSummary)
     (Maybe PlatformSummary)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeletePlatformVersionResponse' {Maybe PlatformSummary
platformSummary :: Maybe PlatformSummary
$sel:platformSummary:DeletePlatformVersionResponse' :: DeletePlatformVersionResponse -> Maybe PlatformSummary
platformSummary} -> Maybe PlatformSummary
platformSummary) (\s :: DeletePlatformVersionResponse
s@DeletePlatformVersionResponse' {} Maybe PlatformSummary
a -> DeletePlatformVersionResponse
s {$sel:platformSummary:DeletePlatformVersionResponse' :: Maybe PlatformSummary
platformSummary = Maybe PlatformSummary
a} :: DeletePlatformVersionResponse)

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

instance Prelude.NFData DeletePlatformVersionResponse