{-# 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.OpenSearch.Types.AdvancedOptionsStatus
-- 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.OpenSearch.Types.AdvancedOptionsStatus where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.OpenSearch.Types.OptionStatus
import qualified Amazonka.Prelude as Prelude

-- | Status of the advanced options for the specified domain. Currently, the
-- following advanced options are available:
--
-- -   Option to allow references to indices in an HTTP request body. Must
--     be @false@ when configuring access to individual sub-resources. By
--     default, the value is @true@. See
--     <http://docs.aws.amazon.com/opensearch-service/latest/developerguide/createupdatedomains.html#createdomain-configure-advanced-options Advanced cluster parameters>
--     for more information.
-- -   Option to specify the percentage of heap space allocated to field
--     data. By default, this setting is unbounded.
--
-- For more information, see
-- <http://docs.aws.amazon.com/opensearch-service/latest/developerguide/createupdatedomains.html#createdomain-configure-advanced-options Advanced cluster parameters>.
--
-- /See:/ 'newAdvancedOptionsStatus' smart constructor.
data AdvancedOptionsStatus = AdvancedOptionsStatus'
  { -- | The status of advanced options for the specified domain.
    AdvancedOptionsStatus -> HashMap Text Text
options :: Prelude.HashMap Prelude.Text Prelude.Text,
    -- | The @OptionStatus@ for advanced options for the specified domain.
    AdvancedOptionsStatus -> OptionStatus
status :: OptionStatus
  }
  deriving (AdvancedOptionsStatus -> AdvancedOptionsStatus -> Bool
(AdvancedOptionsStatus -> AdvancedOptionsStatus -> Bool)
-> (AdvancedOptionsStatus -> AdvancedOptionsStatus -> Bool)
-> Eq AdvancedOptionsStatus
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AdvancedOptionsStatus -> AdvancedOptionsStatus -> Bool
$c/= :: AdvancedOptionsStatus -> AdvancedOptionsStatus -> Bool
== :: AdvancedOptionsStatus -> AdvancedOptionsStatus -> Bool
$c== :: AdvancedOptionsStatus -> AdvancedOptionsStatus -> Bool
Prelude.Eq, ReadPrec [AdvancedOptionsStatus]
ReadPrec AdvancedOptionsStatus
Int -> ReadS AdvancedOptionsStatus
ReadS [AdvancedOptionsStatus]
(Int -> ReadS AdvancedOptionsStatus)
-> ReadS [AdvancedOptionsStatus]
-> ReadPrec AdvancedOptionsStatus
-> ReadPrec [AdvancedOptionsStatus]
-> Read AdvancedOptionsStatus
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AdvancedOptionsStatus]
$creadListPrec :: ReadPrec [AdvancedOptionsStatus]
readPrec :: ReadPrec AdvancedOptionsStatus
$creadPrec :: ReadPrec AdvancedOptionsStatus
readList :: ReadS [AdvancedOptionsStatus]
$creadList :: ReadS [AdvancedOptionsStatus]
readsPrec :: Int -> ReadS AdvancedOptionsStatus
$creadsPrec :: Int -> ReadS AdvancedOptionsStatus
Prelude.Read, Int -> AdvancedOptionsStatus -> ShowS
[AdvancedOptionsStatus] -> ShowS
AdvancedOptionsStatus -> String
(Int -> AdvancedOptionsStatus -> ShowS)
-> (AdvancedOptionsStatus -> String)
-> ([AdvancedOptionsStatus] -> ShowS)
-> Show AdvancedOptionsStatus
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AdvancedOptionsStatus] -> ShowS
$cshowList :: [AdvancedOptionsStatus] -> ShowS
show :: AdvancedOptionsStatus -> String
$cshow :: AdvancedOptionsStatus -> String
showsPrec :: Int -> AdvancedOptionsStatus -> ShowS
$cshowsPrec :: Int -> AdvancedOptionsStatus -> ShowS
Prelude.Show, (forall x. AdvancedOptionsStatus -> Rep AdvancedOptionsStatus x)
-> (forall x. Rep AdvancedOptionsStatus x -> AdvancedOptionsStatus)
-> Generic AdvancedOptionsStatus
forall x. Rep AdvancedOptionsStatus x -> AdvancedOptionsStatus
forall x. AdvancedOptionsStatus -> Rep AdvancedOptionsStatus x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AdvancedOptionsStatus x -> AdvancedOptionsStatus
$cfrom :: forall x. AdvancedOptionsStatus -> Rep AdvancedOptionsStatus x
Prelude.Generic)

-- |
-- Create a value of 'AdvancedOptionsStatus' 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:
--
-- 'options', 'advancedOptionsStatus_options' - The status of advanced options for the specified domain.
--
-- 'status', 'advancedOptionsStatus_status' - The @OptionStatus@ for advanced options for the specified domain.
newAdvancedOptionsStatus ::
  -- | 'status'
  OptionStatus ->
  AdvancedOptionsStatus
newAdvancedOptionsStatus :: OptionStatus -> AdvancedOptionsStatus
newAdvancedOptionsStatus OptionStatus
pStatus_ =
  AdvancedOptionsStatus' :: HashMap Text Text -> OptionStatus -> AdvancedOptionsStatus
AdvancedOptionsStatus'
    { $sel:options:AdvancedOptionsStatus' :: HashMap Text Text
options = HashMap Text Text
forall a. Monoid a => a
Prelude.mempty,
      $sel:status:AdvancedOptionsStatus' :: OptionStatus
status = OptionStatus
pStatus_
    }

-- | The status of advanced options for the specified domain.
advancedOptionsStatus_options :: Lens.Lens' AdvancedOptionsStatus (Prelude.HashMap Prelude.Text Prelude.Text)
advancedOptionsStatus_options :: (HashMap Text Text -> f (HashMap Text Text))
-> AdvancedOptionsStatus -> f AdvancedOptionsStatus
advancedOptionsStatus_options = (AdvancedOptionsStatus -> HashMap Text Text)
-> (AdvancedOptionsStatus
    -> HashMap Text Text -> AdvancedOptionsStatus)
-> Lens
     AdvancedOptionsStatus
     AdvancedOptionsStatus
     (HashMap Text Text)
     (HashMap Text Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AdvancedOptionsStatus' {HashMap Text Text
options :: HashMap Text Text
$sel:options:AdvancedOptionsStatus' :: AdvancedOptionsStatus -> HashMap Text Text
options} -> HashMap Text Text
options) (\s :: AdvancedOptionsStatus
s@AdvancedOptionsStatus' {} HashMap Text Text
a -> AdvancedOptionsStatus
s {$sel:options:AdvancedOptionsStatus' :: HashMap Text Text
options = HashMap Text Text
a} :: AdvancedOptionsStatus) ((HashMap Text Text -> f (HashMap Text Text))
 -> AdvancedOptionsStatus -> f AdvancedOptionsStatus)
-> ((HashMap Text Text -> f (HashMap Text Text))
    -> HashMap Text Text -> f (HashMap Text Text))
-> (HashMap Text Text -> f (HashMap Text Text))
-> AdvancedOptionsStatus
-> f AdvancedOptionsStatus
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (HashMap Text Text -> f (HashMap Text Text))
-> HashMap Text Text -> f (HashMap Text Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The @OptionStatus@ for advanced options for the specified domain.
advancedOptionsStatus_status :: Lens.Lens' AdvancedOptionsStatus OptionStatus
advancedOptionsStatus_status :: (OptionStatus -> f OptionStatus)
-> AdvancedOptionsStatus -> f AdvancedOptionsStatus
advancedOptionsStatus_status = (AdvancedOptionsStatus -> OptionStatus)
-> (AdvancedOptionsStatus -> OptionStatus -> AdvancedOptionsStatus)
-> Lens
     AdvancedOptionsStatus
     AdvancedOptionsStatus
     OptionStatus
     OptionStatus
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AdvancedOptionsStatus' {OptionStatus
status :: OptionStatus
$sel:status:AdvancedOptionsStatus' :: AdvancedOptionsStatus -> OptionStatus
status} -> OptionStatus
status) (\s :: AdvancedOptionsStatus
s@AdvancedOptionsStatus' {} OptionStatus
a -> AdvancedOptionsStatus
s {$sel:status:AdvancedOptionsStatus' :: OptionStatus
status = OptionStatus
a} :: AdvancedOptionsStatus)

instance Core.FromJSON AdvancedOptionsStatus where
  parseJSON :: Value -> Parser AdvancedOptionsStatus
parseJSON =
    String
-> (Object -> Parser AdvancedOptionsStatus)
-> Value
-> Parser AdvancedOptionsStatus
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"AdvancedOptionsStatus"
      ( \Object
x ->
          HashMap Text Text -> OptionStatus -> AdvancedOptionsStatus
AdvancedOptionsStatus'
            (HashMap Text Text -> OptionStatus -> AdvancedOptionsStatus)
-> Parser (HashMap Text Text)
-> Parser (OptionStatus -> AdvancedOptionsStatus)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe (HashMap Text Text))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Options" Parser (Maybe (HashMap Text Text))
-> HashMap Text Text -> Parser (HashMap Text Text)
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= HashMap Text Text
forall a. Monoid a => a
Prelude.mempty)
            Parser (OptionStatus -> AdvancedOptionsStatus)
-> Parser OptionStatus -> Parser AdvancedOptionsStatus
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser OptionStatus
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"Status")
      )

instance Prelude.Hashable AdvancedOptionsStatus

instance Prelude.NFData AdvancedOptionsStatus