{-# 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.ECRPublic.GetRegistryCatalogData
-- 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)
--
-- Retrieves catalog metadata for a public registry.
module Amazonka.ECRPublic.GetRegistryCatalogData
  ( -- * Creating a Request
    GetRegistryCatalogData (..),
    newGetRegistryCatalogData,

    -- * Destructuring the Response
    GetRegistryCatalogDataResponse (..),
    newGetRegistryCatalogDataResponse,

    -- * Response Lenses
    getRegistryCatalogDataResponse_httpStatus,
    getRegistryCatalogDataResponse_registryCatalogData,
  )
where

import qualified Amazonka.Core as Core
import Amazonka.ECRPublic.Types
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newGetRegistryCatalogData' smart constructor.
data GetRegistryCatalogData = GetRegistryCatalogData'
  {
  }
  deriving (GetRegistryCatalogData -> GetRegistryCatalogData -> Bool
(GetRegistryCatalogData -> GetRegistryCatalogData -> Bool)
-> (GetRegistryCatalogData -> GetRegistryCatalogData -> Bool)
-> Eq GetRegistryCatalogData
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetRegistryCatalogData -> GetRegistryCatalogData -> Bool
$c/= :: GetRegistryCatalogData -> GetRegistryCatalogData -> Bool
== :: GetRegistryCatalogData -> GetRegistryCatalogData -> Bool
$c== :: GetRegistryCatalogData -> GetRegistryCatalogData -> Bool
Prelude.Eq, ReadPrec [GetRegistryCatalogData]
ReadPrec GetRegistryCatalogData
Int -> ReadS GetRegistryCatalogData
ReadS [GetRegistryCatalogData]
(Int -> ReadS GetRegistryCatalogData)
-> ReadS [GetRegistryCatalogData]
-> ReadPrec GetRegistryCatalogData
-> ReadPrec [GetRegistryCatalogData]
-> Read GetRegistryCatalogData
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetRegistryCatalogData]
$creadListPrec :: ReadPrec [GetRegistryCatalogData]
readPrec :: ReadPrec GetRegistryCatalogData
$creadPrec :: ReadPrec GetRegistryCatalogData
readList :: ReadS [GetRegistryCatalogData]
$creadList :: ReadS [GetRegistryCatalogData]
readsPrec :: Int -> ReadS GetRegistryCatalogData
$creadsPrec :: Int -> ReadS GetRegistryCatalogData
Prelude.Read, Int -> GetRegistryCatalogData -> ShowS
[GetRegistryCatalogData] -> ShowS
GetRegistryCatalogData -> String
(Int -> GetRegistryCatalogData -> ShowS)
-> (GetRegistryCatalogData -> String)
-> ([GetRegistryCatalogData] -> ShowS)
-> Show GetRegistryCatalogData
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetRegistryCatalogData] -> ShowS
$cshowList :: [GetRegistryCatalogData] -> ShowS
show :: GetRegistryCatalogData -> String
$cshow :: GetRegistryCatalogData -> String
showsPrec :: Int -> GetRegistryCatalogData -> ShowS
$cshowsPrec :: Int -> GetRegistryCatalogData -> ShowS
Prelude.Show, (forall x. GetRegistryCatalogData -> Rep GetRegistryCatalogData x)
-> (forall x.
    Rep GetRegistryCatalogData x -> GetRegistryCatalogData)
-> Generic GetRegistryCatalogData
forall x. Rep GetRegistryCatalogData x -> GetRegistryCatalogData
forall x. GetRegistryCatalogData -> Rep GetRegistryCatalogData x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetRegistryCatalogData x -> GetRegistryCatalogData
$cfrom :: forall x. GetRegistryCatalogData -> Rep GetRegistryCatalogData x
Prelude.Generic)

-- |
-- Create a value of 'GetRegistryCatalogData' 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.
newGetRegistryCatalogData ::
  GetRegistryCatalogData
newGetRegistryCatalogData :: GetRegistryCatalogData
newGetRegistryCatalogData = GetRegistryCatalogData
GetRegistryCatalogData'

instance Core.AWSRequest GetRegistryCatalogData where
  type
    AWSResponse GetRegistryCatalogData =
      GetRegistryCatalogDataResponse
  request :: GetRegistryCatalogData -> Request GetRegistryCatalogData
request = Service -> GetRegistryCatalogData -> Request GetRegistryCatalogData
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy GetRegistryCatalogData
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse GetRegistryCatalogData)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse GetRegistryCatalogData))
-> Logger
-> Service
-> Proxy GetRegistryCatalogData
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse GetRegistryCatalogData)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Int -> RegistryCatalogData -> GetRegistryCatalogDataResponse
GetRegistryCatalogDataResponse'
            (Int -> RegistryCatalogData -> GetRegistryCatalogDataResponse)
-> Either String Int
-> Either
     String (RegistryCatalogData -> GetRegistryCatalogDataResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
            Either
  String (RegistryCatalogData -> GetRegistryCatalogDataResponse)
-> Either String RegistryCatalogData
-> Either String GetRegistryCatalogDataResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Key -> Either String RegistryCatalogData
forall a. FromJSON a => Object -> Key -> Either String a
Core..:> Key
"registryCatalogData")
      )

instance Prelude.Hashable GetRegistryCatalogData

instance Prelude.NFData GetRegistryCatalogData

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

instance Core.ToJSON GetRegistryCatalogData where
  toJSON :: GetRegistryCatalogData -> Value
toJSON = Value -> GetRegistryCatalogData -> Value
forall a b. a -> b -> a
Prelude.const (Object -> Value
Core.Object Object
forall a. Monoid a => a
Prelude.mempty)

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

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

-- | /See:/ 'newGetRegistryCatalogDataResponse' smart constructor.
data GetRegistryCatalogDataResponse = GetRegistryCatalogDataResponse'
  { -- | The response's http status code.
    GetRegistryCatalogDataResponse -> Int
httpStatus :: Prelude.Int,
    -- | The catalog metadata for the public registry.
    GetRegistryCatalogDataResponse -> RegistryCatalogData
registryCatalogData :: RegistryCatalogData
  }
  deriving (GetRegistryCatalogDataResponse
-> GetRegistryCatalogDataResponse -> Bool
(GetRegistryCatalogDataResponse
 -> GetRegistryCatalogDataResponse -> Bool)
-> (GetRegistryCatalogDataResponse
    -> GetRegistryCatalogDataResponse -> Bool)
-> Eq GetRegistryCatalogDataResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetRegistryCatalogDataResponse
-> GetRegistryCatalogDataResponse -> Bool
$c/= :: GetRegistryCatalogDataResponse
-> GetRegistryCatalogDataResponse -> Bool
== :: GetRegistryCatalogDataResponse
-> GetRegistryCatalogDataResponse -> Bool
$c== :: GetRegistryCatalogDataResponse
-> GetRegistryCatalogDataResponse -> Bool
Prelude.Eq, ReadPrec [GetRegistryCatalogDataResponse]
ReadPrec GetRegistryCatalogDataResponse
Int -> ReadS GetRegistryCatalogDataResponse
ReadS [GetRegistryCatalogDataResponse]
(Int -> ReadS GetRegistryCatalogDataResponse)
-> ReadS [GetRegistryCatalogDataResponse]
-> ReadPrec GetRegistryCatalogDataResponse
-> ReadPrec [GetRegistryCatalogDataResponse]
-> Read GetRegistryCatalogDataResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetRegistryCatalogDataResponse]
$creadListPrec :: ReadPrec [GetRegistryCatalogDataResponse]
readPrec :: ReadPrec GetRegistryCatalogDataResponse
$creadPrec :: ReadPrec GetRegistryCatalogDataResponse
readList :: ReadS [GetRegistryCatalogDataResponse]
$creadList :: ReadS [GetRegistryCatalogDataResponse]
readsPrec :: Int -> ReadS GetRegistryCatalogDataResponse
$creadsPrec :: Int -> ReadS GetRegistryCatalogDataResponse
Prelude.Read, Int -> GetRegistryCatalogDataResponse -> ShowS
[GetRegistryCatalogDataResponse] -> ShowS
GetRegistryCatalogDataResponse -> String
(Int -> GetRegistryCatalogDataResponse -> ShowS)
-> (GetRegistryCatalogDataResponse -> String)
-> ([GetRegistryCatalogDataResponse] -> ShowS)
-> Show GetRegistryCatalogDataResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetRegistryCatalogDataResponse] -> ShowS
$cshowList :: [GetRegistryCatalogDataResponse] -> ShowS
show :: GetRegistryCatalogDataResponse -> String
$cshow :: GetRegistryCatalogDataResponse -> String
showsPrec :: Int -> GetRegistryCatalogDataResponse -> ShowS
$cshowsPrec :: Int -> GetRegistryCatalogDataResponse -> ShowS
Prelude.Show, (forall x.
 GetRegistryCatalogDataResponse
 -> Rep GetRegistryCatalogDataResponse x)
-> (forall x.
    Rep GetRegistryCatalogDataResponse x
    -> GetRegistryCatalogDataResponse)
-> Generic GetRegistryCatalogDataResponse
forall x.
Rep GetRegistryCatalogDataResponse x
-> GetRegistryCatalogDataResponse
forall x.
GetRegistryCatalogDataResponse
-> Rep GetRegistryCatalogDataResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetRegistryCatalogDataResponse x
-> GetRegistryCatalogDataResponse
$cfrom :: forall x.
GetRegistryCatalogDataResponse
-> Rep GetRegistryCatalogDataResponse x
Prelude.Generic)

-- |
-- Create a value of 'GetRegistryCatalogDataResponse' 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:
--
-- 'httpStatus', 'getRegistryCatalogDataResponse_httpStatus' - The response's http status code.
--
-- 'registryCatalogData', 'getRegistryCatalogDataResponse_registryCatalogData' - The catalog metadata for the public registry.
newGetRegistryCatalogDataResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  -- | 'registryCatalogData'
  RegistryCatalogData ->
  GetRegistryCatalogDataResponse
newGetRegistryCatalogDataResponse :: Int -> RegistryCatalogData -> GetRegistryCatalogDataResponse
newGetRegistryCatalogDataResponse
  Int
pHttpStatus_
  RegistryCatalogData
pRegistryCatalogData_ =
    GetRegistryCatalogDataResponse' :: Int -> RegistryCatalogData -> GetRegistryCatalogDataResponse
GetRegistryCatalogDataResponse'
      { $sel:httpStatus:GetRegistryCatalogDataResponse' :: Int
httpStatus =
          Int
pHttpStatus_,
        $sel:registryCatalogData:GetRegistryCatalogDataResponse' :: RegistryCatalogData
registryCatalogData = RegistryCatalogData
pRegistryCatalogData_
      }

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

-- | The catalog metadata for the public registry.
getRegistryCatalogDataResponse_registryCatalogData :: Lens.Lens' GetRegistryCatalogDataResponse RegistryCatalogData
getRegistryCatalogDataResponse_registryCatalogData :: (RegistryCatalogData -> f RegistryCatalogData)
-> GetRegistryCatalogDataResponse
-> f GetRegistryCatalogDataResponse
getRegistryCatalogDataResponse_registryCatalogData = (GetRegistryCatalogDataResponse -> RegistryCatalogData)
-> (GetRegistryCatalogDataResponse
    -> RegistryCatalogData -> GetRegistryCatalogDataResponse)
-> Lens
     GetRegistryCatalogDataResponse
     GetRegistryCatalogDataResponse
     RegistryCatalogData
     RegistryCatalogData
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetRegistryCatalogDataResponse' {RegistryCatalogData
registryCatalogData :: RegistryCatalogData
$sel:registryCatalogData:GetRegistryCatalogDataResponse' :: GetRegistryCatalogDataResponse -> RegistryCatalogData
registryCatalogData} -> RegistryCatalogData
registryCatalogData) (\s :: GetRegistryCatalogDataResponse
s@GetRegistryCatalogDataResponse' {} RegistryCatalogData
a -> GetRegistryCatalogDataResponse
s {$sel:registryCatalogData:GetRegistryCatalogDataResponse' :: RegistryCatalogData
registryCatalogData = RegistryCatalogData
a} :: GetRegistryCatalogDataResponse)

instance
  Prelude.NFData
    GetRegistryCatalogDataResponse