{-# 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.ECR.Types.Repository
-- 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.ECR.Types.Repository where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.ECR.Types.EncryptionConfiguration
import Amazonka.ECR.Types.ImageScanningConfiguration
import Amazonka.ECR.Types.ImageTagMutability
import qualified Amazonka.Prelude as Prelude

-- | An object representing a repository.
--
-- /See:/ 'newRepository' smart constructor.
data Repository = Repository'
  { -- | The date and time, in JavaScript date format, when the repository was
    -- created.
    Repository -> Maybe POSIX
createdAt :: Prelude.Maybe Data.POSIX,
    -- | The encryption configuration for the repository. This determines how the
    -- contents of your repository are encrypted at rest.
    Repository -> Maybe EncryptionConfiguration
encryptionConfiguration :: Prelude.Maybe EncryptionConfiguration,
    Repository -> Maybe ImageScanningConfiguration
imageScanningConfiguration :: Prelude.Maybe ImageScanningConfiguration,
    -- | The tag mutability setting for the repository.
    Repository -> Maybe ImageTagMutability
imageTagMutability :: Prelude.Maybe ImageTagMutability,
    -- | The Amazon Web Services account ID associated with the registry that
    -- contains the repository.
    Repository -> Maybe Text
registryId :: Prelude.Maybe Prelude.Text,
    -- | The Amazon Resource Name (ARN) that identifies the repository. The ARN
    -- contains the @arn:aws:ecr@ namespace, followed by the region of the
    -- repository, Amazon Web Services account ID of the repository owner,
    -- repository namespace, and repository name. For example,
    -- @arn:aws:ecr:region:012345678910:repository\/test@.
    Repository -> Maybe Text
repositoryArn :: Prelude.Maybe Prelude.Text,
    -- | The name of the repository.
    Repository -> Maybe Text
repositoryName :: Prelude.Maybe Prelude.Text,
    -- | The URI for the repository. You can use this URI for container image
    -- @push@ and @pull@ operations.
    Repository -> Maybe Text
repositoryUri :: Prelude.Maybe Prelude.Text
  }
  deriving (Repository -> Repository -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Repository -> Repository -> Bool
$c/= :: Repository -> Repository -> Bool
== :: Repository -> Repository -> Bool
$c== :: Repository -> Repository -> Bool
Prelude.Eq, ReadPrec [Repository]
ReadPrec Repository
Int -> ReadS Repository
ReadS [Repository]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Repository]
$creadListPrec :: ReadPrec [Repository]
readPrec :: ReadPrec Repository
$creadPrec :: ReadPrec Repository
readList :: ReadS [Repository]
$creadList :: ReadS [Repository]
readsPrec :: Int -> ReadS Repository
$creadsPrec :: Int -> ReadS Repository
Prelude.Read, Int -> Repository -> ShowS
[Repository] -> ShowS
Repository -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Repository] -> ShowS
$cshowList :: [Repository] -> ShowS
show :: Repository -> String
$cshow :: Repository -> String
showsPrec :: Int -> Repository -> ShowS
$cshowsPrec :: Int -> Repository -> ShowS
Prelude.Show, forall x. Rep Repository x -> Repository
forall x. Repository -> Rep Repository x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Repository x -> Repository
$cfrom :: forall x. Repository -> Rep Repository x
Prelude.Generic)

-- |
-- Create a value of 'Repository' 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:
--
-- 'createdAt', 'repository_createdAt' - The date and time, in JavaScript date format, when the repository was
-- created.
--
-- 'encryptionConfiguration', 'repository_encryptionConfiguration' - The encryption configuration for the repository. This determines how the
-- contents of your repository are encrypted at rest.
--
-- 'imageScanningConfiguration', 'repository_imageScanningConfiguration' - Undocumented member.
--
-- 'imageTagMutability', 'repository_imageTagMutability' - The tag mutability setting for the repository.
--
-- 'registryId', 'repository_registryId' - The Amazon Web Services account ID associated with the registry that
-- contains the repository.
--
-- 'repositoryArn', 'repository_repositoryArn' - The Amazon Resource Name (ARN) that identifies the repository. The ARN
-- contains the @arn:aws:ecr@ namespace, followed by the region of the
-- repository, Amazon Web Services account ID of the repository owner,
-- repository namespace, and repository name. For example,
-- @arn:aws:ecr:region:012345678910:repository\/test@.
--
-- 'repositoryName', 'repository_repositoryName' - The name of the repository.
--
-- 'repositoryUri', 'repository_repositoryUri' - The URI for the repository. You can use this URI for container image
-- @push@ and @pull@ operations.
newRepository ::
  Repository
newRepository :: Repository
newRepository =
  Repository'
    { $sel:createdAt:Repository' :: Maybe POSIX
createdAt = forall a. Maybe a
Prelude.Nothing,
      $sel:encryptionConfiguration:Repository' :: Maybe EncryptionConfiguration
encryptionConfiguration = forall a. Maybe a
Prelude.Nothing,
      $sel:imageScanningConfiguration:Repository' :: Maybe ImageScanningConfiguration
imageScanningConfiguration = forall a. Maybe a
Prelude.Nothing,
      $sel:imageTagMutability:Repository' :: Maybe ImageTagMutability
imageTagMutability = forall a. Maybe a
Prelude.Nothing,
      $sel:registryId:Repository' :: Maybe Text
registryId = forall a. Maybe a
Prelude.Nothing,
      $sel:repositoryArn:Repository' :: Maybe Text
repositoryArn = forall a. Maybe a
Prelude.Nothing,
      $sel:repositoryName:Repository' :: Maybe Text
repositoryName = forall a. Maybe a
Prelude.Nothing,
      $sel:repositoryUri:Repository' :: Maybe Text
repositoryUri = forall a. Maybe a
Prelude.Nothing
    }

-- | The date and time, in JavaScript date format, when the repository was
-- created.
repository_createdAt :: Lens.Lens' Repository (Prelude.Maybe Prelude.UTCTime)
repository_createdAt :: Lens' Repository (Maybe UTCTime)
repository_createdAt = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Repository' {Maybe POSIX
createdAt :: Maybe POSIX
$sel:createdAt:Repository' :: Repository -> Maybe POSIX
createdAt} -> Maybe POSIX
createdAt) (\s :: Repository
s@Repository' {} Maybe POSIX
a -> Repository
s {$sel:createdAt:Repository' :: Maybe POSIX
createdAt = Maybe POSIX
a} :: Repository) 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 encryption configuration for the repository. This determines how the
-- contents of your repository are encrypted at rest.
repository_encryptionConfiguration :: Lens.Lens' Repository (Prelude.Maybe EncryptionConfiguration)
repository_encryptionConfiguration :: Lens' Repository (Maybe EncryptionConfiguration)
repository_encryptionConfiguration = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Repository' {Maybe EncryptionConfiguration
encryptionConfiguration :: Maybe EncryptionConfiguration
$sel:encryptionConfiguration:Repository' :: Repository -> Maybe EncryptionConfiguration
encryptionConfiguration} -> Maybe EncryptionConfiguration
encryptionConfiguration) (\s :: Repository
s@Repository' {} Maybe EncryptionConfiguration
a -> Repository
s {$sel:encryptionConfiguration:Repository' :: Maybe EncryptionConfiguration
encryptionConfiguration = Maybe EncryptionConfiguration
a} :: Repository)

-- | Undocumented member.
repository_imageScanningConfiguration :: Lens.Lens' Repository (Prelude.Maybe ImageScanningConfiguration)
repository_imageScanningConfiguration :: Lens' Repository (Maybe ImageScanningConfiguration)
repository_imageScanningConfiguration = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Repository' {Maybe ImageScanningConfiguration
imageScanningConfiguration :: Maybe ImageScanningConfiguration
$sel:imageScanningConfiguration:Repository' :: Repository -> Maybe ImageScanningConfiguration
imageScanningConfiguration} -> Maybe ImageScanningConfiguration
imageScanningConfiguration) (\s :: Repository
s@Repository' {} Maybe ImageScanningConfiguration
a -> Repository
s {$sel:imageScanningConfiguration:Repository' :: Maybe ImageScanningConfiguration
imageScanningConfiguration = Maybe ImageScanningConfiguration
a} :: Repository)

-- | The tag mutability setting for the repository.
repository_imageTagMutability :: Lens.Lens' Repository (Prelude.Maybe ImageTagMutability)
repository_imageTagMutability :: Lens' Repository (Maybe ImageTagMutability)
repository_imageTagMutability = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Repository' {Maybe ImageTagMutability
imageTagMutability :: Maybe ImageTagMutability
$sel:imageTagMutability:Repository' :: Repository -> Maybe ImageTagMutability
imageTagMutability} -> Maybe ImageTagMutability
imageTagMutability) (\s :: Repository
s@Repository' {} Maybe ImageTagMutability
a -> Repository
s {$sel:imageTagMutability:Repository' :: Maybe ImageTagMutability
imageTagMutability = Maybe ImageTagMutability
a} :: Repository)

-- | The Amazon Web Services account ID associated with the registry that
-- contains the repository.
repository_registryId :: Lens.Lens' Repository (Prelude.Maybe Prelude.Text)
repository_registryId :: Lens' Repository (Maybe Text)
repository_registryId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Repository' {Maybe Text
registryId :: Maybe Text
$sel:registryId:Repository' :: Repository -> Maybe Text
registryId} -> Maybe Text
registryId) (\s :: Repository
s@Repository' {} Maybe Text
a -> Repository
s {$sel:registryId:Repository' :: Maybe Text
registryId = Maybe Text
a} :: Repository)

-- | The Amazon Resource Name (ARN) that identifies the repository. The ARN
-- contains the @arn:aws:ecr@ namespace, followed by the region of the
-- repository, Amazon Web Services account ID of the repository owner,
-- repository namespace, and repository name. For example,
-- @arn:aws:ecr:region:012345678910:repository\/test@.
repository_repositoryArn :: Lens.Lens' Repository (Prelude.Maybe Prelude.Text)
repository_repositoryArn :: Lens' Repository (Maybe Text)
repository_repositoryArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Repository' {Maybe Text
repositoryArn :: Maybe Text
$sel:repositoryArn:Repository' :: Repository -> Maybe Text
repositoryArn} -> Maybe Text
repositoryArn) (\s :: Repository
s@Repository' {} Maybe Text
a -> Repository
s {$sel:repositoryArn:Repository' :: Maybe Text
repositoryArn = Maybe Text
a} :: Repository)

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

-- | The URI for the repository. You can use this URI for container image
-- @push@ and @pull@ operations.
repository_repositoryUri :: Lens.Lens' Repository (Prelude.Maybe Prelude.Text)
repository_repositoryUri :: Lens' Repository (Maybe Text)
repository_repositoryUri = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Repository' {Maybe Text
repositoryUri :: Maybe Text
$sel:repositoryUri:Repository' :: Repository -> Maybe Text
repositoryUri} -> Maybe Text
repositoryUri) (\s :: Repository
s@Repository' {} Maybe Text
a -> Repository
s {$sel:repositoryUri:Repository' :: Maybe Text
repositoryUri = Maybe Text
a} :: Repository)

instance Data.FromJSON Repository where
  parseJSON :: Value -> Parser Repository
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"Repository"
      ( \Object
x ->
          Maybe POSIX
-> Maybe EncryptionConfiguration
-> Maybe ImageScanningConfiguration
-> Maybe ImageTagMutability
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Repository
Repository'
            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
"createdAt")
            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
"encryptionConfiguration")
            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
"imageScanningConfiguration")
            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
"imageTagMutability")
            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
"registryId")
            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
"repositoryArn")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"repositoryName")
            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
"repositoryUri")
      )

instance Prelude.Hashable Repository where
  hashWithSalt :: Int -> Repository -> Int
hashWithSalt Int
_salt Repository' {Maybe Text
Maybe POSIX
Maybe EncryptionConfiguration
Maybe ImageScanningConfiguration
Maybe ImageTagMutability
repositoryUri :: Maybe Text
repositoryName :: Maybe Text
repositoryArn :: Maybe Text
registryId :: Maybe Text
imageTagMutability :: Maybe ImageTagMutability
imageScanningConfiguration :: Maybe ImageScanningConfiguration
encryptionConfiguration :: Maybe EncryptionConfiguration
createdAt :: Maybe POSIX
$sel:repositoryUri:Repository' :: Repository -> Maybe Text
$sel:repositoryName:Repository' :: Repository -> Maybe Text
$sel:repositoryArn:Repository' :: Repository -> Maybe Text
$sel:registryId:Repository' :: Repository -> Maybe Text
$sel:imageTagMutability:Repository' :: Repository -> Maybe ImageTagMutability
$sel:imageScanningConfiguration:Repository' :: Repository -> Maybe ImageScanningConfiguration
$sel:encryptionConfiguration:Repository' :: Repository -> Maybe EncryptionConfiguration
$sel:createdAt:Repository' :: Repository -> Maybe POSIX
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
createdAt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe EncryptionConfiguration
encryptionConfiguration
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ImageScanningConfiguration
imageScanningConfiguration
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ImageTagMutability
imageTagMutability
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
registryId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
repositoryArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
repositoryName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
repositoryUri

instance Prelude.NFData Repository where
  rnf :: Repository -> ()
rnf Repository' {Maybe Text
Maybe POSIX
Maybe EncryptionConfiguration
Maybe ImageScanningConfiguration
Maybe ImageTagMutability
repositoryUri :: Maybe Text
repositoryName :: Maybe Text
repositoryArn :: Maybe Text
registryId :: Maybe Text
imageTagMutability :: Maybe ImageTagMutability
imageScanningConfiguration :: Maybe ImageScanningConfiguration
encryptionConfiguration :: Maybe EncryptionConfiguration
createdAt :: Maybe POSIX
$sel:repositoryUri:Repository' :: Repository -> Maybe Text
$sel:repositoryName:Repository' :: Repository -> Maybe Text
$sel:repositoryArn:Repository' :: Repository -> Maybe Text
$sel:registryId:Repository' :: Repository -> Maybe Text
$sel:imageTagMutability:Repository' :: Repository -> Maybe ImageTagMutability
$sel:imageScanningConfiguration:Repository' :: Repository -> Maybe ImageScanningConfiguration
$sel:encryptionConfiguration:Repository' :: Repository -> Maybe EncryptionConfiguration
$sel:createdAt:Repository' :: Repository -> Maybe POSIX
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
createdAt
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe EncryptionConfiguration
encryptionConfiguration
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ImageScanningConfiguration
imageScanningConfiguration
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ImageTagMutability
imageTagMutability
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
registryId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
repositoryArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
repositoryName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
repositoryUri