{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# 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.GetRegistry
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Describes the specified registry in detail.
module Amazonka.Glue.GetRegistry
  ( -- * Creating a Request
    GetRegistry (..),
    newGetRegistry,

    -- * Request Lenses
    getRegistry_registryId,

    -- * Destructuring the Response
    GetRegistryResponse (..),
    newGetRegistryResponse,

    -- * Response Lenses
    getRegistryResponse_createdTime,
    getRegistryResponse_description,
    getRegistryResponse_registryArn,
    getRegistryResponse_registryName,
    getRegistryResponse_status,
    getRegistryResponse_updatedTime,
    getRegistryResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.Glue.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newGetRegistry' smart constructor.
data GetRegistry = GetRegistry'
  { -- | This is a wrapper structure that may contain the registry name and
    -- Amazon Resource Name (ARN).
    GetRegistry -> RegistryId
registryId :: RegistryId
  }
  deriving (GetRegistry -> GetRegistry -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetRegistry -> GetRegistry -> Bool
$c/= :: GetRegistry -> GetRegistry -> Bool
== :: GetRegistry -> GetRegistry -> Bool
$c== :: GetRegistry -> GetRegistry -> Bool
Prelude.Eq, ReadPrec [GetRegistry]
ReadPrec GetRegistry
Int -> ReadS GetRegistry
ReadS [GetRegistry]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetRegistry]
$creadListPrec :: ReadPrec [GetRegistry]
readPrec :: ReadPrec GetRegistry
$creadPrec :: ReadPrec GetRegistry
readList :: ReadS [GetRegistry]
$creadList :: ReadS [GetRegistry]
readsPrec :: Int -> ReadS GetRegistry
$creadsPrec :: Int -> ReadS GetRegistry
Prelude.Read, Int -> GetRegistry -> ShowS
[GetRegistry] -> ShowS
GetRegistry -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetRegistry] -> ShowS
$cshowList :: [GetRegistry] -> ShowS
show :: GetRegistry -> String
$cshow :: GetRegistry -> String
showsPrec :: Int -> GetRegistry -> ShowS
$cshowsPrec :: Int -> GetRegistry -> ShowS
Prelude.Show, forall x. Rep GetRegistry x -> GetRegistry
forall x. GetRegistry -> Rep GetRegistry x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetRegistry x -> GetRegistry
$cfrom :: forall x. GetRegistry -> Rep GetRegistry x
Prelude.Generic)

-- |
-- Create a value of 'GetRegistry' 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', 'getRegistry_registryId' - This is a wrapper structure that may contain the registry name and
-- Amazon Resource Name (ARN).
newGetRegistry ::
  -- | 'registryId'
  RegistryId ->
  GetRegistry
newGetRegistry :: RegistryId -> GetRegistry
newGetRegistry RegistryId
pRegistryId_ =
  GetRegistry' {$sel:registryId:GetRegistry' :: RegistryId
registryId = RegistryId
pRegistryId_}

-- | This is a wrapper structure that may contain the registry name and
-- Amazon Resource Name (ARN).
getRegistry_registryId :: Lens.Lens' GetRegistry RegistryId
getRegistry_registryId :: Lens' GetRegistry RegistryId
getRegistry_registryId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetRegistry' {RegistryId
registryId :: RegistryId
$sel:registryId:GetRegistry' :: GetRegistry -> RegistryId
registryId} -> RegistryId
registryId) (\s :: GetRegistry
s@GetRegistry' {} RegistryId
a -> GetRegistry
s {$sel:registryId:GetRegistry' :: RegistryId
registryId = RegistryId
a} :: GetRegistry)

instance Core.AWSRequest GetRegistry where
  type AWSResponse GetRegistry = GetRegistryResponse
  request :: (Service -> Service) -> GetRegistry -> Request GetRegistry
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy GetRegistry
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetRegistry)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe RegistryStatus
-> Maybe Text
-> Int
-> GetRegistryResponse
GetRegistryResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"CreatedTime")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"Description")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"RegistryArn")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"RegistryName")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"Status")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"UpdatedTime")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable GetRegistry where
  hashWithSalt :: Int -> GetRegistry -> Int
hashWithSalt Int
_salt GetRegistry' {RegistryId
registryId :: RegistryId
$sel:registryId:GetRegistry' :: GetRegistry -> RegistryId
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` RegistryId
registryId

instance Prelude.NFData GetRegistry where
  rnf :: GetRegistry -> ()
rnf GetRegistry' {RegistryId
registryId :: RegistryId
$sel:registryId:GetRegistry' :: GetRegistry -> RegistryId
..} = forall a. NFData a => a -> ()
Prelude.rnf RegistryId
registryId

instance Data.ToHeaders GetRegistry where
  toHeaders :: GetRegistry -> ResponseHeaders
toHeaders =
    forall a b. a -> b -> a
Prelude.const
      ( forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# (ByteString
"AWSGlue.GetRegistry" :: Prelude.ByteString),
            HeaderName
"Content-Type"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Data.ToJSON GetRegistry where
  toJSON :: GetRegistry -> Value
toJSON GetRegistry' {RegistryId
registryId :: RegistryId
$sel:registryId:GetRegistry' :: GetRegistry -> RegistryId
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [forall a. a -> Maybe a
Prelude.Just (Key
"RegistryId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= RegistryId
registryId)]
      )

instance Data.ToPath GetRegistry where
  toPath :: GetRegistry -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"

instance Data.ToQuery GetRegistry where
  toQuery :: GetRegistry -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty

-- | /See:/ 'newGetRegistryResponse' smart constructor.
data GetRegistryResponse = GetRegistryResponse'
  { -- | The date and time the registry was created.
    GetRegistryResponse -> Maybe Text
createdTime :: Prelude.Maybe Prelude.Text,
    -- | A description of the registry.
    GetRegistryResponse -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | The Amazon Resource Name (ARN) of the registry.
    GetRegistryResponse -> Maybe Text
registryArn :: Prelude.Maybe Prelude.Text,
    -- | The name of the registry.
    GetRegistryResponse -> Maybe Text
registryName :: Prelude.Maybe Prelude.Text,
    -- | The status of the registry.
    GetRegistryResponse -> Maybe RegistryStatus
status :: Prelude.Maybe RegistryStatus,
    -- | The date and time the registry was updated.
    GetRegistryResponse -> Maybe Text
updatedTime :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    GetRegistryResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (GetRegistryResponse -> GetRegistryResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetRegistryResponse -> GetRegistryResponse -> Bool
$c/= :: GetRegistryResponse -> GetRegistryResponse -> Bool
== :: GetRegistryResponse -> GetRegistryResponse -> Bool
$c== :: GetRegistryResponse -> GetRegistryResponse -> Bool
Prelude.Eq, ReadPrec [GetRegistryResponse]
ReadPrec GetRegistryResponse
Int -> ReadS GetRegistryResponse
ReadS [GetRegistryResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetRegistryResponse]
$creadListPrec :: ReadPrec [GetRegistryResponse]
readPrec :: ReadPrec GetRegistryResponse
$creadPrec :: ReadPrec GetRegistryResponse
readList :: ReadS [GetRegistryResponse]
$creadList :: ReadS [GetRegistryResponse]
readsPrec :: Int -> ReadS GetRegistryResponse
$creadsPrec :: Int -> ReadS GetRegistryResponse
Prelude.Read, Int -> GetRegistryResponse -> ShowS
[GetRegistryResponse] -> ShowS
GetRegistryResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetRegistryResponse] -> ShowS
$cshowList :: [GetRegistryResponse] -> ShowS
show :: GetRegistryResponse -> String
$cshow :: GetRegistryResponse -> String
showsPrec :: Int -> GetRegistryResponse -> ShowS
$cshowsPrec :: Int -> GetRegistryResponse -> ShowS
Prelude.Show, forall x. Rep GetRegistryResponse x -> GetRegistryResponse
forall x. GetRegistryResponse -> Rep GetRegistryResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetRegistryResponse x -> GetRegistryResponse
$cfrom :: forall x. GetRegistryResponse -> Rep GetRegistryResponse x
Prelude.Generic)

-- |
-- Create a value of 'GetRegistryResponse' 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:
--
-- 'createdTime', 'getRegistryResponse_createdTime' - The date and time the registry was created.
--
-- 'description', 'getRegistryResponse_description' - A description of the registry.
--
-- 'registryArn', 'getRegistryResponse_registryArn' - The Amazon Resource Name (ARN) of the registry.
--
-- 'registryName', 'getRegistryResponse_registryName' - The name of the registry.
--
-- 'status', 'getRegistryResponse_status' - The status of the registry.
--
-- 'updatedTime', 'getRegistryResponse_updatedTime' - The date and time the registry was updated.
--
-- 'httpStatus', 'getRegistryResponse_httpStatus' - The response's http status code.
newGetRegistryResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetRegistryResponse
newGetRegistryResponse :: Int -> GetRegistryResponse
newGetRegistryResponse Int
pHttpStatus_ =
  GetRegistryResponse'
    { $sel:createdTime:GetRegistryResponse' :: Maybe Text
createdTime = forall a. Maybe a
Prelude.Nothing,
      $sel:description:GetRegistryResponse' :: Maybe Text
description = forall a. Maybe a
Prelude.Nothing,
      $sel:registryArn:GetRegistryResponse' :: Maybe Text
registryArn = forall a. Maybe a
Prelude.Nothing,
      $sel:registryName:GetRegistryResponse' :: Maybe Text
registryName = forall a. Maybe a
Prelude.Nothing,
      $sel:status:GetRegistryResponse' :: Maybe RegistryStatus
status = forall a. Maybe a
Prelude.Nothing,
      $sel:updatedTime:GetRegistryResponse' :: Maybe Text
updatedTime = forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:GetRegistryResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The date and time the registry was created.
getRegistryResponse_createdTime :: Lens.Lens' GetRegistryResponse (Prelude.Maybe Prelude.Text)
getRegistryResponse_createdTime :: Lens' GetRegistryResponse (Maybe Text)
getRegistryResponse_createdTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetRegistryResponse' {Maybe Text
createdTime :: Maybe Text
$sel:createdTime:GetRegistryResponse' :: GetRegistryResponse -> Maybe Text
createdTime} -> Maybe Text
createdTime) (\s :: GetRegistryResponse
s@GetRegistryResponse' {} Maybe Text
a -> GetRegistryResponse
s {$sel:createdTime:GetRegistryResponse' :: Maybe Text
createdTime = Maybe Text
a} :: GetRegistryResponse)

-- | A description of the registry.
getRegistryResponse_description :: Lens.Lens' GetRegistryResponse (Prelude.Maybe Prelude.Text)
getRegistryResponse_description :: Lens' GetRegistryResponse (Maybe Text)
getRegistryResponse_description = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetRegistryResponse' {Maybe Text
description :: Maybe Text
$sel:description:GetRegistryResponse' :: GetRegistryResponse -> Maybe Text
description} -> Maybe Text
description) (\s :: GetRegistryResponse
s@GetRegistryResponse' {} Maybe Text
a -> GetRegistryResponse
s {$sel:description:GetRegistryResponse' :: Maybe Text
description = Maybe Text
a} :: GetRegistryResponse)

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

-- | The name of the registry.
getRegistryResponse_registryName :: Lens.Lens' GetRegistryResponse (Prelude.Maybe Prelude.Text)
getRegistryResponse_registryName :: Lens' GetRegistryResponse (Maybe Text)
getRegistryResponse_registryName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetRegistryResponse' {Maybe Text
registryName :: Maybe Text
$sel:registryName:GetRegistryResponse' :: GetRegistryResponse -> Maybe Text
registryName} -> Maybe Text
registryName) (\s :: GetRegistryResponse
s@GetRegistryResponse' {} Maybe Text
a -> GetRegistryResponse
s {$sel:registryName:GetRegistryResponse' :: Maybe Text
registryName = Maybe Text
a} :: GetRegistryResponse)

-- | The status of the registry.
getRegistryResponse_status :: Lens.Lens' GetRegistryResponse (Prelude.Maybe RegistryStatus)
getRegistryResponse_status :: Lens' GetRegistryResponse (Maybe RegistryStatus)
getRegistryResponse_status = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetRegistryResponse' {Maybe RegistryStatus
status :: Maybe RegistryStatus
$sel:status:GetRegistryResponse' :: GetRegistryResponse -> Maybe RegistryStatus
status} -> Maybe RegistryStatus
status) (\s :: GetRegistryResponse
s@GetRegistryResponse' {} Maybe RegistryStatus
a -> GetRegistryResponse
s {$sel:status:GetRegistryResponse' :: Maybe RegistryStatus
status = Maybe RegistryStatus
a} :: GetRegistryResponse)

-- | The date and time the registry was updated.
getRegistryResponse_updatedTime :: Lens.Lens' GetRegistryResponse (Prelude.Maybe Prelude.Text)
getRegistryResponse_updatedTime :: Lens' GetRegistryResponse (Maybe Text)
getRegistryResponse_updatedTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetRegistryResponse' {Maybe Text
updatedTime :: Maybe Text
$sel:updatedTime:GetRegistryResponse' :: GetRegistryResponse -> Maybe Text
updatedTime} -> Maybe Text
updatedTime) (\s :: GetRegistryResponse
s@GetRegistryResponse' {} Maybe Text
a -> GetRegistryResponse
s {$sel:updatedTime:GetRegistryResponse' :: Maybe Text
updatedTime = Maybe Text
a} :: GetRegistryResponse)

-- | The response's http status code.
getRegistryResponse_httpStatus :: Lens.Lens' GetRegistryResponse Prelude.Int
getRegistryResponse_httpStatus :: Lens' GetRegistryResponse Int
getRegistryResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetRegistryResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetRegistryResponse' :: GetRegistryResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetRegistryResponse
s@GetRegistryResponse' {} Int
a -> GetRegistryResponse
s {$sel:httpStatus:GetRegistryResponse' :: Int
httpStatus = Int
a} :: GetRegistryResponse)

instance Prelude.NFData GetRegistryResponse where
  rnf :: GetRegistryResponse -> ()
rnf GetRegistryResponse' {Int
Maybe Text
Maybe RegistryStatus
httpStatus :: Int
updatedTime :: Maybe Text
status :: Maybe RegistryStatus
registryName :: Maybe Text
registryArn :: Maybe Text
description :: Maybe Text
createdTime :: Maybe Text
$sel:httpStatus:GetRegistryResponse' :: GetRegistryResponse -> Int
$sel:updatedTime:GetRegistryResponse' :: GetRegistryResponse -> Maybe Text
$sel:status:GetRegistryResponse' :: GetRegistryResponse -> Maybe RegistryStatus
$sel:registryName:GetRegistryResponse' :: GetRegistryResponse -> Maybe Text
$sel:registryArn:GetRegistryResponse' :: GetRegistryResponse -> Maybe Text
$sel:description:GetRegistryResponse' :: GetRegistryResponse -> Maybe Text
$sel:createdTime:GetRegistryResponse' :: GetRegistryResponse -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
createdTime
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
description
      seq :: forall a b. a -> b -> b
`Prelude.seq` 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
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe RegistryStatus
status
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
updatedTime
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus