{-# 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.ProcessorFeature
-- 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.ProcessorFeature 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

-- | Contains the processor features of a DB instance class.
--
-- To specify the number of CPU cores, use the @coreCount@ feature name for
-- the @Name@ parameter. To specify the number of threads per core, use the
-- @threadsPerCore@ feature name for the @Name@ parameter.
--
-- You can set the processor features of the DB instance class for a DB
-- instance when you call one of the following actions:
--
-- -   @CreateDBInstance@
--
-- -   @ModifyDBInstance@
--
-- -   @RestoreDBInstanceFromDBSnapshot@
--
-- -   @RestoreDBInstanceFromS3@
--
-- -   @RestoreDBInstanceToPointInTime@
--
-- You can view the valid processor values for a particular instance class
-- by calling the @DescribeOrderableDBInstanceOptions@ action and
-- specifying the instance class for the @DBInstanceClass@ parameter.
--
-- In addition, you can use the following actions for DB instance class
-- processor information:
--
-- -   @DescribeDBInstances@
--
-- -   @DescribeDBSnapshots@
--
-- -   @DescribeValidDBInstanceModifications@
--
-- If you call @DescribeDBInstances@, @ProcessorFeature@ returns non-null
-- values only if the following conditions are met:
--
-- -   You are accessing an Oracle DB instance.
--
-- -   Your Oracle DB instance class supports configuring the number of CPU
--     cores and threads per core.
--
-- -   The current number CPU cores and threads is set to a non-default
--     value.
--
-- For more information, see
-- <https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Concepts.DBInstanceClass.html#USER_ConfigureProcessor Configuring the Processor of the DB Instance Class>
-- in the /Amazon RDS User Guide./
--
-- /See:/ 'newProcessorFeature' smart constructor.
data ProcessorFeature = ProcessorFeature'
  { -- | The name of the processor feature. Valid names are @coreCount@ and
    -- @threadsPerCore@.
    ProcessorFeature -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The value of a processor feature name.
    ProcessorFeature -> Maybe Text
value :: Prelude.Maybe Prelude.Text
  }
  deriving (ProcessorFeature -> ProcessorFeature -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ProcessorFeature -> ProcessorFeature -> Bool
$c/= :: ProcessorFeature -> ProcessorFeature -> Bool
== :: ProcessorFeature -> ProcessorFeature -> Bool
$c== :: ProcessorFeature -> ProcessorFeature -> Bool
Prelude.Eq, ReadPrec [ProcessorFeature]
ReadPrec ProcessorFeature
Int -> ReadS ProcessorFeature
ReadS [ProcessorFeature]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ProcessorFeature]
$creadListPrec :: ReadPrec [ProcessorFeature]
readPrec :: ReadPrec ProcessorFeature
$creadPrec :: ReadPrec ProcessorFeature
readList :: ReadS [ProcessorFeature]
$creadList :: ReadS [ProcessorFeature]
readsPrec :: Int -> ReadS ProcessorFeature
$creadsPrec :: Int -> ReadS ProcessorFeature
Prelude.Read, Int -> ProcessorFeature -> ShowS
[ProcessorFeature] -> ShowS
ProcessorFeature -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ProcessorFeature] -> ShowS
$cshowList :: [ProcessorFeature] -> ShowS
show :: ProcessorFeature -> String
$cshow :: ProcessorFeature -> String
showsPrec :: Int -> ProcessorFeature -> ShowS
$cshowsPrec :: Int -> ProcessorFeature -> ShowS
Prelude.Show, forall x. Rep ProcessorFeature x -> ProcessorFeature
forall x. ProcessorFeature -> Rep ProcessorFeature x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ProcessorFeature x -> ProcessorFeature
$cfrom :: forall x. ProcessorFeature -> Rep ProcessorFeature x
Prelude.Generic)

-- |
-- Create a value of 'ProcessorFeature' 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:
--
-- 'name', 'processorFeature_name' - The name of the processor feature. Valid names are @coreCount@ and
-- @threadsPerCore@.
--
-- 'value', 'processorFeature_value' - The value of a processor feature name.
newProcessorFeature ::
  ProcessorFeature
newProcessorFeature :: ProcessorFeature
newProcessorFeature =
  ProcessorFeature'
    { $sel:name:ProcessorFeature' :: Maybe Text
name = forall a. Maybe a
Prelude.Nothing,
      $sel:value:ProcessorFeature' :: Maybe Text
value = forall a. Maybe a
Prelude.Nothing
    }

-- | The name of the processor feature. Valid names are @coreCount@ and
-- @threadsPerCore@.
processorFeature_name :: Lens.Lens' ProcessorFeature (Prelude.Maybe Prelude.Text)
processorFeature_name :: Lens' ProcessorFeature (Maybe Text)
processorFeature_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProcessorFeature' {Maybe Text
name :: Maybe Text
$sel:name:ProcessorFeature' :: ProcessorFeature -> Maybe Text
name} -> Maybe Text
name) (\s :: ProcessorFeature
s@ProcessorFeature' {} Maybe Text
a -> ProcessorFeature
s {$sel:name:ProcessorFeature' :: Maybe Text
name = Maybe Text
a} :: ProcessorFeature)

-- | The value of a processor feature name.
processorFeature_value :: Lens.Lens' ProcessorFeature (Prelude.Maybe Prelude.Text)
processorFeature_value :: Lens' ProcessorFeature (Maybe Text)
processorFeature_value = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProcessorFeature' {Maybe Text
value :: Maybe Text
$sel:value:ProcessorFeature' :: ProcessorFeature -> Maybe Text
value} -> Maybe Text
value) (\s :: ProcessorFeature
s@ProcessorFeature' {} Maybe Text
a -> ProcessorFeature
s {$sel:value:ProcessorFeature' :: Maybe Text
value = Maybe Text
a} :: ProcessorFeature)

instance Data.FromXML ProcessorFeature where
  parseXML :: [Node] -> Either String ProcessorFeature
parseXML [Node]
x =
    Maybe Text -> Maybe Text -> ProcessorFeature
ProcessorFeature'
      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
"Name")
      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
"Value")

instance Prelude.Hashable ProcessorFeature where
  hashWithSalt :: Int -> ProcessorFeature -> Int
hashWithSalt Int
_salt ProcessorFeature' {Maybe Text
value :: Maybe Text
name :: Maybe Text
$sel:value:ProcessorFeature' :: ProcessorFeature -> Maybe Text
$sel:name:ProcessorFeature' :: ProcessorFeature -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
value

instance Prelude.NFData ProcessorFeature where
  rnf :: ProcessorFeature -> ()
rnf ProcessorFeature' {Maybe Text
value :: Maybe Text
name :: Maybe Text
$sel:value:ProcessorFeature' :: ProcessorFeature -> Maybe Text
$sel:name:ProcessorFeature' :: ProcessorFeature -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
name seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
value

instance Data.ToQuery ProcessorFeature where
  toQuery :: ProcessorFeature -> QueryString
toQuery ProcessorFeature' {Maybe Text
value :: Maybe Text
name :: Maybe Text
$sel:value:ProcessorFeature' :: ProcessorFeature -> Maybe Text
$sel:name:ProcessorFeature' :: ProcessorFeature -> Maybe Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ByteString
"Name" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
name, ByteString
"Value" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
value]