{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.StorageGateway.Types.SMBLocalGroups where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
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
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]
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
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. 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' {$sel:gatewayAdmins:SMBLocalGroups' :: Maybe [Text]
gatewayAdmins = 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 :: Lens' SMBLocalGroups (Maybe [Text])
sMBLocalGroups_gatewayAdmins = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance Prelude.Hashable SMBLocalGroups where
  hashWithSalt :: Int -> SMBLocalGroups -> Int
hashWithSalt Int
_salt SMBLocalGroups' {Maybe [Text]
gatewayAdmins :: Maybe [Text]
$sel:gatewayAdmins:SMBLocalGroups' :: SMBLocalGroups -> Maybe [Text]
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Text]
gatewayAdmins

instance Prelude.NFData SMBLocalGroups where
  rnf :: SMBLocalGroups -> ()
rnf SMBLocalGroups' {Maybe [Text]
gatewayAdmins :: Maybe [Text]
$sel:gatewayAdmins:SMBLocalGroups' :: SMBLocalGroups -> Maybe [Text]
..} = forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
gatewayAdmins

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