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

import qualified Amazonka.Core as Core
import Amazonka.ELBV2.Types.Cipher
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

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

-- |
-- Create a value of 'SslPolicy' 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:
--
-- 'supportedLoadBalancerTypes', 'sslPolicy_supportedLoadBalancerTypes' - The supported load balancers.
--
-- 'ciphers', 'sslPolicy_ciphers' - The ciphers.
--
-- 'name', 'sslPolicy_name' - The name of the policy.
--
-- 'sslProtocols', 'sslPolicy_sslProtocols' - The protocols.
newSslPolicy ::
  SslPolicy
newSslPolicy :: SslPolicy
newSslPolicy =
  SslPolicy' :: Maybe [Text]
-> Maybe [Cipher] -> Maybe Text -> Maybe [Text] -> SslPolicy
SslPolicy'
    { $sel:supportedLoadBalancerTypes:SslPolicy' :: Maybe [Text]
supportedLoadBalancerTypes =
        Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:ciphers:SslPolicy' :: Maybe [Cipher]
ciphers = Maybe [Cipher]
forall a. Maybe a
Prelude.Nothing,
      $sel:name:SslPolicy' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:sslProtocols:SslPolicy' :: Maybe [Text]
sslProtocols = Maybe [Text]
forall a. Maybe a
Prelude.Nothing
    }

-- | The supported load balancers.
sslPolicy_supportedLoadBalancerTypes :: Lens.Lens' SslPolicy (Prelude.Maybe [Prelude.Text])
sslPolicy_supportedLoadBalancerTypes :: (Maybe [Text] -> f (Maybe [Text])) -> SslPolicy -> f SslPolicy
sslPolicy_supportedLoadBalancerTypes = (SslPolicy -> Maybe [Text])
-> (SslPolicy -> Maybe [Text] -> SslPolicy)
-> Lens SslPolicy SslPolicy (Maybe [Text]) (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SslPolicy' {Maybe [Text]
supportedLoadBalancerTypes :: Maybe [Text]
$sel:supportedLoadBalancerTypes:SslPolicy' :: SslPolicy -> Maybe [Text]
supportedLoadBalancerTypes} -> Maybe [Text]
supportedLoadBalancerTypes) (\s :: SslPolicy
s@SslPolicy' {} Maybe [Text]
a -> SslPolicy
s {$sel:supportedLoadBalancerTypes:SslPolicy' :: Maybe [Text]
supportedLoadBalancerTypes = Maybe [Text]
a} :: SslPolicy) ((Maybe [Text] -> f (Maybe [Text])) -> SslPolicy -> f SslPolicy)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> SslPolicy
-> f SslPolicy
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [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 [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The ciphers.
sslPolicy_ciphers :: Lens.Lens' SslPolicy (Prelude.Maybe [Cipher])
sslPolicy_ciphers :: (Maybe [Cipher] -> f (Maybe [Cipher])) -> SslPolicy -> f SslPolicy
sslPolicy_ciphers = (SslPolicy -> Maybe [Cipher])
-> (SslPolicy -> Maybe [Cipher] -> SslPolicy)
-> Lens SslPolicy SslPolicy (Maybe [Cipher]) (Maybe [Cipher])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SslPolicy' {Maybe [Cipher]
ciphers :: Maybe [Cipher]
$sel:ciphers:SslPolicy' :: SslPolicy -> Maybe [Cipher]
ciphers} -> Maybe [Cipher]
ciphers) (\s :: SslPolicy
s@SslPolicy' {} Maybe [Cipher]
a -> SslPolicy
s {$sel:ciphers:SslPolicy' :: Maybe [Cipher]
ciphers = Maybe [Cipher]
a} :: SslPolicy) ((Maybe [Cipher] -> f (Maybe [Cipher]))
 -> SslPolicy -> f SslPolicy)
-> ((Maybe [Cipher] -> f (Maybe [Cipher]))
    -> Maybe [Cipher] -> f (Maybe [Cipher]))
-> (Maybe [Cipher] -> f (Maybe [Cipher]))
-> SslPolicy
-> f SslPolicy
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Cipher] [Cipher] [Cipher] [Cipher]
-> Iso
     (Maybe [Cipher]) (Maybe [Cipher]) (Maybe [Cipher]) (Maybe [Cipher])
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 [Cipher] [Cipher] [Cipher] [Cipher]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

-- | The protocols.
sslPolicy_sslProtocols :: Lens.Lens' SslPolicy (Prelude.Maybe [Prelude.Text])
sslPolicy_sslProtocols :: (Maybe [Text] -> f (Maybe [Text])) -> SslPolicy -> f SslPolicy
sslPolicy_sslProtocols = (SslPolicy -> Maybe [Text])
-> (SslPolicy -> Maybe [Text] -> SslPolicy)
-> Lens SslPolicy SslPolicy (Maybe [Text]) (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SslPolicy' {Maybe [Text]
sslProtocols :: Maybe [Text]
$sel:sslProtocols:SslPolicy' :: SslPolicy -> Maybe [Text]
sslProtocols} -> Maybe [Text]
sslProtocols) (\s :: SslPolicy
s@SslPolicy' {} Maybe [Text]
a -> SslPolicy
s {$sel:sslProtocols:SslPolicy' :: Maybe [Text]
sslProtocols = Maybe [Text]
a} :: SslPolicy) ((Maybe [Text] -> f (Maybe [Text])) -> SslPolicy -> f SslPolicy)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> SslPolicy
-> f SslPolicy
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [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 [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.FromXML SslPolicy where
  parseXML :: [Node] -> Either String SslPolicy
parseXML [Node]
x =
    Maybe [Text]
-> Maybe [Cipher] -> Maybe Text -> Maybe [Text] -> SslPolicy
SslPolicy'
      (Maybe [Text]
 -> Maybe [Cipher] -> Maybe Text -> Maybe [Text] -> SslPolicy)
-> Either String (Maybe [Text])
-> Either
     String (Maybe [Cipher] -> Maybe Text -> Maybe [Text] -> SslPolicy)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( [Node]
x [Node] -> Text -> Either String (Maybe [Node])
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"SupportedLoadBalancerTypes"
                      Either String (Maybe [Node]) -> [Node] -> Either String [Node]
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ [Node]
forall a. Monoid a => a
Prelude.mempty
                      Either String [Node]
-> ([Node] -> Either String (Maybe [Text]))
-> Either String (Maybe [Text])
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= ([Node] -> Either String [Text])
-> [Node] -> Either String (Maybe [Text])
forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (Text -> [Node] -> Either String [Text]
forall a. FromXML a => Text -> [Node] -> Either String [a]
Core.parseXMLList Text
"member")
                  )
      Either
  String (Maybe [Cipher] -> Maybe Text -> Maybe [Text] -> SslPolicy)
-> Either String (Maybe [Cipher])
-> Either String (Maybe Text -> Maybe [Text] -> SslPolicy)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( [Node]
x [Node] -> Text -> Either String (Maybe [Node])
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"Ciphers" Either String (Maybe [Node]) -> [Node] -> Either String [Node]
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ [Node]
forall a. Monoid a => a
Prelude.mempty
                      Either String [Node]
-> ([Node] -> Either String (Maybe [Cipher]))
-> Either String (Maybe [Cipher])
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= ([Node] -> Either String [Cipher])
-> [Node] -> Either String (Maybe [Cipher])
forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (Text -> [Node] -> Either String [Cipher]
forall a. FromXML a => Text -> [Node] -> Either String [a]
Core.parseXMLList Text
"member")
                  )
      Either String (Maybe Text -> Maybe [Text] -> SslPolicy)
-> Either String (Maybe Text)
-> Either String (Maybe [Text] -> SslPolicy)
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")
      Either String (Maybe [Text] -> SslPolicy)
-> Either String (Maybe [Text]) -> Either String SslPolicy
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( [Node]
x [Node] -> Text -> Either String (Maybe [Node])
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"SslProtocols" Either String (Maybe [Node]) -> [Node] -> Either String [Node]
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ [Node]
forall a. Monoid a => a
Prelude.mempty
                      Either String [Node]
-> ([Node] -> Either String (Maybe [Text]))
-> Either String (Maybe [Text])
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= ([Node] -> Either String [Text])
-> [Node] -> Either String (Maybe [Text])
forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (Text -> [Node] -> Either String [Text]
forall a. FromXML a => Text -> [Node] -> Either String [a]
Core.parseXMLList Text
"member")
                  )

instance Prelude.Hashable SslPolicy

instance Prelude.NFData SslPolicy