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

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

-- | The credentials for access to a private registry.
--
-- /See:/ 'newAwsCodeBuildProjectEnvironmentRegistryCredential' smart constructor.
data AwsCodeBuildProjectEnvironmentRegistryCredential = AwsCodeBuildProjectEnvironmentRegistryCredential'
  { -- | The ARN or name of credentials created using Secrets Manager.
    --
    -- The credential can use the name of the credentials only if they exist in
    -- your current Amazon Web Services Region.
    AwsCodeBuildProjectEnvironmentRegistryCredential -> Maybe Text
credential :: Prelude.Maybe Prelude.Text,
    -- | The service that created the credentials to access a private Docker
    -- registry.
    --
    -- The valid value,@ SECRETS_MANAGER@, is for Secrets Manager.
    AwsCodeBuildProjectEnvironmentRegistryCredential -> Maybe Text
credentialProvider :: Prelude.Maybe Prelude.Text
  }
  deriving (AwsCodeBuildProjectEnvironmentRegistryCredential
-> AwsCodeBuildProjectEnvironmentRegistryCredential -> Bool
(AwsCodeBuildProjectEnvironmentRegistryCredential
 -> AwsCodeBuildProjectEnvironmentRegistryCredential -> Bool)
-> (AwsCodeBuildProjectEnvironmentRegistryCredential
    -> AwsCodeBuildProjectEnvironmentRegistryCredential -> Bool)
-> Eq AwsCodeBuildProjectEnvironmentRegistryCredential
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AwsCodeBuildProjectEnvironmentRegistryCredential
-> AwsCodeBuildProjectEnvironmentRegistryCredential -> Bool
$c/= :: AwsCodeBuildProjectEnvironmentRegistryCredential
-> AwsCodeBuildProjectEnvironmentRegistryCredential -> Bool
== :: AwsCodeBuildProjectEnvironmentRegistryCredential
-> AwsCodeBuildProjectEnvironmentRegistryCredential -> Bool
$c== :: AwsCodeBuildProjectEnvironmentRegistryCredential
-> AwsCodeBuildProjectEnvironmentRegistryCredential -> Bool
Prelude.Eq, ReadPrec [AwsCodeBuildProjectEnvironmentRegistryCredential]
ReadPrec AwsCodeBuildProjectEnvironmentRegistryCredential
Int -> ReadS AwsCodeBuildProjectEnvironmentRegistryCredential
ReadS [AwsCodeBuildProjectEnvironmentRegistryCredential]
(Int -> ReadS AwsCodeBuildProjectEnvironmentRegistryCredential)
-> ReadS [AwsCodeBuildProjectEnvironmentRegistryCredential]
-> ReadPrec AwsCodeBuildProjectEnvironmentRegistryCredential
-> ReadPrec [AwsCodeBuildProjectEnvironmentRegistryCredential]
-> Read AwsCodeBuildProjectEnvironmentRegistryCredential
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AwsCodeBuildProjectEnvironmentRegistryCredential]
$creadListPrec :: ReadPrec [AwsCodeBuildProjectEnvironmentRegistryCredential]
readPrec :: ReadPrec AwsCodeBuildProjectEnvironmentRegistryCredential
$creadPrec :: ReadPrec AwsCodeBuildProjectEnvironmentRegistryCredential
readList :: ReadS [AwsCodeBuildProjectEnvironmentRegistryCredential]
$creadList :: ReadS [AwsCodeBuildProjectEnvironmentRegistryCredential]
readsPrec :: Int -> ReadS AwsCodeBuildProjectEnvironmentRegistryCredential
$creadsPrec :: Int -> ReadS AwsCodeBuildProjectEnvironmentRegistryCredential
Prelude.Read, Int -> AwsCodeBuildProjectEnvironmentRegistryCredential -> ShowS
[AwsCodeBuildProjectEnvironmentRegistryCredential] -> ShowS
AwsCodeBuildProjectEnvironmentRegistryCredential -> String
(Int -> AwsCodeBuildProjectEnvironmentRegistryCredential -> ShowS)
-> (AwsCodeBuildProjectEnvironmentRegistryCredential -> String)
-> ([AwsCodeBuildProjectEnvironmentRegistryCredential] -> ShowS)
-> Show AwsCodeBuildProjectEnvironmentRegistryCredential
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AwsCodeBuildProjectEnvironmentRegistryCredential] -> ShowS
$cshowList :: [AwsCodeBuildProjectEnvironmentRegistryCredential] -> ShowS
show :: AwsCodeBuildProjectEnvironmentRegistryCredential -> String
$cshow :: AwsCodeBuildProjectEnvironmentRegistryCredential -> String
showsPrec :: Int -> AwsCodeBuildProjectEnvironmentRegistryCredential -> ShowS
$cshowsPrec :: Int -> AwsCodeBuildProjectEnvironmentRegistryCredential -> ShowS
Prelude.Show, (forall x.
 AwsCodeBuildProjectEnvironmentRegistryCredential
 -> Rep AwsCodeBuildProjectEnvironmentRegistryCredential x)
-> (forall x.
    Rep AwsCodeBuildProjectEnvironmentRegistryCredential x
    -> AwsCodeBuildProjectEnvironmentRegistryCredential)
-> Generic AwsCodeBuildProjectEnvironmentRegistryCredential
forall x.
Rep AwsCodeBuildProjectEnvironmentRegistryCredential x
-> AwsCodeBuildProjectEnvironmentRegistryCredential
forall x.
AwsCodeBuildProjectEnvironmentRegistryCredential
-> Rep AwsCodeBuildProjectEnvironmentRegistryCredential x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AwsCodeBuildProjectEnvironmentRegistryCredential x
-> AwsCodeBuildProjectEnvironmentRegistryCredential
$cfrom :: forall x.
AwsCodeBuildProjectEnvironmentRegistryCredential
-> Rep AwsCodeBuildProjectEnvironmentRegistryCredential x
Prelude.Generic)

-- |
-- Create a value of 'AwsCodeBuildProjectEnvironmentRegistryCredential' 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:
--
-- 'credential', 'awsCodeBuildProjectEnvironmentRegistryCredential_credential' - The ARN or name of credentials created using Secrets Manager.
--
-- The credential can use the name of the credentials only if they exist in
-- your current Amazon Web Services Region.
--
-- 'credentialProvider', 'awsCodeBuildProjectEnvironmentRegistryCredential_credentialProvider' - The service that created the credentials to access a private Docker
-- registry.
--
-- The valid value,@ SECRETS_MANAGER@, is for Secrets Manager.
newAwsCodeBuildProjectEnvironmentRegistryCredential ::
  AwsCodeBuildProjectEnvironmentRegistryCredential
newAwsCodeBuildProjectEnvironmentRegistryCredential :: AwsCodeBuildProjectEnvironmentRegistryCredential
newAwsCodeBuildProjectEnvironmentRegistryCredential =
  AwsCodeBuildProjectEnvironmentRegistryCredential' :: Maybe Text
-> Maybe Text -> AwsCodeBuildProjectEnvironmentRegistryCredential
AwsCodeBuildProjectEnvironmentRegistryCredential'
    { $sel:credential:AwsCodeBuildProjectEnvironmentRegistryCredential' :: Maybe Text
credential =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:credentialProvider:AwsCodeBuildProjectEnvironmentRegistryCredential' :: Maybe Text
credentialProvider =
        Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The ARN or name of credentials created using Secrets Manager.
--
-- The credential can use the name of the credentials only if they exist in
-- your current Amazon Web Services Region.
awsCodeBuildProjectEnvironmentRegistryCredential_credential :: Lens.Lens' AwsCodeBuildProjectEnvironmentRegistryCredential (Prelude.Maybe Prelude.Text)
awsCodeBuildProjectEnvironmentRegistryCredential_credential :: (Maybe Text -> f (Maybe Text))
-> AwsCodeBuildProjectEnvironmentRegistryCredential
-> f AwsCodeBuildProjectEnvironmentRegistryCredential
awsCodeBuildProjectEnvironmentRegistryCredential_credential = (AwsCodeBuildProjectEnvironmentRegistryCredential -> Maybe Text)
-> (AwsCodeBuildProjectEnvironmentRegistryCredential
    -> Maybe Text -> AwsCodeBuildProjectEnvironmentRegistryCredential)
-> Lens
     AwsCodeBuildProjectEnvironmentRegistryCredential
     AwsCodeBuildProjectEnvironmentRegistryCredential
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsCodeBuildProjectEnvironmentRegistryCredential' {Maybe Text
credential :: Maybe Text
$sel:credential:AwsCodeBuildProjectEnvironmentRegistryCredential' :: AwsCodeBuildProjectEnvironmentRegistryCredential -> Maybe Text
credential} -> Maybe Text
credential) (\s :: AwsCodeBuildProjectEnvironmentRegistryCredential
s@AwsCodeBuildProjectEnvironmentRegistryCredential' {} Maybe Text
a -> AwsCodeBuildProjectEnvironmentRegistryCredential
s {$sel:credential:AwsCodeBuildProjectEnvironmentRegistryCredential' :: Maybe Text
credential = Maybe Text
a} :: AwsCodeBuildProjectEnvironmentRegistryCredential)

-- | The service that created the credentials to access a private Docker
-- registry.
--
-- The valid value,@ SECRETS_MANAGER@, is for Secrets Manager.
awsCodeBuildProjectEnvironmentRegistryCredential_credentialProvider :: Lens.Lens' AwsCodeBuildProjectEnvironmentRegistryCredential (Prelude.Maybe Prelude.Text)
awsCodeBuildProjectEnvironmentRegistryCredential_credentialProvider :: (Maybe Text -> f (Maybe Text))
-> AwsCodeBuildProjectEnvironmentRegistryCredential
-> f AwsCodeBuildProjectEnvironmentRegistryCredential
awsCodeBuildProjectEnvironmentRegistryCredential_credentialProvider = (AwsCodeBuildProjectEnvironmentRegistryCredential -> Maybe Text)
-> (AwsCodeBuildProjectEnvironmentRegistryCredential
    -> Maybe Text -> AwsCodeBuildProjectEnvironmentRegistryCredential)
-> Lens
     AwsCodeBuildProjectEnvironmentRegistryCredential
     AwsCodeBuildProjectEnvironmentRegistryCredential
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsCodeBuildProjectEnvironmentRegistryCredential' {Maybe Text
credentialProvider :: Maybe Text
$sel:credentialProvider:AwsCodeBuildProjectEnvironmentRegistryCredential' :: AwsCodeBuildProjectEnvironmentRegistryCredential -> Maybe Text
credentialProvider} -> Maybe Text
credentialProvider) (\s :: AwsCodeBuildProjectEnvironmentRegistryCredential
s@AwsCodeBuildProjectEnvironmentRegistryCredential' {} Maybe Text
a -> AwsCodeBuildProjectEnvironmentRegistryCredential
s {$sel:credentialProvider:AwsCodeBuildProjectEnvironmentRegistryCredential' :: Maybe Text
credentialProvider = Maybe Text
a} :: AwsCodeBuildProjectEnvironmentRegistryCredential)

instance
  Core.FromJSON
    AwsCodeBuildProjectEnvironmentRegistryCredential
  where
  parseJSON :: Value -> Parser AwsCodeBuildProjectEnvironmentRegistryCredential
parseJSON =
    String
-> (Object
    -> Parser AwsCodeBuildProjectEnvironmentRegistryCredential)
-> Value
-> Parser AwsCodeBuildProjectEnvironmentRegistryCredential
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"AwsCodeBuildProjectEnvironmentRegistryCredential"
      ( \Object
x ->
          Maybe Text
-> Maybe Text -> AwsCodeBuildProjectEnvironmentRegistryCredential
AwsCodeBuildProjectEnvironmentRegistryCredential'
            (Maybe Text
 -> Maybe Text -> AwsCodeBuildProjectEnvironmentRegistryCredential)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text -> AwsCodeBuildProjectEnvironmentRegistryCredential)
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
"Credential")
              Parser
  (Maybe Text -> AwsCodeBuildProjectEnvironmentRegistryCredential)
-> Parser (Maybe Text)
-> Parser AwsCodeBuildProjectEnvironmentRegistryCredential
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
"CredentialProvider")
      )

instance
  Prelude.Hashable
    AwsCodeBuildProjectEnvironmentRegistryCredential

instance
  Prelude.NFData
    AwsCodeBuildProjectEnvironmentRegistryCredential

instance
  Core.ToJSON
    AwsCodeBuildProjectEnvironmentRegistryCredential
  where
  toJSON :: AwsCodeBuildProjectEnvironmentRegistryCredential -> Value
toJSON
    AwsCodeBuildProjectEnvironmentRegistryCredential' {Maybe Text
credentialProvider :: Maybe Text
credential :: Maybe Text
$sel:credentialProvider:AwsCodeBuildProjectEnvironmentRegistryCredential' :: AwsCodeBuildProjectEnvironmentRegistryCredential -> Maybe Text
$sel:credential:AwsCodeBuildProjectEnvironmentRegistryCredential' :: AwsCodeBuildProjectEnvironmentRegistryCredential -> Maybe Text
..} =
      [Pair] -> Value
Core.object
        ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
            [ (Text
"Credential" 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
credential,
              (Text
"CredentialProvider" 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
credentialProvider
            ]
        )