{-# 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.Athena.CreateDataCatalog
-- 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 (registers) a data catalog with the specified name and
-- properties. Catalogs created are visible to all users of the same Amazon
-- Web Services account.
module Amazonka.Athena.CreateDataCatalog
  ( -- * Creating a Request
    CreateDataCatalog (..),
    newCreateDataCatalog,

    -- * Request Lenses
    createDataCatalog_parameters,
    createDataCatalog_description,
    createDataCatalog_tags,
    createDataCatalog_name,
    createDataCatalog_type,

    -- * Destructuring the Response
    CreateDataCatalogResponse (..),
    newCreateDataCatalogResponse,

    -- * Response Lenses
    createDataCatalogResponse_httpStatus,
  )
where

import Amazonka.Athena.Types
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

-- | /See:/ 'newCreateDataCatalog' smart constructor.
data CreateDataCatalog = CreateDataCatalog'
  { -- | Specifies the Lambda function or functions to use for creating the data
    -- catalog. This is a mapping whose values depend on the catalog type.
    --
    -- -   For the @HIVE@ data catalog type, use the following syntax. The
    --     @metadata-function@ parameter is required. @The sdk-version@
    --     parameter is optional and defaults to the currently supported
    --     version.
    --
    --     @metadata-function=lambda_arn, sdk-version=version_number @
    --
    -- -   For the @LAMBDA@ data catalog type, use one of the following sets of
    --     required parameters, but not both.
    --
    --     -   If you have one Lambda function that processes metadata and
    --         another for reading the actual data, use the following syntax.
    --         Both parameters are required.
    --
    --         @metadata-function=lambda_arn, record-function=lambda_arn @
    --
    --     -   If you have a composite Lambda function that processes both
    --         metadata and data, use the following syntax to specify your
    --         Lambda function.
    --
    --         @function=lambda_arn @
    --
    -- -   The @GLUE@ type takes a catalog ID parameter and is required. The
    --     @ catalog_id @ is the account ID of the Amazon Web Services account
    --     to which the Glue Data Catalog belongs.
    --
    --     @catalog-id=catalog_id @
    --
    --     -   The @GLUE@ data catalog type also applies to the default
    --         @AwsDataCatalog@ that already exists in your account, of which
    --         you can have only one and cannot modify.
    --
    --     -   Queries that specify a Glue Data Catalog other than the default
    --         @AwsDataCatalog@ must be run on Athena engine version 2.
    --
    --     -   In Regions where Athena engine version 2 is not available,
    --         creating new Glue data catalogs results in an @INVALID_INPUT@
    --         error.
    CreateDataCatalog -> Maybe (HashMap Text Text)
parameters :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | A description of the data catalog to be created.
    CreateDataCatalog -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | A list of comma separated tags to add to the data catalog that is
    -- created.
    CreateDataCatalog -> Maybe [Tag]
tags :: Prelude.Maybe [Tag],
    -- | The name of the data catalog to create. The catalog name must be unique
    -- for the Amazon Web Services account and can use a maximum of 128
    -- alphanumeric, underscore, at sign, or hyphen characters.
    CreateDataCatalog -> Text
name :: Prelude.Text,
    -- | The type of data catalog to create: @LAMBDA@ for a federated catalog,
    -- @HIVE@ for an external hive metastore, or @GLUE@ for an Glue Data
    -- Catalog.
    CreateDataCatalog -> DataCatalogType
type' :: DataCatalogType
  }
  deriving (CreateDataCatalog -> CreateDataCatalog -> Bool
(CreateDataCatalog -> CreateDataCatalog -> Bool)
-> (CreateDataCatalog -> CreateDataCatalog -> Bool)
-> Eq CreateDataCatalog
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateDataCatalog -> CreateDataCatalog -> Bool
$c/= :: CreateDataCatalog -> CreateDataCatalog -> Bool
== :: CreateDataCatalog -> CreateDataCatalog -> Bool
$c== :: CreateDataCatalog -> CreateDataCatalog -> Bool
Prelude.Eq, ReadPrec [CreateDataCatalog]
ReadPrec CreateDataCatalog
Int -> ReadS CreateDataCatalog
ReadS [CreateDataCatalog]
(Int -> ReadS CreateDataCatalog)
-> ReadS [CreateDataCatalog]
-> ReadPrec CreateDataCatalog
-> ReadPrec [CreateDataCatalog]
-> Read CreateDataCatalog
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateDataCatalog]
$creadListPrec :: ReadPrec [CreateDataCatalog]
readPrec :: ReadPrec CreateDataCatalog
$creadPrec :: ReadPrec CreateDataCatalog
readList :: ReadS [CreateDataCatalog]
$creadList :: ReadS [CreateDataCatalog]
readsPrec :: Int -> ReadS CreateDataCatalog
$creadsPrec :: Int -> ReadS CreateDataCatalog
Prelude.Read, Int -> CreateDataCatalog -> ShowS
[CreateDataCatalog] -> ShowS
CreateDataCatalog -> String
(Int -> CreateDataCatalog -> ShowS)
-> (CreateDataCatalog -> String)
-> ([CreateDataCatalog] -> ShowS)
-> Show CreateDataCatalog
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateDataCatalog] -> ShowS
$cshowList :: [CreateDataCatalog] -> ShowS
show :: CreateDataCatalog -> String
$cshow :: CreateDataCatalog -> String
showsPrec :: Int -> CreateDataCatalog -> ShowS
$cshowsPrec :: Int -> CreateDataCatalog -> ShowS
Prelude.Show, (forall x. CreateDataCatalog -> Rep CreateDataCatalog x)
-> (forall x. Rep CreateDataCatalog x -> CreateDataCatalog)
-> Generic CreateDataCatalog
forall x. Rep CreateDataCatalog x -> CreateDataCatalog
forall x. CreateDataCatalog -> Rep CreateDataCatalog x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateDataCatalog x -> CreateDataCatalog
$cfrom :: forall x. CreateDataCatalog -> Rep CreateDataCatalog x
Prelude.Generic)

-- |
-- Create a value of 'CreateDataCatalog' 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:
--
-- 'parameters', 'createDataCatalog_parameters' - Specifies the Lambda function or functions to use for creating the data
-- catalog. This is a mapping whose values depend on the catalog type.
--
-- -   For the @HIVE@ data catalog type, use the following syntax. The
--     @metadata-function@ parameter is required. @The sdk-version@
--     parameter is optional and defaults to the currently supported
--     version.
--
--     @metadata-function=lambda_arn, sdk-version=version_number @
--
-- -   For the @LAMBDA@ data catalog type, use one of the following sets of
--     required parameters, but not both.
--
--     -   If you have one Lambda function that processes metadata and
--         another for reading the actual data, use the following syntax.
--         Both parameters are required.
--
--         @metadata-function=lambda_arn, record-function=lambda_arn @
--
--     -   If you have a composite Lambda function that processes both
--         metadata and data, use the following syntax to specify your
--         Lambda function.
--
--         @function=lambda_arn @
--
-- -   The @GLUE@ type takes a catalog ID parameter and is required. The
--     @ catalog_id @ is the account ID of the Amazon Web Services account
--     to which the Glue Data Catalog belongs.
--
--     @catalog-id=catalog_id @
--
--     -   The @GLUE@ data catalog type also applies to the default
--         @AwsDataCatalog@ that already exists in your account, of which
--         you can have only one and cannot modify.
--
--     -   Queries that specify a Glue Data Catalog other than the default
--         @AwsDataCatalog@ must be run on Athena engine version 2.
--
--     -   In Regions where Athena engine version 2 is not available,
--         creating new Glue data catalogs results in an @INVALID_INPUT@
--         error.
--
-- 'description', 'createDataCatalog_description' - A description of the data catalog to be created.
--
-- 'tags', 'createDataCatalog_tags' - A list of comma separated tags to add to the data catalog that is
-- created.
--
-- 'name', 'createDataCatalog_name' - The name of the data catalog to create. The catalog name must be unique
-- for the Amazon Web Services account and can use a maximum of 128
-- alphanumeric, underscore, at sign, or hyphen characters.
--
-- 'type'', 'createDataCatalog_type' - The type of data catalog to create: @LAMBDA@ for a federated catalog,
-- @HIVE@ for an external hive metastore, or @GLUE@ for an Glue Data
-- Catalog.
newCreateDataCatalog ::
  -- | 'name'
  Prelude.Text ->
  -- | 'type''
  DataCatalogType ->
  CreateDataCatalog
newCreateDataCatalog :: Text -> DataCatalogType -> CreateDataCatalog
newCreateDataCatalog Text
pName_ DataCatalogType
pType_ =
  CreateDataCatalog' :: Maybe (HashMap Text Text)
-> Maybe Text
-> Maybe [Tag]
-> Text
-> DataCatalogType
-> CreateDataCatalog
CreateDataCatalog'
    { $sel:parameters:CreateDataCatalog' :: Maybe (HashMap Text Text)
parameters = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing,
      $sel:description:CreateDataCatalog' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:tags:CreateDataCatalog' :: Maybe [Tag]
tags = Maybe [Tag]
forall a. Maybe a
Prelude.Nothing,
      $sel:name:CreateDataCatalog' :: Text
name = Text
pName_,
      $sel:type':CreateDataCatalog' :: DataCatalogType
type' = DataCatalogType
pType_
    }

-- | Specifies the Lambda function or functions to use for creating the data
-- catalog. This is a mapping whose values depend on the catalog type.
--
-- -   For the @HIVE@ data catalog type, use the following syntax. The
--     @metadata-function@ parameter is required. @The sdk-version@
--     parameter is optional and defaults to the currently supported
--     version.
--
--     @metadata-function=lambda_arn, sdk-version=version_number @
--
-- -   For the @LAMBDA@ data catalog type, use one of the following sets of
--     required parameters, but not both.
--
--     -   If you have one Lambda function that processes metadata and
--         another for reading the actual data, use the following syntax.
--         Both parameters are required.
--
--         @metadata-function=lambda_arn, record-function=lambda_arn @
--
--     -   If you have a composite Lambda function that processes both
--         metadata and data, use the following syntax to specify your
--         Lambda function.
--
--         @function=lambda_arn @
--
-- -   The @GLUE@ type takes a catalog ID parameter and is required. The
--     @ catalog_id @ is the account ID of the Amazon Web Services account
--     to which the Glue Data Catalog belongs.
--
--     @catalog-id=catalog_id @
--
--     -   The @GLUE@ data catalog type also applies to the default
--         @AwsDataCatalog@ that already exists in your account, of which
--         you can have only one and cannot modify.
--
--     -   Queries that specify a Glue Data Catalog other than the default
--         @AwsDataCatalog@ must be run on Athena engine version 2.
--
--     -   In Regions where Athena engine version 2 is not available,
--         creating new Glue data catalogs results in an @INVALID_INPUT@
--         error.
createDataCatalog_parameters :: Lens.Lens' CreateDataCatalog (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
createDataCatalog_parameters :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> CreateDataCatalog -> f CreateDataCatalog
createDataCatalog_parameters = (CreateDataCatalog -> Maybe (HashMap Text Text))
-> (CreateDataCatalog
    -> Maybe (HashMap Text Text) -> CreateDataCatalog)
-> Lens
     CreateDataCatalog
     CreateDataCatalog
     (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 (\CreateDataCatalog' {Maybe (HashMap Text Text)
parameters :: Maybe (HashMap Text Text)
$sel:parameters:CreateDataCatalog' :: CreateDataCatalog -> Maybe (HashMap Text Text)
parameters} -> Maybe (HashMap Text Text)
parameters) (\s :: CreateDataCatalog
s@CreateDataCatalog' {} Maybe (HashMap Text Text)
a -> CreateDataCatalog
s {$sel:parameters:CreateDataCatalog' :: Maybe (HashMap Text Text)
parameters = Maybe (HashMap Text Text)
a} :: CreateDataCatalog) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
 -> CreateDataCatalog -> f CreateDataCatalog)
-> ((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)))
-> CreateDataCatalog
-> f CreateDataCatalog
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

-- | A description of the data catalog to be created.
createDataCatalog_description :: Lens.Lens' CreateDataCatalog (Prelude.Maybe Prelude.Text)
createDataCatalog_description :: (Maybe Text -> f (Maybe Text))
-> CreateDataCatalog -> f CreateDataCatalog
createDataCatalog_description = (CreateDataCatalog -> Maybe Text)
-> (CreateDataCatalog -> Maybe Text -> CreateDataCatalog)
-> Lens
     CreateDataCatalog CreateDataCatalog (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDataCatalog' {Maybe Text
description :: Maybe Text
$sel:description:CreateDataCatalog' :: CreateDataCatalog -> Maybe Text
description} -> Maybe Text
description) (\s :: CreateDataCatalog
s@CreateDataCatalog' {} Maybe Text
a -> CreateDataCatalog
s {$sel:description:CreateDataCatalog' :: Maybe Text
description = Maybe Text
a} :: CreateDataCatalog)

-- | A list of comma separated tags to add to the data catalog that is
-- created.
createDataCatalog_tags :: Lens.Lens' CreateDataCatalog (Prelude.Maybe [Tag])
createDataCatalog_tags :: (Maybe [Tag] -> f (Maybe [Tag]))
-> CreateDataCatalog -> f CreateDataCatalog
createDataCatalog_tags = (CreateDataCatalog -> Maybe [Tag])
-> (CreateDataCatalog -> Maybe [Tag] -> CreateDataCatalog)
-> Lens
     CreateDataCatalog CreateDataCatalog (Maybe [Tag]) (Maybe [Tag])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDataCatalog' {Maybe [Tag]
tags :: Maybe [Tag]
$sel:tags:CreateDataCatalog' :: CreateDataCatalog -> Maybe [Tag]
tags} -> Maybe [Tag]
tags) (\s :: CreateDataCatalog
s@CreateDataCatalog' {} Maybe [Tag]
a -> CreateDataCatalog
s {$sel:tags:CreateDataCatalog' :: Maybe [Tag]
tags = Maybe [Tag]
a} :: CreateDataCatalog) ((Maybe [Tag] -> f (Maybe [Tag]))
 -> CreateDataCatalog -> f CreateDataCatalog)
-> ((Maybe [Tag] -> f (Maybe [Tag]))
    -> Maybe [Tag] -> f (Maybe [Tag]))
-> (Maybe [Tag] -> f (Maybe [Tag]))
-> CreateDataCatalog
-> f CreateDataCatalog
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Tag] [Tag] [Tag] [Tag]
-> Iso (Maybe [Tag]) (Maybe [Tag]) (Maybe [Tag]) (Maybe [Tag])
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 [Tag] [Tag] [Tag] [Tag]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The name of the data catalog to create. The catalog name must be unique
-- for the Amazon Web Services account and can use a maximum of 128
-- alphanumeric, underscore, at sign, or hyphen characters.
createDataCatalog_name :: Lens.Lens' CreateDataCatalog Prelude.Text
createDataCatalog_name :: (Text -> f Text) -> CreateDataCatalog -> f CreateDataCatalog
createDataCatalog_name = (CreateDataCatalog -> Text)
-> (CreateDataCatalog -> Text -> CreateDataCatalog)
-> Lens CreateDataCatalog CreateDataCatalog Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDataCatalog' {Text
name :: Text
$sel:name:CreateDataCatalog' :: CreateDataCatalog -> Text
name} -> Text
name) (\s :: CreateDataCatalog
s@CreateDataCatalog' {} Text
a -> CreateDataCatalog
s {$sel:name:CreateDataCatalog' :: Text
name = Text
a} :: CreateDataCatalog)

-- | The type of data catalog to create: @LAMBDA@ for a federated catalog,
-- @HIVE@ for an external hive metastore, or @GLUE@ for an Glue Data
-- Catalog.
createDataCatalog_type :: Lens.Lens' CreateDataCatalog DataCatalogType
createDataCatalog_type :: (DataCatalogType -> f DataCatalogType)
-> CreateDataCatalog -> f CreateDataCatalog
createDataCatalog_type = (CreateDataCatalog -> DataCatalogType)
-> (CreateDataCatalog -> DataCatalogType -> CreateDataCatalog)
-> Lens
     CreateDataCatalog CreateDataCatalog DataCatalogType DataCatalogType
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDataCatalog' {DataCatalogType
type' :: DataCatalogType
$sel:type':CreateDataCatalog' :: CreateDataCatalog -> DataCatalogType
type'} -> DataCatalogType
type') (\s :: CreateDataCatalog
s@CreateDataCatalog' {} DataCatalogType
a -> CreateDataCatalog
s {$sel:type':CreateDataCatalog' :: DataCatalogType
type' = DataCatalogType
a} :: CreateDataCatalog)

instance Core.AWSRequest CreateDataCatalog where
  type
    AWSResponse CreateDataCatalog =
      CreateDataCatalogResponse
  request :: CreateDataCatalog -> Request CreateDataCatalog
request = Service -> CreateDataCatalog -> Request CreateDataCatalog
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy CreateDataCatalog
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CreateDataCatalog)))
response =
    (Int
 -> ResponseHeaders
 -> ()
 -> Either String (AWSResponse CreateDataCatalog))
-> Logger
-> Service
-> Proxy CreateDataCatalog
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CreateDataCatalog)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
      ( \Int
s ResponseHeaders
h ()
x ->
          Int -> CreateDataCatalogResponse
CreateDataCatalogResponse'
            (Int -> CreateDataCatalogResponse)
-> Either String Int -> Either String CreateDataCatalogResponse
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))
      )

instance Prelude.Hashable CreateDataCatalog

instance Prelude.NFData CreateDataCatalog

instance Core.ToHeaders CreateDataCatalog where
  toHeaders :: CreateDataCatalog -> ResponseHeaders
toHeaders =
    ResponseHeaders -> CreateDataCatalog -> 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
"AmazonAthena.CreateDataCatalog" ::
                          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 CreateDataCatalog where
  toJSON :: CreateDataCatalog -> Value
toJSON CreateDataCatalog' {Maybe [Tag]
Maybe Text
Maybe (HashMap Text Text)
Text
DataCatalogType
type' :: DataCatalogType
name :: Text
tags :: Maybe [Tag]
description :: Maybe Text
parameters :: Maybe (HashMap Text Text)
$sel:type':CreateDataCatalog' :: CreateDataCatalog -> DataCatalogType
$sel:name:CreateDataCatalog' :: CreateDataCatalog -> Text
$sel:tags:CreateDataCatalog' :: CreateDataCatalog -> Maybe [Tag]
$sel:description:CreateDataCatalog' :: CreateDataCatalog -> Maybe Text
$sel:parameters:CreateDataCatalog' :: CreateDataCatalog -> Maybe (HashMap Text Text)
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"Parameters" 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)
parameters,
            (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 -> [Tag] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([Tag] -> Pair) -> Maybe [Tag] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Tag]
tags,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Name" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
name),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Type" Text -> DataCatalogType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= DataCatalogType
type')
          ]
      )

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

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

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

-- |
-- Create a value of 'CreateDataCatalogResponse' 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', 'createDataCatalogResponse_httpStatus' - The response's http status code.
newCreateDataCatalogResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  CreateDataCatalogResponse
newCreateDataCatalogResponse :: Int -> CreateDataCatalogResponse
newCreateDataCatalogResponse Int
pHttpStatus_ =
  CreateDataCatalogResponse' :: Int -> CreateDataCatalogResponse
CreateDataCatalogResponse'
    { $sel:httpStatus:CreateDataCatalogResponse' :: Int
httpStatus =
        Int
pHttpStatus_
    }

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

instance Prelude.NFData CreateDataCatalogResponse