{-# 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.Forecast.CreateDatasetImportJob
-- 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)
--
-- Imports your training data to an Amazon Forecast dataset. You provide
-- the location of your training data in an Amazon Simple Storage Service
-- (Amazon S3) bucket and the Amazon Resource Name (ARN) of the dataset
-- that you want to import the data to.
--
-- You must specify a DataSource object that includes an AWS Identity and
-- Access Management (IAM) role that Amazon Forecast can assume to access
-- the data, as Amazon Forecast makes a copy of your data and processes it
-- in an internal AWS system. For more information, see
-- aws-forecast-iam-roles.
--
-- The training data must be in CSV format. The delimiter must be a comma
-- (,).
--
-- You can specify the path to a specific CSV file, the S3 bucket, or to a
-- folder in the S3 bucket. For the latter two cases, Amazon Forecast
-- imports all files up to the limit of 10,000 files.
--
-- Because dataset imports are not aggregated, your most recent dataset
-- import is the one that is used when training a predictor or generating a
-- forecast. Make sure that your most recent dataset import contains all of
-- the data you want to model off of, and not just the new data collected
-- since the previous import.
--
-- To get a list of all your dataset import jobs, filtered by specified
-- criteria, use the ListDatasetImportJobs operation.
module Amazonka.Forecast.CreateDatasetImportJob
  ( -- * Creating a Request
    CreateDatasetImportJob (..),
    newCreateDatasetImportJob,

    -- * Request Lenses
    createDatasetImportJob_timestampFormat,
    createDatasetImportJob_useGeolocationForTimeZone,
    createDatasetImportJob_geolocationFormat,
    createDatasetImportJob_timeZone,
    createDatasetImportJob_tags,
    createDatasetImportJob_datasetImportJobName,
    createDatasetImportJob_datasetArn,
    createDatasetImportJob_dataSource,

    -- * Destructuring the Response
    CreateDatasetImportJobResponse (..),
    newCreateDatasetImportJobResponse,

    -- * Response Lenses
    createDatasetImportJobResponse_datasetImportJobArn,
    createDatasetImportJobResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import Amazonka.Forecast.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:/ 'newCreateDatasetImportJob' smart constructor.
data CreateDatasetImportJob = CreateDatasetImportJob'
  { -- | The format of timestamps in the dataset. The format that you specify
    -- depends on the @DataFrequency@ specified when the dataset was created.
    -- The following formats are supported
    --
    -- -   \"yyyy-MM-dd\"
    --
    --     For the following data frequencies: Y, M, W, and D
    --
    -- -   \"yyyy-MM-dd HH:mm:ss\"
    --
    --     For the following data frequencies: H, 30min, 15min, and 1min; and
    --     optionally, for: Y, M, W, and D
    --
    -- If the format isn\'t specified, Amazon Forecast expects the format to be
    -- \"yyyy-MM-dd HH:mm:ss\".
    CreateDatasetImportJob -> Maybe Text
timestampFormat :: Prelude.Maybe Prelude.Text,
    -- | Automatically derive time zone information from the geolocation
    -- attribute. This option is ideal for datasets that contain timestamps in
    -- multiple time zones and those timestamps are expressed in local time.
    CreateDatasetImportJob -> Maybe Bool
useGeolocationForTimeZone :: Prelude.Maybe Prelude.Bool,
    -- | The format of the geolocation attribute. The geolocation attribute can
    -- be formatted in one of two ways:
    --
    -- -   @LAT_LONG@ - the latitude and longitude in decimal format (Example:
    --     47.61_-122.33).
    --
    -- -   @CC_POSTALCODE@ (US Only) - the country code (US), followed by the
    --     5-digit ZIP code (Example: US_98121).
    CreateDatasetImportJob -> Maybe Text
geolocationFormat :: Prelude.Maybe Prelude.Text,
    -- | A single time zone for every item in your dataset. This option is ideal
    -- for datasets with all timestamps within a single time zone, or if all
    -- timestamps are normalized to a single time zone.
    --
    -- Refer to the
    -- <http://joda-time.sourceforge.net/timezones.html Joda-Time API> for a
    -- complete list of valid time zone names.
    CreateDatasetImportJob -> Maybe Text
timeZone :: Prelude.Maybe Prelude.Text,
    -- | The optional metadata that you apply to the dataset import job to help
    -- you categorize and organize them. Each tag consists of a key and an
    -- optional value, both of which you define.
    --
    -- The following basic restrictions apply to tags:
    --
    -- -   Maximum number of tags per resource - 50.
    --
    -- -   For each resource, each tag key must be unique, and each tag key can
    --     have only one value.
    --
    -- -   Maximum key length - 128 Unicode characters in UTF-8.
    --
    -- -   Maximum value length - 256 Unicode characters in UTF-8.
    --
    -- -   If your tagging schema is used across multiple services and
    --     resources, remember that other services may have restrictions on
    --     allowed characters. Generally allowed characters are: letters,
    --     numbers, and spaces representable in UTF-8, and the following
    --     characters: + - = . _ : \/ \@.
    --
    -- -   Tag keys and values are case sensitive.
    --
    -- -   Do not use @aws:@, @AWS:@, or any upper or lowercase combination of
    --     such as a prefix for keys as it is reserved for AWS use. You cannot
    --     edit or delete tag keys with this prefix. Values can have this
    --     prefix. If a tag value has @aws@ as its prefix but the key does not,
    --     then Forecast considers it to be a user tag and will count against
    --     the limit of 50 tags. Tags with only the key prefix of @aws@ do not
    --     count against your tags per resource limit.
    CreateDatasetImportJob -> Maybe [Tag]
tags :: Prelude.Maybe [Tag],
    -- | The name for the dataset import job. We recommend including the current
    -- timestamp in the name, for example, @20190721DatasetImport@. This can
    -- help you avoid getting a @ResourceAlreadyExistsException@ exception.
    CreateDatasetImportJob -> Text
datasetImportJobName :: Prelude.Text,
    -- | The Amazon Resource Name (ARN) of the Amazon Forecast dataset that you
    -- want to import data to.
    CreateDatasetImportJob -> Text
datasetArn :: Prelude.Text,
    -- | The location of the training data to import and an AWS Identity and
    -- Access Management (IAM) role that Amazon Forecast can assume to access
    -- the data. The training data must be stored in an Amazon S3 bucket.
    --
    -- If encryption is used, @DataSource@ must include an AWS Key Management
    -- Service (KMS) key and the IAM role must allow Amazon Forecast permission
    -- to access the key. The KMS key and IAM role must match those specified
    -- in the @EncryptionConfig@ parameter of the CreateDataset operation.
    CreateDatasetImportJob -> DataSource
dataSource :: DataSource
  }
  deriving (CreateDatasetImportJob -> CreateDatasetImportJob -> Bool
(CreateDatasetImportJob -> CreateDatasetImportJob -> Bool)
-> (CreateDatasetImportJob -> CreateDatasetImportJob -> Bool)
-> Eq CreateDatasetImportJob
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateDatasetImportJob -> CreateDatasetImportJob -> Bool
$c/= :: CreateDatasetImportJob -> CreateDatasetImportJob -> Bool
== :: CreateDatasetImportJob -> CreateDatasetImportJob -> Bool
$c== :: CreateDatasetImportJob -> CreateDatasetImportJob -> Bool
Prelude.Eq, Int -> CreateDatasetImportJob -> ShowS
[CreateDatasetImportJob] -> ShowS
CreateDatasetImportJob -> String
(Int -> CreateDatasetImportJob -> ShowS)
-> (CreateDatasetImportJob -> String)
-> ([CreateDatasetImportJob] -> ShowS)
-> Show CreateDatasetImportJob
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateDatasetImportJob] -> ShowS
$cshowList :: [CreateDatasetImportJob] -> ShowS
show :: CreateDatasetImportJob -> String
$cshow :: CreateDatasetImportJob -> String
showsPrec :: Int -> CreateDatasetImportJob -> ShowS
$cshowsPrec :: Int -> CreateDatasetImportJob -> ShowS
Prelude.Show, (forall x. CreateDatasetImportJob -> Rep CreateDatasetImportJob x)
-> (forall x.
    Rep CreateDatasetImportJob x -> CreateDatasetImportJob)
-> Generic CreateDatasetImportJob
forall x. Rep CreateDatasetImportJob x -> CreateDatasetImportJob
forall x. CreateDatasetImportJob -> Rep CreateDatasetImportJob x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateDatasetImportJob x -> CreateDatasetImportJob
$cfrom :: forall x. CreateDatasetImportJob -> Rep CreateDatasetImportJob x
Prelude.Generic)

-- |
-- Create a value of 'CreateDatasetImportJob' 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:
--
-- 'timestampFormat', 'createDatasetImportJob_timestampFormat' - The format of timestamps in the dataset. The format that you specify
-- depends on the @DataFrequency@ specified when the dataset was created.
-- The following formats are supported
--
-- -   \"yyyy-MM-dd\"
--
--     For the following data frequencies: Y, M, W, and D
--
-- -   \"yyyy-MM-dd HH:mm:ss\"
--
--     For the following data frequencies: H, 30min, 15min, and 1min; and
--     optionally, for: Y, M, W, and D
--
-- If the format isn\'t specified, Amazon Forecast expects the format to be
-- \"yyyy-MM-dd HH:mm:ss\".
--
-- 'useGeolocationForTimeZone', 'createDatasetImportJob_useGeolocationForTimeZone' - Automatically derive time zone information from the geolocation
-- attribute. This option is ideal for datasets that contain timestamps in
-- multiple time zones and those timestamps are expressed in local time.
--
-- 'geolocationFormat', 'createDatasetImportJob_geolocationFormat' - The format of the geolocation attribute. The geolocation attribute can
-- be formatted in one of two ways:
--
-- -   @LAT_LONG@ - the latitude and longitude in decimal format (Example:
--     47.61_-122.33).
--
-- -   @CC_POSTALCODE@ (US Only) - the country code (US), followed by the
--     5-digit ZIP code (Example: US_98121).
--
-- 'timeZone', 'createDatasetImportJob_timeZone' - A single time zone for every item in your dataset. This option is ideal
-- for datasets with all timestamps within a single time zone, or if all
-- timestamps are normalized to a single time zone.
--
-- Refer to the
-- <http://joda-time.sourceforge.net/timezones.html Joda-Time API> for a
-- complete list of valid time zone names.
--
-- 'tags', 'createDatasetImportJob_tags' - The optional metadata that you apply to the dataset import job to help
-- you categorize and organize them. Each tag consists of a key and an
-- optional value, both of which you define.
--
-- The following basic restrictions apply to tags:
--
-- -   Maximum number of tags per resource - 50.
--
-- -   For each resource, each tag key must be unique, and each tag key can
--     have only one value.
--
-- -   Maximum key length - 128 Unicode characters in UTF-8.
--
-- -   Maximum value length - 256 Unicode characters in UTF-8.
--
-- -   If your tagging schema is used across multiple services and
--     resources, remember that other services may have restrictions on
--     allowed characters. Generally allowed characters are: letters,
--     numbers, and spaces representable in UTF-8, and the following
--     characters: + - = . _ : \/ \@.
--
-- -   Tag keys and values are case sensitive.
--
-- -   Do not use @aws:@, @AWS:@, or any upper or lowercase combination of
--     such as a prefix for keys as it is reserved for AWS use. You cannot
--     edit or delete tag keys with this prefix. Values can have this
--     prefix. If a tag value has @aws@ as its prefix but the key does not,
--     then Forecast considers it to be a user tag and will count against
--     the limit of 50 tags. Tags with only the key prefix of @aws@ do not
--     count against your tags per resource limit.
--
-- 'datasetImportJobName', 'createDatasetImportJob_datasetImportJobName' - The name for the dataset import job. We recommend including the current
-- timestamp in the name, for example, @20190721DatasetImport@. This can
-- help you avoid getting a @ResourceAlreadyExistsException@ exception.
--
-- 'datasetArn', 'createDatasetImportJob_datasetArn' - The Amazon Resource Name (ARN) of the Amazon Forecast dataset that you
-- want to import data to.
--
-- 'dataSource', 'createDatasetImportJob_dataSource' - The location of the training data to import and an AWS Identity and
-- Access Management (IAM) role that Amazon Forecast can assume to access
-- the data. The training data must be stored in an Amazon S3 bucket.
--
-- If encryption is used, @DataSource@ must include an AWS Key Management
-- Service (KMS) key and the IAM role must allow Amazon Forecast permission
-- to access the key. The KMS key and IAM role must match those specified
-- in the @EncryptionConfig@ parameter of the CreateDataset operation.
newCreateDatasetImportJob ::
  -- | 'datasetImportJobName'
  Prelude.Text ->
  -- | 'datasetArn'
  Prelude.Text ->
  -- | 'dataSource'
  DataSource ->
  CreateDatasetImportJob
newCreateDatasetImportJob :: Text -> Text -> DataSource -> CreateDatasetImportJob
newCreateDatasetImportJob
  Text
pDatasetImportJobName_
  Text
pDatasetArn_
  DataSource
pDataSource_ =
    CreateDatasetImportJob' :: Maybe Text
-> Maybe Bool
-> Maybe Text
-> Maybe Text
-> Maybe [Tag]
-> Text
-> Text
-> DataSource
-> CreateDatasetImportJob
CreateDatasetImportJob'
      { $sel:timestampFormat:CreateDatasetImportJob' :: Maybe Text
timestampFormat =
          Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:useGeolocationForTimeZone:CreateDatasetImportJob' :: Maybe Bool
useGeolocationForTimeZone = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
        $sel:geolocationFormat:CreateDatasetImportJob' :: Maybe Text
geolocationFormat = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:timeZone:CreateDatasetImportJob' :: Maybe Text
timeZone = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:tags:CreateDatasetImportJob' :: Maybe [Tag]
tags = Maybe [Tag]
forall a. Maybe a
Prelude.Nothing,
        $sel:datasetImportJobName:CreateDatasetImportJob' :: Text
datasetImportJobName = Text
pDatasetImportJobName_,
        $sel:datasetArn:CreateDatasetImportJob' :: Text
datasetArn = Text
pDatasetArn_,
        $sel:dataSource:CreateDatasetImportJob' :: DataSource
dataSource = DataSource
pDataSource_
      }

-- | The format of timestamps in the dataset. The format that you specify
-- depends on the @DataFrequency@ specified when the dataset was created.
-- The following formats are supported
--
-- -   \"yyyy-MM-dd\"
--
--     For the following data frequencies: Y, M, W, and D
--
-- -   \"yyyy-MM-dd HH:mm:ss\"
--
--     For the following data frequencies: H, 30min, 15min, and 1min; and
--     optionally, for: Y, M, W, and D
--
-- If the format isn\'t specified, Amazon Forecast expects the format to be
-- \"yyyy-MM-dd HH:mm:ss\".
createDatasetImportJob_timestampFormat :: Lens.Lens' CreateDatasetImportJob (Prelude.Maybe Prelude.Text)
createDatasetImportJob_timestampFormat :: (Maybe Text -> f (Maybe Text))
-> CreateDatasetImportJob -> f CreateDatasetImportJob
createDatasetImportJob_timestampFormat = (CreateDatasetImportJob -> Maybe Text)
-> (CreateDatasetImportJob -> Maybe Text -> CreateDatasetImportJob)
-> Lens
     CreateDatasetImportJob
     CreateDatasetImportJob
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDatasetImportJob' {Maybe Text
timestampFormat :: Maybe Text
$sel:timestampFormat:CreateDatasetImportJob' :: CreateDatasetImportJob -> Maybe Text
timestampFormat} -> Maybe Text
timestampFormat) (\s :: CreateDatasetImportJob
s@CreateDatasetImportJob' {} Maybe Text
a -> CreateDatasetImportJob
s {$sel:timestampFormat:CreateDatasetImportJob' :: Maybe Text
timestampFormat = Maybe Text
a} :: CreateDatasetImportJob)

-- | Automatically derive time zone information from the geolocation
-- attribute. This option is ideal for datasets that contain timestamps in
-- multiple time zones and those timestamps are expressed in local time.
createDatasetImportJob_useGeolocationForTimeZone :: Lens.Lens' CreateDatasetImportJob (Prelude.Maybe Prelude.Bool)
createDatasetImportJob_useGeolocationForTimeZone :: (Maybe Bool -> f (Maybe Bool))
-> CreateDatasetImportJob -> f CreateDatasetImportJob
createDatasetImportJob_useGeolocationForTimeZone = (CreateDatasetImportJob -> Maybe Bool)
-> (CreateDatasetImportJob -> Maybe Bool -> CreateDatasetImportJob)
-> Lens
     CreateDatasetImportJob
     CreateDatasetImportJob
     (Maybe Bool)
     (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDatasetImportJob' {Maybe Bool
useGeolocationForTimeZone :: Maybe Bool
$sel:useGeolocationForTimeZone:CreateDatasetImportJob' :: CreateDatasetImportJob -> Maybe Bool
useGeolocationForTimeZone} -> Maybe Bool
useGeolocationForTimeZone) (\s :: CreateDatasetImportJob
s@CreateDatasetImportJob' {} Maybe Bool
a -> CreateDatasetImportJob
s {$sel:useGeolocationForTimeZone:CreateDatasetImportJob' :: Maybe Bool
useGeolocationForTimeZone = Maybe Bool
a} :: CreateDatasetImportJob)

-- | The format of the geolocation attribute. The geolocation attribute can
-- be formatted in one of two ways:
--
-- -   @LAT_LONG@ - the latitude and longitude in decimal format (Example:
--     47.61_-122.33).
--
-- -   @CC_POSTALCODE@ (US Only) - the country code (US), followed by the
--     5-digit ZIP code (Example: US_98121).
createDatasetImportJob_geolocationFormat :: Lens.Lens' CreateDatasetImportJob (Prelude.Maybe Prelude.Text)
createDatasetImportJob_geolocationFormat :: (Maybe Text -> f (Maybe Text))
-> CreateDatasetImportJob -> f CreateDatasetImportJob
createDatasetImportJob_geolocationFormat = (CreateDatasetImportJob -> Maybe Text)
-> (CreateDatasetImportJob -> Maybe Text -> CreateDatasetImportJob)
-> Lens
     CreateDatasetImportJob
     CreateDatasetImportJob
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDatasetImportJob' {Maybe Text
geolocationFormat :: Maybe Text
$sel:geolocationFormat:CreateDatasetImportJob' :: CreateDatasetImportJob -> Maybe Text
geolocationFormat} -> Maybe Text
geolocationFormat) (\s :: CreateDatasetImportJob
s@CreateDatasetImportJob' {} Maybe Text
a -> CreateDatasetImportJob
s {$sel:geolocationFormat:CreateDatasetImportJob' :: Maybe Text
geolocationFormat = Maybe Text
a} :: CreateDatasetImportJob)

-- | A single time zone for every item in your dataset. This option is ideal
-- for datasets with all timestamps within a single time zone, or if all
-- timestamps are normalized to a single time zone.
--
-- Refer to the
-- <http://joda-time.sourceforge.net/timezones.html Joda-Time API> for a
-- complete list of valid time zone names.
createDatasetImportJob_timeZone :: Lens.Lens' CreateDatasetImportJob (Prelude.Maybe Prelude.Text)
createDatasetImportJob_timeZone :: (Maybe Text -> f (Maybe Text))
-> CreateDatasetImportJob -> f CreateDatasetImportJob
createDatasetImportJob_timeZone = (CreateDatasetImportJob -> Maybe Text)
-> (CreateDatasetImportJob -> Maybe Text -> CreateDatasetImportJob)
-> Lens
     CreateDatasetImportJob
     CreateDatasetImportJob
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDatasetImportJob' {Maybe Text
timeZone :: Maybe Text
$sel:timeZone:CreateDatasetImportJob' :: CreateDatasetImportJob -> Maybe Text
timeZone} -> Maybe Text
timeZone) (\s :: CreateDatasetImportJob
s@CreateDatasetImportJob' {} Maybe Text
a -> CreateDatasetImportJob
s {$sel:timeZone:CreateDatasetImportJob' :: Maybe Text
timeZone = Maybe Text
a} :: CreateDatasetImportJob)

-- | The optional metadata that you apply to the dataset import job to help
-- you categorize and organize them. Each tag consists of a key and an
-- optional value, both of which you define.
--
-- The following basic restrictions apply to tags:
--
-- -   Maximum number of tags per resource - 50.
--
-- -   For each resource, each tag key must be unique, and each tag key can
--     have only one value.
--
-- -   Maximum key length - 128 Unicode characters in UTF-8.
--
-- -   Maximum value length - 256 Unicode characters in UTF-8.
--
-- -   If your tagging schema is used across multiple services and
--     resources, remember that other services may have restrictions on
--     allowed characters. Generally allowed characters are: letters,
--     numbers, and spaces representable in UTF-8, and the following
--     characters: + - = . _ : \/ \@.
--
-- -   Tag keys and values are case sensitive.
--
-- -   Do not use @aws:@, @AWS:@, or any upper or lowercase combination of
--     such as a prefix for keys as it is reserved for AWS use. You cannot
--     edit or delete tag keys with this prefix. Values can have this
--     prefix. If a tag value has @aws@ as its prefix but the key does not,
--     then Forecast considers it to be a user tag and will count against
--     the limit of 50 tags. Tags with only the key prefix of @aws@ do not
--     count against your tags per resource limit.
createDatasetImportJob_tags :: Lens.Lens' CreateDatasetImportJob (Prelude.Maybe [Tag])
createDatasetImportJob_tags :: (Maybe [Tag] -> f (Maybe [Tag]))
-> CreateDatasetImportJob -> f CreateDatasetImportJob
createDatasetImportJob_tags = (CreateDatasetImportJob -> Maybe [Tag])
-> (CreateDatasetImportJob
    -> Maybe [Tag] -> CreateDatasetImportJob)
-> Lens
     CreateDatasetImportJob
     CreateDatasetImportJob
     (Maybe [Tag])
     (Maybe [Tag])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDatasetImportJob' {Maybe [Tag]
tags :: Maybe [Tag]
$sel:tags:CreateDatasetImportJob' :: CreateDatasetImportJob -> Maybe [Tag]
tags} -> Maybe [Tag]
tags) (\s :: CreateDatasetImportJob
s@CreateDatasetImportJob' {} Maybe [Tag]
a -> CreateDatasetImportJob
s {$sel:tags:CreateDatasetImportJob' :: Maybe [Tag]
tags = Maybe [Tag]
a} :: CreateDatasetImportJob) ((Maybe [Tag] -> f (Maybe [Tag]))
 -> CreateDatasetImportJob -> f CreateDatasetImportJob)
-> ((Maybe [Tag] -> f (Maybe [Tag]))
    -> Maybe [Tag] -> f (Maybe [Tag]))
-> (Maybe [Tag] -> f (Maybe [Tag]))
-> CreateDatasetImportJob
-> f CreateDatasetImportJob
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 for the dataset import job. We recommend including the current
-- timestamp in the name, for example, @20190721DatasetImport@. This can
-- help you avoid getting a @ResourceAlreadyExistsException@ exception.
createDatasetImportJob_datasetImportJobName :: Lens.Lens' CreateDatasetImportJob Prelude.Text
createDatasetImportJob_datasetImportJobName :: (Text -> f Text)
-> CreateDatasetImportJob -> f CreateDatasetImportJob
createDatasetImportJob_datasetImportJobName = (CreateDatasetImportJob -> Text)
-> (CreateDatasetImportJob -> Text -> CreateDatasetImportJob)
-> Lens CreateDatasetImportJob CreateDatasetImportJob Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDatasetImportJob' {Text
datasetImportJobName :: Text
$sel:datasetImportJobName:CreateDatasetImportJob' :: CreateDatasetImportJob -> Text
datasetImportJobName} -> Text
datasetImportJobName) (\s :: CreateDatasetImportJob
s@CreateDatasetImportJob' {} Text
a -> CreateDatasetImportJob
s {$sel:datasetImportJobName:CreateDatasetImportJob' :: Text
datasetImportJobName = Text
a} :: CreateDatasetImportJob)

-- | The Amazon Resource Name (ARN) of the Amazon Forecast dataset that you
-- want to import data to.
createDatasetImportJob_datasetArn :: Lens.Lens' CreateDatasetImportJob Prelude.Text
createDatasetImportJob_datasetArn :: (Text -> f Text)
-> CreateDatasetImportJob -> f CreateDatasetImportJob
createDatasetImportJob_datasetArn = (CreateDatasetImportJob -> Text)
-> (CreateDatasetImportJob -> Text -> CreateDatasetImportJob)
-> Lens CreateDatasetImportJob CreateDatasetImportJob Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDatasetImportJob' {Text
datasetArn :: Text
$sel:datasetArn:CreateDatasetImportJob' :: CreateDatasetImportJob -> Text
datasetArn} -> Text
datasetArn) (\s :: CreateDatasetImportJob
s@CreateDatasetImportJob' {} Text
a -> CreateDatasetImportJob
s {$sel:datasetArn:CreateDatasetImportJob' :: Text
datasetArn = Text
a} :: CreateDatasetImportJob)

-- | The location of the training data to import and an AWS Identity and
-- Access Management (IAM) role that Amazon Forecast can assume to access
-- the data. The training data must be stored in an Amazon S3 bucket.
--
-- If encryption is used, @DataSource@ must include an AWS Key Management
-- Service (KMS) key and the IAM role must allow Amazon Forecast permission
-- to access the key. The KMS key and IAM role must match those specified
-- in the @EncryptionConfig@ parameter of the CreateDataset operation.
createDatasetImportJob_dataSource :: Lens.Lens' CreateDatasetImportJob DataSource
createDatasetImportJob_dataSource :: (DataSource -> f DataSource)
-> CreateDatasetImportJob -> f CreateDatasetImportJob
createDatasetImportJob_dataSource = (CreateDatasetImportJob -> DataSource)
-> (CreateDatasetImportJob -> DataSource -> CreateDatasetImportJob)
-> Lens
     CreateDatasetImportJob CreateDatasetImportJob DataSource DataSource
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDatasetImportJob' {DataSource
dataSource :: DataSource
$sel:dataSource:CreateDatasetImportJob' :: CreateDatasetImportJob -> DataSource
dataSource} -> DataSource
dataSource) (\s :: CreateDatasetImportJob
s@CreateDatasetImportJob' {} DataSource
a -> CreateDatasetImportJob
s {$sel:dataSource:CreateDatasetImportJob' :: DataSource
dataSource = DataSource
a} :: CreateDatasetImportJob)

instance Core.AWSRequest CreateDatasetImportJob where
  type
    AWSResponse CreateDatasetImportJob =
      CreateDatasetImportJobResponse
  request :: CreateDatasetImportJob -> Request CreateDatasetImportJob
request = Service -> CreateDatasetImportJob -> Request CreateDatasetImportJob
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy CreateDatasetImportJob
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CreateDatasetImportJob)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse CreateDatasetImportJob))
-> Logger
-> Service
-> Proxy CreateDatasetImportJob
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CreateDatasetImportJob)))
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 -> Int -> CreateDatasetImportJobResponse
CreateDatasetImportJobResponse'
            (Maybe Text -> Int -> CreateDatasetImportJobResponse)
-> Either String (Maybe Text)
-> Either String (Int -> CreateDatasetImportJobResponse)
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
"DatasetImportJobArn")
            Either String (Int -> CreateDatasetImportJobResponse)
-> Either String Int
-> Either String CreateDatasetImportJobResponse
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 CreateDatasetImportJob

instance Prelude.NFData CreateDatasetImportJob

instance Core.ToHeaders CreateDatasetImportJob where
  toHeaders :: CreateDatasetImportJob -> ResponseHeaders
toHeaders =
    ResponseHeaders -> CreateDatasetImportJob -> 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
"AmazonForecast.CreateDatasetImportJob" ::
                          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 CreateDatasetImportJob where
  toJSON :: CreateDatasetImportJob -> Value
toJSON CreateDatasetImportJob' {Maybe Bool
Maybe [Tag]
Maybe Text
Text
DataSource
dataSource :: DataSource
datasetArn :: Text
datasetImportJobName :: Text
tags :: Maybe [Tag]
timeZone :: Maybe Text
geolocationFormat :: Maybe Text
useGeolocationForTimeZone :: Maybe Bool
timestampFormat :: Maybe Text
$sel:dataSource:CreateDatasetImportJob' :: CreateDatasetImportJob -> DataSource
$sel:datasetArn:CreateDatasetImportJob' :: CreateDatasetImportJob -> Text
$sel:datasetImportJobName:CreateDatasetImportJob' :: CreateDatasetImportJob -> Text
$sel:tags:CreateDatasetImportJob' :: CreateDatasetImportJob -> Maybe [Tag]
$sel:timeZone:CreateDatasetImportJob' :: CreateDatasetImportJob -> Maybe Text
$sel:geolocationFormat:CreateDatasetImportJob' :: CreateDatasetImportJob -> Maybe Text
$sel:useGeolocationForTimeZone:CreateDatasetImportJob' :: CreateDatasetImportJob -> Maybe Bool
$sel:timestampFormat:CreateDatasetImportJob' :: CreateDatasetImportJob -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"TimestampFormat" 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
timestampFormat,
            (Text
"UseGeolocationForTimeZone" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
useGeolocationForTimeZone,
            (Text
"GeolocationFormat" 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
geolocationFormat,
            (Text
"TimeZone" 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
timeZone,
            (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
"DatasetImportJobName"
                  Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
datasetImportJobName
              ),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"DatasetArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
datasetArn),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"DataSource" Text -> DataSource -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= DataSource
dataSource)
          ]
      )

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

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

-- | /See:/ 'newCreateDatasetImportJobResponse' smart constructor.
data CreateDatasetImportJobResponse = CreateDatasetImportJobResponse'
  { -- | The Amazon Resource Name (ARN) of the dataset import job.
    CreateDatasetImportJobResponse -> Maybe Text
datasetImportJobArn :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    CreateDatasetImportJobResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (CreateDatasetImportJobResponse
-> CreateDatasetImportJobResponse -> Bool
(CreateDatasetImportJobResponse
 -> CreateDatasetImportJobResponse -> Bool)
-> (CreateDatasetImportJobResponse
    -> CreateDatasetImportJobResponse -> Bool)
-> Eq CreateDatasetImportJobResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateDatasetImportJobResponse
-> CreateDatasetImportJobResponse -> Bool
$c/= :: CreateDatasetImportJobResponse
-> CreateDatasetImportJobResponse -> Bool
== :: CreateDatasetImportJobResponse
-> CreateDatasetImportJobResponse -> Bool
$c== :: CreateDatasetImportJobResponse
-> CreateDatasetImportJobResponse -> Bool
Prelude.Eq, ReadPrec [CreateDatasetImportJobResponse]
ReadPrec CreateDatasetImportJobResponse
Int -> ReadS CreateDatasetImportJobResponse
ReadS [CreateDatasetImportJobResponse]
(Int -> ReadS CreateDatasetImportJobResponse)
-> ReadS [CreateDatasetImportJobResponse]
-> ReadPrec CreateDatasetImportJobResponse
-> ReadPrec [CreateDatasetImportJobResponse]
-> Read CreateDatasetImportJobResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateDatasetImportJobResponse]
$creadListPrec :: ReadPrec [CreateDatasetImportJobResponse]
readPrec :: ReadPrec CreateDatasetImportJobResponse
$creadPrec :: ReadPrec CreateDatasetImportJobResponse
readList :: ReadS [CreateDatasetImportJobResponse]
$creadList :: ReadS [CreateDatasetImportJobResponse]
readsPrec :: Int -> ReadS CreateDatasetImportJobResponse
$creadsPrec :: Int -> ReadS CreateDatasetImportJobResponse
Prelude.Read, Int -> CreateDatasetImportJobResponse -> ShowS
[CreateDatasetImportJobResponse] -> ShowS
CreateDatasetImportJobResponse -> String
(Int -> CreateDatasetImportJobResponse -> ShowS)
-> (CreateDatasetImportJobResponse -> String)
-> ([CreateDatasetImportJobResponse] -> ShowS)
-> Show CreateDatasetImportJobResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateDatasetImportJobResponse] -> ShowS
$cshowList :: [CreateDatasetImportJobResponse] -> ShowS
show :: CreateDatasetImportJobResponse -> String
$cshow :: CreateDatasetImportJobResponse -> String
showsPrec :: Int -> CreateDatasetImportJobResponse -> ShowS
$cshowsPrec :: Int -> CreateDatasetImportJobResponse -> ShowS
Prelude.Show, (forall x.
 CreateDatasetImportJobResponse
 -> Rep CreateDatasetImportJobResponse x)
-> (forall x.
    Rep CreateDatasetImportJobResponse x
    -> CreateDatasetImportJobResponse)
-> Generic CreateDatasetImportJobResponse
forall x.
Rep CreateDatasetImportJobResponse x
-> CreateDatasetImportJobResponse
forall x.
CreateDatasetImportJobResponse
-> Rep CreateDatasetImportJobResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateDatasetImportJobResponse x
-> CreateDatasetImportJobResponse
$cfrom :: forall x.
CreateDatasetImportJobResponse
-> Rep CreateDatasetImportJobResponse x
Prelude.Generic)

-- |
-- Create a value of 'CreateDatasetImportJobResponse' 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:
--
-- 'datasetImportJobArn', 'createDatasetImportJobResponse_datasetImportJobArn' - The Amazon Resource Name (ARN) of the dataset import job.
--
-- 'httpStatus', 'createDatasetImportJobResponse_httpStatus' - The response's http status code.
newCreateDatasetImportJobResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  CreateDatasetImportJobResponse
newCreateDatasetImportJobResponse :: Int -> CreateDatasetImportJobResponse
newCreateDatasetImportJobResponse Int
pHttpStatus_ =
  CreateDatasetImportJobResponse' :: Maybe Text -> Int -> CreateDatasetImportJobResponse
CreateDatasetImportJobResponse'
    { $sel:datasetImportJobArn:CreateDatasetImportJobResponse' :: Maybe Text
datasetImportJobArn =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:CreateDatasetImportJobResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The Amazon Resource Name (ARN) of the dataset import job.
createDatasetImportJobResponse_datasetImportJobArn :: Lens.Lens' CreateDatasetImportJobResponse (Prelude.Maybe Prelude.Text)
createDatasetImportJobResponse_datasetImportJobArn :: (Maybe Text -> f (Maybe Text))
-> CreateDatasetImportJobResponse
-> f CreateDatasetImportJobResponse
createDatasetImportJobResponse_datasetImportJobArn = (CreateDatasetImportJobResponse -> Maybe Text)
-> (CreateDatasetImportJobResponse
    -> Maybe Text -> CreateDatasetImportJobResponse)
-> Lens
     CreateDatasetImportJobResponse
     CreateDatasetImportJobResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDatasetImportJobResponse' {Maybe Text
datasetImportJobArn :: Maybe Text
$sel:datasetImportJobArn:CreateDatasetImportJobResponse' :: CreateDatasetImportJobResponse -> Maybe Text
datasetImportJobArn} -> Maybe Text
datasetImportJobArn) (\s :: CreateDatasetImportJobResponse
s@CreateDatasetImportJobResponse' {} Maybe Text
a -> CreateDatasetImportJobResponse
s {$sel:datasetImportJobArn:CreateDatasetImportJobResponse' :: Maybe Text
datasetImportJobArn = Maybe Text
a} :: CreateDatasetImportJobResponse)

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

instance
  Prelude.NFData
    CreateDatasetImportJobResponse