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

import Amazonka.CodeArtifact.Types.ExternalConnectionStatus
import Amazonka.CodeArtifact.Types.PackageFormat
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Contains information about the external connection of a repository.
--
-- /See:/ 'newRepositoryExternalConnectionInfo' smart constructor.
data RepositoryExternalConnectionInfo = RepositoryExternalConnectionInfo'
  { -- | The name of the external connection associated with a repository.
    RepositoryExternalConnectionInfo -> Maybe Text
externalConnectionName :: Prelude.Maybe Prelude.Text,
    -- | The status of the external connection of a repository. There is one
    -- valid value, @Available@.
    RepositoryExternalConnectionInfo -> Maybe ExternalConnectionStatus
status :: Prelude.Maybe ExternalConnectionStatus,
    -- | The package format associated with a repository\'s external connection.
    -- The valid package formats are:
    --
    -- -   @npm@: A Node Package Manager (npm) package.
    --
    -- -   @pypi@: A Python Package Index (PyPI) package.
    --
    -- -   @maven@: A Maven package that contains compiled code in a
    --     distributable format, such as a JAR file.
    RepositoryExternalConnectionInfo -> Maybe PackageFormat
packageFormat :: Prelude.Maybe PackageFormat
  }
  deriving (RepositoryExternalConnectionInfo
-> RepositoryExternalConnectionInfo -> Bool
(RepositoryExternalConnectionInfo
 -> RepositoryExternalConnectionInfo -> Bool)
-> (RepositoryExternalConnectionInfo
    -> RepositoryExternalConnectionInfo -> Bool)
-> Eq RepositoryExternalConnectionInfo
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RepositoryExternalConnectionInfo
-> RepositoryExternalConnectionInfo -> Bool
$c/= :: RepositoryExternalConnectionInfo
-> RepositoryExternalConnectionInfo -> Bool
== :: RepositoryExternalConnectionInfo
-> RepositoryExternalConnectionInfo -> Bool
$c== :: RepositoryExternalConnectionInfo
-> RepositoryExternalConnectionInfo -> Bool
Prelude.Eq, ReadPrec [RepositoryExternalConnectionInfo]
ReadPrec RepositoryExternalConnectionInfo
Int -> ReadS RepositoryExternalConnectionInfo
ReadS [RepositoryExternalConnectionInfo]
(Int -> ReadS RepositoryExternalConnectionInfo)
-> ReadS [RepositoryExternalConnectionInfo]
-> ReadPrec RepositoryExternalConnectionInfo
-> ReadPrec [RepositoryExternalConnectionInfo]
-> Read RepositoryExternalConnectionInfo
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RepositoryExternalConnectionInfo]
$creadListPrec :: ReadPrec [RepositoryExternalConnectionInfo]
readPrec :: ReadPrec RepositoryExternalConnectionInfo
$creadPrec :: ReadPrec RepositoryExternalConnectionInfo
readList :: ReadS [RepositoryExternalConnectionInfo]
$creadList :: ReadS [RepositoryExternalConnectionInfo]
readsPrec :: Int -> ReadS RepositoryExternalConnectionInfo
$creadsPrec :: Int -> ReadS RepositoryExternalConnectionInfo
Prelude.Read, Int -> RepositoryExternalConnectionInfo -> ShowS
[RepositoryExternalConnectionInfo] -> ShowS
RepositoryExternalConnectionInfo -> String
(Int -> RepositoryExternalConnectionInfo -> ShowS)
-> (RepositoryExternalConnectionInfo -> String)
-> ([RepositoryExternalConnectionInfo] -> ShowS)
-> Show RepositoryExternalConnectionInfo
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RepositoryExternalConnectionInfo] -> ShowS
$cshowList :: [RepositoryExternalConnectionInfo] -> ShowS
show :: RepositoryExternalConnectionInfo -> String
$cshow :: RepositoryExternalConnectionInfo -> String
showsPrec :: Int -> RepositoryExternalConnectionInfo -> ShowS
$cshowsPrec :: Int -> RepositoryExternalConnectionInfo -> ShowS
Prelude.Show, (forall x.
 RepositoryExternalConnectionInfo
 -> Rep RepositoryExternalConnectionInfo x)
-> (forall x.
    Rep RepositoryExternalConnectionInfo x
    -> RepositoryExternalConnectionInfo)
-> Generic RepositoryExternalConnectionInfo
forall x.
Rep RepositoryExternalConnectionInfo x
-> RepositoryExternalConnectionInfo
forall x.
RepositoryExternalConnectionInfo
-> Rep RepositoryExternalConnectionInfo x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep RepositoryExternalConnectionInfo x
-> RepositoryExternalConnectionInfo
$cfrom :: forall x.
RepositoryExternalConnectionInfo
-> Rep RepositoryExternalConnectionInfo x
Prelude.Generic)

-- |
-- Create a value of 'RepositoryExternalConnectionInfo' 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', 'repositoryExternalConnectionInfo_externalConnectionName' - The name of the external connection associated with a repository.
--
-- 'status', 'repositoryExternalConnectionInfo_status' - The status of the external connection of a repository. There is one
-- valid value, @Available@.
--
-- 'packageFormat', 'repositoryExternalConnectionInfo_packageFormat' - The package format associated with a repository\'s external connection.
-- The valid package formats are:
--
-- -   @npm@: A Node Package Manager (npm) package.
--
-- -   @pypi@: A Python Package Index (PyPI) package.
--
-- -   @maven@: A Maven package that contains compiled code in a
--     distributable format, such as a JAR file.
newRepositoryExternalConnectionInfo ::
  RepositoryExternalConnectionInfo
newRepositoryExternalConnectionInfo :: RepositoryExternalConnectionInfo
newRepositoryExternalConnectionInfo =
  RepositoryExternalConnectionInfo' :: Maybe Text
-> Maybe ExternalConnectionStatus
-> Maybe PackageFormat
-> RepositoryExternalConnectionInfo
RepositoryExternalConnectionInfo'
    { $sel:externalConnectionName:RepositoryExternalConnectionInfo' :: Maybe Text
externalConnectionName =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:status:RepositoryExternalConnectionInfo' :: Maybe ExternalConnectionStatus
status = Maybe ExternalConnectionStatus
forall a. Maybe a
Prelude.Nothing,
      $sel:packageFormat:RepositoryExternalConnectionInfo' :: Maybe PackageFormat
packageFormat = Maybe PackageFormat
forall a. Maybe a
Prelude.Nothing
    }

-- | The name of the external connection associated with a repository.
repositoryExternalConnectionInfo_externalConnectionName :: Lens.Lens' RepositoryExternalConnectionInfo (Prelude.Maybe Prelude.Text)
repositoryExternalConnectionInfo_externalConnectionName :: (Maybe Text -> f (Maybe Text))
-> RepositoryExternalConnectionInfo
-> f RepositoryExternalConnectionInfo
repositoryExternalConnectionInfo_externalConnectionName = (RepositoryExternalConnectionInfo -> Maybe Text)
-> (RepositoryExternalConnectionInfo
    -> Maybe Text -> RepositoryExternalConnectionInfo)
-> Lens
     RepositoryExternalConnectionInfo
     RepositoryExternalConnectionInfo
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RepositoryExternalConnectionInfo' {Maybe Text
externalConnectionName :: Maybe Text
$sel:externalConnectionName:RepositoryExternalConnectionInfo' :: RepositoryExternalConnectionInfo -> Maybe Text
externalConnectionName} -> Maybe Text
externalConnectionName) (\s :: RepositoryExternalConnectionInfo
s@RepositoryExternalConnectionInfo' {} Maybe Text
a -> RepositoryExternalConnectionInfo
s {$sel:externalConnectionName:RepositoryExternalConnectionInfo' :: Maybe Text
externalConnectionName = Maybe Text
a} :: RepositoryExternalConnectionInfo)

-- | The status of the external connection of a repository. There is one
-- valid value, @Available@.
repositoryExternalConnectionInfo_status :: Lens.Lens' RepositoryExternalConnectionInfo (Prelude.Maybe ExternalConnectionStatus)
repositoryExternalConnectionInfo_status :: (Maybe ExternalConnectionStatus
 -> f (Maybe ExternalConnectionStatus))
-> RepositoryExternalConnectionInfo
-> f RepositoryExternalConnectionInfo
repositoryExternalConnectionInfo_status = (RepositoryExternalConnectionInfo
 -> Maybe ExternalConnectionStatus)
-> (RepositoryExternalConnectionInfo
    -> Maybe ExternalConnectionStatus
    -> RepositoryExternalConnectionInfo)
-> Lens
     RepositoryExternalConnectionInfo
     RepositoryExternalConnectionInfo
     (Maybe ExternalConnectionStatus)
     (Maybe ExternalConnectionStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RepositoryExternalConnectionInfo' {Maybe ExternalConnectionStatus
status :: Maybe ExternalConnectionStatus
$sel:status:RepositoryExternalConnectionInfo' :: RepositoryExternalConnectionInfo -> Maybe ExternalConnectionStatus
status} -> Maybe ExternalConnectionStatus
status) (\s :: RepositoryExternalConnectionInfo
s@RepositoryExternalConnectionInfo' {} Maybe ExternalConnectionStatus
a -> RepositoryExternalConnectionInfo
s {$sel:status:RepositoryExternalConnectionInfo' :: Maybe ExternalConnectionStatus
status = Maybe ExternalConnectionStatus
a} :: RepositoryExternalConnectionInfo)

-- | The package format associated with a repository\'s external connection.
-- The valid package formats are:
--
-- -   @npm@: A Node Package Manager (npm) package.
--
-- -   @pypi@: A Python Package Index (PyPI) package.
--
-- -   @maven@: A Maven package that contains compiled code in a
--     distributable format, such as a JAR file.
repositoryExternalConnectionInfo_packageFormat :: Lens.Lens' RepositoryExternalConnectionInfo (Prelude.Maybe PackageFormat)
repositoryExternalConnectionInfo_packageFormat :: (Maybe PackageFormat -> f (Maybe PackageFormat))
-> RepositoryExternalConnectionInfo
-> f RepositoryExternalConnectionInfo
repositoryExternalConnectionInfo_packageFormat = (RepositoryExternalConnectionInfo -> Maybe PackageFormat)
-> (RepositoryExternalConnectionInfo
    -> Maybe PackageFormat -> RepositoryExternalConnectionInfo)
-> Lens
     RepositoryExternalConnectionInfo
     RepositoryExternalConnectionInfo
     (Maybe PackageFormat)
     (Maybe PackageFormat)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RepositoryExternalConnectionInfo' {Maybe PackageFormat
packageFormat :: Maybe PackageFormat
$sel:packageFormat:RepositoryExternalConnectionInfo' :: RepositoryExternalConnectionInfo -> Maybe PackageFormat
packageFormat} -> Maybe PackageFormat
packageFormat) (\s :: RepositoryExternalConnectionInfo
s@RepositoryExternalConnectionInfo' {} Maybe PackageFormat
a -> RepositoryExternalConnectionInfo
s {$sel:packageFormat:RepositoryExternalConnectionInfo' :: Maybe PackageFormat
packageFormat = Maybe PackageFormat
a} :: RepositoryExternalConnectionInfo)

instance
  Core.FromJSON
    RepositoryExternalConnectionInfo
  where
  parseJSON :: Value -> Parser RepositoryExternalConnectionInfo
parseJSON =
    String
-> (Object -> Parser RepositoryExternalConnectionInfo)
-> Value
-> Parser RepositoryExternalConnectionInfo
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"RepositoryExternalConnectionInfo"
      ( \Object
x ->
          Maybe Text
-> Maybe ExternalConnectionStatus
-> Maybe PackageFormat
-> RepositoryExternalConnectionInfo
RepositoryExternalConnectionInfo'
            (Maybe Text
 -> Maybe ExternalConnectionStatus
 -> Maybe PackageFormat
 -> RepositoryExternalConnectionInfo)
-> Parser (Maybe Text)
-> Parser
     (Maybe ExternalConnectionStatus
      -> Maybe PackageFormat -> RepositoryExternalConnectionInfo)
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
"externalConnectionName")
            Parser
  (Maybe ExternalConnectionStatus
   -> Maybe PackageFormat -> RepositoryExternalConnectionInfo)
-> Parser (Maybe ExternalConnectionStatus)
-> Parser (Maybe PackageFormat -> RepositoryExternalConnectionInfo)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe ExternalConnectionStatus)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"status")
            Parser (Maybe PackageFormat -> RepositoryExternalConnectionInfo)
-> Parser (Maybe PackageFormat)
-> Parser RepositoryExternalConnectionInfo
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe PackageFormat)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"packageFormat")
      )

instance
  Prelude.Hashable
    RepositoryExternalConnectionInfo

instance
  Prelude.NFData
    RepositoryExternalConnectionInfo