{-# 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.ELBV2.Types.Cipher
-- 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.ELBV2.Types.Cipher where

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

-- | Information about a cipher used in a policy.
--
-- /See:/ 'newCipher' smart constructor.
data Cipher = Cipher'
  { -- | The priority of the cipher.
    Cipher -> Maybe Int
priority :: Prelude.Maybe Prelude.Int,
    -- | The name of the cipher.
    Cipher -> Maybe Text
name :: Prelude.Maybe Prelude.Text
  }
  deriving (Cipher -> Cipher -> Bool
(Cipher -> Cipher -> Bool)
-> (Cipher -> Cipher -> Bool) -> Eq Cipher
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Cipher -> Cipher -> Bool
$c/= :: Cipher -> Cipher -> Bool
== :: Cipher -> Cipher -> Bool
$c== :: Cipher -> Cipher -> Bool
Prelude.Eq, ReadPrec [Cipher]
ReadPrec Cipher
Int -> ReadS Cipher
ReadS [Cipher]
(Int -> ReadS Cipher)
-> ReadS [Cipher]
-> ReadPrec Cipher
-> ReadPrec [Cipher]
-> Read Cipher
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Cipher]
$creadListPrec :: ReadPrec [Cipher]
readPrec :: ReadPrec Cipher
$creadPrec :: ReadPrec Cipher
readList :: ReadS [Cipher]
$creadList :: ReadS [Cipher]
readsPrec :: Int -> ReadS Cipher
$creadsPrec :: Int -> ReadS Cipher
Prelude.Read, Int -> Cipher -> ShowS
[Cipher] -> ShowS
Cipher -> String
(Int -> Cipher -> ShowS)
-> (Cipher -> String) -> ([Cipher] -> ShowS) -> Show Cipher
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Cipher] -> ShowS
$cshowList :: [Cipher] -> ShowS
show :: Cipher -> String
$cshow :: Cipher -> String
showsPrec :: Int -> Cipher -> ShowS
$cshowsPrec :: Int -> Cipher -> ShowS
Prelude.Show, (forall x. Cipher -> Rep Cipher x)
-> (forall x. Rep Cipher x -> Cipher) -> Generic Cipher
forall x. Rep Cipher x -> Cipher
forall x. Cipher -> Rep Cipher x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Cipher x -> Cipher
$cfrom :: forall x. Cipher -> Rep Cipher x
Prelude.Generic)

-- |
-- Create a value of 'Cipher' 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:
--
-- 'priority', 'cipher_priority' - The priority of the cipher.
--
-- 'name', 'cipher_name' - The name of the cipher.
newCipher ::
  Cipher
newCipher :: Cipher
newCipher =
  Cipher' :: Maybe Int -> Maybe Text -> Cipher
Cipher'
    { $sel:priority:Cipher' :: Maybe Int
priority = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:name:Cipher' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The priority of the cipher.
cipher_priority :: Lens.Lens' Cipher (Prelude.Maybe Prelude.Int)
cipher_priority :: (Maybe Int -> f (Maybe Int)) -> Cipher -> f Cipher
cipher_priority = (Cipher -> Maybe Int)
-> (Cipher -> Maybe Int -> Cipher)
-> Lens Cipher Cipher (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Cipher' {Maybe Int
priority :: Maybe Int
$sel:priority:Cipher' :: Cipher -> Maybe Int
priority} -> Maybe Int
priority) (\s :: Cipher
s@Cipher' {} Maybe Int
a -> Cipher
s {$sel:priority:Cipher' :: Maybe Int
priority = Maybe Int
a} :: Cipher)

-- | The name of the cipher.
cipher_name :: Lens.Lens' Cipher (Prelude.Maybe Prelude.Text)
cipher_name :: (Maybe Text -> f (Maybe Text)) -> Cipher -> f Cipher
cipher_name = (Cipher -> Maybe Text)
-> (Cipher -> Maybe Text -> Cipher)
-> Lens Cipher Cipher (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Cipher' {Maybe Text
name :: Maybe Text
$sel:name:Cipher' :: Cipher -> Maybe Text
name} -> Maybe Text
name) (\s :: Cipher
s@Cipher' {} Maybe Text
a -> Cipher
s {$sel:name:Cipher' :: Maybe Text
name = Maybe Text
a} :: Cipher)

instance Core.FromXML Cipher where
  parseXML :: [Node] -> Either String Cipher
parseXML [Node]
x =
    Maybe Int -> Maybe Text -> Cipher
Cipher'
      (Maybe Int -> Maybe Text -> Cipher)
-> Either String (Maybe Int)
-> Either String (Maybe Text -> Cipher)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String (Maybe Int)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"Priority")
      Either String (Maybe Text -> Cipher)
-> Either String (Maybe Text) -> Either String Cipher
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"Name")

instance Prelude.Hashable Cipher

instance Prelude.NFData Cipher