{-# 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.EKS.Types.KubernetesNetworkConfigRequest
-- 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.EKS.Types.KubernetesNetworkConfigRequest where

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

-- | The Kubernetes network configuration for the cluster.
--
-- /See:/ 'newKubernetesNetworkConfigRequest' smart constructor.
data KubernetesNetworkConfigRequest = KubernetesNetworkConfigRequest'
  { -- | The CIDR block to assign Kubernetes service IP addresses from. If you
    -- don\'t specify a block, Kubernetes assigns addresses from either the
    -- 10.100.0.0\/16 or 172.20.0.0\/16 CIDR blocks. We recommend that you
    -- specify a block that does not overlap with resources in other networks
    -- that are peered or connected to your VPC. The block must meet the
    -- following requirements:
    --
    -- -   Within one of the following private IP address blocks: 10.0.0.0\/8,
    --     172.16.0.0.0\/12, or 192.168.0.0\/16.
    --
    -- -   Doesn\'t overlap with any CIDR block assigned to the VPC that you
    --     selected for VPC.
    --
    -- -   Between \/24 and \/12.
    --
    -- You can only specify a custom CIDR block when you create a cluster and
    -- can\'t change this value once the cluster is created.
    KubernetesNetworkConfigRequest -> Maybe Text
serviceIpv4Cidr :: Prelude.Maybe Prelude.Text
  }
  deriving (KubernetesNetworkConfigRequest
-> KubernetesNetworkConfigRequest -> Bool
(KubernetesNetworkConfigRequest
 -> KubernetesNetworkConfigRequest -> Bool)
-> (KubernetesNetworkConfigRequest
    -> KubernetesNetworkConfigRequest -> Bool)
-> Eq KubernetesNetworkConfigRequest
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: KubernetesNetworkConfigRequest
-> KubernetesNetworkConfigRequest -> Bool
$c/= :: KubernetesNetworkConfigRequest
-> KubernetesNetworkConfigRequest -> Bool
== :: KubernetesNetworkConfigRequest
-> KubernetesNetworkConfigRequest -> Bool
$c== :: KubernetesNetworkConfigRequest
-> KubernetesNetworkConfigRequest -> Bool
Prelude.Eq, ReadPrec [KubernetesNetworkConfigRequest]
ReadPrec KubernetesNetworkConfigRequest
Int -> ReadS KubernetesNetworkConfigRequest
ReadS [KubernetesNetworkConfigRequest]
(Int -> ReadS KubernetesNetworkConfigRequest)
-> ReadS [KubernetesNetworkConfigRequest]
-> ReadPrec KubernetesNetworkConfigRequest
-> ReadPrec [KubernetesNetworkConfigRequest]
-> Read KubernetesNetworkConfigRequest
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [KubernetesNetworkConfigRequest]
$creadListPrec :: ReadPrec [KubernetesNetworkConfigRequest]
readPrec :: ReadPrec KubernetesNetworkConfigRequest
$creadPrec :: ReadPrec KubernetesNetworkConfigRequest
readList :: ReadS [KubernetesNetworkConfigRequest]
$creadList :: ReadS [KubernetesNetworkConfigRequest]
readsPrec :: Int -> ReadS KubernetesNetworkConfigRequest
$creadsPrec :: Int -> ReadS KubernetesNetworkConfigRequest
Prelude.Read, Int -> KubernetesNetworkConfigRequest -> ShowS
[KubernetesNetworkConfigRequest] -> ShowS
KubernetesNetworkConfigRequest -> String
(Int -> KubernetesNetworkConfigRequest -> ShowS)
-> (KubernetesNetworkConfigRequest -> String)
-> ([KubernetesNetworkConfigRequest] -> ShowS)
-> Show KubernetesNetworkConfigRequest
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [KubernetesNetworkConfigRequest] -> ShowS
$cshowList :: [KubernetesNetworkConfigRequest] -> ShowS
show :: KubernetesNetworkConfigRequest -> String
$cshow :: KubernetesNetworkConfigRequest -> String
showsPrec :: Int -> KubernetesNetworkConfigRequest -> ShowS
$cshowsPrec :: Int -> KubernetesNetworkConfigRequest -> ShowS
Prelude.Show, (forall x.
 KubernetesNetworkConfigRequest
 -> Rep KubernetesNetworkConfigRequest x)
-> (forall x.
    Rep KubernetesNetworkConfigRequest x
    -> KubernetesNetworkConfigRequest)
-> Generic KubernetesNetworkConfigRequest
forall x.
Rep KubernetesNetworkConfigRequest x
-> KubernetesNetworkConfigRequest
forall x.
KubernetesNetworkConfigRequest
-> Rep KubernetesNetworkConfigRequest x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep KubernetesNetworkConfigRequest x
-> KubernetesNetworkConfigRequest
$cfrom :: forall x.
KubernetesNetworkConfigRequest
-> Rep KubernetesNetworkConfigRequest x
Prelude.Generic)

-- |
-- Create a value of 'KubernetesNetworkConfigRequest' 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:
--
-- 'serviceIpv4Cidr', 'kubernetesNetworkConfigRequest_serviceIpv4Cidr' - The CIDR block to assign Kubernetes service IP addresses from. If you
-- don\'t specify a block, Kubernetes assigns addresses from either the
-- 10.100.0.0\/16 or 172.20.0.0\/16 CIDR blocks. We recommend that you
-- specify a block that does not overlap with resources in other networks
-- that are peered or connected to your VPC. The block must meet the
-- following requirements:
--
-- -   Within one of the following private IP address blocks: 10.0.0.0\/8,
--     172.16.0.0.0\/12, or 192.168.0.0\/16.
--
-- -   Doesn\'t overlap with any CIDR block assigned to the VPC that you
--     selected for VPC.
--
-- -   Between \/24 and \/12.
--
-- You can only specify a custom CIDR block when you create a cluster and
-- can\'t change this value once the cluster is created.
newKubernetesNetworkConfigRequest ::
  KubernetesNetworkConfigRequest
newKubernetesNetworkConfigRequest :: KubernetesNetworkConfigRequest
newKubernetesNetworkConfigRequest =
  KubernetesNetworkConfigRequest' :: Maybe Text -> KubernetesNetworkConfigRequest
KubernetesNetworkConfigRequest'
    { $sel:serviceIpv4Cidr:KubernetesNetworkConfigRequest' :: Maybe Text
serviceIpv4Cidr =
        Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The CIDR block to assign Kubernetes service IP addresses from. If you
-- don\'t specify a block, Kubernetes assigns addresses from either the
-- 10.100.0.0\/16 or 172.20.0.0\/16 CIDR blocks. We recommend that you
-- specify a block that does not overlap with resources in other networks
-- that are peered or connected to your VPC. The block must meet the
-- following requirements:
--
-- -   Within one of the following private IP address blocks: 10.0.0.0\/8,
--     172.16.0.0.0\/12, or 192.168.0.0\/16.
--
-- -   Doesn\'t overlap with any CIDR block assigned to the VPC that you
--     selected for VPC.
--
-- -   Between \/24 and \/12.
--
-- You can only specify a custom CIDR block when you create a cluster and
-- can\'t change this value once the cluster is created.
kubernetesNetworkConfigRequest_serviceIpv4Cidr :: Lens.Lens' KubernetesNetworkConfigRequest (Prelude.Maybe Prelude.Text)
kubernetesNetworkConfigRequest_serviceIpv4Cidr :: (Maybe Text -> f (Maybe Text))
-> KubernetesNetworkConfigRequest
-> f KubernetesNetworkConfigRequest
kubernetesNetworkConfigRequest_serviceIpv4Cidr = (KubernetesNetworkConfigRequest -> Maybe Text)
-> (KubernetesNetworkConfigRequest
    -> Maybe Text -> KubernetesNetworkConfigRequest)
-> Lens
     KubernetesNetworkConfigRequest
     KubernetesNetworkConfigRequest
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\KubernetesNetworkConfigRequest' {Maybe Text
serviceIpv4Cidr :: Maybe Text
$sel:serviceIpv4Cidr:KubernetesNetworkConfigRequest' :: KubernetesNetworkConfigRequest -> Maybe Text
serviceIpv4Cidr} -> Maybe Text
serviceIpv4Cidr) (\s :: KubernetesNetworkConfigRequest
s@KubernetesNetworkConfigRequest' {} Maybe Text
a -> KubernetesNetworkConfigRequest
s {$sel:serviceIpv4Cidr:KubernetesNetworkConfigRequest' :: Maybe Text
serviceIpv4Cidr = Maybe Text
a} :: KubernetesNetworkConfigRequest)

instance
  Prelude.Hashable
    KubernetesNetworkConfigRequest

instance
  Prelude.NFData
    KubernetesNetworkConfigRequest

instance Core.ToJSON KubernetesNetworkConfigRequest where
  toJSON :: KubernetesNetworkConfigRequest -> Value
toJSON KubernetesNetworkConfigRequest' {Maybe Text
serviceIpv4Cidr :: Maybe Text
$sel:serviceIpv4Cidr:KubernetesNetworkConfigRequest' :: KubernetesNetworkConfigRequest -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"serviceIpv4Cidr" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
serviceIpv4Cidr
          ]
      )