{-# 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.CodeArtifact.Types.DomainEntryPoint
-- 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.CodeArtifact.Types.DomainEntryPoint 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

-- | Information about how a package originally entered the CodeArtifact
-- domain. For packages published directly to CodeArtifact, the entry point
-- is the repository it was published to. For packages ingested from an
-- external repository, the entry point is the external connection that it
-- was ingested from. An external connection is a CodeArtifact repository
-- that is connected to an external repository such as the npm registry or
-- NuGet gallery.
--
-- /See:/ 'newDomainEntryPoint' smart constructor.
data DomainEntryPoint = DomainEntryPoint'
  { -- | The name of the external connection that a package was ingested from.
    DomainEntryPoint -> Maybe Text
externalConnectionName :: Prelude.Maybe Prelude.Text,
    -- | The name of the repository that a package was originally published to.
    DomainEntryPoint -> Maybe Text
repositoryName :: Prelude.Maybe Prelude.Text
  }
  deriving (DomainEntryPoint -> DomainEntryPoint -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DomainEntryPoint -> DomainEntryPoint -> Bool
$c/= :: DomainEntryPoint -> DomainEntryPoint -> Bool
== :: DomainEntryPoint -> DomainEntryPoint -> Bool
$c== :: DomainEntryPoint -> DomainEntryPoint -> Bool
Prelude.Eq, ReadPrec [DomainEntryPoint]
ReadPrec DomainEntryPoint
Int -> ReadS DomainEntryPoint
ReadS [DomainEntryPoint]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DomainEntryPoint]
$creadListPrec :: ReadPrec [DomainEntryPoint]
readPrec :: ReadPrec DomainEntryPoint
$creadPrec :: ReadPrec DomainEntryPoint
readList :: ReadS [DomainEntryPoint]
$creadList :: ReadS [DomainEntryPoint]
readsPrec :: Int -> ReadS DomainEntryPoint
$creadsPrec :: Int -> ReadS DomainEntryPoint
Prelude.Read, Int -> DomainEntryPoint -> ShowS
[DomainEntryPoint] -> ShowS
DomainEntryPoint -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DomainEntryPoint] -> ShowS
$cshowList :: [DomainEntryPoint] -> ShowS
show :: DomainEntryPoint -> String
$cshow :: DomainEntryPoint -> String
showsPrec :: Int -> DomainEntryPoint -> ShowS
$cshowsPrec :: Int -> DomainEntryPoint -> ShowS
Prelude.Show, forall x. Rep DomainEntryPoint x -> DomainEntryPoint
forall x. DomainEntryPoint -> Rep DomainEntryPoint x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DomainEntryPoint x -> DomainEntryPoint
$cfrom :: forall x. DomainEntryPoint -> Rep DomainEntryPoint x
Prelude.Generic)

-- |
-- Create a value of 'DomainEntryPoint' 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:
--
-- 'externalConnectionName', 'domainEntryPoint_externalConnectionName' - The name of the external connection that a package was ingested from.
--
-- 'repositoryName', 'domainEntryPoint_repositoryName' - The name of the repository that a package was originally published to.
newDomainEntryPoint ::
  DomainEntryPoint
newDomainEntryPoint :: DomainEntryPoint
newDomainEntryPoint =
  DomainEntryPoint'
    { $sel:externalConnectionName:DomainEntryPoint' :: Maybe Text
externalConnectionName =
        forall a. Maybe a
Prelude.Nothing,
      $sel:repositoryName:DomainEntryPoint' :: Maybe Text
repositoryName = forall a. Maybe a
Prelude.Nothing
    }

-- | The name of the external connection that a package was ingested from.
domainEntryPoint_externalConnectionName :: Lens.Lens' DomainEntryPoint (Prelude.Maybe Prelude.Text)
domainEntryPoint_externalConnectionName :: Lens' DomainEntryPoint (Maybe Text)
domainEntryPoint_externalConnectionName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DomainEntryPoint' {Maybe Text
externalConnectionName :: Maybe Text
$sel:externalConnectionName:DomainEntryPoint' :: DomainEntryPoint -> Maybe Text
externalConnectionName} -> Maybe Text
externalConnectionName) (\s :: DomainEntryPoint
s@DomainEntryPoint' {} Maybe Text
a -> DomainEntryPoint
s {$sel:externalConnectionName:DomainEntryPoint' :: Maybe Text
externalConnectionName = Maybe Text
a} :: DomainEntryPoint)

-- | The name of the repository that a package was originally published to.
domainEntryPoint_repositoryName :: Lens.Lens' DomainEntryPoint (Prelude.Maybe Prelude.Text)
domainEntryPoint_repositoryName :: Lens' DomainEntryPoint (Maybe Text)
domainEntryPoint_repositoryName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DomainEntryPoint' {Maybe Text
repositoryName :: Maybe Text
$sel:repositoryName:DomainEntryPoint' :: DomainEntryPoint -> Maybe Text
repositoryName} -> Maybe Text
repositoryName) (\s :: DomainEntryPoint
s@DomainEntryPoint' {} Maybe Text
a -> DomainEntryPoint
s {$sel:repositoryName:DomainEntryPoint' :: Maybe Text
repositoryName = Maybe Text
a} :: DomainEntryPoint)

instance Data.FromJSON DomainEntryPoint where
  parseJSON :: Value -> Parser DomainEntryPoint
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"DomainEntryPoint"
      ( \Object
x ->
          Maybe Text -> Maybe Text -> DomainEntryPoint
DomainEntryPoint'
            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
"externalConnectionName")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"repositoryName")
      )

instance Prelude.Hashable DomainEntryPoint where
  hashWithSalt :: Int -> DomainEntryPoint -> Int
hashWithSalt Int
_salt DomainEntryPoint' {Maybe Text
repositoryName :: Maybe Text
externalConnectionName :: Maybe Text
$sel:repositoryName:DomainEntryPoint' :: DomainEntryPoint -> Maybe Text
$sel:externalConnectionName:DomainEntryPoint' :: DomainEntryPoint -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
externalConnectionName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
repositoryName

instance Prelude.NFData DomainEntryPoint where
  rnf :: DomainEntryPoint -> ()
rnf DomainEntryPoint' {Maybe Text
repositoryName :: Maybe Text
externalConnectionName :: Maybe Text
$sel:repositoryName:DomainEntryPoint' :: DomainEntryPoint -> Maybe Text
$sel:externalConnectionName:DomainEntryPoint' :: DomainEntryPoint -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
externalConnectionName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
repositoryName