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

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

-- | An object representing a repository.
--
-- /See:/ 'newRepository' smart constructor.
data Repository = 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 -> Maybe Text
repositoryArn :: Prelude.Maybe Prelude.Text,
    -- | The date and time, in JavaScript date format, when the repository was
    -- created.
    Repository -> Maybe POSIX
createdAt :: Prelude.Maybe Core.POSIX,
    -- | The Amazon Web Services account ID associated with the registry that
    -- contains the repository.
    Repository -> Maybe Text
registryId :: Prelude.Maybe Prelude.Text,
    Repository -> Maybe ImageScanningConfiguration
imageScanningConfiguration :: Prelude.Maybe ImageScanningConfiguration,
    -- | 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,
    -- | 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,
    -- | The name of the repository.
    Repository -> Maybe Text
repositoryName :: Prelude.Maybe Prelude.Text,
    -- | The tag mutability setting for the repository.
    Repository -> Maybe ImageTagMutability
imageTagMutability :: Prelude.Maybe ImageTagMutability
  }
  deriving (Repository -> Repository -> Bool
(Repository -> Repository -> Bool)
-> (Repository -> Repository -> Bool) -> Eq Repository
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]
(Int -> ReadS Repository)
-> ReadS [Repository]
-> ReadPrec Repository
-> ReadPrec [Repository]
-> Read 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
(Int -> Repository -> ShowS)
-> (Repository -> String)
-> ([Repository] -> ShowS)
-> Show Repository
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. Repository -> Rep Repository x)
-> (forall x. Rep Repository x -> Repository) -> Generic Repository
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:
--
-- '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@.
--
-- 'createdAt', 'repository_createdAt' - The date and time, in JavaScript date format, when the repository was
-- created.
--
-- 'registryId', 'repository_registryId' - The Amazon Web Services account ID associated with the registry that
-- contains the repository.
--
-- 'imageScanningConfiguration', 'repository_imageScanningConfiguration' - Undocumented member.
--
-- 'repositoryUri', 'repository_repositoryUri' - The URI for the repository. You can use this URI for container image
-- @push@ and @pull@ operations.
--
-- 'encryptionConfiguration', 'repository_encryptionConfiguration' - The encryption configuration for the repository. This determines how the
-- contents of your repository are encrypted at rest.
--
-- 'repositoryName', 'repository_repositoryName' - The name of the repository.
--
-- 'imageTagMutability', 'repository_imageTagMutability' - The tag mutability setting for the repository.
newRepository ::
  Repository
newRepository :: Repository
newRepository =
  Repository' :: Maybe Text
-> Maybe POSIX
-> Maybe Text
-> Maybe ImageScanningConfiguration
-> Maybe Text
-> Maybe EncryptionConfiguration
-> Maybe Text
-> Maybe ImageTagMutability
-> Repository
Repository'
    { $sel:repositoryArn:Repository' :: Maybe Text
repositoryArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:createdAt:Repository' :: Maybe POSIX
createdAt = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:registryId:Repository' :: Maybe Text
registryId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:imageScanningConfiguration:Repository' :: Maybe ImageScanningConfiguration
imageScanningConfiguration = Maybe ImageScanningConfiguration
forall a. Maybe a
Prelude.Nothing,
      $sel:repositoryUri:Repository' :: Maybe Text
repositoryUri = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:encryptionConfiguration:Repository' :: Maybe EncryptionConfiguration
encryptionConfiguration = Maybe EncryptionConfiguration
forall a. Maybe a
Prelude.Nothing,
      $sel:repositoryName:Repository' :: Maybe Text
repositoryName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:imageTagMutability:Repository' :: Maybe ImageTagMutability
imageTagMutability = Maybe ImageTagMutability
forall a. Maybe a
Prelude.Nothing
    }

-- | 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 :: (Maybe Text -> f (Maybe Text)) -> Repository -> f Repository
repository_repositoryArn = (Repository -> Maybe Text)
-> (Repository -> Maybe Text -> Repository)
-> Lens Repository Repository (Maybe Text) (Maybe Text)
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 date and time, in JavaScript date format, when the repository was
-- created.
repository_createdAt :: Lens.Lens' Repository (Prelude.Maybe Prelude.UTCTime)
repository_createdAt :: (Maybe UTCTime -> f (Maybe UTCTime)) -> Repository -> f Repository
repository_createdAt = (Repository -> Maybe POSIX)
-> (Repository -> Maybe POSIX -> Repository)
-> Lens Repository Repository (Maybe POSIX) (Maybe POSIX)
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) ((Maybe POSIX -> f (Maybe POSIX)) -> Repository -> f Repository)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> Repository
-> f Repository
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 Amazon Web Services account ID associated with the registry that
-- contains the repository.
repository_registryId :: Lens.Lens' Repository (Prelude.Maybe Prelude.Text)
repository_registryId :: (Maybe Text -> f (Maybe Text)) -> Repository -> f Repository
repository_registryId = (Repository -> Maybe Text)
-> (Repository -> Maybe Text -> Repository)
-> Lens Repository Repository (Maybe Text) (Maybe Text)
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)

-- | Undocumented member.
repository_imageScanningConfiguration :: Lens.Lens' Repository (Prelude.Maybe ImageScanningConfiguration)
repository_imageScanningConfiguration :: (Maybe ImageScanningConfiguration
 -> f (Maybe ImageScanningConfiguration))
-> Repository -> f Repository
repository_imageScanningConfiguration = (Repository -> Maybe ImageScanningConfiguration)
-> (Repository -> Maybe ImageScanningConfiguration -> Repository)
-> Lens
     Repository
     Repository
     (Maybe ImageScanningConfiguration)
     (Maybe 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 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 :: (Maybe Text -> f (Maybe Text)) -> Repository -> f Repository
repository_repositoryUri = (Repository -> Maybe Text)
-> (Repository -> Maybe Text -> Repository)
-> Lens Repository Repository (Maybe Text) (Maybe Text)
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)

-- | 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 :: (Maybe EncryptionConfiguration
 -> f (Maybe EncryptionConfiguration))
-> Repository -> f Repository
repository_encryptionConfiguration = (Repository -> Maybe EncryptionConfiguration)
-> (Repository -> Maybe EncryptionConfiguration -> Repository)
-> Lens
     Repository
     Repository
     (Maybe EncryptionConfiguration)
     (Maybe 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)

-- | The name of the repository.
repository_repositoryName :: Lens.Lens' Repository (Prelude.Maybe Prelude.Text)
repository_repositoryName :: (Maybe Text -> f (Maybe Text)) -> Repository -> f Repository
repository_repositoryName = (Repository -> Maybe Text)
-> (Repository -> Maybe Text -> Repository)
-> Lens Repository Repository (Maybe Text) (Maybe Text)
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 tag mutability setting for the repository.
repository_imageTagMutability :: Lens.Lens' Repository (Prelude.Maybe ImageTagMutability)
repository_imageTagMutability :: (Maybe ImageTagMutability -> f (Maybe ImageTagMutability))
-> Repository -> f Repository
repository_imageTagMutability = (Repository -> Maybe ImageTagMutability)
-> (Repository -> Maybe ImageTagMutability -> Repository)
-> Lens
     Repository
     Repository
     (Maybe ImageTagMutability)
     (Maybe 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)

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

instance Prelude.Hashable Repository

instance Prelude.NFData Repository