{-# 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-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.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.Lens as Lens
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 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 an associated 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,
    RepositoryAssociation -> Maybe S3RepositoryDetails
s3RepositoryDetails :: Prelude.Maybe S3RepositoryDetails,
    -- | The provider type of the repository association.
    RepositoryAssociation -> Maybe ProviderType
providerType :: Prelude.Maybe ProviderType,
    -- | 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 name of the repository.
    RepositoryAssociation -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | 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 respository association.
    RepositoryAssociation -> Maybe KMSKeyDetails
kmsKeyDetails :: Prelude.Maybe KMSKeyDetails,
    -- | 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,
    -- | A description of why the repository association is in the current state.
    RepositoryAssociation -> Maybe Text
stateReason :: Prelude.Maybe Prelude.Text,
    -- | The time, in milliseconds since the epoch, when the repository
    -- association was created.
    RepositoryAssociation -> Maybe POSIX
createdTimeStamp :: Prelude.Maybe Core.POSIX,
    -- | The time, in milliseconds since the epoch, when the repository
    -- association was last updated.
    RepositoryAssociation -> Maybe POSIX
lastUpdatedTimeStamp :: Prelude.Maybe Core.POSIX
  }
  deriving (RepositoryAssociation -> RepositoryAssociation -> Bool
(RepositoryAssociation -> RepositoryAssociation -> Bool)
-> (RepositoryAssociation -> RepositoryAssociation -> Bool)
-> Eq RepositoryAssociation
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]
(Int -> ReadS RepositoryAssociation)
-> ReadS [RepositoryAssociation]
-> ReadPrec RepositoryAssociation
-> ReadPrec [RepositoryAssociation]
-> Read 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
(Int -> RepositoryAssociation -> ShowS)
-> (RepositoryAssociation -> String)
-> ([RepositoryAssociation] -> ShowS)
-> Show RepositoryAssociation
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. RepositoryAssociation -> Rep RepositoryAssociation x)
-> (forall x. Rep RepositoryAssociation x -> RepositoryAssociation)
-> Generic RepositoryAssociation
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.
--
-- '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 an associated 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/.
--
-- 's3RepositoryDetails', 'repositoryAssociation_s3RepositoryDetails' - Undocumented member.
--
-- 'providerType', 'repositoryAssociation_providerType' - The provider type of the repository association.
--
-- '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.
--
-- 'name', 'repositoryAssociation_name' - The name of the repository.
--
-- '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 respository 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/.
--
-- 'stateReason', 'repositoryAssociation_stateReason' - A description of why the repository association is in the current state.
--
-- 'createdTimeStamp', 'repositoryAssociation_createdTimeStamp' - The time, in milliseconds since the epoch, when the repository
-- association was created.
--
-- 'lastUpdatedTimeStamp', 'repositoryAssociation_lastUpdatedTimeStamp' - The time, in milliseconds since the epoch, when the repository
-- association was last updated.
newRepositoryAssociation ::
  RepositoryAssociation
newRepositoryAssociation :: RepositoryAssociation
newRepositoryAssociation =
  RepositoryAssociation' :: Maybe Text
-> Maybe Text
-> Maybe RepositoryAssociationState
-> Maybe S3RepositoryDetails
-> Maybe ProviderType
-> Maybe Text
-> Maybe Text
-> Maybe KMSKeyDetails
-> Maybe Text
-> Maybe Text
-> Maybe POSIX
-> Maybe POSIX
-> RepositoryAssociation
RepositoryAssociation'
    { $sel:associationArn:RepositoryAssociation' :: Maybe Text
associationArn =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:associationId:RepositoryAssociation' :: Maybe Text
associationId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:state:RepositoryAssociation' :: Maybe RepositoryAssociationState
state = Maybe RepositoryAssociationState
forall a. Maybe a
Prelude.Nothing,
      $sel:s3RepositoryDetails:RepositoryAssociation' :: Maybe S3RepositoryDetails
s3RepositoryDetails = Maybe S3RepositoryDetails
forall a. Maybe a
Prelude.Nothing,
      $sel:providerType:RepositoryAssociation' :: Maybe ProviderType
providerType = Maybe ProviderType
forall a. Maybe a
Prelude.Nothing,
      $sel:owner:RepositoryAssociation' :: Maybe Text
owner = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:name:RepositoryAssociation' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:kmsKeyDetails:RepositoryAssociation' :: Maybe KMSKeyDetails
kmsKeyDetails = Maybe KMSKeyDetails
forall a. Maybe a
Prelude.Nothing,
      $sel:connectionArn:RepositoryAssociation' :: Maybe Text
connectionArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:stateReason:RepositoryAssociation' :: Maybe Text
stateReason = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:createdTimeStamp:RepositoryAssociation' :: Maybe POSIX
createdTimeStamp = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:lastUpdatedTimeStamp:RepositoryAssociation' :: Maybe POSIX
lastUpdatedTimeStamp = Maybe POSIX
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 :: (Maybe Text -> f (Maybe Text))
-> RepositoryAssociation -> f RepositoryAssociation
repositoryAssociation_associationArn = (RepositoryAssociation -> Maybe Text)
-> (RepositoryAssociation -> Maybe Text -> RepositoryAssociation)
-> Lens
     RepositoryAssociation
     RepositoryAssociation
     (Maybe Text)
     (Maybe Text)
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 :: (Maybe Text -> f (Maybe Text))
-> RepositoryAssociation -> f RepositoryAssociation
repositoryAssociation_associationId = (RepositoryAssociation -> Maybe Text)
-> (RepositoryAssociation -> Maybe Text -> RepositoryAssociation)
-> Lens
     RepositoryAssociation
     RepositoryAssociation
     (Maybe Text)
     (Maybe Text)
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 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 an associated 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 :: (Maybe RepositoryAssociationState
 -> f (Maybe RepositoryAssociationState))
-> RepositoryAssociation -> f RepositoryAssociation
repositoryAssociation_state = (RepositoryAssociation -> Maybe RepositoryAssociationState)
-> (RepositoryAssociation
    -> Maybe RepositoryAssociationState -> RepositoryAssociation)
-> Lens
     RepositoryAssociation
     RepositoryAssociation
     (Maybe RepositoryAssociationState)
     (Maybe RepositoryAssociationState)
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)

-- | Undocumented member.
repositoryAssociation_s3RepositoryDetails :: Lens.Lens' RepositoryAssociation (Prelude.Maybe S3RepositoryDetails)
repositoryAssociation_s3RepositoryDetails :: (Maybe S3RepositoryDetails -> f (Maybe S3RepositoryDetails))
-> RepositoryAssociation -> f RepositoryAssociation
repositoryAssociation_s3RepositoryDetails = (RepositoryAssociation -> Maybe S3RepositoryDetails)
-> (RepositoryAssociation
    -> Maybe S3RepositoryDetails -> RepositoryAssociation)
-> Lens
     RepositoryAssociation
     RepositoryAssociation
     (Maybe S3RepositoryDetails)
     (Maybe 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 provider type of the repository association.
repositoryAssociation_providerType :: Lens.Lens' RepositoryAssociation (Prelude.Maybe ProviderType)
repositoryAssociation_providerType :: (Maybe ProviderType -> f (Maybe ProviderType))
-> RepositoryAssociation -> f RepositoryAssociation
repositoryAssociation_providerType = (RepositoryAssociation -> Maybe ProviderType)
-> (RepositoryAssociation
    -> Maybe ProviderType -> RepositoryAssociation)
-> Lens
     RepositoryAssociation
     RepositoryAssociation
     (Maybe ProviderType)
     (Maybe 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)

-- | 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 :: (Maybe Text -> f (Maybe Text))
-> RepositoryAssociation -> f RepositoryAssociation
repositoryAssociation_owner = (RepositoryAssociation -> Maybe Text)
-> (RepositoryAssociation -> Maybe Text -> RepositoryAssociation)
-> Lens
     RepositoryAssociation
     RepositoryAssociation
     (Maybe Text)
     (Maybe Text)
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 name of the repository.
repositoryAssociation_name :: Lens.Lens' RepositoryAssociation (Prelude.Maybe Prelude.Text)
repositoryAssociation_name :: (Maybe Text -> f (Maybe Text))
-> RepositoryAssociation -> f RepositoryAssociation
repositoryAssociation_name = (RepositoryAssociation -> Maybe Text)
-> (RepositoryAssociation -> Maybe Text -> RepositoryAssociation)
-> Lens
     RepositoryAssociation
     RepositoryAssociation
     (Maybe Text)
     (Maybe Text)
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)

-- | 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 respository association.
repositoryAssociation_kmsKeyDetails :: Lens.Lens' RepositoryAssociation (Prelude.Maybe KMSKeyDetails)
repositoryAssociation_kmsKeyDetails :: (Maybe KMSKeyDetails -> f (Maybe KMSKeyDetails))
-> RepositoryAssociation -> f RepositoryAssociation
repositoryAssociation_kmsKeyDetails = (RepositoryAssociation -> Maybe KMSKeyDetails)
-> (RepositoryAssociation
    -> Maybe KMSKeyDetails -> RepositoryAssociation)
-> Lens
     RepositoryAssociation
     RepositoryAssociation
     (Maybe KMSKeyDetails)
     (Maybe 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 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 :: (Maybe Text -> f (Maybe Text))
-> RepositoryAssociation -> f RepositoryAssociation
repositoryAssociation_connectionArn = (RepositoryAssociation -> Maybe Text)
-> (RepositoryAssociation -> Maybe Text -> RepositoryAssociation)
-> Lens
     RepositoryAssociation
     RepositoryAssociation
     (Maybe Text)
     (Maybe Text)
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)

-- | A description of why the repository association is in the current state.
repositoryAssociation_stateReason :: Lens.Lens' RepositoryAssociation (Prelude.Maybe Prelude.Text)
repositoryAssociation_stateReason :: (Maybe Text -> f (Maybe Text))
-> RepositoryAssociation -> f RepositoryAssociation
repositoryAssociation_stateReason = (RepositoryAssociation -> Maybe Text)
-> (RepositoryAssociation -> Maybe Text -> RepositoryAssociation)
-> Lens
     RepositoryAssociation
     RepositoryAssociation
     (Maybe Text)
     (Maybe Text)
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)

-- | The time, in milliseconds since the epoch, when the repository
-- association was created.
repositoryAssociation_createdTimeStamp :: Lens.Lens' RepositoryAssociation (Prelude.Maybe Prelude.UTCTime)
repositoryAssociation_createdTimeStamp :: (Maybe UTCTime -> f (Maybe UTCTime))
-> RepositoryAssociation -> f RepositoryAssociation
repositoryAssociation_createdTimeStamp = (RepositoryAssociation -> Maybe POSIX)
-> (RepositoryAssociation -> Maybe POSIX -> RepositoryAssociation)
-> Lens
     RepositoryAssociation
     RepositoryAssociation
     (Maybe POSIX)
     (Maybe POSIX)
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) ((Maybe POSIX -> f (Maybe POSIX))
 -> RepositoryAssociation -> f RepositoryAssociation)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> RepositoryAssociation
-> f RepositoryAssociation
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 AnIso POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | 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 :: (Maybe UTCTime -> f (Maybe UTCTime))
-> RepositoryAssociation -> f RepositoryAssociation
repositoryAssociation_lastUpdatedTimeStamp = (RepositoryAssociation -> Maybe POSIX)
-> (RepositoryAssociation -> Maybe POSIX -> RepositoryAssociation)
-> Lens
     RepositoryAssociation
     RepositoryAssociation
     (Maybe POSIX)
     (Maybe POSIX)
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) ((Maybe POSIX -> f (Maybe POSIX))
 -> RepositoryAssociation -> f RepositoryAssociation)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> RepositoryAssociation
-> f RepositoryAssociation
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 AnIso POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

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

instance Prelude.Hashable RepositoryAssociation

instance Prelude.NFData RepositoryAssociation