{-# 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.GetSchemaByDefinition
-- 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 a schema by the @SchemaDefinition@. The schema definition is
-- sent to the Schema Registry, canonicalized, and hashed. If the hash is
-- matched within the scope of the @SchemaName@ or ARN (or the default
-- registry, if none is supplied), that schema’s metadata is returned.
-- Otherwise, a 404 or NotFound error is returned. Schema versions in
-- @Deleted@ statuses will not be included in the results.
module Amazonka.Glue.GetSchemaByDefinition
  ( -- * Creating a Request
    GetSchemaByDefinition (..),
    newGetSchemaByDefinition,

    -- * Request Lenses
    getSchemaByDefinition_schemaId,
    getSchemaByDefinition_schemaDefinition,

    -- * Destructuring the Response
    GetSchemaByDefinitionResponse (..),
    newGetSchemaByDefinitionResponse,

    -- * Response Lenses
    getSchemaByDefinitionResponse_status,
    getSchemaByDefinitionResponse_createdTime,
    getSchemaByDefinitionResponse_dataFormat,
    getSchemaByDefinitionResponse_schemaVersionId,
    getSchemaByDefinitionResponse_schemaArn,
    getSchemaByDefinitionResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import Amazonka.Glue.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:/ 'newGetSchemaByDefinition' smart constructor.
data GetSchemaByDefinition = GetSchemaByDefinition'
  { -- | This is a wrapper structure to contain schema identity fields. The
    -- structure contains:
    --
    -- -   SchemaId$SchemaArn: The Amazon Resource Name (ARN) of the schema.
    --     One of @SchemaArn@ or @SchemaName@ has to be provided.
    --
    -- -   SchemaId$SchemaName: The name of the schema. One of @SchemaArn@ or
    --     @SchemaName@ has to be provided.
    GetSchemaByDefinition -> SchemaId
schemaId :: SchemaId,
    -- | The definition of the schema for which schema details are required.
    GetSchemaByDefinition -> Text
schemaDefinition :: Prelude.Text
  }
  deriving (GetSchemaByDefinition -> GetSchemaByDefinition -> Bool
(GetSchemaByDefinition -> GetSchemaByDefinition -> Bool)
-> (GetSchemaByDefinition -> GetSchemaByDefinition -> Bool)
-> Eq GetSchemaByDefinition
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetSchemaByDefinition -> GetSchemaByDefinition -> Bool
$c/= :: GetSchemaByDefinition -> GetSchemaByDefinition -> Bool
== :: GetSchemaByDefinition -> GetSchemaByDefinition -> Bool
$c== :: GetSchemaByDefinition -> GetSchemaByDefinition -> Bool
Prelude.Eq, ReadPrec [GetSchemaByDefinition]
ReadPrec GetSchemaByDefinition
Int -> ReadS GetSchemaByDefinition
ReadS [GetSchemaByDefinition]
(Int -> ReadS GetSchemaByDefinition)
-> ReadS [GetSchemaByDefinition]
-> ReadPrec GetSchemaByDefinition
-> ReadPrec [GetSchemaByDefinition]
-> Read GetSchemaByDefinition
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetSchemaByDefinition]
$creadListPrec :: ReadPrec [GetSchemaByDefinition]
readPrec :: ReadPrec GetSchemaByDefinition
$creadPrec :: ReadPrec GetSchemaByDefinition
readList :: ReadS [GetSchemaByDefinition]
$creadList :: ReadS [GetSchemaByDefinition]
readsPrec :: Int -> ReadS GetSchemaByDefinition
$creadsPrec :: Int -> ReadS GetSchemaByDefinition
Prelude.Read, Int -> GetSchemaByDefinition -> ShowS
[GetSchemaByDefinition] -> ShowS
GetSchemaByDefinition -> String
(Int -> GetSchemaByDefinition -> ShowS)
-> (GetSchemaByDefinition -> String)
-> ([GetSchemaByDefinition] -> ShowS)
-> Show GetSchemaByDefinition
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetSchemaByDefinition] -> ShowS
$cshowList :: [GetSchemaByDefinition] -> ShowS
show :: GetSchemaByDefinition -> String
$cshow :: GetSchemaByDefinition -> String
showsPrec :: Int -> GetSchemaByDefinition -> ShowS
$cshowsPrec :: Int -> GetSchemaByDefinition -> ShowS
Prelude.Show, (forall x. GetSchemaByDefinition -> Rep GetSchemaByDefinition x)
-> (forall x. Rep GetSchemaByDefinition x -> GetSchemaByDefinition)
-> Generic GetSchemaByDefinition
forall x. Rep GetSchemaByDefinition x -> GetSchemaByDefinition
forall x. GetSchemaByDefinition -> Rep GetSchemaByDefinition x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetSchemaByDefinition x -> GetSchemaByDefinition
$cfrom :: forall x. GetSchemaByDefinition -> Rep GetSchemaByDefinition x
Prelude.Generic)

-- |
-- Create a value of 'GetSchemaByDefinition' 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:
--
-- 'schemaId', 'getSchemaByDefinition_schemaId' - This is a wrapper structure to contain schema identity fields. The
-- structure contains:
--
-- -   SchemaId$SchemaArn: The Amazon Resource Name (ARN) of the schema.
--     One of @SchemaArn@ or @SchemaName@ has to be provided.
--
-- -   SchemaId$SchemaName: The name of the schema. One of @SchemaArn@ or
--     @SchemaName@ has to be provided.
--
-- 'schemaDefinition', 'getSchemaByDefinition_schemaDefinition' - The definition of the schema for which schema details are required.
newGetSchemaByDefinition ::
  -- | 'schemaId'
  SchemaId ->
  -- | 'schemaDefinition'
  Prelude.Text ->
  GetSchemaByDefinition
newGetSchemaByDefinition :: SchemaId -> Text -> GetSchemaByDefinition
newGetSchemaByDefinition
  SchemaId
pSchemaId_
  Text
pSchemaDefinition_ =
    GetSchemaByDefinition' :: SchemaId -> Text -> GetSchemaByDefinition
GetSchemaByDefinition'
      { $sel:schemaId:GetSchemaByDefinition' :: SchemaId
schemaId = SchemaId
pSchemaId_,
        $sel:schemaDefinition:GetSchemaByDefinition' :: Text
schemaDefinition = Text
pSchemaDefinition_
      }

-- | This is a wrapper structure to contain schema identity fields. The
-- structure contains:
--
-- -   SchemaId$SchemaArn: The Amazon Resource Name (ARN) of the schema.
--     One of @SchemaArn@ or @SchemaName@ has to be provided.
--
-- -   SchemaId$SchemaName: The name of the schema. One of @SchemaArn@ or
--     @SchemaName@ has to be provided.
getSchemaByDefinition_schemaId :: Lens.Lens' GetSchemaByDefinition SchemaId
getSchemaByDefinition_schemaId :: (SchemaId -> f SchemaId)
-> GetSchemaByDefinition -> f GetSchemaByDefinition
getSchemaByDefinition_schemaId = (GetSchemaByDefinition -> SchemaId)
-> (GetSchemaByDefinition -> SchemaId -> GetSchemaByDefinition)
-> Lens
     GetSchemaByDefinition GetSchemaByDefinition SchemaId SchemaId
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetSchemaByDefinition' {SchemaId
schemaId :: SchemaId
$sel:schemaId:GetSchemaByDefinition' :: GetSchemaByDefinition -> SchemaId
schemaId} -> SchemaId
schemaId) (\s :: GetSchemaByDefinition
s@GetSchemaByDefinition' {} SchemaId
a -> GetSchemaByDefinition
s {$sel:schemaId:GetSchemaByDefinition' :: SchemaId
schemaId = SchemaId
a} :: GetSchemaByDefinition)

-- | The definition of the schema for which schema details are required.
getSchemaByDefinition_schemaDefinition :: Lens.Lens' GetSchemaByDefinition Prelude.Text
getSchemaByDefinition_schemaDefinition :: (Text -> f Text)
-> GetSchemaByDefinition -> f GetSchemaByDefinition
getSchemaByDefinition_schemaDefinition = (GetSchemaByDefinition -> Text)
-> (GetSchemaByDefinition -> Text -> GetSchemaByDefinition)
-> Lens GetSchemaByDefinition GetSchemaByDefinition Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetSchemaByDefinition' {Text
schemaDefinition :: Text
$sel:schemaDefinition:GetSchemaByDefinition' :: GetSchemaByDefinition -> Text
schemaDefinition} -> Text
schemaDefinition) (\s :: GetSchemaByDefinition
s@GetSchemaByDefinition' {} Text
a -> GetSchemaByDefinition
s {$sel:schemaDefinition:GetSchemaByDefinition' :: Text
schemaDefinition = Text
a} :: GetSchemaByDefinition)

instance Core.AWSRequest GetSchemaByDefinition where
  type
    AWSResponse GetSchemaByDefinition =
      GetSchemaByDefinitionResponse
  request :: GetSchemaByDefinition -> Request GetSchemaByDefinition
request = Service -> GetSchemaByDefinition -> Request GetSchemaByDefinition
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy GetSchemaByDefinition
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse GetSchemaByDefinition)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse GetSchemaByDefinition))
-> Logger
-> Service
-> Proxy GetSchemaByDefinition
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse GetSchemaByDefinition)))
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 ->
          Maybe SchemaVersionStatus
-> Maybe Text
-> Maybe DataFormat
-> Maybe Text
-> Maybe Text
-> Int
-> GetSchemaByDefinitionResponse
GetSchemaByDefinitionResponse'
            (Maybe SchemaVersionStatus
 -> Maybe Text
 -> Maybe DataFormat
 -> Maybe Text
 -> Maybe Text
 -> Int
 -> GetSchemaByDefinitionResponse)
-> Either String (Maybe SchemaVersionStatus)
-> Either
     String
     (Maybe Text
      -> Maybe DataFormat
      -> Maybe Text
      -> Maybe Text
      -> Int
      -> GetSchemaByDefinitionResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe SchemaVersionStatus)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Status")
            Either
  String
  (Maybe Text
   -> Maybe DataFormat
   -> Maybe Text
   -> Maybe Text
   -> Int
   -> GetSchemaByDefinitionResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe DataFormat
      -> Maybe Text
      -> Maybe Text
      -> Int
      -> GetSchemaByDefinitionResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"CreatedTime")
            Either
  String
  (Maybe DataFormat
   -> Maybe Text
   -> Maybe Text
   -> Int
   -> GetSchemaByDefinitionResponse)
-> Either String (Maybe DataFormat)
-> Either
     String
     (Maybe Text -> Maybe Text -> Int -> GetSchemaByDefinitionResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe DataFormat)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"DataFormat")
            Either
  String
  (Maybe Text -> Maybe Text -> Int -> GetSchemaByDefinitionResponse)
-> Either String (Maybe Text)
-> Either
     String (Maybe Text -> Int -> GetSchemaByDefinitionResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"SchemaVersionId")
            Either String (Maybe Text -> Int -> GetSchemaByDefinitionResponse)
-> Either String (Maybe Text)
-> Either String (Int -> GetSchemaByDefinitionResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"SchemaArn")
            Either String (Int -> GetSchemaByDefinitionResponse)
-> Either String Int -> Either String GetSchemaByDefinitionResponse
forall (f :: * -> *) a b. Applicative f => 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))
      )

instance Prelude.Hashable GetSchemaByDefinition

instance Prelude.NFData GetSchemaByDefinition

instance Core.ToHeaders GetSchemaByDefinition where
  toHeaders :: GetSchemaByDefinition -> ResponseHeaders
toHeaders =
    ResponseHeaders -> GetSchemaByDefinition -> 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
"AWSGlue.GetSchemaByDefinition" ::
                          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 GetSchemaByDefinition where
  toJSON :: GetSchemaByDefinition -> Value
toJSON GetSchemaByDefinition' {Text
SchemaId
schemaDefinition :: Text
schemaId :: SchemaId
$sel:schemaDefinition:GetSchemaByDefinition' :: GetSchemaByDefinition -> Text
$sel:schemaId:GetSchemaByDefinition' :: GetSchemaByDefinition -> SchemaId
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"SchemaId" Text -> SchemaId -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= SchemaId
schemaId),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"SchemaDefinition" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
schemaDefinition)
          ]
      )

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

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

-- | /See:/ 'newGetSchemaByDefinitionResponse' smart constructor.
data GetSchemaByDefinitionResponse = GetSchemaByDefinitionResponse'
  { -- | The status of the schema version.
    GetSchemaByDefinitionResponse -> Maybe SchemaVersionStatus
status :: Prelude.Maybe SchemaVersionStatus,
    -- | The date and time the schema was created.
    GetSchemaByDefinitionResponse -> Maybe Text
createdTime :: Prelude.Maybe Prelude.Text,
    -- | The data format of the schema definition. Currently only @AVRO@ and
    -- @JSON@ are supported.
    GetSchemaByDefinitionResponse -> Maybe DataFormat
dataFormat :: Prelude.Maybe DataFormat,
    -- | The schema ID of the schema version.
    GetSchemaByDefinitionResponse -> Maybe Text
schemaVersionId :: Prelude.Maybe Prelude.Text,
    -- | The Amazon Resource Name (ARN) of the schema.
    GetSchemaByDefinitionResponse -> Maybe Text
schemaArn :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    GetSchemaByDefinitionResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (GetSchemaByDefinitionResponse
-> GetSchemaByDefinitionResponse -> Bool
(GetSchemaByDefinitionResponse
 -> GetSchemaByDefinitionResponse -> Bool)
-> (GetSchemaByDefinitionResponse
    -> GetSchemaByDefinitionResponse -> Bool)
-> Eq GetSchemaByDefinitionResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetSchemaByDefinitionResponse
-> GetSchemaByDefinitionResponse -> Bool
$c/= :: GetSchemaByDefinitionResponse
-> GetSchemaByDefinitionResponse -> Bool
== :: GetSchemaByDefinitionResponse
-> GetSchemaByDefinitionResponse -> Bool
$c== :: GetSchemaByDefinitionResponse
-> GetSchemaByDefinitionResponse -> Bool
Prelude.Eq, ReadPrec [GetSchemaByDefinitionResponse]
ReadPrec GetSchemaByDefinitionResponse
Int -> ReadS GetSchemaByDefinitionResponse
ReadS [GetSchemaByDefinitionResponse]
(Int -> ReadS GetSchemaByDefinitionResponse)
-> ReadS [GetSchemaByDefinitionResponse]
-> ReadPrec GetSchemaByDefinitionResponse
-> ReadPrec [GetSchemaByDefinitionResponse]
-> Read GetSchemaByDefinitionResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetSchemaByDefinitionResponse]
$creadListPrec :: ReadPrec [GetSchemaByDefinitionResponse]
readPrec :: ReadPrec GetSchemaByDefinitionResponse
$creadPrec :: ReadPrec GetSchemaByDefinitionResponse
readList :: ReadS [GetSchemaByDefinitionResponse]
$creadList :: ReadS [GetSchemaByDefinitionResponse]
readsPrec :: Int -> ReadS GetSchemaByDefinitionResponse
$creadsPrec :: Int -> ReadS GetSchemaByDefinitionResponse
Prelude.Read, Int -> GetSchemaByDefinitionResponse -> ShowS
[GetSchemaByDefinitionResponse] -> ShowS
GetSchemaByDefinitionResponse -> String
(Int -> GetSchemaByDefinitionResponse -> ShowS)
-> (GetSchemaByDefinitionResponse -> String)
-> ([GetSchemaByDefinitionResponse] -> ShowS)
-> Show GetSchemaByDefinitionResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetSchemaByDefinitionResponse] -> ShowS
$cshowList :: [GetSchemaByDefinitionResponse] -> ShowS
show :: GetSchemaByDefinitionResponse -> String
$cshow :: GetSchemaByDefinitionResponse -> String
showsPrec :: Int -> GetSchemaByDefinitionResponse -> ShowS
$cshowsPrec :: Int -> GetSchemaByDefinitionResponse -> ShowS
Prelude.Show, (forall x.
 GetSchemaByDefinitionResponse
 -> Rep GetSchemaByDefinitionResponse x)
-> (forall x.
    Rep GetSchemaByDefinitionResponse x
    -> GetSchemaByDefinitionResponse)
-> Generic GetSchemaByDefinitionResponse
forall x.
Rep GetSchemaByDefinitionResponse x
-> GetSchemaByDefinitionResponse
forall x.
GetSchemaByDefinitionResponse
-> Rep GetSchemaByDefinitionResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetSchemaByDefinitionResponse x
-> GetSchemaByDefinitionResponse
$cfrom :: forall x.
GetSchemaByDefinitionResponse
-> Rep GetSchemaByDefinitionResponse x
Prelude.Generic)

-- |
-- Create a value of 'GetSchemaByDefinitionResponse' 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:
--
-- 'status', 'getSchemaByDefinitionResponse_status' - The status of the schema version.
--
-- 'createdTime', 'getSchemaByDefinitionResponse_createdTime' - The date and time the schema was created.
--
-- 'dataFormat', 'getSchemaByDefinitionResponse_dataFormat' - The data format of the schema definition. Currently only @AVRO@ and
-- @JSON@ are supported.
--
-- 'schemaVersionId', 'getSchemaByDefinitionResponse_schemaVersionId' - The schema ID of the schema version.
--
-- 'schemaArn', 'getSchemaByDefinitionResponse_schemaArn' - The Amazon Resource Name (ARN) of the schema.
--
-- 'httpStatus', 'getSchemaByDefinitionResponse_httpStatus' - The response's http status code.
newGetSchemaByDefinitionResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetSchemaByDefinitionResponse
newGetSchemaByDefinitionResponse :: Int -> GetSchemaByDefinitionResponse
newGetSchemaByDefinitionResponse Int
pHttpStatus_ =
  GetSchemaByDefinitionResponse' :: Maybe SchemaVersionStatus
-> Maybe Text
-> Maybe DataFormat
-> Maybe Text
-> Maybe Text
-> Int
-> GetSchemaByDefinitionResponse
GetSchemaByDefinitionResponse'
    { $sel:status:GetSchemaByDefinitionResponse' :: Maybe SchemaVersionStatus
status =
        Maybe SchemaVersionStatus
forall a. Maybe a
Prelude.Nothing,
      $sel:createdTime:GetSchemaByDefinitionResponse' :: Maybe Text
createdTime = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:dataFormat:GetSchemaByDefinitionResponse' :: Maybe DataFormat
dataFormat = Maybe DataFormat
forall a. Maybe a
Prelude.Nothing,
      $sel:schemaVersionId:GetSchemaByDefinitionResponse' :: Maybe Text
schemaVersionId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:schemaArn:GetSchemaByDefinitionResponse' :: Maybe Text
schemaArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:GetSchemaByDefinitionResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The status of the schema version.
getSchemaByDefinitionResponse_status :: Lens.Lens' GetSchemaByDefinitionResponse (Prelude.Maybe SchemaVersionStatus)
getSchemaByDefinitionResponse_status :: (Maybe SchemaVersionStatus -> f (Maybe SchemaVersionStatus))
-> GetSchemaByDefinitionResponse -> f GetSchemaByDefinitionResponse
getSchemaByDefinitionResponse_status = (GetSchemaByDefinitionResponse -> Maybe SchemaVersionStatus)
-> (GetSchemaByDefinitionResponse
    -> Maybe SchemaVersionStatus -> GetSchemaByDefinitionResponse)
-> Lens
     GetSchemaByDefinitionResponse
     GetSchemaByDefinitionResponse
     (Maybe SchemaVersionStatus)
     (Maybe SchemaVersionStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetSchemaByDefinitionResponse' {Maybe SchemaVersionStatus
status :: Maybe SchemaVersionStatus
$sel:status:GetSchemaByDefinitionResponse' :: GetSchemaByDefinitionResponse -> Maybe SchemaVersionStatus
status} -> Maybe SchemaVersionStatus
status) (\s :: GetSchemaByDefinitionResponse
s@GetSchemaByDefinitionResponse' {} Maybe SchemaVersionStatus
a -> GetSchemaByDefinitionResponse
s {$sel:status:GetSchemaByDefinitionResponse' :: Maybe SchemaVersionStatus
status = Maybe SchemaVersionStatus
a} :: GetSchemaByDefinitionResponse)

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

-- | The data format of the schema definition. Currently only @AVRO@ and
-- @JSON@ are supported.
getSchemaByDefinitionResponse_dataFormat :: Lens.Lens' GetSchemaByDefinitionResponse (Prelude.Maybe DataFormat)
getSchemaByDefinitionResponse_dataFormat :: (Maybe DataFormat -> f (Maybe DataFormat))
-> GetSchemaByDefinitionResponse -> f GetSchemaByDefinitionResponse
getSchemaByDefinitionResponse_dataFormat = (GetSchemaByDefinitionResponse -> Maybe DataFormat)
-> (GetSchemaByDefinitionResponse
    -> Maybe DataFormat -> GetSchemaByDefinitionResponse)
-> Lens
     GetSchemaByDefinitionResponse
     GetSchemaByDefinitionResponse
     (Maybe DataFormat)
     (Maybe DataFormat)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetSchemaByDefinitionResponse' {Maybe DataFormat
dataFormat :: Maybe DataFormat
$sel:dataFormat:GetSchemaByDefinitionResponse' :: GetSchemaByDefinitionResponse -> Maybe DataFormat
dataFormat} -> Maybe DataFormat
dataFormat) (\s :: GetSchemaByDefinitionResponse
s@GetSchemaByDefinitionResponse' {} Maybe DataFormat
a -> GetSchemaByDefinitionResponse
s {$sel:dataFormat:GetSchemaByDefinitionResponse' :: Maybe DataFormat
dataFormat = Maybe DataFormat
a} :: GetSchemaByDefinitionResponse)

-- | The schema ID of the schema version.
getSchemaByDefinitionResponse_schemaVersionId :: Lens.Lens' GetSchemaByDefinitionResponse (Prelude.Maybe Prelude.Text)
getSchemaByDefinitionResponse_schemaVersionId :: (Maybe Text -> f (Maybe Text))
-> GetSchemaByDefinitionResponse -> f GetSchemaByDefinitionResponse
getSchemaByDefinitionResponse_schemaVersionId = (GetSchemaByDefinitionResponse -> Maybe Text)
-> (GetSchemaByDefinitionResponse
    -> Maybe Text -> GetSchemaByDefinitionResponse)
-> Lens
     GetSchemaByDefinitionResponse
     GetSchemaByDefinitionResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetSchemaByDefinitionResponse' {Maybe Text
schemaVersionId :: Maybe Text
$sel:schemaVersionId:GetSchemaByDefinitionResponse' :: GetSchemaByDefinitionResponse -> Maybe Text
schemaVersionId} -> Maybe Text
schemaVersionId) (\s :: GetSchemaByDefinitionResponse
s@GetSchemaByDefinitionResponse' {} Maybe Text
a -> GetSchemaByDefinitionResponse
s {$sel:schemaVersionId:GetSchemaByDefinitionResponse' :: Maybe Text
schemaVersionId = Maybe Text
a} :: GetSchemaByDefinitionResponse)

-- | The Amazon Resource Name (ARN) of the schema.
getSchemaByDefinitionResponse_schemaArn :: Lens.Lens' GetSchemaByDefinitionResponse (Prelude.Maybe Prelude.Text)
getSchemaByDefinitionResponse_schemaArn :: (Maybe Text -> f (Maybe Text))
-> GetSchemaByDefinitionResponse -> f GetSchemaByDefinitionResponse
getSchemaByDefinitionResponse_schemaArn = (GetSchemaByDefinitionResponse -> Maybe Text)
-> (GetSchemaByDefinitionResponse
    -> Maybe Text -> GetSchemaByDefinitionResponse)
-> Lens
     GetSchemaByDefinitionResponse
     GetSchemaByDefinitionResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetSchemaByDefinitionResponse' {Maybe Text
schemaArn :: Maybe Text
$sel:schemaArn:GetSchemaByDefinitionResponse' :: GetSchemaByDefinitionResponse -> Maybe Text
schemaArn} -> Maybe Text
schemaArn) (\s :: GetSchemaByDefinitionResponse
s@GetSchemaByDefinitionResponse' {} Maybe Text
a -> GetSchemaByDefinitionResponse
s {$sel:schemaArn:GetSchemaByDefinitionResponse' :: Maybe Text
schemaArn = Maybe Text
a} :: GetSchemaByDefinitionResponse)

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

instance Prelude.NFData GetSchemaByDefinitionResponse