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

import Amazonka.CodeGuruReviewer.Types.KMSKeyDetails
import Amazonka.CodeGuruReviewer.Types.ProviderType
import Amazonka.CodeGuruReviewer.Types.RepositoryAssociationState
import Amazonka.CodeGuruReviewer.Types.S3RepositoryDetails
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 a repository association. The
-- <https://docs.aws.amazon.com/codeguru/latest/reviewer-api/API_DescribeRepositoryAssociation.html DescribeRepositoryAssociation>
-- operation returns a @RepositoryAssociation@ object.
--
-- /See:/ 'newRepositoryAssociation' smart constructor.
data RepositoryAssociation = RepositoryAssociation'
  { -- | The Amazon Resource Name (ARN) identifying the repository association.
    RepositoryAssociation -> Maybe Text
associationArn :: Prelude.Maybe Prelude.Text,
    -- | The ID of the repository association.
    RepositoryAssociation -> Maybe Text
associationId :: Prelude.Maybe 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/.
    RepositoryAssociation -> Maybe Text
connectionArn :: Prelude.Maybe Prelude.Text,
    -- | The time, in milliseconds since the epoch, when the repository
    -- association was created.
    RepositoryAssociation -> Maybe POSIX
createdTimeStamp :: Prelude.Maybe Data.POSIX,
    -- | A @KMSKeyDetails@ object that contains:
    --
    -- -   The encryption option for this repository association. It is either
    --     owned by Amazon Web Services Key Management Service (KMS)
    --     (@AWS_OWNED_CMK@) or customer managed (@CUSTOMER_MANAGED_CMK@).
    --
    -- -   The ID of the Amazon Web Services KMS key that is associated with
    --     this repository association.
    RepositoryAssociation -> Maybe KMSKeyDetails
kmsKeyDetails :: Prelude.Maybe KMSKeyDetails,
    -- | The time, in milliseconds since the epoch, when the repository
    -- association was last updated.
    RepositoryAssociation -> Maybe POSIX
lastUpdatedTimeStamp :: Prelude.Maybe Data.POSIX,
    -- | The name of the repository.
    RepositoryAssociation -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The owner of the repository. For an Amazon Web Services CodeCommit
    -- repository, this is the Amazon Web Services account ID of the account
    -- that owns the repository. For a GitHub, GitHub Enterprise Server, or
    -- Bitbucket repository, this is the username for the account that owns the
    -- repository. For an S3 repository, it can be the username or Amazon Web
    -- Services account ID.
    RepositoryAssociation -> Maybe Text
owner :: Prelude.Maybe Prelude.Text,
    -- | The provider type of the repository association.
    RepositoryAssociation -> Maybe ProviderType
providerType :: Prelude.Maybe ProviderType,
    RepositoryAssociation -> Maybe S3RepositoryDetails
s3RepositoryDetails :: Prelude.Maybe S3RepositoryDetails,
    -- | The state of the repository association.
    --
    -- The valid repository association states are:
    --
    -- -   __Associated__: The repository association is complete.
    --
    -- -   __Associating__: CodeGuru Reviewer is:
    --
    --     -   Setting up pull request notifications. This is required for pull
    --         requests to trigger a CodeGuru Reviewer review.
    --
    --         If your repository @ProviderType@ is @GitHub@,
    --         @GitHub Enterprise Server@, or @Bitbucket@, CodeGuru Reviewer
    --         creates webhooks in your repository to trigger CodeGuru Reviewer
    --         reviews. If you delete these webhooks, reviews of code in your
    --         repository cannot be triggered.
    --
    --     -   Setting up source code access. This is required for CodeGuru
    --         Reviewer to securely clone code in your repository.
    --
    -- -   __Failed__: The repository failed to associate or disassociate.
    --
    -- -   __Disassociating__: CodeGuru Reviewer is removing the repository\'s
    --     pull request notifications and source code access.
    --
    -- -   __Disassociated__: CodeGuru Reviewer successfully disassociated the
    --     repository. You can create a new association with this repository if
    --     you want to review source code in it later. You can control access
    --     to code reviews created in anassociated repository with tags after
    --     it has been disassociated. For more information, see
    --     <https://docs.aws.amazon.com/codeguru/latest/reviewer-ug/auth-and-access-control-using-tags.html Using tags to control access to associated repositories>
    --     in the /Amazon CodeGuru Reviewer User Guide/.
    RepositoryAssociation -> Maybe RepositoryAssociationState
state :: Prelude.Maybe RepositoryAssociationState,
    -- | A description of why the repository association is in the current state.
    RepositoryAssociation -> Maybe Text
stateReason :: Prelude.Maybe Prelude.Text
  }
  deriving (RepositoryAssociation -> RepositoryAssociation -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RepositoryAssociation -> RepositoryAssociation -> Bool
$c/= :: RepositoryAssociation -> RepositoryAssociation -> Bool
== :: RepositoryAssociation -> RepositoryAssociation -> Bool
$c== :: RepositoryAssociation -> RepositoryAssociation -> Bool
Prelude.Eq, ReadPrec [RepositoryAssociation]
ReadPrec RepositoryAssociation
Int -> ReadS RepositoryAssociation
ReadS [RepositoryAssociation]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RepositoryAssociation]
$creadListPrec :: ReadPrec [RepositoryAssociation]
readPrec :: ReadPrec RepositoryAssociation
$creadPrec :: ReadPrec RepositoryAssociation
readList :: ReadS [RepositoryAssociation]
$creadList :: ReadS [RepositoryAssociation]
readsPrec :: Int -> ReadS RepositoryAssociation
$creadsPrec :: Int -> ReadS RepositoryAssociation
Prelude.Read, Int -> RepositoryAssociation -> ShowS
[RepositoryAssociation] -> ShowS
RepositoryAssociation -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RepositoryAssociation] -> ShowS
$cshowList :: [RepositoryAssociation] -> ShowS
show :: RepositoryAssociation -> String
$cshow :: RepositoryAssociation -> String
showsPrec :: Int -> RepositoryAssociation -> ShowS
$cshowsPrec :: Int -> RepositoryAssociation -> ShowS
Prelude.Show, forall x. Rep RepositoryAssociation x -> RepositoryAssociation
forall x. RepositoryAssociation -> Rep RepositoryAssociation x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RepositoryAssociation x -> RepositoryAssociation
$cfrom :: forall x. RepositoryAssociation -> Rep RepositoryAssociation x
Prelude.Generic)

-- |
-- Create a value of 'RepositoryAssociation' 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:
--
-- 'associationArn', 'repositoryAssociation_associationArn' - The Amazon Resource Name (ARN) identifying the repository association.
--
-- 'associationId', 'repositoryAssociation_associationId' - The ID of the repository association.
--
-- 'connectionArn', 'repositoryAssociation_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/.
--
-- 'createdTimeStamp', 'repositoryAssociation_createdTimeStamp' - The time, in milliseconds since the epoch, when the repository
-- association was created.
--
-- 'kmsKeyDetails', 'repositoryAssociation_kmsKeyDetails' - A @KMSKeyDetails@ object that contains:
--
-- -   The encryption option for this repository association. It is either
--     owned by Amazon Web Services Key Management Service (KMS)
--     (@AWS_OWNED_CMK@) or customer managed (@CUSTOMER_MANAGED_CMK@).
--
-- -   The ID of the Amazon Web Services KMS key that is associated with
--     this repository association.
--
-- 'lastUpdatedTimeStamp', 'repositoryAssociation_lastUpdatedTimeStamp' - The time, in milliseconds since the epoch, when the repository
-- association was last updated.
--
-- 'name', 'repositoryAssociation_name' - The name of the repository.
--
-- 'owner', 'repositoryAssociation_owner' - The owner of the repository. For an Amazon Web Services CodeCommit
-- repository, this is the Amazon Web Services account ID of the account
-- that owns the repository. For a GitHub, GitHub Enterprise Server, or
-- Bitbucket repository, this is the username for the account that owns the
-- repository. For an S3 repository, it can be the username or Amazon Web
-- Services account ID.
--
-- 'providerType', 'repositoryAssociation_providerType' - The provider type of the repository association.
--
-- 's3RepositoryDetails', 'repositoryAssociation_s3RepositoryDetails' - Undocumented member.
--
-- 'state', 'repositoryAssociation_state' - The state of the repository association.
--
-- The valid repository association states are:
--
-- -   __Associated__: The repository association is complete.
--
-- -   __Associating__: CodeGuru Reviewer is:
--
--     -   Setting up pull request notifications. This is required for pull
--         requests to trigger a CodeGuru Reviewer review.
--
--         If your repository @ProviderType@ is @GitHub@,
--         @GitHub Enterprise Server@, or @Bitbucket@, CodeGuru Reviewer
--         creates webhooks in your repository to trigger CodeGuru Reviewer
--         reviews. If you delete these webhooks, reviews of code in your
--         repository cannot be triggered.
--
--     -   Setting up source code access. This is required for CodeGuru
--         Reviewer to securely clone code in your repository.
--
-- -   __Failed__: The repository failed to associate or disassociate.
--
-- -   __Disassociating__: CodeGuru Reviewer is removing the repository\'s
--     pull request notifications and source code access.
--
-- -   __Disassociated__: CodeGuru Reviewer successfully disassociated the
--     repository. You can create a new association with this repository if
--     you want to review source code in it later. You can control access
--     to code reviews created in anassociated repository with tags after
--     it has been disassociated. For more information, see
--     <https://docs.aws.amazon.com/codeguru/latest/reviewer-ug/auth-and-access-control-using-tags.html Using tags to control access to associated repositories>
--     in the /Amazon CodeGuru Reviewer User Guide/.
--
-- 'stateReason', 'repositoryAssociation_stateReason' - A description of why the repository association is in the current state.
newRepositoryAssociation ::
  RepositoryAssociation
newRepositoryAssociation :: RepositoryAssociation
newRepositoryAssociation =
  RepositoryAssociation'
    { $sel:associationArn:RepositoryAssociation' :: Maybe Text
associationArn =
        forall a. Maybe a
Prelude.Nothing,
      $sel:associationId:RepositoryAssociation' :: Maybe Text
associationId = forall a. Maybe a
Prelude.Nothing,
      $sel:connectionArn:RepositoryAssociation' :: Maybe Text
connectionArn = forall a. Maybe a
Prelude.Nothing,
      $sel:createdTimeStamp:RepositoryAssociation' :: Maybe POSIX
createdTimeStamp = forall a. Maybe a
Prelude.Nothing,
      $sel:kmsKeyDetails:RepositoryAssociation' :: Maybe KMSKeyDetails
kmsKeyDetails = forall a. Maybe a
Prelude.Nothing,
      $sel:lastUpdatedTimeStamp:RepositoryAssociation' :: Maybe POSIX
lastUpdatedTimeStamp = forall a. Maybe a
Prelude.Nothing,
      $sel:name:RepositoryAssociation' :: Maybe Text
name = forall a. Maybe a
Prelude.Nothing,
      $sel:owner:RepositoryAssociation' :: Maybe Text
owner = forall a. Maybe a
Prelude.Nothing,
      $sel:providerType:RepositoryAssociation' :: Maybe ProviderType
providerType = forall a. Maybe a
Prelude.Nothing,
      $sel:s3RepositoryDetails:RepositoryAssociation' :: Maybe S3RepositoryDetails
s3RepositoryDetails = forall a. Maybe a
Prelude.Nothing,
      $sel:state:RepositoryAssociation' :: Maybe RepositoryAssociationState
state = forall a. Maybe a
Prelude.Nothing,
      $sel:stateReason:RepositoryAssociation' :: Maybe Text
stateReason = forall a. Maybe a
Prelude.Nothing
    }

-- | The Amazon Resource Name (ARN) identifying the repository association.
repositoryAssociation_associationArn :: Lens.Lens' RepositoryAssociation (Prelude.Maybe Prelude.Text)
repositoryAssociation_associationArn :: Lens' RepositoryAssociation (Maybe Text)
repositoryAssociation_associationArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RepositoryAssociation' {Maybe Text
associationArn :: Maybe Text
$sel:associationArn:RepositoryAssociation' :: RepositoryAssociation -> Maybe Text
associationArn} -> Maybe Text
associationArn) (\s :: RepositoryAssociation
s@RepositoryAssociation' {} Maybe Text
a -> RepositoryAssociation
s {$sel:associationArn:RepositoryAssociation' :: Maybe Text
associationArn = Maybe Text
a} :: RepositoryAssociation)

-- | The ID of the repository association.
repositoryAssociation_associationId :: Lens.Lens' RepositoryAssociation (Prelude.Maybe Prelude.Text)
repositoryAssociation_associationId :: Lens' RepositoryAssociation (Maybe Text)
repositoryAssociation_associationId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RepositoryAssociation' {Maybe Text
associationId :: Maybe Text
$sel:associationId:RepositoryAssociation' :: RepositoryAssociation -> Maybe Text
associationId} -> Maybe Text
associationId) (\s :: RepositoryAssociation
s@RepositoryAssociation' {} Maybe Text
a -> RepositoryAssociation
s {$sel:associationId:RepositoryAssociation' :: Maybe Text
associationId = Maybe Text
a} :: RepositoryAssociation)

-- | 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/.
repositoryAssociation_connectionArn :: Lens.Lens' RepositoryAssociation (Prelude.Maybe Prelude.Text)
repositoryAssociation_connectionArn :: Lens' RepositoryAssociation (Maybe Text)
repositoryAssociation_connectionArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RepositoryAssociation' {Maybe Text
connectionArn :: Maybe Text
$sel:connectionArn:RepositoryAssociation' :: RepositoryAssociation -> Maybe Text
connectionArn} -> Maybe Text
connectionArn) (\s :: RepositoryAssociation
s@RepositoryAssociation' {} Maybe Text
a -> RepositoryAssociation
s {$sel:connectionArn:RepositoryAssociation' :: Maybe Text
connectionArn = Maybe Text
a} :: RepositoryAssociation)

-- | The time, in milliseconds since the epoch, when the repository
-- association was created.
repositoryAssociation_createdTimeStamp :: Lens.Lens' RepositoryAssociation (Prelude.Maybe Prelude.UTCTime)
repositoryAssociation_createdTimeStamp :: Lens' RepositoryAssociation (Maybe UTCTime)
repositoryAssociation_createdTimeStamp = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RepositoryAssociation' {Maybe POSIX
createdTimeStamp :: Maybe POSIX
$sel:createdTimeStamp:RepositoryAssociation' :: RepositoryAssociation -> Maybe POSIX
createdTimeStamp} -> Maybe POSIX
createdTimeStamp) (\s :: RepositoryAssociation
s@RepositoryAssociation' {} Maybe POSIX
a -> RepositoryAssociation
s {$sel:createdTimeStamp:RepositoryAssociation' :: Maybe POSIX
createdTimeStamp = Maybe POSIX
a} :: RepositoryAssociation) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | A @KMSKeyDetails@ object that contains:
--
-- -   The encryption option for this repository association. It is either
--     owned by Amazon Web Services Key Management Service (KMS)
--     (@AWS_OWNED_CMK@) or customer managed (@CUSTOMER_MANAGED_CMK@).
--
-- -   The ID of the Amazon Web Services KMS key that is associated with
--     this repository association.
repositoryAssociation_kmsKeyDetails :: Lens.Lens' RepositoryAssociation (Prelude.Maybe KMSKeyDetails)
repositoryAssociation_kmsKeyDetails :: Lens' RepositoryAssociation (Maybe KMSKeyDetails)
repositoryAssociation_kmsKeyDetails = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RepositoryAssociation' {Maybe KMSKeyDetails
kmsKeyDetails :: Maybe KMSKeyDetails
$sel:kmsKeyDetails:RepositoryAssociation' :: RepositoryAssociation -> Maybe KMSKeyDetails
kmsKeyDetails} -> Maybe KMSKeyDetails
kmsKeyDetails) (\s :: RepositoryAssociation
s@RepositoryAssociation' {} Maybe KMSKeyDetails
a -> RepositoryAssociation
s {$sel:kmsKeyDetails:RepositoryAssociation' :: Maybe KMSKeyDetails
kmsKeyDetails = Maybe KMSKeyDetails
a} :: RepositoryAssociation)

-- | The time, in milliseconds since the epoch, when the repository
-- association was last updated.
repositoryAssociation_lastUpdatedTimeStamp :: Lens.Lens' RepositoryAssociation (Prelude.Maybe Prelude.UTCTime)
repositoryAssociation_lastUpdatedTimeStamp :: Lens' RepositoryAssociation (Maybe UTCTime)
repositoryAssociation_lastUpdatedTimeStamp = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RepositoryAssociation' {Maybe POSIX
lastUpdatedTimeStamp :: Maybe POSIX
$sel:lastUpdatedTimeStamp:RepositoryAssociation' :: RepositoryAssociation -> Maybe POSIX
lastUpdatedTimeStamp} -> Maybe POSIX
lastUpdatedTimeStamp) (\s :: RepositoryAssociation
s@RepositoryAssociation' {} Maybe POSIX
a -> RepositoryAssociation
s {$sel:lastUpdatedTimeStamp:RepositoryAssociation' :: Maybe POSIX
lastUpdatedTimeStamp = Maybe POSIX
a} :: RepositoryAssociation) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | The name of the repository.
repositoryAssociation_name :: Lens.Lens' RepositoryAssociation (Prelude.Maybe Prelude.Text)
repositoryAssociation_name :: Lens' RepositoryAssociation (Maybe Text)
repositoryAssociation_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RepositoryAssociation' {Maybe Text
name :: Maybe Text
$sel:name:RepositoryAssociation' :: RepositoryAssociation -> Maybe Text
name} -> Maybe Text
name) (\s :: RepositoryAssociation
s@RepositoryAssociation' {} Maybe Text
a -> RepositoryAssociation
s {$sel:name:RepositoryAssociation' :: Maybe Text
name = Maybe Text
a} :: RepositoryAssociation)

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

-- | The provider type of the repository association.
repositoryAssociation_providerType :: Lens.Lens' RepositoryAssociation (Prelude.Maybe ProviderType)
repositoryAssociation_providerType :: Lens' RepositoryAssociation (Maybe ProviderType)
repositoryAssociation_providerType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RepositoryAssociation' {Maybe ProviderType
providerType :: Maybe ProviderType
$sel:providerType:RepositoryAssociation' :: RepositoryAssociation -> Maybe ProviderType
providerType} -> Maybe ProviderType
providerType) (\s :: RepositoryAssociation
s@RepositoryAssociation' {} Maybe ProviderType
a -> RepositoryAssociation
s {$sel:providerType:RepositoryAssociation' :: Maybe ProviderType
providerType = Maybe ProviderType
a} :: RepositoryAssociation)

-- | Undocumented member.
repositoryAssociation_s3RepositoryDetails :: Lens.Lens' RepositoryAssociation (Prelude.Maybe S3RepositoryDetails)
repositoryAssociation_s3RepositoryDetails :: Lens' RepositoryAssociation (Maybe S3RepositoryDetails)
repositoryAssociation_s3RepositoryDetails = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RepositoryAssociation' {Maybe S3RepositoryDetails
s3RepositoryDetails :: Maybe S3RepositoryDetails
$sel:s3RepositoryDetails:RepositoryAssociation' :: RepositoryAssociation -> Maybe S3RepositoryDetails
s3RepositoryDetails} -> Maybe S3RepositoryDetails
s3RepositoryDetails) (\s :: RepositoryAssociation
s@RepositoryAssociation' {} Maybe S3RepositoryDetails
a -> RepositoryAssociation
s {$sel:s3RepositoryDetails:RepositoryAssociation' :: Maybe S3RepositoryDetails
s3RepositoryDetails = Maybe S3RepositoryDetails
a} :: RepositoryAssociation)

-- | The state of the repository association.
--
-- The valid repository association states are:
--
-- -   __Associated__: The repository association is complete.
--
-- -   __Associating__: CodeGuru Reviewer is:
--
--     -   Setting up pull request notifications. This is required for pull
--         requests to trigger a CodeGuru Reviewer review.
--
--         If your repository @ProviderType@ is @GitHub@,
--         @GitHub Enterprise Server@, or @Bitbucket@, CodeGuru Reviewer
--         creates webhooks in your repository to trigger CodeGuru Reviewer
--         reviews. If you delete these webhooks, reviews of code in your
--         repository cannot be triggered.
--
--     -   Setting up source code access. This is required for CodeGuru
--         Reviewer to securely clone code in your repository.
--
-- -   __Failed__: The repository failed to associate or disassociate.
--
-- -   __Disassociating__: CodeGuru Reviewer is removing the repository\'s
--     pull request notifications and source code access.
--
-- -   __Disassociated__: CodeGuru Reviewer successfully disassociated the
--     repository. You can create a new association with this repository if
--     you want to review source code in it later. You can control access
--     to code reviews created in anassociated repository with tags after
--     it has been disassociated. For more information, see
--     <https://docs.aws.amazon.com/codeguru/latest/reviewer-ug/auth-and-access-control-using-tags.html Using tags to control access to associated repositories>
--     in the /Amazon CodeGuru Reviewer User Guide/.
repositoryAssociation_state :: Lens.Lens' RepositoryAssociation (Prelude.Maybe RepositoryAssociationState)
repositoryAssociation_state :: Lens' RepositoryAssociation (Maybe RepositoryAssociationState)
repositoryAssociation_state = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RepositoryAssociation' {Maybe RepositoryAssociationState
state :: Maybe RepositoryAssociationState
$sel:state:RepositoryAssociation' :: RepositoryAssociation -> Maybe RepositoryAssociationState
state} -> Maybe RepositoryAssociationState
state) (\s :: RepositoryAssociation
s@RepositoryAssociation' {} Maybe RepositoryAssociationState
a -> RepositoryAssociation
s {$sel:state:RepositoryAssociation' :: Maybe RepositoryAssociationState
state = Maybe RepositoryAssociationState
a} :: RepositoryAssociation)

-- | A description of why the repository association is in the current state.
repositoryAssociation_stateReason :: Lens.Lens' RepositoryAssociation (Prelude.Maybe Prelude.Text)
repositoryAssociation_stateReason :: Lens' RepositoryAssociation (Maybe Text)
repositoryAssociation_stateReason = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RepositoryAssociation' {Maybe Text
stateReason :: Maybe Text
$sel:stateReason:RepositoryAssociation' :: RepositoryAssociation -> Maybe Text
stateReason} -> Maybe Text
stateReason) (\s :: RepositoryAssociation
s@RepositoryAssociation' {} Maybe Text
a -> RepositoryAssociation
s {$sel:stateReason:RepositoryAssociation' :: Maybe Text
stateReason = Maybe Text
a} :: RepositoryAssociation)

instance Data.FromJSON RepositoryAssociation where
  parseJSON :: Value -> Parser RepositoryAssociation
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"RepositoryAssociation"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe POSIX
-> Maybe KMSKeyDetails
-> Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Maybe ProviderType
-> Maybe S3RepositoryDetails
-> Maybe RepositoryAssociationState
-> Maybe Text
-> RepositoryAssociation
RepositoryAssociation'
            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
"AssociationArn")
            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
"AssociationId")
            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
"ConnectionArn")
            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
"CreatedTimeStamp")
            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
"KMSKeyDetails")
            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
"LastUpdatedTimeStamp")
            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
"Name")
            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
"Owner")
            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
"ProviderType")
            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
"S3RepositoryDetails")
            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
"State")
            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
"StateReason")
      )

instance Prelude.Hashable RepositoryAssociation where
  hashWithSalt :: Int -> RepositoryAssociation -> Int
hashWithSalt Int
_salt RepositoryAssociation' {Maybe Text
Maybe POSIX
Maybe KMSKeyDetails
Maybe ProviderType
Maybe RepositoryAssociationState
Maybe S3RepositoryDetails
stateReason :: Maybe Text
state :: Maybe RepositoryAssociationState
s3RepositoryDetails :: Maybe S3RepositoryDetails
providerType :: Maybe ProviderType
owner :: Maybe Text
name :: Maybe Text
lastUpdatedTimeStamp :: Maybe POSIX
kmsKeyDetails :: Maybe KMSKeyDetails
createdTimeStamp :: Maybe POSIX
connectionArn :: Maybe Text
associationId :: Maybe Text
associationArn :: Maybe Text
$sel:stateReason:RepositoryAssociation' :: RepositoryAssociation -> Maybe Text
$sel:state:RepositoryAssociation' :: RepositoryAssociation -> Maybe RepositoryAssociationState
$sel:s3RepositoryDetails:RepositoryAssociation' :: RepositoryAssociation -> Maybe S3RepositoryDetails
$sel:providerType:RepositoryAssociation' :: RepositoryAssociation -> Maybe ProviderType
$sel:owner:RepositoryAssociation' :: RepositoryAssociation -> Maybe Text
$sel:name:RepositoryAssociation' :: RepositoryAssociation -> Maybe Text
$sel:lastUpdatedTimeStamp:RepositoryAssociation' :: RepositoryAssociation -> Maybe POSIX
$sel:kmsKeyDetails:RepositoryAssociation' :: RepositoryAssociation -> Maybe KMSKeyDetails
$sel:createdTimeStamp:RepositoryAssociation' :: RepositoryAssociation -> Maybe POSIX
$sel:connectionArn:RepositoryAssociation' :: RepositoryAssociation -> Maybe Text
$sel:associationId:RepositoryAssociation' :: RepositoryAssociation -> Maybe Text
$sel:associationArn:RepositoryAssociation' :: RepositoryAssociation -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
associationArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
associationId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
connectionArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
createdTimeStamp
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe KMSKeyDetails
kmsKeyDetails
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
lastUpdatedTimeStamp
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
owner
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ProviderType
providerType
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe S3RepositoryDetails
s3RepositoryDetails
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe RepositoryAssociationState
state
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
stateReason

instance Prelude.NFData RepositoryAssociation where
  rnf :: RepositoryAssociation -> ()
rnf RepositoryAssociation' {Maybe Text
Maybe POSIX
Maybe KMSKeyDetails
Maybe ProviderType
Maybe RepositoryAssociationState
Maybe S3RepositoryDetails
stateReason :: Maybe Text
state :: Maybe RepositoryAssociationState
s3RepositoryDetails :: Maybe S3RepositoryDetails
providerType :: Maybe ProviderType
owner :: Maybe Text
name :: Maybe Text
lastUpdatedTimeStamp :: Maybe POSIX
kmsKeyDetails :: Maybe KMSKeyDetails
createdTimeStamp :: Maybe POSIX
connectionArn :: Maybe Text
associationId :: Maybe Text
associationArn :: Maybe Text
$sel:stateReason:RepositoryAssociation' :: RepositoryAssociation -> Maybe Text
$sel:state:RepositoryAssociation' :: RepositoryAssociation -> Maybe RepositoryAssociationState
$sel:s3RepositoryDetails:RepositoryAssociation' :: RepositoryAssociation -> Maybe S3RepositoryDetails
$sel:providerType:RepositoryAssociation' :: RepositoryAssociation -> Maybe ProviderType
$sel:owner:RepositoryAssociation' :: RepositoryAssociation -> Maybe Text
$sel:name:RepositoryAssociation' :: RepositoryAssociation -> Maybe Text
$sel:lastUpdatedTimeStamp:RepositoryAssociation' :: RepositoryAssociation -> Maybe POSIX
$sel:kmsKeyDetails:RepositoryAssociation' :: RepositoryAssociation -> Maybe KMSKeyDetails
$sel:createdTimeStamp:RepositoryAssociation' :: RepositoryAssociation -> Maybe POSIX
$sel:connectionArn:RepositoryAssociation' :: RepositoryAssociation -> Maybe Text
$sel:associationId:RepositoryAssociation' :: RepositoryAssociation -> Maybe Text
$sel:associationArn:RepositoryAssociation' :: RepositoryAssociation -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
associationArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
associationId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
connectionArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
createdTimeStamp
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe KMSKeyDetails
kmsKeyDetails
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
lastUpdatedTimeStamp
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
name
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
owner
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ProviderType
providerType
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe S3RepositoryDetails
s3RepositoryDetails
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe RepositoryAssociationState
state
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
stateReason