{-# 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.DataSync.CreateTask
-- 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 task.
--
-- A task includes a source location and a destination location, and a
-- configuration that specifies how data is transferred. A task always
-- transfers data from the source location to the destination location. The
-- configuration specifies options such as task scheduling, bandwidth
-- limits, etc. A task is the complete definition of a data transfer.
--
-- When you create a task that transfers data between Amazon Web Services
-- services in different Amazon Web Services Regions, one of the two
-- locations that you specify must reside in the Region where DataSync is
-- being used. The other location must be specified in a different Region.
--
-- You can transfer data between commercial Amazon Web Services Regions
-- except for China, or between Amazon Web Services GovCloud (US) Regions.
--
-- When you use DataSync to copy files or objects between Amazon Web
-- Services Regions, you pay for data transfer between Regions. This is
-- billed as data transfer OUT from your source Region to your destination
-- Region. For more information, see
-- <http://aws.amazon.com/ec2/pricing/on-demand/#Data_Transfer Data Transfer pricing>.
module Amazonka.DataSync.CreateTask
  ( -- * Creating a Request
    CreateTask (..),
    newCreateTask,

    -- * Request Lenses
    createTask_schedule,
    createTask_includes,
    createTask_name,
    createTask_excludes,
    createTask_options,
    createTask_cloudWatchLogGroupArn,
    createTask_tags,
    createTask_sourceLocationArn,
    createTask_destinationLocationArn,

    -- * Destructuring the Response
    CreateTaskResponse (..),
    newCreateTaskResponse,

    -- * Response Lenses
    createTaskResponse_taskArn,
    createTaskResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import Amazonka.DataSync.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

-- | CreateTaskRequest
--
-- /See:/ 'newCreateTask' smart constructor.
data CreateTask = CreateTask'
  { -- | Specifies a schedule used to periodically transfer files from a source
    -- to a destination location. The schedule should be specified in UTC time.
    -- For more information, see
    -- <https://docs.aws.amazon.com/datasync/latest/userguide/task-scheduling.html Scheduling your task>.
    CreateTask -> Maybe TaskSchedule
schedule :: Prelude.Maybe TaskSchedule,
    -- | A list of filter rules that determines which files to include when
    -- running a task. The pattern should contain a single filter string that
    -- consists of the patterns to include. The patterns are delimited by \"|\"
    -- (that is, a pipe). For example: @\"\/folder1|\/folder2@\"
    CreateTask -> Maybe [FilterRule]
includes :: Prelude.Maybe [FilterRule],
    -- | The name of a task. This value is a text reference that is used to
    -- identify the task in the console.
    CreateTask -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | A list of filter rules that determines which files to exclude from a
    -- task. The list should contain a single filter string that consists of
    -- the patterns to exclude. The patterns are delimited by \"|\" (that is, a
    -- pipe), for example, @\"\/folder1|\/folder2\"@.
    CreateTask -> Maybe [FilterRule]
excludes :: Prelude.Maybe [FilterRule],
    -- | The set of configuration options that control the behavior of a single
    -- execution of the task that occurs when you call @StartTaskExecution@.
    -- You can configure these options to preserve metadata such as user ID
    -- (UID) and group ID (GID), file permissions, data integrity verification,
    -- and so on.
    --
    -- For each individual task execution, you can override these options by
    -- specifying the @OverrideOptions@ before starting the task execution. For
    -- more information, see the
    -- <https://docs.aws.amazon.com/datasync/latest/userguide/API_StartTaskExecution.html StartTaskExecution>
    -- operation.
    CreateTask -> Maybe Options
options :: Prelude.Maybe Options,
    -- | The Amazon Resource Name (ARN) of the Amazon CloudWatch log group that
    -- is used to monitor and log events in the task.
    CreateTask -> Maybe Text
cloudWatchLogGroupArn :: Prelude.Maybe Prelude.Text,
    -- | The key-value pair that represents the tag that you want to add to the
    -- resource. The value can be an empty string.
    CreateTask -> Maybe [TagListEntry]
tags :: Prelude.Maybe [TagListEntry],
    -- | The Amazon Resource Name (ARN) of the source location for the task.
    CreateTask -> Text
sourceLocationArn :: Prelude.Text,
    -- | The Amazon Resource Name (ARN) of an Amazon Web Services storage
    -- resource\'s location.
    CreateTask -> Text
destinationLocationArn :: Prelude.Text
  }
  deriving (CreateTask -> CreateTask -> Bool
(CreateTask -> CreateTask -> Bool)
-> (CreateTask -> CreateTask -> Bool) -> Eq CreateTask
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateTask -> CreateTask -> Bool
$c/= :: CreateTask -> CreateTask -> Bool
== :: CreateTask -> CreateTask -> Bool
$c== :: CreateTask -> CreateTask -> Bool
Prelude.Eq, ReadPrec [CreateTask]
ReadPrec CreateTask
Int -> ReadS CreateTask
ReadS [CreateTask]
(Int -> ReadS CreateTask)
-> ReadS [CreateTask]
-> ReadPrec CreateTask
-> ReadPrec [CreateTask]
-> Read CreateTask
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateTask]
$creadListPrec :: ReadPrec [CreateTask]
readPrec :: ReadPrec CreateTask
$creadPrec :: ReadPrec CreateTask
readList :: ReadS [CreateTask]
$creadList :: ReadS [CreateTask]
readsPrec :: Int -> ReadS CreateTask
$creadsPrec :: Int -> ReadS CreateTask
Prelude.Read, Int -> CreateTask -> ShowS
[CreateTask] -> ShowS
CreateTask -> String
(Int -> CreateTask -> ShowS)
-> (CreateTask -> String)
-> ([CreateTask] -> ShowS)
-> Show CreateTask
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateTask] -> ShowS
$cshowList :: [CreateTask] -> ShowS
show :: CreateTask -> String
$cshow :: CreateTask -> String
showsPrec :: Int -> CreateTask -> ShowS
$cshowsPrec :: Int -> CreateTask -> ShowS
Prelude.Show, (forall x. CreateTask -> Rep CreateTask x)
-> (forall x. Rep CreateTask x -> CreateTask) -> Generic CreateTask
forall x. Rep CreateTask x -> CreateTask
forall x. CreateTask -> Rep CreateTask x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateTask x -> CreateTask
$cfrom :: forall x. CreateTask -> Rep CreateTask x
Prelude.Generic)

-- |
-- Create a value of 'CreateTask' 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:
--
-- 'schedule', 'createTask_schedule' - Specifies a schedule used to periodically transfer files from a source
-- to a destination location. The schedule should be specified in UTC time.
-- For more information, see
-- <https://docs.aws.amazon.com/datasync/latest/userguide/task-scheduling.html Scheduling your task>.
--
-- 'includes', 'createTask_includes' - A list of filter rules that determines which files to include when
-- running a task. The pattern should contain a single filter string that
-- consists of the patterns to include. The patterns are delimited by \"|\"
-- (that is, a pipe). For example: @\"\/folder1|\/folder2@\"
--
-- 'name', 'createTask_name' - The name of a task. This value is a text reference that is used to
-- identify the task in the console.
--
-- 'excludes', 'createTask_excludes' - A list of filter rules that determines which files to exclude from a
-- task. The list should contain a single filter string that consists of
-- the patterns to exclude. The patterns are delimited by \"|\" (that is, a
-- pipe), for example, @\"\/folder1|\/folder2\"@.
--
-- 'options', 'createTask_options' - The set of configuration options that control the behavior of a single
-- execution of the task that occurs when you call @StartTaskExecution@.
-- You can configure these options to preserve metadata such as user ID
-- (UID) and group ID (GID), file permissions, data integrity verification,
-- and so on.
--
-- For each individual task execution, you can override these options by
-- specifying the @OverrideOptions@ before starting the task execution. For
-- more information, see the
-- <https://docs.aws.amazon.com/datasync/latest/userguide/API_StartTaskExecution.html StartTaskExecution>
-- operation.
--
-- 'cloudWatchLogGroupArn', 'createTask_cloudWatchLogGroupArn' - The Amazon Resource Name (ARN) of the Amazon CloudWatch log group that
-- is used to monitor and log events in the task.
--
-- 'tags', 'createTask_tags' - The key-value pair that represents the tag that you want to add to the
-- resource. The value can be an empty string.
--
-- 'sourceLocationArn', 'createTask_sourceLocationArn' - The Amazon Resource Name (ARN) of the source location for the task.
--
-- 'destinationLocationArn', 'createTask_destinationLocationArn' - The Amazon Resource Name (ARN) of an Amazon Web Services storage
-- resource\'s location.
newCreateTask ::
  -- | 'sourceLocationArn'
  Prelude.Text ->
  -- | 'destinationLocationArn'
  Prelude.Text ->
  CreateTask
newCreateTask :: Text -> Text -> CreateTask
newCreateTask
  Text
pSourceLocationArn_
  Text
pDestinationLocationArn_ =
    CreateTask' :: Maybe TaskSchedule
-> Maybe [FilterRule]
-> Maybe Text
-> Maybe [FilterRule]
-> Maybe Options
-> Maybe Text
-> Maybe [TagListEntry]
-> Text
-> Text
-> CreateTask
CreateTask'
      { $sel:schedule:CreateTask' :: Maybe TaskSchedule
schedule = Maybe TaskSchedule
forall a. Maybe a
Prelude.Nothing,
        $sel:includes:CreateTask' :: Maybe [FilterRule]
includes = Maybe [FilterRule]
forall a. Maybe a
Prelude.Nothing,
        $sel:name:CreateTask' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:excludes:CreateTask' :: Maybe [FilterRule]
excludes = Maybe [FilterRule]
forall a. Maybe a
Prelude.Nothing,
        $sel:options:CreateTask' :: Maybe Options
options = Maybe Options
forall a. Maybe a
Prelude.Nothing,
        $sel:cloudWatchLogGroupArn:CreateTask' :: Maybe Text
cloudWatchLogGroupArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:tags:CreateTask' :: Maybe [TagListEntry]
tags = Maybe [TagListEntry]
forall a. Maybe a
Prelude.Nothing,
        $sel:sourceLocationArn:CreateTask' :: Text
sourceLocationArn = Text
pSourceLocationArn_,
        $sel:destinationLocationArn:CreateTask' :: Text
destinationLocationArn = Text
pDestinationLocationArn_
      }

-- | Specifies a schedule used to periodically transfer files from a source
-- to a destination location. The schedule should be specified in UTC time.
-- For more information, see
-- <https://docs.aws.amazon.com/datasync/latest/userguide/task-scheduling.html Scheduling your task>.
createTask_schedule :: Lens.Lens' CreateTask (Prelude.Maybe TaskSchedule)
createTask_schedule :: (Maybe TaskSchedule -> f (Maybe TaskSchedule))
-> CreateTask -> f CreateTask
createTask_schedule = (CreateTask -> Maybe TaskSchedule)
-> (CreateTask -> Maybe TaskSchedule -> CreateTask)
-> Lens
     CreateTask CreateTask (Maybe TaskSchedule) (Maybe TaskSchedule)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateTask' {Maybe TaskSchedule
schedule :: Maybe TaskSchedule
$sel:schedule:CreateTask' :: CreateTask -> Maybe TaskSchedule
schedule} -> Maybe TaskSchedule
schedule) (\s :: CreateTask
s@CreateTask' {} Maybe TaskSchedule
a -> CreateTask
s {$sel:schedule:CreateTask' :: Maybe TaskSchedule
schedule = Maybe TaskSchedule
a} :: CreateTask)

-- | A list of filter rules that determines which files to include when
-- running a task. The pattern should contain a single filter string that
-- consists of the patterns to include. The patterns are delimited by \"|\"
-- (that is, a pipe). For example: @\"\/folder1|\/folder2@\"
createTask_includes :: Lens.Lens' CreateTask (Prelude.Maybe [FilterRule])
createTask_includes :: (Maybe [FilterRule] -> f (Maybe [FilterRule]))
-> CreateTask -> f CreateTask
createTask_includes = (CreateTask -> Maybe [FilterRule])
-> (CreateTask -> Maybe [FilterRule] -> CreateTask)
-> Lens
     CreateTask CreateTask (Maybe [FilterRule]) (Maybe [FilterRule])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateTask' {Maybe [FilterRule]
includes :: Maybe [FilterRule]
$sel:includes:CreateTask' :: CreateTask -> Maybe [FilterRule]
includes} -> Maybe [FilterRule]
includes) (\s :: CreateTask
s@CreateTask' {} Maybe [FilterRule]
a -> CreateTask
s {$sel:includes:CreateTask' :: Maybe [FilterRule]
includes = Maybe [FilterRule]
a} :: CreateTask) ((Maybe [FilterRule] -> f (Maybe [FilterRule]))
 -> CreateTask -> f CreateTask)
-> ((Maybe [FilterRule] -> f (Maybe [FilterRule]))
    -> Maybe [FilterRule] -> f (Maybe [FilterRule]))
-> (Maybe [FilterRule] -> f (Maybe [FilterRule]))
-> CreateTask
-> f CreateTask
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [FilterRule] [FilterRule] [FilterRule] [FilterRule]
-> Iso
     (Maybe [FilterRule])
     (Maybe [FilterRule])
     (Maybe [FilterRule])
     (Maybe [FilterRule])
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 [FilterRule] [FilterRule] [FilterRule] [FilterRule]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The name of a task. This value is a text reference that is used to
-- identify the task in the console.
createTask_name :: Lens.Lens' CreateTask (Prelude.Maybe Prelude.Text)
createTask_name :: (Maybe Text -> f (Maybe Text)) -> CreateTask -> f CreateTask
createTask_name = (CreateTask -> Maybe Text)
-> (CreateTask -> Maybe Text -> CreateTask)
-> Lens CreateTask CreateTask (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateTask' {Maybe Text
name :: Maybe Text
$sel:name:CreateTask' :: CreateTask -> Maybe Text
name} -> Maybe Text
name) (\s :: CreateTask
s@CreateTask' {} Maybe Text
a -> CreateTask
s {$sel:name:CreateTask' :: Maybe Text
name = Maybe Text
a} :: CreateTask)

-- | A list of filter rules that determines which files to exclude from a
-- task. The list should contain a single filter string that consists of
-- the patterns to exclude. The patterns are delimited by \"|\" (that is, a
-- pipe), for example, @\"\/folder1|\/folder2\"@.
createTask_excludes :: Lens.Lens' CreateTask (Prelude.Maybe [FilterRule])
createTask_excludes :: (Maybe [FilterRule] -> f (Maybe [FilterRule]))
-> CreateTask -> f CreateTask
createTask_excludes = (CreateTask -> Maybe [FilterRule])
-> (CreateTask -> Maybe [FilterRule] -> CreateTask)
-> Lens
     CreateTask CreateTask (Maybe [FilterRule]) (Maybe [FilterRule])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateTask' {Maybe [FilterRule]
excludes :: Maybe [FilterRule]
$sel:excludes:CreateTask' :: CreateTask -> Maybe [FilterRule]
excludes} -> Maybe [FilterRule]
excludes) (\s :: CreateTask
s@CreateTask' {} Maybe [FilterRule]
a -> CreateTask
s {$sel:excludes:CreateTask' :: Maybe [FilterRule]
excludes = Maybe [FilterRule]
a} :: CreateTask) ((Maybe [FilterRule] -> f (Maybe [FilterRule]))
 -> CreateTask -> f CreateTask)
-> ((Maybe [FilterRule] -> f (Maybe [FilterRule]))
    -> Maybe [FilterRule] -> f (Maybe [FilterRule]))
-> (Maybe [FilterRule] -> f (Maybe [FilterRule]))
-> CreateTask
-> f CreateTask
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [FilterRule] [FilterRule] [FilterRule] [FilterRule]
-> Iso
     (Maybe [FilterRule])
     (Maybe [FilterRule])
     (Maybe [FilterRule])
     (Maybe [FilterRule])
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 [FilterRule] [FilterRule] [FilterRule] [FilterRule]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The set of configuration options that control the behavior of a single
-- execution of the task that occurs when you call @StartTaskExecution@.
-- You can configure these options to preserve metadata such as user ID
-- (UID) and group ID (GID), file permissions, data integrity verification,
-- and so on.
--
-- For each individual task execution, you can override these options by
-- specifying the @OverrideOptions@ before starting the task execution. For
-- more information, see the
-- <https://docs.aws.amazon.com/datasync/latest/userguide/API_StartTaskExecution.html StartTaskExecution>
-- operation.
createTask_options :: Lens.Lens' CreateTask (Prelude.Maybe Options)
createTask_options :: (Maybe Options -> f (Maybe Options)) -> CreateTask -> f CreateTask
createTask_options = (CreateTask -> Maybe Options)
-> (CreateTask -> Maybe Options -> CreateTask)
-> Lens CreateTask CreateTask (Maybe Options) (Maybe Options)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateTask' {Maybe Options
options :: Maybe Options
$sel:options:CreateTask' :: CreateTask -> Maybe Options
options} -> Maybe Options
options) (\s :: CreateTask
s@CreateTask' {} Maybe Options
a -> CreateTask
s {$sel:options:CreateTask' :: Maybe Options
options = Maybe Options
a} :: CreateTask)

-- | The Amazon Resource Name (ARN) of the Amazon CloudWatch log group that
-- is used to monitor and log events in the task.
createTask_cloudWatchLogGroupArn :: Lens.Lens' CreateTask (Prelude.Maybe Prelude.Text)
createTask_cloudWatchLogGroupArn :: (Maybe Text -> f (Maybe Text)) -> CreateTask -> f CreateTask
createTask_cloudWatchLogGroupArn = (CreateTask -> Maybe Text)
-> (CreateTask -> Maybe Text -> CreateTask)
-> Lens CreateTask CreateTask (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateTask' {Maybe Text
cloudWatchLogGroupArn :: Maybe Text
$sel:cloudWatchLogGroupArn:CreateTask' :: CreateTask -> Maybe Text
cloudWatchLogGroupArn} -> Maybe Text
cloudWatchLogGroupArn) (\s :: CreateTask
s@CreateTask' {} Maybe Text
a -> CreateTask
s {$sel:cloudWatchLogGroupArn:CreateTask' :: Maybe Text
cloudWatchLogGroupArn = Maybe Text
a} :: CreateTask)

-- | The key-value pair that represents the tag that you want to add to the
-- resource. The value can be an empty string.
createTask_tags :: Lens.Lens' CreateTask (Prelude.Maybe [TagListEntry])
createTask_tags :: (Maybe [TagListEntry] -> f (Maybe [TagListEntry]))
-> CreateTask -> f CreateTask
createTask_tags = (CreateTask -> Maybe [TagListEntry])
-> (CreateTask -> Maybe [TagListEntry] -> CreateTask)
-> Lens
     CreateTask CreateTask (Maybe [TagListEntry]) (Maybe [TagListEntry])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateTask' {Maybe [TagListEntry]
tags :: Maybe [TagListEntry]
$sel:tags:CreateTask' :: CreateTask -> Maybe [TagListEntry]
tags} -> Maybe [TagListEntry]
tags) (\s :: CreateTask
s@CreateTask' {} Maybe [TagListEntry]
a -> CreateTask
s {$sel:tags:CreateTask' :: Maybe [TagListEntry]
tags = Maybe [TagListEntry]
a} :: CreateTask) ((Maybe [TagListEntry] -> f (Maybe [TagListEntry]))
 -> CreateTask -> f CreateTask)
-> ((Maybe [TagListEntry] -> f (Maybe [TagListEntry]))
    -> Maybe [TagListEntry] -> f (Maybe [TagListEntry]))
-> (Maybe [TagListEntry] -> f (Maybe [TagListEntry]))
-> CreateTask
-> f CreateTask
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [TagListEntry] [TagListEntry] [TagListEntry] [TagListEntry]
-> Iso
     (Maybe [TagListEntry])
     (Maybe [TagListEntry])
     (Maybe [TagListEntry])
     (Maybe [TagListEntry])
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 [TagListEntry] [TagListEntry] [TagListEntry] [TagListEntry]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The Amazon Resource Name (ARN) of the source location for the task.
createTask_sourceLocationArn :: Lens.Lens' CreateTask Prelude.Text
createTask_sourceLocationArn :: (Text -> f Text) -> CreateTask -> f CreateTask
createTask_sourceLocationArn = (CreateTask -> Text)
-> (CreateTask -> Text -> CreateTask)
-> Lens CreateTask CreateTask Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateTask' {Text
sourceLocationArn :: Text
$sel:sourceLocationArn:CreateTask' :: CreateTask -> Text
sourceLocationArn} -> Text
sourceLocationArn) (\s :: CreateTask
s@CreateTask' {} Text
a -> CreateTask
s {$sel:sourceLocationArn:CreateTask' :: Text
sourceLocationArn = Text
a} :: CreateTask)

-- | The Amazon Resource Name (ARN) of an Amazon Web Services storage
-- resource\'s location.
createTask_destinationLocationArn :: Lens.Lens' CreateTask Prelude.Text
createTask_destinationLocationArn :: (Text -> f Text) -> CreateTask -> f CreateTask
createTask_destinationLocationArn = (CreateTask -> Text)
-> (CreateTask -> Text -> CreateTask)
-> Lens CreateTask CreateTask Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateTask' {Text
destinationLocationArn :: Text
$sel:destinationLocationArn:CreateTask' :: CreateTask -> Text
destinationLocationArn} -> Text
destinationLocationArn) (\s :: CreateTask
s@CreateTask' {} Text
a -> CreateTask
s {$sel:destinationLocationArn:CreateTask' :: Text
destinationLocationArn = Text
a} :: CreateTask)

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

instance Prelude.NFData CreateTask

instance Core.ToHeaders CreateTask where
  toHeaders :: CreateTask -> ResponseHeaders
toHeaders =
    ResponseHeaders -> CreateTask -> 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
"FmrsService.CreateTask" :: 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 CreateTask where
  toJSON :: CreateTask -> Value
toJSON CreateTask' {Maybe [FilterRule]
Maybe [TagListEntry]
Maybe Text
Maybe TaskSchedule
Maybe Options
Text
destinationLocationArn :: Text
sourceLocationArn :: Text
tags :: Maybe [TagListEntry]
cloudWatchLogGroupArn :: Maybe Text
options :: Maybe Options
excludes :: Maybe [FilterRule]
name :: Maybe Text
includes :: Maybe [FilterRule]
schedule :: Maybe TaskSchedule
$sel:destinationLocationArn:CreateTask' :: CreateTask -> Text
$sel:sourceLocationArn:CreateTask' :: CreateTask -> Text
$sel:tags:CreateTask' :: CreateTask -> Maybe [TagListEntry]
$sel:cloudWatchLogGroupArn:CreateTask' :: CreateTask -> Maybe Text
$sel:options:CreateTask' :: CreateTask -> Maybe Options
$sel:excludes:CreateTask' :: CreateTask -> Maybe [FilterRule]
$sel:name:CreateTask' :: CreateTask -> Maybe Text
$sel:includes:CreateTask' :: CreateTask -> Maybe [FilterRule]
$sel:schedule:CreateTask' :: CreateTask -> Maybe TaskSchedule
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"Schedule" Text -> TaskSchedule -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (TaskSchedule -> Pair) -> Maybe TaskSchedule -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe TaskSchedule
schedule,
            (Text
"Includes" Text -> [FilterRule] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([FilterRule] -> Pair) -> Maybe [FilterRule] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [FilterRule]
includes,
            (Text
"Name" 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
name,
            (Text
"Excludes" Text -> [FilterRule] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([FilterRule] -> Pair) -> Maybe [FilterRule] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [FilterRule]
excludes,
            (Text
"Options" Text -> Options -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Options -> Pair) -> Maybe Options -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Options
options,
            (Text
"CloudWatchLogGroupArn" 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
cloudWatchLogGroupArn,
            (Text
"Tags" Text -> [TagListEntry] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([TagListEntry] -> Pair) -> Maybe [TagListEntry] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [TagListEntry]
tags,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"SourceLocationArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
sourceLocationArn),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              ( Text
"DestinationLocationArn"
                  Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
destinationLocationArn
              )
          ]
      )

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

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

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

-- |
-- Create a value of 'CreateTaskResponse' 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:
--
-- 'taskArn', 'createTaskResponse_taskArn' - The Amazon Resource Name (ARN) of the task.
--
-- 'httpStatus', 'createTaskResponse_httpStatus' - The response's http status code.
newCreateTaskResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  CreateTaskResponse
newCreateTaskResponse :: Int -> CreateTaskResponse
newCreateTaskResponse Int
pHttpStatus_ =
  CreateTaskResponse' :: Maybe Text -> Int -> CreateTaskResponse
CreateTaskResponse'
    { $sel:taskArn:CreateTaskResponse' :: Maybe Text
taskArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:CreateTaskResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The Amazon Resource Name (ARN) of the task.
createTaskResponse_taskArn :: Lens.Lens' CreateTaskResponse (Prelude.Maybe Prelude.Text)
createTaskResponse_taskArn :: (Maybe Text -> f (Maybe Text))
-> CreateTaskResponse -> f CreateTaskResponse
createTaskResponse_taskArn = (CreateTaskResponse -> Maybe Text)
-> (CreateTaskResponse -> Maybe Text -> CreateTaskResponse)
-> Lens
     CreateTaskResponse CreateTaskResponse (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateTaskResponse' {Maybe Text
taskArn :: Maybe Text
$sel:taskArn:CreateTaskResponse' :: CreateTaskResponse -> Maybe Text
taskArn} -> Maybe Text
taskArn) (\s :: CreateTaskResponse
s@CreateTaskResponse' {} Maybe Text
a -> CreateTaskResponse
s {$sel:taskArn:CreateTaskResponse' :: Maybe Text
taskArn = Maybe Text
a} :: CreateTaskResponse)

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

instance Prelude.NFData CreateTaskResponse