{-# 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.StorageGateway.Types.SMBLocalGroups
-- 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.StorageGateway.Types.SMBLocalGroups where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | A list of Active Directory users and groups that have special
-- permissions for SMB file shares on the gateway.
--
-- /See:/ 'newSMBLocalGroups' smart constructor.
data SMBLocalGroups = SMBLocalGroups'
  { -- | A list of Active Directory users and groups that have local Gateway
    -- Admin permissions. Acceptable formats include: @DOMAIN\\User1@, @user1@,
    -- @DOMAIN\\group1@, and @group1@.
    --
    -- Gateway Admins can use the Shared Folders Microsoft Management Console
    -- snap-in to force-close files that are open and locked.
    SMBLocalGroups -> Maybe [Text]
gatewayAdmins :: Prelude.Maybe [Prelude.Text]
  }
  deriving (SMBLocalGroups -> SMBLocalGroups -> Bool
(SMBLocalGroups -> SMBLocalGroups -> Bool)
-> (SMBLocalGroups -> SMBLocalGroups -> Bool) -> Eq SMBLocalGroups
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SMBLocalGroups -> SMBLocalGroups -> Bool
$c/= :: SMBLocalGroups -> SMBLocalGroups -> Bool
== :: SMBLocalGroups -> SMBLocalGroups -> Bool
$c== :: SMBLocalGroups -> SMBLocalGroups -> Bool
Prelude.Eq, ReadPrec [SMBLocalGroups]
ReadPrec SMBLocalGroups
Int -> ReadS SMBLocalGroups
ReadS [SMBLocalGroups]
(Int -> ReadS SMBLocalGroups)
-> ReadS [SMBLocalGroups]
-> ReadPrec SMBLocalGroups
-> ReadPrec [SMBLocalGroups]
-> Read SMBLocalGroups
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SMBLocalGroups]
$creadListPrec :: ReadPrec [SMBLocalGroups]
readPrec :: ReadPrec SMBLocalGroups
$creadPrec :: ReadPrec SMBLocalGroups
readList :: ReadS [SMBLocalGroups]
$creadList :: ReadS [SMBLocalGroups]
readsPrec :: Int -> ReadS SMBLocalGroups
$creadsPrec :: Int -> ReadS SMBLocalGroups
Prelude.Read, Int -> SMBLocalGroups -> ShowS
[SMBLocalGroups] -> ShowS
SMBLocalGroups -> String
(Int -> SMBLocalGroups -> ShowS)
-> (SMBLocalGroups -> String)
-> ([SMBLocalGroups] -> ShowS)
-> Show SMBLocalGroups
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SMBLocalGroups] -> ShowS
$cshowList :: [SMBLocalGroups] -> ShowS
show :: SMBLocalGroups -> String
$cshow :: SMBLocalGroups -> String
showsPrec :: Int -> SMBLocalGroups -> ShowS
$cshowsPrec :: Int -> SMBLocalGroups -> ShowS
Prelude.Show, (forall x. SMBLocalGroups -> Rep SMBLocalGroups x)
-> (forall x. Rep SMBLocalGroups x -> SMBLocalGroups)
-> Generic SMBLocalGroups
forall x. Rep SMBLocalGroups x -> SMBLocalGroups
forall x. SMBLocalGroups -> Rep SMBLocalGroups x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SMBLocalGroups x -> SMBLocalGroups
$cfrom :: forall x. SMBLocalGroups -> Rep SMBLocalGroups x
Prelude.Generic)

-- |
-- Create a value of 'SMBLocalGroups' 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:
--
-- 'gatewayAdmins', 'sMBLocalGroups_gatewayAdmins' - A list of Active Directory users and groups that have local Gateway
-- Admin permissions. Acceptable formats include: @DOMAIN\\User1@, @user1@,
-- @DOMAIN\\group1@, and @group1@.
--
-- Gateway Admins can use the Shared Folders Microsoft Management Console
-- snap-in to force-close files that are open and locked.
newSMBLocalGroups ::
  SMBLocalGroups
newSMBLocalGroups :: SMBLocalGroups
newSMBLocalGroups =
  SMBLocalGroups' :: Maybe [Text] -> SMBLocalGroups
SMBLocalGroups' {$sel:gatewayAdmins:SMBLocalGroups' :: Maybe [Text]
gatewayAdmins = Maybe [Text]
forall a. Maybe a
Prelude.Nothing}

-- | A list of Active Directory users and groups that have local Gateway
-- Admin permissions. Acceptable formats include: @DOMAIN\\User1@, @user1@,
-- @DOMAIN\\group1@, and @group1@.
--
-- Gateway Admins can use the Shared Folders Microsoft Management Console
-- snap-in to force-close files that are open and locked.
sMBLocalGroups_gatewayAdmins :: Lens.Lens' SMBLocalGroups (Prelude.Maybe [Prelude.Text])
sMBLocalGroups_gatewayAdmins :: (Maybe [Text] -> f (Maybe [Text]))
-> SMBLocalGroups -> f SMBLocalGroups
sMBLocalGroups_gatewayAdmins = (SMBLocalGroups -> Maybe [Text])
-> (SMBLocalGroups -> Maybe [Text] -> SMBLocalGroups)
-> Lens SMBLocalGroups SMBLocalGroups (Maybe [Text]) (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SMBLocalGroups' {Maybe [Text]
gatewayAdmins :: Maybe [Text]
$sel:gatewayAdmins:SMBLocalGroups' :: SMBLocalGroups -> Maybe [Text]
gatewayAdmins} -> Maybe [Text]
gatewayAdmins) (\s :: SMBLocalGroups
s@SMBLocalGroups' {} Maybe [Text]
a -> SMBLocalGroups
s {$sel:gatewayAdmins:SMBLocalGroups' :: Maybe [Text]
gatewayAdmins = Maybe [Text]
a} :: SMBLocalGroups) ((Maybe [Text] -> f (Maybe [Text]))
 -> SMBLocalGroups -> f SMBLocalGroups)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> SMBLocalGroups
-> f SMBLocalGroups
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance Prelude.Hashable SMBLocalGroups

instance Prelude.NFData SMBLocalGroups

instance Core.ToJSON SMBLocalGroups where
  toJSON :: SMBLocalGroups -> Value
toJSON SMBLocalGroups' {Maybe [Text]
gatewayAdmins :: Maybe [Text]
$sel:gatewayAdmins:SMBLocalGroups' :: SMBLocalGroups -> Maybe [Text]
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"GatewayAdmins" Text -> [Text] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              ([Text] -> Pair) -> Maybe [Text] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Text]
gatewayAdmins
          ]
      )