{-# 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.AwsEcsTaskDefinitionContainerDefinitionsSecretsDetails
-- 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.AwsEcsTaskDefinitionContainerDefinitionsSecretsDetails where

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

-- | A secret to pass to the container.
--
-- /See:/ 'newAwsEcsTaskDefinitionContainerDefinitionsSecretsDetails' smart constructor.
data AwsEcsTaskDefinitionContainerDefinitionsSecretsDetails = AwsEcsTaskDefinitionContainerDefinitionsSecretsDetails'
  { -- | The name of the secret.
    AwsEcsTaskDefinitionContainerDefinitionsSecretsDetails
-> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The secret to expose to the container. The value is either the full ARN
    -- of the Secrets Manager secret or the full ARN of the parameter in the
    -- Systems Manager Parameter Store.
    AwsEcsTaskDefinitionContainerDefinitionsSecretsDetails
-> Maybe Text
valueFrom :: Prelude.Maybe Prelude.Text
  }
  deriving (AwsEcsTaskDefinitionContainerDefinitionsSecretsDetails
-> AwsEcsTaskDefinitionContainerDefinitionsSecretsDetails -> Bool
(AwsEcsTaskDefinitionContainerDefinitionsSecretsDetails
 -> AwsEcsTaskDefinitionContainerDefinitionsSecretsDetails -> Bool)
-> (AwsEcsTaskDefinitionContainerDefinitionsSecretsDetails
    -> AwsEcsTaskDefinitionContainerDefinitionsSecretsDetails -> Bool)
-> Eq AwsEcsTaskDefinitionContainerDefinitionsSecretsDetails
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AwsEcsTaskDefinitionContainerDefinitionsSecretsDetails
-> AwsEcsTaskDefinitionContainerDefinitionsSecretsDetails -> Bool
$c/= :: AwsEcsTaskDefinitionContainerDefinitionsSecretsDetails
-> AwsEcsTaskDefinitionContainerDefinitionsSecretsDetails -> Bool
== :: AwsEcsTaskDefinitionContainerDefinitionsSecretsDetails
-> AwsEcsTaskDefinitionContainerDefinitionsSecretsDetails -> Bool
$c== :: AwsEcsTaskDefinitionContainerDefinitionsSecretsDetails
-> AwsEcsTaskDefinitionContainerDefinitionsSecretsDetails -> Bool
Prelude.Eq, ReadPrec [AwsEcsTaskDefinitionContainerDefinitionsSecretsDetails]
ReadPrec AwsEcsTaskDefinitionContainerDefinitionsSecretsDetails
Int -> ReadS AwsEcsTaskDefinitionContainerDefinitionsSecretsDetails
ReadS [AwsEcsTaskDefinitionContainerDefinitionsSecretsDetails]
(Int
 -> ReadS AwsEcsTaskDefinitionContainerDefinitionsSecretsDetails)
-> ReadS [AwsEcsTaskDefinitionContainerDefinitionsSecretsDetails]
-> ReadPrec AwsEcsTaskDefinitionContainerDefinitionsSecretsDetails
-> ReadPrec
     [AwsEcsTaskDefinitionContainerDefinitionsSecretsDetails]
-> Read AwsEcsTaskDefinitionContainerDefinitionsSecretsDetails
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AwsEcsTaskDefinitionContainerDefinitionsSecretsDetails]
$creadListPrec :: ReadPrec [AwsEcsTaskDefinitionContainerDefinitionsSecretsDetails]
readPrec :: ReadPrec AwsEcsTaskDefinitionContainerDefinitionsSecretsDetails
$creadPrec :: ReadPrec AwsEcsTaskDefinitionContainerDefinitionsSecretsDetails
readList :: ReadS [AwsEcsTaskDefinitionContainerDefinitionsSecretsDetails]
$creadList :: ReadS [AwsEcsTaskDefinitionContainerDefinitionsSecretsDetails]
readsPrec :: Int -> ReadS AwsEcsTaskDefinitionContainerDefinitionsSecretsDetails
$creadsPrec :: Int -> ReadS AwsEcsTaskDefinitionContainerDefinitionsSecretsDetails
Prelude.Read, Int
-> AwsEcsTaskDefinitionContainerDefinitionsSecretsDetails -> ShowS
[AwsEcsTaskDefinitionContainerDefinitionsSecretsDetails] -> ShowS
AwsEcsTaskDefinitionContainerDefinitionsSecretsDetails -> String
(Int
 -> AwsEcsTaskDefinitionContainerDefinitionsSecretsDetails -> ShowS)
-> (AwsEcsTaskDefinitionContainerDefinitionsSecretsDetails
    -> String)
-> ([AwsEcsTaskDefinitionContainerDefinitionsSecretsDetails]
    -> ShowS)
-> Show AwsEcsTaskDefinitionContainerDefinitionsSecretsDetails
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AwsEcsTaskDefinitionContainerDefinitionsSecretsDetails] -> ShowS
$cshowList :: [AwsEcsTaskDefinitionContainerDefinitionsSecretsDetails] -> ShowS
show :: AwsEcsTaskDefinitionContainerDefinitionsSecretsDetails -> String
$cshow :: AwsEcsTaskDefinitionContainerDefinitionsSecretsDetails -> String
showsPrec :: Int
-> AwsEcsTaskDefinitionContainerDefinitionsSecretsDetails -> ShowS
$cshowsPrec :: Int
-> AwsEcsTaskDefinitionContainerDefinitionsSecretsDetails -> ShowS
Prelude.Show, (forall x.
 AwsEcsTaskDefinitionContainerDefinitionsSecretsDetails
 -> Rep AwsEcsTaskDefinitionContainerDefinitionsSecretsDetails x)
-> (forall x.
    Rep AwsEcsTaskDefinitionContainerDefinitionsSecretsDetails x
    -> AwsEcsTaskDefinitionContainerDefinitionsSecretsDetails)
-> Generic AwsEcsTaskDefinitionContainerDefinitionsSecretsDetails
forall x.
Rep AwsEcsTaskDefinitionContainerDefinitionsSecretsDetails x
-> AwsEcsTaskDefinitionContainerDefinitionsSecretsDetails
forall x.
AwsEcsTaskDefinitionContainerDefinitionsSecretsDetails
-> Rep AwsEcsTaskDefinitionContainerDefinitionsSecretsDetails x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AwsEcsTaskDefinitionContainerDefinitionsSecretsDetails x
-> AwsEcsTaskDefinitionContainerDefinitionsSecretsDetails
$cfrom :: forall x.
AwsEcsTaskDefinitionContainerDefinitionsSecretsDetails
-> Rep AwsEcsTaskDefinitionContainerDefinitionsSecretsDetails x
Prelude.Generic)

-- |
-- Create a value of 'AwsEcsTaskDefinitionContainerDefinitionsSecretsDetails' 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:
--
-- 'name', 'awsEcsTaskDefinitionContainerDefinitionsSecretsDetails_name' - The name of the secret.
--
-- 'valueFrom', 'awsEcsTaskDefinitionContainerDefinitionsSecretsDetails_valueFrom' - The secret to expose to the container. The value is either the full ARN
-- of the Secrets Manager secret or the full ARN of the parameter in the
-- Systems Manager Parameter Store.
newAwsEcsTaskDefinitionContainerDefinitionsSecretsDetails ::
  AwsEcsTaskDefinitionContainerDefinitionsSecretsDetails
newAwsEcsTaskDefinitionContainerDefinitionsSecretsDetails :: AwsEcsTaskDefinitionContainerDefinitionsSecretsDetails
newAwsEcsTaskDefinitionContainerDefinitionsSecretsDetails =
  AwsEcsTaskDefinitionContainerDefinitionsSecretsDetails' :: Maybe Text
-> Maybe Text
-> AwsEcsTaskDefinitionContainerDefinitionsSecretsDetails
AwsEcsTaskDefinitionContainerDefinitionsSecretsDetails'
    { $sel:name:AwsEcsTaskDefinitionContainerDefinitionsSecretsDetails' :: Maybe Text
name =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:valueFrom:AwsEcsTaskDefinitionContainerDefinitionsSecretsDetails' :: Maybe Text
valueFrom =
        Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The name of the secret.
awsEcsTaskDefinitionContainerDefinitionsSecretsDetails_name :: Lens.Lens' AwsEcsTaskDefinitionContainerDefinitionsSecretsDetails (Prelude.Maybe Prelude.Text)
awsEcsTaskDefinitionContainerDefinitionsSecretsDetails_name :: (Maybe Text -> f (Maybe Text))
-> AwsEcsTaskDefinitionContainerDefinitionsSecretsDetails
-> f AwsEcsTaskDefinitionContainerDefinitionsSecretsDetails
awsEcsTaskDefinitionContainerDefinitionsSecretsDetails_name = (AwsEcsTaskDefinitionContainerDefinitionsSecretsDetails
 -> Maybe Text)
-> (AwsEcsTaskDefinitionContainerDefinitionsSecretsDetails
    -> Maybe Text
    -> AwsEcsTaskDefinitionContainerDefinitionsSecretsDetails)
-> Lens
     AwsEcsTaskDefinitionContainerDefinitionsSecretsDetails
     AwsEcsTaskDefinitionContainerDefinitionsSecretsDetails
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsEcsTaskDefinitionContainerDefinitionsSecretsDetails' {Maybe Text
name :: Maybe Text
$sel:name:AwsEcsTaskDefinitionContainerDefinitionsSecretsDetails' :: AwsEcsTaskDefinitionContainerDefinitionsSecretsDetails
-> Maybe Text
name} -> Maybe Text
name) (\s :: AwsEcsTaskDefinitionContainerDefinitionsSecretsDetails
s@AwsEcsTaskDefinitionContainerDefinitionsSecretsDetails' {} Maybe Text
a -> AwsEcsTaskDefinitionContainerDefinitionsSecretsDetails
s {$sel:name:AwsEcsTaskDefinitionContainerDefinitionsSecretsDetails' :: Maybe Text
name = Maybe Text
a} :: AwsEcsTaskDefinitionContainerDefinitionsSecretsDetails)

-- | The secret to expose to the container. The value is either the full ARN
-- of the Secrets Manager secret or the full ARN of the parameter in the
-- Systems Manager Parameter Store.
awsEcsTaskDefinitionContainerDefinitionsSecretsDetails_valueFrom :: Lens.Lens' AwsEcsTaskDefinitionContainerDefinitionsSecretsDetails (Prelude.Maybe Prelude.Text)
awsEcsTaskDefinitionContainerDefinitionsSecretsDetails_valueFrom :: (Maybe Text -> f (Maybe Text))
-> AwsEcsTaskDefinitionContainerDefinitionsSecretsDetails
-> f AwsEcsTaskDefinitionContainerDefinitionsSecretsDetails
awsEcsTaskDefinitionContainerDefinitionsSecretsDetails_valueFrom = (AwsEcsTaskDefinitionContainerDefinitionsSecretsDetails
 -> Maybe Text)
-> (AwsEcsTaskDefinitionContainerDefinitionsSecretsDetails
    -> Maybe Text
    -> AwsEcsTaskDefinitionContainerDefinitionsSecretsDetails)
-> Lens
     AwsEcsTaskDefinitionContainerDefinitionsSecretsDetails
     AwsEcsTaskDefinitionContainerDefinitionsSecretsDetails
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsEcsTaskDefinitionContainerDefinitionsSecretsDetails' {Maybe Text
valueFrom :: Maybe Text
$sel:valueFrom:AwsEcsTaskDefinitionContainerDefinitionsSecretsDetails' :: AwsEcsTaskDefinitionContainerDefinitionsSecretsDetails
-> Maybe Text
valueFrom} -> Maybe Text
valueFrom) (\s :: AwsEcsTaskDefinitionContainerDefinitionsSecretsDetails
s@AwsEcsTaskDefinitionContainerDefinitionsSecretsDetails' {} Maybe Text
a -> AwsEcsTaskDefinitionContainerDefinitionsSecretsDetails
s {$sel:valueFrom:AwsEcsTaskDefinitionContainerDefinitionsSecretsDetails' :: Maybe Text
valueFrom = Maybe Text
a} :: AwsEcsTaskDefinitionContainerDefinitionsSecretsDetails)

instance
  Core.FromJSON
    AwsEcsTaskDefinitionContainerDefinitionsSecretsDetails
  where
  parseJSON :: Value
-> Parser AwsEcsTaskDefinitionContainerDefinitionsSecretsDetails
parseJSON =
    String
-> (Object
    -> Parser AwsEcsTaskDefinitionContainerDefinitionsSecretsDetails)
-> Value
-> Parser AwsEcsTaskDefinitionContainerDefinitionsSecretsDetails
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"AwsEcsTaskDefinitionContainerDefinitionsSecretsDetails"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> AwsEcsTaskDefinitionContainerDefinitionsSecretsDetails
AwsEcsTaskDefinitionContainerDefinitionsSecretsDetails'
            (Maybe Text
 -> Maybe Text
 -> AwsEcsTaskDefinitionContainerDefinitionsSecretsDetails)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> AwsEcsTaskDefinitionContainerDefinitionsSecretsDetails)
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
"Name")
              Parser
  (Maybe Text
   -> AwsEcsTaskDefinitionContainerDefinitionsSecretsDetails)
-> Parser (Maybe Text)
-> Parser AwsEcsTaskDefinitionContainerDefinitionsSecretsDetails
forall (f :: * -> *) a b. Applicative f => 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
"ValueFrom")
      )

instance
  Prelude.Hashable
    AwsEcsTaskDefinitionContainerDefinitionsSecretsDetails

instance
  Prelude.NFData
    AwsEcsTaskDefinitionContainerDefinitionsSecretsDetails

instance
  Core.ToJSON
    AwsEcsTaskDefinitionContainerDefinitionsSecretsDetails
  where
  toJSON :: AwsEcsTaskDefinitionContainerDefinitionsSecretsDetails -> Value
toJSON
    AwsEcsTaskDefinitionContainerDefinitionsSecretsDetails' {Maybe Text
valueFrom :: Maybe Text
name :: Maybe Text
$sel:valueFrom:AwsEcsTaskDefinitionContainerDefinitionsSecretsDetails' :: AwsEcsTaskDefinitionContainerDefinitionsSecretsDetails
-> Maybe Text
$sel:name:AwsEcsTaskDefinitionContainerDefinitionsSecretsDetails' :: AwsEcsTaskDefinitionContainerDefinitionsSecretsDetails
-> Maybe Text
..} =
      [Pair] -> Value
Core.object
        ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
            [ (Text
"Name" 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
name,
              (Text
"ValueFrom" 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
valueFrom
            ]
        )