{-# 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.RDS.DeleteInstallationMedia
-- 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 installation medium for a DB engine that requires an
-- on-premises customer provided license, such as Microsoft SQL Server.
module Amazonka.RDS.DeleteInstallationMedia
  ( -- * Creating a Request
    DeleteInstallationMedia (..),
    newDeleteInstallationMedia,

    -- * Request Lenses
    deleteInstallationMedia_installationMediaId,

    -- * Destructuring the Response
    InstallationMedia (..),
    newInstallationMedia,

    -- * Response Lenses
    installationMedia_engineVersion,
    installationMedia_status,
    installationMedia_installationMediaId,
    installationMedia_engineInstallationMediaPath,
    installationMedia_engine,
    installationMedia_oSInstallationMediaPath,
    installationMedia_customAvailabilityZoneId,
    installationMedia_failureCause,
  )
where

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

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

-- |
-- Create a value of 'DeleteInstallationMedia' 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:
--
-- 'installationMediaId', 'deleteInstallationMedia_installationMediaId' - The installation medium ID.
newDeleteInstallationMedia ::
  -- | 'installationMediaId'
  Prelude.Text ->
  DeleteInstallationMedia
newDeleteInstallationMedia :: Text -> DeleteInstallationMedia
newDeleteInstallationMedia Text
pInstallationMediaId_ =
  DeleteInstallationMedia' :: Text -> DeleteInstallationMedia
DeleteInstallationMedia'
    { $sel:installationMediaId:DeleteInstallationMedia' :: Text
installationMediaId =
        Text
pInstallationMediaId_
    }

-- | The installation medium ID.
deleteInstallationMedia_installationMediaId :: Lens.Lens' DeleteInstallationMedia Prelude.Text
deleteInstallationMedia_installationMediaId :: (Text -> f Text)
-> DeleteInstallationMedia -> f DeleteInstallationMedia
deleteInstallationMedia_installationMediaId = (DeleteInstallationMedia -> Text)
-> (DeleteInstallationMedia -> Text -> DeleteInstallationMedia)
-> Lens DeleteInstallationMedia DeleteInstallationMedia Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteInstallationMedia' {Text
installationMediaId :: Text
$sel:installationMediaId:DeleteInstallationMedia' :: DeleteInstallationMedia -> Text
installationMediaId} -> Text
installationMediaId) (\s :: DeleteInstallationMedia
s@DeleteInstallationMedia' {} Text
a -> DeleteInstallationMedia
s {$sel:installationMediaId:DeleteInstallationMedia' :: Text
installationMediaId = Text
a} :: DeleteInstallationMedia)

instance Core.AWSRequest DeleteInstallationMedia where
  type
    AWSResponse DeleteInstallationMedia =
      InstallationMedia
  request :: DeleteInstallationMedia -> Request DeleteInstallationMedia
request = Service
-> DeleteInstallationMedia -> Request DeleteInstallationMedia
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
  response :: Logger
-> Service
-> Proxy DeleteInstallationMedia
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteInstallationMedia)))
response =
    Text
-> (Int
    -> ResponseHeaders
    -> [Node]
    -> Either String (AWSResponse DeleteInstallationMedia))
-> Logger
-> Service
-> Proxy DeleteInstallationMedia
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteInstallationMedia)))
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
"DeleteInstallationMediaResult"
      (\Int
s ResponseHeaders
h [Node]
x -> [Node] -> Either String InstallationMedia
forall a. FromXML a => [Node] -> Either String a
Core.parseXML [Node]
x)

instance Prelude.Hashable DeleteInstallationMedia

instance Prelude.NFData DeleteInstallationMedia

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

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

instance Core.ToQuery DeleteInstallationMedia where
  toQuery :: DeleteInstallationMedia -> QueryString
toQuery DeleteInstallationMedia' {Text
installationMediaId :: Text
$sel:installationMediaId:DeleteInstallationMedia' :: DeleteInstallationMedia -> 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
"DeleteInstallationMedia" :: Prelude.ByteString),
        ByteString
"Version"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2014-10-31" :: Prelude.ByteString),
        ByteString
"InstallationMediaId" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
installationMediaId
      ]