{-# 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.AppStream.CreateStack
-- 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 stack to start streaming applications to users. A stack
-- consists of an associated fleet, user access policies, and storage
-- configurations.
module Amazonka.AppStream.CreateStack
  ( -- * Creating a Request
    CreateStack (..),
    newCreateStack,

    -- * Request Lenses
    createStack_userSettings,
    createStack_applicationSettings,
    createStack_feedbackURL,
    createStack_storageConnectors,
    createStack_accessEndpoints,
    createStack_displayName,
    createStack_embedHostDomains,
    createStack_description,
    createStack_tags,
    createStack_redirectURL,
    createStack_name,

    -- * Destructuring the Response
    CreateStackResponse (..),
    newCreateStackResponse,

    -- * Response Lenses
    createStackResponse_stack,
    createStackResponse_httpStatus,
  )
where

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

-- | /See:/ 'newCreateStack' smart constructor.
data CreateStack = CreateStack'
  { -- | The actions that are enabled or disabled for users during their
    -- streaming sessions. By default, these actions are enabled.
    CreateStack -> Maybe (NonEmpty UserSetting)
userSettings :: Prelude.Maybe (Prelude.NonEmpty UserSetting),
    -- | The persistent application settings for users of a stack. When these
    -- settings are enabled, changes that users make to applications and
    -- Windows settings are automatically saved after each session and applied
    -- to the next session.
    CreateStack -> Maybe ApplicationSettings
applicationSettings :: Prelude.Maybe ApplicationSettings,
    -- | The URL that users are redirected to after they click the Send Feedback
    -- link. If no URL is specified, no Send Feedback link is displayed.
    CreateStack -> Maybe Text
feedbackURL :: Prelude.Maybe Prelude.Text,
    -- | The storage connectors to enable.
    CreateStack -> Maybe [StorageConnector]
storageConnectors :: Prelude.Maybe [StorageConnector],
    -- | The list of interface VPC endpoint (interface endpoint) objects. Users
    -- of the stack can connect to AppStream 2.0 only through the specified
    -- endpoints.
    CreateStack -> Maybe (NonEmpty AccessEndpoint)
accessEndpoints :: Prelude.Maybe (Prelude.NonEmpty AccessEndpoint),
    -- | The stack name to display.
    CreateStack -> Maybe Text
displayName :: Prelude.Maybe Prelude.Text,
    -- | The domains where AppStream 2.0 streaming sessions can be embedded in an
    -- iframe. You must approve the domains that you want to host embedded
    -- AppStream 2.0 streaming sessions.
    CreateStack -> Maybe (NonEmpty Text)
embedHostDomains :: Prelude.Maybe (Prelude.NonEmpty Prelude.Text),
    -- | The description to display.
    CreateStack -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | The tags to associate with the stack. A tag is a key-value pair, and the
    -- value is optional. For example, Environment=Test. If you do not specify
    -- a value, Environment=.
    --
    -- If you do not specify a value, the value is set to an empty string.
    --
    -- Generally allowed characters are: letters, numbers, and spaces
    -- representable in UTF-8, and the following special characters:
    --
    -- _ . : \/ = + \\ - \@
    --
    -- For more information about tags, see
    -- <https://docs.aws.amazon.com/appstream2/latest/developerguide/tagging-basic.html Tagging Your Resources>
    -- in the /Amazon AppStream 2.0 Administration Guide/.
    CreateStack -> Maybe (HashMap Text Text)
tags :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | The URL that users are redirected to after their streaming session ends.
    CreateStack -> Maybe Text
redirectURL :: Prelude.Maybe Prelude.Text,
    -- | The name of the stack.
    CreateStack -> Text
name :: Prelude.Text
  }
  deriving (CreateStack -> CreateStack -> Bool
(CreateStack -> CreateStack -> Bool)
-> (CreateStack -> CreateStack -> Bool) -> Eq CreateStack
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateStack -> CreateStack -> Bool
$c/= :: CreateStack -> CreateStack -> Bool
== :: CreateStack -> CreateStack -> Bool
$c== :: CreateStack -> CreateStack -> Bool
Prelude.Eq, ReadPrec [CreateStack]
ReadPrec CreateStack
Int -> ReadS CreateStack
ReadS [CreateStack]
(Int -> ReadS CreateStack)
-> ReadS [CreateStack]
-> ReadPrec CreateStack
-> ReadPrec [CreateStack]
-> Read CreateStack
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateStack]
$creadListPrec :: ReadPrec [CreateStack]
readPrec :: ReadPrec CreateStack
$creadPrec :: ReadPrec CreateStack
readList :: ReadS [CreateStack]
$creadList :: ReadS [CreateStack]
readsPrec :: Int -> ReadS CreateStack
$creadsPrec :: Int -> ReadS CreateStack
Prelude.Read, Int -> CreateStack -> ShowS
[CreateStack] -> ShowS
CreateStack -> String
(Int -> CreateStack -> ShowS)
-> (CreateStack -> String)
-> ([CreateStack] -> ShowS)
-> Show CreateStack
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateStack] -> ShowS
$cshowList :: [CreateStack] -> ShowS
show :: CreateStack -> String
$cshow :: CreateStack -> String
showsPrec :: Int -> CreateStack -> ShowS
$cshowsPrec :: Int -> CreateStack -> ShowS
Prelude.Show, (forall x. CreateStack -> Rep CreateStack x)
-> (forall x. Rep CreateStack x -> CreateStack)
-> Generic CreateStack
forall x. Rep CreateStack x -> CreateStack
forall x. CreateStack -> Rep CreateStack x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateStack x -> CreateStack
$cfrom :: forall x. CreateStack -> Rep CreateStack x
Prelude.Generic)

-- |
-- Create a value of 'CreateStack' 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:
--
-- 'userSettings', 'createStack_userSettings' - The actions that are enabled or disabled for users during their
-- streaming sessions. By default, these actions are enabled.
--
-- 'applicationSettings', 'createStack_applicationSettings' - The persistent application settings for users of a stack. When these
-- settings are enabled, changes that users make to applications and
-- Windows settings are automatically saved after each session and applied
-- to the next session.
--
-- 'feedbackURL', 'createStack_feedbackURL' - The URL that users are redirected to after they click the Send Feedback
-- link. If no URL is specified, no Send Feedback link is displayed.
--
-- 'storageConnectors', 'createStack_storageConnectors' - The storage connectors to enable.
--
-- 'accessEndpoints', 'createStack_accessEndpoints' - The list of interface VPC endpoint (interface endpoint) objects. Users
-- of the stack can connect to AppStream 2.0 only through the specified
-- endpoints.
--
-- 'displayName', 'createStack_displayName' - The stack name to display.
--
-- 'embedHostDomains', 'createStack_embedHostDomains' - The domains where AppStream 2.0 streaming sessions can be embedded in an
-- iframe. You must approve the domains that you want to host embedded
-- AppStream 2.0 streaming sessions.
--
-- 'description', 'createStack_description' - The description to display.
--
-- 'tags', 'createStack_tags' - The tags to associate with the stack. A tag is a key-value pair, and the
-- value is optional. For example, Environment=Test. If you do not specify
-- a value, Environment=.
--
-- If you do not specify a value, the value is set to an empty string.
--
-- Generally allowed characters are: letters, numbers, and spaces
-- representable in UTF-8, and the following special characters:
--
-- _ . : \/ = + \\ - \@
--
-- For more information about tags, see
-- <https://docs.aws.amazon.com/appstream2/latest/developerguide/tagging-basic.html Tagging Your Resources>
-- in the /Amazon AppStream 2.0 Administration Guide/.
--
-- 'redirectURL', 'createStack_redirectURL' - The URL that users are redirected to after their streaming session ends.
--
-- 'name', 'createStack_name' - The name of the stack.
newCreateStack ::
  -- | 'name'
  Prelude.Text ->
  CreateStack
newCreateStack :: Text -> CreateStack
newCreateStack Text
pName_ =
  CreateStack' :: Maybe (NonEmpty UserSetting)
-> Maybe ApplicationSettings
-> Maybe Text
-> Maybe [StorageConnector]
-> Maybe (NonEmpty AccessEndpoint)
-> Maybe Text
-> Maybe (NonEmpty Text)
-> Maybe Text
-> Maybe (HashMap Text Text)
-> Maybe Text
-> Text
-> CreateStack
CreateStack'
    { $sel:userSettings:CreateStack' :: Maybe (NonEmpty UserSetting)
userSettings = Maybe (NonEmpty UserSetting)
forall a. Maybe a
Prelude.Nothing,
      $sel:applicationSettings:CreateStack' :: Maybe ApplicationSettings
applicationSettings = Maybe ApplicationSettings
forall a. Maybe a
Prelude.Nothing,
      $sel:feedbackURL:CreateStack' :: Maybe Text
feedbackURL = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:storageConnectors:CreateStack' :: Maybe [StorageConnector]
storageConnectors = Maybe [StorageConnector]
forall a. Maybe a
Prelude.Nothing,
      $sel:accessEndpoints:CreateStack' :: Maybe (NonEmpty AccessEndpoint)
accessEndpoints = Maybe (NonEmpty AccessEndpoint)
forall a. Maybe a
Prelude.Nothing,
      $sel:displayName:CreateStack' :: Maybe Text
displayName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:embedHostDomains:CreateStack' :: Maybe (NonEmpty Text)
embedHostDomains = Maybe (NonEmpty Text)
forall a. Maybe a
Prelude.Nothing,
      $sel:description:CreateStack' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:tags:CreateStack' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing,
      $sel:redirectURL:CreateStack' :: Maybe Text
redirectURL = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:name:CreateStack' :: Text
name = Text
pName_
    }

-- | The actions that are enabled or disabled for users during their
-- streaming sessions. By default, these actions are enabled.
createStack_userSettings :: Lens.Lens' CreateStack (Prelude.Maybe (Prelude.NonEmpty UserSetting))
createStack_userSettings :: (Maybe (NonEmpty UserSetting) -> f (Maybe (NonEmpty UserSetting)))
-> CreateStack -> f CreateStack
createStack_userSettings = (CreateStack -> Maybe (NonEmpty UserSetting))
-> (CreateStack -> Maybe (NonEmpty UserSetting) -> CreateStack)
-> Lens
     CreateStack
     CreateStack
     (Maybe (NonEmpty UserSetting))
     (Maybe (NonEmpty UserSetting))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateStack' {Maybe (NonEmpty UserSetting)
userSettings :: Maybe (NonEmpty UserSetting)
$sel:userSettings:CreateStack' :: CreateStack -> Maybe (NonEmpty UserSetting)
userSettings} -> Maybe (NonEmpty UserSetting)
userSettings) (\s :: CreateStack
s@CreateStack' {} Maybe (NonEmpty UserSetting)
a -> CreateStack
s {$sel:userSettings:CreateStack' :: Maybe (NonEmpty UserSetting)
userSettings = Maybe (NonEmpty UserSetting)
a} :: CreateStack) ((Maybe (NonEmpty UserSetting) -> f (Maybe (NonEmpty UserSetting)))
 -> CreateStack -> f CreateStack)
-> ((Maybe (NonEmpty UserSetting)
     -> f (Maybe (NonEmpty UserSetting)))
    -> Maybe (NonEmpty UserSetting)
    -> f (Maybe (NonEmpty UserSetting)))
-> (Maybe (NonEmpty UserSetting)
    -> f (Maybe (NonEmpty UserSetting)))
-> CreateStack
-> f CreateStack
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (NonEmpty UserSetting)
  (NonEmpty UserSetting)
  (NonEmpty UserSetting)
  (NonEmpty UserSetting)
-> Iso
     (Maybe (NonEmpty UserSetting))
     (Maybe (NonEmpty UserSetting))
     (Maybe (NonEmpty UserSetting))
     (Maybe (NonEmpty UserSetting))
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
  (NonEmpty UserSetting)
  (NonEmpty UserSetting)
  (NonEmpty UserSetting)
  (NonEmpty UserSetting)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The persistent application settings for users of a stack. When these
-- settings are enabled, changes that users make to applications and
-- Windows settings are automatically saved after each session and applied
-- to the next session.
createStack_applicationSettings :: Lens.Lens' CreateStack (Prelude.Maybe ApplicationSettings)
createStack_applicationSettings :: (Maybe ApplicationSettings -> f (Maybe ApplicationSettings))
-> CreateStack -> f CreateStack
createStack_applicationSettings = (CreateStack -> Maybe ApplicationSettings)
-> (CreateStack -> Maybe ApplicationSettings -> CreateStack)
-> Lens
     CreateStack
     CreateStack
     (Maybe ApplicationSettings)
     (Maybe ApplicationSettings)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateStack' {Maybe ApplicationSettings
applicationSettings :: Maybe ApplicationSettings
$sel:applicationSettings:CreateStack' :: CreateStack -> Maybe ApplicationSettings
applicationSettings} -> Maybe ApplicationSettings
applicationSettings) (\s :: CreateStack
s@CreateStack' {} Maybe ApplicationSettings
a -> CreateStack
s {$sel:applicationSettings:CreateStack' :: Maybe ApplicationSettings
applicationSettings = Maybe ApplicationSettings
a} :: CreateStack)

-- | The URL that users are redirected to after they click the Send Feedback
-- link. If no URL is specified, no Send Feedback link is displayed.
createStack_feedbackURL :: Lens.Lens' CreateStack (Prelude.Maybe Prelude.Text)
createStack_feedbackURL :: (Maybe Text -> f (Maybe Text)) -> CreateStack -> f CreateStack
createStack_feedbackURL = (CreateStack -> Maybe Text)
-> (CreateStack -> Maybe Text -> CreateStack)
-> Lens CreateStack CreateStack (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateStack' {Maybe Text
feedbackURL :: Maybe Text
$sel:feedbackURL:CreateStack' :: CreateStack -> Maybe Text
feedbackURL} -> Maybe Text
feedbackURL) (\s :: CreateStack
s@CreateStack' {} Maybe Text
a -> CreateStack
s {$sel:feedbackURL:CreateStack' :: Maybe Text
feedbackURL = Maybe Text
a} :: CreateStack)

-- | The storage connectors to enable.
createStack_storageConnectors :: Lens.Lens' CreateStack (Prelude.Maybe [StorageConnector])
createStack_storageConnectors :: (Maybe [StorageConnector] -> f (Maybe [StorageConnector]))
-> CreateStack -> f CreateStack
createStack_storageConnectors = (CreateStack -> Maybe [StorageConnector])
-> (CreateStack -> Maybe [StorageConnector] -> CreateStack)
-> Lens
     CreateStack
     CreateStack
     (Maybe [StorageConnector])
     (Maybe [StorageConnector])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateStack' {Maybe [StorageConnector]
storageConnectors :: Maybe [StorageConnector]
$sel:storageConnectors:CreateStack' :: CreateStack -> Maybe [StorageConnector]
storageConnectors} -> Maybe [StorageConnector]
storageConnectors) (\s :: CreateStack
s@CreateStack' {} Maybe [StorageConnector]
a -> CreateStack
s {$sel:storageConnectors:CreateStack' :: Maybe [StorageConnector]
storageConnectors = Maybe [StorageConnector]
a} :: CreateStack) ((Maybe [StorageConnector] -> f (Maybe [StorageConnector]))
 -> CreateStack -> f CreateStack)
-> ((Maybe [StorageConnector] -> f (Maybe [StorageConnector]))
    -> Maybe [StorageConnector] -> f (Maybe [StorageConnector]))
-> (Maybe [StorageConnector] -> f (Maybe [StorageConnector]))
-> CreateStack
-> f CreateStack
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [StorageConnector]
  [StorageConnector]
  [StorageConnector]
  [StorageConnector]
-> Iso
     (Maybe [StorageConnector])
     (Maybe [StorageConnector])
     (Maybe [StorageConnector])
     (Maybe [StorageConnector])
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
  [StorageConnector]
  [StorageConnector]
  [StorageConnector]
  [StorageConnector]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The list of interface VPC endpoint (interface endpoint) objects. Users
-- of the stack can connect to AppStream 2.0 only through the specified
-- endpoints.
createStack_accessEndpoints :: Lens.Lens' CreateStack (Prelude.Maybe (Prelude.NonEmpty AccessEndpoint))
createStack_accessEndpoints :: (Maybe (NonEmpty AccessEndpoint)
 -> f (Maybe (NonEmpty AccessEndpoint)))
-> CreateStack -> f CreateStack
createStack_accessEndpoints = (CreateStack -> Maybe (NonEmpty AccessEndpoint))
-> (CreateStack -> Maybe (NonEmpty AccessEndpoint) -> CreateStack)
-> Lens
     CreateStack
     CreateStack
     (Maybe (NonEmpty AccessEndpoint))
     (Maybe (NonEmpty AccessEndpoint))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateStack' {Maybe (NonEmpty AccessEndpoint)
accessEndpoints :: Maybe (NonEmpty AccessEndpoint)
$sel:accessEndpoints:CreateStack' :: CreateStack -> Maybe (NonEmpty AccessEndpoint)
accessEndpoints} -> Maybe (NonEmpty AccessEndpoint)
accessEndpoints) (\s :: CreateStack
s@CreateStack' {} Maybe (NonEmpty AccessEndpoint)
a -> CreateStack
s {$sel:accessEndpoints:CreateStack' :: Maybe (NonEmpty AccessEndpoint)
accessEndpoints = Maybe (NonEmpty AccessEndpoint)
a} :: CreateStack) ((Maybe (NonEmpty AccessEndpoint)
  -> f (Maybe (NonEmpty AccessEndpoint)))
 -> CreateStack -> f CreateStack)
-> ((Maybe (NonEmpty AccessEndpoint)
     -> f (Maybe (NonEmpty AccessEndpoint)))
    -> Maybe (NonEmpty AccessEndpoint)
    -> f (Maybe (NonEmpty AccessEndpoint)))
-> (Maybe (NonEmpty AccessEndpoint)
    -> f (Maybe (NonEmpty AccessEndpoint)))
-> CreateStack
-> f CreateStack
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (NonEmpty AccessEndpoint)
  (NonEmpty AccessEndpoint)
  (NonEmpty AccessEndpoint)
  (NonEmpty AccessEndpoint)
-> Iso
     (Maybe (NonEmpty AccessEndpoint))
     (Maybe (NonEmpty AccessEndpoint))
     (Maybe (NonEmpty AccessEndpoint))
     (Maybe (NonEmpty AccessEndpoint))
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
  (NonEmpty AccessEndpoint)
  (NonEmpty AccessEndpoint)
  (NonEmpty AccessEndpoint)
  (NonEmpty AccessEndpoint)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The stack name to display.
createStack_displayName :: Lens.Lens' CreateStack (Prelude.Maybe Prelude.Text)
createStack_displayName :: (Maybe Text -> f (Maybe Text)) -> CreateStack -> f CreateStack
createStack_displayName = (CreateStack -> Maybe Text)
-> (CreateStack -> Maybe Text -> CreateStack)
-> Lens CreateStack CreateStack (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateStack' {Maybe Text
displayName :: Maybe Text
$sel:displayName:CreateStack' :: CreateStack -> Maybe Text
displayName} -> Maybe Text
displayName) (\s :: CreateStack
s@CreateStack' {} Maybe Text
a -> CreateStack
s {$sel:displayName:CreateStack' :: Maybe Text
displayName = Maybe Text
a} :: CreateStack)

-- | The domains where AppStream 2.0 streaming sessions can be embedded in an
-- iframe. You must approve the domains that you want to host embedded
-- AppStream 2.0 streaming sessions.
createStack_embedHostDomains :: Lens.Lens' CreateStack (Prelude.Maybe (Prelude.NonEmpty Prelude.Text))
createStack_embedHostDomains :: (Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> CreateStack -> f CreateStack
createStack_embedHostDomains = (CreateStack -> Maybe (NonEmpty Text))
-> (CreateStack -> Maybe (NonEmpty Text) -> CreateStack)
-> Lens
     CreateStack
     CreateStack
     (Maybe (NonEmpty Text))
     (Maybe (NonEmpty Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateStack' {Maybe (NonEmpty Text)
embedHostDomains :: Maybe (NonEmpty Text)
$sel:embedHostDomains:CreateStack' :: CreateStack -> Maybe (NonEmpty Text)
embedHostDomains} -> Maybe (NonEmpty Text)
embedHostDomains) (\s :: CreateStack
s@CreateStack' {} Maybe (NonEmpty Text)
a -> CreateStack
s {$sel:embedHostDomains:CreateStack' :: Maybe (NonEmpty Text)
embedHostDomains = Maybe (NonEmpty Text)
a} :: CreateStack) ((Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
 -> CreateStack -> f CreateStack)
-> ((Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
    -> Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> (Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> CreateStack
-> f CreateStack
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (NonEmpty Text) (NonEmpty Text) (NonEmpty Text) (NonEmpty Text)
-> Iso
     (Maybe (NonEmpty Text))
     (Maybe (NonEmpty Text))
     (Maybe (NonEmpty Text))
     (Maybe (NonEmpty 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
  (NonEmpty Text) (NonEmpty Text) (NonEmpty Text) (NonEmpty Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The description to display.
createStack_description :: Lens.Lens' CreateStack (Prelude.Maybe Prelude.Text)
createStack_description :: (Maybe Text -> f (Maybe Text)) -> CreateStack -> f CreateStack
createStack_description = (CreateStack -> Maybe Text)
-> (CreateStack -> Maybe Text -> CreateStack)
-> Lens CreateStack CreateStack (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateStack' {Maybe Text
description :: Maybe Text
$sel:description:CreateStack' :: CreateStack -> Maybe Text
description} -> Maybe Text
description) (\s :: CreateStack
s@CreateStack' {} Maybe Text
a -> CreateStack
s {$sel:description:CreateStack' :: Maybe Text
description = Maybe Text
a} :: CreateStack)

-- | The tags to associate with the stack. A tag is a key-value pair, and the
-- value is optional. For example, Environment=Test. If you do not specify
-- a value, Environment=.
--
-- If you do not specify a value, the value is set to an empty string.
--
-- Generally allowed characters are: letters, numbers, and spaces
-- representable in UTF-8, and the following special characters:
--
-- _ . : \/ = + \\ - \@
--
-- For more information about tags, see
-- <https://docs.aws.amazon.com/appstream2/latest/developerguide/tagging-basic.html Tagging Your Resources>
-- in the /Amazon AppStream 2.0 Administration Guide/.
createStack_tags :: Lens.Lens' CreateStack (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
createStack_tags :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> CreateStack -> f CreateStack
createStack_tags = (CreateStack -> Maybe (HashMap Text Text))
-> (CreateStack -> Maybe (HashMap Text Text) -> CreateStack)
-> Lens
     CreateStack
     CreateStack
     (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 (\CreateStack' {Maybe (HashMap Text Text)
tags :: Maybe (HashMap Text Text)
$sel:tags:CreateStack' :: CreateStack -> Maybe (HashMap Text Text)
tags} -> Maybe (HashMap Text Text)
tags) (\s :: CreateStack
s@CreateStack' {} Maybe (HashMap Text Text)
a -> CreateStack
s {$sel:tags:CreateStack' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
a} :: CreateStack) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
 -> CreateStack -> f CreateStack)
-> ((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)))
-> CreateStack
-> f CreateStack
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 URL that users are redirected to after their streaming session ends.
createStack_redirectURL :: Lens.Lens' CreateStack (Prelude.Maybe Prelude.Text)
createStack_redirectURL :: (Maybe Text -> f (Maybe Text)) -> CreateStack -> f CreateStack
createStack_redirectURL = (CreateStack -> Maybe Text)
-> (CreateStack -> Maybe Text -> CreateStack)
-> Lens CreateStack CreateStack (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateStack' {Maybe Text
redirectURL :: Maybe Text
$sel:redirectURL:CreateStack' :: CreateStack -> Maybe Text
redirectURL} -> Maybe Text
redirectURL) (\s :: CreateStack
s@CreateStack' {} Maybe Text
a -> CreateStack
s {$sel:redirectURL:CreateStack' :: Maybe Text
redirectURL = Maybe Text
a} :: CreateStack)

-- | The name of the stack.
createStack_name :: Lens.Lens' CreateStack Prelude.Text
createStack_name :: (Text -> f Text) -> CreateStack -> f CreateStack
createStack_name = (CreateStack -> Text)
-> (CreateStack -> Text -> CreateStack)
-> Lens CreateStack CreateStack Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateStack' {Text
name :: Text
$sel:name:CreateStack' :: CreateStack -> Text
name} -> Text
name) (\s :: CreateStack
s@CreateStack' {} Text
a -> CreateStack
s {$sel:name:CreateStack' :: Text
name = Text
a} :: CreateStack)

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

instance Prelude.NFData CreateStack

instance Core.ToHeaders CreateStack where
  toHeaders :: CreateStack -> ResponseHeaders
toHeaders =
    ResponseHeaders -> CreateStack -> 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
"PhotonAdminProxyService.CreateStack" ::
                          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 CreateStack where
  toJSON :: CreateStack -> Value
toJSON CreateStack' {Maybe [StorageConnector]
Maybe (NonEmpty Text)
Maybe (NonEmpty AccessEndpoint)
Maybe (NonEmpty UserSetting)
Maybe Text
Maybe (HashMap Text Text)
Maybe ApplicationSettings
Text
name :: Text
redirectURL :: Maybe Text
tags :: Maybe (HashMap Text Text)
description :: Maybe Text
embedHostDomains :: Maybe (NonEmpty Text)
displayName :: Maybe Text
accessEndpoints :: Maybe (NonEmpty AccessEndpoint)
storageConnectors :: Maybe [StorageConnector]
feedbackURL :: Maybe Text
applicationSettings :: Maybe ApplicationSettings
userSettings :: Maybe (NonEmpty UserSetting)
$sel:name:CreateStack' :: CreateStack -> Text
$sel:redirectURL:CreateStack' :: CreateStack -> Maybe Text
$sel:tags:CreateStack' :: CreateStack -> Maybe (HashMap Text Text)
$sel:description:CreateStack' :: CreateStack -> Maybe Text
$sel:embedHostDomains:CreateStack' :: CreateStack -> Maybe (NonEmpty Text)
$sel:displayName:CreateStack' :: CreateStack -> Maybe Text
$sel:accessEndpoints:CreateStack' :: CreateStack -> Maybe (NonEmpty AccessEndpoint)
$sel:storageConnectors:CreateStack' :: CreateStack -> Maybe [StorageConnector]
$sel:feedbackURL:CreateStack' :: CreateStack -> Maybe Text
$sel:applicationSettings:CreateStack' :: CreateStack -> Maybe ApplicationSettings
$sel:userSettings:CreateStack' :: CreateStack -> Maybe (NonEmpty UserSetting)
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"UserSettings" Text -> NonEmpty UserSetting -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (NonEmpty UserSetting -> Pair)
-> Maybe (NonEmpty UserSetting) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (NonEmpty UserSetting)
userSettings,
            (Text
"ApplicationSettings" Text -> ApplicationSettings -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (ApplicationSettings -> Pair)
-> Maybe ApplicationSettings -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ApplicationSettings
applicationSettings,
            (Text
"FeedbackURL" 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
feedbackURL,
            (Text
"StorageConnectors" Text -> [StorageConnector] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              ([StorageConnector] -> Pair)
-> Maybe [StorageConnector] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [StorageConnector]
storageConnectors,
            (Text
"AccessEndpoints" Text -> NonEmpty AccessEndpoint -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (NonEmpty AccessEndpoint -> Pair)
-> Maybe (NonEmpty AccessEndpoint) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (NonEmpty AccessEndpoint)
accessEndpoints,
            (Text
"DisplayName" 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
displayName,
            (Text
"EmbedHostDomains" Text -> NonEmpty Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (NonEmpty Text -> Pair) -> Maybe (NonEmpty Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (NonEmpty Text)
embedHostDomains,
            (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
"RedirectURL" 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
redirectURL,
            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)
          ]
      )

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

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

-- | /See:/ 'newCreateStackResponse' smart constructor.
data CreateStackResponse = CreateStackResponse'
  { -- | Information about the stack.
    CreateStackResponse -> Maybe Stack
stack :: Prelude.Maybe Stack,
    -- | The response's http status code.
    CreateStackResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (CreateStackResponse -> CreateStackResponse -> Bool
(CreateStackResponse -> CreateStackResponse -> Bool)
-> (CreateStackResponse -> CreateStackResponse -> Bool)
-> Eq CreateStackResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateStackResponse -> CreateStackResponse -> Bool
$c/= :: CreateStackResponse -> CreateStackResponse -> Bool
== :: CreateStackResponse -> CreateStackResponse -> Bool
$c== :: CreateStackResponse -> CreateStackResponse -> Bool
Prelude.Eq, ReadPrec [CreateStackResponse]
ReadPrec CreateStackResponse
Int -> ReadS CreateStackResponse
ReadS [CreateStackResponse]
(Int -> ReadS CreateStackResponse)
-> ReadS [CreateStackResponse]
-> ReadPrec CreateStackResponse
-> ReadPrec [CreateStackResponse]
-> Read CreateStackResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateStackResponse]
$creadListPrec :: ReadPrec [CreateStackResponse]
readPrec :: ReadPrec CreateStackResponse
$creadPrec :: ReadPrec CreateStackResponse
readList :: ReadS [CreateStackResponse]
$creadList :: ReadS [CreateStackResponse]
readsPrec :: Int -> ReadS CreateStackResponse
$creadsPrec :: Int -> ReadS CreateStackResponse
Prelude.Read, Int -> CreateStackResponse -> ShowS
[CreateStackResponse] -> ShowS
CreateStackResponse -> String
(Int -> CreateStackResponse -> ShowS)
-> (CreateStackResponse -> String)
-> ([CreateStackResponse] -> ShowS)
-> Show CreateStackResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateStackResponse] -> ShowS
$cshowList :: [CreateStackResponse] -> ShowS
show :: CreateStackResponse -> String
$cshow :: CreateStackResponse -> String
showsPrec :: Int -> CreateStackResponse -> ShowS
$cshowsPrec :: Int -> CreateStackResponse -> ShowS
Prelude.Show, (forall x. CreateStackResponse -> Rep CreateStackResponse x)
-> (forall x. Rep CreateStackResponse x -> CreateStackResponse)
-> Generic CreateStackResponse
forall x. Rep CreateStackResponse x -> CreateStackResponse
forall x. CreateStackResponse -> Rep CreateStackResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateStackResponse x -> CreateStackResponse
$cfrom :: forall x. CreateStackResponse -> Rep CreateStackResponse x
Prelude.Generic)

-- |
-- Create a value of 'CreateStackResponse' 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:
--
-- 'stack', 'createStackResponse_stack' - Information about the stack.
--
-- 'httpStatus', 'createStackResponse_httpStatus' - The response's http status code.
newCreateStackResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  CreateStackResponse
newCreateStackResponse :: Int -> CreateStackResponse
newCreateStackResponse Int
pHttpStatus_ =
  CreateStackResponse' :: Maybe Stack -> Int -> CreateStackResponse
CreateStackResponse'
    { $sel:stack:CreateStackResponse' :: Maybe Stack
stack = Maybe Stack
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:CreateStackResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | Information about the stack.
createStackResponse_stack :: Lens.Lens' CreateStackResponse (Prelude.Maybe Stack)
createStackResponse_stack :: (Maybe Stack -> f (Maybe Stack))
-> CreateStackResponse -> f CreateStackResponse
createStackResponse_stack = (CreateStackResponse -> Maybe Stack)
-> (CreateStackResponse -> Maybe Stack -> CreateStackResponse)
-> Lens
     CreateStackResponse CreateStackResponse (Maybe Stack) (Maybe Stack)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateStackResponse' {Maybe Stack
stack :: Maybe Stack
$sel:stack:CreateStackResponse' :: CreateStackResponse -> Maybe Stack
stack} -> Maybe Stack
stack) (\s :: CreateStackResponse
s@CreateStackResponse' {} Maybe Stack
a -> CreateStackResponse
s {$sel:stack:CreateStackResponse' :: Maybe Stack
stack = Maybe Stack
a} :: CreateStackResponse)

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

instance Prelude.NFData CreateStackResponse