{-# 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.FinSpaceData.CreateChangeset
-- 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 new changeset in a FinSpace dataset.
module Amazonka.FinSpaceData.CreateChangeset
  ( -- * Creating a Request
    CreateChangeset (..),
    newCreateChangeset,

    -- * Request Lenses
    createChangeset_formatParams,
    createChangeset_formatType,
    createChangeset_tags,
    createChangeset_datasetId,
    createChangeset_changeType,
    createChangeset_sourceType,
    createChangeset_sourceParams,

    -- * Destructuring the Response
    CreateChangesetResponse (..),
    newCreateChangesetResponse,

    -- * Response Lenses
    createChangesetResponse_changeset,
    createChangesetResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import Amazonka.FinSpaceData.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:/ 'newCreateChangeset' smart constructor.
data CreateChangeset = CreateChangeset'
  { -- | Options that define the structure of the source file(s).
    CreateChangeset -> Maybe (HashMap Text Text)
formatParams :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | Format type of the input files being loaded into the changeset.
    CreateChangeset -> Maybe FormatType
formatType :: Prelude.Maybe FormatType,
    -- | Metadata tags to apply to this changeset.
    CreateChangeset -> Maybe (HashMap Text Text)
tags :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | The unique identifier for the FinSpace dataset in which the changeset
    -- will be created.
    CreateChangeset -> Text
datasetId :: Prelude.Text,
    -- | Option to indicate how a changeset will be applied to a dataset.
    --
    -- -   @REPLACE@ - Changeset will be considered as a replacement to all
    --     prior loaded changesets.
    --
    -- -   @APPEND@ - Changeset will be considered as an addition to the end of
    --     all prior loaded changesets.
    CreateChangeset -> ChangeType
changeType :: ChangeType,
    -- | Type of the data source from which the files to create the changeset
    -- will be sourced.
    --
    -- -   @S3@ - Amazon S3.
    CreateChangeset -> SourceType
sourceType :: SourceType,
    -- | Source path from which the files to create the changeset will be
    -- sourced.
    CreateChangeset -> HashMap Text Text
sourceParams :: Prelude.HashMap Prelude.Text Prelude.Text
  }
  deriving (CreateChangeset -> CreateChangeset -> Bool
(CreateChangeset -> CreateChangeset -> Bool)
-> (CreateChangeset -> CreateChangeset -> Bool)
-> Eq CreateChangeset
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateChangeset -> CreateChangeset -> Bool
$c/= :: CreateChangeset -> CreateChangeset -> Bool
== :: CreateChangeset -> CreateChangeset -> Bool
$c== :: CreateChangeset -> CreateChangeset -> Bool
Prelude.Eq, ReadPrec [CreateChangeset]
ReadPrec CreateChangeset
Int -> ReadS CreateChangeset
ReadS [CreateChangeset]
(Int -> ReadS CreateChangeset)
-> ReadS [CreateChangeset]
-> ReadPrec CreateChangeset
-> ReadPrec [CreateChangeset]
-> Read CreateChangeset
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateChangeset]
$creadListPrec :: ReadPrec [CreateChangeset]
readPrec :: ReadPrec CreateChangeset
$creadPrec :: ReadPrec CreateChangeset
readList :: ReadS [CreateChangeset]
$creadList :: ReadS [CreateChangeset]
readsPrec :: Int -> ReadS CreateChangeset
$creadsPrec :: Int -> ReadS CreateChangeset
Prelude.Read, Int -> CreateChangeset -> ShowS
[CreateChangeset] -> ShowS
CreateChangeset -> String
(Int -> CreateChangeset -> ShowS)
-> (CreateChangeset -> String)
-> ([CreateChangeset] -> ShowS)
-> Show CreateChangeset
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateChangeset] -> ShowS
$cshowList :: [CreateChangeset] -> ShowS
show :: CreateChangeset -> String
$cshow :: CreateChangeset -> String
showsPrec :: Int -> CreateChangeset -> ShowS
$cshowsPrec :: Int -> CreateChangeset -> ShowS
Prelude.Show, (forall x. CreateChangeset -> Rep CreateChangeset x)
-> (forall x. Rep CreateChangeset x -> CreateChangeset)
-> Generic CreateChangeset
forall x. Rep CreateChangeset x -> CreateChangeset
forall x. CreateChangeset -> Rep CreateChangeset x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateChangeset x -> CreateChangeset
$cfrom :: forall x. CreateChangeset -> Rep CreateChangeset x
Prelude.Generic)

-- |
-- Create a value of 'CreateChangeset' 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:
--
-- 'formatParams', 'createChangeset_formatParams' - Options that define the structure of the source file(s).
--
-- 'formatType', 'createChangeset_formatType' - Format type of the input files being loaded into the changeset.
--
-- 'tags', 'createChangeset_tags' - Metadata tags to apply to this changeset.
--
-- 'datasetId', 'createChangeset_datasetId' - The unique identifier for the FinSpace dataset in which the changeset
-- will be created.
--
-- 'changeType', 'createChangeset_changeType' - Option to indicate how a changeset will be applied to a dataset.
--
-- -   @REPLACE@ - Changeset will be considered as a replacement to all
--     prior loaded changesets.
--
-- -   @APPEND@ - Changeset will be considered as an addition to the end of
--     all prior loaded changesets.
--
-- 'sourceType', 'createChangeset_sourceType' - Type of the data source from which the files to create the changeset
-- will be sourced.
--
-- -   @S3@ - Amazon S3.
--
-- 'sourceParams', 'createChangeset_sourceParams' - Source path from which the files to create the changeset will be
-- sourced.
newCreateChangeset ::
  -- | 'datasetId'
  Prelude.Text ->
  -- | 'changeType'
  ChangeType ->
  -- | 'sourceType'
  SourceType ->
  CreateChangeset
newCreateChangeset :: Text -> ChangeType -> SourceType -> CreateChangeset
newCreateChangeset
  Text
pDatasetId_
  ChangeType
pChangeType_
  SourceType
pSourceType_ =
    CreateChangeset' :: Maybe (HashMap Text Text)
-> Maybe FormatType
-> Maybe (HashMap Text Text)
-> Text
-> ChangeType
-> SourceType
-> HashMap Text Text
-> CreateChangeset
CreateChangeset'
      { $sel:formatParams:CreateChangeset' :: Maybe (HashMap Text Text)
formatParams = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing,
        $sel:formatType:CreateChangeset' :: Maybe FormatType
formatType = Maybe FormatType
forall a. Maybe a
Prelude.Nothing,
        $sel:tags:CreateChangeset' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing,
        $sel:datasetId:CreateChangeset' :: Text
datasetId = Text
pDatasetId_,
        $sel:changeType:CreateChangeset' :: ChangeType
changeType = ChangeType
pChangeType_,
        $sel:sourceType:CreateChangeset' :: SourceType
sourceType = SourceType
pSourceType_,
        $sel:sourceParams:CreateChangeset' :: HashMap Text Text
sourceParams = HashMap Text Text
forall a. Monoid a => a
Prelude.mempty
      }

-- | Options that define the structure of the source file(s).
createChangeset_formatParams :: Lens.Lens' CreateChangeset (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
createChangeset_formatParams :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> CreateChangeset -> f CreateChangeset
createChangeset_formatParams = (CreateChangeset -> Maybe (HashMap Text Text))
-> (CreateChangeset
    -> Maybe (HashMap Text Text) -> CreateChangeset)
-> Lens
     CreateChangeset
     CreateChangeset
     (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 (\CreateChangeset' {Maybe (HashMap Text Text)
formatParams :: Maybe (HashMap Text Text)
$sel:formatParams:CreateChangeset' :: CreateChangeset -> Maybe (HashMap Text Text)
formatParams} -> Maybe (HashMap Text Text)
formatParams) (\s :: CreateChangeset
s@CreateChangeset' {} Maybe (HashMap Text Text)
a -> CreateChangeset
s {$sel:formatParams:CreateChangeset' :: Maybe (HashMap Text Text)
formatParams = Maybe (HashMap Text Text)
a} :: CreateChangeset) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
 -> CreateChangeset -> f CreateChangeset)
-> ((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)))
-> CreateChangeset
-> f CreateChangeset
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

-- | Format type of the input files being loaded into the changeset.
createChangeset_formatType :: Lens.Lens' CreateChangeset (Prelude.Maybe FormatType)
createChangeset_formatType :: (Maybe FormatType -> f (Maybe FormatType))
-> CreateChangeset -> f CreateChangeset
createChangeset_formatType = (CreateChangeset -> Maybe FormatType)
-> (CreateChangeset -> Maybe FormatType -> CreateChangeset)
-> Lens
     CreateChangeset
     CreateChangeset
     (Maybe FormatType)
     (Maybe FormatType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateChangeset' {Maybe FormatType
formatType :: Maybe FormatType
$sel:formatType:CreateChangeset' :: CreateChangeset -> Maybe FormatType
formatType} -> Maybe FormatType
formatType) (\s :: CreateChangeset
s@CreateChangeset' {} Maybe FormatType
a -> CreateChangeset
s {$sel:formatType:CreateChangeset' :: Maybe FormatType
formatType = Maybe FormatType
a} :: CreateChangeset)

-- | Metadata tags to apply to this changeset.
createChangeset_tags :: Lens.Lens' CreateChangeset (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
createChangeset_tags :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> CreateChangeset -> f CreateChangeset
createChangeset_tags = (CreateChangeset -> Maybe (HashMap Text Text))
-> (CreateChangeset
    -> Maybe (HashMap Text Text) -> CreateChangeset)
-> Lens
     CreateChangeset
     CreateChangeset
     (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 (\CreateChangeset' {Maybe (HashMap Text Text)
tags :: Maybe (HashMap Text Text)
$sel:tags:CreateChangeset' :: CreateChangeset -> Maybe (HashMap Text Text)
tags} -> Maybe (HashMap Text Text)
tags) (\s :: CreateChangeset
s@CreateChangeset' {} Maybe (HashMap Text Text)
a -> CreateChangeset
s {$sel:tags:CreateChangeset' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
a} :: CreateChangeset) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
 -> CreateChangeset -> f CreateChangeset)
-> ((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)))
-> CreateChangeset
-> f CreateChangeset
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 unique identifier for the FinSpace dataset in which the changeset
-- will be created.
createChangeset_datasetId :: Lens.Lens' CreateChangeset Prelude.Text
createChangeset_datasetId :: (Text -> f Text) -> CreateChangeset -> f CreateChangeset
createChangeset_datasetId = (CreateChangeset -> Text)
-> (CreateChangeset -> Text -> CreateChangeset)
-> Lens CreateChangeset CreateChangeset Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateChangeset' {Text
datasetId :: Text
$sel:datasetId:CreateChangeset' :: CreateChangeset -> Text
datasetId} -> Text
datasetId) (\s :: CreateChangeset
s@CreateChangeset' {} Text
a -> CreateChangeset
s {$sel:datasetId:CreateChangeset' :: Text
datasetId = Text
a} :: CreateChangeset)

-- | Option to indicate how a changeset will be applied to a dataset.
--
-- -   @REPLACE@ - Changeset will be considered as a replacement to all
--     prior loaded changesets.
--
-- -   @APPEND@ - Changeset will be considered as an addition to the end of
--     all prior loaded changesets.
createChangeset_changeType :: Lens.Lens' CreateChangeset ChangeType
createChangeset_changeType :: (ChangeType -> f ChangeType)
-> CreateChangeset -> f CreateChangeset
createChangeset_changeType = (CreateChangeset -> ChangeType)
-> (CreateChangeset -> ChangeType -> CreateChangeset)
-> Lens CreateChangeset CreateChangeset ChangeType ChangeType
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateChangeset' {ChangeType
changeType :: ChangeType
$sel:changeType:CreateChangeset' :: CreateChangeset -> ChangeType
changeType} -> ChangeType
changeType) (\s :: CreateChangeset
s@CreateChangeset' {} ChangeType
a -> CreateChangeset
s {$sel:changeType:CreateChangeset' :: ChangeType
changeType = ChangeType
a} :: CreateChangeset)

-- | Type of the data source from which the files to create the changeset
-- will be sourced.
--
-- -   @S3@ - Amazon S3.
createChangeset_sourceType :: Lens.Lens' CreateChangeset SourceType
createChangeset_sourceType :: (SourceType -> f SourceType)
-> CreateChangeset -> f CreateChangeset
createChangeset_sourceType = (CreateChangeset -> SourceType)
-> (CreateChangeset -> SourceType -> CreateChangeset)
-> Lens CreateChangeset CreateChangeset SourceType SourceType
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateChangeset' {SourceType
sourceType :: SourceType
$sel:sourceType:CreateChangeset' :: CreateChangeset -> SourceType
sourceType} -> SourceType
sourceType) (\s :: CreateChangeset
s@CreateChangeset' {} SourceType
a -> CreateChangeset
s {$sel:sourceType:CreateChangeset' :: SourceType
sourceType = SourceType
a} :: CreateChangeset)

-- | Source path from which the files to create the changeset will be
-- sourced.
createChangeset_sourceParams :: Lens.Lens' CreateChangeset (Prelude.HashMap Prelude.Text Prelude.Text)
createChangeset_sourceParams :: (HashMap Text Text -> f (HashMap Text Text))
-> CreateChangeset -> f CreateChangeset
createChangeset_sourceParams = (CreateChangeset -> HashMap Text Text)
-> (CreateChangeset -> HashMap Text Text -> CreateChangeset)
-> Lens
     CreateChangeset
     CreateChangeset
     (HashMap Text Text)
     (HashMap Text Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateChangeset' {HashMap Text Text
sourceParams :: HashMap Text Text
$sel:sourceParams:CreateChangeset' :: CreateChangeset -> HashMap Text Text
sourceParams} -> HashMap Text Text
sourceParams) (\s :: CreateChangeset
s@CreateChangeset' {} HashMap Text Text
a -> CreateChangeset
s {$sel:sourceParams:CreateChangeset' :: HashMap Text Text
sourceParams = HashMap Text Text
a} :: CreateChangeset) ((HashMap Text Text -> f (HashMap Text Text))
 -> CreateChangeset -> f CreateChangeset)
-> ((HashMap Text Text -> f (HashMap Text Text))
    -> HashMap Text Text -> f (HashMap Text Text))
-> (HashMap Text Text -> f (HashMap Text Text))
-> CreateChangeset
-> f CreateChangeset
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (HashMap Text Text -> f (HashMap Text Text))
-> HashMap Text Text -> f (HashMap Text Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance Prelude.NFData CreateChangeset

instance Core.ToHeaders CreateChangeset where
  toHeaders :: CreateChangeset -> ResponseHeaders
toHeaders =
    ResponseHeaders -> CreateChangeset -> 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 CreateChangeset where
  toJSON :: CreateChangeset -> Value
toJSON CreateChangeset' {Maybe (HashMap Text Text)
Maybe FormatType
Text
HashMap Text Text
ChangeType
SourceType
sourceParams :: HashMap Text Text
sourceType :: SourceType
changeType :: ChangeType
datasetId :: Text
tags :: Maybe (HashMap Text Text)
formatType :: Maybe FormatType
formatParams :: Maybe (HashMap Text Text)
$sel:sourceParams:CreateChangeset' :: CreateChangeset -> HashMap Text Text
$sel:sourceType:CreateChangeset' :: CreateChangeset -> SourceType
$sel:changeType:CreateChangeset' :: CreateChangeset -> ChangeType
$sel:datasetId:CreateChangeset' :: CreateChangeset -> Text
$sel:tags:CreateChangeset' :: CreateChangeset -> Maybe (HashMap Text Text)
$sel:formatType:CreateChangeset' :: CreateChangeset -> Maybe FormatType
$sel:formatParams:CreateChangeset' :: CreateChangeset -> Maybe (HashMap Text Text)
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"formatParams" 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)
formatParams,
            (Text
"formatType" Text -> FormatType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (FormatType -> Pair) -> Maybe FormatType -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe FormatType
formatType,
            (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
"changeType" Text -> ChangeType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= ChangeType
changeType),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"sourceType" Text -> SourceType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= SourceType
sourceType),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"sourceParams" Text -> HashMap Text Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= HashMap Text Text
sourceParams)
          ]
      )

instance Core.ToPath CreateChangeset where
  toPath :: CreateChangeset -> ByteString
toPath CreateChangeset' {Maybe (HashMap Text Text)
Maybe FormatType
Text
HashMap Text Text
ChangeType
SourceType
sourceParams :: HashMap Text Text
sourceType :: SourceType
changeType :: ChangeType
datasetId :: Text
tags :: Maybe (HashMap Text Text)
formatType :: Maybe FormatType
formatParams :: Maybe (HashMap Text Text)
$sel:sourceParams:CreateChangeset' :: CreateChangeset -> HashMap Text Text
$sel:sourceType:CreateChangeset' :: CreateChangeset -> SourceType
$sel:changeType:CreateChangeset' :: CreateChangeset -> ChangeType
$sel:datasetId:CreateChangeset' :: CreateChangeset -> Text
$sel:tags:CreateChangeset' :: CreateChangeset -> Maybe (HashMap Text Text)
$sel:formatType:CreateChangeset' :: CreateChangeset -> Maybe FormatType
$sel:formatParams:CreateChangeset' :: CreateChangeset -> Maybe (HashMap Text Text)
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ByteString
"/datasets/", Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
datasetId, ByteString
"/changesets"]

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

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

-- |
-- Create a value of 'CreateChangesetResponse' 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:
--
-- 'changeset', 'createChangesetResponse_changeset' - Returns the changeset details.
--
-- 'httpStatus', 'createChangesetResponse_httpStatus' - The response's http status code.
newCreateChangesetResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  CreateChangesetResponse
newCreateChangesetResponse :: Int -> CreateChangesetResponse
newCreateChangesetResponse Int
pHttpStatus_ =
  CreateChangesetResponse' :: Maybe ChangesetInfo -> Int -> CreateChangesetResponse
CreateChangesetResponse'
    { $sel:changeset:CreateChangesetResponse' :: Maybe ChangesetInfo
changeset =
        Maybe ChangesetInfo
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:CreateChangesetResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | Returns the changeset details.
createChangesetResponse_changeset :: Lens.Lens' CreateChangesetResponse (Prelude.Maybe ChangesetInfo)
createChangesetResponse_changeset :: (Maybe ChangesetInfo -> f (Maybe ChangesetInfo))
-> CreateChangesetResponse -> f CreateChangesetResponse
createChangesetResponse_changeset = (CreateChangesetResponse -> Maybe ChangesetInfo)
-> (CreateChangesetResponse
    -> Maybe ChangesetInfo -> CreateChangesetResponse)
-> Lens
     CreateChangesetResponse
     CreateChangesetResponse
     (Maybe ChangesetInfo)
     (Maybe ChangesetInfo)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateChangesetResponse' {Maybe ChangesetInfo
changeset :: Maybe ChangesetInfo
$sel:changeset:CreateChangesetResponse' :: CreateChangesetResponse -> Maybe ChangesetInfo
changeset} -> Maybe ChangesetInfo
changeset) (\s :: CreateChangesetResponse
s@CreateChangesetResponse' {} Maybe ChangesetInfo
a -> CreateChangesetResponse
s {$sel:changeset:CreateChangesetResponse' :: Maybe ChangesetInfo
changeset = Maybe ChangesetInfo
a} :: CreateChangesetResponse)

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

instance Prelude.NFData CreateChangesetResponse