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

    -- * Request Lenses
    importInstallationMedia_customAvailabilityZoneId,
    importInstallationMedia_engine,
    importInstallationMedia_engineVersion,
    importInstallationMedia_engineInstallationMediaPath,
    importInstallationMedia_oSInstallationMediaPath,

    -- * 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:/ 'newImportInstallationMedia' smart constructor.
data ImportInstallationMedia = ImportInstallationMedia'
  { -- | The identifier of the custom Availability Zone (AZ) to import the
    -- installation media to.
    ImportInstallationMedia -> Text
customAvailabilityZoneId :: Prelude.Text,
    -- | The name of the database engine to be used for this instance.
    --
    -- The list only includes supported DB engines that require an on-premises
    -- customer provided license.
    --
    -- Valid Values:
    --
    -- -   @sqlserver-ee@
    --
    -- -   @sqlserver-se@
    --
    -- -   @sqlserver-ex@
    --
    -- -   @sqlserver-web@
    ImportInstallationMedia -> Text
engine :: Prelude.Text,
    -- | The version number of the database engine to use.
    --
    -- For a list of valid engine versions, call DescribeDBEngineVersions.
    --
    -- The following are the database engines and links to information about
    -- the major and minor versions. The list only includes DB engines that
    -- require an on-premises customer provided license.
    --
    -- __Microsoft SQL Server__
    --
    -- See
    -- <https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/CHAP_SQLServer.html#SQLServer.Concepts.General.VersionSupport Microsoft SQL Server Versions on Amazon RDS>
    -- in the /Amazon RDS User Guide./
    ImportInstallationMedia -> Text
engineVersion :: Prelude.Text,
    -- | The path to the installation medium for the specified DB engine.
    --
    -- Example:
    -- @SQLServerISO\/en_sql_server_2016_enterprise_x64_dvd_8701793.iso@
    ImportInstallationMedia -> Text
engineInstallationMediaPath :: Prelude.Text,
    -- | The path to the installation medium for the operating system associated
    -- with the specified DB engine.
    --
    -- Example: @WindowsISO\/en_windows_server_2016_x64_dvd_9327751.iso@
    ImportInstallationMedia -> Text
oSInstallationMediaPath :: Prelude.Text
  }
  deriving (ImportInstallationMedia -> ImportInstallationMedia -> Bool
(ImportInstallationMedia -> ImportInstallationMedia -> Bool)
-> (ImportInstallationMedia -> ImportInstallationMedia -> Bool)
-> Eq ImportInstallationMedia
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ImportInstallationMedia -> ImportInstallationMedia -> Bool
$c/= :: ImportInstallationMedia -> ImportInstallationMedia -> Bool
== :: ImportInstallationMedia -> ImportInstallationMedia -> Bool
$c== :: ImportInstallationMedia -> ImportInstallationMedia -> Bool
Prelude.Eq, ReadPrec [ImportInstallationMedia]
ReadPrec ImportInstallationMedia
Int -> ReadS ImportInstallationMedia
ReadS [ImportInstallationMedia]
(Int -> ReadS ImportInstallationMedia)
-> ReadS [ImportInstallationMedia]
-> ReadPrec ImportInstallationMedia
-> ReadPrec [ImportInstallationMedia]
-> Read ImportInstallationMedia
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ImportInstallationMedia]
$creadListPrec :: ReadPrec [ImportInstallationMedia]
readPrec :: ReadPrec ImportInstallationMedia
$creadPrec :: ReadPrec ImportInstallationMedia
readList :: ReadS [ImportInstallationMedia]
$creadList :: ReadS [ImportInstallationMedia]
readsPrec :: Int -> ReadS ImportInstallationMedia
$creadsPrec :: Int -> ReadS ImportInstallationMedia
Prelude.Read, Int -> ImportInstallationMedia -> ShowS
[ImportInstallationMedia] -> ShowS
ImportInstallationMedia -> String
(Int -> ImportInstallationMedia -> ShowS)
-> (ImportInstallationMedia -> String)
-> ([ImportInstallationMedia] -> ShowS)
-> Show ImportInstallationMedia
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ImportInstallationMedia] -> ShowS
$cshowList :: [ImportInstallationMedia] -> ShowS
show :: ImportInstallationMedia -> String
$cshow :: ImportInstallationMedia -> String
showsPrec :: Int -> ImportInstallationMedia -> ShowS
$cshowsPrec :: Int -> ImportInstallationMedia -> ShowS
Prelude.Show, (forall x.
 ImportInstallationMedia -> Rep ImportInstallationMedia x)
-> (forall x.
    Rep ImportInstallationMedia x -> ImportInstallationMedia)
-> Generic ImportInstallationMedia
forall x. Rep ImportInstallationMedia x -> ImportInstallationMedia
forall x. ImportInstallationMedia -> Rep ImportInstallationMedia x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ImportInstallationMedia x -> ImportInstallationMedia
$cfrom :: forall x. ImportInstallationMedia -> Rep ImportInstallationMedia x
Prelude.Generic)

-- |
-- Create a value of 'ImportInstallationMedia' 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:
--
-- 'customAvailabilityZoneId', 'importInstallationMedia_customAvailabilityZoneId' - The identifier of the custom Availability Zone (AZ) to import the
-- installation media to.
--
-- 'engine', 'importInstallationMedia_engine' - The name of the database engine to be used for this instance.
--
-- The list only includes supported DB engines that require an on-premises
-- customer provided license.
--
-- Valid Values:
--
-- -   @sqlserver-ee@
--
-- -   @sqlserver-se@
--
-- -   @sqlserver-ex@
--
-- -   @sqlserver-web@
--
-- 'engineVersion', 'importInstallationMedia_engineVersion' - The version number of the database engine to use.
--
-- For a list of valid engine versions, call DescribeDBEngineVersions.
--
-- The following are the database engines and links to information about
-- the major and minor versions. The list only includes DB engines that
-- require an on-premises customer provided license.
--
-- __Microsoft SQL Server__
--
-- See
-- <https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/CHAP_SQLServer.html#SQLServer.Concepts.General.VersionSupport Microsoft SQL Server Versions on Amazon RDS>
-- in the /Amazon RDS User Guide./
--
-- 'engineInstallationMediaPath', 'importInstallationMedia_engineInstallationMediaPath' - The path to the installation medium for the specified DB engine.
--
-- Example:
-- @SQLServerISO\/en_sql_server_2016_enterprise_x64_dvd_8701793.iso@
--
-- 'oSInstallationMediaPath', 'importInstallationMedia_oSInstallationMediaPath' - The path to the installation medium for the operating system associated
-- with the specified DB engine.
--
-- Example: @WindowsISO\/en_windows_server_2016_x64_dvd_9327751.iso@
newImportInstallationMedia ::
  -- | 'customAvailabilityZoneId'
  Prelude.Text ->
  -- | 'engine'
  Prelude.Text ->
  -- | 'engineVersion'
  Prelude.Text ->
  -- | 'engineInstallationMediaPath'
  Prelude.Text ->
  -- | 'oSInstallationMediaPath'
  Prelude.Text ->
  ImportInstallationMedia
newImportInstallationMedia :: Text -> Text -> Text -> Text -> Text -> ImportInstallationMedia
newImportInstallationMedia
  Text
pCustomAvailabilityZoneId_
  Text
pEngine_
  Text
pEngineVersion_
  Text
pEngineInstallationMediaPath_
  Text
pOSInstallationMediaPath_ =
    ImportInstallationMedia' :: Text -> Text -> Text -> Text -> Text -> ImportInstallationMedia
ImportInstallationMedia'
      { $sel:customAvailabilityZoneId:ImportInstallationMedia' :: Text
customAvailabilityZoneId =
          Text
pCustomAvailabilityZoneId_,
        $sel:engine:ImportInstallationMedia' :: Text
engine = Text
pEngine_,
        $sel:engineVersion:ImportInstallationMedia' :: Text
engineVersion = Text
pEngineVersion_,
        $sel:engineInstallationMediaPath:ImportInstallationMedia' :: Text
engineInstallationMediaPath =
          Text
pEngineInstallationMediaPath_,
        $sel:oSInstallationMediaPath:ImportInstallationMedia' :: Text
oSInstallationMediaPath =
          Text
pOSInstallationMediaPath_
      }

-- | The identifier of the custom Availability Zone (AZ) to import the
-- installation media to.
importInstallationMedia_customAvailabilityZoneId :: Lens.Lens' ImportInstallationMedia Prelude.Text
importInstallationMedia_customAvailabilityZoneId :: (Text -> f Text)
-> ImportInstallationMedia -> f ImportInstallationMedia
importInstallationMedia_customAvailabilityZoneId = (ImportInstallationMedia -> Text)
-> (ImportInstallationMedia -> Text -> ImportInstallationMedia)
-> Lens ImportInstallationMedia ImportInstallationMedia Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ImportInstallationMedia' {Text
customAvailabilityZoneId :: Text
$sel:customAvailabilityZoneId:ImportInstallationMedia' :: ImportInstallationMedia -> Text
customAvailabilityZoneId} -> Text
customAvailabilityZoneId) (\s :: ImportInstallationMedia
s@ImportInstallationMedia' {} Text
a -> ImportInstallationMedia
s {$sel:customAvailabilityZoneId:ImportInstallationMedia' :: Text
customAvailabilityZoneId = Text
a} :: ImportInstallationMedia)

-- | The name of the database engine to be used for this instance.
--
-- The list only includes supported DB engines that require an on-premises
-- customer provided license.
--
-- Valid Values:
--
-- -   @sqlserver-ee@
--
-- -   @sqlserver-se@
--
-- -   @sqlserver-ex@
--
-- -   @sqlserver-web@
importInstallationMedia_engine :: Lens.Lens' ImportInstallationMedia Prelude.Text
importInstallationMedia_engine :: (Text -> f Text)
-> ImportInstallationMedia -> f ImportInstallationMedia
importInstallationMedia_engine = (ImportInstallationMedia -> Text)
-> (ImportInstallationMedia -> Text -> ImportInstallationMedia)
-> Lens ImportInstallationMedia ImportInstallationMedia Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ImportInstallationMedia' {Text
engine :: Text
$sel:engine:ImportInstallationMedia' :: ImportInstallationMedia -> Text
engine} -> Text
engine) (\s :: ImportInstallationMedia
s@ImportInstallationMedia' {} Text
a -> ImportInstallationMedia
s {$sel:engine:ImportInstallationMedia' :: Text
engine = Text
a} :: ImportInstallationMedia)

-- | The version number of the database engine to use.
--
-- For a list of valid engine versions, call DescribeDBEngineVersions.
--
-- The following are the database engines and links to information about
-- the major and minor versions. The list only includes DB engines that
-- require an on-premises customer provided license.
--
-- __Microsoft SQL Server__
--
-- See
-- <https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/CHAP_SQLServer.html#SQLServer.Concepts.General.VersionSupport Microsoft SQL Server Versions on Amazon RDS>
-- in the /Amazon RDS User Guide./
importInstallationMedia_engineVersion :: Lens.Lens' ImportInstallationMedia Prelude.Text
importInstallationMedia_engineVersion :: (Text -> f Text)
-> ImportInstallationMedia -> f ImportInstallationMedia
importInstallationMedia_engineVersion = (ImportInstallationMedia -> Text)
-> (ImportInstallationMedia -> Text -> ImportInstallationMedia)
-> Lens ImportInstallationMedia ImportInstallationMedia Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ImportInstallationMedia' {Text
engineVersion :: Text
$sel:engineVersion:ImportInstallationMedia' :: ImportInstallationMedia -> Text
engineVersion} -> Text
engineVersion) (\s :: ImportInstallationMedia
s@ImportInstallationMedia' {} Text
a -> ImportInstallationMedia
s {$sel:engineVersion:ImportInstallationMedia' :: Text
engineVersion = Text
a} :: ImportInstallationMedia)

-- | The path to the installation medium for the specified DB engine.
--
-- Example:
-- @SQLServerISO\/en_sql_server_2016_enterprise_x64_dvd_8701793.iso@
importInstallationMedia_engineInstallationMediaPath :: Lens.Lens' ImportInstallationMedia Prelude.Text
importInstallationMedia_engineInstallationMediaPath :: (Text -> f Text)
-> ImportInstallationMedia -> f ImportInstallationMedia
importInstallationMedia_engineInstallationMediaPath = (ImportInstallationMedia -> Text)
-> (ImportInstallationMedia -> Text -> ImportInstallationMedia)
-> Lens ImportInstallationMedia ImportInstallationMedia Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ImportInstallationMedia' {Text
engineInstallationMediaPath :: Text
$sel:engineInstallationMediaPath:ImportInstallationMedia' :: ImportInstallationMedia -> Text
engineInstallationMediaPath} -> Text
engineInstallationMediaPath) (\s :: ImportInstallationMedia
s@ImportInstallationMedia' {} Text
a -> ImportInstallationMedia
s {$sel:engineInstallationMediaPath:ImportInstallationMedia' :: Text
engineInstallationMediaPath = Text
a} :: ImportInstallationMedia)

-- | The path to the installation medium for the operating system associated
-- with the specified DB engine.
--
-- Example: @WindowsISO\/en_windows_server_2016_x64_dvd_9327751.iso@
importInstallationMedia_oSInstallationMediaPath :: Lens.Lens' ImportInstallationMedia Prelude.Text
importInstallationMedia_oSInstallationMediaPath :: (Text -> f Text)
-> ImportInstallationMedia -> f ImportInstallationMedia
importInstallationMedia_oSInstallationMediaPath = (ImportInstallationMedia -> Text)
-> (ImportInstallationMedia -> Text -> ImportInstallationMedia)
-> Lens ImportInstallationMedia ImportInstallationMedia Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ImportInstallationMedia' {Text
oSInstallationMediaPath :: Text
$sel:oSInstallationMediaPath:ImportInstallationMedia' :: ImportInstallationMedia -> Text
oSInstallationMediaPath} -> Text
oSInstallationMediaPath) (\s :: ImportInstallationMedia
s@ImportInstallationMedia' {} Text
a -> ImportInstallationMedia
s {$sel:oSInstallationMediaPath:ImportInstallationMedia' :: Text
oSInstallationMediaPath = Text
a} :: ImportInstallationMedia)

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

instance Prelude.NFData ImportInstallationMedia

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

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

instance Core.ToQuery ImportInstallationMedia where
  toQuery :: ImportInstallationMedia -> QueryString
toQuery ImportInstallationMedia' {Text
oSInstallationMediaPath :: Text
engineInstallationMediaPath :: Text
engineVersion :: Text
engine :: Text
customAvailabilityZoneId :: Text
$sel:oSInstallationMediaPath:ImportInstallationMedia' :: ImportInstallationMedia -> Text
$sel:engineInstallationMediaPath:ImportInstallationMedia' :: ImportInstallationMedia -> Text
$sel:engineVersion:ImportInstallationMedia' :: ImportInstallationMedia -> Text
$sel:engine:ImportInstallationMedia' :: ImportInstallationMedia -> Text
$sel:customAvailabilityZoneId:ImportInstallationMedia' :: ImportInstallationMedia -> 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
"ImportInstallationMedia" :: Prelude.ByteString),
        ByteString
"Version"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2014-10-31" :: Prelude.ByteString),
        ByteString
"CustomAvailabilityZoneId"
          ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
customAvailabilityZoneId,
        ByteString
"Engine" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
engine,
        ByteString
"EngineVersion" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
engineVersion,
        ByteString
"EngineInstallationMediaPath"
          ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
engineInstallationMediaPath,
        ByteString
"OSInstallationMediaPath"
          ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
oSInstallationMediaPath
      ]