{-# 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.Panorama.CreateApplicationInstance
-- 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 an application instance and deploys it to a device.
module Amazonka.Panorama.CreateApplicationInstance
  ( -- * Creating a Request
    CreateApplicationInstance (..),
    newCreateApplicationInstance,

    -- * Request Lenses
    createApplicationInstance_manifestOverridesPayload,
    createApplicationInstance_name,
    createApplicationInstance_runtimeRoleArn,
    createApplicationInstance_description,
    createApplicationInstance_tags,
    createApplicationInstance_applicationInstanceIdToReplace,
    createApplicationInstance_manifestPayload,
    createApplicationInstance_defaultRuntimeContextDevice,

    -- * Destructuring the Response
    CreateApplicationInstanceResponse (..),
    newCreateApplicationInstanceResponse,

    -- * Response Lenses
    createApplicationInstanceResponse_httpStatus,
    createApplicationInstanceResponse_applicationInstanceId,
  )
where

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

-- | /See:/ 'newCreateApplicationInstance' smart constructor.
data CreateApplicationInstance = CreateApplicationInstance'
  { -- | Setting overrides for the application manifest.
    CreateApplicationInstance -> Maybe ManifestOverridesPayload
manifestOverridesPayload :: Prelude.Maybe ManifestOverridesPayload,
    -- | A name for the application instance.
    CreateApplicationInstance -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The ARN of a runtime role for the application instance.
    CreateApplicationInstance -> Maybe Text
runtimeRoleArn :: Prelude.Maybe Prelude.Text,
    -- | A description for the application instance.
    CreateApplicationInstance -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | Tags for the application instance.
    CreateApplicationInstance -> Maybe (HashMap Text Text)
tags :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | The ID of an application instance to replace with the new instance.
    CreateApplicationInstance -> Maybe Text
applicationInstanceIdToReplace :: Prelude.Maybe Prelude.Text,
    -- | The application\'s manifest document.
    CreateApplicationInstance -> ManifestPayload
manifestPayload :: ManifestPayload,
    -- | A device\'s ID.
    CreateApplicationInstance -> Text
defaultRuntimeContextDevice :: Prelude.Text
  }
  deriving (CreateApplicationInstance -> CreateApplicationInstance -> Bool
(CreateApplicationInstance -> CreateApplicationInstance -> Bool)
-> (CreateApplicationInstance -> CreateApplicationInstance -> Bool)
-> Eq CreateApplicationInstance
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateApplicationInstance -> CreateApplicationInstance -> Bool
$c/= :: CreateApplicationInstance -> CreateApplicationInstance -> Bool
== :: CreateApplicationInstance -> CreateApplicationInstance -> Bool
$c== :: CreateApplicationInstance -> CreateApplicationInstance -> Bool
Prelude.Eq, ReadPrec [CreateApplicationInstance]
ReadPrec CreateApplicationInstance
Int -> ReadS CreateApplicationInstance
ReadS [CreateApplicationInstance]
(Int -> ReadS CreateApplicationInstance)
-> ReadS [CreateApplicationInstance]
-> ReadPrec CreateApplicationInstance
-> ReadPrec [CreateApplicationInstance]
-> Read CreateApplicationInstance
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateApplicationInstance]
$creadListPrec :: ReadPrec [CreateApplicationInstance]
readPrec :: ReadPrec CreateApplicationInstance
$creadPrec :: ReadPrec CreateApplicationInstance
readList :: ReadS [CreateApplicationInstance]
$creadList :: ReadS [CreateApplicationInstance]
readsPrec :: Int -> ReadS CreateApplicationInstance
$creadsPrec :: Int -> ReadS CreateApplicationInstance
Prelude.Read, Int -> CreateApplicationInstance -> ShowS
[CreateApplicationInstance] -> ShowS
CreateApplicationInstance -> String
(Int -> CreateApplicationInstance -> ShowS)
-> (CreateApplicationInstance -> String)
-> ([CreateApplicationInstance] -> ShowS)
-> Show CreateApplicationInstance
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateApplicationInstance] -> ShowS
$cshowList :: [CreateApplicationInstance] -> ShowS
show :: CreateApplicationInstance -> String
$cshow :: CreateApplicationInstance -> String
showsPrec :: Int -> CreateApplicationInstance -> ShowS
$cshowsPrec :: Int -> CreateApplicationInstance -> ShowS
Prelude.Show, (forall x.
 CreateApplicationInstance -> Rep CreateApplicationInstance x)
-> (forall x.
    Rep CreateApplicationInstance x -> CreateApplicationInstance)
-> Generic CreateApplicationInstance
forall x.
Rep CreateApplicationInstance x -> CreateApplicationInstance
forall x.
CreateApplicationInstance -> Rep CreateApplicationInstance x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateApplicationInstance x -> CreateApplicationInstance
$cfrom :: forall x.
CreateApplicationInstance -> Rep CreateApplicationInstance x
Prelude.Generic)

-- |
-- Create a value of 'CreateApplicationInstance' 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:
--
-- 'manifestOverridesPayload', 'createApplicationInstance_manifestOverridesPayload' - Setting overrides for the application manifest.
--
-- 'name', 'createApplicationInstance_name' - A name for the application instance.
--
-- 'runtimeRoleArn', 'createApplicationInstance_runtimeRoleArn' - The ARN of a runtime role for the application instance.
--
-- 'description', 'createApplicationInstance_description' - A description for the application instance.
--
-- 'tags', 'createApplicationInstance_tags' - Tags for the application instance.
--
-- 'applicationInstanceIdToReplace', 'createApplicationInstance_applicationInstanceIdToReplace' - The ID of an application instance to replace with the new instance.
--
-- 'manifestPayload', 'createApplicationInstance_manifestPayload' - The application\'s manifest document.
--
-- 'defaultRuntimeContextDevice', 'createApplicationInstance_defaultRuntimeContextDevice' - A device\'s ID.
newCreateApplicationInstance ::
  -- | 'manifestPayload'
  ManifestPayload ->
  -- | 'defaultRuntimeContextDevice'
  Prelude.Text ->
  CreateApplicationInstance
newCreateApplicationInstance :: ManifestPayload -> Text -> CreateApplicationInstance
newCreateApplicationInstance
  ManifestPayload
pManifestPayload_
  Text
pDefaultRuntimeContextDevice_ =
    CreateApplicationInstance' :: Maybe ManifestOverridesPayload
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe (HashMap Text Text)
-> Maybe Text
-> ManifestPayload
-> Text
-> CreateApplicationInstance
CreateApplicationInstance'
      { $sel:manifestOverridesPayload:CreateApplicationInstance' :: Maybe ManifestOverridesPayload
manifestOverridesPayload =
          Maybe ManifestOverridesPayload
forall a. Maybe a
Prelude.Nothing,
        $sel:name:CreateApplicationInstance' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:runtimeRoleArn:CreateApplicationInstance' :: Maybe Text
runtimeRoleArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:description:CreateApplicationInstance' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:tags:CreateApplicationInstance' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing,
        $sel:applicationInstanceIdToReplace:CreateApplicationInstance' :: Maybe Text
applicationInstanceIdToReplace = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:manifestPayload:CreateApplicationInstance' :: ManifestPayload
manifestPayload = ManifestPayload
pManifestPayload_,
        $sel:defaultRuntimeContextDevice:CreateApplicationInstance' :: Text
defaultRuntimeContextDevice =
          Text
pDefaultRuntimeContextDevice_
      }

-- | Setting overrides for the application manifest.
createApplicationInstance_manifestOverridesPayload :: Lens.Lens' CreateApplicationInstance (Prelude.Maybe ManifestOverridesPayload)
createApplicationInstance_manifestOverridesPayload :: (Maybe ManifestOverridesPayload
 -> f (Maybe ManifestOverridesPayload))
-> CreateApplicationInstance -> f CreateApplicationInstance
createApplicationInstance_manifestOverridesPayload = (CreateApplicationInstance -> Maybe ManifestOverridesPayload)
-> (CreateApplicationInstance
    -> Maybe ManifestOverridesPayload -> CreateApplicationInstance)
-> Lens
     CreateApplicationInstance
     CreateApplicationInstance
     (Maybe ManifestOverridesPayload)
     (Maybe ManifestOverridesPayload)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateApplicationInstance' {Maybe ManifestOverridesPayload
manifestOverridesPayload :: Maybe ManifestOverridesPayload
$sel:manifestOverridesPayload:CreateApplicationInstance' :: CreateApplicationInstance -> Maybe ManifestOverridesPayload
manifestOverridesPayload} -> Maybe ManifestOverridesPayload
manifestOverridesPayload) (\s :: CreateApplicationInstance
s@CreateApplicationInstance' {} Maybe ManifestOverridesPayload
a -> CreateApplicationInstance
s {$sel:manifestOverridesPayload:CreateApplicationInstance' :: Maybe ManifestOverridesPayload
manifestOverridesPayload = Maybe ManifestOverridesPayload
a} :: CreateApplicationInstance)

-- | A name for the application instance.
createApplicationInstance_name :: Lens.Lens' CreateApplicationInstance (Prelude.Maybe Prelude.Text)
createApplicationInstance_name :: (Maybe Text -> f (Maybe Text))
-> CreateApplicationInstance -> f CreateApplicationInstance
createApplicationInstance_name = (CreateApplicationInstance -> Maybe Text)
-> (CreateApplicationInstance
    -> Maybe Text -> CreateApplicationInstance)
-> Lens
     CreateApplicationInstance
     CreateApplicationInstance
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateApplicationInstance' {Maybe Text
name :: Maybe Text
$sel:name:CreateApplicationInstance' :: CreateApplicationInstance -> Maybe Text
name} -> Maybe Text
name) (\s :: CreateApplicationInstance
s@CreateApplicationInstance' {} Maybe Text
a -> CreateApplicationInstance
s {$sel:name:CreateApplicationInstance' :: Maybe Text
name = Maybe Text
a} :: CreateApplicationInstance)

-- | The ARN of a runtime role for the application instance.
createApplicationInstance_runtimeRoleArn :: Lens.Lens' CreateApplicationInstance (Prelude.Maybe Prelude.Text)
createApplicationInstance_runtimeRoleArn :: (Maybe Text -> f (Maybe Text))
-> CreateApplicationInstance -> f CreateApplicationInstance
createApplicationInstance_runtimeRoleArn = (CreateApplicationInstance -> Maybe Text)
-> (CreateApplicationInstance
    -> Maybe Text -> CreateApplicationInstance)
-> Lens
     CreateApplicationInstance
     CreateApplicationInstance
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateApplicationInstance' {Maybe Text
runtimeRoleArn :: Maybe Text
$sel:runtimeRoleArn:CreateApplicationInstance' :: CreateApplicationInstance -> Maybe Text
runtimeRoleArn} -> Maybe Text
runtimeRoleArn) (\s :: CreateApplicationInstance
s@CreateApplicationInstance' {} Maybe Text
a -> CreateApplicationInstance
s {$sel:runtimeRoleArn:CreateApplicationInstance' :: Maybe Text
runtimeRoleArn = Maybe Text
a} :: CreateApplicationInstance)

-- | A description for the application instance.
createApplicationInstance_description :: Lens.Lens' CreateApplicationInstance (Prelude.Maybe Prelude.Text)
createApplicationInstance_description :: (Maybe Text -> f (Maybe Text))
-> CreateApplicationInstance -> f CreateApplicationInstance
createApplicationInstance_description = (CreateApplicationInstance -> Maybe Text)
-> (CreateApplicationInstance
    -> Maybe Text -> CreateApplicationInstance)
-> Lens
     CreateApplicationInstance
     CreateApplicationInstance
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateApplicationInstance' {Maybe Text
description :: Maybe Text
$sel:description:CreateApplicationInstance' :: CreateApplicationInstance -> Maybe Text
description} -> Maybe Text
description) (\s :: CreateApplicationInstance
s@CreateApplicationInstance' {} Maybe Text
a -> CreateApplicationInstance
s {$sel:description:CreateApplicationInstance' :: Maybe Text
description = Maybe Text
a} :: CreateApplicationInstance)

-- | Tags for the application instance.
createApplicationInstance_tags :: Lens.Lens' CreateApplicationInstance (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
createApplicationInstance_tags :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> CreateApplicationInstance -> f CreateApplicationInstance
createApplicationInstance_tags = (CreateApplicationInstance -> Maybe (HashMap Text Text))
-> (CreateApplicationInstance
    -> Maybe (HashMap Text Text) -> CreateApplicationInstance)
-> Lens
     CreateApplicationInstance
     CreateApplicationInstance
     (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 (\CreateApplicationInstance' {Maybe (HashMap Text Text)
tags :: Maybe (HashMap Text Text)
$sel:tags:CreateApplicationInstance' :: CreateApplicationInstance -> Maybe (HashMap Text Text)
tags} -> Maybe (HashMap Text Text)
tags) (\s :: CreateApplicationInstance
s@CreateApplicationInstance' {} Maybe (HashMap Text Text)
a -> CreateApplicationInstance
s {$sel:tags:CreateApplicationInstance' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
a} :: CreateApplicationInstance) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
 -> CreateApplicationInstance -> f CreateApplicationInstance)
-> ((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)))
-> CreateApplicationInstance
-> f CreateApplicationInstance
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 ID of an application instance to replace with the new instance.
createApplicationInstance_applicationInstanceIdToReplace :: Lens.Lens' CreateApplicationInstance (Prelude.Maybe Prelude.Text)
createApplicationInstance_applicationInstanceIdToReplace :: (Maybe Text -> f (Maybe Text))
-> CreateApplicationInstance -> f CreateApplicationInstance
createApplicationInstance_applicationInstanceIdToReplace = (CreateApplicationInstance -> Maybe Text)
-> (CreateApplicationInstance
    -> Maybe Text -> CreateApplicationInstance)
-> Lens
     CreateApplicationInstance
     CreateApplicationInstance
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateApplicationInstance' {Maybe Text
applicationInstanceIdToReplace :: Maybe Text
$sel:applicationInstanceIdToReplace:CreateApplicationInstance' :: CreateApplicationInstance -> Maybe Text
applicationInstanceIdToReplace} -> Maybe Text
applicationInstanceIdToReplace) (\s :: CreateApplicationInstance
s@CreateApplicationInstance' {} Maybe Text
a -> CreateApplicationInstance
s {$sel:applicationInstanceIdToReplace:CreateApplicationInstance' :: Maybe Text
applicationInstanceIdToReplace = Maybe Text
a} :: CreateApplicationInstance)

-- | The application\'s manifest document.
createApplicationInstance_manifestPayload :: Lens.Lens' CreateApplicationInstance ManifestPayload
createApplicationInstance_manifestPayload :: (ManifestPayload -> f ManifestPayload)
-> CreateApplicationInstance -> f CreateApplicationInstance
createApplicationInstance_manifestPayload = (CreateApplicationInstance -> ManifestPayload)
-> (CreateApplicationInstance
    -> ManifestPayload -> CreateApplicationInstance)
-> Lens
     CreateApplicationInstance
     CreateApplicationInstance
     ManifestPayload
     ManifestPayload
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateApplicationInstance' {ManifestPayload
manifestPayload :: ManifestPayload
$sel:manifestPayload:CreateApplicationInstance' :: CreateApplicationInstance -> ManifestPayload
manifestPayload} -> ManifestPayload
manifestPayload) (\s :: CreateApplicationInstance
s@CreateApplicationInstance' {} ManifestPayload
a -> CreateApplicationInstance
s {$sel:manifestPayload:CreateApplicationInstance' :: ManifestPayload
manifestPayload = ManifestPayload
a} :: CreateApplicationInstance)

-- | A device\'s ID.
createApplicationInstance_defaultRuntimeContextDevice :: Lens.Lens' CreateApplicationInstance Prelude.Text
createApplicationInstance_defaultRuntimeContextDevice :: (Text -> f Text)
-> CreateApplicationInstance -> f CreateApplicationInstance
createApplicationInstance_defaultRuntimeContextDevice = (CreateApplicationInstance -> Text)
-> (CreateApplicationInstance -> Text -> CreateApplicationInstance)
-> Lens
     CreateApplicationInstance CreateApplicationInstance Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateApplicationInstance' {Text
defaultRuntimeContextDevice :: Text
$sel:defaultRuntimeContextDevice:CreateApplicationInstance' :: CreateApplicationInstance -> Text
defaultRuntimeContextDevice} -> Text
defaultRuntimeContextDevice) (\s :: CreateApplicationInstance
s@CreateApplicationInstance' {} Text
a -> CreateApplicationInstance
s {$sel:defaultRuntimeContextDevice:CreateApplicationInstance' :: Text
defaultRuntimeContextDevice = Text
a} :: CreateApplicationInstance)

instance Core.AWSRequest CreateApplicationInstance where
  type
    AWSResponse CreateApplicationInstance =
      CreateApplicationInstanceResponse
  request :: CreateApplicationInstance -> Request CreateApplicationInstance
request = Service
-> CreateApplicationInstance -> Request CreateApplicationInstance
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy CreateApplicationInstance
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CreateApplicationInstance)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse CreateApplicationInstance))
-> Logger
-> Service
-> Proxy CreateApplicationInstance
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CreateApplicationInstance)))
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 ->
          Int -> Text -> CreateApplicationInstanceResponse
CreateApplicationInstanceResponse'
            (Int -> Text -> CreateApplicationInstanceResponse)
-> Either String Int
-> Either String (Text -> CreateApplicationInstanceResponse)
forall (f :: * -> *) a b. Functor 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))
            Either String (Text -> CreateApplicationInstanceResponse)
-> Either String Text
-> Either String CreateApplicationInstanceResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String Text
forall a. FromJSON a => Object -> Text -> Either String a
Core..:> Text
"ApplicationInstanceId")
      )

instance Prelude.Hashable CreateApplicationInstance

instance Prelude.NFData CreateApplicationInstance

instance Core.ToHeaders CreateApplicationInstance where
  toHeaders :: CreateApplicationInstance -> ResponseHeaders
toHeaders =
    ResponseHeaders -> CreateApplicationInstance -> 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 CreateApplicationInstance where
  toJSON :: CreateApplicationInstance -> Value
toJSON CreateApplicationInstance' {Maybe Text
Maybe (HashMap Text Text)
Maybe ManifestOverridesPayload
Text
ManifestPayload
defaultRuntimeContextDevice :: Text
manifestPayload :: ManifestPayload
applicationInstanceIdToReplace :: Maybe Text
tags :: Maybe (HashMap Text Text)
description :: Maybe Text
runtimeRoleArn :: Maybe Text
name :: Maybe Text
manifestOverridesPayload :: Maybe ManifestOverridesPayload
$sel:defaultRuntimeContextDevice:CreateApplicationInstance' :: CreateApplicationInstance -> Text
$sel:manifestPayload:CreateApplicationInstance' :: CreateApplicationInstance -> ManifestPayload
$sel:applicationInstanceIdToReplace:CreateApplicationInstance' :: CreateApplicationInstance -> Maybe Text
$sel:tags:CreateApplicationInstance' :: CreateApplicationInstance -> Maybe (HashMap Text Text)
$sel:description:CreateApplicationInstance' :: CreateApplicationInstance -> Maybe Text
$sel:runtimeRoleArn:CreateApplicationInstance' :: CreateApplicationInstance -> Maybe Text
$sel:name:CreateApplicationInstance' :: CreateApplicationInstance -> Maybe Text
$sel:manifestOverridesPayload:CreateApplicationInstance' :: CreateApplicationInstance -> Maybe ManifestOverridesPayload
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"ManifestOverridesPayload" Text -> ManifestOverridesPayload -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (ManifestOverridesPayload -> Pair)
-> Maybe ManifestOverridesPayload -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ManifestOverridesPayload
manifestOverridesPayload,
            (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
"RuntimeRoleArn" 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
runtimeRoleArn,
            (Text
"Description" 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
description,
            (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,
            (Text
"ApplicationInstanceIdToReplace" 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
applicationInstanceIdToReplace,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"ManifestPayload" Text -> ManifestPayload -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= ManifestPayload
manifestPayload),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              ( Text
"DefaultRuntimeContextDevice"
                  Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
defaultRuntimeContextDevice
              )
          ]
      )

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

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

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

-- |
-- Create a value of 'CreateApplicationInstanceResponse' 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:
--
-- 'httpStatus', 'createApplicationInstanceResponse_httpStatus' - The response's http status code.
--
-- 'applicationInstanceId', 'createApplicationInstanceResponse_applicationInstanceId' - The application instance\'s ID.
newCreateApplicationInstanceResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  -- | 'applicationInstanceId'
  Prelude.Text ->
  CreateApplicationInstanceResponse
newCreateApplicationInstanceResponse :: Int -> Text -> CreateApplicationInstanceResponse
newCreateApplicationInstanceResponse
  Int
pHttpStatus_
  Text
pApplicationInstanceId_ =
    CreateApplicationInstanceResponse' :: Int -> Text -> CreateApplicationInstanceResponse
CreateApplicationInstanceResponse'
      { $sel:httpStatus:CreateApplicationInstanceResponse' :: Int
httpStatus =
          Int
pHttpStatus_,
        $sel:applicationInstanceId:CreateApplicationInstanceResponse' :: Text
applicationInstanceId =
          Text
pApplicationInstanceId_
      }

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

-- | The application instance\'s ID.
createApplicationInstanceResponse_applicationInstanceId :: Lens.Lens' CreateApplicationInstanceResponse Prelude.Text
createApplicationInstanceResponse_applicationInstanceId :: (Text -> f Text)
-> CreateApplicationInstanceResponse
-> f CreateApplicationInstanceResponse
createApplicationInstanceResponse_applicationInstanceId = (CreateApplicationInstanceResponse -> Text)
-> (CreateApplicationInstanceResponse
    -> Text -> CreateApplicationInstanceResponse)
-> Lens
     CreateApplicationInstanceResponse
     CreateApplicationInstanceResponse
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateApplicationInstanceResponse' {Text
applicationInstanceId :: Text
$sel:applicationInstanceId:CreateApplicationInstanceResponse' :: CreateApplicationInstanceResponse -> Text
applicationInstanceId} -> Text
applicationInstanceId) (\s :: CreateApplicationInstanceResponse
s@CreateApplicationInstanceResponse' {} Text
a -> CreateApplicationInstanceResponse
s {$sel:applicationInstanceId:CreateApplicationInstanceResponse' :: Text
applicationInstanceId = Text
a} :: CreateApplicationInstanceResponse)

instance
  Prelude.NFData
    CreateApplicationInstanceResponse