{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.ELBV2.Types.Cipher 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

-- | Information about a cipher used in a policy.
--
-- /See:/ 'newCipher' smart constructor.
data Cipher = Cipher'
  { -- | The name of the cipher.
    Cipher -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The priority of the cipher.
    Cipher -> Maybe Int
priority :: Prelude.Maybe Prelude.Int
  }
  deriving (Cipher -> Cipher -> Bool
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]
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
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. 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:
--
-- 'name', 'cipher_name' - The name of the cipher.
--
-- 'priority', 'cipher_priority' - The priority of the cipher.
newCipher ::
  Cipher
newCipher :: Cipher
newCipher =
  Cipher'
    { $sel:name:Cipher' :: Maybe Text
name = forall a. Maybe a
Prelude.Nothing,
      $sel:priority:Cipher' :: Maybe Int
priority = forall a. Maybe a
Prelude.Nothing
    }

-- | The name of the cipher.
cipher_name :: Lens.Lens' Cipher (Prelude.Maybe Prelude.Text)
cipher_name :: Lens' Cipher (Maybe Text)
cipher_name = 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)

-- | The priority of the cipher.
cipher_priority :: Lens.Lens' Cipher (Prelude.Maybe Prelude.Int)
cipher_priority :: Lens' Cipher (Maybe Int)
cipher_priority = 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)

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

instance Prelude.Hashable Cipher where
  hashWithSalt :: Int -> Cipher -> Int
hashWithSalt Int
_salt Cipher' {Maybe Int
Maybe Text
priority :: Maybe Int
name :: Maybe Text
$sel:priority:Cipher' :: Cipher -> Maybe Int
$sel:name:Cipher' :: Cipher -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
priority

instance Prelude.NFData Cipher where
  rnf :: Cipher -> ()
rnf Cipher' {Maybe Int
Maybe Text
priority :: Maybe Int
name :: Maybe Text
$sel:priority:Cipher' :: Cipher -> Maybe Int
$sel:name:Cipher' :: Cipher -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
name seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
priority