{-# 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.GuardDuty.Types.SecurityContext
-- 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.GuardDuty.Types.SecurityContext 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

-- | Container security context.
--
-- /See:/ 'newSecurityContext' smart constructor.
data SecurityContext = SecurityContext'
  { -- | Whether the container is privileged.
    SecurityContext -> Maybe Bool
privileged :: Prelude.Maybe Prelude.Bool
  }
  deriving (SecurityContext -> SecurityContext -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SecurityContext -> SecurityContext -> Bool
$c/= :: SecurityContext -> SecurityContext -> Bool
== :: SecurityContext -> SecurityContext -> Bool
$c== :: SecurityContext -> SecurityContext -> Bool
Prelude.Eq, ReadPrec [SecurityContext]
ReadPrec SecurityContext
Int -> ReadS SecurityContext
ReadS [SecurityContext]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SecurityContext]
$creadListPrec :: ReadPrec [SecurityContext]
readPrec :: ReadPrec SecurityContext
$creadPrec :: ReadPrec SecurityContext
readList :: ReadS [SecurityContext]
$creadList :: ReadS [SecurityContext]
readsPrec :: Int -> ReadS SecurityContext
$creadsPrec :: Int -> ReadS SecurityContext
Prelude.Read, Int -> SecurityContext -> ShowS
[SecurityContext] -> ShowS
SecurityContext -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SecurityContext] -> ShowS
$cshowList :: [SecurityContext] -> ShowS
show :: SecurityContext -> String
$cshow :: SecurityContext -> String
showsPrec :: Int -> SecurityContext -> ShowS
$cshowsPrec :: Int -> SecurityContext -> ShowS
Prelude.Show, forall x. Rep SecurityContext x -> SecurityContext
forall x. SecurityContext -> Rep SecurityContext x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SecurityContext x -> SecurityContext
$cfrom :: forall x. SecurityContext -> Rep SecurityContext x
Prelude.Generic)

-- |
-- Create a value of 'SecurityContext' 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:
--
-- 'privileged', 'securityContext_privileged' - Whether the container is privileged.
newSecurityContext ::
  SecurityContext
newSecurityContext :: SecurityContext
newSecurityContext =
  SecurityContext' {$sel:privileged:SecurityContext' :: Maybe Bool
privileged = forall a. Maybe a
Prelude.Nothing}

-- | Whether the container is privileged.
securityContext_privileged :: Lens.Lens' SecurityContext (Prelude.Maybe Prelude.Bool)
securityContext_privileged :: Lens' SecurityContext (Maybe Bool)
securityContext_privileged = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SecurityContext' {Maybe Bool
privileged :: Maybe Bool
$sel:privileged:SecurityContext' :: SecurityContext -> Maybe Bool
privileged} -> Maybe Bool
privileged) (\s :: SecurityContext
s@SecurityContext' {} Maybe Bool
a -> SecurityContext
s {$sel:privileged:SecurityContext' :: Maybe Bool
privileged = Maybe Bool
a} :: SecurityContext)

instance Data.FromJSON SecurityContext where
  parseJSON :: Value -> Parser SecurityContext
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"SecurityContext"
      ( \Object
x ->
          Maybe Bool -> SecurityContext
SecurityContext'
            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
"privileged")
      )

instance Prelude.Hashable SecurityContext where
  hashWithSalt :: Int -> SecurityContext -> Int
hashWithSalt Int
_salt SecurityContext' {Maybe Bool
privileged :: Maybe Bool
$sel:privileged:SecurityContext' :: SecurityContext -> Maybe Bool
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
privileged

instance Prelude.NFData SecurityContext where
  rnf :: SecurityContext -> ()
rnf SecurityContext' {Maybe Bool
privileged :: Maybe Bool
$sel:privileged:SecurityContext' :: SecurityContext -> Maybe Bool
..} = forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
privileged