{-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE DuplicateRecordFields #-} {-# LANGUAGE NamedFieldPuns #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE RecordWildCards #-} {-# LANGUAGE StrictData #-} {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE NoImplicitPrelude #-} {-# OPTIONS_GHC -fno-warn-unused-binds #-} {-# OPTIONS_GHC -fno-warn-unused-imports #-} {-# OPTIONS_GHC -fno-warn-unused-matches #-} -- Derived from AWS service descriptions, licensed under Apache 2.0. -- | -- Module : Amazonka.IoTAnalytics.CreatePipeline -- Copyright : (c) 2013-2023 Brendan Hay -- License : Mozilla Public License, v. 2.0. -- Maintainer : Brendan Hay -- Stability : auto-generated -- Portability : non-portable (GHC extensions) -- -- Creates a pipeline. A pipeline consumes messages from a channel and -- allows you to process the messages before storing them in a data store. -- You must specify both a @channel@ and a @datastore@ activity and, -- optionally, as many as 23 additional activities in the -- @pipelineActivities@ array. module Amazonka.IoTAnalytics.CreatePipeline ( -- * Creating a Request CreatePipeline (..), newCreatePipeline, -- * Request Lenses createPipeline_tags, createPipeline_pipelineName, createPipeline_pipelineActivities, -- * Destructuring the Response CreatePipelineResponse (..), newCreatePipelineResponse, -- * Response Lenses createPipelineResponse_pipelineArn, createPipelineResponse_pipelineName, createPipelineResponse_httpStatus, ) where import qualified Amazonka.Core as Core import qualified Amazonka.Core.Lens.Internal as Lens import qualified Amazonka.Data as Data import Amazonka.IoTAnalytics.Types import qualified Amazonka.Prelude as Prelude import qualified Amazonka.Request as Request import qualified Amazonka.Response as Response -- | /See:/ 'newCreatePipeline' smart constructor. data CreatePipeline = CreatePipeline' { -- | Metadata which can be used to manage the pipeline. tags :: Prelude.Maybe (Prelude.NonEmpty Tag), -- | The name of the pipeline. pipelineName :: Prelude.Text, -- | A list of @PipelineActivity@ objects. Activities perform transformations -- on your messages, such as removing, renaming or adding message -- attributes; filtering messages based on attribute values; invoking your -- Lambda unctions on messages for advanced processing; or performing -- mathematical transformations to normalize device data. -- -- The list can be 2-25 @PipelineActivity@ objects and must contain both a -- @channel@ and a @datastore@ activity. Each entry in the list must -- contain only one activity. For example: -- -- @pipelineActivities = [ { \"channel\": { ... } }, { \"lambda\": { ... } }, ... ]@ pipelineActivities :: Prelude.NonEmpty PipelineActivity } deriving (Prelude.Eq, Prelude.Read, Prelude.Show, Prelude.Generic) -- | -- Create a value of 'CreatePipeline' 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: -- -- 'tags', 'createPipeline_tags' - Metadata which can be used to manage the pipeline. -- -- 'pipelineName', 'createPipeline_pipelineName' - The name of the pipeline. -- -- 'pipelineActivities', 'createPipeline_pipelineActivities' - A list of @PipelineActivity@ objects. Activities perform transformations -- on your messages, such as removing, renaming or adding message -- attributes; filtering messages based on attribute values; invoking your -- Lambda unctions on messages for advanced processing; or performing -- mathematical transformations to normalize device data. -- -- The list can be 2-25 @PipelineActivity@ objects and must contain both a -- @channel@ and a @datastore@ activity. Each entry in the list must -- contain only one activity. For example: -- -- @pipelineActivities = [ { \"channel\": { ... } }, { \"lambda\": { ... } }, ... ]@ newCreatePipeline :: -- | 'pipelineName' Prelude.Text -> -- | 'pipelineActivities' Prelude.NonEmpty PipelineActivity -> CreatePipeline newCreatePipeline pPipelineName_ pPipelineActivities_ = CreatePipeline' { tags = Prelude.Nothing, pipelineName = pPipelineName_, pipelineActivities = Lens.coerced Lens.# pPipelineActivities_ } -- | Metadata which can be used to manage the pipeline. createPipeline_tags :: Lens.Lens' CreatePipeline (Prelude.Maybe (Prelude.NonEmpty Tag)) createPipeline_tags = Lens.lens (\CreatePipeline' {tags} -> tags) (\s@CreatePipeline' {} a -> s {tags = a} :: CreatePipeline) Prelude.. Lens.mapping Lens.coerced -- | The name of the pipeline. createPipeline_pipelineName :: Lens.Lens' CreatePipeline Prelude.Text createPipeline_pipelineName = Lens.lens (\CreatePipeline' {pipelineName} -> pipelineName) (\s@CreatePipeline' {} a -> s {pipelineName = a} :: CreatePipeline) -- | A list of @PipelineActivity@ objects. Activities perform transformations -- on your messages, such as removing, renaming or adding message -- attributes; filtering messages based on attribute values; invoking your -- Lambda unctions on messages for advanced processing; or performing -- mathematical transformations to normalize device data. -- -- The list can be 2-25 @PipelineActivity@ objects and must contain both a -- @channel@ and a @datastore@ activity. Each entry in the list must -- contain only one activity. For example: -- -- @pipelineActivities = [ { \"channel\": { ... } }, { \"lambda\": { ... } }, ... ]@ createPipeline_pipelineActivities :: Lens.Lens' CreatePipeline (Prelude.NonEmpty PipelineActivity) createPipeline_pipelineActivities = Lens.lens (\CreatePipeline' {pipelineActivities} -> pipelineActivities) (\s@CreatePipeline' {} a -> s {pipelineActivities = a} :: CreatePipeline) Prelude.. Lens.coerced instance Core.AWSRequest CreatePipeline where type AWSResponse CreatePipeline = CreatePipelineResponse request overrides = Request.postJSON (overrides defaultService) response = Response.receiveJSON ( \s h x -> CreatePipelineResponse' Prelude.<$> (x Data..?> "pipelineArn") Prelude.<*> (x Data..?> "pipelineName") Prelude.<*> (Prelude.pure (Prelude.fromEnum s)) ) instance Prelude.Hashable CreatePipeline where hashWithSalt _salt CreatePipeline' {..} = _salt `Prelude.hashWithSalt` tags `Prelude.hashWithSalt` pipelineName `Prelude.hashWithSalt` pipelineActivities instance Prelude.NFData CreatePipeline where rnf CreatePipeline' {..} = Prelude.rnf tags `Prelude.seq` Prelude.rnf pipelineName `Prelude.seq` Prelude.rnf pipelineActivities instance Data.ToHeaders CreatePipeline where toHeaders = Prelude.const Prelude.mempty instance Data.ToJSON CreatePipeline where toJSON CreatePipeline' {..} = Data.object ( Prelude.catMaybes [ ("tags" Data..=) Prelude.<$> tags, Prelude.Just ("pipelineName" Data..= pipelineName), Prelude.Just ("pipelineActivities" Data..= pipelineActivities) ] ) instance Data.ToPath CreatePipeline where toPath = Prelude.const "/pipelines" instance Data.ToQuery CreatePipeline where toQuery = Prelude.const Prelude.mempty -- | /See:/ 'newCreatePipelineResponse' smart constructor. data CreatePipelineResponse = CreatePipelineResponse' { -- | The ARN of the pipeline. pipelineArn :: Prelude.Maybe Prelude.Text, -- | The name of the pipeline. pipelineName :: 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 'CreatePipelineResponse' 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: -- -- 'pipelineArn', 'createPipelineResponse_pipelineArn' - The ARN of the pipeline. -- -- 'pipelineName', 'createPipelineResponse_pipelineName' - The name of the pipeline. -- -- 'httpStatus', 'createPipelineResponse_httpStatus' - The response's http status code. newCreatePipelineResponse :: -- | 'httpStatus' Prelude.Int -> CreatePipelineResponse newCreatePipelineResponse pHttpStatus_ = CreatePipelineResponse' { pipelineArn = Prelude.Nothing, pipelineName = Prelude.Nothing, httpStatus = pHttpStatus_ } -- | The ARN of the pipeline. createPipelineResponse_pipelineArn :: Lens.Lens' CreatePipelineResponse (Prelude.Maybe Prelude.Text) createPipelineResponse_pipelineArn = Lens.lens (\CreatePipelineResponse' {pipelineArn} -> pipelineArn) (\s@CreatePipelineResponse' {} a -> s {pipelineArn = a} :: CreatePipelineResponse) -- | The name of the pipeline. createPipelineResponse_pipelineName :: Lens.Lens' CreatePipelineResponse (Prelude.Maybe Prelude.Text) createPipelineResponse_pipelineName = Lens.lens (\CreatePipelineResponse' {pipelineName} -> pipelineName) (\s@CreatePipelineResponse' {} a -> s {pipelineName = a} :: CreatePipelineResponse) -- | The response's http status code. createPipelineResponse_httpStatus :: Lens.Lens' CreatePipelineResponse Prelude.Int createPipelineResponse_httpStatus = Lens.lens (\CreatePipelineResponse' {httpStatus} -> httpStatus) (\s@CreatePipelineResponse' {} a -> s {httpStatus = a} :: CreatePipelineResponse) instance Prelude.NFData CreatePipelineResponse where rnf CreatePipelineResponse' {..} = Prelude.rnf pipelineArn `Prelude.seq` Prelude.rnf pipelineName `Prelude.seq` Prelude.rnf httpStatus