{-# 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.RobOMaker.CreateDeploymentJob
-- 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)
--
-- Deploys a specific version of a robot application to robots in a fleet.
--
-- The robot application must have a numbered @applicationVersion@ for
-- consistency reasons. To create a new version, use
-- @CreateRobotApplicationVersion@ or see
-- <https://docs.aws.amazon.com/robomaker/latest/dg/create-robot-application-version.html Creating a Robot Application Version>.
--
-- After 90 days, deployment jobs expire and will be deleted. They will no
-- longer be accessible.
module Amazonka.RobOMaker.CreateDeploymentJob
  ( -- * Creating a Request
    CreateDeploymentJob (..),
    newCreateDeploymentJob,

    -- * Request Lenses
    createDeploymentJob_deploymentConfig,
    createDeploymentJob_tags,
    createDeploymentJob_clientRequestToken,
    createDeploymentJob_fleet,
    createDeploymentJob_deploymentApplicationConfigs,

    -- * Destructuring the Response
    CreateDeploymentJobResponse (..),
    newCreateDeploymentJobResponse,

    -- * Response Lenses
    createDeploymentJobResponse_failureReason,
    createDeploymentJobResponse_status,
    createDeploymentJobResponse_deploymentApplicationConfigs,
    createDeploymentJobResponse_arn,
    createDeploymentJobResponse_createdAt,
    createDeploymentJobResponse_failureCode,
    createDeploymentJobResponse_deploymentConfig,
    createDeploymentJobResponse_fleet,
    createDeploymentJobResponse_tags,
    createDeploymentJobResponse_httpStatus,
  )
where

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

-- | /See:/ 'newCreateDeploymentJob' smart constructor.
data CreateDeploymentJob = CreateDeploymentJob'
  { -- | The requested deployment configuration.
    CreateDeploymentJob -> Maybe DeploymentConfig
deploymentConfig :: Prelude.Maybe DeploymentConfig,
    -- | A map that contains tag keys and tag values that are attached to the
    -- deployment job.
    CreateDeploymentJob -> Maybe (HashMap Text Text)
tags :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | Unique, case-sensitive identifier that you provide to ensure the
    -- idempotency of the request.
    CreateDeploymentJob -> Text
clientRequestToken :: Prelude.Text,
    -- | The Amazon Resource Name (ARN) of the fleet to deploy.
    CreateDeploymentJob -> Text
fleet :: Prelude.Text,
    -- | The deployment application configuration.
    CreateDeploymentJob -> NonEmpty DeploymentApplicationConfig
deploymentApplicationConfigs :: Prelude.NonEmpty DeploymentApplicationConfig
  }
  deriving (CreateDeploymentJob -> CreateDeploymentJob -> Bool
(CreateDeploymentJob -> CreateDeploymentJob -> Bool)
-> (CreateDeploymentJob -> CreateDeploymentJob -> Bool)
-> Eq CreateDeploymentJob
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateDeploymentJob -> CreateDeploymentJob -> Bool
$c/= :: CreateDeploymentJob -> CreateDeploymentJob -> Bool
== :: CreateDeploymentJob -> CreateDeploymentJob -> Bool
$c== :: CreateDeploymentJob -> CreateDeploymentJob -> Bool
Prelude.Eq, ReadPrec [CreateDeploymentJob]
ReadPrec CreateDeploymentJob
Int -> ReadS CreateDeploymentJob
ReadS [CreateDeploymentJob]
(Int -> ReadS CreateDeploymentJob)
-> ReadS [CreateDeploymentJob]
-> ReadPrec CreateDeploymentJob
-> ReadPrec [CreateDeploymentJob]
-> Read CreateDeploymentJob
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateDeploymentJob]
$creadListPrec :: ReadPrec [CreateDeploymentJob]
readPrec :: ReadPrec CreateDeploymentJob
$creadPrec :: ReadPrec CreateDeploymentJob
readList :: ReadS [CreateDeploymentJob]
$creadList :: ReadS [CreateDeploymentJob]
readsPrec :: Int -> ReadS CreateDeploymentJob
$creadsPrec :: Int -> ReadS CreateDeploymentJob
Prelude.Read, Int -> CreateDeploymentJob -> ShowS
[CreateDeploymentJob] -> ShowS
CreateDeploymentJob -> String
(Int -> CreateDeploymentJob -> ShowS)
-> (CreateDeploymentJob -> String)
-> ([CreateDeploymentJob] -> ShowS)
-> Show CreateDeploymentJob
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateDeploymentJob] -> ShowS
$cshowList :: [CreateDeploymentJob] -> ShowS
show :: CreateDeploymentJob -> String
$cshow :: CreateDeploymentJob -> String
showsPrec :: Int -> CreateDeploymentJob -> ShowS
$cshowsPrec :: Int -> CreateDeploymentJob -> ShowS
Prelude.Show, (forall x. CreateDeploymentJob -> Rep CreateDeploymentJob x)
-> (forall x. Rep CreateDeploymentJob x -> CreateDeploymentJob)
-> Generic CreateDeploymentJob
forall x. Rep CreateDeploymentJob x -> CreateDeploymentJob
forall x. CreateDeploymentJob -> Rep CreateDeploymentJob x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateDeploymentJob x -> CreateDeploymentJob
$cfrom :: forall x. CreateDeploymentJob -> Rep CreateDeploymentJob x
Prelude.Generic)

-- |
-- Create a value of 'CreateDeploymentJob' 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:
--
-- 'deploymentConfig', 'createDeploymentJob_deploymentConfig' - The requested deployment configuration.
--
-- 'tags', 'createDeploymentJob_tags' - A map that contains tag keys and tag values that are attached to the
-- deployment job.
--
-- 'clientRequestToken', 'createDeploymentJob_clientRequestToken' - Unique, case-sensitive identifier that you provide to ensure the
-- idempotency of the request.
--
-- 'fleet', 'createDeploymentJob_fleet' - The Amazon Resource Name (ARN) of the fleet to deploy.
--
-- 'deploymentApplicationConfigs', 'createDeploymentJob_deploymentApplicationConfigs' - The deployment application configuration.
newCreateDeploymentJob ::
  -- | 'clientRequestToken'
  Prelude.Text ->
  -- | 'fleet'
  Prelude.Text ->
  -- | 'deploymentApplicationConfigs'
  Prelude.NonEmpty DeploymentApplicationConfig ->
  CreateDeploymentJob
newCreateDeploymentJob :: Text
-> Text
-> NonEmpty DeploymentApplicationConfig
-> CreateDeploymentJob
newCreateDeploymentJob
  Text
pClientRequestToken_
  Text
pFleet_
  NonEmpty DeploymentApplicationConfig
pDeploymentApplicationConfigs_ =
    CreateDeploymentJob' :: Maybe DeploymentConfig
-> Maybe (HashMap Text Text)
-> Text
-> Text
-> NonEmpty DeploymentApplicationConfig
-> CreateDeploymentJob
CreateDeploymentJob'
      { $sel:deploymentConfig:CreateDeploymentJob' :: Maybe DeploymentConfig
deploymentConfig =
          Maybe DeploymentConfig
forall a. Maybe a
Prelude.Nothing,
        $sel:tags:CreateDeploymentJob' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing,
        $sel:clientRequestToken:CreateDeploymentJob' :: Text
clientRequestToken = Text
pClientRequestToken_,
        $sel:fleet:CreateDeploymentJob' :: Text
fleet = Text
pFleet_,
        $sel:deploymentApplicationConfigs:CreateDeploymentJob' :: NonEmpty DeploymentApplicationConfig
deploymentApplicationConfigs =
          Tagged
  (NonEmpty DeploymentApplicationConfig)
  (Identity (NonEmpty DeploymentApplicationConfig))
-> Tagged
     (NonEmpty DeploymentApplicationConfig)
     (Identity (NonEmpty DeploymentApplicationConfig))
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced (Tagged
   (NonEmpty DeploymentApplicationConfig)
   (Identity (NonEmpty DeploymentApplicationConfig))
 -> Tagged
      (NonEmpty DeploymentApplicationConfig)
      (Identity (NonEmpty DeploymentApplicationConfig)))
-> NonEmpty DeploymentApplicationConfig
-> NonEmpty DeploymentApplicationConfig
forall t b. AReview t b -> b -> t
Lens.# NonEmpty DeploymentApplicationConfig
pDeploymentApplicationConfigs_
      }

-- | The requested deployment configuration.
createDeploymentJob_deploymentConfig :: Lens.Lens' CreateDeploymentJob (Prelude.Maybe DeploymentConfig)
createDeploymentJob_deploymentConfig :: (Maybe DeploymentConfig -> f (Maybe DeploymentConfig))
-> CreateDeploymentJob -> f CreateDeploymentJob
createDeploymentJob_deploymentConfig = (CreateDeploymentJob -> Maybe DeploymentConfig)
-> (CreateDeploymentJob
    -> Maybe DeploymentConfig -> CreateDeploymentJob)
-> Lens
     CreateDeploymentJob
     CreateDeploymentJob
     (Maybe DeploymentConfig)
     (Maybe DeploymentConfig)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDeploymentJob' {Maybe DeploymentConfig
deploymentConfig :: Maybe DeploymentConfig
$sel:deploymentConfig:CreateDeploymentJob' :: CreateDeploymentJob -> Maybe DeploymentConfig
deploymentConfig} -> Maybe DeploymentConfig
deploymentConfig) (\s :: CreateDeploymentJob
s@CreateDeploymentJob' {} Maybe DeploymentConfig
a -> CreateDeploymentJob
s {$sel:deploymentConfig:CreateDeploymentJob' :: Maybe DeploymentConfig
deploymentConfig = Maybe DeploymentConfig
a} :: CreateDeploymentJob)

-- | A map that contains tag keys and tag values that are attached to the
-- deployment job.
createDeploymentJob_tags :: Lens.Lens' CreateDeploymentJob (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
createDeploymentJob_tags :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> CreateDeploymentJob -> f CreateDeploymentJob
createDeploymentJob_tags = (CreateDeploymentJob -> Maybe (HashMap Text Text))
-> (CreateDeploymentJob
    -> Maybe (HashMap Text Text) -> CreateDeploymentJob)
-> Lens
     CreateDeploymentJob
     CreateDeploymentJob
     (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 (\CreateDeploymentJob' {Maybe (HashMap Text Text)
tags :: Maybe (HashMap Text Text)
$sel:tags:CreateDeploymentJob' :: CreateDeploymentJob -> Maybe (HashMap Text Text)
tags} -> Maybe (HashMap Text Text)
tags) (\s :: CreateDeploymentJob
s@CreateDeploymentJob' {} Maybe (HashMap Text Text)
a -> CreateDeploymentJob
s {$sel:tags:CreateDeploymentJob' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
a} :: CreateDeploymentJob) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
 -> CreateDeploymentJob -> f CreateDeploymentJob)
-> ((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)))
-> CreateDeploymentJob
-> f CreateDeploymentJob
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

-- | Unique, case-sensitive identifier that you provide to ensure the
-- idempotency of the request.
createDeploymentJob_clientRequestToken :: Lens.Lens' CreateDeploymentJob Prelude.Text
createDeploymentJob_clientRequestToken :: (Text -> f Text) -> CreateDeploymentJob -> f CreateDeploymentJob
createDeploymentJob_clientRequestToken = (CreateDeploymentJob -> Text)
-> (CreateDeploymentJob -> Text -> CreateDeploymentJob)
-> Lens CreateDeploymentJob CreateDeploymentJob Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDeploymentJob' {Text
clientRequestToken :: Text
$sel:clientRequestToken:CreateDeploymentJob' :: CreateDeploymentJob -> Text
clientRequestToken} -> Text
clientRequestToken) (\s :: CreateDeploymentJob
s@CreateDeploymentJob' {} Text
a -> CreateDeploymentJob
s {$sel:clientRequestToken:CreateDeploymentJob' :: Text
clientRequestToken = Text
a} :: CreateDeploymentJob)

-- | The Amazon Resource Name (ARN) of the fleet to deploy.
createDeploymentJob_fleet :: Lens.Lens' CreateDeploymentJob Prelude.Text
createDeploymentJob_fleet :: (Text -> f Text) -> CreateDeploymentJob -> f CreateDeploymentJob
createDeploymentJob_fleet = (CreateDeploymentJob -> Text)
-> (CreateDeploymentJob -> Text -> CreateDeploymentJob)
-> Lens CreateDeploymentJob CreateDeploymentJob Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDeploymentJob' {Text
fleet :: Text
$sel:fleet:CreateDeploymentJob' :: CreateDeploymentJob -> Text
fleet} -> Text
fleet) (\s :: CreateDeploymentJob
s@CreateDeploymentJob' {} Text
a -> CreateDeploymentJob
s {$sel:fleet:CreateDeploymentJob' :: Text
fleet = Text
a} :: CreateDeploymentJob)

-- | The deployment application configuration.
createDeploymentJob_deploymentApplicationConfigs :: Lens.Lens' CreateDeploymentJob (Prelude.NonEmpty DeploymentApplicationConfig)
createDeploymentJob_deploymentApplicationConfigs :: (NonEmpty DeploymentApplicationConfig
 -> f (NonEmpty DeploymentApplicationConfig))
-> CreateDeploymentJob -> f CreateDeploymentJob
createDeploymentJob_deploymentApplicationConfigs = (CreateDeploymentJob -> NonEmpty DeploymentApplicationConfig)
-> (CreateDeploymentJob
    -> NonEmpty DeploymentApplicationConfig -> CreateDeploymentJob)
-> Lens
     CreateDeploymentJob
     CreateDeploymentJob
     (NonEmpty DeploymentApplicationConfig)
     (NonEmpty DeploymentApplicationConfig)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDeploymentJob' {NonEmpty DeploymentApplicationConfig
deploymentApplicationConfigs :: NonEmpty DeploymentApplicationConfig
$sel:deploymentApplicationConfigs:CreateDeploymentJob' :: CreateDeploymentJob -> NonEmpty DeploymentApplicationConfig
deploymentApplicationConfigs} -> NonEmpty DeploymentApplicationConfig
deploymentApplicationConfigs) (\s :: CreateDeploymentJob
s@CreateDeploymentJob' {} NonEmpty DeploymentApplicationConfig
a -> CreateDeploymentJob
s {$sel:deploymentApplicationConfigs:CreateDeploymentJob' :: NonEmpty DeploymentApplicationConfig
deploymentApplicationConfigs = NonEmpty DeploymentApplicationConfig
a} :: CreateDeploymentJob) ((NonEmpty DeploymentApplicationConfig
  -> f (NonEmpty DeploymentApplicationConfig))
 -> CreateDeploymentJob -> f CreateDeploymentJob)
-> ((NonEmpty DeploymentApplicationConfig
     -> f (NonEmpty DeploymentApplicationConfig))
    -> NonEmpty DeploymentApplicationConfig
    -> f (NonEmpty DeploymentApplicationConfig))
-> (NonEmpty DeploymentApplicationConfig
    -> f (NonEmpty DeploymentApplicationConfig))
-> CreateDeploymentJob
-> f CreateDeploymentJob
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (NonEmpty DeploymentApplicationConfig
 -> f (NonEmpty DeploymentApplicationConfig))
-> NonEmpty DeploymentApplicationConfig
-> f (NonEmpty DeploymentApplicationConfig)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.AWSRequest CreateDeploymentJob where
  type
    AWSResponse CreateDeploymentJob =
      CreateDeploymentJobResponse
  request :: CreateDeploymentJob -> Request CreateDeploymentJob
request = Service -> CreateDeploymentJob -> Request CreateDeploymentJob
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy CreateDeploymentJob
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CreateDeploymentJob)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse CreateDeploymentJob))
-> Logger
-> Service
-> Proxy CreateDeploymentJob
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CreateDeploymentJob)))
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
-> Maybe DeploymentStatus
-> Maybe (NonEmpty DeploymentApplicationConfig)
-> Maybe Text
-> Maybe POSIX
-> Maybe DeploymentJobErrorCode
-> Maybe DeploymentConfig
-> Maybe Text
-> Maybe (HashMap Text Text)
-> Int
-> CreateDeploymentJobResponse
CreateDeploymentJobResponse'
            (Maybe Text
 -> Maybe DeploymentStatus
 -> Maybe (NonEmpty DeploymentApplicationConfig)
 -> Maybe Text
 -> Maybe POSIX
 -> Maybe DeploymentJobErrorCode
 -> Maybe DeploymentConfig
 -> Maybe Text
 -> Maybe (HashMap Text Text)
 -> Int
 -> CreateDeploymentJobResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe DeploymentStatus
      -> Maybe (NonEmpty DeploymentApplicationConfig)
      -> Maybe Text
      -> Maybe POSIX
      -> Maybe DeploymentJobErrorCode
      -> Maybe DeploymentConfig
      -> Maybe Text
      -> Maybe (HashMap Text Text)
      -> Int
      -> CreateDeploymentJobResponse)
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
"failureReason")
            Either
  String
  (Maybe DeploymentStatus
   -> Maybe (NonEmpty DeploymentApplicationConfig)
   -> Maybe Text
   -> Maybe POSIX
   -> Maybe DeploymentJobErrorCode
   -> Maybe DeploymentConfig
   -> Maybe Text
   -> Maybe (HashMap Text Text)
   -> Int
   -> CreateDeploymentJobResponse)
-> Either String (Maybe DeploymentStatus)
-> Either
     String
     (Maybe (NonEmpty DeploymentApplicationConfig)
      -> Maybe Text
      -> Maybe POSIX
      -> Maybe DeploymentJobErrorCode
      -> Maybe DeploymentConfig
      -> Maybe Text
      -> Maybe (HashMap Text Text)
      -> Int
      -> CreateDeploymentJobResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe DeploymentStatus)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"status")
            Either
  String
  (Maybe (NonEmpty DeploymentApplicationConfig)
   -> Maybe Text
   -> Maybe POSIX
   -> Maybe DeploymentJobErrorCode
   -> Maybe DeploymentConfig
   -> Maybe Text
   -> Maybe (HashMap Text Text)
   -> Int
   -> CreateDeploymentJobResponse)
-> Either String (Maybe (NonEmpty DeploymentApplicationConfig))
-> Either
     String
     (Maybe Text
      -> Maybe POSIX
      -> Maybe DeploymentJobErrorCode
      -> Maybe DeploymentConfig
      -> Maybe Text
      -> Maybe (HashMap Text Text)
      -> Int
      -> CreateDeploymentJobResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object
-> Text
-> Either String (Maybe (NonEmpty DeploymentApplicationConfig))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"deploymentApplicationConfigs")
            Either
  String
  (Maybe Text
   -> Maybe POSIX
   -> Maybe DeploymentJobErrorCode
   -> Maybe DeploymentConfig
   -> Maybe Text
   -> Maybe (HashMap Text Text)
   -> Int
   -> CreateDeploymentJobResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe POSIX
      -> Maybe DeploymentJobErrorCode
      -> Maybe DeploymentConfig
      -> Maybe Text
      -> Maybe (HashMap Text Text)
      -> Int
      -> CreateDeploymentJobResponse)
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
"arn")
            Either
  String
  (Maybe POSIX
   -> Maybe DeploymentJobErrorCode
   -> Maybe DeploymentConfig
   -> Maybe Text
   -> Maybe (HashMap Text Text)
   -> Int
   -> CreateDeploymentJobResponse)
-> Either String (Maybe POSIX)
-> Either
     String
     (Maybe DeploymentJobErrorCode
      -> Maybe DeploymentConfig
      -> Maybe Text
      -> Maybe (HashMap Text Text)
      -> Int
      -> CreateDeploymentJobResponse)
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
"createdAt")
            Either
  String
  (Maybe DeploymentJobErrorCode
   -> Maybe DeploymentConfig
   -> Maybe Text
   -> Maybe (HashMap Text Text)
   -> Int
   -> CreateDeploymentJobResponse)
-> Either String (Maybe DeploymentJobErrorCode)
-> Either
     String
     (Maybe DeploymentConfig
      -> Maybe Text
      -> Maybe (HashMap Text Text)
      -> Int
      -> CreateDeploymentJobResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe DeploymentJobErrorCode)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"failureCode")
            Either
  String
  (Maybe DeploymentConfig
   -> Maybe Text
   -> Maybe (HashMap Text Text)
   -> Int
   -> CreateDeploymentJobResponse)
-> Either String (Maybe DeploymentConfig)
-> Either
     String
     (Maybe Text
      -> Maybe (HashMap Text Text) -> Int -> CreateDeploymentJobResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe DeploymentConfig)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"deploymentConfig")
            Either
  String
  (Maybe Text
   -> Maybe (HashMap Text Text) -> Int -> CreateDeploymentJobResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe (HashMap Text Text) -> Int -> CreateDeploymentJobResponse)
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
"fleet")
            Either
  String
  (Maybe (HashMap Text Text) -> Int -> CreateDeploymentJobResponse)
-> Either String (Maybe (HashMap Text Text))
-> Either String (Int -> CreateDeploymentJobResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe (Maybe (HashMap Text Text)))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"tags" Either String (Maybe (Maybe (HashMap Text Text)))
-> Maybe (HashMap Text Text)
-> Either String (Maybe (HashMap Text Text))
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe (HashMap Text Text)
forall a. Monoid a => a
Prelude.mempty)
            Either String (Int -> CreateDeploymentJobResponse)
-> Either String Int -> Either String CreateDeploymentJobResponse
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 CreateDeploymentJob

instance Prelude.NFData CreateDeploymentJob

instance Core.ToHeaders CreateDeploymentJob where
  toHeaders :: CreateDeploymentJob -> ResponseHeaders
toHeaders =
    ResponseHeaders -> CreateDeploymentJob -> 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 CreateDeploymentJob where
  toJSON :: CreateDeploymentJob -> Value
toJSON CreateDeploymentJob' {Maybe (HashMap Text Text)
Maybe DeploymentConfig
NonEmpty DeploymentApplicationConfig
Text
deploymentApplicationConfigs :: NonEmpty DeploymentApplicationConfig
fleet :: Text
clientRequestToken :: Text
tags :: Maybe (HashMap Text Text)
deploymentConfig :: Maybe DeploymentConfig
$sel:deploymentApplicationConfigs:CreateDeploymentJob' :: CreateDeploymentJob -> NonEmpty DeploymentApplicationConfig
$sel:fleet:CreateDeploymentJob' :: CreateDeploymentJob -> Text
$sel:clientRequestToken:CreateDeploymentJob' :: CreateDeploymentJob -> Text
$sel:tags:CreateDeploymentJob' :: CreateDeploymentJob -> Maybe (HashMap Text Text)
$sel:deploymentConfig:CreateDeploymentJob' :: CreateDeploymentJob -> Maybe DeploymentConfig
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"deploymentConfig" Text -> DeploymentConfig -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (DeploymentConfig -> Pair) -> Maybe DeploymentConfig -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe DeploymentConfig
deploymentConfig,
            (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
"clientRequestToken" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
clientRequestToken),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"fleet" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
fleet),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              ( Text
"deploymentApplicationConfigs"
                  Text -> NonEmpty DeploymentApplicationConfig -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= NonEmpty DeploymentApplicationConfig
deploymentApplicationConfigs
              )
          ]
      )

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

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

-- | /See:/ 'newCreateDeploymentJobResponse' smart constructor.
data CreateDeploymentJobResponse = CreateDeploymentJobResponse'
  { -- | The failure reason of the deployment job if it failed.
    CreateDeploymentJobResponse -> Maybe Text
failureReason :: Prelude.Maybe Prelude.Text,
    -- | The status of the deployment job.
    CreateDeploymentJobResponse -> Maybe DeploymentStatus
status :: Prelude.Maybe DeploymentStatus,
    -- | The deployment application configuration.
    CreateDeploymentJobResponse
-> Maybe (NonEmpty DeploymentApplicationConfig)
deploymentApplicationConfigs :: Prelude.Maybe (Prelude.NonEmpty DeploymentApplicationConfig),
    -- | The Amazon Resource Name (ARN) of the deployment job.
    CreateDeploymentJobResponse -> Maybe Text
arn :: Prelude.Maybe Prelude.Text,
    -- | The time, in milliseconds since the epoch, when the fleet was created.
    CreateDeploymentJobResponse -> Maybe POSIX
createdAt :: Prelude.Maybe Core.POSIX,
    -- | The failure code of the simulation job if it failed:
    --
    -- [BadPermissionError]
    --     AWS Greengrass requires a service-level role permission to access
    --     other services. The role must include the
    --     <https://console.aws.amazon.com/iam/home?#/policies/arn:aws:iam::aws:policy/service-role/AWSGreengrassResourceAccessRolePolicy$jsonEditor AWSGreengrassResourceAccessRolePolicy managed policy>.
    --
    -- [ExtractingBundleFailure]
    --     The robot application could not be extracted from the bundle.
    --
    -- [FailureThresholdBreached]
    --     The percentage of robots that could not be updated exceeded the
    --     percentage set for the deployment.
    --
    -- [GreengrassDeploymentFailed]
    --     The robot application could not be deployed to the robot.
    --
    -- [GreengrassGroupVersionDoesNotExist]
    --     The AWS Greengrass group or version associated with a robot is
    --     missing.
    --
    -- [InternalServerError]
    --     An internal error has occurred. Retry your request, but if the
    --     problem persists, contact us with details.
    --
    -- [MissingRobotApplicationArchitecture]
    --     The robot application does not have a source that matches the
    --     architecture of the robot.
    --
    -- [MissingRobotDeploymentResource]
    --     One or more of the resources specified for the robot application are
    --     missing. For example, does the robot application have the correct
    --     launch package and launch file?
    --
    -- [PostLaunchFileFailure]
    --     The post-launch script failed.
    --
    -- [PreLaunchFileFailure]
    --     The pre-launch script failed.
    --
    -- [ResourceNotFound]
    --     One or more deployment resources are missing. For example, do robot
    --     application source bundles still exist?
    --
    -- [RobotDeploymentNoResponse]
    --     There is no response from the robot. It might not be powered on or
    --     connected to the internet.
    CreateDeploymentJobResponse -> Maybe DeploymentJobErrorCode
failureCode :: Prelude.Maybe DeploymentJobErrorCode,
    -- | The deployment configuration.
    CreateDeploymentJobResponse -> Maybe DeploymentConfig
deploymentConfig :: Prelude.Maybe DeploymentConfig,
    -- | The target fleet for the deployment job.
    CreateDeploymentJobResponse -> Maybe Text
fleet :: Prelude.Maybe Prelude.Text,
    -- | The list of all tags added to the deployment job.
    CreateDeploymentJobResponse -> Maybe (HashMap Text Text)
tags :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | The response's http status code.
    CreateDeploymentJobResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (CreateDeploymentJobResponse -> CreateDeploymentJobResponse -> Bool
(CreateDeploymentJobResponse
 -> CreateDeploymentJobResponse -> Bool)
-> (CreateDeploymentJobResponse
    -> CreateDeploymentJobResponse -> Bool)
-> Eq CreateDeploymentJobResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateDeploymentJobResponse -> CreateDeploymentJobResponse -> Bool
$c/= :: CreateDeploymentJobResponse -> CreateDeploymentJobResponse -> Bool
== :: CreateDeploymentJobResponse -> CreateDeploymentJobResponse -> Bool
$c== :: CreateDeploymentJobResponse -> CreateDeploymentJobResponse -> Bool
Prelude.Eq, ReadPrec [CreateDeploymentJobResponse]
ReadPrec CreateDeploymentJobResponse
Int -> ReadS CreateDeploymentJobResponse
ReadS [CreateDeploymentJobResponse]
(Int -> ReadS CreateDeploymentJobResponse)
-> ReadS [CreateDeploymentJobResponse]
-> ReadPrec CreateDeploymentJobResponse
-> ReadPrec [CreateDeploymentJobResponse]
-> Read CreateDeploymentJobResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateDeploymentJobResponse]
$creadListPrec :: ReadPrec [CreateDeploymentJobResponse]
readPrec :: ReadPrec CreateDeploymentJobResponse
$creadPrec :: ReadPrec CreateDeploymentJobResponse
readList :: ReadS [CreateDeploymentJobResponse]
$creadList :: ReadS [CreateDeploymentJobResponse]
readsPrec :: Int -> ReadS CreateDeploymentJobResponse
$creadsPrec :: Int -> ReadS CreateDeploymentJobResponse
Prelude.Read, Int -> CreateDeploymentJobResponse -> ShowS
[CreateDeploymentJobResponse] -> ShowS
CreateDeploymentJobResponse -> String
(Int -> CreateDeploymentJobResponse -> ShowS)
-> (CreateDeploymentJobResponse -> String)
-> ([CreateDeploymentJobResponse] -> ShowS)
-> Show CreateDeploymentJobResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateDeploymentJobResponse] -> ShowS
$cshowList :: [CreateDeploymentJobResponse] -> ShowS
show :: CreateDeploymentJobResponse -> String
$cshow :: CreateDeploymentJobResponse -> String
showsPrec :: Int -> CreateDeploymentJobResponse -> ShowS
$cshowsPrec :: Int -> CreateDeploymentJobResponse -> ShowS
Prelude.Show, (forall x.
 CreateDeploymentJobResponse -> Rep CreateDeploymentJobResponse x)
-> (forall x.
    Rep CreateDeploymentJobResponse x -> CreateDeploymentJobResponse)
-> Generic CreateDeploymentJobResponse
forall x.
Rep CreateDeploymentJobResponse x -> CreateDeploymentJobResponse
forall x.
CreateDeploymentJobResponse -> Rep CreateDeploymentJobResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateDeploymentJobResponse x -> CreateDeploymentJobResponse
$cfrom :: forall x.
CreateDeploymentJobResponse -> Rep CreateDeploymentJobResponse x
Prelude.Generic)

-- |
-- Create a value of 'CreateDeploymentJobResponse' 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:
--
-- 'failureReason', 'createDeploymentJobResponse_failureReason' - The failure reason of the deployment job if it failed.
--
-- 'status', 'createDeploymentJobResponse_status' - The status of the deployment job.
--
-- 'deploymentApplicationConfigs', 'createDeploymentJobResponse_deploymentApplicationConfigs' - The deployment application configuration.
--
-- 'arn', 'createDeploymentJobResponse_arn' - The Amazon Resource Name (ARN) of the deployment job.
--
-- 'createdAt', 'createDeploymentJobResponse_createdAt' - The time, in milliseconds since the epoch, when the fleet was created.
--
-- 'failureCode', 'createDeploymentJobResponse_failureCode' - The failure code of the simulation job if it failed:
--
-- [BadPermissionError]
--     AWS Greengrass requires a service-level role permission to access
--     other services. The role must include the
--     <https://console.aws.amazon.com/iam/home?#/policies/arn:aws:iam::aws:policy/service-role/AWSGreengrassResourceAccessRolePolicy$jsonEditor AWSGreengrassResourceAccessRolePolicy managed policy>.
--
-- [ExtractingBundleFailure]
--     The robot application could not be extracted from the bundle.
--
-- [FailureThresholdBreached]
--     The percentage of robots that could not be updated exceeded the
--     percentage set for the deployment.
--
-- [GreengrassDeploymentFailed]
--     The robot application could not be deployed to the robot.
--
-- [GreengrassGroupVersionDoesNotExist]
--     The AWS Greengrass group or version associated with a robot is
--     missing.
--
-- [InternalServerError]
--     An internal error has occurred. Retry your request, but if the
--     problem persists, contact us with details.
--
-- [MissingRobotApplicationArchitecture]
--     The robot application does not have a source that matches the
--     architecture of the robot.
--
-- [MissingRobotDeploymentResource]
--     One or more of the resources specified for the robot application are
--     missing. For example, does the robot application have the correct
--     launch package and launch file?
--
-- [PostLaunchFileFailure]
--     The post-launch script failed.
--
-- [PreLaunchFileFailure]
--     The pre-launch script failed.
--
-- [ResourceNotFound]
--     One or more deployment resources are missing. For example, do robot
--     application source bundles still exist?
--
-- [RobotDeploymentNoResponse]
--     There is no response from the robot. It might not be powered on or
--     connected to the internet.
--
-- 'deploymentConfig', 'createDeploymentJobResponse_deploymentConfig' - The deployment configuration.
--
-- 'fleet', 'createDeploymentJobResponse_fleet' - The target fleet for the deployment job.
--
-- 'tags', 'createDeploymentJobResponse_tags' - The list of all tags added to the deployment job.
--
-- 'httpStatus', 'createDeploymentJobResponse_httpStatus' - The response's http status code.
newCreateDeploymentJobResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  CreateDeploymentJobResponse
newCreateDeploymentJobResponse :: Int -> CreateDeploymentJobResponse
newCreateDeploymentJobResponse Int
pHttpStatus_ =
  CreateDeploymentJobResponse' :: Maybe Text
-> Maybe DeploymentStatus
-> Maybe (NonEmpty DeploymentApplicationConfig)
-> Maybe Text
-> Maybe POSIX
-> Maybe DeploymentJobErrorCode
-> Maybe DeploymentConfig
-> Maybe Text
-> Maybe (HashMap Text Text)
-> Int
-> CreateDeploymentJobResponse
CreateDeploymentJobResponse'
    { $sel:failureReason:CreateDeploymentJobResponse' :: Maybe Text
failureReason =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:status:CreateDeploymentJobResponse' :: Maybe DeploymentStatus
status = Maybe DeploymentStatus
forall a. Maybe a
Prelude.Nothing,
      $sel:deploymentApplicationConfigs:CreateDeploymentJobResponse' :: Maybe (NonEmpty DeploymentApplicationConfig)
deploymentApplicationConfigs = Maybe (NonEmpty DeploymentApplicationConfig)
forall a. Maybe a
Prelude.Nothing,
      $sel:arn:CreateDeploymentJobResponse' :: Maybe Text
arn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:createdAt:CreateDeploymentJobResponse' :: Maybe POSIX
createdAt = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:failureCode:CreateDeploymentJobResponse' :: Maybe DeploymentJobErrorCode
failureCode = Maybe DeploymentJobErrorCode
forall a. Maybe a
Prelude.Nothing,
      $sel:deploymentConfig:CreateDeploymentJobResponse' :: Maybe DeploymentConfig
deploymentConfig = Maybe DeploymentConfig
forall a. Maybe a
Prelude.Nothing,
      $sel:fleet:CreateDeploymentJobResponse' :: Maybe Text
fleet = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:tags:CreateDeploymentJobResponse' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:CreateDeploymentJobResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The failure reason of the deployment job if it failed.
createDeploymentJobResponse_failureReason :: Lens.Lens' CreateDeploymentJobResponse (Prelude.Maybe Prelude.Text)
createDeploymentJobResponse_failureReason :: (Maybe Text -> f (Maybe Text))
-> CreateDeploymentJobResponse -> f CreateDeploymentJobResponse
createDeploymentJobResponse_failureReason = (CreateDeploymentJobResponse -> Maybe Text)
-> (CreateDeploymentJobResponse
    -> Maybe Text -> CreateDeploymentJobResponse)
-> Lens
     CreateDeploymentJobResponse
     CreateDeploymentJobResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDeploymentJobResponse' {Maybe Text
failureReason :: Maybe Text
$sel:failureReason:CreateDeploymentJobResponse' :: CreateDeploymentJobResponse -> Maybe Text
failureReason} -> Maybe Text
failureReason) (\s :: CreateDeploymentJobResponse
s@CreateDeploymentJobResponse' {} Maybe Text
a -> CreateDeploymentJobResponse
s {$sel:failureReason:CreateDeploymentJobResponse' :: Maybe Text
failureReason = Maybe Text
a} :: CreateDeploymentJobResponse)

-- | The status of the deployment job.
createDeploymentJobResponse_status :: Lens.Lens' CreateDeploymentJobResponse (Prelude.Maybe DeploymentStatus)
createDeploymentJobResponse_status :: (Maybe DeploymentStatus -> f (Maybe DeploymentStatus))
-> CreateDeploymentJobResponse -> f CreateDeploymentJobResponse
createDeploymentJobResponse_status = (CreateDeploymentJobResponse -> Maybe DeploymentStatus)
-> (CreateDeploymentJobResponse
    -> Maybe DeploymentStatus -> CreateDeploymentJobResponse)
-> Lens
     CreateDeploymentJobResponse
     CreateDeploymentJobResponse
     (Maybe DeploymentStatus)
     (Maybe DeploymentStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDeploymentJobResponse' {Maybe DeploymentStatus
status :: Maybe DeploymentStatus
$sel:status:CreateDeploymentJobResponse' :: CreateDeploymentJobResponse -> Maybe DeploymentStatus
status} -> Maybe DeploymentStatus
status) (\s :: CreateDeploymentJobResponse
s@CreateDeploymentJobResponse' {} Maybe DeploymentStatus
a -> CreateDeploymentJobResponse
s {$sel:status:CreateDeploymentJobResponse' :: Maybe DeploymentStatus
status = Maybe DeploymentStatus
a} :: CreateDeploymentJobResponse)

-- | The deployment application configuration.
createDeploymentJobResponse_deploymentApplicationConfigs :: Lens.Lens' CreateDeploymentJobResponse (Prelude.Maybe (Prelude.NonEmpty DeploymentApplicationConfig))
createDeploymentJobResponse_deploymentApplicationConfigs :: (Maybe (NonEmpty DeploymentApplicationConfig)
 -> f (Maybe (NonEmpty DeploymentApplicationConfig)))
-> CreateDeploymentJobResponse -> f CreateDeploymentJobResponse
createDeploymentJobResponse_deploymentApplicationConfigs = (CreateDeploymentJobResponse
 -> Maybe (NonEmpty DeploymentApplicationConfig))
-> (CreateDeploymentJobResponse
    -> Maybe (NonEmpty DeploymentApplicationConfig)
    -> CreateDeploymentJobResponse)
-> Lens
     CreateDeploymentJobResponse
     CreateDeploymentJobResponse
     (Maybe (NonEmpty DeploymentApplicationConfig))
     (Maybe (NonEmpty DeploymentApplicationConfig))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDeploymentJobResponse' {Maybe (NonEmpty DeploymentApplicationConfig)
deploymentApplicationConfigs :: Maybe (NonEmpty DeploymentApplicationConfig)
$sel:deploymentApplicationConfigs:CreateDeploymentJobResponse' :: CreateDeploymentJobResponse
-> Maybe (NonEmpty DeploymentApplicationConfig)
deploymentApplicationConfigs} -> Maybe (NonEmpty DeploymentApplicationConfig)
deploymentApplicationConfigs) (\s :: CreateDeploymentJobResponse
s@CreateDeploymentJobResponse' {} Maybe (NonEmpty DeploymentApplicationConfig)
a -> CreateDeploymentJobResponse
s {$sel:deploymentApplicationConfigs:CreateDeploymentJobResponse' :: Maybe (NonEmpty DeploymentApplicationConfig)
deploymentApplicationConfigs = Maybe (NonEmpty DeploymentApplicationConfig)
a} :: CreateDeploymentJobResponse) ((Maybe (NonEmpty DeploymentApplicationConfig)
  -> f (Maybe (NonEmpty DeploymentApplicationConfig)))
 -> CreateDeploymentJobResponse -> f CreateDeploymentJobResponse)
-> ((Maybe (NonEmpty DeploymentApplicationConfig)
     -> f (Maybe (NonEmpty DeploymentApplicationConfig)))
    -> Maybe (NonEmpty DeploymentApplicationConfig)
    -> f (Maybe (NonEmpty DeploymentApplicationConfig)))
-> (Maybe (NonEmpty DeploymentApplicationConfig)
    -> f (Maybe (NonEmpty DeploymentApplicationConfig)))
-> CreateDeploymentJobResponse
-> f CreateDeploymentJobResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (NonEmpty DeploymentApplicationConfig)
  (NonEmpty DeploymentApplicationConfig)
  (NonEmpty DeploymentApplicationConfig)
  (NonEmpty DeploymentApplicationConfig)
-> Iso
     (Maybe (NonEmpty DeploymentApplicationConfig))
     (Maybe (NonEmpty DeploymentApplicationConfig))
     (Maybe (NonEmpty DeploymentApplicationConfig))
     (Maybe (NonEmpty DeploymentApplicationConfig))
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 DeploymentApplicationConfig)
  (NonEmpty DeploymentApplicationConfig)
  (NonEmpty DeploymentApplicationConfig)
  (NonEmpty DeploymentApplicationConfig)
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 deployment job.
createDeploymentJobResponse_arn :: Lens.Lens' CreateDeploymentJobResponse (Prelude.Maybe Prelude.Text)
createDeploymentJobResponse_arn :: (Maybe Text -> f (Maybe Text))
-> CreateDeploymentJobResponse -> f CreateDeploymentJobResponse
createDeploymentJobResponse_arn = (CreateDeploymentJobResponse -> Maybe Text)
-> (CreateDeploymentJobResponse
    -> Maybe Text -> CreateDeploymentJobResponse)
-> Lens
     CreateDeploymentJobResponse
     CreateDeploymentJobResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDeploymentJobResponse' {Maybe Text
arn :: Maybe Text
$sel:arn:CreateDeploymentJobResponse' :: CreateDeploymentJobResponse -> Maybe Text
arn} -> Maybe Text
arn) (\s :: CreateDeploymentJobResponse
s@CreateDeploymentJobResponse' {} Maybe Text
a -> CreateDeploymentJobResponse
s {$sel:arn:CreateDeploymentJobResponse' :: Maybe Text
arn = Maybe Text
a} :: CreateDeploymentJobResponse)

-- | The time, in milliseconds since the epoch, when the fleet was created.
createDeploymentJobResponse_createdAt :: Lens.Lens' CreateDeploymentJobResponse (Prelude.Maybe Prelude.UTCTime)
createDeploymentJobResponse_createdAt :: (Maybe UTCTime -> f (Maybe UTCTime))
-> CreateDeploymentJobResponse -> f CreateDeploymentJobResponse
createDeploymentJobResponse_createdAt = (CreateDeploymentJobResponse -> Maybe POSIX)
-> (CreateDeploymentJobResponse
    -> Maybe POSIX -> CreateDeploymentJobResponse)
-> Lens
     CreateDeploymentJobResponse
     CreateDeploymentJobResponse
     (Maybe POSIX)
     (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDeploymentJobResponse' {Maybe POSIX
createdAt :: Maybe POSIX
$sel:createdAt:CreateDeploymentJobResponse' :: CreateDeploymentJobResponse -> Maybe POSIX
createdAt} -> Maybe POSIX
createdAt) (\s :: CreateDeploymentJobResponse
s@CreateDeploymentJobResponse' {} Maybe POSIX
a -> CreateDeploymentJobResponse
s {$sel:createdAt:CreateDeploymentJobResponse' :: Maybe POSIX
createdAt = Maybe POSIX
a} :: CreateDeploymentJobResponse) ((Maybe POSIX -> f (Maybe POSIX))
 -> CreateDeploymentJobResponse -> f CreateDeploymentJobResponse)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> CreateDeploymentJobResponse
-> f CreateDeploymentJobResponse
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 failure code of the simulation job if it failed:
--
-- [BadPermissionError]
--     AWS Greengrass requires a service-level role permission to access
--     other services. The role must include the
--     <https://console.aws.amazon.com/iam/home?#/policies/arn:aws:iam::aws:policy/service-role/AWSGreengrassResourceAccessRolePolicy$jsonEditor AWSGreengrassResourceAccessRolePolicy managed policy>.
--
-- [ExtractingBundleFailure]
--     The robot application could not be extracted from the bundle.
--
-- [FailureThresholdBreached]
--     The percentage of robots that could not be updated exceeded the
--     percentage set for the deployment.
--
-- [GreengrassDeploymentFailed]
--     The robot application could not be deployed to the robot.
--
-- [GreengrassGroupVersionDoesNotExist]
--     The AWS Greengrass group or version associated with a robot is
--     missing.
--
-- [InternalServerError]
--     An internal error has occurred. Retry your request, but if the
--     problem persists, contact us with details.
--
-- [MissingRobotApplicationArchitecture]
--     The robot application does not have a source that matches the
--     architecture of the robot.
--
-- [MissingRobotDeploymentResource]
--     One or more of the resources specified for the robot application are
--     missing. For example, does the robot application have the correct
--     launch package and launch file?
--
-- [PostLaunchFileFailure]
--     The post-launch script failed.
--
-- [PreLaunchFileFailure]
--     The pre-launch script failed.
--
-- [ResourceNotFound]
--     One or more deployment resources are missing. For example, do robot
--     application source bundles still exist?
--
-- [RobotDeploymentNoResponse]
--     There is no response from the robot. It might not be powered on or
--     connected to the internet.
createDeploymentJobResponse_failureCode :: Lens.Lens' CreateDeploymentJobResponse (Prelude.Maybe DeploymentJobErrorCode)
createDeploymentJobResponse_failureCode :: (Maybe DeploymentJobErrorCode -> f (Maybe DeploymentJobErrorCode))
-> CreateDeploymentJobResponse -> f CreateDeploymentJobResponse
createDeploymentJobResponse_failureCode = (CreateDeploymentJobResponse -> Maybe DeploymentJobErrorCode)
-> (CreateDeploymentJobResponse
    -> Maybe DeploymentJobErrorCode -> CreateDeploymentJobResponse)
-> Lens
     CreateDeploymentJobResponse
     CreateDeploymentJobResponse
     (Maybe DeploymentJobErrorCode)
     (Maybe DeploymentJobErrorCode)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDeploymentJobResponse' {Maybe DeploymentJobErrorCode
failureCode :: Maybe DeploymentJobErrorCode
$sel:failureCode:CreateDeploymentJobResponse' :: CreateDeploymentJobResponse -> Maybe DeploymentJobErrorCode
failureCode} -> Maybe DeploymentJobErrorCode
failureCode) (\s :: CreateDeploymentJobResponse
s@CreateDeploymentJobResponse' {} Maybe DeploymentJobErrorCode
a -> CreateDeploymentJobResponse
s {$sel:failureCode:CreateDeploymentJobResponse' :: Maybe DeploymentJobErrorCode
failureCode = Maybe DeploymentJobErrorCode
a} :: CreateDeploymentJobResponse)

-- | The deployment configuration.
createDeploymentJobResponse_deploymentConfig :: Lens.Lens' CreateDeploymentJobResponse (Prelude.Maybe DeploymentConfig)
createDeploymentJobResponse_deploymentConfig :: (Maybe DeploymentConfig -> f (Maybe DeploymentConfig))
-> CreateDeploymentJobResponse -> f CreateDeploymentJobResponse
createDeploymentJobResponse_deploymentConfig = (CreateDeploymentJobResponse -> Maybe DeploymentConfig)
-> (CreateDeploymentJobResponse
    -> Maybe DeploymentConfig -> CreateDeploymentJobResponse)
-> Lens
     CreateDeploymentJobResponse
     CreateDeploymentJobResponse
     (Maybe DeploymentConfig)
     (Maybe DeploymentConfig)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDeploymentJobResponse' {Maybe DeploymentConfig
deploymentConfig :: Maybe DeploymentConfig
$sel:deploymentConfig:CreateDeploymentJobResponse' :: CreateDeploymentJobResponse -> Maybe DeploymentConfig
deploymentConfig} -> Maybe DeploymentConfig
deploymentConfig) (\s :: CreateDeploymentJobResponse
s@CreateDeploymentJobResponse' {} Maybe DeploymentConfig
a -> CreateDeploymentJobResponse
s {$sel:deploymentConfig:CreateDeploymentJobResponse' :: Maybe DeploymentConfig
deploymentConfig = Maybe DeploymentConfig
a} :: CreateDeploymentJobResponse)

-- | The target fleet for the deployment job.
createDeploymentJobResponse_fleet :: Lens.Lens' CreateDeploymentJobResponse (Prelude.Maybe Prelude.Text)
createDeploymentJobResponse_fleet :: (Maybe Text -> f (Maybe Text))
-> CreateDeploymentJobResponse -> f CreateDeploymentJobResponse
createDeploymentJobResponse_fleet = (CreateDeploymentJobResponse -> Maybe Text)
-> (CreateDeploymentJobResponse
    -> Maybe Text -> CreateDeploymentJobResponse)
-> Lens
     CreateDeploymentJobResponse
     CreateDeploymentJobResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDeploymentJobResponse' {Maybe Text
fleet :: Maybe Text
$sel:fleet:CreateDeploymentJobResponse' :: CreateDeploymentJobResponse -> Maybe Text
fleet} -> Maybe Text
fleet) (\s :: CreateDeploymentJobResponse
s@CreateDeploymentJobResponse' {} Maybe Text
a -> CreateDeploymentJobResponse
s {$sel:fleet:CreateDeploymentJobResponse' :: Maybe Text
fleet = Maybe Text
a} :: CreateDeploymentJobResponse)

-- | The list of all tags added to the deployment job.
createDeploymentJobResponse_tags :: Lens.Lens' CreateDeploymentJobResponse (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
createDeploymentJobResponse_tags :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> CreateDeploymentJobResponse -> f CreateDeploymentJobResponse
createDeploymentJobResponse_tags = (CreateDeploymentJobResponse -> Maybe (HashMap Text Text))
-> (CreateDeploymentJobResponse
    -> Maybe (HashMap Text Text) -> CreateDeploymentJobResponse)
-> Lens
     CreateDeploymentJobResponse
     CreateDeploymentJobResponse
     (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 (\CreateDeploymentJobResponse' {Maybe (HashMap Text Text)
tags :: Maybe (HashMap Text Text)
$sel:tags:CreateDeploymentJobResponse' :: CreateDeploymentJobResponse -> Maybe (HashMap Text Text)
tags} -> Maybe (HashMap Text Text)
tags) (\s :: CreateDeploymentJobResponse
s@CreateDeploymentJobResponse' {} Maybe (HashMap Text Text)
a -> CreateDeploymentJobResponse
s {$sel:tags:CreateDeploymentJobResponse' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
a} :: CreateDeploymentJobResponse) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
 -> CreateDeploymentJobResponse -> f CreateDeploymentJobResponse)
-> ((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)))
-> CreateDeploymentJobResponse
-> f CreateDeploymentJobResponse
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 response's http status code.
createDeploymentJobResponse_httpStatus :: Lens.Lens' CreateDeploymentJobResponse Prelude.Int
createDeploymentJobResponse_httpStatus :: (Int -> f Int)
-> CreateDeploymentJobResponse -> f CreateDeploymentJobResponse
createDeploymentJobResponse_httpStatus = (CreateDeploymentJobResponse -> Int)
-> (CreateDeploymentJobResponse
    -> Int -> CreateDeploymentJobResponse)
-> Lens
     CreateDeploymentJobResponse CreateDeploymentJobResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDeploymentJobResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateDeploymentJobResponse' :: CreateDeploymentJobResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateDeploymentJobResponse
s@CreateDeploymentJobResponse' {} Int
a -> CreateDeploymentJobResponse
s {$sel:httpStatus:CreateDeploymentJobResponse' :: Int
httpStatus = Int
a} :: CreateDeploymentJobResponse)

instance Prelude.NFData CreateDeploymentJobResponse