{-# 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.CodeGuruReviewer.Types.ThirdPartySourceRepository
-- 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.CodeGuruReviewer.Types.ThirdPartySourceRepository where

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

-- | Information about a third-party source repository connected to CodeGuru
-- Reviewer.
--
-- /See:/ 'newThirdPartySourceRepository' smart constructor.
data ThirdPartySourceRepository = ThirdPartySourceRepository'
  { -- | The name of the third party source repository.
    ThirdPartySourceRepository -> Text
name :: Prelude.Text,
    -- | The Amazon Resource Name (ARN) of an Amazon Web Services CodeStar
    -- Connections connection. Its format is
    -- @arn:aws:codestar-connections:region-id:aws-account_id:connection\/connection-id@.
    -- For more information, see
    -- <https://docs.aws.amazon.com/codestar-connections/latest/APIReference/API_Connection.html Connection>
    -- in the /Amazon Web Services CodeStar Connections API Reference/.
    ThirdPartySourceRepository -> Text
connectionArn :: Prelude.Text,
    -- | The owner of the repository. For a GitHub, GitHub Enterprise, or
    -- Bitbucket repository, this is the username for the account that owns the
    -- repository. For an S3 repository, this can be the username or Amazon Web
    -- Services account ID.
    ThirdPartySourceRepository -> Text
owner :: Prelude.Text
  }
  deriving (ThirdPartySourceRepository -> ThirdPartySourceRepository -> Bool
(ThirdPartySourceRepository -> ThirdPartySourceRepository -> Bool)
-> (ThirdPartySourceRepository
    -> ThirdPartySourceRepository -> Bool)
-> Eq ThirdPartySourceRepository
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ThirdPartySourceRepository -> ThirdPartySourceRepository -> Bool
$c/= :: ThirdPartySourceRepository -> ThirdPartySourceRepository -> Bool
== :: ThirdPartySourceRepository -> ThirdPartySourceRepository -> Bool
$c== :: ThirdPartySourceRepository -> ThirdPartySourceRepository -> Bool
Prelude.Eq, ReadPrec [ThirdPartySourceRepository]
ReadPrec ThirdPartySourceRepository
Int -> ReadS ThirdPartySourceRepository
ReadS [ThirdPartySourceRepository]
(Int -> ReadS ThirdPartySourceRepository)
-> ReadS [ThirdPartySourceRepository]
-> ReadPrec ThirdPartySourceRepository
-> ReadPrec [ThirdPartySourceRepository]
-> Read ThirdPartySourceRepository
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ThirdPartySourceRepository]
$creadListPrec :: ReadPrec [ThirdPartySourceRepository]
readPrec :: ReadPrec ThirdPartySourceRepository
$creadPrec :: ReadPrec ThirdPartySourceRepository
readList :: ReadS [ThirdPartySourceRepository]
$creadList :: ReadS [ThirdPartySourceRepository]
readsPrec :: Int -> ReadS ThirdPartySourceRepository
$creadsPrec :: Int -> ReadS ThirdPartySourceRepository
Prelude.Read, Int -> ThirdPartySourceRepository -> ShowS
[ThirdPartySourceRepository] -> ShowS
ThirdPartySourceRepository -> String
(Int -> ThirdPartySourceRepository -> ShowS)
-> (ThirdPartySourceRepository -> String)
-> ([ThirdPartySourceRepository] -> ShowS)
-> Show ThirdPartySourceRepository
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ThirdPartySourceRepository] -> ShowS
$cshowList :: [ThirdPartySourceRepository] -> ShowS
show :: ThirdPartySourceRepository -> String
$cshow :: ThirdPartySourceRepository -> String
showsPrec :: Int -> ThirdPartySourceRepository -> ShowS
$cshowsPrec :: Int -> ThirdPartySourceRepository -> ShowS
Prelude.Show, (forall x.
 ThirdPartySourceRepository -> Rep ThirdPartySourceRepository x)
-> (forall x.
    Rep ThirdPartySourceRepository x -> ThirdPartySourceRepository)
-> Generic ThirdPartySourceRepository
forall x.
Rep ThirdPartySourceRepository x -> ThirdPartySourceRepository
forall x.
ThirdPartySourceRepository -> Rep ThirdPartySourceRepository x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ThirdPartySourceRepository x -> ThirdPartySourceRepository
$cfrom :: forall x.
ThirdPartySourceRepository -> Rep ThirdPartySourceRepository x
Prelude.Generic)

-- |
-- Create a value of 'ThirdPartySourceRepository' 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', 'thirdPartySourceRepository_name' - The name of the third party source repository.
--
-- 'connectionArn', 'thirdPartySourceRepository_connectionArn' - The Amazon Resource Name (ARN) of an Amazon Web Services CodeStar
-- Connections connection. Its format is
-- @arn:aws:codestar-connections:region-id:aws-account_id:connection\/connection-id@.
-- For more information, see
-- <https://docs.aws.amazon.com/codestar-connections/latest/APIReference/API_Connection.html Connection>
-- in the /Amazon Web Services CodeStar Connections API Reference/.
--
-- 'owner', 'thirdPartySourceRepository_owner' - The owner of the repository. For a GitHub, GitHub Enterprise, or
-- Bitbucket repository, this is the username for the account that owns the
-- repository. For an S3 repository, this can be the username or Amazon Web
-- Services account ID.
newThirdPartySourceRepository ::
  -- | 'name'
  Prelude.Text ->
  -- | 'connectionArn'
  Prelude.Text ->
  -- | 'owner'
  Prelude.Text ->
  ThirdPartySourceRepository
newThirdPartySourceRepository :: Text -> Text -> Text -> ThirdPartySourceRepository
newThirdPartySourceRepository
  Text
pName_
  Text
pConnectionArn_
  Text
pOwner_ =
    ThirdPartySourceRepository' :: Text -> Text -> Text -> ThirdPartySourceRepository
ThirdPartySourceRepository'
      { $sel:name:ThirdPartySourceRepository' :: Text
name = Text
pName_,
        $sel:connectionArn:ThirdPartySourceRepository' :: Text
connectionArn = Text
pConnectionArn_,
        $sel:owner:ThirdPartySourceRepository' :: Text
owner = Text
pOwner_
      }

-- | The name of the third party source repository.
thirdPartySourceRepository_name :: Lens.Lens' ThirdPartySourceRepository Prelude.Text
thirdPartySourceRepository_name :: (Text -> f Text)
-> ThirdPartySourceRepository -> f ThirdPartySourceRepository
thirdPartySourceRepository_name = (ThirdPartySourceRepository -> Text)
-> (ThirdPartySourceRepository
    -> Text -> ThirdPartySourceRepository)
-> Lens
     ThirdPartySourceRepository ThirdPartySourceRepository Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ThirdPartySourceRepository' {Text
name :: Text
$sel:name:ThirdPartySourceRepository' :: ThirdPartySourceRepository -> Text
name} -> Text
name) (\s :: ThirdPartySourceRepository
s@ThirdPartySourceRepository' {} Text
a -> ThirdPartySourceRepository
s {$sel:name:ThirdPartySourceRepository' :: Text
name = Text
a} :: ThirdPartySourceRepository)

-- | The Amazon Resource Name (ARN) of an Amazon Web Services CodeStar
-- Connections connection. Its format is
-- @arn:aws:codestar-connections:region-id:aws-account_id:connection\/connection-id@.
-- For more information, see
-- <https://docs.aws.amazon.com/codestar-connections/latest/APIReference/API_Connection.html Connection>
-- in the /Amazon Web Services CodeStar Connections API Reference/.
thirdPartySourceRepository_connectionArn :: Lens.Lens' ThirdPartySourceRepository Prelude.Text
thirdPartySourceRepository_connectionArn :: (Text -> f Text)
-> ThirdPartySourceRepository -> f ThirdPartySourceRepository
thirdPartySourceRepository_connectionArn = (ThirdPartySourceRepository -> Text)
-> (ThirdPartySourceRepository
    -> Text -> ThirdPartySourceRepository)
-> Lens
     ThirdPartySourceRepository ThirdPartySourceRepository Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ThirdPartySourceRepository' {Text
connectionArn :: Text
$sel:connectionArn:ThirdPartySourceRepository' :: ThirdPartySourceRepository -> Text
connectionArn} -> Text
connectionArn) (\s :: ThirdPartySourceRepository
s@ThirdPartySourceRepository' {} Text
a -> ThirdPartySourceRepository
s {$sel:connectionArn:ThirdPartySourceRepository' :: Text
connectionArn = Text
a} :: ThirdPartySourceRepository)

-- | The owner of the repository. For a GitHub, GitHub Enterprise, or
-- Bitbucket repository, this is the username for the account that owns the
-- repository. For an S3 repository, this can be the username or Amazon Web
-- Services account ID.
thirdPartySourceRepository_owner :: Lens.Lens' ThirdPartySourceRepository Prelude.Text
thirdPartySourceRepository_owner :: (Text -> f Text)
-> ThirdPartySourceRepository -> f ThirdPartySourceRepository
thirdPartySourceRepository_owner = (ThirdPartySourceRepository -> Text)
-> (ThirdPartySourceRepository
    -> Text -> ThirdPartySourceRepository)
-> Lens
     ThirdPartySourceRepository ThirdPartySourceRepository Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ThirdPartySourceRepository' {Text
owner :: Text
$sel:owner:ThirdPartySourceRepository' :: ThirdPartySourceRepository -> Text
owner} -> Text
owner) (\s :: ThirdPartySourceRepository
s@ThirdPartySourceRepository' {} Text
a -> ThirdPartySourceRepository
s {$sel:owner:ThirdPartySourceRepository' :: Text
owner = Text
a} :: ThirdPartySourceRepository)

instance Prelude.Hashable ThirdPartySourceRepository

instance Prelude.NFData ThirdPartySourceRepository

instance Core.ToJSON ThirdPartySourceRepository where
  toJSON :: ThirdPartySourceRepository -> Value
toJSON ThirdPartySourceRepository' {Text
owner :: Text
connectionArn :: Text
name :: Text
$sel:owner:ThirdPartySourceRepository' :: ThirdPartySourceRepository -> Text
$sel:connectionArn:ThirdPartySourceRepository' :: ThirdPartySourceRepository -> Text
$sel:name:ThirdPartySourceRepository' :: ThirdPartySourceRepository -> Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Name" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
name),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"ConnectionArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
connectionArn),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Owner" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
owner)
          ]
      )