{-# 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.Glue.Types.RegistryId
-- 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.Glue.Types.RegistryId where

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

-- | A wrapper structure that may contain the registry name and Amazon
-- Resource Name (ARN).
--
-- /See:/ 'newRegistryId' smart constructor.
data RegistryId = RegistryId'
  { -- | Arn of the registry to be updated. One of @RegistryArn@ or
    -- @RegistryName@ has to be provided.
    RegistryId -> Maybe Text
registryArn :: Prelude.Maybe Prelude.Text,
    -- | Name of the registry. Used only for lookup. One of @RegistryArn@ or
    -- @RegistryName@ has to be provided.
    RegistryId -> Maybe Text
registryName :: Prelude.Maybe Prelude.Text
  }
  deriving (RegistryId -> RegistryId -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RegistryId -> RegistryId -> Bool
$c/= :: RegistryId -> RegistryId -> Bool
== :: RegistryId -> RegistryId -> Bool
$c== :: RegistryId -> RegistryId -> Bool
Prelude.Eq, ReadPrec [RegistryId]
ReadPrec RegistryId
Int -> ReadS RegistryId
ReadS [RegistryId]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RegistryId]
$creadListPrec :: ReadPrec [RegistryId]
readPrec :: ReadPrec RegistryId
$creadPrec :: ReadPrec RegistryId
readList :: ReadS [RegistryId]
$creadList :: ReadS [RegistryId]
readsPrec :: Int -> ReadS RegistryId
$creadsPrec :: Int -> ReadS RegistryId
Prelude.Read, Int -> RegistryId -> ShowS
[RegistryId] -> ShowS
RegistryId -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RegistryId] -> ShowS
$cshowList :: [RegistryId] -> ShowS
show :: RegistryId -> String
$cshow :: RegistryId -> String
showsPrec :: Int -> RegistryId -> ShowS
$cshowsPrec :: Int -> RegistryId -> ShowS
Prelude.Show, forall x. Rep RegistryId x -> RegistryId
forall x. RegistryId -> Rep RegistryId x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RegistryId x -> RegistryId
$cfrom :: forall x. RegistryId -> Rep RegistryId x
Prelude.Generic)

-- |
-- Create a value of 'RegistryId' 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:
--
-- 'registryArn', 'registryId_registryArn' - Arn of the registry to be updated. One of @RegistryArn@ or
-- @RegistryName@ has to be provided.
--
-- 'registryName', 'registryId_registryName' - Name of the registry. Used only for lookup. One of @RegistryArn@ or
-- @RegistryName@ has to be provided.
newRegistryId ::
  RegistryId
newRegistryId :: RegistryId
newRegistryId =
  RegistryId'
    { $sel:registryArn:RegistryId' :: Maybe Text
registryArn = forall a. Maybe a
Prelude.Nothing,
      $sel:registryName:RegistryId' :: Maybe Text
registryName = forall a. Maybe a
Prelude.Nothing
    }

-- | Arn of the registry to be updated. One of @RegistryArn@ or
-- @RegistryName@ has to be provided.
registryId_registryArn :: Lens.Lens' RegistryId (Prelude.Maybe Prelude.Text)
registryId_registryArn :: Lens' RegistryId (Maybe Text)
registryId_registryArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RegistryId' {Maybe Text
registryArn :: Maybe Text
$sel:registryArn:RegistryId' :: RegistryId -> Maybe Text
registryArn} -> Maybe Text
registryArn) (\s :: RegistryId
s@RegistryId' {} Maybe Text
a -> RegistryId
s {$sel:registryArn:RegistryId' :: Maybe Text
registryArn = Maybe Text
a} :: RegistryId)

-- | Name of the registry. Used only for lookup. One of @RegistryArn@ or
-- @RegistryName@ has to be provided.
registryId_registryName :: Lens.Lens' RegistryId (Prelude.Maybe Prelude.Text)
registryId_registryName :: Lens' RegistryId (Maybe Text)
registryId_registryName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RegistryId' {Maybe Text
registryName :: Maybe Text
$sel:registryName:RegistryId' :: RegistryId -> Maybe Text
registryName} -> Maybe Text
registryName) (\s :: RegistryId
s@RegistryId' {} Maybe Text
a -> RegistryId
s {$sel:registryName:RegistryId' :: Maybe Text
registryName = Maybe Text
a} :: RegistryId)

instance Prelude.Hashable RegistryId where
  hashWithSalt :: Int -> RegistryId -> Int
hashWithSalt Int
_salt RegistryId' {Maybe Text
registryName :: Maybe Text
registryArn :: Maybe Text
$sel:registryName:RegistryId' :: RegistryId -> Maybe Text
$sel:registryArn:RegistryId' :: RegistryId -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
registryArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
registryName

instance Prelude.NFData RegistryId where
  rnf :: RegistryId -> ()
rnf RegistryId' {Maybe Text
registryName :: Maybe Text
registryArn :: Maybe Text
$sel:registryName:RegistryId' :: RegistryId -> Maybe Text
$sel:registryArn:RegistryId' :: RegistryId -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
registryArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
registryName

instance Data.ToJSON RegistryId where
  toJSON :: RegistryId -> Value
toJSON RegistryId' {Maybe Text
registryName :: Maybe Text
registryArn :: Maybe Text
$sel:registryName:RegistryId' :: RegistryId -> Maybe Text
$sel:registryArn:RegistryId' :: RegistryId -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"RegistryArn" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
registryArn,
            (Key
"RegistryName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
registryName
          ]
      )