{-# 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.PlaybackKeyPair
-- 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.PlaybackKeyPair where

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

-- | A key pair used to sign and validate a playback authorization token.
--
-- /See:/ 'newPlaybackKeyPair' smart constructor.
data PlaybackKeyPair = PlaybackKeyPair'
  { -- | Key-pair ARN.
    PlaybackKeyPair -> Maybe Text
arn :: Prelude.Maybe Prelude.Text,
    -- | Key-pair identifier.
    PlaybackKeyPair -> Maybe Text
fingerprint :: Prelude.Maybe Prelude.Text,
    -- | Playback-key-pair name. The value does not need to be unique.
    PlaybackKeyPair -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | Array of 1-50 maps, each of the form @string:string (key:value)@.
    PlaybackKeyPair -> Maybe (HashMap Text Text)
tags :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text)
  }
  deriving (PlaybackKeyPair -> PlaybackKeyPair -> Bool
(PlaybackKeyPair -> PlaybackKeyPair -> Bool)
-> (PlaybackKeyPair -> PlaybackKeyPair -> Bool)
-> Eq PlaybackKeyPair
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PlaybackKeyPair -> PlaybackKeyPair -> Bool
$c/= :: PlaybackKeyPair -> PlaybackKeyPair -> Bool
== :: PlaybackKeyPair -> PlaybackKeyPair -> Bool
$c== :: PlaybackKeyPair -> PlaybackKeyPair -> Bool
Prelude.Eq, ReadPrec [PlaybackKeyPair]
ReadPrec PlaybackKeyPair
Int -> ReadS PlaybackKeyPair
ReadS [PlaybackKeyPair]
(Int -> ReadS PlaybackKeyPair)
-> ReadS [PlaybackKeyPair]
-> ReadPrec PlaybackKeyPair
-> ReadPrec [PlaybackKeyPair]
-> Read PlaybackKeyPair
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PlaybackKeyPair]
$creadListPrec :: ReadPrec [PlaybackKeyPair]
readPrec :: ReadPrec PlaybackKeyPair
$creadPrec :: ReadPrec PlaybackKeyPair
readList :: ReadS [PlaybackKeyPair]
$creadList :: ReadS [PlaybackKeyPair]
readsPrec :: Int -> ReadS PlaybackKeyPair
$creadsPrec :: Int -> ReadS PlaybackKeyPair
Prelude.Read, Int -> PlaybackKeyPair -> ShowS
[PlaybackKeyPair] -> ShowS
PlaybackKeyPair -> String
(Int -> PlaybackKeyPair -> ShowS)
-> (PlaybackKeyPair -> String)
-> ([PlaybackKeyPair] -> ShowS)
-> Show PlaybackKeyPair
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PlaybackKeyPair] -> ShowS
$cshowList :: [PlaybackKeyPair] -> ShowS
show :: PlaybackKeyPair -> String
$cshow :: PlaybackKeyPair -> String
showsPrec :: Int -> PlaybackKeyPair -> ShowS
$cshowsPrec :: Int -> PlaybackKeyPair -> ShowS
Prelude.Show, (forall x. PlaybackKeyPair -> Rep PlaybackKeyPair x)
-> (forall x. Rep PlaybackKeyPair x -> PlaybackKeyPair)
-> Generic PlaybackKeyPair
forall x. Rep PlaybackKeyPair x -> PlaybackKeyPair
forall x. PlaybackKeyPair -> Rep PlaybackKeyPair x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PlaybackKeyPair x -> PlaybackKeyPair
$cfrom :: forall x. PlaybackKeyPair -> Rep PlaybackKeyPair x
Prelude.Generic)

-- |
-- Create a value of 'PlaybackKeyPair' 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', 'playbackKeyPair_arn' - Key-pair ARN.
--
-- 'fingerprint', 'playbackKeyPair_fingerprint' - Key-pair identifier.
--
-- 'name', 'playbackKeyPair_name' - Playback-key-pair name. The value does not need to be unique.
--
-- 'tags', 'playbackKeyPair_tags' - Array of 1-50 maps, each of the form @string:string (key:value)@.
newPlaybackKeyPair ::
  PlaybackKeyPair
newPlaybackKeyPair :: PlaybackKeyPair
newPlaybackKeyPair =
  PlaybackKeyPair' :: Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe (HashMap Text Text)
-> PlaybackKeyPair
PlaybackKeyPair'
    { $sel:arn:PlaybackKeyPair' :: Maybe Text
arn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:fingerprint:PlaybackKeyPair' :: Maybe Text
fingerprint = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:name:PlaybackKeyPair' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:tags:PlaybackKeyPair' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing
    }

-- | Key-pair ARN.
playbackKeyPair_arn :: Lens.Lens' PlaybackKeyPair (Prelude.Maybe Prelude.Text)
playbackKeyPair_arn :: (Maybe Text -> f (Maybe Text))
-> PlaybackKeyPair -> f PlaybackKeyPair
playbackKeyPair_arn = (PlaybackKeyPair -> Maybe Text)
-> (PlaybackKeyPair -> Maybe Text -> PlaybackKeyPair)
-> Lens PlaybackKeyPair PlaybackKeyPair (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PlaybackKeyPair' {Maybe Text
arn :: Maybe Text
$sel:arn:PlaybackKeyPair' :: PlaybackKeyPair -> Maybe Text
arn} -> Maybe Text
arn) (\s :: PlaybackKeyPair
s@PlaybackKeyPair' {} Maybe Text
a -> PlaybackKeyPair
s {$sel:arn:PlaybackKeyPair' :: Maybe Text
arn = Maybe Text
a} :: PlaybackKeyPair)

-- | Key-pair identifier.
playbackKeyPair_fingerprint :: Lens.Lens' PlaybackKeyPair (Prelude.Maybe Prelude.Text)
playbackKeyPair_fingerprint :: (Maybe Text -> f (Maybe Text))
-> PlaybackKeyPair -> f PlaybackKeyPair
playbackKeyPair_fingerprint = (PlaybackKeyPair -> Maybe Text)
-> (PlaybackKeyPair -> Maybe Text -> PlaybackKeyPair)
-> Lens PlaybackKeyPair PlaybackKeyPair (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PlaybackKeyPair' {Maybe Text
fingerprint :: Maybe Text
$sel:fingerprint:PlaybackKeyPair' :: PlaybackKeyPair -> Maybe Text
fingerprint} -> Maybe Text
fingerprint) (\s :: PlaybackKeyPair
s@PlaybackKeyPair' {} Maybe Text
a -> PlaybackKeyPair
s {$sel:fingerprint:PlaybackKeyPair' :: Maybe Text
fingerprint = Maybe Text
a} :: PlaybackKeyPair)

-- | Playback-key-pair name. The value does not need to be unique.
playbackKeyPair_name :: Lens.Lens' PlaybackKeyPair (Prelude.Maybe Prelude.Text)
playbackKeyPair_name :: (Maybe Text -> f (Maybe Text))
-> PlaybackKeyPair -> f PlaybackKeyPair
playbackKeyPair_name = (PlaybackKeyPair -> Maybe Text)
-> (PlaybackKeyPair -> Maybe Text -> PlaybackKeyPair)
-> Lens PlaybackKeyPair PlaybackKeyPair (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PlaybackKeyPair' {Maybe Text
name :: Maybe Text
$sel:name:PlaybackKeyPair' :: PlaybackKeyPair -> Maybe Text
name} -> Maybe Text
name) (\s :: PlaybackKeyPair
s@PlaybackKeyPair' {} Maybe Text
a -> PlaybackKeyPair
s {$sel:name:PlaybackKeyPair' :: Maybe Text
name = Maybe Text
a} :: PlaybackKeyPair)

-- | Array of 1-50 maps, each of the form @string:string (key:value)@.
playbackKeyPair_tags :: Lens.Lens' PlaybackKeyPair (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
playbackKeyPair_tags :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> PlaybackKeyPair -> f PlaybackKeyPair
playbackKeyPair_tags = (PlaybackKeyPair -> Maybe (HashMap Text Text))
-> (PlaybackKeyPair
    -> Maybe (HashMap Text Text) -> PlaybackKeyPair)
-> Lens
     PlaybackKeyPair
     PlaybackKeyPair
     (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 (\PlaybackKeyPair' {Maybe (HashMap Text Text)
tags :: Maybe (HashMap Text Text)
$sel:tags:PlaybackKeyPair' :: PlaybackKeyPair -> Maybe (HashMap Text Text)
tags} -> Maybe (HashMap Text Text)
tags) (\s :: PlaybackKeyPair
s@PlaybackKeyPair' {} Maybe (HashMap Text Text)
a -> PlaybackKeyPair
s {$sel:tags:PlaybackKeyPair' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
a} :: PlaybackKeyPair) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
 -> PlaybackKeyPair -> f PlaybackKeyPair)
-> ((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)))
-> PlaybackKeyPair
-> f PlaybackKeyPair
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 PlaybackKeyPair where
  parseJSON :: Value -> Parser PlaybackKeyPair
parseJSON =
    String
-> (Object -> Parser PlaybackKeyPair)
-> Value
-> Parser PlaybackKeyPair
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"PlaybackKeyPair"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe (HashMap Text Text)
-> PlaybackKeyPair
PlaybackKeyPair'
            (Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe (HashMap Text Text)
 -> PlaybackKeyPair)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text -> Maybe (HashMap Text Text) -> PlaybackKeyPair)
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 Text -> Maybe (HashMap Text Text) -> PlaybackKeyPair)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text -> Maybe (HashMap Text Text) -> PlaybackKeyPair)
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
"fingerprint")
            Parser (Maybe Text -> Maybe (HashMap Text Text) -> PlaybackKeyPair)
-> Parser (Maybe Text)
-> Parser (Maybe (HashMap Text Text) -> PlaybackKeyPair)
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
"name")
            Parser (Maybe (HashMap Text Text) -> PlaybackKeyPair)
-> Parser (Maybe (HashMap Text Text)) -> Parser PlaybackKeyPair
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 PlaybackKeyPair

instance Prelude.NFData PlaybackKeyPair