{-# 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.ECRPublic.Types.Registry
-- 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.ECRPublic.Types.Registry where

import qualified Amazonka.Core as Core
import Amazonka.ECRPublic.Types.RegistryAlias
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | The details of a public registry.
--
-- /See:/ 'newRegistry' smart constructor.
data Registry = Registry'
  { -- | The AWS account ID associated with the registry. If you do not specify a
    -- registry, the default public registry is assumed.
    Registry -> Text
registryId :: Prelude.Text,
    -- | The Amazon Resource Name (ARN) of the public registry.
    Registry -> Text
registryArn :: Prelude.Text,
    -- | The URI of a public registry. The URI contains a universal prefix and
    -- the registry alias.
    Registry -> Text
registryUri :: Prelude.Text,
    -- | Whether the account is verified. This indicates whether the account is
    -- an AWS Marketplace vendor. If an account is verified, each public
    -- repository will received a verified account badge on the Amazon ECR
    -- Public Gallery.
    Registry -> Bool
verified :: Prelude.Bool,
    -- | An array of objects representing the aliases for a public registry.
    Registry -> [RegistryAlias]
aliases :: [RegistryAlias]
  }
  deriving (Registry -> Registry -> Bool
(Registry -> Registry -> Bool)
-> (Registry -> Registry -> Bool) -> Eq Registry
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Registry -> Registry -> Bool
$c/= :: Registry -> Registry -> Bool
== :: Registry -> Registry -> Bool
$c== :: Registry -> Registry -> Bool
Prelude.Eq, ReadPrec [Registry]
ReadPrec Registry
Int -> ReadS Registry
ReadS [Registry]
(Int -> ReadS Registry)
-> ReadS [Registry]
-> ReadPrec Registry
-> ReadPrec [Registry]
-> Read Registry
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Registry]
$creadListPrec :: ReadPrec [Registry]
readPrec :: ReadPrec Registry
$creadPrec :: ReadPrec Registry
readList :: ReadS [Registry]
$creadList :: ReadS [Registry]
readsPrec :: Int -> ReadS Registry
$creadsPrec :: Int -> ReadS Registry
Prelude.Read, Int -> Registry -> ShowS
[Registry] -> ShowS
Registry -> String
(Int -> Registry -> ShowS)
-> (Registry -> String) -> ([Registry] -> ShowS) -> Show Registry
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Registry] -> ShowS
$cshowList :: [Registry] -> ShowS
show :: Registry -> String
$cshow :: Registry -> String
showsPrec :: Int -> Registry -> ShowS
$cshowsPrec :: Int -> Registry -> ShowS
Prelude.Show, (forall x. Registry -> Rep Registry x)
-> (forall x. Rep Registry x -> Registry) -> Generic Registry
forall x. Rep Registry x -> Registry
forall x. Registry -> Rep Registry x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Registry x -> Registry
$cfrom :: forall x. Registry -> Rep Registry x
Prelude.Generic)

-- |
-- Create a value of 'Registry' 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:
--
-- 'registryId', 'registry_registryId' - The AWS account ID associated with the registry. If you do not specify a
-- registry, the default public registry is assumed.
--
-- 'registryArn', 'registry_registryArn' - The Amazon Resource Name (ARN) of the public registry.
--
-- 'registryUri', 'registry_registryUri' - The URI of a public registry. The URI contains a universal prefix and
-- the registry alias.
--
-- 'verified', 'registry_verified' - Whether the account is verified. This indicates whether the account is
-- an AWS Marketplace vendor. If an account is verified, each public
-- repository will received a verified account badge on the Amazon ECR
-- Public Gallery.
--
-- 'aliases', 'registry_aliases' - An array of objects representing the aliases for a public registry.
newRegistry ::
  -- | 'registryId'
  Prelude.Text ->
  -- | 'registryArn'
  Prelude.Text ->
  -- | 'registryUri'
  Prelude.Text ->
  -- | 'verified'
  Prelude.Bool ->
  Registry
newRegistry :: Text -> Text -> Text -> Bool -> Registry
newRegistry
  Text
pRegistryId_
  Text
pRegistryArn_
  Text
pRegistryUri_
  Bool
pVerified_ =
    Registry' :: Text -> Text -> Text -> Bool -> [RegistryAlias] -> Registry
Registry'
      { $sel:registryId:Registry' :: Text
registryId = Text
pRegistryId_,
        $sel:registryArn:Registry' :: Text
registryArn = Text
pRegistryArn_,
        $sel:registryUri:Registry' :: Text
registryUri = Text
pRegistryUri_,
        $sel:verified:Registry' :: Bool
verified = Bool
pVerified_,
        $sel:aliases:Registry' :: [RegistryAlias]
aliases = [RegistryAlias]
forall a. Monoid a => a
Prelude.mempty
      }

-- | The AWS account ID associated with the registry. If you do not specify a
-- registry, the default public registry is assumed.
registry_registryId :: Lens.Lens' Registry Prelude.Text
registry_registryId :: (Text -> f Text) -> Registry -> f Registry
registry_registryId = (Registry -> Text)
-> (Registry -> Text -> Registry)
-> Lens Registry Registry Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Registry' {Text
registryId :: Text
$sel:registryId:Registry' :: Registry -> Text
registryId} -> Text
registryId) (\s :: Registry
s@Registry' {} Text
a -> Registry
s {$sel:registryId:Registry' :: Text
registryId = Text
a} :: Registry)

-- | The Amazon Resource Name (ARN) of the public registry.
registry_registryArn :: Lens.Lens' Registry Prelude.Text
registry_registryArn :: (Text -> f Text) -> Registry -> f Registry
registry_registryArn = (Registry -> Text)
-> (Registry -> Text -> Registry)
-> Lens Registry Registry Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Registry' {Text
registryArn :: Text
$sel:registryArn:Registry' :: Registry -> Text
registryArn} -> Text
registryArn) (\s :: Registry
s@Registry' {} Text
a -> Registry
s {$sel:registryArn:Registry' :: Text
registryArn = Text
a} :: Registry)

-- | The URI of a public registry. The URI contains a universal prefix and
-- the registry alias.
registry_registryUri :: Lens.Lens' Registry Prelude.Text
registry_registryUri :: (Text -> f Text) -> Registry -> f Registry
registry_registryUri = (Registry -> Text)
-> (Registry -> Text -> Registry)
-> Lens Registry Registry Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Registry' {Text
registryUri :: Text
$sel:registryUri:Registry' :: Registry -> Text
registryUri} -> Text
registryUri) (\s :: Registry
s@Registry' {} Text
a -> Registry
s {$sel:registryUri:Registry' :: Text
registryUri = Text
a} :: Registry)

-- | Whether the account is verified. This indicates whether the account is
-- an AWS Marketplace vendor. If an account is verified, each public
-- repository will received a verified account badge on the Amazon ECR
-- Public Gallery.
registry_verified :: Lens.Lens' Registry Prelude.Bool
registry_verified :: (Bool -> f Bool) -> Registry -> f Registry
registry_verified = (Registry -> Bool)
-> (Registry -> Bool -> Registry)
-> Lens Registry Registry Bool Bool
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Registry' {Bool
verified :: Bool
$sel:verified:Registry' :: Registry -> Bool
verified} -> Bool
verified) (\s :: Registry
s@Registry' {} Bool
a -> Registry
s {$sel:verified:Registry' :: Bool
verified = Bool
a} :: Registry)

-- | An array of objects representing the aliases for a public registry.
registry_aliases :: Lens.Lens' Registry [RegistryAlias]
registry_aliases :: ([RegistryAlias] -> f [RegistryAlias]) -> Registry -> f Registry
registry_aliases = (Registry -> [RegistryAlias])
-> (Registry -> [RegistryAlias] -> Registry)
-> Lens Registry Registry [RegistryAlias] [RegistryAlias]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Registry' {[RegistryAlias]
aliases :: [RegistryAlias]
$sel:aliases:Registry' :: Registry -> [RegistryAlias]
aliases} -> [RegistryAlias]
aliases) (\s :: Registry
s@Registry' {} [RegistryAlias]
a -> Registry
s {$sel:aliases:Registry' :: [RegistryAlias]
aliases = [RegistryAlias]
a} :: Registry) (([RegistryAlias] -> f [RegistryAlias]) -> Registry -> f Registry)
-> (([RegistryAlias] -> f [RegistryAlias])
    -> [RegistryAlias] -> f [RegistryAlias])
-> ([RegistryAlias] -> f [RegistryAlias])
-> Registry
-> f Registry
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([RegistryAlias] -> f [RegistryAlias])
-> [RegistryAlias] -> f [RegistryAlias]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.FromJSON Registry where
  parseJSON :: Value -> Parser Registry
parseJSON =
    String -> (Object -> Parser Registry) -> Value -> Parser Registry
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"Registry"
      ( \Object
x ->
          Text -> Text -> Text -> Bool -> [RegistryAlias] -> Registry
Registry'
            (Text -> Text -> Text -> Bool -> [RegistryAlias] -> Registry)
-> Parser Text
-> Parser (Text -> Text -> Bool -> [RegistryAlias] -> Registry)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"registryId")
            Parser (Text -> Text -> Bool -> [RegistryAlias] -> Registry)
-> Parser Text
-> Parser (Text -> Bool -> [RegistryAlias] -> Registry)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"registryArn")
            Parser (Text -> Bool -> [RegistryAlias] -> Registry)
-> Parser Text -> Parser (Bool -> [RegistryAlias] -> Registry)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"registryUri")
            Parser (Bool -> [RegistryAlias] -> Registry)
-> Parser Bool -> Parser ([RegistryAlias] -> Registry)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Bool
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"verified")
            Parser ([RegistryAlias] -> Registry)
-> Parser [RegistryAlias] -> Parser Registry
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe [RegistryAlias])
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"aliases" Parser (Maybe [RegistryAlias])
-> [RegistryAlias] -> Parser [RegistryAlias]
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= [RegistryAlias]
forall a. Monoid a => a
Prelude.mempty)
      )

instance Prelude.Hashable Registry

instance Prelude.NFData Registry