{-# 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.IoT.CreateStream
-- 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 stream for delivering one or more large files in chunks over
-- MQTT. A stream transports data bytes in chunks or blocks packaged as
-- MQTT messages from a source like S3. You can have one or more files
-- associated with a stream.
--
-- Requires permission to access the
-- <https://docs.aws.amazon.com/service-authorization/latest/reference/list_awsiot.html#awsiot-actions-as-permissions CreateStream>
-- action.
module Amazonka.IoT.CreateStream
  ( -- * Creating a Request
    CreateStream (..),
    newCreateStream,

    -- * Request Lenses
    createStream_description,
    createStream_tags,
    createStream_streamId,
    createStream_files,
    createStream_roleArn,

    -- * Destructuring the Response
    CreateStreamResponse (..),
    newCreateStreamResponse,

    -- * Response Lenses
    createStreamResponse_streamVersion,
    createStreamResponse_streamArn,
    createStreamResponse_description,
    createStreamResponse_streamId,
    createStreamResponse_httpStatus,
  )
where

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

-- | /See:/ 'newCreateStream' smart constructor.
data CreateStream = CreateStream'
  { -- | A description of the stream.
    CreateStream -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | Metadata which can be used to manage streams.
    CreateStream -> Maybe [Tag]
tags :: Prelude.Maybe [Tag],
    -- | The stream ID.
    CreateStream -> Text
streamId :: Prelude.Text,
    -- | The files to stream.
    CreateStream -> NonEmpty StreamFile
files :: Prelude.NonEmpty StreamFile,
    -- | An IAM role that allows the IoT service principal assumes to access your
    -- S3 files.
    CreateStream -> Text
roleArn :: Prelude.Text
  }
  deriving (CreateStream -> CreateStream -> Bool
(CreateStream -> CreateStream -> Bool)
-> (CreateStream -> CreateStream -> Bool) -> Eq CreateStream
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateStream -> CreateStream -> Bool
$c/= :: CreateStream -> CreateStream -> Bool
== :: CreateStream -> CreateStream -> Bool
$c== :: CreateStream -> CreateStream -> Bool
Prelude.Eq, ReadPrec [CreateStream]
ReadPrec CreateStream
Int -> ReadS CreateStream
ReadS [CreateStream]
(Int -> ReadS CreateStream)
-> ReadS [CreateStream]
-> ReadPrec CreateStream
-> ReadPrec [CreateStream]
-> Read CreateStream
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateStream]
$creadListPrec :: ReadPrec [CreateStream]
readPrec :: ReadPrec CreateStream
$creadPrec :: ReadPrec CreateStream
readList :: ReadS [CreateStream]
$creadList :: ReadS [CreateStream]
readsPrec :: Int -> ReadS CreateStream
$creadsPrec :: Int -> ReadS CreateStream
Prelude.Read, Int -> CreateStream -> ShowS
[CreateStream] -> ShowS
CreateStream -> String
(Int -> CreateStream -> ShowS)
-> (CreateStream -> String)
-> ([CreateStream] -> ShowS)
-> Show CreateStream
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateStream] -> ShowS
$cshowList :: [CreateStream] -> ShowS
show :: CreateStream -> String
$cshow :: CreateStream -> String
showsPrec :: Int -> CreateStream -> ShowS
$cshowsPrec :: Int -> CreateStream -> ShowS
Prelude.Show, (forall x. CreateStream -> Rep CreateStream x)
-> (forall x. Rep CreateStream x -> CreateStream)
-> Generic CreateStream
forall x. Rep CreateStream x -> CreateStream
forall x. CreateStream -> Rep CreateStream x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateStream x -> CreateStream
$cfrom :: forall x. CreateStream -> Rep CreateStream x
Prelude.Generic)

-- |
-- Create a value of 'CreateStream' 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:
--
-- 'description', 'createStream_description' - A description of the stream.
--
-- 'tags', 'createStream_tags' - Metadata which can be used to manage streams.
--
-- 'streamId', 'createStream_streamId' - The stream ID.
--
-- 'files', 'createStream_files' - The files to stream.
--
-- 'roleArn', 'createStream_roleArn' - An IAM role that allows the IoT service principal assumes to access your
-- S3 files.
newCreateStream ::
  -- | 'streamId'
  Prelude.Text ->
  -- | 'files'
  Prelude.NonEmpty StreamFile ->
  -- | 'roleArn'
  Prelude.Text ->
  CreateStream
newCreateStream :: Text -> NonEmpty StreamFile -> Text -> CreateStream
newCreateStream Text
pStreamId_ NonEmpty StreamFile
pFiles_ Text
pRoleArn_ =
  CreateStream' :: Maybe Text
-> Maybe [Tag]
-> Text
-> NonEmpty StreamFile
-> Text
-> CreateStream
CreateStream'
    { $sel:description:CreateStream' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:tags:CreateStream' :: Maybe [Tag]
tags = Maybe [Tag]
forall a. Maybe a
Prelude.Nothing,
      $sel:streamId:CreateStream' :: Text
streamId = Text
pStreamId_,
      $sel:files:CreateStream' :: NonEmpty StreamFile
files = Tagged (NonEmpty StreamFile) (Identity (NonEmpty StreamFile))
-> Tagged (NonEmpty StreamFile) (Identity (NonEmpty StreamFile))
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced (Tagged (NonEmpty StreamFile) (Identity (NonEmpty StreamFile))
 -> Tagged (NonEmpty StreamFile) (Identity (NonEmpty StreamFile)))
-> NonEmpty StreamFile -> NonEmpty StreamFile
forall t b. AReview t b -> b -> t
Lens.# NonEmpty StreamFile
pFiles_,
      $sel:roleArn:CreateStream' :: Text
roleArn = Text
pRoleArn_
    }

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

-- | Metadata which can be used to manage streams.
createStream_tags :: Lens.Lens' CreateStream (Prelude.Maybe [Tag])
createStream_tags :: (Maybe [Tag] -> f (Maybe [Tag])) -> CreateStream -> f CreateStream
createStream_tags = (CreateStream -> Maybe [Tag])
-> (CreateStream -> Maybe [Tag] -> CreateStream)
-> Lens CreateStream CreateStream (Maybe [Tag]) (Maybe [Tag])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateStream' {Maybe [Tag]
tags :: Maybe [Tag]
$sel:tags:CreateStream' :: CreateStream -> Maybe [Tag]
tags} -> Maybe [Tag]
tags) (\s :: CreateStream
s@CreateStream' {} Maybe [Tag]
a -> CreateStream
s {$sel:tags:CreateStream' :: Maybe [Tag]
tags = Maybe [Tag]
a} :: CreateStream) ((Maybe [Tag] -> f (Maybe [Tag]))
 -> CreateStream -> f CreateStream)
-> ((Maybe [Tag] -> f (Maybe [Tag]))
    -> Maybe [Tag] -> f (Maybe [Tag]))
-> (Maybe [Tag] -> f (Maybe [Tag]))
-> CreateStream
-> f CreateStream
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Tag] [Tag] [Tag] [Tag]
-> Iso (Maybe [Tag]) (Maybe [Tag]) (Maybe [Tag]) (Maybe [Tag])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso [Tag] [Tag] [Tag] [Tag]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The stream ID.
createStream_streamId :: Lens.Lens' CreateStream Prelude.Text
createStream_streamId :: (Text -> f Text) -> CreateStream -> f CreateStream
createStream_streamId = (CreateStream -> Text)
-> (CreateStream -> Text -> CreateStream)
-> Lens CreateStream CreateStream Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateStream' {Text
streamId :: Text
$sel:streamId:CreateStream' :: CreateStream -> Text
streamId} -> Text
streamId) (\s :: CreateStream
s@CreateStream' {} Text
a -> CreateStream
s {$sel:streamId:CreateStream' :: Text
streamId = Text
a} :: CreateStream)

-- | The files to stream.
createStream_files :: Lens.Lens' CreateStream (Prelude.NonEmpty StreamFile)
createStream_files :: (NonEmpty StreamFile -> f (NonEmpty StreamFile))
-> CreateStream -> f CreateStream
createStream_files = (CreateStream -> NonEmpty StreamFile)
-> (CreateStream -> NonEmpty StreamFile -> CreateStream)
-> Lens
     CreateStream
     CreateStream
     (NonEmpty StreamFile)
     (NonEmpty StreamFile)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateStream' {NonEmpty StreamFile
files :: NonEmpty StreamFile
$sel:files:CreateStream' :: CreateStream -> NonEmpty StreamFile
files} -> NonEmpty StreamFile
files) (\s :: CreateStream
s@CreateStream' {} NonEmpty StreamFile
a -> CreateStream
s {$sel:files:CreateStream' :: NonEmpty StreamFile
files = NonEmpty StreamFile
a} :: CreateStream) ((NonEmpty StreamFile -> f (NonEmpty StreamFile))
 -> CreateStream -> f CreateStream)
-> ((NonEmpty StreamFile -> f (NonEmpty StreamFile))
    -> NonEmpty StreamFile -> f (NonEmpty StreamFile))
-> (NonEmpty StreamFile -> f (NonEmpty StreamFile))
-> CreateStream
-> f CreateStream
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (NonEmpty StreamFile -> f (NonEmpty StreamFile))
-> NonEmpty StreamFile -> f (NonEmpty StreamFile)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | An IAM role that allows the IoT service principal assumes to access your
-- S3 files.
createStream_roleArn :: Lens.Lens' CreateStream Prelude.Text
createStream_roleArn :: (Text -> f Text) -> CreateStream -> f CreateStream
createStream_roleArn = (CreateStream -> Text)
-> (CreateStream -> Text -> CreateStream)
-> Lens CreateStream CreateStream Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateStream' {Text
roleArn :: Text
$sel:roleArn:CreateStream' :: CreateStream -> Text
roleArn} -> Text
roleArn) (\s :: CreateStream
s@CreateStream' {} Text
a -> CreateStream
s {$sel:roleArn:CreateStream' :: Text
roleArn = Text
a} :: CreateStream)

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

instance Prelude.NFData CreateStream

instance Core.ToHeaders CreateStream where
  toHeaders :: CreateStream -> ResponseHeaders
toHeaders = ResponseHeaders -> CreateStream -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty

instance Core.ToJSON CreateStream where
  toJSON :: CreateStream -> Value
toJSON CreateStream' {Maybe [Tag]
Maybe Text
NonEmpty StreamFile
Text
roleArn :: Text
files :: NonEmpty StreamFile
streamId :: Text
tags :: Maybe [Tag]
description :: Maybe Text
$sel:roleArn:CreateStream' :: CreateStream -> Text
$sel:files:CreateStream' :: CreateStream -> NonEmpty StreamFile
$sel:streamId:CreateStream' :: CreateStream -> Text
$sel:tags:CreateStream' :: CreateStream -> Maybe [Tag]
$sel:description:CreateStream' :: CreateStream -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (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 -> [Tag] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([Tag] -> Pair) -> Maybe [Tag] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Tag]
tags,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"files" Text -> NonEmpty StreamFile -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= NonEmpty StreamFile
files),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"roleArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
roleArn)
          ]
      )

instance Core.ToPath CreateStream where
  toPath :: CreateStream -> ByteString
toPath CreateStream' {Maybe [Tag]
Maybe Text
NonEmpty StreamFile
Text
roleArn :: Text
files :: NonEmpty StreamFile
streamId :: Text
tags :: Maybe [Tag]
description :: Maybe Text
$sel:roleArn:CreateStream' :: CreateStream -> Text
$sel:files:CreateStream' :: CreateStream -> NonEmpty StreamFile
$sel:streamId:CreateStream' :: CreateStream -> Text
$sel:tags:CreateStream' :: CreateStream -> Maybe [Tag]
$sel:description:CreateStream' :: CreateStream -> Maybe Text
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat [ByteString
"/streams/", Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
streamId]

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

-- | /See:/ 'newCreateStreamResponse' smart constructor.
data CreateStreamResponse = CreateStreamResponse'
  { -- | The version of the stream.
    CreateStreamResponse -> Maybe Natural
streamVersion :: Prelude.Maybe Prelude.Natural,
    -- | The stream ARN.
    CreateStreamResponse -> Maybe Text
streamArn :: Prelude.Maybe Prelude.Text,
    -- | A description of the stream.
    CreateStreamResponse -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | The stream ID.
    CreateStreamResponse -> Maybe Text
streamId :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    CreateStreamResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (CreateStreamResponse -> CreateStreamResponse -> Bool
(CreateStreamResponse -> CreateStreamResponse -> Bool)
-> (CreateStreamResponse -> CreateStreamResponse -> Bool)
-> Eq CreateStreamResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateStreamResponse -> CreateStreamResponse -> Bool
$c/= :: CreateStreamResponse -> CreateStreamResponse -> Bool
== :: CreateStreamResponse -> CreateStreamResponse -> Bool
$c== :: CreateStreamResponse -> CreateStreamResponse -> Bool
Prelude.Eq, ReadPrec [CreateStreamResponse]
ReadPrec CreateStreamResponse
Int -> ReadS CreateStreamResponse
ReadS [CreateStreamResponse]
(Int -> ReadS CreateStreamResponse)
-> ReadS [CreateStreamResponse]
-> ReadPrec CreateStreamResponse
-> ReadPrec [CreateStreamResponse]
-> Read CreateStreamResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateStreamResponse]
$creadListPrec :: ReadPrec [CreateStreamResponse]
readPrec :: ReadPrec CreateStreamResponse
$creadPrec :: ReadPrec CreateStreamResponse
readList :: ReadS [CreateStreamResponse]
$creadList :: ReadS [CreateStreamResponse]
readsPrec :: Int -> ReadS CreateStreamResponse
$creadsPrec :: Int -> ReadS CreateStreamResponse
Prelude.Read, Int -> CreateStreamResponse -> ShowS
[CreateStreamResponse] -> ShowS
CreateStreamResponse -> String
(Int -> CreateStreamResponse -> ShowS)
-> (CreateStreamResponse -> String)
-> ([CreateStreamResponse] -> ShowS)
-> Show CreateStreamResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateStreamResponse] -> ShowS
$cshowList :: [CreateStreamResponse] -> ShowS
show :: CreateStreamResponse -> String
$cshow :: CreateStreamResponse -> String
showsPrec :: Int -> CreateStreamResponse -> ShowS
$cshowsPrec :: Int -> CreateStreamResponse -> ShowS
Prelude.Show, (forall x. CreateStreamResponse -> Rep CreateStreamResponse x)
-> (forall x. Rep CreateStreamResponse x -> CreateStreamResponse)
-> Generic CreateStreamResponse
forall x. Rep CreateStreamResponse x -> CreateStreamResponse
forall x. CreateStreamResponse -> Rep CreateStreamResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateStreamResponse x -> CreateStreamResponse
$cfrom :: forall x. CreateStreamResponse -> Rep CreateStreamResponse x
Prelude.Generic)

-- |
-- Create a value of 'CreateStreamResponse' 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:
--
-- 'streamVersion', 'createStreamResponse_streamVersion' - The version of the stream.
--
-- 'streamArn', 'createStreamResponse_streamArn' - The stream ARN.
--
-- 'description', 'createStreamResponse_description' - A description of the stream.
--
-- 'streamId', 'createStreamResponse_streamId' - The stream ID.
--
-- 'httpStatus', 'createStreamResponse_httpStatus' - The response's http status code.
newCreateStreamResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  CreateStreamResponse
newCreateStreamResponse :: Int -> CreateStreamResponse
newCreateStreamResponse Int
pHttpStatus_ =
  CreateStreamResponse' :: Maybe Natural
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Int
-> CreateStreamResponse
CreateStreamResponse'
    { $sel:streamVersion:CreateStreamResponse' :: Maybe Natural
streamVersion =
        Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:streamArn:CreateStreamResponse' :: Maybe Text
streamArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:description:CreateStreamResponse' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:streamId:CreateStreamResponse' :: Maybe Text
streamId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:CreateStreamResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The version of the stream.
createStreamResponse_streamVersion :: Lens.Lens' CreateStreamResponse (Prelude.Maybe Prelude.Natural)
createStreamResponse_streamVersion :: (Maybe Natural -> f (Maybe Natural))
-> CreateStreamResponse -> f CreateStreamResponse
createStreamResponse_streamVersion = (CreateStreamResponse -> Maybe Natural)
-> (CreateStreamResponse -> Maybe Natural -> CreateStreamResponse)
-> Lens
     CreateStreamResponse
     CreateStreamResponse
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateStreamResponse' {Maybe Natural
streamVersion :: Maybe Natural
$sel:streamVersion:CreateStreamResponse' :: CreateStreamResponse -> Maybe Natural
streamVersion} -> Maybe Natural
streamVersion) (\s :: CreateStreamResponse
s@CreateStreamResponse' {} Maybe Natural
a -> CreateStreamResponse
s {$sel:streamVersion:CreateStreamResponse' :: Maybe Natural
streamVersion = Maybe Natural
a} :: CreateStreamResponse)

-- | The stream ARN.
createStreamResponse_streamArn :: Lens.Lens' CreateStreamResponse (Prelude.Maybe Prelude.Text)
createStreamResponse_streamArn :: (Maybe Text -> f (Maybe Text))
-> CreateStreamResponse -> f CreateStreamResponse
createStreamResponse_streamArn = (CreateStreamResponse -> Maybe Text)
-> (CreateStreamResponse -> Maybe Text -> CreateStreamResponse)
-> Lens
     CreateStreamResponse CreateStreamResponse (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateStreamResponse' {Maybe Text
streamArn :: Maybe Text
$sel:streamArn:CreateStreamResponse' :: CreateStreamResponse -> Maybe Text
streamArn} -> Maybe Text
streamArn) (\s :: CreateStreamResponse
s@CreateStreamResponse' {} Maybe Text
a -> CreateStreamResponse
s {$sel:streamArn:CreateStreamResponse' :: Maybe Text
streamArn = Maybe Text
a} :: CreateStreamResponse)

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

-- | The stream ID.
createStreamResponse_streamId :: Lens.Lens' CreateStreamResponse (Prelude.Maybe Prelude.Text)
createStreamResponse_streamId :: (Maybe Text -> f (Maybe Text))
-> CreateStreamResponse -> f CreateStreamResponse
createStreamResponse_streamId = (CreateStreamResponse -> Maybe Text)
-> (CreateStreamResponse -> Maybe Text -> CreateStreamResponse)
-> Lens
     CreateStreamResponse CreateStreamResponse (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateStreamResponse' {Maybe Text
streamId :: Maybe Text
$sel:streamId:CreateStreamResponse' :: CreateStreamResponse -> Maybe Text
streamId} -> Maybe Text
streamId) (\s :: CreateStreamResponse
s@CreateStreamResponse' {} Maybe Text
a -> CreateStreamResponse
s {$sel:streamId:CreateStreamResponse' :: Maybe Text
streamId = Maybe Text
a} :: CreateStreamResponse)

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

instance Prelude.NFData CreateStreamResponse