{-# 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.StreamKeySummary
-- 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)
module Amazonka.IVS.Types.StreamKeySummary where

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

-- | Summary information about a stream key.
--
-- /See:/ 'newStreamKeySummary' smart constructor.
data StreamKeySummary = StreamKeySummary'
  { -- | Stream-key ARN.
    StreamKeySummary -> Maybe Text
arn :: Prelude.Maybe Prelude.Text,
    -- | Channel ARN for the stream.
    StreamKeySummary -> Maybe Text
channelArn :: Prelude.Maybe Prelude.Text,
    -- | Array of 1-50 maps, each of the form @string:string (key:value)@.
    StreamKeySummary -> Maybe (HashMap Text Text)
tags :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text)
  }
  deriving (StreamKeySummary -> StreamKeySummary -> Bool
(StreamKeySummary -> StreamKeySummary -> Bool)
-> (StreamKeySummary -> StreamKeySummary -> Bool)
-> Eq StreamKeySummary
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StreamKeySummary -> StreamKeySummary -> Bool
$c/= :: StreamKeySummary -> StreamKeySummary -> Bool
== :: StreamKeySummary -> StreamKeySummary -> Bool
$c== :: StreamKeySummary -> StreamKeySummary -> Bool
Prelude.Eq, ReadPrec [StreamKeySummary]
ReadPrec StreamKeySummary
Int -> ReadS StreamKeySummary
ReadS [StreamKeySummary]
(Int -> ReadS StreamKeySummary)
-> ReadS [StreamKeySummary]
-> ReadPrec StreamKeySummary
-> ReadPrec [StreamKeySummary]
-> Read StreamKeySummary
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StreamKeySummary]
$creadListPrec :: ReadPrec [StreamKeySummary]
readPrec :: ReadPrec StreamKeySummary
$creadPrec :: ReadPrec StreamKeySummary
readList :: ReadS [StreamKeySummary]
$creadList :: ReadS [StreamKeySummary]
readsPrec :: Int -> ReadS StreamKeySummary
$creadsPrec :: Int -> ReadS StreamKeySummary
Prelude.Read, Int -> StreamKeySummary -> ShowS
[StreamKeySummary] -> ShowS
StreamKeySummary -> String
(Int -> StreamKeySummary -> ShowS)
-> (StreamKeySummary -> String)
-> ([StreamKeySummary] -> ShowS)
-> Show StreamKeySummary
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StreamKeySummary] -> ShowS
$cshowList :: [StreamKeySummary] -> ShowS
show :: StreamKeySummary -> String
$cshow :: StreamKeySummary -> String
showsPrec :: Int -> StreamKeySummary -> ShowS
$cshowsPrec :: Int -> StreamKeySummary -> ShowS
Prelude.Show, (forall x. StreamKeySummary -> Rep StreamKeySummary x)
-> (forall x. Rep StreamKeySummary x -> StreamKeySummary)
-> Generic StreamKeySummary
forall x. Rep StreamKeySummary x -> StreamKeySummary
forall x. StreamKeySummary -> Rep StreamKeySummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StreamKeySummary x -> StreamKeySummary
$cfrom :: forall x. StreamKeySummary -> Rep StreamKeySummary x
Prelude.Generic)

-- |
-- Create a value of 'StreamKeySummary' 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', 'streamKeySummary_arn' - Stream-key ARN.
--
-- 'channelArn', 'streamKeySummary_channelArn' - Channel ARN for the stream.
--
-- 'tags', 'streamKeySummary_tags' - Array of 1-50 maps, each of the form @string:string (key:value)@.
newStreamKeySummary ::
  StreamKeySummary
newStreamKeySummary :: StreamKeySummary
newStreamKeySummary =
  StreamKeySummary' :: Maybe Text
-> Maybe Text -> Maybe (HashMap Text Text) -> StreamKeySummary
StreamKeySummary'
    { $sel:arn:StreamKeySummary' :: Maybe Text
arn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:channelArn:StreamKeySummary' :: Maybe Text
channelArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:tags:StreamKeySummary' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing
    }

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

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

-- | Array of 1-50 maps, each of the form @string:string (key:value)@.
streamKeySummary_tags :: Lens.Lens' StreamKeySummary (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
streamKeySummary_tags :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> StreamKeySummary -> f StreamKeySummary
streamKeySummary_tags = (StreamKeySummary -> Maybe (HashMap Text Text))
-> (StreamKeySummary
    -> Maybe (HashMap Text Text) -> StreamKeySummary)
-> Lens
     StreamKeySummary
     StreamKeySummary
     (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 (\StreamKeySummary' {Maybe (HashMap Text Text)
tags :: Maybe (HashMap Text Text)
$sel:tags:StreamKeySummary' :: StreamKeySummary -> Maybe (HashMap Text Text)
tags} -> Maybe (HashMap Text Text)
tags) (\s :: StreamKeySummary
s@StreamKeySummary' {} Maybe (HashMap Text Text)
a -> StreamKeySummary
s {$sel:tags:StreamKeySummary' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
a} :: StreamKeySummary) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
 -> StreamKeySummary -> f StreamKeySummary)
-> ((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)))
-> StreamKeySummary
-> f StreamKeySummary
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

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

instance Prelude.Hashable StreamKeySummary

instance Prelude.NFData StreamKeySummary