{-# 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-2023 Brendan Hay -- License : Mozilla Public License, v. 2.0. -- Maintainer : Brendan Hay -- 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 -- -- 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 -- . -- -- The training data must be in CSV or Parquet format. The delimiter must -- be a comma (,). -- -- You can specify the path to a specific 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 -- -- operation. module Amazonka.Forecast.CreateDatasetImportJob ( -- * Creating a Request CreateDatasetImportJob (..), newCreateDatasetImportJob, -- * Request Lenses createDatasetImportJob_format, createDatasetImportJob_geolocationFormat, createDatasetImportJob_tags, createDatasetImportJob_timeZone, createDatasetImportJob_timestampFormat, createDatasetImportJob_useGeolocationForTimeZone, 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 qualified Amazonka.Core.Lens.Internal as Lens import qualified Amazonka.Data as Data import Amazonka.Forecast.Types 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 the imported data, CSV or PARQUET. The default value is -- CSV. format :: Prelude.Maybe Prelude.Text, -- | 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). geolocationFormat :: 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. tags :: Prelude.Maybe [Tag], -- | 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 -- for a -- complete list of valid time zone names. timeZone :: Prelude.Maybe Prelude.Text, -- | 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\". 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. useGeolocationForTimeZone :: Prelude.Maybe Prelude.Bool, -- | 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. datasetImportJobName :: Prelude.Text, -- | The Amazon Resource Name (ARN) of the Amazon Forecast dataset that you -- want to import data to. 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 -- -- operation. dataSource :: DataSource } deriving (Prelude.Eq, Prelude.Show, Prelude.Generic) -- | -- Create a value of 'CreateDatasetImportJob' with all optional fields omitted. -- -- Use or to modify other optional fields. -- -- The following record fields are available, with the corresponding lenses provided -- for backwards compatibility: -- -- 'format', 'createDatasetImportJob_format' - The format of the imported data, CSV or PARQUET. The default value is -- CSV. -- -- '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). -- -- '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. -- -- '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 -- for a -- complete list of valid time zone names. -- -- '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. -- -- '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 -- -- operation. newCreateDatasetImportJob :: -- | 'datasetImportJobName' Prelude.Text -> -- | 'datasetArn' Prelude.Text -> -- | 'dataSource' DataSource -> CreateDatasetImportJob newCreateDatasetImportJob pDatasetImportJobName_ pDatasetArn_ pDataSource_ = CreateDatasetImportJob' { format = Prelude.Nothing, geolocationFormat = Prelude.Nothing, tags = Prelude.Nothing, timeZone = Prelude.Nothing, timestampFormat = Prelude.Nothing, useGeolocationForTimeZone = Prelude.Nothing, datasetImportJobName = pDatasetImportJobName_, datasetArn = pDatasetArn_, dataSource = pDataSource_ } -- | The format of the imported data, CSV or PARQUET. The default value is -- CSV. createDatasetImportJob_format :: Lens.Lens' CreateDatasetImportJob (Prelude.Maybe Prelude.Text) createDatasetImportJob_format = Lens.lens (\CreateDatasetImportJob' {format} -> format) (\s@CreateDatasetImportJob' {} a -> s {format = 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 = Lens.lens (\CreateDatasetImportJob' {geolocationFormat} -> geolocationFormat) (\s@CreateDatasetImportJob' {} a -> s {geolocationFormat = 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 = Lens.lens (\CreateDatasetImportJob' {tags} -> tags) (\s@CreateDatasetImportJob' {} a -> s {tags = a} :: CreateDatasetImportJob) Prelude.. Lens.mapping Lens.coerced -- | 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 -- for a -- complete list of valid time zone names. createDatasetImportJob_timeZone :: Lens.Lens' CreateDatasetImportJob (Prelude.Maybe Prelude.Text) createDatasetImportJob_timeZone = Lens.lens (\CreateDatasetImportJob' {timeZone} -> timeZone) (\s@CreateDatasetImportJob' {} a -> s {timeZone = a} :: 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_timestampFormat :: Lens.Lens' CreateDatasetImportJob (Prelude.Maybe Prelude.Text) createDatasetImportJob_timestampFormat = Lens.lens (\CreateDatasetImportJob' {timestampFormat} -> timestampFormat) (\s@CreateDatasetImportJob' {} a -> s {timestampFormat = 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 = Lens.lens (\CreateDatasetImportJob' {useGeolocationForTimeZone} -> useGeolocationForTimeZone) (\s@CreateDatasetImportJob' {} a -> s {useGeolocationForTimeZone = a} :: CreateDatasetImportJob) -- | 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 = Lens.lens (\CreateDatasetImportJob' {datasetImportJobName} -> datasetImportJobName) (\s@CreateDatasetImportJob' {} a -> s {datasetImportJobName = 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 = Lens.lens (\CreateDatasetImportJob' {datasetArn} -> datasetArn) (\s@CreateDatasetImportJob' {} a -> s {datasetArn = 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 -- -- operation. createDatasetImportJob_dataSource :: Lens.Lens' CreateDatasetImportJob DataSource createDatasetImportJob_dataSource = Lens.lens (\CreateDatasetImportJob' {dataSource} -> dataSource) (\s@CreateDatasetImportJob' {} a -> s {dataSource = a} :: CreateDatasetImportJob) instance Core.AWSRequest CreateDatasetImportJob where type AWSResponse CreateDatasetImportJob = CreateDatasetImportJobResponse request overrides = Request.postJSON (overrides defaultService) response = Response.receiveJSON ( \s h x -> CreateDatasetImportJobResponse' Prelude.<$> (x Data..?> "DatasetImportJobArn") Prelude.<*> (Prelude.pure (Prelude.fromEnum s)) ) instance Prelude.Hashable CreateDatasetImportJob where hashWithSalt _salt CreateDatasetImportJob' {..} = _salt `Prelude.hashWithSalt` format `Prelude.hashWithSalt` geolocationFormat `Prelude.hashWithSalt` tags `Prelude.hashWithSalt` timeZone `Prelude.hashWithSalt` timestampFormat `Prelude.hashWithSalt` useGeolocationForTimeZone `Prelude.hashWithSalt` datasetImportJobName `Prelude.hashWithSalt` datasetArn `Prelude.hashWithSalt` dataSource instance Prelude.NFData CreateDatasetImportJob where rnf CreateDatasetImportJob' {..} = Prelude.rnf format `Prelude.seq` Prelude.rnf geolocationFormat `Prelude.seq` Prelude.rnf tags `Prelude.seq` Prelude.rnf timeZone `Prelude.seq` Prelude.rnf timestampFormat `Prelude.seq` Prelude.rnf useGeolocationForTimeZone `Prelude.seq` Prelude.rnf datasetImportJobName `Prelude.seq` Prelude.rnf datasetArn `Prelude.seq` Prelude.rnf dataSource instance Data.ToHeaders CreateDatasetImportJob where toHeaders = Prelude.const ( Prelude.mconcat [ "X-Amz-Target" Data.=# ( "AmazonForecast.CreateDatasetImportJob" :: Prelude.ByteString ), "Content-Type" Data.=# ( "application/x-amz-json-1.1" :: Prelude.ByteString ) ] ) instance Data.ToJSON CreateDatasetImportJob where toJSON CreateDatasetImportJob' {..} = Data.object ( Prelude.catMaybes [ ("Format" Data..=) Prelude.<$> format, ("GeolocationFormat" Data..=) Prelude.<$> geolocationFormat, ("Tags" Data..=) Prelude.<$> tags, ("TimeZone" Data..=) Prelude.<$> timeZone, ("TimestampFormat" Data..=) Prelude.<$> timestampFormat, ("UseGeolocationForTimeZone" Data..=) Prelude.<$> useGeolocationForTimeZone, Prelude.Just ( "DatasetImportJobName" Data..= datasetImportJobName ), Prelude.Just ("DatasetArn" Data..= datasetArn), Prelude.Just ("DataSource" Data..= dataSource) ] ) instance Data.ToPath CreateDatasetImportJob where toPath = Prelude.const "/" instance Data.ToQuery CreateDatasetImportJob where toQuery = Prelude.const Prelude.mempty -- | /See:/ 'newCreateDatasetImportJobResponse' smart constructor. data CreateDatasetImportJobResponse = CreateDatasetImportJobResponse' { -- | The Amazon Resource Name (ARN) of the dataset import job. datasetImportJobArn :: Prelude.Maybe Prelude.Text, -- | The response's http status code. httpStatus :: Prelude.Int } deriving (Prelude.Eq, Prelude.Read, Prelude.Show, Prelude.Generic) -- | -- Create a value of 'CreateDatasetImportJobResponse' with all optional fields omitted. -- -- Use or 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 pHttpStatus_ = CreateDatasetImportJobResponse' { datasetImportJobArn = Prelude.Nothing, httpStatus = pHttpStatus_ } -- | The Amazon Resource Name (ARN) of the dataset import job. createDatasetImportJobResponse_datasetImportJobArn :: Lens.Lens' CreateDatasetImportJobResponse (Prelude.Maybe Prelude.Text) createDatasetImportJobResponse_datasetImportJobArn = Lens.lens (\CreateDatasetImportJobResponse' {datasetImportJobArn} -> datasetImportJobArn) (\s@CreateDatasetImportJobResponse' {} a -> s {datasetImportJobArn = a} :: CreateDatasetImportJobResponse) -- | The response's http status code. createDatasetImportJobResponse_httpStatus :: Lens.Lens' CreateDatasetImportJobResponse Prelude.Int createDatasetImportJobResponse_httpStatus = Lens.lens (\CreateDatasetImportJobResponse' {httpStatus} -> httpStatus) (\s@CreateDatasetImportJobResponse' {} a -> s {httpStatus = a} :: CreateDatasetImportJobResponse) instance Prelude.NFData CreateDatasetImportJobResponse where rnf CreateDatasetImportJobResponse' {..} = Prelude.rnf datasetImportJobArn `Prelude.seq` Prelude.rnf httpStatus