{-# 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.IoTThingsGraph.CreateSystemInstance
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Creates a system instance.
--
-- This action validates the system instance, prepares the
-- deployment-related resources. For Greengrass deployments, it updates the
-- Greengrass group that is specified by the @greengrassGroupName@
-- parameter. It also adds a file to the S3 bucket specified by the
-- @s3BucketName@ parameter. You need to call @DeploySystemInstance@ after
-- running this action.
--
-- For Greengrass deployments, since this action modifies and adds
-- resources to a Greengrass group and an S3 bucket on the caller\'s
-- behalf, the calling identity must have write permissions to both the
-- specified Greengrass group and S3 bucket. Otherwise, the call will fail
-- with an authorization error.
--
-- For cloud deployments, this action requires a @flowActionsRoleArn@
-- value. This is an IAM role that has permissions to access AWS services,
-- such as AWS Lambda and AWS IoT, that the flow uses when it executes.
--
-- If the definition document doesn\'t specify a version of the user\'s
-- namespace, the latest version will be used by default.
module Amazonka.IoTThingsGraph.CreateSystemInstance
  ( -- * Creating a Request
    CreateSystemInstance (..),
    newCreateSystemInstance,

    -- * Request Lenses
    createSystemInstance_metricsConfiguration,
    createSystemInstance_greengrassGroupName,
    createSystemInstance_flowActionsRoleArn,
    createSystemInstance_s3BucketName,
    createSystemInstance_tags,
    createSystemInstance_definition,
    createSystemInstance_target,

    -- * Destructuring the Response
    CreateSystemInstanceResponse (..),
    newCreateSystemInstanceResponse,

    -- * Response Lenses
    createSystemInstanceResponse_summary,
    createSystemInstanceResponse_httpStatus,
  )
where

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

-- | /See:/ 'newCreateSystemInstance' smart constructor.
data CreateSystemInstance = CreateSystemInstance'
  { CreateSystemInstance -> Maybe MetricsConfiguration
metricsConfiguration :: Prelude.Maybe MetricsConfiguration,
    -- | The name of the Greengrass group where the system instance will be
    -- deployed. This value is required if the value of the @target@ parameter
    -- is @GREENGRASS@.
    CreateSystemInstance -> Maybe Text
greengrassGroupName :: Prelude.Maybe Prelude.Text,
    -- | The ARN of the IAM role that AWS IoT Things Graph will assume when it
    -- executes the flow. This role must have read and write access to AWS
    -- Lambda and AWS IoT and any other AWS services that the flow uses when it
    -- executes. This value is required if the value of the @target@ parameter
    -- is @CLOUD@.
    CreateSystemInstance -> Maybe Text
flowActionsRoleArn :: Prelude.Maybe Prelude.Text,
    -- | The name of the Amazon Simple Storage Service bucket that will be used
    -- to store and deploy the system instance\'s resource file. This value is
    -- required if the value of the @target@ parameter is @GREENGRASS@.
    CreateSystemInstance -> Maybe Text
s3BucketName :: Prelude.Maybe Prelude.Text,
    -- | Metadata, consisting of key-value pairs, that can be used to categorize
    -- your system instances.
    CreateSystemInstance -> Maybe [Tag]
tags :: Prelude.Maybe [Tag],
    CreateSystemInstance -> DefinitionDocument
definition :: DefinitionDocument,
    -- | The target type of the deployment. Valid values are @GREENGRASS@ and
    -- @CLOUD@.
    CreateSystemInstance -> DeploymentTarget
target :: DeploymentTarget
  }
  deriving (CreateSystemInstance -> CreateSystemInstance -> Bool
(CreateSystemInstance -> CreateSystemInstance -> Bool)
-> (CreateSystemInstance -> CreateSystemInstance -> Bool)
-> Eq CreateSystemInstance
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateSystemInstance -> CreateSystemInstance -> Bool
$c/= :: CreateSystemInstance -> CreateSystemInstance -> Bool
== :: CreateSystemInstance -> CreateSystemInstance -> Bool
$c== :: CreateSystemInstance -> CreateSystemInstance -> Bool
Prelude.Eq, ReadPrec [CreateSystemInstance]
ReadPrec CreateSystemInstance
Int -> ReadS CreateSystemInstance
ReadS [CreateSystemInstance]
(Int -> ReadS CreateSystemInstance)
-> ReadS [CreateSystemInstance]
-> ReadPrec CreateSystemInstance
-> ReadPrec [CreateSystemInstance]
-> Read CreateSystemInstance
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateSystemInstance]
$creadListPrec :: ReadPrec [CreateSystemInstance]
readPrec :: ReadPrec CreateSystemInstance
$creadPrec :: ReadPrec CreateSystemInstance
readList :: ReadS [CreateSystemInstance]
$creadList :: ReadS [CreateSystemInstance]
readsPrec :: Int -> ReadS CreateSystemInstance
$creadsPrec :: Int -> ReadS CreateSystemInstance
Prelude.Read, Int -> CreateSystemInstance -> ShowS
[CreateSystemInstance] -> ShowS
CreateSystemInstance -> String
(Int -> CreateSystemInstance -> ShowS)
-> (CreateSystemInstance -> String)
-> ([CreateSystemInstance] -> ShowS)
-> Show CreateSystemInstance
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateSystemInstance] -> ShowS
$cshowList :: [CreateSystemInstance] -> ShowS
show :: CreateSystemInstance -> String
$cshow :: CreateSystemInstance -> String
showsPrec :: Int -> CreateSystemInstance -> ShowS
$cshowsPrec :: Int -> CreateSystemInstance -> ShowS
Prelude.Show, (forall x. CreateSystemInstance -> Rep CreateSystemInstance x)
-> (forall x. Rep CreateSystemInstance x -> CreateSystemInstance)
-> Generic CreateSystemInstance
forall x. Rep CreateSystemInstance x -> CreateSystemInstance
forall x. CreateSystemInstance -> Rep CreateSystemInstance x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateSystemInstance x -> CreateSystemInstance
$cfrom :: forall x. CreateSystemInstance -> Rep CreateSystemInstance x
Prelude.Generic)

-- |
-- Create a value of 'CreateSystemInstance' 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:
--
-- 'metricsConfiguration', 'createSystemInstance_metricsConfiguration' - Undocumented member.
--
-- 'greengrassGroupName', 'createSystemInstance_greengrassGroupName' - The name of the Greengrass group where the system instance will be
-- deployed. This value is required if the value of the @target@ parameter
-- is @GREENGRASS@.
--
-- 'flowActionsRoleArn', 'createSystemInstance_flowActionsRoleArn' - The ARN of the IAM role that AWS IoT Things Graph will assume when it
-- executes the flow. This role must have read and write access to AWS
-- Lambda and AWS IoT and any other AWS services that the flow uses when it
-- executes. This value is required if the value of the @target@ parameter
-- is @CLOUD@.
--
-- 's3BucketName', 'createSystemInstance_s3BucketName' - The name of the Amazon Simple Storage Service bucket that will be used
-- to store and deploy the system instance\'s resource file. This value is
-- required if the value of the @target@ parameter is @GREENGRASS@.
--
-- 'tags', 'createSystemInstance_tags' - Metadata, consisting of key-value pairs, that can be used to categorize
-- your system instances.
--
-- 'definition', 'createSystemInstance_definition' - Undocumented member.
--
-- 'target', 'createSystemInstance_target' - The target type of the deployment. Valid values are @GREENGRASS@ and
-- @CLOUD@.
newCreateSystemInstance ::
  -- | 'definition'
  DefinitionDocument ->
  -- | 'target'
  DeploymentTarget ->
  CreateSystemInstance
newCreateSystemInstance :: DefinitionDocument -> DeploymentTarget -> CreateSystemInstance
newCreateSystemInstance DefinitionDocument
pDefinition_ DeploymentTarget
pTarget_ =
  CreateSystemInstance' :: Maybe MetricsConfiguration
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe [Tag]
-> DefinitionDocument
-> DeploymentTarget
-> CreateSystemInstance
CreateSystemInstance'
    { $sel:metricsConfiguration:CreateSystemInstance' :: Maybe MetricsConfiguration
metricsConfiguration =
        Maybe MetricsConfiguration
forall a. Maybe a
Prelude.Nothing,
      $sel:greengrassGroupName:CreateSystemInstance' :: Maybe Text
greengrassGroupName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:flowActionsRoleArn:CreateSystemInstance' :: Maybe Text
flowActionsRoleArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:s3BucketName:CreateSystemInstance' :: Maybe Text
s3BucketName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:tags:CreateSystemInstance' :: Maybe [Tag]
tags = Maybe [Tag]
forall a. Maybe a
Prelude.Nothing,
      $sel:definition:CreateSystemInstance' :: DefinitionDocument
definition = DefinitionDocument
pDefinition_,
      $sel:target:CreateSystemInstance' :: DeploymentTarget
target = DeploymentTarget
pTarget_
    }

-- | Undocumented member.
createSystemInstance_metricsConfiguration :: Lens.Lens' CreateSystemInstance (Prelude.Maybe MetricsConfiguration)
createSystemInstance_metricsConfiguration :: (Maybe MetricsConfiguration -> f (Maybe MetricsConfiguration))
-> CreateSystemInstance -> f CreateSystemInstance
createSystemInstance_metricsConfiguration = (CreateSystemInstance -> Maybe MetricsConfiguration)
-> (CreateSystemInstance
    -> Maybe MetricsConfiguration -> CreateSystemInstance)
-> Lens
     CreateSystemInstance
     CreateSystemInstance
     (Maybe MetricsConfiguration)
     (Maybe MetricsConfiguration)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateSystemInstance' {Maybe MetricsConfiguration
metricsConfiguration :: Maybe MetricsConfiguration
$sel:metricsConfiguration:CreateSystemInstance' :: CreateSystemInstance -> Maybe MetricsConfiguration
metricsConfiguration} -> Maybe MetricsConfiguration
metricsConfiguration) (\s :: CreateSystemInstance
s@CreateSystemInstance' {} Maybe MetricsConfiguration
a -> CreateSystemInstance
s {$sel:metricsConfiguration:CreateSystemInstance' :: Maybe MetricsConfiguration
metricsConfiguration = Maybe MetricsConfiguration
a} :: CreateSystemInstance)

-- | The name of the Greengrass group where the system instance will be
-- deployed. This value is required if the value of the @target@ parameter
-- is @GREENGRASS@.
createSystemInstance_greengrassGroupName :: Lens.Lens' CreateSystemInstance (Prelude.Maybe Prelude.Text)
createSystemInstance_greengrassGroupName :: (Maybe Text -> f (Maybe Text))
-> CreateSystemInstance -> f CreateSystemInstance
createSystemInstance_greengrassGroupName = (CreateSystemInstance -> Maybe Text)
-> (CreateSystemInstance -> Maybe Text -> CreateSystemInstance)
-> Lens
     CreateSystemInstance CreateSystemInstance (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateSystemInstance' {Maybe Text
greengrassGroupName :: Maybe Text
$sel:greengrassGroupName:CreateSystemInstance' :: CreateSystemInstance -> Maybe Text
greengrassGroupName} -> Maybe Text
greengrassGroupName) (\s :: CreateSystemInstance
s@CreateSystemInstance' {} Maybe Text
a -> CreateSystemInstance
s {$sel:greengrassGroupName:CreateSystemInstance' :: Maybe Text
greengrassGroupName = Maybe Text
a} :: CreateSystemInstance)

-- | The ARN of the IAM role that AWS IoT Things Graph will assume when it
-- executes the flow. This role must have read and write access to AWS
-- Lambda and AWS IoT and any other AWS services that the flow uses when it
-- executes. This value is required if the value of the @target@ parameter
-- is @CLOUD@.
createSystemInstance_flowActionsRoleArn :: Lens.Lens' CreateSystemInstance (Prelude.Maybe Prelude.Text)
createSystemInstance_flowActionsRoleArn :: (Maybe Text -> f (Maybe Text))
-> CreateSystemInstance -> f CreateSystemInstance
createSystemInstance_flowActionsRoleArn = (CreateSystemInstance -> Maybe Text)
-> (CreateSystemInstance -> Maybe Text -> CreateSystemInstance)
-> Lens
     CreateSystemInstance CreateSystemInstance (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateSystemInstance' {Maybe Text
flowActionsRoleArn :: Maybe Text
$sel:flowActionsRoleArn:CreateSystemInstance' :: CreateSystemInstance -> Maybe Text
flowActionsRoleArn} -> Maybe Text
flowActionsRoleArn) (\s :: CreateSystemInstance
s@CreateSystemInstance' {} Maybe Text
a -> CreateSystemInstance
s {$sel:flowActionsRoleArn:CreateSystemInstance' :: Maybe Text
flowActionsRoleArn = Maybe Text
a} :: CreateSystemInstance)

-- | The name of the Amazon Simple Storage Service bucket that will be used
-- to store and deploy the system instance\'s resource file. This value is
-- required if the value of the @target@ parameter is @GREENGRASS@.
createSystemInstance_s3BucketName :: Lens.Lens' CreateSystemInstance (Prelude.Maybe Prelude.Text)
createSystemInstance_s3BucketName :: (Maybe Text -> f (Maybe Text))
-> CreateSystemInstance -> f CreateSystemInstance
createSystemInstance_s3BucketName = (CreateSystemInstance -> Maybe Text)
-> (CreateSystemInstance -> Maybe Text -> CreateSystemInstance)
-> Lens
     CreateSystemInstance CreateSystemInstance (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateSystemInstance' {Maybe Text
s3BucketName :: Maybe Text
$sel:s3BucketName:CreateSystemInstance' :: CreateSystemInstance -> Maybe Text
s3BucketName} -> Maybe Text
s3BucketName) (\s :: CreateSystemInstance
s@CreateSystemInstance' {} Maybe Text
a -> CreateSystemInstance
s {$sel:s3BucketName:CreateSystemInstance' :: Maybe Text
s3BucketName = Maybe Text
a} :: CreateSystemInstance)

-- | Metadata, consisting of key-value pairs, that can be used to categorize
-- your system instances.
createSystemInstance_tags :: Lens.Lens' CreateSystemInstance (Prelude.Maybe [Tag])
createSystemInstance_tags :: (Maybe [Tag] -> f (Maybe [Tag]))
-> CreateSystemInstance -> f CreateSystemInstance
createSystemInstance_tags = (CreateSystemInstance -> Maybe [Tag])
-> (CreateSystemInstance -> Maybe [Tag] -> CreateSystemInstance)
-> Lens
     CreateSystemInstance
     CreateSystemInstance
     (Maybe [Tag])
     (Maybe [Tag])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateSystemInstance' {Maybe [Tag]
tags :: Maybe [Tag]
$sel:tags:CreateSystemInstance' :: CreateSystemInstance -> Maybe [Tag]
tags} -> Maybe [Tag]
tags) (\s :: CreateSystemInstance
s@CreateSystemInstance' {} Maybe [Tag]
a -> CreateSystemInstance
s {$sel:tags:CreateSystemInstance' :: Maybe [Tag]
tags = Maybe [Tag]
a} :: CreateSystemInstance) ((Maybe [Tag] -> f (Maybe [Tag]))
 -> CreateSystemInstance -> f CreateSystemInstance)
-> ((Maybe [Tag] -> f (Maybe [Tag]))
    -> Maybe [Tag] -> f (Maybe [Tag]))
-> (Maybe [Tag] -> f (Maybe [Tag]))
-> CreateSystemInstance
-> f CreateSystemInstance
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

-- | Undocumented member.
createSystemInstance_definition :: Lens.Lens' CreateSystemInstance DefinitionDocument
createSystemInstance_definition :: (DefinitionDocument -> f DefinitionDocument)
-> CreateSystemInstance -> f CreateSystemInstance
createSystemInstance_definition = (CreateSystemInstance -> DefinitionDocument)
-> (CreateSystemInstance
    -> DefinitionDocument -> CreateSystemInstance)
-> Lens
     CreateSystemInstance
     CreateSystemInstance
     DefinitionDocument
     DefinitionDocument
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateSystemInstance' {DefinitionDocument
definition :: DefinitionDocument
$sel:definition:CreateSystemInstance' :: CreateSystemInstance -> DefinitionDocument
definition} -> DefinitionDocument
definition) (\s :: CreateSystemInstance
s@CreateSystemInstance' {} DefinitionDocument
a -> CreateSystemInstance
s {$sel:definition:CreateSystemInstance' :: DefinitionDocument
definition = DefinitionDocument
a} :: CreateSystemInstance)

-- | The target type of the deployment. Valid values are @GREENGRASS@ and
-- @CLOUD@.
createSystemInstance_target :: Lens.Lens' CreateSystemInstance DeploymentTarget
createSystemInstance_target :: (DeploymentTarget -> f DeploymentTarget)
-> CreateSystemInstance -> f CreateSystemInstance
createSystemInstance_target = (CreateSystemInstance -> DeploymentTarget)
-> (CreateSystemInstance
    -> DeploymentTarget -> CreateSystemInstance)
-> Lens
     CreateSystemInstance
     CreateSystemInstance
     DeploymentTarget
     DeploymentTarget
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateSystemInstance' {DeploymentTarget
target :: DeploymentTarget
$sel:target:CreateSystemInstance' :: CreateSystemInstance -> DeploymentTarget
target} -> DeploymentTarget
target) (\s :: CreateSystemInstance
s@CreateSystemInstance' {} DeploymentTarget
a -> CreateSystemInstance
s {$sel:target:CreateSystemInstance' :: DeploymentTarget
target = DeploymentTarget
a} :: CreateSystemInstance)

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

instance Prelude.NFData CreateSystemInstance

instance Core.ToHeaders CreateSystemInstance where
  toHeaders :: CreateSystemInstance -> ResponseHeaders
toHeaders =
    ResponseHeaders -> CreateSystemInstance -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"IotThingsGraphFrontEndService.CreateSystemInstance" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Core.ToJSON CreateSystemInstance where
  toJSON :: CreateSystemInstance -> Value
toJSON CreateSystemInstance' {Maybe [Tag]
Maybe Text
Maybe MetricsConfiguration
DefinitionDocument
DeploymentTarget
target :: DeploymentTarget
definition :: DefinitionDocument
tags :: Maybe [Tag]
s3BucketName :: Maybe Text
flowActionsRoleArn :: Maybe Text
greengrassGroupName :: Maybe Text
metricsConfiguration :: Maybe MetricsConfiguration
$sel:target:CreateSystemInstance' :: CreateSystemInstance -> DeploymentTarget
$sel:definition:CreateSystemInstance' :: CreateSystemInstance -> DefinitionDocument
$sel:tags:CreateSystemInstance' :: CreateSystemInstance -> Maybe [Tag]
$sel:s3BucketName:CreateSystemInstance' :: CreateSystemInstance -> Maybe Text
$sel:flowActionsRoleArn:CreateSystemInstance' :: CreateSystemInstance -> Maybe Text
$sel:greengrassGroupName:CreateSystemInstance' :: CreateSystemInstance -> Maybe Text
$sel:metricsConfiguration:CreateSystemInstance' :: CreateSystemInstance -> Maybe MetricsConfiguration
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"metricsConfiguration" Text -> MetricsConfiguration -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (MetricsConfiguration -> Pair)
-> Maybe MetricsConfiguration -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe MetricsConfiguration
metricsConfiguration,
            (Text
"greengrassGroupName" 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
greengrassGroupName,
            (Text
"flowActionsRoleArn" 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
flowActionsRoleArn,
            (Text
"s3BucketName" 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
s3BucketName,
            (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
"definition" Text -> DefinitionDocument -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= DefinitionDocument
definition),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"target" Text -> DeploymentTarget -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= DeploymentTarget
target)
          ]
      )

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

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

-- | /See:/ 'newCreateSystemInstanceResponse' smart constructor.
data CreateSystemInstanceResponse = CreateSystemInstanceResponse'
  { -- | The summary object that describes the new system instance.
    CreateSystemInstanceResponse -> Maybe SystemInstanceSummary
summary :: Prelude.Maybe SystemInstanceSummary,
    -- | The response's http status code.
    CreateSystemInstanceResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (CreateSystemInstanceResponse
-> CreateSystemInstanceResponse -> Bool
(CreateSystemInstanceResponse
 -> CreateSystemInstanceResponse -> Bool)
-> (CreateSystemInstanceResponse
    -> CreateSystemInstanceResponse -> Bool)
-> Eq CreateSystemInstanceResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateSystemInstanceResponse
-> CreateSystemInstanceResponse -> Bool
$c/= :: CreateSystemInstanceResponse
-> CreateSystemInstanceResponse -> Bool
== :: CreateSystemInstanceResponse
-> CreateSystemInstanceResponse -> Bool
$c== :: CreateSystemInstanceResponse
-> CreateSystemInstanceResponse -> Bool
Prelude.Eq, ReadPrec [CreateSystemInstanceResponse]
ReadPrec CreateSystemInstanceResponse
Int -> ReadS CreateSystemInstanceResponse
ReadS [CreateSystemInstanceResponse]
(Int -> ReadS CreateSystemInstanceResponse)
-> ReadS [CreateSystemInstanceResponse]
-> ReadPrec CreateSystemInstanceResponse
-> ReadPrec [CreateSystemInstanceResponse]
-> Read CreateSystemInstanceResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateSystemInstanceResponse]
$creadListPrec :: ReadPrec [CreateSystemInstanceResponse]
readPrec :: ReadPrec CreateSystemInstanceResponse
$creadPrec :: ReadPrec CreateSystemInstanceResponse
readList :: ReadS [CreateSystemInstanceResponse]
$creadList :: ReadS [CreateSystemInstanceResponse]
readsPrec :: Int -> ReadS CreateSystemInstanceResponse
$creadsPrec :: Int -> ReadS CreateSystemInstanceResponse
Prelude.Read, Int -> CreateSystemInstanceResponse -> ShowS
[CreateSystemInstanceResponse] -> ShowS
CreateSystemInstanceResponse -> String
(Int -> CreateSystemInstanceResponse -> ShowS)
-> (CreateSystemInstanceResponse -> String)
-> ([CreateSystemInstanceResponse] -> ShowS)
-> Show CreateSystemInstanceResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateSystemInstanceResponse] -> ShowS
$cshowList :: [CreateSystemInstanceResponse] -> ShowS
show :: CreateSystemInstanceResponse -> String
$cshow :: CreateSystemInstanceResponse -> String
showsPrec :: Int -> CreateSystemInstanceResponse -> ShowS
$cshowsPrec :: Int -> CreateSystemInstanceResponse -> ShowS
Prelude.Show, (forall x.
 CreateSystemInstanceResponse -> Rep CreateSystemInstanceResponse x)
-> (forall x.
    Rep CreateSystemInstanceResponse x -> CreateSystemInstanceResponse)
-> Generic CreateSystemInstanceResponse
forall x.
Rep CreateSystemInstanceResponse x -> CreateSystemInstanceResponse
forall x.
CreateSystemInstanceResponse -> Rep CreateSystemInstanceResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateSystemInstanceResponse x -> CreateSystemInstanceResponse
$cfrom :: forall x.
CreateSystemInstanceResponse -> Rep CreateSystemInstanceResponse x
Prelude.Generic)

-- |
-- Create a value of 'CreateSystemInstanceResponse' 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:
--
-- 'summary', 'createSystemInstanceResponse_summary' - The summary object that describes the new system instance.
--
-- 'httpStatus', 'createSystemInstanceResponse_httpStatus' - The response's http status code.
newCreateSystemInstanceResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  CreateSystemInstanceResponse
newCreateSystemInstanceResponse :: Int -> CreateSystemInstanceResponse
newCreateSystemInstanceResponse Int
pHttpStatus_ =
  CreateSystemInstanceResponse' :: Maybe SystemInstanceSummary -> Int -> CreateSystemInstanceResponse
CreateSystemInstanceResponse'
    { $sel:summary:CreateSystemInstanceResponse' :: Maybe SystemInstanceSummary
summary =
        Maybe SystemInstanceSummary
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:CreateSystemInstanceResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The summary object that describes the new system instance.
createSystemInstanceResponse_summary :: Lens.Lens' CreateSystemInstanceResponse (Prelude.Maybe SystemInstanceSummary)
createSystemInstanceResponse_summary :: (Maybe SystemInstanceSummary -> f (Maybe SystemInstanceSummary))
-> CreateSystemInstanceResponse -> f CreateSystemInstanceResponse
createSystemInstanceResponse_summary = (CreateSystemInstanceResponse -> Maybe SystemInstanceSummary)
-> (CreateSystemInstanceResponse
    -> Maybe SystemInstanceSummary -> CreateSystemInstanceResponse)
-> Lens
     CreateSystemInstanceResponse
     CreateSystemInstanceResponse
     (Maybe SystemInstanceSummary)
     (Maybe SystemInstanceSummary)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateSystemInstanceResponse' {Maybe SystemInstanceSummary
summary :: Maybe SystemInstanceSummary
$sel:summary:CreateSystemInstanceResponse' :: CreateSystemInstanceResponse -> Maybe SystemInstanceSummary
summary} -> Maybe SystemInstanceSummary
summary) (\s :: CreateSystemInstanceResponse
s@CreateSystemInstanceResponse' {} Maybe SystemInstanceSummary
a -> CreateSystemInstanceResponse
s {$sel:summary:CreateSystemInstanceResponse' :: Maybe SystemInstanceSummary
summary = Maybe SystemInstanceSummary
a} :: CreateSystemInstanceResponse)

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

instance Prelude.NFData CreateSystemInstanceResponse