{-# 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.SSOAdmin.Types.InstanceAccessControlAttributeConfiguration
-- 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.SSOAdmin.Types.InstanceAccessControlAttributeConfiguration where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.SSOAdmin.Types.AccessControlAttribute

-- | Specifies the attributes to add to your attribute-based access control
-- (ABAC) configuration.
--
-- /See:/ 'newInstanceAccessControlAttributeConfiguration' smart constructor.
data InstanceAccessControlAttributeConfiguration = InstanceAccessControlAttributeConfiguration'
  { -- | Lists the attributes that are configured for ABAC in the specified
    -- Amazon Web Services SSO instance.
    InstanceAccessControlAttributeConfiguration
-> [AccessControlAttribute]
accessControlAttributes :: [AccessControlAttribute]
  }
  deriving (InstanceAccessControlAttributeConfiguration
-> InstanceAccessControlAttributeConfiguration -> Bool
(InstanceAccessControlAttributeConfiguration
 -> InstanceAccessControlAttributeConfiguration -> Bool)
-> (InstanceAccessControlAttributeConfiguration
    -> InstanceAccessControlAttributeConfiguration -> Bool)
-> Eq InstanceAccessControlAttributeConfiguration
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: InstanceAccessControlAttributeConfiguration
-> InstanceAccessControlAttributeConfiguration -> Bool
$c/= :: InstanceAccessControlAttributeConfiguration
-> InstanceAccessControlAttributeConfiguration -> Bool
== :: InstanceAccessControlAttributeConfiguration
-> InstanceAccessControlAttributeConfiguration -> Bool
$c== :: InstanceAccessControlAttributeConfiguration
-> InstanceAccessControlAttributeConfiguration -> Bool
Prelude.Eq, ReadPrec [InstanceAccessControlAttributeConfiguration]
ReadPrec InstanceAccessControlAttributeConfiguration
Int -> ReadS InstanceAccessControlAttributeConfiguration
ReadS [InstanceAccessControlAttributeConfiguration]
(Int -> ReadS InstanceAccessControlAttributeConfiguration)
-> ReadS [InstanceAccessControlAttributeConfiguration]
-> ReadPrec InstanceAccessControlAttributeConfiguration
-> ReadPrec [InstanceAccessControlAttributeConfiguration]
-> Read InstanceAccessControlAttributeConfiguration
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [InstanceAccessControlAttributeConfiguration]
$creadListPrec :: ReadPrec [InstanceAccessControlAttributeConfiguration]
readPrec :: ReadPrec InstanceAccessControlAttributeConfiguration
$creadPrec :: ReadPrec InstanceAccessControlAttributeConfiguration
readList :: ReadS [InstanceAccessControlAttributeConfiguration]
$creadList :: ReadS [InstanceAccessControlAttributeConfiguration]
readsPrec :: Int -> ReadS InstanceAccessControlAttributeConfiguration
$creadsPrec :: Int -> ReadS InstanceAccessControlAttributeConfiguration
Prelude.Read, Int -> InstanceAccessControlAttributeConfiguration -> ShowS
[InstanceAccessControlAttributeConfiguration] -> ShowS
InstanceAccessControlAttributeConfiguration -> String
(Int -> InstanceAccessControlAttributeConfiguration -> ShowS)
-> (InstanceAccessControlAttributeConfiguration -> String)
-> ([InstanceAccessControlAttributeConfiguration] -> ShowS)
-> Show InstanceAccessControlAttributeConfiguration
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [InstanceAccessControlAttributeConfiguration] -> ShowS
$cshowList :: [InstanceAccessControlAttributeConfiguration] -> ShowS
show :: InstanceAccessControlAttributeConfiguration -> String
$cshow :: InstanceAccessControlAttributeConfiguration -> String
showsPrec :: Int -> InstanceAccessControlAttributeConfiguration -> ShowS
$cshowsPrec :: Int -> InstanceAccessControlAttributeConfiguration -> ShowS
Prelude.Show, (forall x.
 InstanceAccessControlAttributeConfiguration
 -> Rep InstanceAccessControlAttributeConfiguration x)
-> (forall x.
    Rep InstanceAccessControlAttributeConfiguration x
    -> InstanceAccessControlAttributeConfiguration)
-> Generic InstanceAccessControlAttributeConfiguration
forall x.
Rep InstanceAccessControlAttributeConfiguration x
-> InstanceAccessControlAttributeConfiguration
forall x.
InstanceAccessControlAttributeConfiguration
-> Rep InstanceAccessControlAttributeConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep InstanceAccessControlAttributeConfiguration x
-> InstanceAccessControlAttributeConfiguration
$cfrom :: forall x.
InstanceAccessControlAttributeConfiguration
-> Rep InstanceAccessControlAttributeConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'InstanceAccessControlAttributeConfiguration' 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:
--
-- 'accessControlAttributes', 'instanceAccessControlAttributeConfiguration_accessControlAttributes' - Lists the attributes that are configured for ABAC in the specified
-- Amazon Web Services SSO instance.
newInstanceAccessControlAttributeConfiguration ::
  InstanceAccessControlAttributeConfiguration
newInstanceAccessControlAttributeConfiguration :: InstanceAccessControlAttributeConfiguration
newInstanceAccessControlAttributeConfiguration =
  InstanceAccessControlAttributeConfiguration' :: [AccessControlAttribute]
-> InstanceAccessControlAttributeConfiguration
InstanceAccessControlAttributeConfiguration'
    { $sel:accessControlAttributes:InstanceAccessControlAttributeConfiguration' :: [AccessControlAttribute]
accessControlAttributes =
        [AccessControlAttribute]
forall a. Monoid a => a
Prelude.mempty
    }

-- | Lists the attributes that are configured for ABAC in the specified
-- Amazon Web Services SSO instance.
instanceAccessControlAttributeConfiguration_accessControlAttributes :: Lens.Lens' InstanceAccessControlAttributeConfiguration [AccessControlAttribute]
instanceAccessControlAttributeConfiguration_accessControlAttributes :: ([AccessControlAttribute] -> f [AccessControlAttribute])
-> InstanceAccessControlAttributeConfiguration
-> f InstanceAccessControlAttributeConfiguration
instanceAccessControlAttributeConfiguration_accessControlAttributes = (InstanceAccessControlAttributeConfiguration
 -> [AccessControlAttribute])
-> (InstanceAccessControlAttributeConfiguration
    -> [AccessControlAttribute]
    -> InstanceAccessControlAttributeConfiguration)
-> Lens
     InstanceAccessControlAttributeConfiguration
     InstanceAccessControlAttributeConfiguration
     [AccessControlAttribute]
     [AccessControlAttribute]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InstanceAccessControlAttributeConfiguration' {[AccessControlAttribute]
accessControlAttributes :: [AccessControlAttribute]
$sel:accessControlAttributes:InstanceAccessControlAttributeConfiguration' :: InstanceAccessControlAttributeConfiguration
-> [AccessControlAttribute]
accessControlAttributes} -> [AccessControlAttribute]
accessControlAttributes) (\s :: InstanceAccessControlAttributeConfiguration
s@InstanceAccessControlAttributeConfiguration' {} [AccessControlAttribute]
a -> InstanceAccessControlAttributeConfiguration
s {$sel:accessControlAttributes:InstanceAccessControlAttributeConfiguration' :: [AccessControlAttribute]
accessControlAttributes = [AccessControlAttribute]
a} :: InstanceAccessControlAttributeConfiguration) (([AccessControlAttribute] -> f [AccessControlAttribute])
 -> InstanceAccessControlAttributeConfiguration
 -> f InstanceAccessControlAttributeConfiguration)
-> (([AccessControlAttribute] -> f [AccessControlAttribute])
    -> [AccessControlAttribute] -> f [AccessControlAttribute])
-> ([AccessControlAttribute] -> f [AccessControlAttribute])
-> InstanceAccessControlAttributeConfiguration
-> f InstanceAccessControlAttributeConfiguration
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([AccessControlAttribute] -> f [AccessControlAttribute])
-> [AccessControlAttribute] -> f [AccessControlAttribute]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance
  Core.FromJSON
    InstanceAccessControlAttributeConfiguration
  where
  parseJSON :: Value -> Parser InstanceAccessControlAttributeConfiguration
parseJSON =
    String
-> (Object -> Parser InstanceAccessControlAttributeConfiguration)
-> Value
-> Parser InstanceAccessControlAttributeConfiguration
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"InstanceAccessControlAttributeConfiguration"
      ( \Object
x ->
          [AccessControlAttribute]
-> InstanceAccessControlAttributeConfiguration
InstanceAccessControlAttributeConfiguration'
            ([AccessControlAttribute]
 -> InstanceAccessControlAttributeConfiguration)
-> Parser [AccessControlAttribute]
-> Parser InstanceAccessControlAttributeConfiguration
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( Object
x Object -> Text -> Parser (Maybe [AccessControlAttribute])
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"AccessControlAttributes"
                            Parser (Maybe [AccessControlAttribute])
-> [AccessControlAttribute] -> Parser [AccessControlAttribute]
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= [AccessControlAttribute]
forall a. Monoid a => a
Prelude.mempty
                        )
      )

instance
  Prelude.Hashable
    InstanceAccessControlAttributeConfiguration

instance
  Prelude.NFData
    InstanceAccessControlAttributeConfiguration

instance
  Core.ToJSON
    InstanceAccessControlAttributeConfiguration
  where
  toJSON :: InstanceAccessControlAttributeConfiguration -> Value
toJSON
    InstanceAccessControlAttributeConfiguration' {[AccessControlAttribute]
accessControlAttributes :: [AccessControlAttribute]
$sel:accessControlAttributes:InstanceAccessControlAttributeConfiguration' :: InstanceAccessControlAttributeConfiguration
-> [AccessControlAttribute]
..} =
      [Pair] -> Value
Core.object
        ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
            [ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
                ( Text
"AccessControlAttributes"
                    Text -> [AccessControlAttribute] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= [AccessControlAttribute]
accessControlAttributes
                )
            ]
        )