{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.IVS.Types.StreamKey
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.IVS.Types.StreamKey where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude

-- | Object specifying a stream key.
--
-- /See:/ 'newStreamKey' smart constructor.
data StreamKey = StreamKey'
  { -- | Stream-key ARN.
    StreamKey -> Maybe Text
arn :: Prelude.Maybe Prelude.Text,
    -- | Channel ARN for the stream.
    StreamKey -> Maybe Text
channelArn :: Prelude.Maybe Prelude.Text,
    -- | Array of 1-50 maps, each of the form @string:string (key:value)@. See
    -- <https://docs.aws.amazon.com/general/latest/gr/aws_tagging.html Tagging Amazon Web Services Resources>
    -- for more information, including restrictions that apply to tags and
    -- \"Tag naming limits and requirements\"; Amazon IVS has no
    -- service-specific constraints beyond what is documented there.
    StreamKey -> Maybe (HashMap Text Text)
tags :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | Stream-key value.
    StreamKey -> Maybe (Sensitive Text)
value :: Prelude.Maybe (Data.Sensitive Prelude.Text)
  }
  deriving (StreamKey -> StreamKey -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StreamKey -> StreamKey -> Bool
$c/= :: StreamKey -> StreamKey -> Bool
== :: StreamKey -> StreamKey -> Bool
$c== :: StreamKey -> StreamKey -> Bool
Prelude.Eq, Int -> StreamKey -> ShowS
[StreamKey] -> ShowS
StreamKey -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StreamKey] -> ShowS
$cshowList :: [StreamKey] -> ShowS
show :: StreamKey -> String
$cshow :: StreamKey -> String
showsPrec :: Int -> StreamKey -> ShowS
$cshowsPrec :: Int -> StreamKey -> ShowS
Prelude.Show, forall x. Rep StreamKey x -> StreamKey
forall x. StreamKey -> Rep StreamKey x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StreamKey x -> StreamKey
$cfrom :: forall x. StreamKey -> Rep StreamKey x
Prelude.Generic)

-- |
-- Create a value of 'StreamKey' 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:
--
-- 'arn', 'streamKey_arn' - Stream-key ARN.
--
-- 'channelArn', 'streamKey_channelArn' - Channel ARN for the stream.
--
-- 'tags', 'streamKey_tags' - Array of 1-50 maps, each of the form @string:string (key:value)@. See
-- <https://docs.aws.amazon.com/general/latest/gr/aws_tagging.html Tagging Amazon Web Services Resources>
-- for more information, including restrictions that apply to tags and
-- \"Tag naming limits and requirements\"; Amazon IVS has no
-- service-specific constraints beyond what is documented there.
--
-- 'value', 'streamKey_value' - Stream-key value.
newStreamKey ::
  StreamKey
newStreamKey :: StreamKey
newStreamKey =
  StreamKey'
    { $sel:arn:StreamKey' :: Maybe Text
arn = forall a. Maybe a
Prelude.Nothing,
      $sel:channelArn:StreamKey' :: Maybe Text
channelArn = forall a. Maybe a
Prelude.Nothing,
      $sel:tags:StreamKey' :: Maybe (HashMap Text Text)
tags = forall a. Maybe a
Prelude.Nothing,
      $sel:value:StreamKey' :: Maybe (Sensitive Text)
value = forall a. Maybe a
Prelude.Nothing
    }

-- | Stream-key ARN.
streamKey_arn :: Lens.Lens' StreamKey (Prelude.Maybe Prelude.Text)
streamKey_arn :: Lens' StreamKey (Maybe Text)
streamKey_arn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StreamKey' {Maybe Text
arn :: Maybe Text
$sel:arn:StreamKey' :: StreamKey -> Maybe Text
arn} -> Maybe Text
arn) (\s :: StreamKey
s@StreamKey' {} Maybe Text
a -> StreamKey
s {$sel:arn:StreamKey' :: Maybe Text
arn = Maybe Text
a} :: StreamKey)

-- | Channel ARN for the stream.
streamKey_channelArn :: Lens.Lens' StreamKey (Prelude.Maybe Prelude.Text)
streamKey_channelArn :: Lens' StreamKey (Maybe Text)
streamKey_channelArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StreamKey' {Maybe Text
channelArn :: Maybe Text
$sel:channelArn:StreamKey' :: StreamKey -> Maybe Text
channelArn} -> Maybe Text
channelArn) (\s :: StreamKey
s@StreamKey' {} Maybe Text
a -> StreamKey
s {$sel:channelArn:StreamKey' :: Maybe Text
channelArn = Maybe Text
a} :: StreamKey)

-- | Array of 1-50 maps, each of the form @string:string (key:value)@. See
-- <https://docs.aws.amazon.com/general/latest/gr/aws_tagging.html Tagging Amazon Web Services Resources>
-- for more information, including restrictions that apply to tags and
-- \"Tag naming limits and requirements\"; Amazon IVS has no
-- service-specific constraints beyond what is documented there.
streamKey_tags :: Lens.Lens' StreamKey (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
streamKey_tags :: Lens' StreamKey (Maybe (HashMap Text Text))
streamKey_tags = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StreamKey' {Maybe (HashMap Text Text)
tags :: Maybe (HashMap Text Text)
$sel:tags:StreamKey' :: StreamKey -> Maybe (HashMap Text Text)
tags} -> Maybe (HashMap Text Text)
tags) (\s :: StreamKey
s@StreamKey' {} Maybe (HashMap Text Text)
a -> StreamKey
s {$sel:tags:StreamKey' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
a} :: StreamKey) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Stream-key value.
streamKey_value :: Lens.Lens' StreamKey (Prelude.Maybe Prelude.Text)
streamKey_value :: Lens' StreamKey (Maybe Text)
streamKey_value = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StreamKey' {Maybe (Sensitive Text)
value :: Maybe (Sensitive Text)
$sel:value:StreamKey' :: StreamKey -> Maybe (Sensitive Text)
value} -> Maybe (Sensitive Text)
value) (\s :: StreamKey
s@StreamKey' {} Maybe (Sensitive Text)
a -> StreamKey
s {$sel:value:StreamKey' :: Maybe (Sensitive Text)
value = Maybe (Sensitive Text)
a} :: StreamKey) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall a. Iso' (Sensitive a) a
Data._Sensitive

instance Data.FromJSON StreamKey where
  parseJSON :: Value -> Parser StreamKey
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"StreamKey"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe (HashMap Text Text)
-> Maybe (Sensitive Text)
-> StreamKey
StreamKey'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"arn")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"channelArn")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"tags" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"value")
      )

instance Prelude.Hashable StreamKey where
  hashWithSalt :: Int -> StreamKey -> Int
hashWithSalt Int
_salt StreamKey' {Maybe Text
Maybe (HashMap Text Text)
Maybe (Sensitive Text)
value :: Maybe (Sensitive Text)
tags :: Maybe (HashMap Text Text)
channelArn :: Maybe Text
arn :: Maybe Text
$sel:value:StreamKey' :: StreamKey -> Maybe (Sensitive Text)
$sel:tags:StreamKey' :: StreamKey -> Maybe (HashMap Text Text)
$sel:channelArn:StreamKey' :: StreamKey -> Maybe Text
$sel:arn:StreamKey' :: StreamKey -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
arn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
channelArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (HashMap Text Text)
tags
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (Sensitive Text)
value

instance Prelude.NFData StreamKey where
  rnf :: StreamKey -> ()
rnf StreamKey' {Maybe Text
Maybe (HashMap Text Text)
Maybe (Sensitive Text)
value :: Maybe (Sensitive Text)
tags :: Maybe (HashMap Text Text)
channelArn :: Maybe Text
arn :: Maybe Text
$sel:value:StreamKey' :: StreamKey -> Maybe (Sensitive Text)
$sel:tags:StreamKey' :: StreamKey -> Maybe (HashMap Text Text)
$sel:channelArn:StreamKey' :: StreamKey -> Maybe Text
$sel:arn:StreamKey' :: StreamKey -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
arn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
channelArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (HashMap Text Text)
tags
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (Sensitive Text)
value