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

-- | Provides information on the option groups the DB instance is a member
-- of.
--
-- /See:/ 'newOptionGroupMembership' smart constructor.
data OptionGroupMembership = OptionGroupMembership'
  { -- | The name of the option group that the instance belongs to.
    OptionGroupMembership -> Maybe Text
optionGroupName :: Prelude.Maybe Prelude.Text,
    -- | The status of the DB instance\'s option group membership. Valid values
    -- are: @in-sync@, @pending-apply@, @pending-removal@,
    -- @pending-maintenance-apply@, @pending-maintenance-removal@, @applying@,
    -- @removing@, and @failed@.
    OptionGroupMembership -> Maybe Text
status :: Prelude.Maybe Prelude.Text
  }
  deriving (OptionGroupMembership -> OptionGroupMembership -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: OptionGroupMembership -> OptionGroupMembership -> Bool
$c/= :: OptionGroupMembership -> OptionGroupMembership -> Bool
== :: OptionGroupMembership -> OptionGroupMembership -> Bool
$c== :: OptionGroupMembership -> OptionGroupMembership -> Bool
Prelude.Eq, ReadPrec [OptionGroupMembership]
ReadPrec OptionGroupMembership
Int -> ReadS OptionGroupMembership
ReadS [OptionGroupMembership]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [OptionGroupMembership]
$creadListPrec :: ReadPrec [OptionGroupMembership]
readPrec :: ReadPrec OptionGroupMembership
$creadPrec :: ReadPrec OptionGroupMembership
readList :: ReadS [OptionGroupMembership]
$creadList :: ReadS [OptionGroupMembership]
readsPrec :: Int -> ReadS OptionGroupMembership
$creadsPrec :: Int -> ReadS OptionGroupMembership
Prelude.Read, Int -> OptionGroupMembership -> ShowS
[OptionGroupMembership] -> ShowS
OptionGroupMembership -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [OptionGroupMembership] -> ShowS
$cshowList :: [OptionGroupMembership] -> ShowS
show :: OptionGroupMembership -> String
$cshow :: OptionGroupMembership -> String
showsPrec :: Int -> OptionGroupMembership -> ShowS
$cshowsPrec :: Int -> OptionGroupMembership -> ShowS
Prelude.Show, forall x. Rep OptionGroupMembership x -> OptionGroupMembership
forall x. OptionGroupMembership -> Rep OptionGroupMembership x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep OptionGroupMembership x -> OptionGroupMembership
$cfrom :: forall x. OptionGroupMembership -> Rep OptionGroupMembership x
Prelude.Generic)

-- |
-- Create a value of 'OptionGroupMembership' 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:
--
-- 'optionGroupName', 'optionGroupMembership_optionGroupName' - The name of the option group that the instance belongs to.
--
-- 'status', 'optionGroupMembership_status' - The status of the DB instance\'s option group membership. Valid values
-- are: @in-sync@, @pending-apply@, @pending-removal@,
-- @pending-maintenance-apply@, @pending-maintenance-removal@, @applying@,
-- @removing@, and @failed@.
newOptionGroupMembership ::
  OptionGroupMembership
newOptionGroupMembership :: OptionGroupMembership
newOptionGroupMembership =
  OptionGroupMembership'
    { $sel:optionGroupName:OptionGroupMembership' :: Maybe Text
optionGroupName =
        forall a. Maybe a
Prelude.Nothing,
      $sel:status:OptionGroupMembership' :: Maybe Text
status = forall a. Maybe a
Prelude.Nothing
    }

-- | The name of the option group that the instance belongs to.
optionGroupMembership_optionGroupName :: Lens.Lens' OptionGroupMembership (Prelude.Maybe Prelude.Text)
optionGroupMembership_optionGroupName :: Lens' OptionGroupMembership (Maybe Text)
optionGroupMembership_optionGroupName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OptionGroupMembership' {Maybe Text
optionGroupName :: Maybe Text
$sel:optionGroupName:OptionGroupMembership' :: OptionGroupMembership -> Maybe Text
optionGroupName} -> Maybe Text
optionGroupName) (\s :: OptionGroupMembership
s@OptionGroupMembership' {} Maybe Text
a -> OptionGroupMembership
s {$sel:optionGroupName:OptionGroupMembership' :: Maybe Text
optionGroupName = Maybe Text
a} :: OptionGroupMembership)

-- | The status of the DB instance\'s option group membership. Valid values
-- are: @in-sync@, @pending-apply@, @pending-removal@,
-- @pending-maintenance-apply@, @pending-maintenance-removal@, @applying@,
-- @removing@, and @failed@.
optionGroupMembership_status :: Lens.Lens' OptionGroupMembership (Prelude.Maybe Prelude.Text)
optionGroupMembership_status :: Lens' OptionGroupMembership (Maybe Text)
optionGroupMembership_status = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OptionGroupMembership' {Maybe Text
status :: Maybe Text
$sel:status:OptionGroupMembership' :: OptionGroupMembership -> Maybe Text
status} -> Maybe Text
status) (\s :: OptionGroupMembership
s@OptionGroupMembership' {} Maybe Text
a -> OptionGroupMembership
s {$sel:status:OptionGroupMembership' :: Maybe Text
status = Maybe Text
a} :: OptionGroupMembership)

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

instance Prelude.Hashable OptionGroupMembership where
  hashWithSalt :: Int -> OptionGroupMembership -> Int
hashWithSalt Int
_salt OptionGroupMembership' {Maybe Text
status :: Maybe Text
optionGroupName :: Maybe Text
$sel:status:OptionGroupMembership' :: OptionGroupMembership -> Maybe Text
$sel:optionGroupName:OptionGroupMembership' :: OptionGroupMembership -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
optionGroupName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
status

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