{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# 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.Types.OptionVersion
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.RDS.Types.OptionVersion where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude

-- | The version for an option. Option group option versions are returned by
-- the @DescribeOptionGroupOptions@ action.
--
-- /See:/ 'newOptionVersion' smart constructor.
data OptionVersion = OptionVersion'
  { -- | True if the version is the default version of the option, and otherwise
    -- false.
    OptionVersion -> Maybe Bool
isDefault :: Prelude.Maybe Prelude.Bool,
    -- | The version of the option.
    OptionVersion -> Maybe Text
version :: Prelude.Maybe Prelude.Text
  }
  deriving (OptionVersion -> OptionVersion -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: OptionVersion -> OptionVersion -> Bool
$c/= :: OptionVersion -> OptionVersion -> Bool
== :: OptionVersion -> OptionVersion -> Bool
$c== :: OptionVersion -> OptionVersion -> Bool
Prelude.Eq, ReadPrec [OptionVersion]
ReadPrec OptionVersion
Int -> ReadS OptionVersion
ReadS [OptionVersion]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [OptionVersion]
$creadListPrec :: ReadPrec [OptionVersion]
readPrec :: ReadPrec OptionVersion
$creadPrec :: ReadPrec OptionVersion
readList :: ReadS [OptionVersion]
$creadList :: ReadS [OptionVersion]
readsPrec :: Int -> ReadS OptionVersion
$creadsPrec :: Int -> ReadS OptionVersion
Prelude.Read, Int -> OptionVersion -> ShowS
[OptionVersion] -> ShowS
OptionVersion -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [OptionVersion] -> ShowS
$cshowList :: [OptionVersion] -> ShowS
show :: OptionVersion -> String
$cshow :: OptionVersion -> String
showsPrec :: Int -> OptionVersion -> ShowS
$cshowsPrec :: Int -> OptionVersion -> ShowS
Prelude.Show, forall x. Rep OptionVersion x -> OptionVersion
forall x. OptionVersion -> Rep OptionVersion x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep OptionVersion x -> OptionVersion
$cfrom :: forall x. OptionVersion -> Rep OptionVersion x
Prelude.Generic)

-- |
-- Create a value of 'OptionVersion' 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:
--
-- 'isDefault', 'optionVersion_isDefault' - True if the version is the default version of the option, and otherwise
-- false.
--
-- 'version', 'optionVersion_version' - The version of the option.
newOptionVersion ::
  OptionVersion
newOptionVersion :: OptionVersion
newOptionVersion =
  OptionVersion'
    { $sel:isDefault:OptionVersion' :: Maybe Bool
isDefault = forall a. Maybe a
Prelude.Nothing,
      $sel:version:OptionVersion' :: Maybe Text
version = forall a. Maybe a
Prelude.Nothing
    }

-- | True if the version is the default version of the option, and otherwise
-- false.
optionVersion_isDefault :: Lens.Lens' OptionVersion (Prelude.Maybe Prelude.Bool)
optionVersion_isDefault :: Lens' OptionVersion (Maybe Bool)
optionVersion_isDefault = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OptionVersion' {Maybe Bool
isDefault :: Maybe Bool
$sel:isDefault:OptionVersion' :: OptionVersion -> Maybe Bool
isDefault} -> Maybe Bool
isDefault) (\s :: OptionVersion
s@OptionVersion' {} Maybe Bool
a -> OptionVersion
s {$sel:isDefault:OptionVersion' :: Maybe Bool
isDefault = Maybe Bool
a} :: OptionVersion)

-- | The version of the option.
optionVersion_version :: Lens.Lens' OptionVersion (Prelude.Maybe Prelude.Text)
optionVersion_version :: Lens' OptionVersion (Maybe Text)
optionVersion_version = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OptionVersion' {Maybe Text
version :: Maybe Text
$sel:version:OptionVersion' :: OptionVersion -> Maybe Text
version} -> Maybe Text
version) (\s :: OptionVersion
s@OptionVersion' {} Maybe Text
a -> OptionVersion
s {$sel:version:OptionVersion' :: Maybe Text
version = Maybe Text
a} :: OptionVersion)

instance Data.FromXML OptionVersion where
  parseXML :: [Node] -> Either String OptionVersion
parseXML [Node]
x =
    Maybe Bool -> Maybe Text -> OptionVersion
OptionVersion'
      forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"IsDefault")
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"Version")

instance Prelude.Hashable OptionVersion where
  hashWithSalt :: Int -> OptionVersion -> Int
hashWithSalt Int
_salt OptionVersion' {Maybe Bool
Maybe Text
version :: Maybe Text
isDefault :: Maybe Bool
$sel:version:OptionVersion' :: OptionVersion -> Maybe Text
$sel:isDefault:OptionVersion' :: OptionVersion -> Maybe Bool
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
isDefault
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
version

instance Prelude.NFData OptionVersion where
  rnf :: OptionVersion -> ()
rnf OptionVersion' {Maybe Bool
Maybe Text
version :: Maybe Text
isDefault :: Maybe Bool
$sel:version:OptionVersion' :: OptionVersion -> Maybe Text
$sel:isDefault:OptionVersion' :: OptionVersion -> Maybe Bool
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
isDefault
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
version