{-# 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.IoTAnalytics.CreateDatastore
-- 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 data store, which is a repository for messages.
module Amazonka.IoTAnalytics.CreateDatastore
  ( -- * Creating a Request
    CreateDatastore (..),
    newCreateDatastore,

    -- * Request Lenses
    createDatastore_fileFormatConfiguration,
    createDatastore_datastorePartitions,
    createDatastore_retentionPeriod,
    createDatastore_datastoreStorage,
    createDatastore_tags,
    createDatastore_datastoreName,

    -- * Destructuring the Response
    CreateDatastoreResponse (..),
    newCreateDatastoreResponse,

    -- * Response Lenses
    createDatastoreResponse_datastoreArn,
    createDatastoreResponse_datastoreName,
    createDatastoreResponse_retentionPeriod,
    createDatastoreResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import Amazonka.IoTAnalytics.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:/ 'newCreateDatastore' smart constructor.
data CreateDatastore = CreateDatastore'
  { -- | Contains the configuration information of file formats. IoT Analytics
    -- data stores support JSON and <https://parquet.apache.org/ Parquet>.
    --
    -- The default file format is JSON. You can specify only one format.
    --
    -- You can\'t change the file format after you create the data store.
    CreateDatastore -> Maybe FileFormatConfiguration
fileFormatConfiguration :: Prelude.Maybe FileFormatConfiguration,
    -- | Contains information about the partition dimensions in a data store.
    CreateDatastore -> Maybe DatastorePartitions
datastorePartitions :: Prelude.Maybe DatastorePartitions,
    -- | How long, in days, message data is kept for the data store. When
    -- @customerManagedS3@ storage is selected, this parameter is ignored.
    CreateDatastore -> Maybe RetentionPeriod
retentionPeriod :: Prelude.Maybe RetentionPeriod,
    -- | Where data in a data store is stored.. You can choose @serviceManagedS3@
    -- storage, @customerManagedS3@ storage, or @iotSiteWiseMultiLayerStorage@
    -- storage. The default is @serviceManagedS3@. You can\'t change the choice
    -- of Amazon S3 storage after your data store is created.
    CreateDatastore -> Maybe DatastoreStorage
datastoreStorage :: Prelude.Maybe DatastoreStorage,
    -- | Metadata which can be used to manage the data store.
    CreateDatastore -> Maybe (NonEmpty Tag)
tags :: Prelude.Maybe (Prelude.NonEmpty Tag),
    -- | The name of the data store.
    CreateDatastore -> Text
datastoreName :: Prelude.Text
  }
  deriving (CreateDatastore -> CreateDatastore -> Bool
(CreateDatastore -> CreateDatastore -> Bool)
-> (CreateDatastore -> CreateDatastore -> Bool)
-> Eq CreateDatastore
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateDatastore -> CreateDatastore -> Bool
$c/= :: CreateDatastore -> CreateDatastore -> Bool
== :: CreateDatastore -> CreateDatastore -> Bool
$c== :: CreateDatastore -> CreateDatastore -> Bool
Prelude.Eq, ReadPrec [CreateDatastore]
ReadPrec CreateDatastore
Int -> ReadS CreateDatastore
ReadS [CreateDatastore]
(Int -> ReadS CreateDatastore)
-> ReadS [CreateDatastore]
-> ReadPrec CreateDatastore
-> ReadPrec [CreateDatastore]
-> Read CreateDatastore
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateDatastore]
$creadListPrec :: ReadPrec [CreateDatastore]
readPrec :: ReadPrec CreateDatastore
$creadPrec :: ReadPrec CreateDatastore
readList :: ReadS [CreateDatastore]
$creadList :: ReadS [CreateDatastore]
readsPrec :: Int -> ReadS CreateDatastore
$creadsPrec :: Int -> ReadS CreateDatastore
Prelude.Read, Int -> CreateDatastore -> ShowS
[CreateDatastore] -> ShowS
CreateDatastore -> String
(Int -> CreateDatastore -> ShowS)
-> (CreateDatastore -> String)
-> ([CreateDatastore] -> ShowS)
-> Show CreateDatastore
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateDatastore] -> ShowS
$cshowList :: [CreateDatastore] -> ShowS
show :: CreateDatastore -> String
$cshow :: CreateDatastore -> String
showsPrec :: Int -> CreateDatastore -> ShowS
$cshowsPrec :: Int -> CreateDatastore -> ShowS
Prelude.Show, (forall x. CreateDatastore -> Rep CreateDatastore x)
-> (forall x. Rep CreateDatastore x -> CreateDatastore)
-> Generic CreateDatastore
forall x. Rep CreateDatastore x -> CreateDatastore
forall x. CreateDatastore -> Rep CreateDatastore x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateDatastore x -> CreateDatastore
$cfrom :: forall x. CreateDatastore -> Rep CreateDatastore x
Prelude.Generic)

-- |
-- Create a value of 'CreateDatastore' 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:
--
-- 'fileFormatConfiguration', 'createDatastore_fileFormatConfiguration' - Contains the configuration information of file formats. IoT Analytics
-- data stores support JSON and <https://parquet.apache.org/ Parquet>.
--
-- The default file format is JSON. You can specify only one format.
--
-- You can\'t change the file format after you create the data store.
--
-- 'datastorePartitions', 'createDatastore_datastorePartitions' - Contains information about the partition dimensions in a data store.
--
-- 'retentionPeriod', 'createDatastore_retentionPeriod' - How long, in days, message data is kept for the data store. When
-- @customerManagedS3@ storage is selected, this parameter is ignored.
--
-- 'datastoreStorage', 'createDatastore_datastoreStorage' - Where data in a data store is stored.. You can choose @serviceManagedS3@
-- storage, @customerManagedS3@ storage, or @iotSiteWiseMultiLayerStorage@
-- storage. The default is @serviceManagedS3@. You can\'t change the choice
-- of Amazon S3 storage after your data store is created.
--
-- 'tags', 'createDatastore_tags' - Metadata which can be used to manage the data store.
--
-- 'datastoreName', 'createDatastore_datastoreName' - The name of the data store.
newCreateDatastore ::
  -- | 'datastoreName'
  Prelude.Text ->
  CreateDatastore
newCreateDatastore :: Text -> CreateDatastore
newCreateDatastore Text
pDatastoreName_ =
  CreateDatastore' :: Maybe FileFormatConfiguration
-> Maybe DatastorePartitions
-> Maybe RetentionPeriod
-> Maybe DatastoreStorage
-> Maybe (NonEmpty Tag)
-> Text
-> CreateDatastore
CreateDatastore'
    { $sel:fileFormatConfiguration:CreateDatastore' :: Maybe FileFormatConfiguration
fileFormatConfiguration =
        Maybe FileFormatConfiguration
forall a. Maybe a
Prelude.Nothing,
      $sel:datastorePartitions:CreateDatastore' :: Maybe DatastorePartitions
datastorePartitions = Maybe DatastorePartitions
forall a. Maybe a
Prelude.Nothing,
      $sel:retentionPeriod:CreateDatastore' :: Maybe RetentionPeriod
retentionPeriod = Maybe RetentionPeriod
forall a. Maybe a
Prelude.Nothing,
      $sel:datastoreStorage:CreateDatastore' :: Maybe DatastoreStorage
datastoreStorage = Maybe DatastoreStorage
forall a. Maybe a
Prelude.Nothing,
      $sel:tags:CreateDatastore' :: Maybe (NonEmpty Tag)
tags = Maybe (NonEmpty Tag)
forall a. Maybe a
Prelude.Nothing,
      $sel:datastoreName:CreateDatastore' :: Text
datastoreName = Text
pDatastoreName_
    }

-- | Contains the configuration information of file formats. IoT Analytics
-- data stores support JSON and <https://parquet.apache.org/ Parquet>.
--
-- The default file format is JSON. You can specify only one format.
--
-- You can\'t change the file format after you create the data store.
createDatastore_fileFormatConfiguration :: Lens.Lens' CreateDatastore (Prelude.Maybe FileFormatConfiguration)
createDatastore_fileFormatConfiguration :: (Maybe FileFormatConfiguration
 -> f (Maybe FileFormatConfiguration))
-> CreateDatastore -> f CreateDatastore
createDatastore_fileFormatConfiguration = (CreateDatastore -> Maybe FileFormatConfiguration)
-> (CreateDatastore
    -> Maybe FileFormatConfiguration -> CreateDatastore)
-> Lens
     CreateDatastore
     CreateDatastore
     (Maybe FileFormatConfiguration)
     (Maybe FileFormatConfiguration)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDatastore' {Maybe FileFormatConfiguration
fileFormatConfiguration :: Maybe FileFormatConfiguration
$sel:fileFormatConfiguration:CreateDatastore' :: CreateDatastore -> Maybe FileFormatConfiguration
fileFormatConfiguration} -> Maybe FileFormatConfiguration
fileFormatConfiguration) (\s :: CreateDatastore
s@CreateDatastore' {} Maybe FileFormatConfiguration
a -> CreateDatastore
s {$sel:fileFormatConfiguration:CreateDatastore' :: Maybe FileFormatConfiguration
fileFormatConfiguration = Maybe FileFormatConfiguration
a} :: CreateDatastore)

-- | Contains information about the partition dimensions in a data store.
createDatastore_datastorePartitions :: Lens.Lens' CreateDatastore (Prelude.Maybe DatastorePartitions)
createDatastore_datastorePartitions :: (Maybe DatastorePartitions -> f (Maybe DatastorePartitions))
-> CreateDatastore -> f CreateDatastore
createDatastore_datastorePartitions = (CreateDatastore -> Maybe DatastorePartitions)
-> (CreateDatastore
    -> Maybe DatastorePartitions -> CreateDatastore)
-> Lens
     CreateDatastore
     CreateDatastore
     (Maybe DatastorePartitions)
     (Maybe DatastorePartitions)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDatastore' {Maybe DatastorePartitions
datastorePartitions :: Maybe DatastorePartitions
$sel:datastorePartitions:CreateDatastore' :: CreateDatastore -> Maybe DatastorePartitions
datastorePartitions} -> Maybe DatastorePartitions
datastorePartitions) (\s :: CreateDatastore
s@CreateDatastore' {} Maybe DatastorePartitions
a -> CreateDatastore
s {$sel:datastorePartitions:CreateDatastore' :: Maybe DatastorePartitions
datastorePartitions = Maybe DatastorePartitions
a} :: CreateDatastore)

-- | How long, in days, message data is kept for the data store. When
-- @customerManagedS3@ storage is selected, this parameter is ignored.
createDatastore_retentionPeriod :: Lens.Lens' CreateDatastore (Prelude.Maybe RetentionPeriod)
createDatastore_retentionPeriod :: (Maybe RetentionPeriod -> f (Maybe RetentionPeriod))
-> CreateDatastore -> f CreateDatastore
createDatastore_retentionPeriod = (CreateDatastore -> Maybe RetentionPeriod)
-> (CreateDatastore -> Maybe RetentionPeriod -> CreateDatastore)
-> Lens
     CreateDatastore
     CreateDatastore
     (Maybe RetentionPeriod)
     (Maybe RetentionPeriod)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDatastore' {Maybe RetentionPeriod
retentionPeriod :: Maybe RetentionPeriod
$sel:retentionPeriod:CreateDatastore' :: CreateDatastore -> Maybe RetentionPeriod
retentionPeriod} -> Maybe RetentionPeriod
retentionPeriod) (\s :: CreateDatastore
s@CreateDatastore' {} Maybe RetentionPeriod
a -> CreateDatastore
s {$sel:retentionPeriod:CreateDatastore' :: Maybe RetentionPeriod
retentionPeriod = Maybe RetentionPeriod
a} :: CreateDatastore)

-- | Where data in a data store is stored.. You can choose @serviceManagedS3@
-- storage, @customerManagedS3@ storage, or @iotSiteWiseMultiLayerStorage@
-- storage. The default is @serviceManagedS3@. You can\'t change the choice
-- of Amazon S3 storage after your data store is created.
createDatastore_datastoreStorage :: Lens.Lens' CreateDatastore (Prelude.Maybe DatastoreStorage)
createDatastore_datastoreStorage :: (Maybe DatastoreStorage -> f (Maybe DatastoreStorage))
-> CreateDatastore -> f CreateDatastore
createDatastore_datastoreStorage = (CreateDatastore -> Maybe DatastoreStorage)
-> (CreateDatastore -> Maybe DatastoreStorage -> CreateDatastore)
-> Lens
     CreateDatastore
     CreateDatastore
     (Maybe DatastoreStorage)
     (Maybe DatastoreStorage)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDatastore' {Maybe DatastoreStorage
datastoreStorage :: Maybe DatastoreStorage
$sel:datastoreStorage:CreateDatastore' :: CreateDatastore -> Maybe DatastoreStorage
datastoreStorage} -> Maybe DatastoreStorage
datastoreStorage) (\s :: CreateDatastore
s@CreateDatastore' {} Maybe DatastoreStorage
a -> CreateDatastore
s {$sel:datastoreStorage:CreateDatastore' :: Maybe DatastoreStorage
datastoreStorage = Maybe DatastoreStorage
a} :: CreateDatastore)

-- | Metadata which can be used to manage the data store.
createDatastore_tags :: Lens.Lens' CreateDatastore (Prelude.Maybe (Prelude.NonEmpty Tag))
createDatastore_tags :: (Maybe (NonEmpty Tag) -> f (Maybe (NonEmpty Tag)))
-> CreateDatastore -> f CreateDatastore
createDatastore_tags = (CreateDatastore -> Maybe (NonEmpty Tag))
-> (CreateDatastore -> Maybe (NonEmpty Tag) -> CreateDatastore)
-> Lens
     CreateDatastore
     CreateDatastore
     (Maybe (NonEmpty Tag))
     (Maybe (NonEmpty Tag))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDatastore' {Maybe (NonEmpty Tag)
tags :: Maybe (NonEmpty Tag)
$sel:tags:CreateDatastore' :: CreateDatastore -> Maybe (NonEmpty Tag)
tags} -> Maybe (NonEmpty Tag)
tags) (\s :: CreateDatastore
s@CreateDatastore' {} Maybe (NonEmpty Tag)
a -> CreateDatastore
s {$sel:tags:CreateDatastore' :: Maybe (NonEmpty Tag)
tags = Maybe (NonEmpty Tag)
a} :: CreateDatastore) ((Maybe (NonEmpty Tag) -> f (Maybe (NonEmpty Tag)))
 -> CreateDatastore -> f CreateDatastore)
-> ((Maybe (NonEmpty Tag) -> f (Maybe (NonEmpty Tag)))
    -> Maybe (NonEmpty Tag) -> f (Maybe (NonEmpty Tag)))
-> (Maybe (NonEmpty Tag) -> f (Maybe (NonEmpty Tag)))
-> CreateDatastore
-> f CreateDatastore
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso (NonEmpty Tag) (NonEmpty Tag) (NonEmpty Tag) (NonEmpty Tag)
-> Iso
     (Maybe (NonEmpty Tag))
     (Maybe (NonEmpty Tag))
     (Maybe (NonEmpty Tag))
     (Maybe (NonEmpty 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 (NonEmpty Tag) (NonEmpty Tag) (NonEmpty Tag) (NonEmpty Tag)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The name of the data store.
createDatastore_datastoreName :: Lens.Lens' CreateDatastore Prelude.Text
createDatastore_datastoreName :: (Text -> f Text) -> CreateDatastore -> f CreateDatastore
createDatastore_datastoreName = (CreateDatastore -> Text)
-> (CreateDatastore -> Text -> CreateDatastore)
-> Lens CreateDatastore CreateDatastore Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDatastore' {Text
datastoreName :: Text
$sel:datastoreName:CreateDatastore' :: CreateDatastore -> Text
datastoreName} -> Text
datastoreName) (\s :: CreateDatastore
s@CreateDatastore' {} Text
a -> CreateDatastore
s {$sel:datastoreName:CreateDatastore' :: Text
datastoreName = Text
a} :: CreateDatastore)

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

instance Prelude.NFData CreateDatastore

instance Core.ToHeaders CreateDatastore where
  toHeaders :: CreateDatastore -> ResponseHeaders
toHeaders = ResponseHeaders -> CreateDatastore -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty

instance Core.ToJSON CreateDatastore where
  toJSON :: CreateDatastore -> Value
toJSON CreateDatastore' {Maybe (NonEmpty Tag)
Maybe RetentionPeriod
Maybe FileFormatConfiguration
Maybe DatastoreStorage
Maybe DatastorePartitions
Text
datastoreName :: Text
tags :: Maybe (NonEmpty Tag)
datastoreStorage :: Maybe DatastoreStorage
retentionPeriod :: Maybe RetentionPeriod
datastorePartitions :: Maybe DatastorePartitions
fileFormatConfiguration :: Maybe FileFormatConfiguration
$sel:datastoreName:CreateDatastore' :: CreateDatastore -> Text
$sel:tags:CreateDatastore' :: CreateDatastore -> Maybe (NonEmpty Tag)
$sel:datastoreStorage:CreateDatastore' :: CreateDatastore -> Maybe DatastoreStorage
$sel:retentionPeriod:CreateDatastore' :: CreateDatastore -> Maybe RetentionPeriod
$sel:datastorePartitions:CreateDatastore' :: CreateDatastore -> Maybe DatastorePartitions
$sel:fileFormatConfiguration:CreateDatastore' :: CreateDatastore -> Maybe FileFormatConfiguration
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"fileFormatConfiguration" Text -> FileFormatConfiguration -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (FileFormatConfiguration -> Pair)
-> Maybe FileFormatConfiguration -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe FileFormatConfiguration
fileFormatConfiguration,
            (Text
"datastorePartitions" Text -> DatastorePartitions -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (DatastorePartitions -> Pair)
-> Maybe DatastorePartitions -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe DatastorePartitions
datastorePartitions,
            (Text
"retentionPeriod" Text -> RetentionPeriod -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (RetentionPeriod -> Pair) -> Maybe RetentionPeriod -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe RetentionPeriod
retentionPeriod,
            (Text
"datastoreStorage" Text -> DatastoreStorage -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (DatastoreStorage -> Pair) -> Maybe DatastoreStorage -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe DatastoreStorage
datastoreStorage,
            (Text
"tags" Text -> NonEmpty Tag -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (NonEmpty Tag -> Pair) -> Maybe (NonEmpty Tag) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (NonEmpty Tag)
tags,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"datastoreName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
datastoreName)
          ]
      )

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

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

-- | /See:/ 'newCreateDatastoreResponse' smart constructor.
data CreateDatastoreResponse = CreateDatastoreResponse'
  { -- | The ARN of the data store.
    CreateDatastoreResponse -> Maybe Text
datastoreArn :: Prelude.Maybe Prelude.Text,
    -- | The name of the data store.
    CreateDatastoreResponse -> Maybe Text
datastoreName :: Prelude.Maybe Prelude.Text,
    -- | How long, in days, message data is kept for the data store.
    CreateDatastoreResponse -> Maybe RetentionPeriod
retentionPeriod :: Prelude.Maybe RetentionPeriod,
    -- | The response's http status code.
    CreateDatastoreResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (CreateDatastoreResponse -> CreateDatastoreResponse -> Bool
(CreateDatastoreResponse -> CreateDatastoreResponse -> Bool)
-> (CreateDatastoreResponse -> CreateDatastoreResponse -> Bool)
-> Eq CreateDatastoreResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateDatastoreResponse -> CreateDatastoreResponse -> Bool
$c/= :: CreateDatastoreResponse -> CreateDatastoreResponse -> Bool
== :: CreateDatastoreResponse -> CreateDatastoreResponse -> Bool
$c== :: CreateDatastoreResponse -> CreateDatastoreResponse -> Bool
Prelude.Eq, ReadPrec [CreateDatastoreResponse]
ReadPrec CreateDatastoreResponse
Int -> ReadS CreateDatastoreResponse
ReadS [CreateDatastoreResponse]
(Int -> ReadS CreateDatastoreResponse)
-> ReadS [CreateDatastoreResponse]
-> ReadPrec CreateDatastoreResponse
-> ReadPrec [CreateDatastoreResponse]
-> Read CreateDatastoreResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateDatastoreResponse]
$creadListPrec :: ReadPrec [CreateDatastoreResponse]
readPrec :: ReadPrec CreateDatastoreResponse
$creadPrec :: ReadPrec CreateDatastoreResponse
readList :: ReadS [CreateDatastoreResponse]
$creadList :: ReadS [CreateDatastoreResponse]
readsPrec :: Int -> ReadS CreateDatastoreResponse
$creadsPrec :: Int -> ReadS CreateDatastoreResponse
Prelude.Read, Int -> CreateDatastoreResponse -> ShowS
[CreateDatastoreResponse] -> ShowS
CreateDatastoreResponse -> String
(Int -> CreateDatastoreResponse -> ShowS)
-> (CreateDatastoreResponse -> String)
-> ([CreateDatastoreResponse] -> ShowS)
-> Show CreateDatastoreResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateDatastoreResponse] -> ShowS
$cshowList :: [CreateDatastoreResponse] -> ShowS
show :: CreateDatastoreResponse -> String
$cshow :: CreateDatastoreResponse -> String
showsPrec :: Int -> CreateDatastoreResponse -> ShowS
$cshowsPrec :: Int -> CreateDatastoreResponse -> ShowS
Prelude.Show, (forall x.
 CreateDatastoreResponse -> Rep CreateDatastoreResponse x)
-> (forall x.
    Rep CreateDatastoreResponse x -> CreateDatastoreResponse)
-> Generic CreateDatastoreResponse
forall x. Rep CreateDatastoreResponse x -> CreateDatastoreResponse
forall x. CreateDatastoreResponse -> Rep CreateDatastoreResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateDatastoreResponse x -> CreateDatastoreResponse
$cfrom :: forall x. CreateDatastoreResponse -> Rep CreateDatastoreResponse x
Prelude.Generic)

-- |
-- Create a value of 'CreateDatastoreResponse' 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:
--
-- 'datastoreArn', 'createDatastoreResponse_datastoreArn' - The ARN of the data store.
--
-- 'datastoreName', 'createDatastoreResponse_datastoreName' - The name of the data store.
--
-- 'retentionPeriod', 'createDatastoreResponse_retentionPeriod' - How long, in days, message data is kept for the data store.
--
-- 'httpStatus', 'createDatastoreResponse_httpStatus' - The response's http status code.
newCreateDatastoreResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  CreateDatastoreResponse
newCreateDatastoreResponse :: Int -> CreateDatastoreResponse
newCreateDatastoreResponse Int
pHttpStatus_ =
  CreateDatastoreResponse' :: Maybe Text
-> Maybe Text
-> Maybe RetentionPeriod
-> Int
-> CreateDatastoreResponse
CreateDatastoreResponse'
    { $sel:datastoreArn:CreateDatastoreResponse' :: Maybe Text
datastoreArn =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:datastoreName:CreateDatastoreResponse' :: Maybe Text
datastoreName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:retentionPeriod:CreateDatastoreResponse' :: Maybe RetentionPeriod
retentionPeriod = Maybe RetentionPeriod
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:CreateDatastoreResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The ARN of the data store.
createDatastoreResponse_datastoreArn :: Lens.Lens' CreateDatastoreResponse (Prelude.Maybe Prelude.Text)
createDatastoreResponse_datastoreArn :: (Maybe Text -> f (Maybe Text))
-> CreateDatastoreResponse -> f CreateDatastoreResponse
createDatastoreResponse_datastoreArn = (CreateDatastoreResponse -> Maybe Text)
-> (CreateDatastoreResponse
    -> Maybe Text -> CreateDatastoreResponse)
-> Lens
     CreateDatastoreResponse
     CreateDatastoreResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDatastoreResponse' {Maybe Text
datastoreArn :: Maybe Text
$sel:datastoreArn:CreateDatastoreResponse' :: CreateDatastoreResponse -> Maybe Text
datastoreArn} -> Maybe Text
datastoreArn) (\s :: CreateDatastoreResponse
s@CreateDatastoreResponse' {} Maybe Text
a -> CreateDatastoreResponse
s {$sel:datastoreArn:CreateDatastoreResponse' :: Maybe Text
datastoreArn = Maybe Text
a} :: CreateDatastoreResponse)

-- | The name of the data store.
createDatastoreResponse_datastoreName :: Lens.Lens' CreateDatastoreResponse (Prelude.Maybe Prelude.Text)
createDatastoreResponse_datastoreName :: (Maybe Text -> f (Maybe Text))
-> CreateDatastoreResponse -> f CreateDatastoreResponse
createDatastoreResponse_datastoreName = (CreateDatastoreResponse -> Maybe Text)
-> (CreateDatastoreResponse
    -> Maybe Text -> CreateDatastoreResponse)
-> Lens
     CreateDatastoreResponse
     CreateDatastoreResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDatastoreResponse' {Maybe Text
datastoreName :: Maybe Text
$sel:datastoreName:CreateDatastoreResponse' :: CreateDatastoreResponse -> Maybe Text
datastoreName} -> Maybe Text
datastoreName) (\s :: CreateDatastoreResponse
s@CreateDatastoreResponse' {} Maybe Text
a -> CreateDatastoreResponse
s {$sel:datastoreName:CreateDatastoreResponse' :: Maybe Text
datastoreName = Maybe Text
a} :: CreateDatastoreResponse)

-- | How long, in days, message data is kept for the data store.
createDatastoreResponse_retentionPeriod :: Lens.Lens' CreateDatastoreResponse (Prelude.Maybe RetentionPeriod)
createDatastoreResponse_retentionPeriod :: (Maybe RetentionPeriod -> f (Maybe RetentionPeriod))
-> CreateDatastoreResponse -> f CreateDatastoreResponse
createDatastoreResponse_retentionPeriod = (CreateDatastoreResponse -> Maybe RetentionPeriod)
-> (CreateDatastoreResponse
    -> Maybe RetentionPeriod -> CreateDatastoreResponse)
-> Lens
     CreateDatastoreResponse
     CreateDatastoreResponse
     (Maybe RetentionPeriod)
     (Maybe RetentionPeriod)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDatastoreResponse' {Maybe RetentionPeriod
retentionPeriod :: Maybe RetentionPeriod
$sel:retentionPeriod:CreateDatastoreResponse' :: CreateDatastoreResponse -> Maybe RetentionPeriod
retentionPeriod} -> Maybe RetentionPeriod
retentionPeriod) (\s :: CreateDatastoreResponse
s@CreateDatastoreResponse' {} Maybe RetentionPeriod
a -> CreateDatastoreResponse
s {$sel:retentionPeriod:CreateDatastoreResponse' :: Maybe RetentionPeriod
retentionPeriod = Maybe RetentionPeriod
a} :: CreateDatastoreResponse)

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

instance Prelude.NFData CreateDatastoreResponse