{-# 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.SecurityHub.Types.AwsEcsTaskDefinitionContainerDefinitionsVolumesFromDetails
-- 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.SecurityHub.Types.AwsEcsTaskDefinitionContainerDefinitionsVolumesFromDetails where

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

-- | A data volume to mount from another container.
--
-- /See:/ 'newAwsEcsTaskDefinitionContainerDefinitionsVolumesFromDetails' smart constructor.
data AwsEcsTaskDefinitionContainerDefinitionsVolumesFromDetails = AwsEcsTaskDefinitionContainerDefinitionsVolumesFromDetails'
  { -- | The name of another container within the same task definition from which
    -- to mount volumes.
    AwsEcsTaskDefinitionContainerDefinitionsVolumesFromDetails
-> Maybe Text
sourceContainer :: Prelude.Maybe Prelude.Text,
    -- | Whether the container has read-only access to the volume.
    AwsEcsTaskDefinitionContainerDefinitionsVolumesFromDetails
-> Maybe Bool
readOnly :: Prelude.Maybe Prelude.Bool
  }
  deriving (AwsEcsTaskDefinitionContainerDefinitionsVolumesFromDetails
-> AwsEcsTaskDefinitionContainerDefinitionsVolumesFromDetails
-> Bool
(AwsEcsTaskDefinitionContainerDefinitionsVolumesFromDetails
 -> AwsEcsTaskDefinitionContainerDefinitionsVolumesFromDetails
 -> Bool)
-> (AwsEcsTaskDefinitionContainerDefinitionsVolumesFromDetails
    -> AwsEcsTaskDefinitionContainerDefinitionsVolumesFromDetails
    -> Bool)
-> Eq AwsEcsTaskDefinitionContainerDefinitionsVolumesFromDetails
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AwsEcsTaskDefinitionContainerDefinitionsVolumesFromDetails
-> AwsEcsTaskDefinitionContainerDefinitionsVolumesFromDetails
-> Bool
$c/= :: AwsEcsTaskDefinitionContainerDefinitionsVolumesFromDetails
-> AwsEcsTaskDefinitionContainerDefinitionsVolumesFromDetails
-> Bool
== :: AwsEcsTaskDefinitionContainerDefinitionsVolumesFromDetails
-> AwsEcsTaskDefinitionContainerDefinitionsVolumesFromDetails
-> Bool
$c== :: AwsEcsTaskDefinitionContainerDefinitionsVolumesFromDetails
-> AwsEcsTaskDefinitionContainerDefinitionsVolumesFromDetails
-> Bool
Prelude.Eq, ReadPrec
  [AwsEcsTaskDefinitionContainerDefinitionsVolumesFromDetails]
ReadPrec AwsEcsTaskDefinitionContainerDefinitionsVolumesFromDetails
Int
-> ReadS AwsEcsTaskDefinitionContainerDefinitionsVolumesFromDetails
ReadS [AwsEcsTaskDefinitionContainerDefinitionsVolumesFromDetails]
(Int
 -> ReadS
      AwsEcsTaskDefinitionContainerDefinitionsVolumesFromDetails)
-> ReadS
     [AwsEcsTaskDefinitionContainerDefinitionsVolumesFromDetails]
-> ReadPrec
     AwsEcsTaskDefinitionContainerDefinitionsVolumesFromDetails
-> ReadPrec
     [AwsEcsTaskDefinitionContainerDefinitionsVolumesFromDetails]
-> Read AwsEcsTaskDefinitionContainerDefinitionsVolumesFromDetails
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec
  [AwsEcsTaskDefinitionContainerDefinitionsVolumesFromDetails]
$creadListPrec :: ReadPrec
  [AwsEcsTaskDefinitionContainerDefinitionsVolumesFromDetails]
readPrec :: ReadPrec AwsEcsTaskDefinitionContainerDefinitionsVolumesFromDetails
$creadPrec :: ReadPrec AwsEcsTaskDefinitionContainerDefinitionsVolumesFromDetails
readList :: ReadS [AwsEcsTaskDefinitionContainerDefinitionsVolumesFromDetails]
$creadList :: ReadS [AwsEcsTaskDefinitionContainerDefinitionsVolumesFromDetails]
readsPrec :: Int
-> ReadS AwsEcsTaskDefinitionContainerDefinitionsVolumesFromDetails
$creadsPrec :: Int
-> ReadS AwsEcsTaskDefinitionContainerDefinitionsVolumesFromDetails
Prelude.Read, Int
-> AwsEcsTaskDefinitionContainerDefinitionsVolumesFromDetails
-> ShowS
[AwsEcsTaskDefinitionContainerDefinitionsVolumesFromDetails]
-> ShowS
AwsEcsTaskDefinitionContainerDefinitionsVolumesFromDetails
-> String
(Int
 -> AwsEcsTaskDefinitionContainerDefinitionsVolumesFromDetails
 -> ShowS)
-> (AwsEcsTaskDefinitionContainerDefinitionsVolumesFromDetails
    -> String)
-> ([AwsEcsTaskDefinitionContainerDefinitionsVolumesFromDetails]
    -> ShowS)
-> Show AwsEcsTaskDefinitionContainerDefinitionsVolumesFromDetails
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AwsEcsTaskDefinitionContainerDefinitionsVolumesFromDetails]
-> ShowS
$cshowList :: [AwsEcsTaskDefinitionContainerDefinitionsVolumesFromDetails]
-> ShowS
show :: AwsEcsTaskDefinitionContainerDefinitionsVolumesFromDetails
-> String
$cshow :: AwsEcsTaskDefinitionContainerDefinitionsVolumesFromDetails
-> String
showsPrec :: Int
-> AwsEcsTaskDefinitionContainerDefinitionsVolumesFromDetails
-> ShowS
$cshowsPrec :: Int
-> AwsEcsTaskDefinitionContainerDefinitionsVolumesFromDetails
-> ShowS
Prelude.Show, (forall x.
 AwsEcsTaskDefinitionContainerDefinitionsVolumesFromDetails
 -> Rep
      AwsEcsTaskDefinitionContainerDefinitionsVolumesFromDetails x)
-> (forall x.
    Rep AwsEcsTaskDefinitionContainerDefinitionsVolumesFromDetails x
    -> AwsEcsTaskDefinitionContainerDefinitionsVolumesFromDetails)
-> Generic
     AwsEcsTaskDefinitionContainerDefinitionsVolumesFromDetails
forall x.
Rep AwsEcsTaskDefinitionContainerDefinitionsVolumesFromDetails x
-> AwsEcsTaskDefinitionContainerDefinitionsVolumesFromDetails
forall x.
AwsEcsTaskDefinitionContainerDefinitionsVolumesFromDetails
-> Rep AwsEcsTaskDefinitionContainerDefinitionsVolumesFromDetails x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AwsEcsTaskDefinitionContainerDefinitionsVolumesFromDetails x
-> AwsEcsTaskDefinitionContainerDefinitionsVolumesFromDetails
$cfrom :: forall x.
AwsEcsTaskDefinitionContainerDefinitionsVolumesFromDetails
-> Rep AwsEcsTaskDefinitionContainerDefinitionsVolumesFromDetails x
Prelude.Generic)

-- |
-- Create a value of 'AwsEcsTaskDefinitionContainerDefinitionsVolumesFromDetails' 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:
--
-- 'sourceContainer', 'awsEcsTaskDefinitionContainerDefinitionsVolumesFromDetails_sourceContainer' - The name of another container within the same task definition from which
-- to mount volumes.
--
-- 'readOnly', 'awsEcsTaskDefinitionContainerDefinitionsVolumesFromDetails_readOnly' - Whether the container has read-only access to the volume.
newAwsEcsTaskDefinitionContainerDefinitionsVolumesFromDetails ::
  AwsEcsTaskDefinitionContainerDefinitionsVolumesFromDetails
newAwsEcsTaskDefinitionContainerDefinitionsVolumesFromDetails :: AwsEcsTaskDefinitionContainerDefinitionsVolumesFromDetails
newAwsEcsTaskDefinitionContainerDefinitionsVolumesFromDetails =
  AwsEcsTaskDefinitionContainerDefinitionsVolumesFromDetails' :: Maybe Text
-> Maybe Bool
-> AwsEcsTaskDefinitionContainerDefinitionsVolumesFromDetails
AwsEcsTaskDefinitionContainerDefinitionsVolumesFromDetails'
    { $sel:sourceContainer:AwsEcsTaskDefinitionContainerDefinitionsVolumesFromDetails' :: Maybe Text
sourceContainer =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:readOnly:AwsEcsTaskDefinitionContainerDefinitionsVolumesFromDetails' :: Maybe Bool
readOnly =
        Maybe Bool
forall a. Maybe a
Prelude.Nothing
    }

-- | The name of another container within the same task definition from which
-- to mount volumes.
awsEcsTaskDefinitionContainerDefinitionsVolumesFromDetails_sourceContainer :: Lens.Lens' AwsEcsTaskDefinitionContainerDefinitionsVolumesFromDetails (Prelude.Maybe Prelude.Text)
awsEcsTaskDefinitionContainerDefinitionsVolumesFromDetails_sourceContainer :: (Maybe Text -> f (Maybe Text))
-> AwsEcsTaskDefinitionContainerDefinitionsVolumesFromDetails
-> f AwsEcsTaskDefinitionContainerDefinitionsVolumesFromDetails
awsEcsTaskDefinitionContainerDefinitionsVolumesFromDetails_sourceContainer = (AwsEcsTaskDefinitionContainerDefinitionsVolumesFromDetails
 -> Maybe Text)
-> (AwsEcsTaskDefinitionContainerDefinitionsVolumesFromDetails
    -> Maybe Text
    -> AwsEcsTaskDefinitionContainerDefinitionsVolumesFromDetails)
-> Lens
     AwsEcsTaskDefinitionContainerDefinitionsVolumesFromDetails
     AwsEcsTaskDefinitionContainerDefinitionsVolumesFromDetails
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsEcsTaskDefinitionContainerDefinitionsVolumesFromDetails' {Maybe Text
sourceContainer :: Maybe Text
$sel:sourceContainer:AwsEcsTaskDefinitionContainerDefinitionsVolumesFromDetails' :: AwsEcsTaskDefinitionContainerDefinitionsVolumesFromDetails
-> Maybe Text
sourceContainer} -> Maybe Text
sourceContainer) (\s :: AwsEcsTaskDefinitionContainerDefinitionsVolumesFromDetails
s@AwsEcsTaskDefinitionContainerDefinitionsVolumesFromDetails' {} Maybe Text
a -> AwsEcsTaskDefinitionContainerDefinitionsVolumesFromDetails
s {$sel:sourceContainer:AwsEcsTaskDefinitionContainerDefinitionsVolumesFromDetails' :: Maybe Text
sourceContainer = Maybe Text
a} :: AwsEcsTaskDefinitionContainerDefinitionsVolumesFromDetails)

-- | Whether the container has read-only access to the volume.
awsEcsTaskDefinitionContainerDefinitionsVolumesFromDetails_readOnly :: Lens.Lens' AwsEcsTaskDefinitionContainerDefinitionsVolumesFromDetails (Prelude.Maybe Prelude.Bool)
awsEcsTaskDefinitionContainerDefinitionsVolumesFromDetails_readOnly :: (Maybe Bool -> f (Maybe Bool))
-> AwsEcsTaskDefinitionContainerDefinitionsVolumesFromDetails
-> f AwsEcsTaskDefinitionContainerDefinitionsVolumesFromDetails
awsEcsTaskDefinitionContainerDefinitionsVolumesFromDetails_readOnly = (AwsEcsTaskDefinitionContainerDefinitionsVolumesFromDetails
 -> Maybe Bool)
-> (AwsEcsTaskDefinitionContainerDefinitionsVolumesFromDetails
    -> Maybe Bool
    -> AwsEcsTaskDefinitionContainerDefinitionsVolumesFromDetails)
-> Lens
     AwsEcsTaskDefinitionContainerDefinitionsVolumesFromDetails
     AwsEcsTaskDefinitionContainerDefinitionsVolumesFromDetails
     (Maybe Bool)
     (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsEcsTaskDefinitionContainerDefinitionsVolumesFromDetails' {Maybe Bool
readOnly :: Maybe Bool
$sel:readOnly:AwsEcsTaskDefinitionContainerDefinitionsVolumesFromDetails' :: AwsEcsTaskDefinitionContainerDefinitionsVolumesFromDetails
-> Maybe Bool
readOnly} -> Maybe Bool
readOnly) (\s :: AwsEcsTaskDefinitionContainerDefinitionsVolumesFromDetails
s@AwsEcsTaskDefinitionContainerDefinitionsVolumesFromDetails' {} Maybe Bool
a -> AwsEcsTaskDefinitionContainerDefinitionsVolumesFromDetails
s {$sel:readOnly:AwsEcsTaskDefinitionContainerDefinitionsVolumesFromDetails' :: Maybe Bool
readOnly = Maybe Bool
a} :: AwsEcsTaskDefinitionContainerDefinitionsVolumesFromDetails)

instance
  Core.FromJSON
    AwsEcsTaskDefinitionContainerDefinitionsVolumesFromDetails
  where
  parseJSON :: Value
-> Parser
     AwsEcsTaskDefinitionContainerDefinitionsVolumesFromDetails
parseJSON =
    String
-> (Object
    -> Parser
         AwsEcsTaskDefinitionContainerDefinitionsVolumesFromDetails)
-> Value
-> Parser
     AwsEcsTaskDefinitionContainerDefinitionsVolumesFromDetails
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"AwsEcsTaskDefinitionContainerDefinitionsVolumesFromDetails"
      ( \Object
x ->
          Maybe Text
-> Maybe Bool
-> AwsEcsTaskDefinitionContainerDefinitionsVolumesFromDetails
AwsEcsTaskDefinitionContainerDefinitionsVolumesFromDetails'
            (Maybe Text
 -> Maybe Bool
 -> AwsEcsTaskDefinitionContainerDefinitionsVolumesFromDetails)
-> Parser (Maybe Text)
-> Parser
     (Maybe Bool
      -> AwsEcsTaskDefinitionContainerDefinitionsVolumesFromDetails)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"SourceContainer")
              Parser
  (Maybe Bool
   -> AwsEcsTaskDefinitionContainerDefinitionsVolumesFromDetails)
-> Parser (Maybe Bool)
-> Parser
     AwsEcsTaskDefinitionContainerDefinitionsVolumesFromDetails
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ReadOnly")
      )

instance
  Prelude.Hashable
    AwsEcsTaskDefinitionContainerDefinitionsVolumesFromDetails

instance
  Prelude.NFData
    AwsEcsTaskDefinitionContainerDefinitionsVolumesFromDetails

instance
  Core.ToJSON
    AwsEcsTaskDefinitionContainerDefinitionsVolumesFromDetails
  where
  toJSON :: AwsEcsTaskDefinitionContainerDefinitionsVolumesFromDetails -> Value
toJSON
    AwsEcsTaskDefinitionContainerDefinitionsVolumesFromDetails' {Maybe Bool
Maybe Text
readOnly :: Maybe Bool
sourceContainer :: Maybe Text
$sel:readOnly:AwsEcsTaskDefinitionContainerDefinitionsVolumesFromDetails' :: AwsEcsTaskDefinitionContainerDefinitionsVolumesFromDetails
-> Maybe Bool
$sel:sourceContainer:AwsEcsTaskDefinitionContainerDefinitionsVolumesFromDetails' :: AwsEcsTaskDefinitionContainerDefinitionsVolumesFromDetails
-> Maybe Text
..} =
      [Pair] -> Value
Core.object
        ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
            [ (Text
"SourceContainer" 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
sourceContainer,
              (Text
"ReadOnly" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
readOnly
            ]
        )