{-# 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.AccessPoliciesStatus
-- 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.AccessPoliciesStatus where

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

-- | The configured access rules for the domain\'s document and search
-- endpoints, and the current status of those rules.
--
-- /See:/ 'newAccessPoliciesStatus' smart constructor.
data AccessPoliciesStatus = AccessPoliciesStatus'
  { -- | The access policy configured for the domain. Access policies can be
    -- resource-based, IP-based, or IAM-based. See
    -- <http://docs.aws.amazon.com/opensearch-service/latest/developerguide/createupdatedomains.html#createdomain-configure-access-policies Configuring access policies>for
    -- more information.
    AccessPoliciesStatus -> Text
options :: Prelude.Text,
    -- | The status of the access policy for the domain. See @OptionStatus@ for
    -- the status information that\'s included.
    AccessPoliciesStatus -> OptionStatus
status :: OptionStatus
  }
  deriving (AccessPoliciesStatus -> AccessPoliciesStatus -> Bool
(AccessPoliciesStatus -> AccessPoliciesStatus -> Bool)
-> (AccessPoliciesStatus -> AccessPoliciesStatus -> Bool)
-> Eq AccessPoliciesStatus
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AccessPoliciesStatus -> AccessPoliciesStatus -> Bool
$c/= :: AccessPoliciesStatus -> AccessPoliciesStatus -> Bool
== :: AccessPoliciesStatus -> AccessPoliciesStatus -> Bool
$c== :: AccessPoliciesStatus -> AccessPoliciesStatus -> Bool
Prelude.Eq, ReadPrec [AccessPoliciesStatus]
ReadPrec AccessPoliciesStatus
Int -> ReadS AccessPoliciesStatus
ReadS [AccessPoliciesStatus]
(Int -> ReadS AccessPoliciesStatus)
-> ReadS [AccessPoliciesStatus]
-> ReadPrec AccessPoliciesStatus
-> ReadPrec [AccessPoliciesStatus]
-> Read AccessPoliciesStatus
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AccessPoliciesStatus]
$creadListPrec :: ReadPrec [AccessPoliciesStatus]
readPrec :: ReadPrec AccessPoliciesStatus
$creadPrec :: ReadPrec AccessPoliciesStatus
readList :: ReadS [AccessPoliciesStatus]
$creadList :: ReadS [AccessPoliciesStatus]
readsPrec :: Int -> ReadS AccessPoliciesStatus
$creadsPrec :: Int -> ReadS AccessPoliciesStatus
Prelude.Read, Int -> AccessPoliciesStatus -> ShowS
[AccessPoliciesStatus] -> ShowS
AccessPoliciesStatus -> String
(Int -> AccessPoliciesStatus -> ShowS)
-> (AccessPoliciesStatus -> String)
-> ([AccessPoliciesStatus] -> ShowS)
-> Show AccessPoliciesStatus
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AccessPoliciesStatus] -> ShowS
$cshowList :: [AccessPoliciesStatus] -> ShowS
show :: AccessPoliciesStatus -> String
$cshow :: AccessPoliciesStatus -> String
showsPrec :: Int -> AccessPoliciesStatus -> ShowS
$cshowsPrec :: Int -> AccessPoliciesStatus -> ShowS
Prelude.Show, (forall x. AccessPoliciesStatus -> Rep AccessPoliciesStatus x)
-> (forall x. Rep AccessPoliciesStatus x -> AccessPoliciesStatus)
-> Generic AccessPoliciesStatus
forall x. Rep AccessPoliciesStatus x -> AccessPoliciesStatus
forall x. AccessPoliciesStatus -> Rep AccessPoliciesStatus x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AccessPoliciesStatus x -> AccessPoliciesStatus
$cfrom :: forall x. AccessPoliciesStatus -> Rep AccessPoliciesStatus x
Prelude.Generic)

-- |
-- Create a value of 'AccessPoliciesStatus' 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', 'accessPoliciesStatus_options' - The access policy configured for the domain. Access policies can be
-- resource-based, IP-based, or IAM-based. See
-- <http://docs.aws.amazon.com/opensearch-service/latest/developerguide/createupdatedomains.html#createdomain-configure-access-policies Configuring access policies>for
-- more information.
--
-- 'status', 'accessPoliciesStatus_status' - The status of the access policy for the domain. See @OptionStatus@ for
-- the status information that\'s included.
newAccessPoliciesStatus ::
  -- | 'options'
  Prelude.Text ->
  -- | 'status'
  OptionStatus ->
  AccessPoliciesStatus
newAccessPoliciesStatus :: Text -> OptionStatus -> AccessPoliciesStatus
newAccessPoliciesStatus Text
pOptions_ OptionStatus
pStatus_ =
  AccessPoliciesStatus' :: Text -> OptionStatus -> AccessPoliciesStatus
AccessPoliciesStatus'
    { $sel:options:AccessPoliciesStatus' :: Text
options = Text
pOptions_,
      $sel:status:AccessPoliciesStatus' :: OptionStatus
status = OptionStatus
pStatus_
    }

-- | The access policy configured for the domain. Access policies can be
-- resource-based, IP-based, or IAM-based. See
-- <http://docs.aws.amazon.com/opensearch-service/latest/developerguide/createupdatedomains.html#createdomain-configure-access-policies Configuring access policies>for
-- more information.
accessPoliciesStatus_options :: Lens.Lens' AccessPoliciesStatus Prelude.Text
accessPoliciesStatus_options :: (Text -> f Text) -> AccessPoliciesStatus -> f AccessPoliciesStatus
accessPoliciesStatus_options = (AccessPoliciesStatus -> Text)
-> (AccessPoliciesStatus -> Text -> AccessPoliciesStatus)
-> Lens AccessPoliciesStatus AccessPoliciesStatus Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AccessPoliciesStatus' {Text
options :: Text
$sel:options:AccessPoliciesStatus' :: AccessPoliciesStatus -> Text
options} -> Text
options) (\s :: AccessPoliciesStatus
s@AccessPoliciesStatus' {} Text
a -> AccessPoliciesStatus
s {$sel:options:AccessPoliciesStatus' :: Text
options = Text
a} :: AccessPoliciesStatus)

-- | The status of the access policy for the domain. See @OptionStatus@ for
-- the status information that\'s included.
accessPoliciesStatus_status :: Lens.Lens' AccessPoliciesStatus OptionStatus
accessPoliciesStatus_status :: (OptionStatus -> f OptionStatus)
-> AccessPoliciesStatus -> f AccessPoliciesStatus
accessPoliciesStatus_status = (AccessPoliciesStatus -> OptionStatus)
-> (AccessPoliciesStatus -> OptionStatus -> AccessPoliciesStatus)
-> Lens
     AccessPoliciesStatus AccessPoliciesStatus OptionStatus OptionStatus
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AccessPoliciesStatus' {OptionStatus
status :: OptionStatus
$sel:status:AccessPoliciesStatus' :: AccessPoliciesStatus -> OptionStatus
status} -> OptionStatus
status) (\s :: AccessPoliciesStatus
s@AccessPoliciesStatus' {} OptionStatus
a -> AccessPoliciesStatus
s {$sel:status:AccessPoliciesStatus' :: OptionStatus
status = OptionStatus
a} :: AccessPoliciesStatus)

instance Core.FromJSON AccessPoliciesStatus where
  parseJSON :: Value -> Parser AccessPoliciesStatus
parseJSON =
    String
-> (Object -> Parser AccessPoliciesStatus)
-> Value
-> Parser AccessPoliciesStatus
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"AccessPoliciesStatus"
      ( \Object
x ->
          Text -> OptionStatus -> AccessPoliciesStatus
AccessPoliciesStatus'
            (Text -> OptionStatus -> AccessPoliciesStatus)
-> Parser Text -> Parser (OptionStatus -> AccessPoliciesStatus)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"Options")
            Parser (OptionStatus -> AccessPoliciesStatus)
-> Parser OptionStatus -> Parser AccessPoliciesStatus
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 AccessPoliciesStatus

instance Prelude.NFData AccessPoliciesStatus