{-# 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-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)
module Amazonka.RDS.Types.OptionGroupMembership where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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 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,
    -- | The name of the option group that the instance belongs to.
    OptionGroupMembership -> Maybe Text
optionGroupName :: Prelude.Maybe Prelude.Text
  }
  deriving (OptionGroupMembership -> OptionGroupMembership -> Bool
(OptionGroupMembership -> OptionGroupMembership -> Bool)
-> (OptionGroupMembership -> OptionGroupMembership -> Bool)
-> Eq OptionGroupMembership
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]
(Int -> ReadS OptionGroupMembership)
-> ReadS [OptionGroupMembership]
-> ReadPrec OptionGroupMembership
-> ReadPrec [OptionGroupMembership]
-> Read 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
(Int -> OptionGroupMembership -> ShowS)
-> (OptionGroupMembership -> String)
-> ([OptionGroupMembership] -> ShowS)
-> Show OptionGroupMembership
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. OptionGroupMembership -> Rep OptionGroupMembership x)
-> (forall x. Rep OptionGroupMembership x -> OptionGroupMembership)
-> Generic OptionGroupMembership
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:
--
-- '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@.
--
-- 'optionGroupName', 'optionGroupMembership_optionGroupName' - The name of the option group that the instance belongs to.
newOptionGroupMembership ::
  OptionGroupMembership
newOptionGroupMembership :: OptionGroupMembership
newOptionGroupMembership =
  OptionGroupMembership' :: Maybe Text -> Maybe Text -> OptionGroupMembership
OptionGroupMembership'
    { $sel:status:OptionGroupMembership' :: Maybe Text
status = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:optionGroupName:OptionGroupMembership' :: Maybe Text
optionGroupName = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | 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 :: (Maybe Text -> f (Maybe Text))
-> OptionGroupMembership -> f OptionGroupMembership
optionGroupMembership_status = (OptionGroupMembership -> Maybe Text)
-> (OptionGroupMembership -> Maybe Text -> OptionGroupMembership)
-> Lens
     OptionGroupMembership
     OptionGroupMembership
     (Maybe Text)
     (Maybe Text)
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)

-- | The name of the option group that the instance belongs to.
optionGroupMembership_optionGroupName :: Lens.Lens' OptionGroupMembership (Prelude.Maybe Prelude.Text)
optionGroupMembership_optionGroupName :: (Maybe Text -> f (Maybe Text))
-> OptionGroupMembership -> f OptionGroupMembership
optionGroupMembership_optionGroupName = (OptionGroupMembership -> Maybe Text)
-> (OptionGroupMembership -> Maybe Text -> OptionGroupMembership)
-> Lens
     OptionGroupMembership
     OptionGroupMembership
     (Maybe Text)
     (Maybe Text)
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)

instance Core.FromXML OptionGroupMembership where
  parseXML :: [Node] -> Either String OptionGroupMembership
parseXML [Node]
x =
    Maybe Text -> Maybe Text -> OptionGroupMembership
OptionGroupMembership'
      (Maybe Text -> Maybe Text -> OptionGroupMembership)
-> Either String (Maybe Text)
-> Either String (Maybe Text -> OptionGroupMembership)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"Status")
      Either String (Maybe Text -> OptionGroupMembership)
-> Either String (Maybe Text)
-> Either String OptionGroupMembership
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"OptionGroupName")

instance Prelude.Hashable OptionGroupMembership

instance Prelude.NFData OptionGroupMembership