{-# 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.OpsWorks.CreateApp
-- 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 app for a specified stack. For more information, see
-- <https://docs.aws.amazon.com/opsworks/latest/userguide/workingapps-creating.html Creating Apps>.
--
-- __Required Permissions__: To use this action, an IAM user must have a
-- Manage permissions level for the stack, or an attached policy that
-- explicitly grants permissions. For more information on user permissions,
-- see
-- <https://docs.aws.amazon.com/opsworks/latest/userguide/opsworks-security-users.html Managing User Permissions>.
module Amazonka.OpsWorks.CreateApp
  ( -- * Creating a Request
    CreateApp (..),
    newCreateApp,

    -- * Request Lenses
    createApp_sslConfiguration,
    createApp_environment,
    createApp_enableSsl,
    createApp_shortname,
    createApp_dataSources,
    createApp_appSource,
    createApp_attributes,
    createApp_domains,
    createApp_description,
    createApp_stackId,
    createApp_name,
    createApp_type,

    -- * Destructuring the Response
    CreateAppResponse (..),
    newCreateAppResponse,

    -- * Response Lenses
    createAppResponse_appId,
    createAppResponse_httpStatus,
  )
where

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

-- | /See:/ 'newCreateApp' smart constructor.
data CreateApp = CreateApp'
  { -- | An @SslConfiguration@ object with the SSL configuration.
    CreateApp -> Maybe SslConfiguration
sslConfiguration :: Prelude.Maybe SslConfiguration,
    -- | An array of @EnvironmentVariable@ objects that specify environment
    -- variables to be associated with the app. After you deploy the app, these
    -- variables are defined on the associated app server instance. For more
    -- information, see
    -- <https://docs.aws.amazon.com/opsworks/latest/userguide/workingapps-creating.html#workingapps-creating-environment Environment Variables>.
    --
    -- There is no specific limit on the number of environment variables.
    -- However, the size of the associated data structure - which includes the
    -- variables\' names, values, and protected flag values - cannot exceed 20
    -- KB. This limit should accommodate most if not all use cases. Exceeding
    -- it will cause an exception with the message, \"Environment: is too large
    -- (maximum is 20KB).\"
    --
    -- If you have specified one or more environment variables, you cannot
    -- modify the stack\'s Chef version.
    CreateApp -> Maybe [EnvironmentVariable]
environment :: Prelude.Maybe [EnvironmentVariable],
    -- | Whether to enable SSL for the app.
    CreateApp -> Maybe Bool
enableSsl :: Prelude.Maybe Prelude.Bool,
    -- | The app\'s short name.
    CreateApp -> Maybe Text
shortname :: Prelude.Maybe Prelude.Text,
    -- | The app\'s data source.
    CreateApp -> Maybe [DataSource]
dataSources :: Prelude.Maybe [DataSource],
    -- | A @Source@ object that specifies the app repository.
    CreateApp -> Maybe Source
appSource :: Prelude.Maybe Source,
    -- | One or more user-defined key\/value pairs to be added to the stack
    -- attributes.
    CreateApp -> Maybe (HashMap AppAttributesKeys Text)
attributes :: Prelude.Maybe (Prelude.HashMap AppAttributesKeys Prelude.Text),
    -- | The app virtual host settings, with multiple domains separated by
    -- commas. For example: @\'www.example.com, example.com\'@
    CreateApp -> Maybe [Text]
domains :: Prelude.Maybe [Prelude.Text],
    -- | A description of the app.
    CreateApp -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | The stack ID.
    CreateApp -> Text
stackId :: Prelude.Text,
    -- | The app name.
    CreateApp -> Text
name :: Prelude.Text,
    -- | The app type. Each supported type is associated with a particular layer.
    -- For example, PHP applications are associated with a PHP layer. AWS
    -- OpsWorks Stacks deploys an application to those instances that are
    -- members of the corresponding layer. If your app isn\'t one of the
    -- standard types, or you prefer to implement your own Deploy recipes,
    -- specify @other@.
    CreateApp -> AppType
type' :: AppType
  }
  deriving (CreateApp -> CreateApp -> Bool
(CreateApp -> CreateApp -> Bool)
-> (CreateApp -> CreateApp -> Bool) -> Eq CreateApp
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateApp -> CreateApp -> Bool
$c/= :: CreateApp -> CreateApp -> Bool
== :: CreateApp -> CreateApp -> Bool
$c== :: CreateApp -> CreateApp -> Bool
Prelude.Eq, ReadPrec [CreateApp]
ReadPrec CreateApp
Int -> ReadS CreateApp
ReadS [CreateApp]
(Int -> ReadS CreateApp)
-> ReadS [CreateApp]
-> ReadPrec CreateApp
-> ReadPrec [CreateApp]
-> Read CreateApp
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateApp]
$creadListPrec :: ReadPrec [CreateApp]
readPrec :: ReadPrec CreateApp
$creadPrec :: ReadPrec CreateApp
readList :: ReadS [CreateApp]
$creadList :: ReadS [CreateApp]
readsPrec :: Int -> ReadS CreateApp
$creadsPrec :: Int -> ReadS CreateApp
Prelude.Read, Int -> CreateApp -> ShowS
[CreateApp] -> ShowS
CreateApp -> String
(Int -> CreateApp -> ShowS)
-> (CreateApp -> String)
-> ([CreateApp] -> ShowS)
-> Show CreateApp
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateApp] -> ShowS
$cshowList :: [CreateApp] -> ShowS
show :: CreateApp -> String
$cshow :: CreateApp -> String
showsPrec :: Int -> CreateApp -> ShowS
$cshowsPrec :: Int -> CreateApp -> ShowS
Prelude.Show, (forall x. CreateApp -> Rep CreateApp x)
-> (forall x. Rep CreateApp x -> CreateApp) -> Generic CreateApp
forall x. Rep CreateApp x -> CreateApp
forall x. CreateApp -> Rep CreateApp x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateApp x -> CreateApp
$cfrom :: forall x. CreateApp -> Rep CreateApp x
Prelude.Generic)

-- |
-- Create a value of 'CreateApp' 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:
--
-- 'sslConfiguration', 'createApp_sslConfiguration' - An @SslConfiguration@ object with the SSL configuration.
--
-- 'environment', 'createApp_environment' - An array of @EnvironmentVariable@ objects that specify environment
-- variables to be associated with the app. After you deploy the app, these
-- variables are defined on the associated app server instance. For more
-- information, see
-- <https://docs.aws.amazon.com/opsworks/latest/userguide/workingapps-creating.html#workingapps-creating-environment Environment Variables>.
--
-- There is no specific limit on the number of environment variables.
-- However, the size of the associated data structure - which includes the
-- variables\' names, values, and protected flag values - cannot exceed 20
-- KB. This limit should accommodate most if not all use cases. Exceeding
-- it will cause an exception with the message, \"Environment: is too large
-- (maximum is 20KB).\"
--
-- If you have specified one or more environment variables, you cannot
-- modify the stack\'s Chef version.
--
-- 'enableSsl', 'createApp_enableSsl' - Whether to enable SSL for the app.
--
-- 'shortname', 'createApp_shortname' - The app\'s short name.
--
-- 'dataSources', 'createApp_dataSources' - The app\'s data source.
--
-- 'appSource', 'createApp_appSource' - A @Source@ object that specifies the app repository.
--
-- 'attributes', 'createApp_attributes' - One or more user-defined key\/value pairs to be added to the stack
-- attributes.
--
-- 'domains', 'createApp_domains' - The app virtual host settings, with multiple domains separated by
-- commas. For example: @\'www.example.com, example.com\'@
--
-- 'description', 'createApp_description' - A description of the app.
--
-- 'stackId', 'createApp_stackId' - The stack ID.
--
-- 'name', 'createApp_name' - The app name.
--
-- 'type'', 'createApp_type' - The app type. Each supported type is associated with a particular layer.
-- For example, PHP applications are associated with a PHP layer. AWS
-- OpsWorks Stacks deploys an application to those instances that are
-- members of the corresponding layer. If your app isn\'t one of the
-- standard types, or you prefer to implement your own Deploy recipes,
-- specify @other@.
newCreateApp ::
  -- | 'stackId'
  Prelude.Text ->
  -- | 'name'
  Prelude.Text ->
  -- | 'type''
  AppType ->
  CreateApp
newCreateApp :: Text -> Text -> AppType -> CreateApp
newCreateApp Text
pStackId_ Text
pName_ AppType
pType_ =
  CreateApp' :: Maybe SslConfiguration
-> Maybe [EnvironmentVariable]
-> Maybe Bool
-> Maybe Text
-> Maybe [DataSource]
-> Maybe Source
-> Maybe (HashMap AppAttributesKeys Text)
-> Maybe [Text]
-> Maybe Text
-> Text
-> Text
-> AppType
-> CreateApp
CreateApp'
    { $sel:sslConfiguration:CreateApp' :: Maybe SslConfiguration
sslConfiguration = Maybe SslConfiguration
forall a. Maybe a
Prelude.Nothing,
      $sel:environment:CreateApp' :: Maybe [EnvironmentVariable]
environment = Maybe [EnvironmentVariable]
forall a. Maybe a
Prelude.Nothing,
      $sel:enableSsl:CreateApp' :: Maybe Bool
enableSsl = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:shortname:CreateApp' :: Maybe Text
shortname = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:dataSources:CreateApp' :: Maybe [DataSource]
dataSources = Maybe [DataSource]
forall a. Maybe a
Prelude.Nothing,
      $sel:appSource:CreateApp' :: Maybe Source
appSource = Maybe Source
forall a. Maybe a
Prelude.Nothing,
      $sel:attributes:CreateApp' :: Maybe (HashMap AppAttributesKeys Text)
attributes = Maybe (HashMap AppAttributesKeys Text)
forall a. Maybe a
Prelude.Nothing,
      $sel:domains:CreateApp' :: Maybe [Text]
domains = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:description:CreateApp' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:stackId:CreateApp' :: Text
stackId = Text
pStackId_,
      $sel:name:CreateApp' :: Text
name = Text
pName_,
      $sel:type':CreateApp' :: AppType
type' = AppType
pType_
    }

-- | An @SslConfiguration@ object with the SSL configuration.
createApp_sslConfiguration :: Lens.Lens' CreateApp (Prelude.Maybe SslConfiguration)
createApp_sslConfiguration :: (Maybe SslConfiguration -> f (Maybe SslConfiguration))
-> CreateApp -> f CreateApp
createApp_sslConfiguration = (CreateApp -> Maybe SslConfiguration)
-> (CreateApp -> Maybe SslConfiguration -> CreateApp)
-> Lens
     CreateApp
     CreateApp
     (Maybe SslConfiguration)
     (Maybe SslConfiguration)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateApp' {Maybe SslConfiguration
sslConfiguration :: Maybe SslConfiguration
$sel:sslConfiguration:CreateApp' :: CreateApp -> Maybe SslConfiguration
sslConfiguration} -> Maybe SslConfiguration
sslConfiguration) (\s :: CreateApp
s@CreateApp' {} Maybe SslConfiguration
a -> CreateApp
s {$sel:sslConfiguration:CreateApp' :: Maybe SslConfiguration
sslConfiguration = Maybe SslConfiguration
a} :: CreateApp)

-- | An array of @EnvironmentVariable@ objects that specify environment
-- variables to be associated with the app. After you deploy the app, these
-- variables are defined on the associated app server instance. For more
-- information, see
-- <https://docs.aws.amazon.com/opsworks/latest/userguide/workingapps-creating.html#workingapps-creating-environment Environment Variables>.
--
-- There is no specific limit on the number of environment variables.
-- However, the size of the associated data structure - which includes the
-- variables\' names, values, and protected flag values - cannot exceed 20
-- KB. This limit should accommodate most if not all use cases. Exceeding
-- it will cause an exception with the message, \"Environment: is too large
-- (maximum is 20KB).\"
--
-- If you have specified one or more environment variables, you cannot
-- modify the stack\'s Chef version.
createApp_environment :: Lens.Lens' CreateApp (Prelude.Maybe [EnvironmentVariable])
createApp_environment :: (Maybe [EnvironmentVariable] -> f (Maybe [EnvironmentVariable]))
-> CreateApp -> f CreateApp
createApp_environment = (CreateApp -> Maybe [EnvironmentVariable])
-> (CreateApp -> Maybe [EnvironmentVariable] -> CreateApp)
-> Lens
     CreateApp
     CreateApp
     (Maybe [EnvironmentVariable])
     (Maybe [EnvironmentVariable])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateApp' {Maybe [EnvironmentVariable]
environment :: Maybe [EnvironmentVariable]
$sel:environment:CreateApp' :: CreateApp -> Maybe [EnvironmentVariable]
environment} -> Maybe [EnvironmentVariable]
environment) (\s :: CreateApp
s@CreateApp' {} Maybe [EnvironmentVariable]
a -> CreateApp
s {$sel:environment:CreateApp' :: Maybe [EnvironmentVariable]
environment = Maybe [EnvironmentVariable]
a} :: CreateApp) ((Maybe [EnvironmentVariable] -> f (Maybe [EnvironmentVariable]))
 -> CreateApp -> f CreateApp)
-> ((Maybe [EnvironmentVariable]
     -> f (Maybe [EnvironmentVariable]))
    -> Maybe [EnvironmentVariable] -> f (Maybe [EnvironmentVariable]))
-> (Maybe [EnvironmentVariable] -> f (Maybe [EnvironmentVariable]))
-> CreateApp
-> f CreateApp
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [EnvironmentVariable]
  [EnvironmentVariable]
  [EnvironmentVariable]
  [EnvironmentVariable]
-> Iso
     (Maybe [EnvironmentVariable])
     (Maybe [EnvironmentVariable])
     (Maybe [EnvironmentVariable])
     (Maybe [EnvironmentVariable])
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
  [EnvironmentVariable]
  [EnvironmentVariable]
  [EnvironmentVariable]
  [EnvironmentVariable]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Whether to enable SSL for the app.
createApp_enableSsl :: Lens.Lens' CreateApp (Prelude.Maybe Prelude.Bool)
createApp_enableSsl :: (Maybe Bool -> f (Maybe Bool)) -> CreateApp -> f CreateApp
createApp_enableSsl = (CreateApp -> Maybe Bool)
-> (CreateApp -> Maybe Bool -> CreateApp)
-> Lens CreateApp CreateApp (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateApp' {Maybe Bool
enableSsl :: Maybe Bool
$sel:enableSsl:CreateApp' :: CreateApp -> Maybe Bool
enableSsl} -> Maybe Bool
enableSsl) (\s :: CreateApp
s@CreateApp' {} Maybe Bool
a -> CreateApp
s {$sel:enableSsl:CreateApp' :: Maybe Bool
enableSsl = Maybe Bool
a} :: CreateApp)

-- | The app\'s short name.
createApp_shortname :: Lens.Lens' CreateApp (Prelude.Maybe Prelude.Text)
createApp_shortname :: (Maybe Text -> f (Maybe Text)) -> CreateApp -> f CreateApp
createApp_shortname = (CreateApp -> Maybe Text)
-> (CreateApp -> Maybe Text -> CreateApp)
-> Lens CreateApp CreateApp (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateApp' {Maybe Text
shortname :: Maybe Text
$sel:shortname:CreateApp' :: CreateApp -> Maybe Text
shortname} -> Maybe Text
shortname) (\s :: CreateApp
s@CreateApp' {} Maybe Text
a -> CreateApp
s {$sel:shortname:CreateApp' :: Maybe Text
shortname = Maybe Text
a} :: CreateApp)

-- | The app\'s data source.
createApp_dataSources :: Lens.Lens' CreateApp (Prelude.Maybe [DataSource])
createApp_dataSources :: (Maybe [DataSource] -> f (Maybe [DataSource]))
-> CreateApp -> f CreateApp
createApp_dataSources = (CreateApp -> Maybe [DataSource])
-> (CreateApp -> Maybe [DataSource] -> CreateApp)
-> Lens
     CreateApp CreateApp (Maybe [DataSource]) (Maybe [DataSource])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateApp' {Maybe [DataSource]
dataSources :: Maybe [DataSource]
$sel:dataSources:CreateApp' :: CreateApp -> Maybe [DataSource]
dataSources} -> Maybe [DataSource]
dataSources) (\s :: CreateApp
s@CreateApp' {} Maybe [DataSource]
a -> CreateApp
s {$sel:dataSources:CreateApp' :: Maybe [DataSource]
dataSources = Maybe [DataSource]
a} :: CreateApp) ((Maybe [DataSource] -> f (Maybe [DataSource]))
 -> CreateApp -> f CreateApp)
-> ((Maybe [DataSource] -> f (Maybe [DataSource]))
    -> Maybe [DataSource] -> f (Maybe [DataSource]))
-> (Maybe [DataSource] -> f (Maybe [DataSource]))
-> CreateApp
-> f CreateApp
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [DataSource] [DataSource] [DataSource] [DataSource]
-> Iso
     (Maybe [DataSource])
     (Maybe [DataSource])
     (Maybe [DataSource])
     (Maybe [DataSource])
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 [DataSource] [DataSource] [DataSource] [DataSource]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | A @Source@ object that specifies the app repository.
createApp_appSource :: Lens.Lens' CreateApp (Prelude.Maybe Source)
createApp_appSource :: (Maybe Source -> f (Maybe Source)) -> CreateApp -> f CreateApp
createApp_appSource = (CreateApp -> Maybe Source)
-> (CreateApp -> Maybe Source -> CreateApp)
-> Lens CreateApp CreateApp (Maybe Source) (Maybe Source)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateApp' {Maybe Source
appSource :: Maybe Source
$sel:appSource:CreateApp' :: CreateApp -> Maybe Source
appSource} -> Maybe Source
appSource) (\s :: CreateApp
s@CreateApp' {} Maybe Source
a -> CreateApp
s {$sel:appSource:CreateApp' :: Maybe Source
appSource = Maybe Source
a} :: CreateApp)

-- | One or more user-defined key\/value pairs to be added to the stack
-- attributes.
createApp_attributes :: Lens.Lens' CreateApp (Prelude.Maybe (Prelude.HashMap AppAttributesKeys Prelude.Text))
createApp_attributes :: (Maybe (HashMap AppAttributesKeys Text)
 -> f (Maybe (HashMap AppAttributesKeys Text)))
-> CreateApp -> f CreateApp
createApp_attributes = (CreateApp -> Maybe (HashMap AppAttributesKeys Text))
-> (CreateApp
    -> Maybe (HashMap AppAttributesKeys Text) -> CreateApp)
-> Lens
     CreateApp
     CreateApp
     (Maybe (HashMap AppAttributesKeys Text))
     (Maybe (HashMap AppAttributesKeys Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateApp' {Maybe (HashMap AppAttributesKeys Text)
attributes :: Maybe (HashMap AppAttributesKeys Text)
$sel:attributes:CreateApp' :: CreateApp -> Maybe (HashMap AppAttributesKeys Text)
attributes} -> Maybe (HashMap AppAttributesKeys Text)
attributes) (\s :: CreateApp
s@CreateApp' {} Maybe (HashMap AppAttributesKeys Text)
a -> CreateApp
s {$sel:attributes:CreateApp' :: Maybe (HashMap AppAttributesKeys Text)
attributes = Maybe (HashMap AppAttributesKeys Text)
a} :: CreateApp) ((Maybe (HashMap AppAttributesKeys Text)
  -> f (Maybe (HashMap AppAttributesKeys Text)))
 -> CreateApp -> f CreateApp)
-> ((Maybe (HashMap AppAttributesKeys Text)
     -> f (Maybe (HashMap AppAttributesKeys Text)))
    -> Maybe (HashMap AppAttributesKeys Text)
    -> f (Maybe (HashMap AppAttributesKeys Text)))
-> (Maybe (HashMap AppAttributesKeys Text)
    -> f (Maybe (HashMap AppAttributesKeys Text)))
-> CreateApp
-> f CreateApp
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (HashMap AppAttributesKeys Text)
  (HashMap AppAttributesKeys Text)
  (HashMap AppAttributesKeys Text)
  (HashMap AppAttributesKeys Text)
-> Iso
     (Maybe (HashMap AppAttributesKeys Text))
     (Maybe (HashMap AppAttributesKeys Text))
     (Maybe (HashMap AppAttributesKeys Text))
     (Maybe (HashMap AppAttributesKeys 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 AppAttributesKeys Text)
  (HashMap AppAttributesKeys Text)
  (HashMap AppAttributesKeys Text)
  (HashMap AppAttributesKeys Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The app virtual host settings, with multiple domains separated by
-- commas. For example: @\'www.example.com, example.com\'@
createApp_domains :: Lens.Lens' CreateApp (Prelude.Maybe [Prelude.Text])
createApp_domains :: (Maybe [Text] -> f (Maybe [Text])) -> CreateApp -> f CreateApp
createApp_domains = (CreateApp -> Maybe [Text])
-> (CreateApp -> Maybe [Text] -> CreateApp)
-> Lens CreateApp CreateApp (Maybe [Text]) (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateApp' {Maybe [Text]
domains :: Maybe [Text]
$sel:domains:CreateApp' :: CreateApp -> Maybe [Text]
domains} -> Maybe [Text]
domains) (\s :: CreateApp
s@CreateApp' {} Maybe [Text]
a -> CreateApp
s {$sel:domains:CreateApp' :: Maybe [Text]
domains = Maybe [Text]
a} :: CreateApp) ((Maybe [Text] -> f (Maybe [Text])) -> CreateApp -> f CreateApp)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> CreateApp
-> f CreateApp
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [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 [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | A description of the app.
createApp_description :: Lens.Lens' CreateApp (Prelude.Maybe Prelude.Text)
createApp_description :: (Maybe Text -> f (Maybe Text)) -> CreateApp -> f CreateApp
createApp_description = (CreateApp -> Maybe Text)
-> (CreateApp -> Maybe Text -> CreateApp)
-> Lens CreateApp CreateApp (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateApp' {Maybe Text
description :: Maybe Text
$sel:description:CreateApp' :: CreateApp -> Maybe Text
description} -> Maybe Text
description) (\s :: CreateApp
s@CreateApp' {} Maybe Text
a -> CreateApp
s {$sel:description:CreateApp' :: Maybe Text
description = Maybe Text
a} :: CreateApp)

-- | The stack ID.
createApp_stackId :: Lens.Lens' CreateApp Prelude.Text
createApp_stackId :: (Text -> f Text) -> CreateApp -> f CreateApp
createApp_stackId = (CreateApp -> Text)
-> (CreateApp -> Text -> CreateApp)
-> Lens CreateApp CreateApp Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateApp' {Text
stackId :: Text
$sel:stackId:CreateApp' :: CreateApp -> Text
stackId} -> Text
stackId) (\s :: CreateApp
s@CreateApp' {} Text
a -> CreateApp
s {$sel:stackId:CreateApp' :: Text
stackId = Text
a} :: CreateApp)

-- | The app name.
createApp_name :: Lens.Lens' CreateApp Prelude.Text
createApp_name :: (Text -> f Text) -> CreateApp -> f CreateApp
createApp_name = (CreateApp -> Text)
-> (CreateApp -> Text -> CreateApp)
-> Lens CreateApp CreateApp Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateApp' {Text
name :: Text
$sel:name:CreateApp' :: CreateApp -> Text
name} -> Text
name) (\s :: CreateApp
s@CreateApp' {} Text
a -> CreateApp
s {$sel:name:CreateApp' :: Text
name = Text
a} :: CreateApp)

-- | The app type. Each supported type is associated with a particular layer.
-- For example, PHP applications are associated with a PHP layer. AWS
-- OpsWorks Stacks deploys an application to those instances that are
-- members of the corresponding layer. If your app isn\'t one of the
-- standard types, or you prefer to implement your own Deploy recipes,
-- specify @other@.
createApp_type :: Lens.Lens' CreateApp AppType
createApp_type :: (AppType -> f AppType) -> CreateApp -> f CreateApp
createApp_type = (CreateApp -> AppType)
-> (CreateApp -> AppType -> CreateApp)
-> Lens CreateApp CreateApp AppType AppType
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateApp' {AppType
type' :: AppType
$sel:type':CreateApp' :: CreateApp -> AppType
type'} -> AppType
type') (\s :: CreateApp
s@CreateApp' {} AppType
a -> CreateApp
s {$sel:type':CreateApp' :: AppType
type' = AppType
a} :: CreateApp)

instance Core.AWSRequest CreateApp where
  type AWSResponse CreateApp = CreateAppResponse
  request :: CreateApp -> Request CreateApp
request = Service -> CreateApp -> Request CreateApp
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy CreateApp
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateApp)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse CreateApp))
-> Logger
-> Service
-> Proxy CreateApp
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateApp)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe Text -> Int -> CreateAppResponse
CreateAppResponse'
            (Maybe Text -> Int -> CreateAppResponse)
-> Either String (Maybe Text)
-> Either String (Int -> CreateAppResponse)
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
"AppId")
            Either String (Int -> CreateAppResponse)
-> Either String Int -> Either String CreateAppResponse
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 CreateApp

instance Prelude.NFData CreateApp

instance Core.ToHeaders CreateApp where
  toHeaders :: CreateApp -> ResponseHeaders
toHeaders =
    ResponseHeaders -> CreateApp -> 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
"OpsWorks_20130218.CreateApp" ::
                          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 CreateApp where
  toJSON :: CreateApp -> Value
toJSON CreateApp' {Maybe Bool
Maybe [Text]
Maybe [DataSource]
Maybe [EnvironmentVariable]
Maybe Text
Maybe (HashMap AppAttributesKeys Text)
Maybe Source
Maybe SslConfiguration
Text
AppType
type' :: AppType
name :: Text
stackId :: Text
description :: Maybe Text
domains :: Maybe [Text]
attributes :: Maybe (HashMap AppAttributesKeys Text)
appSource :: Maybe Source
dataSources :: Maybe [DataSource]
shortname :: Maybe Text
enableSsl :: Maybe Bool
environment :: Maybe [EnvironmentVariable]
sslConfiguration :: Maybe SslConfiguration
$sel:type':CreateApp' :: CreateApp -> AppType
$sel:name:CreateApp' :: CreateApp -> Text
$sel:stackId:CreateApp' :: CreateApp -> Text
$sel:description:CreateApp' :: CreateApp -> Maybe Text
$sel:domains:CreateApp' :: CreateApp -> Maybe [Text]
$sel:attributes:CreateApp' :: CreateApp -> Maybe (HashMap AppAttributesKeys Text)
$sel:appSource:CreateApp' :: CreateApp -> Maybe Source
$sel:dataSources:CreateApp' :: CreateApp -> Maybe [DataSource]
$sel:shortname:CreateApp' :: CreateApp -> Maybe Text
$sel:enableSsl:CreateApp' :: CreateApp -> Maybe Bool
$sel:environment:CreateApp' :: CreateApp -> Maybe [EnvironmentVariable]
$sel:sslConfiguration:CreateApp' :: CreateApp -> Maybe SslConfiguration
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"SslConfiguration" Text -> SslConfiguration -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (SslConfiguration -> Pair) -> Maybe SslConfiguration -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe SslConfiguration
sslConfiguration,
            (Text
"Environment" Text -> [EnvironmentVariable] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([EnvironmentVariable] -> Pair)
-> Maybe [EnvironmentVariable] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [EnvironmentVariable]
environment,
            (Text
"EnableSsl" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
enableSsl,
            (Text
"Shortname" 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
shortname,
            (Text
"DataSources" Text -> [DataSource] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([DataSource] -> Pair) -> Maybe [DataSource] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [DataSource]
dataSources,
            (Text
"AppSource" Text -> Source -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Source -> Pair) -> Maybe Source -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Source
appSource,
            (Text
"Attributes" Text -> HashMap AppAttributesKeys Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (HashMap AppAttributesKeys Text -> Pair)
-> Maybe (HashMap AppAttributesKeys Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap AppAttributesKeys Text)
attributes,
            (Text
"Domains" 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]
domains,
            (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,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"StackId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
stackId),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Name" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
name),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Type" Text -> AppType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= AppType
type')
          ]
      )

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

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

-- | Contains the response to a @CreateApp@ request.
--
-- /See:/ 'newCreateAppResponse' smart constructor.
data CreateAppResponse = CreateAppResponse'
  { -- | The app ID.
    CreateAppResponse -> Maybe Text
appId :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    CreateAppResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (CreateAppResponse -> CreateAppResponse -> Bool
(CreateAppResponse -> CreateAppResponse -> Bool)
-> (CreateAppResponse -> CreateAppResponse -> Bool)
-> Eq CreateAppResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateAppResponse -> CreateAppResponse -> Bool
$c/= :: CreateAppResponse -> CreateAppResponse -> Bool
== :: CreateAppResponse -> CreateAppResponse -> Bool
$c== :: CreateAppResponse -> CreateAppResponse -> Bool
Prelude.Eq, ReadPrec [CreateAppResponse]
ReadPrec CreateAppResponse
Int -> ReadS CreateAppResponse
ReadS [CreateAppResponse]
(Int -> ReadS CreateAppResponse)
-> ReadS [CreateAppResponse]
-> ReadPrec CreateAppResponse
-> ReadPrec [CreateAppResponse]
-> Read CreateAppResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateAppResponse]
$creadListPrec :: ReadPrec [CreateAppResponse]
readPrec :: ReadPrec CreateAppResponse
$creadPrec :: ReadPrec CreateAppResponse
readList :: ReadS [CreateAppResponse]
$creadList :: ReadS [CreateAppResponse]
readsPrec :: Int -> ReadS CreateAppResponse
$creadsPrec :: Int -> ReadS CreateAppResponse
Prelude.Read, Int -> CreateAppResponse -> ShowS
[CreateAppResponse] -> ShowS
CreateAppResponse -> String
(Int -> CreateAppResponse -> ShowS)
-> (CreateAppResponse -> String)
-> ([CreateAppResponse] -> ShowS)
-> Show CreateAppResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateAppResponse] -> ShowS
$cshowList :: [CreateAppResponse] -> ShowS
show :: CreateAppResponse -> String
$cshow :: CreateAppResponse -> String
showsPrec :: Int -> CreateAppResponse -> ShowS
$cshowsPrec :: Int -> CreateAppResponse -> ShowS
Prelude.Show, (forall x. CreateAppResponse -> Rep CreateAppResponse x)
-> (forall x. Rep CreateAppResponse x -> CreateAppResponse)
-> Generic CreateAppResponse
forall x. Rep CreateAppResponse x -> CreateAppResponse
forall x. CreateAppResponse -> Rep CreateAppResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateAppResponse x -> CreateAppResponse
$cfrom :: forall x. CreateAppResponse -> Rep CreateAppResponse x
Prelude.Generic)

-- |
-- Create a value of 'CreateAppResponse' 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:
--
-- 'appId', 'createAppResponse_appId' - The app ID.
--
-- 'httpStatus', 'createAppResponse_httpStatus' - The response's http status code.
newCreateAppResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  CreateAppResponse
newCreateAppResponse :: Int -> CreateAppResponse
newCreateAppResponse Int
pHttpStatus_ =
  CreateAppResponse' :: Maybe Text -> Int -> CreateAppResponse
CreateAppResponse'
    { $sel:appId:CreateAppResponse' :: Maybe Text
appId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:CreateAppResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The app ID.
createAppResponse_appId :: Lens.Lens' CreateAppResponse (Prelude.Maybe Prelude.Text)
createAppResponse_appId :: (Maybe Text -> f (Maybe Text))
-> CreateAppResponse -> f CreateAppResponse
createAppResponse_appId = (CreateAppResponse -> Maybe Text)
-> (CreateAppResponse -> Maybe Text -> CreateAppResponse)
-> Lens
     CreateAppResponse CreateAppResponse (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAppResponse' {Maybe Text
appId :: Maybe Text
$sel:appId:CreateAppResponse' :: CreateAppResponse -> Maybe Text
appId} -> Maybe Text
appId) (\s :: CreateAppResponse
s@CreateAppResponse' {} Maybe Text
a -> CreateAppResponse
s {$sel:appId:CreateAppResponse' :: Maybe Text
appId = Maybe Text
a} :: CreateAppResponse)

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

instance Prelude.NFData CreateAppResponse