{-# 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.LexModels.StartImport
-- 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)
--
-- Starts a job to import a resource to Amazon Lex.
module Amazonka.LexModels.StartImport
  ( -- * Creating a Request
    StartImport (..),
    newStartImport,

    -- * Request Lenses
    startImport_tags,
    startImport_payload,
    startImport_resourceType,
    startImport_mergeStrategy,

    -- * Destructuring the Response
    StartImportResponse (..),
    newStartImportResponse,

    -- * Response Lenses
    startImportResponse_resourceType,
    startImportResponse_importId,
    startImportResponse_createdDate,
    startImportResponse_name,
    startImportResponse_mergeStrategy,
    startImportResponse_importStatus,
    startImportResponse_tags,
    startImportResponse_httpStatus,
  )
where

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

-- | /See:/ 'newStartImport' smart constructor.
data StartImport = StartImport'
  { -- | A list of tags to add to the imported bot. You can only add tags when
    -- you import a bot, you can\'t add tags to an intent or slot type.
    StartImport -> Maybe [Tag]
tags :: Prelude.Maybe [Tag],
    -- | A zip archive in binary format. The archive should contain one file, a
    -- JSON file containing the resource to import. The resource should match
    -- the type specified in the @resourceType@ field.
    StartImport -> Base64
payload :: Core.Base64,
    -- | Specifies the type of resource to export. Each resource also exports any
    -- resources that it depends on.
    --
    -- -   A bot exports dependent intents.
    --
    -- -   An intent exports dependent slot types.
    StartImport -> ResourceType
resourceType :: ResourceType,
    -- | Specifies the action that the @StartImport@ operation should take when
    -- there is an existing resource with the same name.
    --
    -- -   FAIL_ON_CONFLICT - The import operation is stopped on the first
    --     conflict between a resource in the import file and an existing
    --     resource. The name of the resource causing the conflict is in the
    --     @failureReason@ field of the response to the @GetImport@ operation.
    --
    --     OVERWRITE_LATEST - The import operation proceeds even if there is a
    --     conflict with an existing resource. The $LASTEST version of the
    --     existing resource is overwritten with the data from the import file.
    StartImport -> MergeStrategy
mergeStrategy :: MergeStrategy
  }
  deriving (StartImport -> StartImport -> Bool
(StartImport -> StartImport -> Bool)
-> (StartImport -> StartImport -> Bool) -> Eq StartImport
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StartImport -> StartImport -> Bool
$c/= :: StartImport -> StartImport -> Bool
== :: StartImport -> StartImport -> Bool
$c== :: StartImport -> StartImport -> Bool
Prelude.Eq, ReadPrec [StartImport]
ReadPrec StartImport
Int -> ReadS StartImport
ReadS [StartImport]
(Int -> ReadS StartImport)
-> ReadS [StartImport]
-> ReadPrec StartImport
-> ReadPrec [StartImport]
-> Read StartImport
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StartImport]
$creadListPrec :: ReadPrec [StartImport]
readPrec :: ReadPrec StartImport
$creadPrec :: ReadPrec StartImport
readList :: ReadS [StartImport]
$creadList :: ReadS [StartImport]
readsPrec :: Int -> ReadS StartImport
$creadsPrec :: Int -> ReadS StartImport
Prelude.Read, Int -> StartImport -> ShowS
[StartImport] -> ShowS
StartImport -> String
(Int -> StartImport -> ShowS)
-> (StartImport -> String)
-> ([StartImport] -> ShowS)
-> Show StartImport
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StartImport] -> ShowS
$cshowList :: [StartImport] -> ShowS
show :: StartImport -> String
$cshow :: StartImport -> String
showsPrec :: Int -> StartImport -> ShowS
$cshowsPrec :: Int -> StartImport -> ShowS
Prelude.Show, (forall x. StartImport -> Rep StartImport x)
-> (forall x. Rep StartImport x -> StartImport)
-> Generic StartImport
forall x. Rep StartImport x -> StartImport
forall x. StartImport -> Rep StartImport x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StartImport x -> StartImport
$cfrom :: forall x. StartImport -> Rep StartImport x
Prelude.Generic)

-- |
-- Create a value of 'StartImport' 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:
--
-- 'tags', 'startImport_tags' - A list of tags to add to the imported bot. You can only add tags when
-- you import a bot, you can\'t add tags to an intent or slot type.
--
-- 'payload', 'startImport_payload' - A zip archive in binary format. The archive should contain one file, a
-- JSON file containing the resource to import. The resource should match
-- the type specified in the @resourceType@ field.--
-- -- /Note:/ This 'Lens' automatically encodes and decodes Base64 data.
-- -- The underlying isomorphism will encode to Base64 representation during
-- -- serialisation, and decode from Base64 representation during deserialisation.
-- -- This 'Lens' accepts and returns only raw unencoded data.
--
-- 'resourceType', 'startImport_resourceType' - Specifies the type of resource to export. Each resource also exports any
-- resources that it depends on.
--
-- -   A bot exports dependent intents.
--
-- -   An intent exports dependent slot types.
--
-- 'mergeStrategy', 'startImport_mergeStrategy' - Specifies the action that the @StartImport@ operation should take when
-- there is an existing resource with the same name.
--
-- -   FAIL_ON_CONFLICT - The import operation is stopped on the first
--     conflict between a resource in the import file and an existing
--     resource. The name of the resource causing the conflict is in the
--     @failureReason@ field of the response to the @GetImport@ operation.
--
--     OVERWRITE_LATEST - The import operation proceeds even if there is a
--     conflict with an existing resource. The $LASTEST version of the
--     existing resource is overwritten with the data from the import file.
newStartImport ::
  -- | 'payload'
  Prelude.ByteString ->
  -- | 'resourceType'
  ResourceType ->
  -- | 'mergeStrategy'
  MergeStrategy ->
  StartImport
newStartImport :: ByteString -> ResourceType -> MergeStrategy -> StartImport
newStartImport
  ByteString
pPayload_
  ResourceType
pResourceType_
  MergeStrategy
pMergeStrategy_ =
    StartImport' :: Maybe [Tag]
-> Base64 -> ResourceType -> MergeStrategy -> StartImport
StartImport'
      { $sel:tags:StartImport' :: Maybe [Tag]
tags = Maybe [Tag]
forall a. Maybe a
Prelude.Nothing,
        $sel:payload:StartImport' :: Base64
payload = Tagged ByteString (Identity ByteString)
-> Tagged Base64 (Identity Base64)
Iso' Base64 ByteString
Core._Base64 (Tagged ByteString (Identity ByteString)
 -> Tagged Base64 (Identity Base64))
-> ByteString -> Base64
forall t b. AReview t b -> b -> t
Lens.# ByteString
pPayload_,
        $sel:resourceType:StartImport' :: ResourceType
resourceType = ResourceType
pResourceType_,
        $sel:mergeStrategy:StartImport' :: MergeStrategy
mergeStrategy = MergeStrategy
pMergeStrategy_
      }

-- | A list of tags to add to the imported bot. You can only add tags when
-- you import a bot, you can\'t add tags to an intent or slot type.
startImport_tags :: Lens.Lens' StartImport (Prelude.Maybe [Tag])
startImport_tags :: (Maybe [Tag] -> f (Maybe [Tag])) -> StartImport -> f StartImport
startImport_tags = (StartImport -> Maybe [Tag])
-> (StartImport -> Maybe [Tag] -> StartImport)
-> Lens StartImport StartImport (Maybe [Tag]) (Maybe [Tag])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartImport' {Maybe [Tag]
tags :: Maybe [Tag]
$sel:tags:StartImport' :: StartImport -> Maybe [Tag]
tags} -> Maybe [Tag]
tags) (\s :: StartImport
s@StartImport' {} Maybe [Tag]
a -> StartImport
s {$sel:tags:StartImport' :: Maybe [Tag]
tags = Maybe [Tag]
a} :: StartImport) ((Maybe [Tag] -> f (Maybe [Tag])) -> StartImport -> f StartImport)
-> ((Maybe [Tag] -> f (Maybe [Tag]))
    -> Maybe [Tag] -> f (Maybe [Tag]))
-> (Maybe [Tag] -> f (Maybe [Tag]))
-> StartImport
-> f StartImport
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Tag] [Tag] [Tag] [Tag]
-> Iso (Maybe [Tag]) (Maybe [Tag]) (Maybe [Tag]) (Maybe [Tag])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso [Tag] [Tag] [Tag] [Tag]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | A zip archive in binary format. The archive should contain one file, a
-- JSON file containing the resource to import. The resource should match
-- the type specified in the @resourceType@ field.--
-- -- /Note:/ This 'Lens' automatically encodes and decodes Base64 data.
-- -- The underlying isomorphism will encode to Base64 representation during
-- -- serialisation, and decode from Base64 representation during deserialisation.
-- -- This 'Lens' accepts and returns only raw unencoded data.
startImport_payload :: Lens.Lens' StartImport Prelude.ByteString
startImport_payload :: (ByteString -> f ByteString) -> StartImport -> f StartImport
startImport_payload = (StartImport -> Base64)
-> (StartImport -> Base64 -> StartImport)
-> Lens StartImport StartImport Base64 Base64
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartImport' {Base64
payload :: Base64
$sel:payload:StartImport' :: StartImport -> Base64
payload} -> Base64
payload) (\s :: StartImport
s@StartImport' {} Base64
a -> StartImport
s {$sel:payload:StartImport' :: Base64
payload = Base64
a} :: StartImport) ((Base64 -> f Base64) -> StartImport -> f StartImport)
-> ((ByteString -> f ByteString) -> Base64 -> f Base64)
-> (ByteString -> f ByteString)
-> StartImport
-> f StartImport
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (ByteString -> f ByteString) -> Base64 -> f Base64
Iso' Base64 ByteString
Core._Base64

-- | Specifies the type of resource to export. Each resource also exports any
-- resources that it depends on.
--
-- -   A bot exports dependent intents.
--
-- -   An intent exports dependent slot types.
startImport_resourceType :: Lens.Lens' StartImport ResourceType
startImport_resourceType :: (ResourceType -> f ResourceType) -> StartImport -> f StartImport
startImport_resourceType = (StartImport -> ResourceType)
-> (StartImport -> ResourceType -> StartImport)
-> Lens StartImport StartImport ResourceType ResourceType
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartImport' {ResourceType
resourceType :: ResourceType
$sel:resourceType:StartImport' :: StartImport -> ResourceType
resourceType} -> ResourceType
resourceType) (\s :: StartImport
s@StartImport' {} ResourceType
a -> StartImport
s {$sel:resourceType:StartImport' :: ResourceType
resourceType = ResourceType
a} :: StartImport)

-- | Specifies the action that the @StartImport@ operation should take when
-- there is an existing resource with the same name.
--
-- -   FAIL_ON_CONFLICT - The import operation is stopped on the first
--     conflict between a resource in the import file and an existing
--     resource. The name of the resource causing the conflict is in the
--     @failureReason@ field of the response to the @GetImport@ operation.
--
--     OVERWRITE_LATEST - The import operation proceeds even if there is a
--     conflict with an existing resource. The $LASTEST version of the
--     existing resource is overwritten with the data from the import file.
startImport_mergeStrategy :: Lens.Lens' StartImport MergeStrategy
startImport_mergeStrategy :: (MergeStrategy -> f MergeStrategy) -> StartImport -> f StartImport
startImport_mergeStrategy = (StartImport -> MergeStrategy)
-> (StartImport -> MergeStrategy -> StartImport)
-> Lens StartImport StartImport MergeStrategy MergeStrategy
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartImport' {MergeStrategy
mergeStrategy :: MergeStrategy
$sel:mergeStrategy:StartImport' :: StartImport -> MergeStrategy
mergeStrategy} -> MergeStrategy
mergeStrategy) (\s :: StartImport
s@StartImport' {} MergeStrategy
a -> StartImport
s {$sel:mergeStrategy:StartImport' :: MergeStrategy
mergeStrategy = MergeStrategy
a} :: StartImport)

instance Core.AWSRequest StartImport where
  type AWSResponse StartImport = StartImportResponse
  request :: StartImport -> Request StartImport
request = Service -> StartImport -> Request StartImport
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy StartImport
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse StartImport)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse StartImport))
-> Logger
-> Service
-> Proxy StartImport
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse StartImport)))
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 ResourceType
-> Maybe Text
-> Maybe POSIX
-> Maybe Text
-> Maybe MergeStrategy
-> Maybe ImportStatus
-> Maybe [Tag]
-> Int
-> StartImportResponse
StartImportResponse'
            (Maybe ResourceType
 -> Maybe Text
 -> Maybe POSIX
 -> Maybe Text
 -> Maybe MergeStrategy
 -> Maybe ImportStatus
 -> Maybe [Tag]
 -> Int
 -> StartImportResponse)
-> Either String (Maybe ResourceType)
-> Either
     String
     (Maybe Text
      -> Maybe POSIX
      -> Maybe Text
      -> Maybe MergeStrategy
      -> Maybe ImportStatus
      -> Maybe [Tag]
      -> Int
      -> StartImportResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe ResourceType)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"resourceType")
            Either
  String
  (Maybe Text
   -> Maybe POSIX
   -> Maybe Text
   -> Maybe MergeStrategy
   -> Maybe ImportStatus
   -> Maybe [Tag]
   -> Int
   -> StartImportResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe POSIX
      -> Maybe Text
      -> Maybe MergeStrategy
      -> Maybe ImportStatus
      -> Maybe [Tag]
      -> Int
      -> StartImportResponse)
forall (f :: * -> *) a b. Applicative f => 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
"importId")
            Either
  String
  (Maybe POSIX
   -> Maybe Text
   -> Maybe MergeStrategy
   -> Maybe ImportStatus
   -> Maybe [Tag]
   -> Int
   -> StartImportResponse)
-> Either String (Maybe POSIX)
-> Either
     String
     (Maybe Text
      -> Maybe MergeStrategy
      -> Maybe ImportStatus
      -> Maybe [Tag]
      -> Int
      -> StartImportResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"createdDate")
            Either
  String
  (Maybe Text
   -> Maybe MergeStrategy
   -> Maybe ImportStatus
   -> Maybe [Tag]
   -> Int
   -> StartImportResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe MergeStrategy
      -> Maybe ImportStatus -> Maybe [Tag] -> Int -> StartImportResponse)
forall (f :: * -> *) a b. Applicative f => 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
"name")
            Either
  String
  (Maybe MergeStrategy
   -> Maybe ImportStatus -> Maybe [Tag] -> Int -> StartImportResponse)
-> Either String (Maybe MergeStrategy)
-> Either
     String
     (Maybe ImportStatus -> Maybe [Tag] -> Int -> StartImportResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe MergeStrategy)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"mergeStrategy")
            Either
  String
  (Maybe ImportStatus -> Maybe [Tag] -> Int -> StartImportResponse)
-> Either String (Maybe ImportStatus)
-> Either String (Maybe [Tag] -> Int -> StartImportResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe ImportStatus)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"importStatus")
            Either String (Maybe [Tag] -> Int -> StartImportResponse)
-> Either String (Maybe [Tag])
-> Either String (Int -> StartImportResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe (Maybe [Tag]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"tags" Either String (Maybe (Maybe [Tag]))
-> Maybe [Tag] -> Either String (Maybe [Tag])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [Tag]
forall a. Monoid a => a
Prelude.mempty)
            Either String (Int -> StartImportResponse)
-> Either String Int -> Either String StartImportResponse
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 StartImport

instance Prelude.NFData StartImport

instance Core.ToHeaders StartImport where
  toHeaders :: StartImport -> ResponseHeaders
toHeaders =
    ResponseHeaders -> StartImport -> 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 StartImport where
  toJSON :: StartImport -> Value
toJSON StartImport' {Maybe [Tag]
Base64
MergeStrategy
ResourceType
mergeStrategy :: MergeStrategy
resourceType :: ResourceType
payload :: Base64
tags :: Maybe [Tag]
$sel:mergeStrategy:StartImport' :: StartImport -> MergeStrategy
$sel:resourceType:StartImport' :: StartImport -> ResourceType
$sel:payload:StartImport' :: StartImport -> Base64
$sel:tags:StartImport' :: StartImport -> Maybe [Tag]
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"tags" Text -> [Tag] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([Tag] -> Pair) -> Maybe [Tag] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Tag]
tags,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"payload" Text -> Base64 -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Base64
payload),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"resourceType" Text -> ResourceType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= ResourceType
resourceType),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"mergeStrategy" Text -> MergeStrategy -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= MergeStrategy
mergeStrategy)
          ]
      )

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

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

-- | /See:/ 'newStartImportResponse' smart constructor.
data StartImportResponse = StartImportResponse'
  { -- | The type of resource to import.
    StartImportResponse -> Maybe ResourceType
resourceType :: Prelude.Maybe ResourceType,
    -- | The identifier for the specific import job.
    StartImportResponse -> Maybe Text
importId :: Prelude.Maybe Prelude.Text,
    -- | A timestamp for the date and time that the import job was requested.
    StartImportResponse -> Maybe POSIX
createdDate :: Prelude.Maybe Core.POSIX,
    -- | The name given to the import job.
    StartImportResponse -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The action to take when there is a merge conflict.
    StartImportResponse -> Maybe MergeStrategy
mergeStrategy :: Prelude.Maybe MergeStrategy,
    -- | The status of the import job. If the status is @FAILED@, you can get the
    -- reason for the failure using the @GetImport@ operation.
    StartImportResponse -> Maybe ImportStatus
importStatus :: Prelude.Maybe ImportStatus,
    -- | A list of tags added to the imported bot.
    StartImportResponse -> Maybe [Tag]
tags :: Prelude.Maybe [Tag],
    -- | The response's http status code.
    StartImportResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (StartImportResponse -> StartImportResponse -> Bool
(StartImportResponse -> StartImportResponse -> Bool)
-> (StartImportResponse -> StartImportResponse -> Bool)
-> Eq StartImportResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StartImportResponse -> StartImportResponse -> Bool
$c/= :: StartImportResponse -> StartImportResponse -> Bool
== :: StartImportResponse -> StartImportResponse -> Bool
$c== :: StartImportResponse -> StartImportResponse -> Bool
Prelude.Eq, ReadPrec [StartImportResponse]
ReadPrec StartImportResponse
Int -> ReadS StartImportResponse
ReadS [StartImportResponse]
(Int -> ReadS StartImportResponse)
-> ReadS [StartImportResponse]
-> ReadPrec StartImportResponse
-> ReadPrec [StartImportResponse]
-> Read StartImportResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StartImportResponse]
$creadListPrec :: ReadPrec [StartImportResponse]
readPrec :: ReadPrec StartImportResponse
$creadPrec :: ReadPrec StartImportResponse
readList :: ReadS [StartImportResponse]
$creadList :: ReadS [StartImportResponse]
readsPrec :: Int -> ReadS StartImportResponse
$creadsPrec :: Int -> ReadS StartImportResponse
Prelude.Read, Int -> StartImportResponse -> ShowS
[StartImportResponse] -> ShowS
StartImportResponse -> String
(Int -> StartImportResponse -> ShowS)
-> (StartImportResponse -> String)
-> ([StartImportResponse] -> ShowS)
-> Show StartImportResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StartImportResponse] -> ShowS
$cshowList :: [StartImportResponse] -> ShowS
show :: StartImportResponse -> String
$cshow :: StartImportResponse -> String
showsPrec :: Int -> StartImportResponse -> ShowS
$cshowsPrec :: Int -> StartImportResponse -> ShowS
Prelude.Show, (forall x. StartImportResponse -> Rep StartImportResponse x)
-> (forall x. Rep StartImportResponse x -> StartImportResponse)
-> Generic StartImportResponse
forall x. Rep StartImportResponse x -> StartImportResponse
forall x. StartImportResponse -> Rep StartImportResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StartImportResponse x -> StartImportResponse
$cfrom :: forall x. StartImportResponse -> Rep StartImportResponse x
Prelude.Generic)

-- |
-- Create a value of 'StartImportResponse' 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:
--
-- 'resourceType', 'startImportResponse_resourceType' - The type of resource to import.
--
-- 'importId', 'startImportResponse_importId' - The identifier for the specific import job.
--
-- 'createdDate', 'startImportResponse_createdDate' - A timestamp for the date and time that the import job was requested.
--
-- 'name', 'startImportResponse_name' - The name given to the import job.
--
-- 'mergeStrategy', 'startImportResponse_mergeStrategy' - The action to take when there is a merge conflict.
--
-- 'importStatus', 'startImportResponse_importStatus' - The status of the import job. If the status is @FAILED@, you can get the
-- reason for the failure using the @GetImport@ operation.
--
-- 'tags', 'startImportResponse_tags' - A list of tags added to the imported bot.
--
-- 'httpStatus', 'startImportResponse_httpStatus' - The response's http status code.
newStartImportResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  StartImportResponse
newStartImportResponse :: Int -> StartImportResponse
newStartImportResponse Int
pHttpStatus_ =
  StartImportResponse' :: Maybe ResourceType
-> Maybe Text
-> Maybe POSIX
-> Maybe Text
-> Maybe MergeStrategy
-> Maybe ImportStatus
-> Maybe [Tag]
-> Int
-> StartImportResponse
StartImportResponse'
    { $sel:resourceType:StartImportResponse' :: Maybe ResourceType
resourceType =
        Maybe ResourceType
forall a. Maybe a
Prelude.Nothing,
      $sel:importId:StartImportResponse' :: Maybe Text
importId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:createdDate:StartImportResponse' :: Maybe POSIX
createdDate = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:name:StartImportResponse' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:mergeStrategy:StartImportResponse' :: Maybe MergeStrategy
mergeStrategy = Maybe MergeStrategy
forall a. Maybe a
Prelude.Nothing,
      $sel:importStatus:StartImportResponse' :: Maybe ImportStatus
importStatus = Maybe ImportStatus
forall a. Maybe a
Prelude.Nothing,
      $sel:tags:StartImportResponse' :: Maybe [Tag]
tags = Maybe [Tag]
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:StartImportResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The type of resource to import.
startImportResponse_resourceType :: Lens.Lens' StartImportResponse (Prelude.Maybe ResourceType)
startImportResponse_resourceType :: (Maybe ResourceType -> f (Maybe ResourceType))
-> StartImportResponse -> f StartImportResponse
startImportResponse_resourceType = (StartImportResponse -> Maybe ResourceType)
-> (StartImportResponse
    -> Maybe ResourceType -> StartImportResponse)
-> Lens
     StartImportResponse
     StartImportResponse
     (Maybe ResourceType)
     (Maybe ResourceType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartImportResponse' {Maybe ResourceType
resourceType :: Maybe ResourceType
$sel:resourceType:StartImportResponse' :: StartImportResponse -> Maybe ResourceType
resourceType} -> Maybe ResourceType
resourceType) (\s :: StartImportResponse
s@StartImportResponse' {} Maybe ResourceType
a -> StartImportResponse
s {$sel:resourceType:StartImportResponse' :: Maybe ResourceType
resourceType = Maybe ResourceType
a} :: StartImportResponse)

-- | The identifier for the specific import job.
startImportResponse_importId :: Lens.Lens' StartImportResponse (Prelude.Maybe Prelude.Text)
startImportResponse_importId :: (Maybe Text -> f (Maybe Text))
-> StartImportResponse -> f StartImportResponse
startImportResponse_importId = (StartImportResponse -> Maybe Text)
-> (StartImportResponse -> Maybe Text -> StartImportResponse)
-> Lens
     StartImportResponse StartImportResponse (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartImportResponse' {Maybe Text
importId :: Maybe Text
$sel:importId:StartImportResponse' :: StartImportResponse -> Maybe Text
importId} -> Maybe Text
importId) (\s :: StartImportResponse
s@StartImportResponse' {} Maybe Text
a -> StartImportResponse
s {$sel:importId:StartImportResponse' :: Maybe Text
importId = Maybe Text
a} :: StartImportResponse)

-- | A timestamp for the date and time that the import job was requested.
startImportResponse_createdDate :: Lens.Lens' StartImportResponse (Prelude.Maybe Prelude.UTCTime)
startImportResponse_createdDate :: (Maybe UTCTime -> f (Maybe UTCTime))
-> StartImportResponse -> f StartImportResponse
startImportResponse_createdDate = (StartImportResponse -> Maybe POSIX)
-> (StartImportResponse -> Maybe POSIX -> StartImportResponse)
-> Lens
     StartImportResponse StartImportResponse (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartImportResponse' {Maybe POSIX
createdDate :: Maybe POSIX
$sel:createdDate:StartImportResponse' :: StartImportResponse -> Maybe POSIX
createdDate} -> Maybe POSIX
createdDate) (\s :: StartImportResponse
s@StartImportResponse' {} Maybe POSIX
a -> StartImportResponse
s {$sel:createdDate:StartImportResponse' :: Maybe POSIX
createdDate = Maybe POSIX
a} :: StartImportResponse) ((Maybe POSIX -> f (Maybe POSIX))
 -> StartImportResponse -> f StartImportResponse)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> StartImportResponse
-> f StartImportResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The name given to the import job.
startImportResponse_name :: Lens.Lens' StartImportResponse (Prelude.Maybe Prelude.Text)
startImportResponse_name :: (Maybe Text -> f (Maybe Text))
-> StartImportResponse -> f StartImportResponse
startImportResponse_name = (StartImportResponse -> Maybe Text)
-> (StartImportResponse -> Maybe Text -> StartImportResponse)
-> Lens
     StartImportResponse StartImportResponse (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartImportResponse' {Maybe Text
name :: Maybe Text
$sel:name:StartImportResponse' :: StartImportResponse -> Maybe Text
name} -> Maybe Text
name) (\s :: StartImportResponse
s@StartImportResponse' {} Maybe Text
a -> StartImportResponse
s {$sel:name:StartImportResponse' :: Maybe Text
name = Maybe Text
a} :: StartImportResponse)

-- | The action to take when there is a merge conflict.
startImportResponse_mergeStrategy :: Lens.Lens' StartImportResponse (Prelude.Maybe MergeStrategy)
startImportResponse_mergeStrategy :: (Maybe MergeStrategy -> f (Maybe MergeStrategy))
-> StartImportResponse -> f StartImportResponse
startImportResponse_mergeStrategy = (StartImportResponse -> Maybe MergeStrategy)
-> (StartImportResponse
    -> Maybe MergeStrategy -> StartImportResponse)
-> Lens
     StartImportResponse
     StartImportResponse
     (Maybe MergeStrategy)
     (Maybe MergeStrategy)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartImportResponse' {Maybe MergeStrategy
mergeStrategy :: Maybe MergeStrategy
$sel:mergeStrategy:StartImportResponse' :: StartImportResponse -> Maybe MergeStrategy
mergeStrategy} -> Maybe MergeStrategy
mergeStrategy) (\s :: StartImportResponse
s@StartImportResponse' {} Maybe MergeStrategy
a -> StartImportResponse
s {$sel:mergeStrategy:StartImportResponse' :: Maybe MergeStrategy
mergeStrategy = Maybe MergeStrategy
a} :: StartImportResponse)

-- | The status of the import job. If the status is @FAILED@, you can get the
-- reason for the failure using the @GetImport@ operation.
startImportResponse_importStatus :: Lens.Lens' StartImportResponse (Prelude.Maybe ImportStatus)
startImportResponse_importStatus :: (Maybe ImportStatus -> f (Maybe ImportStatus))
-> StartImportResponse -> f StartImportResponse
startImportResponse_importStatus = (StartImportResponse -> Maybe ImportStatus)
-> (StartImportResponse
    -> Maybe ImportStatus -> StartImportResponse)
-> Lens
     StartImportResponse
     StartImportResponse
     (Maybe ImportStatus)
     (Maybe ImportStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartImportResponse' {Maybe ImportStatus
importStatus :: Maybe ImportStatus
$sel:importStatus:StartImportResponse' :: StartImportResponse -> Maybe ImportStatus
importStatus} -> Maybe ImportStatus
importStatus) (\s :: StartImportResponse
s@StartImportResponse' {} Maybe ImportStatus
a -> StartImportResponse
s {$sel:importStatus:StartImportResponse' :: Maybe ImportStatus
importStatus = Maybe ImportStatus
a} :: StartImportResponse)

-- | A list of tags added to the imported bot.
startImportResponse_tags :: Lens.Lens' StartImportResponse (Prelude.Maybe [Tag])
startImportResponse_tags :: (Maybe [Tag] -> f (Maybe [Tag]))
-> StartImportResponse -> f StartImportResponse
startImportResponse_tags = (StartImportResponse -> Maybe [Tag])
-> (StartImportResponse -> Maybe [Tag] -> StartImportResponse)
-> Lens
     StartImportResponse StartImportResponse (Maybe [Tag]) (Maybe [Tag])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartImportResponse' {Maybe [Tag]
tags :: Maybe [Tag]
$sel:tags:StartImportResponse' :: StartImportResponse -> Maybe [Tag]
tags} -> Maybe [Tag]
tags) (\s :: StartImportResponse
s@StartImportResponse' {} Maybe [Tag]
a -> StartImportResponse
s {$sel:tags:StartImportResponse' :: Maybe [Tag]
tags = Maybe [Tag]
a} :: StartImportResponse) ((Maybe [Tag] -> f (Maybe [Tag]))
 -> StartImportResponse -> f StartImportResponse)
-> ((Maybe [Tag] -> f (Maybe [Tag]))
    -> Maybe [Tag] -> f (Maybe [Tag]))
-> (Maybe [Tag] -> f (Maybe [Tag]))
-> StartImportResponse
-> f StartImportResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Tag] [Tag] [Tag] [Tag]
-> Iso (Maybe [Tag]) (Maybe [Tag]) (Maybe [Tag]) (Maybe [Tag])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso [Tag] [Tag] [Tag] [Tag]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance Prelude.NFData StartImportResponse