{-# 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.Schemas.CreateSchema
-- 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)
--
-- Creates a schema definition.
--
-- Inactive schemas will be deleted after two years.
module Amazonka.Schemas.CreateSchema
  ( -- * Creating a Request
    CreateSchema (..),
    newCreateSchema,

    -- * Request Lenses
    createSchema_description,
    createSchema_tags,
    createSchema_registryName,
    createSchema_schemaName,
    createSchema_type,
    createSchema_content,

    -- * Destructuring the Response
    CreateSchemaResponse (..),
    newCreateSchemaResponse,

    -- * Response Lenses
    createSchemaResponse_schemaVersion,
    createSchemaResponse_schemaName,
    createSchemaResponse_schemaArn,
    createSchemaResponse_type,
    createSchemaResponse_lastModified,
    createSchemaResponse_description,
    createSchemaResponse_versionCreatedDate,
    createSchemaResponse_tags,
    createSchemaResponse_httpStatus,
  )
where

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

-- | /See:/ 'newCreateSchema' smart constructor.
data CreateSchema = CreateSchema'
  { -- | A description of the schema.
    CreateSchema -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | Tags associated with the schema.
    CreateSchema -> Maybe (HashMap Text Text)
tags :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | The name of the registry.
    CreateSchema -> Text
registryName :: Prelude.Text,
    -- | The name of the schema.
    CreateSchema -> Text
schemaName :: Prelude.Text,
    -- | The type of schema.
    CreateSchema -> Type
type' :: Type,
    -- | The source of the schema definition.
    CreateSchema -> Text
content :: Prelude.Text
  }
  deriving (CreateSchema -> CreateSchema -> Bool
(CreateSchema -> CreateSchema -> Bool)
-> (CreateSchema -> CreateSchema -> Bool) -> Eq CreateSchema
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateSchema -> CreateSchema -> Bool
$c/= :: CreateSchema -> CreateSchema -> Bool
== :: CreateSchema -> CreateSchema -> Bool
$c== :: CreateSchema -> CreateSchema -> Bool
Prelude.Eq, ReadPrec [CreateSchema]
ReadPrec CreateSchema
Int -> ReadS CreateSchema
ReadS [CreateSchema]
(Int -> ReadS CreateSchema)
-> ReadS [CreateSchema]
-> ReadPrec CreateSchema
-> ReadPrec [CreateSchema]
-> Read CreateSchema
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateSchema]
$creadListPrec :: ReadPrec [CreateSchema]
readPrec :: ReadPrec CreateSchema
$creadPrec :: ReadPrec CreateSchema
readList :: ReadS [CreateSchema]
$creadList :: ReadS [CreateSchema]
readsPrec :: Int -> ReadS CreateSchema
$creadsPrec :: Int -> ReadS CreateSchema
Prelude.Read, Int -> CreateSchema -> ShowS
[CreateSchema] -> ShowS
CreateSchema -> String
(Int -> CreateSchema -> ShowS)
-> (CreateSchema -> String)
-> ([CreateSchema] -> ShowS)
-> Show CreateSchema
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateSchema] -> ShowS
$cshowList :: [CreateSchema] -> ShowS
show :: CreateSchema -> String
$cshow :: CreateSchema -> String
showsPrec :: Int -> CreateSchema -> ShowS
$cshowsPrec :: Int -> CreateSchema -> ShowS
Prelude.Show, (forall x. CreateSchema -> Rep CreateSchema x)
-> (forall x. Rep CreateSchema x -> CreateSchema)
-> Generic CreateSchema
forall x. Rep CreateSchema x -> CreateSchema
forall x. CreateSchema -> Rep CreateSchema x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateSchema x -> CreateSchema
$cfrom :: forall x. CreateSchema -> Rep CreateSchema x
Prelude.Generic)

-- |
-- Create a value of 'CreateSchema' 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:
--
-- 'description', 'createSchema_description' - A description of the schema.
--
-- 'tags', 'createSchema_tags' - Tags associated with the schema.
--
-- 'registryName', 'createSchema_registryName' - The name of the registry.
--
-- 'schemaName', 'createSchema_schemaName' - The name of the schema.
--
-- 'type'', 'createSchema_type' - The type of schema.
--
-- 'content', 'createSchema_content' - The source of the schema definition.
newCreateSchema ::
  -- | 'registryName'
  Prelude.Text ->
  -- | 'schemaName'
  Prelude.Text ->
  -- | 'type''
  Type ->
  -- | 'content'
  Prelude.Text ->
  CreateSchema
newCreateSchema :: Text -> Text -> Type -> Text -> CreateSchema
newCreateSchema
  Text
pRegistryName_
  Text
pSchemaName_
  Type
pType_
  Text
pContent_ =
    CreateSchema' :: Maybe Text
-> Maybe (HashMap Text Text)
-> Text
-> Text
-> Type
-> Text
-> CreateSchema
CreateSchema'
      { $sel:description:CreateSchema' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:tags:CreateSchema' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing,
        $sel:registryName:CreateSchema' :: Text
registryName = Text
pRegistryName_,
        $sel:schemaName:CreateSchema' :: Text
schemaName = Text
pSchemaName_,
        $sel:type':CreateSchema' :: Type
type' = Type
pType_,
        $sel:content:CreateSchema' :: Text
content = Text
pContent_
      }

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

-- | Tags associated with the schema.
createSchema_tags :: Lens.Lens' CreateSchema (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
createSchema_tags :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> CreateSchema -> f CreateSchema
createSchema_tags = (CreateSchema -> Maybe (HashMap Text Text))
-> (CreateSchema -> Maybe (HashMap Text Text) -> CreateSchema)
-> Lens
     CreateSchema
     CreateSchema
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateSchema' {Maybe (HashMap Text Text)
tags :: Maybe (HashMap Text Text)
$sel:tags:CreateSchema' :: CreateSchema -> Maybe (HashMap Text Text)
tags} -> Maybe (HashMap Text Text)
tags) (\s :: CreateSchema
s@CreateSchema' {} Maybe (HashMap Text Text)
a -> CreateSchema
s {$sel:tags:CreateSchema' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
a} :: CreateSchema) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
 -> CreateSchema -> f CreateSchema)
-> ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
    -> Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> CreateSchema
-> f CreateSchema
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
-> Iso
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

-- | The name of the schema.
createSchema_schemaName :: Lens.Lens' CreateSchema Prelude.Text
createSchema_schemaName :: (Text -> f Text) -> CreateSchema -> f CreateSchema
createSchema_schemaName = (CreateSchema -> Text)
-> (CreateSchema -> Text -> CreateSchema)
-> Lens CreateSchema CreateSchema Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateSchema' {Text
schemaName :: Text
$sel:schemaName:CreateSchema' :: CreateSchema -> Text
schemaName} -> Text
schemaName) (\s :: CreateSchema
s@CreateSchema' {} Text
a -> CreateSchema
s {$sel:schemaName:CreateSchema' :: Text
schemaName = Text
a} :: CreateSchema)

-- | The type of schema.
createSchema_type :: Lens.Lens' CreateSchema Type
createSchema_type :: (Type -> f Type) -> CreateSchema -> f CreateSchema
createSchema_type = (CreateSchema -> Type)
-> (CreateSchema -> Type -> CreateSchema)
-> Lens CreateSchema CreateSchema Type Type
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateSchema' {Type
type' :: Type
$sel:type':CreateSchema' :: CreateSchema -> Type
type'} -> Type
type') (\s :: CreateSchema
s@CreateSchema' {} Type
a -> CreateSchema
s {$sel:type':CreateSchema' :: Type
type' = Type
a} :: CreateSchema)

-- | The source of the schema definition.
createSchema_content :: Lens.Lens' CreateSchema Prelude.Text
createSchema_content :: (Text -> f Text) -> CreateSchema -> f CreateSchema
createSchema_content = (CreateSchema -> Text)
-> (CreateSchema -> Text -> CreateSchema)
-> Lens CreateSchema CreateSchema Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateSchema' {Text
content :: Text
$sel:content:CreateSchema' :: CreateSchema -> Text
content} -> Text
content) (\s :: CreateSchema
s@CreateSchema' {} Text
a -> CreateSchema
s {$sel:content:CreateSchema' :: Text
content = Text
a} :: CreateSchema)

instance Core.AWSRequest CreateSchema where
  type AWSResponse CreateSchema = CreateSchemaResponse
  request :: CreateSchema -> Request CreateSchema
request = Service -> CreateSchema -> Request CreateSchema
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy CreateSchema
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateSchema)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse CreateSchema))
-> Logger
-> Service
-> Proxy CreateSchema
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateSchema)))
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 Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe POSIX
-> Maybe Text
-> Maybe POSIX
-> Maybe (HashMap Text Text)
-> Int
-> CreateSchemaResponse
CreateSchemaResponse'
            (Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe POSIX
 -> Maybe Text
 -> Maybe POSIX
 -> Maybe (HashMap Text Text)
 -> Int
 -> CreateSchemaResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe POSIX
      -> Maybe Text
      -> Maybe POSIX
      -> Maybe (HashMap Text Text)
      -> Int
      -> CreateSchemaResponse)
forall (f :: * -> *) a b. Functor 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
"SchemaVersion")
            Either
  String
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe POSIX
   -> Maybe Text
   -> Maybe POSIX
   -> Maybe (HashMap Text Text)
   -> Int
   -> CreateSchemaResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe Text
      -> Maybe Text
      -> Maybe POSIX
      -> Maybe Text
      -> Maybe POSIX
      -> Maybe (HashMap Text Text)
      -> Int
      -> CreateSchemaResponse)
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
"SchemaName")
            Either
  String
  (Maybe Text
   -> Maybe Text
   -> Maybe POSIX
   -> Maybe Text
   -> Maybe POSIX
   -> Maybe (HashMap Text Text)
   -> Int
   -> CreateSchemaResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe Text
      -> Maybe POSIX
      -> Maybe Text
      -> Maybe POSIX
      -> Maybe (HashMap Text Text)
      -> Int
      -> CreateSchemaResponse)
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
  (Maybe Text
   -> Maybe POSIX
   -> Maybe Text
   -> Maybe POSIX
   -> Maybe (HashMap Text Text)
   -> Int
   -> CreateSchemaResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe POSIX
      -> Maybe Text
      -> Maybe POSIX
      -> Maybe (HashMap Text Text)
      -> Int
      -> CreateSchemaResponse)
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
"Type")
            Either
  String
  (Maybe POSIX
   -> Maybe Text
   -> Maybe POSIX
   -> Maybe (HashMap Text Text)
   -> Int
   -> CreateSchemaResponse)
-> Either String (Maybe POSIX)
-> Either
     String
     (Maybe Text
      -> Maybe POSIX
      -> Maybe (HashMap Text Text)
      -> Int
      -> CreateSchemaResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"LastModified")
            Either
  String
  (Maybe Text
   -> Maybe POSIX
   -> Maybe (HashMap Text Text)
   -> Int
   -> CreateSchemaResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe POSIX
      -> Maybe (HashMap Text Text) -> Int -> CreateSchemaResponse)
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
"Description")
            Either
  String
  (Maybe POSIX
   -> Maybe (HashMap Text Text) -> Int -> CreateSchemaResponse)
-> Either String (Maybe POSIX)
-> Either
     String (Maybe (HashMap Text Text) -> Int -> CreateSchemaResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"VersionCreatedDate")
            Either
  String (Maybe (HashMap Text Text) -> Int -> CreateSchemaResponse)
-> Either String (Maybe (HashMap Text Text))
-> Either String (Int -> CreateSchemaResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe (Maybe (HashMap Text Text)))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"tags" Either String (Maybe (Maybe (HashMap Text Text)))
-> Maybe (HashMap Text Text)
-> Either String (Maybe (HashMap Text Text))
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe (HashMap Text Text)
forall a. Monoid a => a
Prelude.mempty)
            Either String (Int -> CreateSchemaResponse)
-> Either String Int -> Either String CreateSchemaResponse
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 CreateSchema

instance Prelude.NFData CreateSchema

instance Core.ToHeaders CreateSchema where
  toHeaders :: CreateSchema -> ResponseHeaders
toHeaders =
    ResponseHeaders -> CreateSchema -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ 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 CreateSchema where
  toJSON :: CreateSchema -> Value
toJSON CreateSchema' {Maybe Text
Maybe (HashMap Text Text)
Text
Type
content :: Text
type' :: Type
schemaName :: Text
registryName :: Text
tags :: Maybe (HashMap Text Text)
description :: Maybe Text
$sel:content:CreateSchema' :: CreateSchema -> Text
$sel:type':CreateSchema' :: CreateSchema -> Type
$sel:schemaName:CreateSchema' :: CreateSchema -> Text
$sel:registryName:CreateSchema' :: CreateSchema -> Text
$sel:tags:CreateSchema' :: CreateSchema -> Maybe (HashMap Text Text)
$sel:description:CreateSchema' :: CreateSchema -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"Description" 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
description,
            (Text
"tags" Text -> HashMap Text Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (HashMap Text Text -> Pair)
-> Maybe (HashMap Text Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text Text)
tags,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Type" Text -> Type -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Type
type'),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Content" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
content)
          ]
      )

instance Core.ToPath CreateSchema where
  toPath :: CreateSchema -> ByteString
toPath CreateSchema' {Maybe Text
Maybe (HashMap Text Text)
Text
Type
content :: Text
type' :: Type
schemaName :: Text
registryName :: Text
tags :: Maybe (HashMap Text Text)
description :: Maybe Text
$sel:content:CreateSchema' :: CreateSchema -> Text
$sel:type':CreateSchema' :: CreateSchema -> Type
$sel:schemaName:CreateSchema' :: CreateSchema -> Text
$sel:registryName:CreateSchema' :: CreateSchema -> Text
$sel:tags:CreateSchema' :: CreateSchema -> Maybe (HashMap Text Text)
$sel:description:CreateSchema' :: CreateSchema -> Maybe Text
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/v1/registries/name/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
registryName,
        ByteString
"/schemas/name/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
schemaName
      ]

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

-- | /See:/ 'newCreateSchemaResponse' smart constructor.
data CreateSchemaResponse = CreateSchemaResponse'
  { -- | The version number of the schema
    CreateSchemaResponse -> Maybe Text
schemaVersion :: Prelude.Maybe Prelude.Text,
    -- | The name of the schema.
    CreateSchemaResponse -> Maybe Text
schemaName :: Prelude.Maybe Prelude.Text,
    -- | The ARN of the schema.
    CreateSchemaResponse -> Maybe Text
schemaArn :: Prelude.Maybe Prelude.Text,
    -- | The type of the schema.
    CreateSchemaResponse -> Maybe Text
type' :: Prelude.Maybe Prelude.Text,
    -- | The date and time that schema was modified.
    CreateSchemaResponse -> Maybe POSIX
lastModified :: Prelude.Maybe Core.POSIX,
    -- | The description of the schema.
    CreateSchemaResponse -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | The date the schema version was created.
    CreateSchemaResponse -> Maybe POSIX
versionCreatedDate :: Prelude.Maybe Core.POSIX,
    CreateSchemaResponse -> Maybe (HashMap Text Text)
tags :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | The response's http status code.
    CreateSchemaResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (CreateSchemaResponse -> CreateSchemaResponse -> Bool
(CreateSchemaResponse -> CreateSchemaResponse -> Bool)
-> (CreateSchemaResponse -> CreateSchemaResponse -> Bool)
-> Eq CreateSchemaResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateSchemaResponse -> CreateSchemaResponse -> Bool
$c/= :: CreateSchemaResponse -> CreateSchemaResponse -> Bool
== :: CreateSchemaResponse -> CreateSchemaResponse -> Bool
$c== :: CreateSchemaResponse -> CreateSchemaResponse -> Bool
Prelude.Eq, ReadPrec [CreateSchemaResponse]
ReadPrec CreateSchemaResponse
Int -> ReadS CreateSchemaResponse
ReadS [CreateSchemaResponse]
(Int -> ReadS CreateSchemaResponse)
-> ReadS [CreateSchemaResponse]
-> ReadPrec CreateSchemaResponse
-> ReadPrec [CreateSchemaResponse]
-> Read CreateSchemaResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateSchemaResponse]
$creadListPrec :: ReadPrec [CreateSchemaResponse]
readPrec :: ReadPrec CreateSchemaResponse
$creadPrec :: ReadPrec CreateSchemaResponse
readList :: ReadS [CreateSchemaResponse]
$creadList :: ReadS [CreateSchemaResponse]
readsPrec :: Int -> ReadS CreateSchemaResponse
$creadsPrec :: Int -> ReadS CreateSchemaResponse
Prelude.Read, Int -> CreateSchemaResponse -> ShowS
[CreateSchemaResponse] -> ShowS
CreateSchemaResponse -> String
(Int -> CreateSchemaResponse -> ShowS)
-> (CreateSchemaResponse -> String)
-> ([CreateSchemaResponse] -> ShowS)
-> Show CreateSchemaResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateSchemaResponse] -> ShowS
$cshowList :: [CreateSchemaResponse] -> ShowS
show :: CreateSchemaResponse -> String
$cshow :: CreateSchemaResponse -> String
showsPrec :: Int -> CreateSchemaResponse -> ShowS
$cshowsPrec :: Int -> CreateSchemaResponse -> ShowS
Prelude.Show, (forall x. CreateSchemaResponse -> Rep CreateSchemaResponse x)
-> (forall x. Rep CreateSchemaResponse x -> CreateSchemaResponse)
-> Generic CreateSchemaResponse
forall x. Rep CreateSchemaResponse x -> CreateSchemaResponse
forall x. CreateSchemaResponse -> Rep CreateSchemaResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateSchemaResponse x -> CreateSchemaResponse
$cfrom :: forall x. CreateSchemaResponse -> Rep CreateSchemaResponse x
Prelude.Generic)

-- |
-- Create a value of 'CreateSchemaResponse' 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:
--
-- 'schemaVersion', 'createSchemaResponse_schemaVersion' - The version number of the schema
--
-- 'schemaName', 'createSchemaResponse_schemaName' - The name of the schema.
--
-- 'schemaArn', 'createSchemaResponse_schemaArn' - The ARN of the schema.
--
-- 'type'', 'createSchemaResponse_type' - The type of the schema.
--
-- 'lastModified', 'createSchemaResponse_lastModified' - The date and time that schema was modified.
--
-- 'description', 'createSchemaResponse_description' - The description of the schema.
--
-- 'versionCreatedDate', 'createSchemaResponse_versionCreatedDate' - The date the schema version was created.
--
-- 'tags', 'createSchemaResponse_tags' - Undocumented member.
--
-- 'httpStatus', 'createSchemaResponse_httpStatus' - The response's http status code.
newCreateSchemaResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  CreateSchemaResponse
newCreateSchemaResponse :: Int -> CreateSchemaResponse
newCreateSchemaResponse Int
pHttpStatus_ =
  CreateSchemaResponse' :: Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe POSIX
-> Maybe Text
-> Maybe POSIX
-> Maybe (HashMap Text Text)
-> Int
-> CreateSchemaResponse
CreateSchemaResponse'
    { $sel:schemaVersion:CreateSchemaResponse' :: Maybe Text
schemaVersion =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:schemaName:CreateSchemaResponse' :: Maybe Text
schemaName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:schemaArn:CreateSchemaResponse' :: Maybe Text
schemaArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:type':CreateSchemaResponse' :: Maybe Text
type' = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:lastModified:CreateSchemaResponse' :: Maybe POSIX
lastModified = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:description:CreateSchemaResponse' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:versionCreatedDate:CreateSchemaResponse' :: Maybe POSIX
versionCreatedDate = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:tags:CreateSchemaResponse' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:CreateSchemaResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The version number of the schema
createSchemaResponse_schemaVersion :: Lens.Lens' CreateSchemaResponse (Prelude.Maybe Prelude.Text)
createSchemaResponse_schemaVersion :: (Maybe Text -> f (Maybe Text))
-> CreateSchemaResponse -> f CreateSchemaResponse
createSchemaResponse_schemaVersion = (CreateSchemaResponse -> Maybe Text)
-> (CreateSchemaResponse -> Maybe Text -> CreateSchemaResponse)
-> Lens
     CreateSchemaResponse CreateSchemaResponse (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateSchemaResponse' {Maybe Text
schemaVersion :: Maybe Text
$sel:schemaVersion:CreateSchemaResponse' :: CreateSchemaResponse -> Maybe Text
schemaVersion} -> Maybe Text
schemaVersion) (\s :: CreateSchemaResponse
s@CreateSchemaResponse' {} Maybe Text
a -> CreateSchemaResponse
s {$sel:schemaVersion:CreateSchemaResponse' :: Maybe Text
schemaVersion = Maybe Text
a} :: CreateSchemaResponse)

-- | The name of the schema.
createSchemaResponse_schemaName :: Lens.Lens' CreateSchemaResponse (Prelude.Maybe Prelude.Text)
createSchemaResponse_schemaName :: (Maybe Text -> f (Maybe Text))
-> CreateSchemaResponse -> f CreateSchemaResponse
createSchemaResponse_schemaName = (CreateSchemaResponse -> Maybe Text)
-> (CreateSchemaResponse -> Maybe Text -> CreateSchemaResponse)
-> Lens
     CreateSchemaResponse CreateSchemaResponse (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateSchemaResponse' {Maybe Text
schemaName :: Maybe Text
$sel:schemaName:CreateSchemaResponse' :: CreateSchemaResponse -> Maybe Text
schemaName} -> Maybe Text
schemaName) (\s :: CreateSchemaResponse
s@CreateSchemaResponse' {} Maybe Text
a -> CreateSchemaResponse
s {$sel:schemaName:CreateSchemaResponse' :: Maybe Text
schemaName = Maybe Text
a} :: CreateSchemaResponse)

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

-- | The type of the schema.
createSchemaResponse_type :: Lens.Lens' CreateSchemaResponse (Prelude.Maybe Prelude.Text)
createSchemaResponse_type :: (Maybe Text -> f (Maybe Text))
-> CreateSchemaResponse -> f CreateSchemaResponse
createSchemaResponse_type = (CreateSchemaResponse -> Maybe Text)
-> (CreateSchemaResponse -> Maybe Text -> CreateSchemaResponse)
-> Lens
     CreateSchemaResponse CreateSchemaResponse (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateSchemaResponse' {Maybe Text
type' :: Maybe Text
$sel:type':CreateSchemaResponse' :: CreateSchemaResponse -> Maybe Text
type'} -> Maybe Text
type') (\s :: CreateSchemaResponse
s@CreateSchemaResponse' {} Maybe Text
a -> CreateSchemaResponse
s {$sel:type':CreateSchemaResponse' :: Maybe Text
type' = Maybe Text
a} :: CreateSchemaResponse)

-- | The date and time that schema was modified.
createSchemaResponse_lastModified :: Lens.Lens' CreateSchemaResponse (Prelude.Maybe Prelude.UTCTime)
createSchemaResponse_lastModified :: (Maybe UTCTime -> f (Maybe UTCTime))
-> CreateSchemaResponse -> f CreateSchemaResponse
createSchemaResponse_lastModified = (CreateSchemaResponse -> Maybe POSIX)
-> (CreateSchemaResponse -> Maybe POSIX -> CreateSchemaResponse)
-> Lens
     CreateSchemaResponse
     CreateSchemaResponse
     (Maybe POSIX)
     (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateSchemaResponse' {Maybe POSIX
lastModified :: Maybe POSIX
$sel:lastModified:CreateSchemaResponse' :: CreateSchemaResponse -> Maybe POSIX
lastModified} -> Maybe POSIX
lastModified) (\s :: CreateSchemaResponse
s@CreateSchemaResponse' {} Maybe POSIX
a -> CreateSchemaResponse
s {$sel:lastModified:CreateSchemaResponse' :: Maybe POSIX
lastModified = Maybe POSIX
a} :: CreateSchemaResponse) ((Maybe POSIX -> f (Maybe POSIX))
 -> CreateSchemaResponse -> f CreateSchemaResponse)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> CreateSchemaResponse
-> f CreateSchemaResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The description of the schema.
createSchemaResponse_description :: Lens.Lens' CreateSchemaResponse (Prelude.Maybe Prelude.Text)
createSchemaResponse_description :: (Maybe Text -> f (Maybe Text))
-> CreateSchemaResponse -> f CreateSchemaResponse
createSchemaResponse_description = (CreateSchemaResponse -> Maybe Text)
-> (CreateSchemaResponse -> Maybe Text -> CreateSchemaResponse)
-> Lens
     CreateSchemaResponse CreateSchemaResponse (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateSchemaResponse' {Maybe Text
description :: Maybe Text
$sel:description:CreateSchemaResponse' :: CreateSchemaResponse -> Maybe Text
description} -> Maybe Text
description) (\s :: CreateSchemaResponse
s@CreateSchemaResponse' {} Maybe Text
a -> CreateSchemaResponse
s {$sel:description:CreateSchemaResponse' :: Maybe Text
description = Maybe Text
a} :: CreateSchemaResponse)

-- | The date the schema version was created.
createSchemaResponse_versionCreatedDate :: Lens.Lens' CreateSchemaResponse (Prelude.Maybe Prelude.UTCTime)
createSchemaResponse_versionCreatedDate :: (Maybe UTCTime -> f (Maybe UTCTime))
-> CreateSchemaResponse -> f CreateSchemaResponse
createSchemaResponse_versionCreatedDate = (CreateSchemaResponse -> Maybe POSIX)
-> (CreateSchemaResponse -> Maybe POSIX -> CreateSchemaResponse)
-> Lens
     CreateSchemaResponse
     CreateSchemaResponse
     (Maybe POSIX)
     (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateSchemaResponse' {Maybe POSIX
versionCreatedDate :: Maybe POSIX
$sel:versionCreatedDate:CreateSchemaResponse' :: CreateSchemaResponse -> Maybe POSIX
versionCreatedDate} -> Maybe POSIX
versionCreatedDate) (\s :: CreateSchemaResponse
s@CreateSchemaResponse' {} Maybe POSIX
a -> CreateSchemaResponse
s {$sel:versionCreatedDate:CreateSchemaResponse' :: Maybe POSIX
versionCreatedDate = Maybe POSIX
a} :: CreateSchemaResponse) ((Maybe POSIX -> f (Maybe POSIX))
 -> CreateSchemaResponse -> f CreateSchemaResponse)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> CreateSchemaResponse
-> f CreateSchemaResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | Undocumented member.
createSchemaResponse_tags :: Lens.Lens' CreateSchemaResponse (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
createSchemaResponse_tags :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> CreateSchemaResponse -> f CreateSchemaResponse
createSchemaResponse_tags = (CreateSchemaResponse -> Maybe (HashMap Text Text))
-> (CreateSchemaResponse
    -> Maybe (HashMap Text Text) -> CreateSchemaResponse)
-> Lens
     CreateSchemaResponse
     CreateSchemaResponse
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateSchemaResponse' {Maybe (HashMap Text Text)
tags :: Maybe (HashMap Text Text)
$sel:tags:CreateSchemaResponse' :: CreateSchemaResponse -> Maybe (HashMap Text Text)
tags} -> Maybe (HashMap Text Text)
tags) (\s :: CreateSchemaResponse
s@CreateSchemaResponse' {} Maybe (HashMap Text Text)
a -> CreateSchemaResponse
s {$sel:tags:CreateSchemaResponse' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
a} :: CreateSchemaResponse) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
 -> CreateSchemaResponse -> f CreateSchemaResponse)
-> ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
    -> Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> CreateSchemaResponse
-> f CreateSchemaResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
-> Iso
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance Prelude.NFData CreateSchemaResponse