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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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'
  { -- | 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,
    -- | Arn of the registry to be updated. One of @RegistryArn@ or
    -- @RegistryName@ has to be provided.
    RegistryId -> Maybe Text
registryArn :: Prelude.Maybe Prelude.Text
  }
  deriving (RegistryId -> RegistryId -> Bool
(RegistryId -> RegistryId -> Bool)
-> (RegistryId -> RegistryId -> Bool) -> Eq RegistryId
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]
(Int -> ReadS RegistryId)
-> ReadS [RegistryId]
-> ReadPrec RegistryId
-> ReadPrec [RegistryId]
-> Read 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
(Int -> RegistryId -> ShowS)
-> (RegistryId -> String)
-> ([RegistryId] -> ShowS)
-> Show RegistryId
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. RegistryId -> Rep RegistryId x)
-> (forall x. Rep RegistryId x -> RegistryId) -> Generic RegistryId
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:
--
-- 'registryName', 'registryId_registryName' - Name of the registry. Used only for lookup. One of @RegistryArn@ or
-- @RegistryName@ has to be provided.
--
-- 'registryArn', 'registryId_registryArn' - Arn of the registry to be updated. One of @RegistryArn@ or
-- @RegistryName@ has to be provided.
newRegistryId ::
  RegistryId
newRegistryId :: RegistryId
newRegistryId =
  RegistryId' :: Maybe Text -> Maybe Text -> RegistryId
RegistryId'
    { $sel:registryName:RegistryId' :: Maybe Text
registryName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:registryArn:RegistryId' :: Maybe Text
registryArn = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | 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 :: (Maybe Text -> f (Maybe Text)) -> RegistryId -> f RegistryId
registryId_registryName = (RegistryId -> Maybe Text)
-> (RegistryId -> Maybe Text -> RegistryId)
-> Lens RegistryId RegistryId (Maybe Text) (Maybe Text)
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)

-- | 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 :: (Maybe Text -> f (Maybe Text)) -> RegistryId -> f RegistryId
registryId_registryArn = (RegistryId -> Maybe Text)
-> (RegistryId -> Maybe Text -> RegistryId)
-> Lens RegistryId RegistryId (Maybe Text) (Maybe Text)
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)

instance Prelude.Hashable RegistryId

instance Prelude.NFData RegistryId

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