{-# 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.Nimble.CreateStreamingSession
-- 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 streaming session in a studio.
--
-- After invoking this operation, you must poll GetStreamingSession until
-- the streaming session is in state READY.
module Amazonka.Nimble.CreateStreamingSession
  ( -- * Creating a Request
    CreateStreamingSession (..),
    newCreateStreamingSession,

    -- * Request Lenses
    createStreamingSession_ownedBy,
    createStreamingSession_clientToken,
    createStreamingSession_ec2InstanceType,
    createStreamingSession_launchProfileId,
    createStreamingSession_streamingImageId,
    createStreamingSession_tags,
    createStreamingSession_studioId,

    -- * Destructuring the Response
    CreateStreamingSessionResponse (..),
    newCreateStreamingSessionResponse,

    -- * Response Lenses
    createStreamingSessionResponse_session,
    createStreamingSessionResponse_httpStatus,
  )
where

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

-- | A collection of streaming sessions.
--
-- /See:/ 'newCreateStreamingSession' smart constructor.
data CreateStreamingSession = CreateStreamingSession'
  { -- | The user ID of the user that owns the streaming session.
    CreateStreamingSession -> Maybe Text
ownedBy :: Prelude.Maybe Prelude.Text,
    -- | To make an idempotent API request using one of these actions, specify a
    -- client token in the request. You should not reuse the same client token
    -- for other API requests. If you retry a request that completed
    -- successfully using the same client token and the same parameters, the
    -- retry succeeds without performing any further actions. If you retry a
    -- successful request using the same client token, but one or more of the
    -- parameters are different, the retry fails with a ValidationException
    -- error.
    CreateStreamingSession -> Maybe Text
clientToken :: Prelude.Maybe Prelude.Text,
    -- | The EC2 Instance type used for the streaming session.
    CreateStreamingSession -> Maybe StreamingInstanceType
ec2InstanceType :: Prelude.Maybe StreamingInstanceType,
    -- | The launch profile ID.
    CreateStreamingSession -> Maybe Text
launchProfileId :: Prelude.Maybe Prelude.Text,
    -- | The ID of the streaming image.
    CreateStreamingSession -> Maybe Text
streamingImageId :: Prelude.Maybe Prelude.Text,
    -- | A collection of labels, in the form of key:value pairs, that apply to
    -- this resource.
    CreateStreamingSession -> Maybe (HashMap Text Text)
tags :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | The studio ID.
    CreateStreamingSession -> Text
studioId :: Prelude.Text
  }
  deriving (CreateStreamingSession -> CreateStreamingSession -> Bool
(CreateStreamingSession -> CreateStreamingSession -> Bool)
-> (CreateStreamingSession -> CreateStreamingSession -> Bool)
-> Eq CreateStreamingSession
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateStreamingSession -> CreateStreamingSession -> Bool
$c/= :: CreateStreamingSession -> CreateStreamingSession -> Bool
== :: CreateStreamingSession -> CreateStreamingSession -> Bool
$c== :: CreateStreamingSession -> CreateStreamingSession -> Bool
Prelude.Eq, ReadPrec [CreateStreamingSession]
ReadPrec CreateStreamingSession
Int -> ReadS CreateStreamingSession
ReadS [CreateStreamingSession]
(Int -> ReadS CreateStreamingSession)
-> ReadS [CreateStreamingSession]
-> ReadPrec CreateStreamingSession
-> ReadPrec [CreateStreamingSession]
-> Read CreateStreamingSession
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateStreamingSession]
$creadListPrec :: ReadPrec [CreateStreamingSession]
readPrec :: ReadPrec CreateStreamingSession
$creadPrec :: ReadPrec CreateStreamingSession
readList :: ReadS [CreateStreamingSession]
$creadList :: ReadS [CreateStreamingSession]
readsPrec :: Int -> ReadS CreateStreamingSession
$creadsPrec :: Int -> ReadS CreateStreamingSession
Prelude.Read, Int -> CreateStreamingSession -> ShowS
[CreateStreamingSession] -> ShowS
CreateStreamingSession -> String
(Int -> CreateStreamingSession -> ShowS)
-> (CreateStreamingSession -> String)
-> ([CreateStreamingSession] -> ShowS)
-> Show CreateStreamingSession
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateStreamingSession] -> ShowS
$cshowList :: [CreateStreamingSession] -> ShowS
show :: CreateStreamingSession -> String
$cshow :: CreateStreamingSession -> String
showsPrec :: Int -> CreateStreamingSession -> ShowS
$cshowsPrec :: Int -> CreateStreamingSession -> ShowS
Prelude.Show, (forall x. CreateStreamingSession -> Rep CreateStreamingSession x)
-> (forall x.
    Rep CreateStreamingSession x -> CreateStreamingSession)
-> Generic CreateStreamingSession
forall x. Rep CreateStreamingSession x -> CreateStreamingSession
forall x. CreateStreamingSession -> Rep CreateStreamingSession x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateStreamingSession x -> CreateStreamingSession
$cfrom :: forall x. CreateStreamingSession -> Rep CreateStreamingSession x
Prelude.Generic)

-- |
-- Create a value of 'CreateStreamingSession' 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:
--
-- 'ownedBy', 'createStreamingSession_ownedBy' - The user ID of the user that owns the streaming session.
--
-- 'clientToken', 'createStreamingSession_clientToken' - To make an idempotent API request using one of these actions, specify a
-- client token in the request. You should not reuse the same client token
-- for other API requests. If you retry a request that completed
-- successfully using the same client token and the same parameters, the
-- retry succeeds without performing any further actions. If you retry a
-- successful request using the same client token, but one or more of the
-- parameters are different, the retry fails with a ValidationException
-- error.
--
-- 'ec2InstanceType', 'createStreamingSession_ec2InstanceType' - The EC2 Instance type used for the streaming session.
--
-- 'launchProfileId', 'createStreamingSession_launchProfileId' - The launch profile ID.
--
-- 'streamingImageId', 'createStreamingSession_streamingImageId' - The ID of the streaming image.
--
-- 'tags', 'createStreamingSession_tags' - A collection of labels, in the form of key:value pairs, that apply to
-- this resource.
--
-- 'studioId', 'createStreamingSession_studioId' - The studio ID.
newCreateStreamingSession ::
  -- | 'studioId'
  Prelude.Text ->
  CreateStreamingSession
newCreateStreamingSession :: Text -> CreateStreamingSession
newCreateStreamingSession Text
pStudioId_ =
  CreateStreamingSession' :: Maybe Text
-> Maybe Text
-> Maybe StreamingInstanceType
-> Maybe Text
-> Maybe Text
-> Maybe (HashMap Text Text)
-> Text
-> CreateStreamingSession
CreateStreamingSession'
    { $sel:ownedBy:CreateStreamingSession' :: Maybe Text
ownedBy = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:clientToken:CreateStreamingSession' :: Maybe Text
clientToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:ec2InstanceType:CreateStreamingSession' :: Maybe StreamingInstanceType
ec2InstanceType = Maybe StreamingInstanceType
forall a. Maybe a
Prelude.Nothing,
      $sel:launchProfileId:CreateStreamingSession' :: Maybe Text
launchProfileId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:streamingImageId:CreateStreamingSession' :: Maybe Text
streamingImageId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:tags:CreateStreamingSession' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing,
      $sel:studioId:CreateStreamingSession' :: Text
studioId = Text
pStudioId_
    }

-- | The user ID of the user that owns the streaming session.
createStreamingSession_ownedBy :: Lens.Lens' CreateStreamingSession (Prelude.Maybe Prelude.Text)
createStreamingSession_ownedBy :: (Maybe Text -> f (Maybe Text))
-> CreateStreamingSession -> f CreateStreamingSession
createStreamingSession_ownedBy = (CreateStreamingSession -> Maybe Text)
-> (CreateStreamingSession -> Maybe Text -> CreateStreamingSession)
-> Lens
     CreateStreamingSession
     CreateStreamingSession
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateStreamingSession' {Maybe Text
ownedBy :: Maybe Text
$sel:ownedBy:CreateStreamingSession' :: CreateStreamingSession -> Maybe Text
ownedBy} -> Maybe Text
ownedBy) (\s :: CreateStreamingSession
s@CreateStreamingSession' {} Maybe Text
a -> CreateStreamingSession
s {$sel:ownedBy:CreateStreamingSession' :: Maybe Text
ownedBy = Maybe Text
a} :: CreateStreamingSession)

-- | To make an idempotent API request using one of these actions, specify a
-- client token in the request. You should not reuse the same client token
-- for other API requests. If you retry a request that completed
-- successfully using the same client token and the same parameters, the
-- retry succeeds without performing any further actions. If you retry a
-- successful request using the same client token, but one or more of the
-- parameters are different, the retry fails with a ValidationException
-- error.
createStreamingSession_clientToken :: Lens.Lens' CreateStreamingSession (Prelude.Maybe Prelude.Text)
createStreamingSession_clientToken :: (Maybe Text -> f (Maybe Text))
-> CreateStreamingSession -> f CreateStreamingSession
createStreamingSession_clientToken = (CreateStreamingSession -> Maybe Text)
-> (CreateStreamingSession -> Maybe Text -> CreateStreamingSession)
-> Lens
     CreateStreamingSession
     CreateStreamingSession
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateStreamingSession' {Maybe Text
clientToken :: Maybe Text
$sel:clientToken:CreateStreamingSession' :: CreateStreamingSession -> Maybe Text
clientToken} -> Maybe Text
clientToken) (\s :: CreateStreamingSession
s@CreateStreamingSession' {} Maybe Text
a -> CreateStreamingSession
s {$sel:clientToken:CreateStreamingSession' :: Maybe Text
clientToken = Maybe Text
a} :: CreateStreamingSession)

-- | The EC2 Instance type used for the streaming session.
createStreamingSession_ec2InstanceType :: Lens.Lens' CreateStreamingSession (Prelude.Maybe StreamingInstanceType)
createStreamingSession_ec2InstanceType :: (Maybe StreamingInstanceType -> f (Maybe StreamingInstanceType))
-> CreateStreamingSession -> f CreateStreamingSession
createStreamingSession_ec2InstanceType = (CreateStreamingSession -> Maybe StreamingInstanceType)
-> (CreateStreamingSession
    -> Maybe StreamingInstanceType -> CreateStreamingSession)
-> Lens
     CreateStreamingSession
     CreateStreamingSession
     (Maybe StreamingInstanceType)
     (Maybe StreamingInstanceType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateStreamingSession' {Maybe StreamingInstanceType
ec2InstanceType :: Maybe StreamingInstanceType
$sel:ec2InstanceType:CreateStreamingSession' :: CreateStreamingSession -> Maybe StreamingInstanceType
ec2InstanceType} -> Maybe StreamingInstanceType
ec2InstanceType) (\s :: CreateStreamingSession
s@CreateStreamingSession' {} Maybe StreamingInstanceType
a -> CreateStreamingSession
s {$sel:ec2InstanceType:CreateStreamingSession' :: Maybe StreamingInstanceType
ec2InstanceType = Maybe StreamingInstanceType
a} :: CreateStreamingSession)

-- | The launch profile ID.
createStreamingSession_launchProfileId :: Lens.Lens' CreateStreamingSession (Prelude.Maybe Prelude.Text)
createStreamingSession_launchProfileId :: (Maybe Text -> f (Maybe Text))
-> CreateStreamingSession -> f CreateStreamingSession
createStreamingSession_launchProfileId = (CreateStreamingSession -> Maybe Text)
-> (CreateStreamingSession -> Maybe Text -> CreateStreamingSession)
-> Lens
     CreateStreamingSession
     CreateStreamingSession
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateStreamingSession' {Maybe Text
launchProfileId :: Maybe Text
$sel:launchProfileId:CreateStreamingSession' :: CreateStreamingSession -> Maybe Text
launchProfileId} -> Maybe Text
launchProfileId) (\s :: CreateStreamingSession
s@CreateStreamingSession' {} Maybe Text
a -> CreateStreamingSession
s {$sel:launchProfileId:CreateStreamingSession' :: Maybe Text
launchProfileId = Maybe Text
a} :: CreateStreamingSession)

-- | The ID of the streaming image.
createStreamingSession_streamingImageId :: Lens.Lens' CreateStreamingSession (Prelude.Maybe Prelude.Text)
createStreamingSession_streamingImageId :: (Maybe Text -> f (Maybe Text))
-> CreateStreamingSession -> f CreateStreamingSession
createStreamingSession_streamingImageId = (CreateStreamingSession -> Maybe Text)
-> (CreateStreamingSession -> Maybe Text -> CreateStreamingSession)
-> Lens
     CreateStreamingSession
     CreateStreamingSession
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateStreamingSession' {Maybe Text
streamingImageId :: Maybe Text
$sel:streamingImageId:CreateStreamingSession' :: CreateStreamingSession -> Maybe Text
streamingImageId} -> Maybe Text
streamingImageId) (\s :: CreateStreamingSession
s@CreateStreamingSession' {} Maybe Text
a -> CreateStreamingSession
s {$sel:streamingImageId:CreateStreamingSession' :: Maybe Text
streamingImageId = Maybe Text
a} :: CreateStreamingSession)

-- | A collection of labels, in the form of key:value pairs, that apply to
-- this resource.
createStreamingSession_tags :: Lens.Lens' CreateStreamingSession (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
createStreamingSession_tags :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> CreateStreamingSession -> f CreateStreamingSession
createStreamingSession_tags = (CreateStreamingSession -> Maybe (HashMap Text Text))
-> (CreateStreamingSession
    -> Maybe (HashMap Text Text) -> CreateStreamingSession)
-> Lens
     CreateStreamingSession
     CreateStreamingSession
     (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 (\CreateStreamingSession' {Maybe (HashMap Text Text)
tags :: Maybe (HashMap Text Text)
$sel:tags:CreateStreamingSession' :: CreateStreamingSession -> Maybe (HashMap Text Text)
tags} -> Maybe (HashMap Text Text)
tags) (\s :: CreateStreamingSession
s@CreateStreamingSession' {} Maybe (HashMap Text Text)
a -> CreateStreamingSession
s {$sel:tags:CreateStreamingSession' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
a} :: CreateStreamingSession) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
 -> CreateStreamingSession -> f CreateStreamingSession)
-> ((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)))
-> CreateStreamingSession
-> f CreateStreamingSession
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 studio ID.
createStreamingSession_studioId :: Lens.Lens' CreateStreamingSession Prelude.Text
createStreamingSession_studioId :: (Text -> f Text)
-> CreateStreamingSession -> f CreateStreamingSession
createStreamingSession_studioId = (CreateStreamingSession -> Text)
-> (CreateStreamingSession -> Text -> CreateStreamingSession)
-> Lens CreateStreamingSession CreateStreamingSession Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateStreamingSession' {Text
studioId :: Text
$sel:studioId:CreateStreamingSession' :: CreateStreamingSession -> Text
studioId} -> Text
studioId) (\s :: CreateStreamingSession
s@CreateStreamingSession' {} Text
a -> CreateStreamingSession
s {$sel:studioId:CreateStreamingSession' :: Text
studioId = Text
a} :: CreateStreamingSession)

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

instance Prelude.NFData CreateStreamingSession

instance Core.ToHeaders CreateStreamingSession where
  toHeaders :: CreateStreamingSession -> ResponseHeaders
toHeaders CreateStreamingSession' {Maybe Text
Maybe (HashMap Text Text)
Maybe StreamingInstanceType
Text
studioId :: Text
tags :: Maybe (HashMap Text Text)
streamingImageId :: Maybe Text
launchProfileId :: Maybe Text
ec2InstanceType :: Maybe StreamingInstanceType
clientToken :: Maybe Text
ownedBy :: Maybe Text
$sel:studioId:CreateStreamingSession' :: CreateStreamingSession -> Text
$sel:tags:CreateStreamingSession' :: CreateStreamingSession -> Maybe (HashMap Text Text)
$sel:streamingImageId:CreateStreamingSession' :: CreateStreamingSession -> Maybe Text
$sel:launchProfileId:CreateStreamingSession' :: CreateStreamingSession -> Maybe Text
$sel:ec2InstanceType:CreateStreamingSession' :: CreateStreamingSession -> Maybe StreamingInstanceType
$sel:clientToken:CreateStreamingSession' :: CreateStreamingSession -> Maybe Text
$sel:ownedBy:CreateStreamingSession' :: CreateStreamingSession -> Maybe Text
..} =
    [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ HeaderName
"X-Amz-Client-Token" HeaderName -> Maybe Text -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# Maybe Text
clientToken,
        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 CreateStreamingSession where
  toJSON :: CreateStreamingSession -> Value
toJSON CreateStreamingSession' {Maybe Text
Maybe (HashMap Text Text)
Maybe StreamingInstanceType
Text
studioId :: Text
tags :: Maybe (HashMap Text Text)
streamingImageId :: Maybe Text
launchProfileId :: Maybe Text
ec2InstanceType :: Maybe StreamingInstanceType
clientToken :: Maybe Text
ownedBy :: Maybe Text
$sel:studioId:CreateStreamingSession' :: CreateStreamingSession -> Text
$sel:tags:CreateStreamingSession' :: CreateStreamingSession -> Maybe (HashMap Text Text)
$sel:streamingImageId:CreateStreamingSession' :: CreateStreamingSession -> Maybe Text
$sel:launchProfileId:CreateStreamingSession' :: CreateStreamingSession -> Maybe Text
$sel:ec2InstanceType:CreateStreamingSession' :: CreateStreamingSession -> Maybe StreamingInstanceType
$sel:clientToken:CreateStreamingSession' :: CreateStreamingSession -> Maybe Text
$sel:ownedBy:CreateStreamingSession' :: CreateStreamingSession -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"ownedBy" 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
ownedBy,
            (Text
"ec2InstanceType" Text -> StreamingInstanceType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (StreamingInstanceType -> Pair)
-> Maybe StreamingInstanceType -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe StreamingInstanceType
ec2InstanceType,
            (Text
"launchProfileId" 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
launchProfileId,
            (Text
"streamingImageId" 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
streamingImageId,
            (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
          ]
      )

instance Core.ToPath CreateStreamingSession where
  toPath :: CreateStreamingSession -> ByteString
toPath CreateStreamingSession' {Maybe Text
Maybe (HashMap Text Text)
Maybe StreamingInstanceType
Text
studioId :: Text
tags :: Maybe (HashMap Text Text)
streamingImageId :: Maybe Text
launchProfileId :: Maybe Text
ec2InstanceType :: Maybe StreamingInstanceType
clientToken :: Maybe Text
ownedBy :: Maybe Text
$sel:studioId:CreateStreamingSession' :: CreateStreamingSession -> Text
$sel:tags:CreateStreamingSession' :: CreateStreamingSession -> Maybe (HashMap Text Text)
$sel:streamingImageId:CreateStreamingSession' :: CreateStreamingSession -> Maybe Text
$sel:launchProfileId:CreateStreamingSession' :: CreateStreamingSession -> Maybe Text
$sel:ec2InstanceType:CreateStreamingSession' :: CreateStreamingSession -> Maybe StreamingInstanceType
$sel:clientToken:CreateStreamingSession' :: CreateStreamingSession -> Maybe Text
$sel:ownedBy:CreateStreamingSession' :: CreateStreamingSession -> Maybe Text
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/2020-08-01/studios/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
studioId,
        ByteString
"/streaming-sessions"
      ]

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

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

-- |
-- Create a value of 'CreateStreamingSessionResponse' 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:
--
-- 'session', 'createStreamingSessionResponse_session' - The session.
--
-- 'httpStatus', 'createStreamingSessionResponse_httpStatus' - The response's http status code.
newCreateStreamingSessionResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  CreateStreamingSessionResponse
newCreateStreamingSessionResponse :: Int -> CreateStreamingSessionResponse
newCreateStreamingSessionResponse Int
pHttpStatus_ =
  CreateStreamingSessionResponse' :: Maybe StreamingSession -> Int -> CreateStreamingSessionResponse
CreateStreamingSessionResponse'
    { $sel:session:CreateStreamingSessionResponse' :: Maybe StreamingSession
session =
        Maybe StreamingSession
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:CreateStreamingSessionResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The session.
createStreamingSessionResponse_session :: Lens.Lens' CreateStreamingSessionResponse (Prelude.Maybe StreamingSession)
createStreamingSessionResponse_session :: (Maybe StreamingSession -> f (Maybe StreamingSession))
-> CreateStreamingSessionResponse
-> f CreateStreamingSessionResponse
createStreamingSessionResponse_session = (CreateStreamingSessionResponse -> Maybe StreamingSession)
-> (CreateStreamingSessionResponse
    -> Maybe StreamingSession -> CreateStreamingSessionResponse)
-> Lens
     CreateStreamingSessionResponse
     CreateStreamingSessionResponse
     (Maybe StreamingSession)
     (Maybe StreamingSession)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateStreamingSessionResponse' {Maybe StreamingSession
session :: Maybe StreamingSession
$sel:session:CreateStreamingSessionResponse' :: CreateStreamingSessionResponse -> Maybe StreamingSession
session} -> Maybe StreamingSession
session) (\s :: CreateStreamingSessionResponse
s@CreateStreamingSessionResponse' {} Maybe StreamingSession
a -> CreateStreamingSessionResponse
s {$sel:session:CreateStreamingSessionResponse' :: Maybe StreamingSession
session = Maybe StreamingSession
a} :: CreateStreamingSessionResponse)

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

instance
  Prelude.NFData
    CreateStreamingSessionResponse