{-# 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.Lambda.Types.AllowedPublishers
-- 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.Lambda.Types.AllowedPublishers 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

-- | List of signing profiles that can sign a code package.
--
-- /See:/ 'newAllowedPublishers' smart constructor.
data AllowedPublishers = AllowedPublishers'
  { -- | The Amazon Resource Name (ARN) for each of the signing profiles. A
    -- signing profile defines a trusted user who can sign a code package.
    AllowedPublishers -> NonEmpty Text
signingProfileVersionArns :: Prelude.NonEmpty Prelude.Text
  }
  deriving (AllowedPublishers -> AllowedPublishers -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AllowedPublishers -> AllowedPublishers -> Bool
$c/= :: AllowedPublishers -> AllowedPublishers -> Bool
== :: AllowedPublishers -> AllowedPublishers -> Bool
$c== :: AllowedPublishers -> AllowedPublishers -> Bool
Prelude.Eq, ReadPrec [AllowedPublishers]
ReadPrec AllowedPublishers
Int -> ReadS AllowedPublishers
ReadS [AllowedPublishers]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AllowedPublishers]
$creadListPrec :: ReadPrec [AllowedPublishers]
readPrec :: ReadPrec AllowedPublishers
$creadPrec :: ReadPrec AllowedPublishers
readList :: ReadS [AllowedPublishers]
$creadList :: ReadS [AllowedPublishers]
readsPrec :: Int -> ReadS AllowedPublishers
$creadsPrec :: Int -> ReadS AllowedPublishers
Prelude.Read, Int -> AllowedPublishers -> ShowS
[AllowedPublishers] -> ShowS
AllowedPublishers -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AllowedPublishers] -> ShowS
$cshowList :: [AllowedPublishers] -> ShowS
show :: AllowedPublishers -> String
$cshow :: AllowedPublishers -> String
showsPrec :: Int -> AllowedPublishers -> ShowS
$cshowsPrec :: Int -> AllowedPublishers -> ShowS
Prelude.Show, forall x. Rep AllowedPublishers x -> AllowedPublishers
forall x. AllowedPublishers -> Rep AllowedPublishers x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AllowedPublishers x -> AllowedPublishers
$cfrom :: forall x. AllowedPublishers -> Rep AllowedPublishers x
Prelude.Generic)

-- |
-- Create a value of 'AllowedPublishers' 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:
--
-- 'signingProfileVersionArns', 'allowedPublishers_signingProfileVersionArns' - The Amazon Resource Name (ARN) for each of the signing profiles. A
-- signing profile defines a trusted user who can sign a code package.
newAllowedPublishers ::
  -- | 'signingProfileVersionArns'
  Prelude.NonEmpty Prelude.Text ->
  AllowedPublishers
newAllowedPublishers :: NonEmpty Text -> AllowedPublishers
newAllowedPublishers NonEmpty Text
pSigningProfileVersionArns_ =
  AllowedPublishers'
    { $sel:signingProfileVersionArns:AllowedPublishers' :: NonEmpty Text
signingProfileVersionArns =
        forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced forall t b. AReview t b -> b -> t
Lens.# NonEmpty Text
pSigningProfileVersionArns_
    }

-- | The Amazon Resource Name (ARN) for each of the signing profiles. A
-- signing profile defines a trusted user who can sign a code package.
allowedPublishers_signingProfileVersionArns :: Lens.Lens' AllowedPublishers (Prelude.NonEmpty Prelude.Text)
allowedPublishers_signingProfileVersionArns :: Lens' AllowedPublishers (NonEmpty Text)
allowedPublishers_signingProfileVersionArns = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AllowedPublishers' {NonEmpty Text
signingProfileVersionArns :: NonEmpty Text
$sel:signingProfileVersionArns:AllowedPublishers' :: AllowedPublishers -> NonEmpty Text
signingProfileVersionArns} -> NonEmpty Text
signingProfileVersionArns) (\s :: AllowedPublishers
s@AllowedPublishers' {} NonEmpty Text
a -> AllowedPublishers
s {$sel:signingProfileVersionArns:AllowedPublishers' :: NonEmpty Text
signingProfileVersionArns = NonEmpty Text
a} :: AllowedPublishers) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Data.FromJSON AllowedPublishers where
  parseJSON :: Value -> Parser AllowedPublishers
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"AllowedPublishers"
      ( \Object
x ->
          NonEmpty Text -> AllowedPublishers
AllowedPublishers'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"SigningProfileVersionArns")
      )

instance Prelude.Hashable AllowedPublishers where
  hashWithSalt :: Int -> AllowedPublishers -> Int
hashWithSalt Int
_salt AllowedPublishers' {NonEmpty Text
signingProfileVersionArns :: NonEmpty Text
$sel:signingProfileVersionArns:AllowedPublishers' :: AllowedPublishers -> NonEmpty Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` NonEmpty Text
signingProfileVersionArns

instance Prelude.NFData AllowedPublishers where
  rnf :: AllowedPublishers -> ()
rnf AllowedPublishers' {NonEmpty Text
signingProfileVersionArns :: NonEmpty Text
$sel:signingProfileVersionArns:AllowedPublishers' :: AllowedPublishers -> NonEmpty Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf NonEmpty Text
signingProfileVersionArns

instance Data.ToJSON AllowedPublishers where
  toJSON :: AllowedPublishers -> Value
toJSON AllowedPublishers' {NonEmpty Text
signingProfileVersionArns :: NonEmpty Text
$sel:signingProfileVersionArns:AllowedPublishers' :: AllowedPublishers -> NonEmpty Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ forall a. a -> Maybe a
Prelude.Just
              ( Key
"SigningProfileVersionArns"
                  forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= NonEmpty Text
signingProfileVersionArns
              )
          ]
      )