{-# 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.LookoutMetrics.CreateMetricSet
-- 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 dataset.
module Amazonka.LookoutMetrics.CreateMetricSet
  ( -- * Creating a Request
    CreateMetricSet (..),
    newCreateMetricSet,

    -- * Request Lenses
    createMetricSet_dimensionList,
    createMetricSet_offset,
    createMetricSet_timestampColumn,
    createMetricSet_metricSetFrequency,
    createMetricSet_metricSetDescription,
    createMetricSet_timezone,
    createMetricSet_tags,
    createMetricSet_anomalyDetectorArn,
    createMetricSet_metricSetName,
    createMetricSet_metricList,
    createMetricSet_metricSource,

    -- * Destructuring the Response
    CreateMetricSetResponse (..),
    newCreateMetricSetResponse,

    -- * Response Lenses
    createMetricSetResponse_metricSetArn,
    createMetricSetResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.LookoutMetrics.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newCreateMetricSet' smart constructor.
data CreateMetricSet = CreateMetricSet'
  { -- | A list of the fields you want to treat as dimensions.
    CreateMetricSet -> Maybe (NonEmpty Text)
dimensionList :: Prelude.Maybe (Prelude.NonEmpty Prelude.Text),
    -- | After an interval ends, the amount of seconds that the detector waits
    -- before importing data. Offset is only supported for S3 and Redshift
    -- datasources.
    CreateMetricSet -> Maybe Natural
offset :: Prelude.Maybe Prelude.Natural,
    -- | Contains information about the column used for tracking time in your
    -- source data.
    CreateMetricSet -> Maybe TimestampColumn
timestampColumn :: Prelude.Maybe TimestampColumn,
    -- | The frequency with which the source data will be analyzed for anomalies.
    CreateMetricSet -> Maybe Frequency
metricSetFrequency :: Prelude.Maybe Frequency,
    -- | A description of the dataset you are creating.
    CreateMetricSet -> Maybe Text
metricSetDescription :: Prelude.Maybe Prelude.Text,
    -- | The time zone in which your source data was recorded.
    CreateMetricSet -> Maybe Text
timezone :: Prelude.Maybe Prelude.Text,
    -- | A list of
    -- <https://docs.aws.amazon.com/lookoutmetrics/latest/dev/detectors-tags.html tags>
    -- to apply to the dataset.
    CreateMetricSet -> Maybe (HashMap Text Text)
tags :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | The ARN of the anomaly detector that will use the dataset.
    CreateMetricSet -> Text
anomalyDetectorArn :: Prelude.Text,
    -- | The name of the dataset.
    CreateMetricSet -> Text
metricSetName :: Prelude.Text,
    -- | A list of metrics that the dataset will contain.
    CreateMetricSet -> NonEmpty Metric
metricList :: Prelude.NonEmpty Metric,
    -- | Contains information about how the source data should be interpreted.
    CreateMetricSet -> MetricSource
metricSource :: MetricSource
  }
  deriving (CreateMetricSet -> CreateMetricSet -> Bool
(CreateMetricSet -> CreateMetricSet -> Bool)
-> (CreateMetricSet -> CreateMetricSet -> Bool)
-> Eq CreateMetricSet
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateMetricSet -> CreateMetricSet -> Bool
$c/= :: CreateMetricSet -> CreateMetricSet -> Bool
== :: CreateMetricSet -> CreateMetricSet -> Bool
$c== :: CreateMetricSet -> CreateMetricSet -> Bool
Prelude.Eq, ReadPrec [CreateMetricSet]
ReadPrec CreateMetricSet
Int -> ReadS CreateMetricSet
ReadS [CreateMetricSet]
(Int -> ReadS CreateMetricSet)
-> ReadS [CreateMetricSet]
-> ReadPrec CreateMetricSet
-> ReadPrec [CreateMetricSet]
-> Read CreateMetricSet
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateMetricSet]
$creadListPrec :: ReadPrec [CreateMetricSet]
readPrec :: ReadPrec CreateMetricSet
$creadPrec :: ReadPrec CreateMetricSet
readList :: ReadS [CreateMetricSet]
$creadList :: ReadS [CreateMetricSet]
readsPrec :: Int -> ReadS CreateMetricSet
$creadsPrec :: Int -> ReadS CreateMetricSet
Prelude.Read, Int -> CreateMetricSet -> ShowS
[CreateMetricSet] -> ShowS
CreateMetricSet -> String
(Int -> CreateMetricSet -> ShowS)
-> (CreateMetricSet -> String)
-> ([CreateMetricSet] -> ShowS)
-> Show CreateMetricSet
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateMetricSet] -> ShowS
$cshowList :: [CreateMetricSet] -> ShowS
show :: CreateMetricSet -> String
$cshow :: CreateMetricSet -> String
showsPrec :: Int -> CreateMetricSet -> ShowS
$cshowsPrec :: Int -> CreateMetricSet -> ShowS
Prelude.Show, (forall x. CreateMetricSet -> Rep CreateMetricSet x)
-> (forall x. Rep CreateMetricSet x -> CreateMetricSet)
-> Generic CreateMetricSet
forall x. Rep CreateMetricSet x -> CreateMetricSet
forall x. CreateMetricSet -> Rep CreateMetricSet x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateMetricSet x -> CreateMetricSet
$cfrom :: forall x. CreateMetricSet -> Rep CreateMetricSet x
Prelude.Generic)

-- |
-- Create a value of 'CreateMetricSet' 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:
--
-- 'dimensionList', 'createMetricSet_dimensionList' - A list of the fields you want to treat as dimensions.
--
-- 'offset', 'createMetricSet_offset' - After an interval ends, the amount of seconds that the detector waits
-- before importing data. Offset is only supported for S3 and Redshift
-- datasources.
--
-- 'timestampColumn', 'createMetricSet_timestampColumn' - Contains information about the column used for tracking time in your
-- source data.
--
-- 'metricSetFrequency', 'createMetricSet_metricSetFrequency' - The frequency with which the source data will be analyzed for anomalies.
--
-- 'metricSetDescription', 'createMetricSet_metricSetDescription' - A description of the dataset you are creating.
--
-- 'timezone', 'createMetricSet_timezone' - The time zone in which your source data was recorded.
--
-- 'tags', 'createMetricSet_tags' - A list of
-- <https://docs.aws.amazon.com/lookoutmetrics/latest/dev/detectors-tags.html tags>
-- to apply to the dataset.
--
-- 'anomalyDetectorArn', 'createMetricSet_anomalyDetectorArn' - The ARN of the anomaly detector that will use the dataset.
--
-- 'metricSetName', 'createMetricSet_metricSetName' - The name of the dataset.
--
-- 'metricList', 'createMetricSet_metricList' - A list of metrics that the dataset will contain.
--
-- 'metricSource', 'createMetricSet_metricSource' - Contains information about how the source data should be interpreted.
newCreateMetricSet ::
  -- | 'anomalyDetectorArn'
  Prelude.Text ->
  -- | 'metricSetName'
  Prelude.Text ->
  -- | 'metricList'
  Prelude.NonEmpty Metric ->
  -- | 'metricSource'
  MetricSource ->
  CreateMetricSet
newCreateMetricSet :: Text -> Text -> NonEmpty Metric -> MetricSource -> CreateMetricSet
newCreateMetricSet
  Text
pAnomalyDetectorArn_
  Text
pMetricSetName_
  NonEmpty Metric
pMetricList_
  MetricSource
pMetricSource_ =
    CreateMetricSet' :: Maybe (NonEmpty Text)
-> Maybe Natural
-> Maybe TimestampColumn
-> Maybe Frequency
-> Maybe Text
-> Maybe Text
-> Maybe (HashMap Text Text)
-> Text
-> Text
-> NonEmpty Metric
-> MetricSource
-> CreateMetricSet
CreateMetricSet'
      { $sel:dimensionList:CreateMetricSet' :: Maybe (NonEmpty Text)
dimensionList = Maybe (NonEmpty Text)
forall a. Maybe a
Prelude.Nothing,
        $sel:offset:CreateMetricSet' :: Maybe Natural
offset = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
        $sel:timestampColumn:CreateMetricSet' :: Maybe TimestampColumn
timestampColumn = Maybe TimestampColumn
forall a. Maybe a
Prelude.Nothing,
        $sel:metricSetFrequency:CreateMetricSet' :: Maybe Frequency
metricSetFrequency = Maybe Frequency
forall a. Maybe a
Prelude.Nothing,
        $sel:metricSetDescription:CreateMetricSet' :: Maybe Text
metricSetDescription = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:timezone:CreateMetricSet' :: Maybe Text
timezone = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:tags:CreateMetricSet' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing,
        $sel:anomalyDetectorArn:CreateMetricSet' :: Text
anomalyDetectorArn = Text
pAnomalyDetectorArn_,
        $sel:metricSetName:CreateMetricSet' :: Text
metricSetName = Text
pMetricSetName_,
        $sel:metricList:CreateMetricSet' :: NonEmpty Metric
metricList = Tagged (NonEmpty Metric) (Identity (NonEmpty Metric))
-> Tagged (NonEmpty Metric) (Identity (NonEmpty Metric))
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced (Tagged (NonEmpty Metric) (Identity (NonEmpty Metric))
 -> Tagged (NonEmpty Metric) (Identity (NonEmpty Metric)))
-> NonEmpty Metric -> NonEmpty Metric
forall t b. AReview t b -> b -> t
Lens.# NonEmpty Metric
pMetricList_,
        $sel:metricSource:CreateMetricSet' :: MetricSource
metricSource = MetricSource
pMetricSource_
      }

-- | A list of the fields you want to treat as dimensions.
createMetricSet_dimensionList :: Lens.Lens' CreateMetricSet (Prelude.Maybe (Prelude.NonEmpty Prelude.Text))
createMetricSet_dimensionList :: (Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> CreateMetricSet -> f CreateMetricSet
createMetricSet_dimensionList = (CreateMetricSet -> Maybe (NonEmpty Text))
-> (CreateMetricSet -> Maybe (NonEmpty Text) -> CreateMetricSet)
-> Lens
     CreateMetricSet
     CreateMetricSet
     (Maybe (NonEmpty Text))
     (Maybe (NonEmpty Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateMetricSet' {Maybe (NonEmpty Text)
dimensionList :: Maybe (NonEmpty Text)
$sel:dimensionList:CreateMetricSet' :: CreateMetricSet -> Maybe (NonEmpty Text)
dimensionList} -> Maybe (NonEmpty Text)
dimensionList) (\s :: CreateMetricSet
s@CreateMetricSet' {} Maybe (NonEmpty Text)
a -> CreateMetricSet
s {$sel:dimensionList:CreateMetricSet' :: Maybe (NonEmpty Text)
dimensionList = Maybe (NonEmpty Text)
a} :: CreateMetricSet) ((Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
 -> CreateMetricSet -> f CreateMetricSet)
-> ((Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
    -> Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> (Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> CreateMetricSet
-> f CreateMetricSet
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (NonEmpty Text) (NonEmpty Text) (NonEmpty Text) (NonEmpty Text)
-> Iso
     (Maybe (NonEmpty Text))
     (Maybe (NonEmpty Text))
     (Maybe (NonEmpty Text))
     (Maybe (NonEmpty Text))
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
  (NonEmpty Text) (NonEmpty Text) (NonEmpty Text) (NonEmpty Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | After an interval ends, the amount of seconds that the detector waits
-- before importing data. Offset is only supported for S3 and Redshift
-- datasources.
createMetricSet_offset :: Lens.Lens' CreateMetricSet (Prelude.Maybe Prelude.Natural)
createMetricSet_offset :: (Maybe Natural -> f (Maybe Natural))
-> CreateMetricSet -> f CreateMetricSet
createMetricSet_offset = (CreateMetricSet -> Maybe Natural)
-> (CreateMetricSet -> Maybe Natural -> CreateMetricSet)
-> Lens
     CreateMetricSet CreateMetricSet (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateMetricSet' {Maybe Natural
offset :: Maybe Natural
$sel:offset:CreateMetricSet' :: CreateMetricSet -> Maybe Natural
offset} -> Maybe Natural
offset) (\s :: CreateMetricSet
s@CreateMetricSet' {} Maybe Natural
a -> CreateMetricSet
s {$sel:offset:CreateMetricSet' :: Maybe Natural
offset = Maybe Natural
a} :: CreateMetricSet)

-- | Contains information about the column used for tracking time in your
-- source data.
createMetricSet_timestampColumn :: Lens.Lens' CreateMetricSet (Prelude.Maybe TimestampColumn)
createMetricSet_timestampColumn :: (Maybe TimestampColumn -> f (Maybe TimestampColumn))
-> CreateMetricSet -> f CreateMetricSet
createMetricSet_timestampColumn = (CreateMetricSet -> Maybe TimestampColumn)
-> (CreateMetricSet -> Maybe TimestampColumn -> CreateMetricSet)
-> Lens
     CreateMetricSet
     CreateMetricSet
     (Maybe TimestampColumn)
     (Maybe TimestampColumn)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateMetricSet' {Maybe TimestampColumn
timestampColumn :: Maybe TimestampColumn
$sel:timestampColumn:CreateMetricSet' :: CreateMetricSet -> Maybe TimestampColumn
timestampColumn} -> Maybe TimestampColumn
timestampColumn) (\s :: CreateMetricSet
s@CreateMetricSet' {} Maybe TimestampColumn
a -> CreateMetricSet
s {$sel:timestampColumn:CreateMetricSet' :: Maybe TimestampColumn
timestampColumn = Maybe TimestampColumn
a} :: CreateMetricSet)

-- | The frequency with which the source data will be analyzed for anomalies.
createMetricSet_metricSetFrequency :: Lens.Lens' CreateMetricSet (Prelude.Maybe Frequency)
createMetricSet_metricSetFrequency :: (Maybe Frequency -> f (Maybe Frequency))
-> CreateMetricSet -> f CreateMetricSet
createMetricSet_metricSetFrequency = (CreateMetricSet -> Maybe Frequency)
-> (CreateMetricSet -> Maybe Frequency -> CreateMetricSet)
-> Lens
     CreateMetricSet CreateMetricSet (Maybe Frequency) (Maybe Frequency)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateMetricSet' {Maybe Frequency
metricSetFrequency :: Maybe Frequency
$sel:metricSetFrequency:CreateMetricSet' :: CreateMetricSet -> Maybe Frequency
metricSetFrequency} -> Maybe Frequency
metricSetFrequency) (\s :: CreateMetricSet
s@CreateMetricSet' {} Maybe Frequency
a -> CreateMetricSet
s {$sel:metricSetFrequency:CreateMetricSet' :: Maybe Frequency
metricSetFrequency = Maybe Frequency
a} :: CreateMetricSet)

-- | A description of the dataset you are creating.
createMetricSet_metricSetDescription :: Lens.Lens' CreateMetricSet (Prelude.Maybe Prelude.Text)
createMetricSet_metricSetDescription :: (Maybe Text -> f (Maybe Text))
-> CreateMetricSet -> f CreateMetricSet
createMetricSet_metricSetDescription = (CreateMetricSet -> Maybe Text)
-> (CreateMetricSet -> Maybe Text -> CreateMetricSet)
-> Lens CreateMetricSet CreateMetricSet (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateMetricSet' {Maybe Text
metricSetDescription :: Maybe Text
$sel:metricSetDescription:CreateMetricSet' :: CreateMetricSet -> Maybe Text
metricSetDescription} -> Maybe Text
metricSetDescription) (\s :: CreateMetricSet
s@CreateMetricSet' {} Maybe Text
a -> CreateMetricSet
s {$sel:metricSetDescription:CreateMetricSet' :: Maybe Text
metricSetDescription = Maybe Text
a} :: CreateMetricSet)

-- | The time zone in which your source data was recorded.
createMetricSet_timezone :: Lens.Lens' CreateMetricSet (Prelude.Maybe Prelude.Text)
createMetricSet_timezone :: (Maybe Text -> f (Maybe Text))
-> CreateMetricSet -> f CreateMetricSet
createMetricSet_timezone = (CreateMetricSet -> Maybe Text)
-> (CreateMetricSet -> Maybe Text -> CreateMetricSet)
-> Lens CreateMetricSet CreateMetricSet (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateMetricSet' {Maybe Text
timezone :: Maybe Text
$sel:timezone:CreateMetricSet' :: CreateMetricSet -> Maybe Text
timezone} -> Maybe Text
timezone) (\s :: CreateMetricSet
s@CreateMetricSet' {} Maybe Text
a -> CreateMetricSet
s {$sel:timezone:CreateMetricSet' :: Maybe Text
timezone = Maybe Text
a} :: CreateMetricSet)

-- | A list of
-- <https://docs.aws.amazon.com/lookoutmetrics/latest/dev/detectors-tags.html tags>
-- to apply to the dataset.
createMetricSet_tags :: Lens.Lens' CreateMetricSet (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
createMetricSet_tags :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> CreateMetricSet -> f CreateMetricSet
createMetricSet_tags = (CreateMetricSet -> Maybe (HashMap Text Text))
-> (CreateMetricSet
    -> Maybe (HashMap Text Text) -> CreateMetricSet)
-> Lens
     CreateMetricSet
     CreateMetricSet
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateMetricSet' {Maybe (HashMap Text Text)
tags :: Maybe (HashMap Text Text)
$sel:tags:CreateMetricSet' :: CreateMetricSet -> Maybe (HashMap Text Text)
tags} -> Maybe (HashMap Text Text)
tags) (\s :: CreateMetricSet
s@CreateMetricSet' {} Maybe (HashMap Text Text)
a -> CreateMetricSet
s {$sel:tags:CreateMetricSet' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
a} :: CreateMetricSet) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
 -> CreateMetricSet -> f CreateMetricSet)
-> ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
    -> Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> CreateMetricSet
-> f CreateMetricSet
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
-> Iso
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The ARN of the anomaly detector that will use the dataset.
createMetricSet_anomalyDetectorArn :: Lens.Lens' CreateMetricSet Prelude.Text
createMetricSet_anomalyDetectorArn :: (Text -> f Text) -> CreateMetricSet -> f CreateMetricSet
createMetricSet_anomalyDetectorArn = (CreateMetricSet -> Text)
-> (CreateMetricSet -> Text -> CreateMetricSet)
-> Lens CreateMetricSet CreateMetricSet Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateMetricSet' {Text
anomalyDetectorArn :: Text
$sel:anomalyDetectorArn:CreateMetricSet' :: CreateMetricSet -> Text
anomalyDetectorArn} -> Text
anomalyDetectorArn) (\s :: CreateMetricSet
s@CreateMetricSet' {} Text
a -> CreateMetricSet
s {$sel:anomalyDetectorArn:CreateMetricSet' :: Text
anomalyDetectorArn = Text
a} :: CreateMetricSet)

-- | The name of the dataset.
createMetricSet_metricSetName :: Lens.Lens' CreateMetricSet Prelude.Text
createMetricSet_metricSetName :: (Text -> f Text) -> CreateMetricSet -> f CreateMetricSet
createMetricSet_metricSetName = (CreateMetricSet -> Text)
-> (CreateMetricSet -> Text -> CreateMetricSet)
-> Lens CreateMetricSet CreateMetricSet Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateMetricSet' {Text
metricSetName :: Text
$sel:metricSetName:CreateMetricSet' :: CreateMetricSet -> Text
metricSetName} -> Text
metricSetName) (\s :: CreateMetricSet
s@CreateMetricSet' {} Text
a -> CreateMetricSet
s {$sel:metricSetName:CreateMetricSet' :: Text
metricSetName = Text
a} :: CreateMetricSet)

-- | A list of metrics that the dataset will contain.
createMetricSet_metricList :: Lens.Lens' CreateMetricSet (Prelude.NonEmpty Metric)
createMetricSet_metricList :: (NonEmpty Metric -> f (NonEmpty Metric))
-> CreateMetricSet -> f CreateMetricSet
createMetricSet_metricList = (CreateMetricSet -> NonEmpty Metric)
-> (CreateMetricSet -> NonEmpty Metric -> CreateMetricSet)
-> Lens
     CreateMetricSet CreateMetricSet (NonEmpty Metric) (NonEmpty Metric)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateMetricSet' {NonEmpty Metric
metricList :: NonEmpty Metric
$sel:metricList:CreateMetricSet' :: CreateMetricSet -> NonEmpty Metric
metricList} -> NonEmpty Metric
metricList) (\s :: CreateMetricSet
s@CreateMetricSet' {} NonEmpty Metric
a -> CreateMetricSet
s {$sel:metricList:CreateMetricSet' :: NonEmpty Metric
metricList = NonEmpty Metric
a} :: CreateMetricSet) ((NonEmpty Metric -> f (NonEmpty Metric))
 -> CreateMetricSet -> f CreateMetricSet)
-> ((NonEmpty Metric -> f (NonEmpty Metric))
    -> NonEmpty Metric -> f (NonEmpty Metric))
-> (NonEmpty Metric -> f (NonEmpty Metric))
-> CreateMetricSet
-> f CreateMetricSet
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (NonEmpty Metric -> f (NonEmpty Metric))
-> NonEmpty Metric -> f (NonEmpty Metric)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Contains information about how the source data should be interpreted.
createMetricSet_metricSource :: Lens.Lens' CreateMetricSet MetricSource
createMetricSet_metricSource :: (MetricSource -> f MetricSource)
-> CreateMetricSet -> f CreateMetricSet
createMetricSet_metricSource = (CreateMetricSet -> MetricSource)
-> (CreateMetricSet -> MetricSource -> CreateMetricSet)
-> Lens CreateMetricSet CreateMetricSet MetricSource MetricSource
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateMetricSet' {MetricSource
metricSource :: MetricSource
$sel:metricSource:CreateMetricSet' :: CreateMetricSet -> MetricSource
metricSource} -> MetricSource
metricSource) (\s :: CreateMetricSet
s@CreateMetricSet' {} MetricSource
a -> CreateMetricSet
s {$sel:metricSource:CreateMetricSet' :: MetricSource
metricSource = MetricSource
a} :: CreateMetricSet)

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

instance Prelude.NFData CreateMetricSet

instance Core.ToHeaders CreateMetricSet where
  toHeaders :: CreateMetricSet -> ResponseHeaders
toHeaders =
    ResponseHeaders -> CreateMetricSet -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"Content-Type"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Core.ToJSON CreateMetricSet where
  toJSON :: CreateMetricSet -> Value
toJSON CreateMetricSet' {Maybe Natural
Maybe (NonEmpty Text)
Maybe Text
Maybe (HashMap Text Text)
Maybe Frequency
Maybe TimestampColumn
NonEmpty Metric
Text
MetricSource
metricSource :: MetricSource
metricList :: NonEmpty Metric
metricSetName :: Text
anomalyDetectorArn :: Text
tags :: Maybe (HashMap Text Text)
timezone :: Maybe Text
metricSetDescription :: Maybe Text
metricSetFrequency :: Maybe Frequency
timestampColumn :: Maybe TimestampColumn
offset :: Maybe Natural
dimensionList :: Maybe (NonEmpty Text)
$sel:metricSource:CreateMetricSet' :: CreateMetricSet -> MetricSource
$sel:metricList:CreateMetricSet' :: CreateMetricSet -> NonEmpty Metric
$sel:metricSetName:CreateMetricSet' :: CreateMetricSet -> Text
$sel:anomalyDetectorArn:CreateMetricSet' :: CreateMetricSet -> Text
$sel:tags:CreateMetricSet' :: CreateMetricSet -> Maybe (HashMap Text Text)
$sel:timezone:CreateMetricSet' :: CreateMetricSet -> Maybe Text
$sel:metricSetDescription:CreateMetricSet' :: CreateMetricSet -> Maybe Text
$sel:metricSetFrequency:CreateMetricSet' :: CreateMetricSet -> Maybe Frequency
$sel:timestampColumn:CreateMetricSet' :: CreateMetricSet -> Maybe TimestampColumn
$sel:offset:CreateMetricSet' :: CreateMetricSet -> Maybe Natural
$sel:dimensionList:CreateMetricSet' :: CreateMetricSet -> Maybe (NonEmpty Text)
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"DimensionList" Text -> NonEmpty Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (NonEmpty Text -> Pair) -> Maybe (NonEmpty Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (NonEmpty Text)
dimensionList,
            (Text
"Offset" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
offset,
            (Text
"TimestampColumn" Text -> TimestampColumn -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (TimestampColumn -> Pair) -> Maybe TimestampColumn -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe TimestampColumn
timestampColumn,
            (Text
"MetricSetFrequency" Text -> Frequency -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Frequency -> Pair) -> Maybe Frequency -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Frequency
metricSetFrequency,
            (Text
"MetricSetDescription" 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
metricSetDescription,
            (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 -> HashMap Text Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (HashMap Text Text -> Pair)
-> Maybe (HashMap Text Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text Text)
tags,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"AnomalyDetectorArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
anomalyDetectorArn),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"MetricSetName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
metricSetName),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"MetricList" Text -> NonEmpty Metric -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= NonEmpty Metric
metricList),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"MetricSource" Text -> MetricSource -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= MetricSource
metricSource)
          ]
      )

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

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

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

-- |
-- Create a value of 'CreateMetricSetResponse' 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:
--
-- 'metricSetArn', 'createMetricSetResponse_metricSetArn' - The ARN of the dataset.
--
-- 'httpStatus', 'createMetricSetResponse_httpStatus' - The response's http status code.
newCreateMetricSetResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  CreateMetricSetResponse
newCreateMetricSetResponse :: Int -> CreateMetricSetResponse
newCreateMetricSetResponse Int
pHttpStatus_ =
  CreateMetricSetResponse' :: Maybe Text -> Int -> CreateMetricSetResponse
CreateMetricSetResponse'
    { $sel:metricSetArn:CreateMetricSetResponse' :: Maybe Text
metricSetArn =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:CreateMetricSetResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The ARN of the dataset.
createMetricSetResponse_metricSetArn :: Lens.Lens' CreateMetricSetResponse (Prelude.Maybe Prelude.Text)
createMetricSetResponse_metricSetArn :: (Maybe Text -> f (Maybe Text))
-> CreateMetricSetResponse -> f CreateMetricSetResponse
createMetricSetResponse_metricSetArn = (CreateMetricSetResponse -> Maybe Text)
-> (CreateMetricSetResponse
    -> Maybe Text -> CreateMetricSetResponse)
-> Lens
     CreateMetricSetResponse
     CreateMetricSetResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateMetricSetResponse' {Maybe Text
metricSetArn :: Maybe Text
$sel:metricSetArn:CreateMetricSetResponse' :: CreateMetricSetResponse -> Maybe Text
metricSetArn} -> Maybe Text
metricSetArn) (\s :: CreateMetricSetResponse
s@CreateMetricSetResponse' {} Maybe Text
a -> CreateMetricSetResponse
s {$sel:metricSetArn:CreateMetricSetResponse' :: Maybe Text
metricSetArn = Maybe Text
a} :: CreateMetricSetResponse)

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

instance Prelude.NFData CreateMetricSetResponse