{-# 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.Kafka.Types.Serverless
-- 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.Kafka.Types.Serverless where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.Kafka.Types.ServerlessClientAuthentication
import Amazonka.Kafka.Types.VpcConfig
import qualified Amazonka.Prelude as Prelude

-- | Serverless cluster.
--
-- /See:/ 'newServerless' smart constructor.
data Serverless = Serverless'
  { -- | Includes all client authentication information.
    Serverless -> Maybe ServerlessClientAuthentication
clientAuthentication :: Prelude.Maybe ServerlessClientAuthentication,
    -- | The configuration of the Amazon VPCs for the cluster.
    Serverless -> [VpcConfig]
vpcConfigs :: [VpcConfig]
  }
  deriving (Serverless -> Serverless -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Serverless -> Serverless -> Bool
$c/= :: Serverless -> Serverless -> Bool
== :: Serverless -> Serverless -> Bool
$c== :: Serverless -> Serverless -> Bool
Prelude.Eq, ReadPrec [Serverless]
ReadPrec Serverless
Int -> ReadS Serverless
ReadS [Serverless]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Serverless]
$creadListPrec :: ReadPrec [Serverless]
readPrec :: ReadPrec Serverless
$creadPrec :: ReadPrec Serverless
readList :: ReadS [Serverless]
$creadList :: ReadS [Serverless]
readsPrec :: Int -> ReadS Serverless
$creadsPrec :: Int -> ReadS Serverless
Prelude.Read, Int -> Serverless -> ShowS
[Serverless] -> ShowS
Serverless -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Serverless] -> ShowS
$cshowList :: [Serverless] -> ShowS
show :: Serverless -> String
$cshow :: Serverless -> String
showsPrec :: Int -> Serverless -> ShowS
$cshowsPrec :: Int -> Serverless -> ShowS
Prelude.Show, forall x. Rep Serverless x -> Serverless
forall x. Serverless -> Rep Serverless x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Serverless x -> Serverless
$cfrom :: forall x. Serverless -> Rep Serverless x
Prelude.Generic)

-- |
-- Create a value of 'Serverless' 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:
--
-- 'clientAuthentication', 'serverless_clientAuthentication' - Includes all client authentication information.
--
-- 'vpcConfigs', 'serverless_vpcConfigs' - The configuration of the Amazon VPCs for the cluster.
newServerless ::
  Serverless
newServerless :: Serverless
newServerless =
  Serverless'
    { $sel:clientAuthentication:Serverless' :: Maybe ServerlessClientAuthentication
clientAuthentication = forall a. Maybe a
Prelude.Nothing,
      $sel:vpcConfigs:Serverless' :: [VpcConfig]
vpcConfigs = forall a. Monoid a => a
Prelude.mempty
    }

-- | Includes all client authentication information.
serverless_clientAuthentication :: Lens.Lens' Serverless (Prelude.Maybe ServerlessClientAuthentication)
serverless_clientAuthentication :: Lens' Serverless (Maybe ServerlessClientAuthentication)
serverless_clientAuthentication = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Serverless' {Maybe ServerlessClientAuthentication
clientAuthentication :: Maybe ServerlessClientAuthentication
$sel:clientAuthentication:Serverless' :: Serverless -> Maybe ServerlessClientAuthentication
clientAuthentication} -> Maybe ServerlessClientAuthentication
clientAuthentication) (\s :: Serverless
s@Serverless' {} Maybe ServerlessClientAuthentication
a -> Serverless
s {$sel:clientAuthentication:Serverless' :: Maybe ServerlessClientAuthentication
clientAuthentication = Maybe ServerlessClientAuthentication
a} :: Serverless)

-- | The configuration of the Amazon VPCs for the cluster.
serverless_vpcConfigs :: Lens.Lens' Serverless [VpcConfig]
serverless_vpcConfigs :: Lens' Serverless [VpcConfig]
serverless_vpcConfigs = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Serverless' {[VpcConfig]
vpcConfigs :: [VpcConfig]
$sel:vpcConfigs:Serverless' :: Serverless -> [VpcConfig]
vpcConfigs} -> [VpcConfig]
vpcConfigs) (\s :: Serverless
s@Serverless' {} [VpcConfig]
a -> Serverless
s {$sel:vpcConfigs:Serverless' :: [VpcConfig]
vpcConfigs = [VpcConfig]
a} :: Serverless) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Data.FromJSON Serverless where
  parseJSON :: Value -> Parser Serverless
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"Serverless"
      ( \Object
x ->
          Maybe ServerlessClientAuthentication -> [VpcConfig] -> Serverless
Serverless'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"clientAuthentication")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"vpcConfigs" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
      )

instance Prelude.Hashable Serverless where
  hashWithSalt :: Int -> Serverless -> Int
hashWithSalt Int
_salt Serverless' {[VpcConfig]
Maybe ServerlessClientAuthentication
vpcConfigs :: [VpcConfig]
clientAuthentication :: Maybe ServerlessClientAuthentication
$sel:vpcConfigs:Serverless' :: Serverless -> [VpcConfig]
$sel:clientAuthentication:Serverless' :: Serverless -> Maybe ServerlessClientAuthentication
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ServerlessClientAuthentication
clientAuthentication
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` [VpcConfig]
vpcConfigs

instance Prelude.NFData Serverless where
  rnf :: Serverless -> ()
rnf Serverless' {[VpcConfig]
Maybe ServerlessClientAuthentication
vpcConfigs :: [VpcConfig]
clientAuthentication :: Maybe ServerlessClientAuthentication
$sel:vpcConfigs:Serverless' :: Serverless -> [VpcConfig]
$sel:clientAuthentication:Serverless' :: Serverless -> Maybe ServerlessClientAuthentication
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe ServerlessClientAuthentication
clientAuthentication
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf [VpcConfig]
vpcConfigs