{-# 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.EC2.Types.DhcpOptions
-- 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.EC2.Types.DhcpOptions where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.EC2.Internal
import Amazonka.EC2.Types.DhcpConfiguration
import Amazonka.EC2.Types.Tag
import qualified Amazonka.Prelude as Prelude

-- | Describes a set of DHCP options.
--
-- /See:/ 'newDhcpOptions' smart constructor.
data DhcpOptions = DhcpOptions'
  { -- | One or more DHCP options in the set.
    DhcpOptions -> Maybe [DhcpConfiguration]
dhcpConfigurations :: Prelude.Maybe [DhcpConfiguration],
    -- | The ID of the set of DHCP options.
    DhcpOptions -> Maybe Text
dhcpOptionsId :: Prelude.Maybe Prelude.Text,
    -- | The ID of the Amazon Web Services account that owns the DHCP options
    -- set.
    DhcpOptions -> Maybe Text
ownerId :: Prelude.Maybe Prelude.Text,
    -- | Any tags assigned to the DHCP options set.
    DhcpOptions -> Maybe [Tag]
tags :: Prelude.Maybe [Tag]
  }
  deriving (DhcpOptions -> DhcpOptions -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DhcpOptions -> DhcpOptions -> Bool
$c/= :: DhcpOptions -> DhcpOptions -> Bool
== :: DhcpOptions -> DhcpOptions -> Bool
$c== :: DhcpOptions -> DhcpOptions -> Bool
Prelude.Eq, ReadPrec [DhcpOptions]
ReadPrec DhcpOptions
Int -> ReadS DhcpOptions
ReadS [DhcpOptions]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DhcpOptions]
$creadListPrec :: ReadPrec [DhcpOptions]
readPrec :: ReadPrec DhcpOptions
$creadPrec :: ReadPrec DhcpOptions
readList :: ReadS [DhcpOptions]
$creadList :: ReadS [DhcpOptions]
readsPrec :: Int -> ReadS DhcpOptions
$creadsPrec :: Int -> ReadS DhcpOptions
Prelude.Read, Int -> DhcpOptions -> ShowS
[DhcpOptions] -> ShowS
DhcpOptions -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DhcpOptions] -> ShowS
$cshowList :: [DhcpOptions] -> ShowS
show :: DhcpOptions -> String
$cshow :: DhcpOptions -> String
showsPrec :: Int -> DhcpOptions -> ShowS
$cshowsPrec :: Int -> DhcpOptions -> ShowS
Prelude.Show, forall x. Rep DhcpOptions x -> DhcpOptions
forall x. DhcpOptions -> Rep DhcpOptions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DhcpOptions x -> DhcpOptions
$cfrom :: forall x. DhcpOptions -> Rep DhcpOptions x
Prelude.Generic)

-- |
-- Create a value of 'DhcpOptions' 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:
--
-- 'dhcpConfigurations', 'dhcpOptions_dhcpConfigurations' - One or more DHCP options in the set.
--
-- 'dhcpOptionsId', 'dhcpOptions_dhcpOptionsId' - The ID of the set of DHCP options.
--
-- 'ownerId', 'dhcpOptions_ownerId' - The ID of the Amazon Web Services account that owns the DHCP options
-- set.
--
-- 'tags', 'dhcpOptions_tags' - Any tags assigned to the DHCP options set.
newDhcpOptions ::
  DhcpOptions
newDhcpOptions :: DhcpOptions
newDhcpOptions =
  DhcpOptions'
    { $sel:dhcpConfigurations:DhcpOptions' :: Maybe [DhcpConfiguration]
dhcpConfigurations = forall a. Maybe a
Prelude.Nothing,
      $sel:dhcpOptionsId:DhcpOptions' :: Maybe Text
dhcpOptionsId = forall a. Maybe a
Prelude.Nothing,
      $sel:ownerId:DhcpOptions' :: Maybe Text
ownerId = forall a. Maybe a
Prelude.Nothing,
      $sel:tags:DhcpOptions' :: Maybe [Tag]
tags = forall a. Maybe a
Prelude.Nothing
    }

-- | One or more DHCP options in the set.
dhcpOptions_dhcpConfigurations :: Lens.Lens' DhcpOptions (Prelude.Maybe [DhcpConfiguration])
dhcpOptions_dhcpConfigurations :: Lens' DhcpOptions (Maybe [DhcpConfiguration])
dhcpOptions_dhcpConfigurations = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DhcpOptions' {Maybe [DhcpConfiguration]
dhcpConfigurations :: Maybe [DhcpConfiguration]
$sel:dhcpConfigurations:DhcpOptions' :: DhcpOptions -> Maybe [DhcpConfiguration]
dhcpConfigurations} -> Maybe [DhcpConfiguration]
dhcpConfigurations) (\s :: DhcpOptions
s@DhcpOptions' {} Maybe [DhcpConfiguration]
a -> DhcpOptions
s {$sel:dhcpConfigurations:DhcpOptions' :: Maybe [DhcpConfiguration]
dhcpConfigurations = Maybe [DhcpConfiguration]
a} :: DhcpOptions) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The ID of the set of DHCP options.
dhcpOptions_dhcpOptionsId :: Lens.Lens' DhcpOptions (Prelude.Maybe Prelude.Text)
dhcpOptions_dhcpOptionsId :: Lens' DhcpOptions (Maybe Text)
dhcpOptions_dhcpOptionsId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DhcpOptions' {Maybe Text
dhcpOptionsId :: Maybe Text
$sel:dhcpOptionsId:DhcpOptions' :: DhcpOptions -> Maybe Text
dhcpOptionsId} -> Maybe Text
dhcpOptionsId) (\s :: DhcpOptions
s@DhcpOptions' {} Maybe Text
a -> DhcpOptions
s {$sel:dhcpOptionsId:DhcpOptions' :: Maybe Text
dhcpOptionsId = Maybe Text
a} :: DhcpOptions)

-- | The ID of the Amazon Web Services account that owns the DHCP options
-- set.
dhcpOptions_ownerId :: Lens.Lens' DhcpOptions (Prelude.Maybe Prelude.Text)
dhcpOptions_ownerId :: Lens' DhcpOptions (Maybe Text)
dhcpOptions_ownerId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DhcpOptions' {Maybe Text
ownerId :: Maybe Text
$sel:ownerId:DhcpOptions' :: DhcpOptions -> Maybe Text
ownerId} -> Maybe Text
ownerId) (\s :: DhcpOptions
s@DhcpOptions' {} Maybe Text
a -> DhcpOptions
s {$sel:ownerId:DhcpOptions' :: Maybe Text
ownerId = Maybe Text
a} :: DhcpOptions)

-- | Any tags assigned to the DHCP options set.
dhcpOptions_tags :: Lens.Lens' DhcpOptions (Prelude.Maybe [Tag])
dhcpOptions_tags :: Lens' DhcpOptions (Maybe [Tag])
dhcpOptions_tags = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DhcpOptions' {Maybe [Tag]
tags :: Maybe [Tag]
$sel:tags:DhcpOptions' :: DhcpOptions -> Maybe [Tag]
tags} -> Maybe [Tag]
tags) (\s :: DhcpOptions
s@DhcpOptions' {} Maybe [Tag]
a -> DhcpOptions
s {$sel:tags:DhcpOptions' :: Maybe [Tag]
tags = Maybe [Tag]
a} :: DhcpOptions) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Data.FromXML DhcpOptions where
  parseXML :: [Node] -> Either String DhcpOptions
parseXML [Node]
x =
    Maybe [DhcpConfiguration]
-> Maybe Text -> Maybe Text -> Maybe [Tag] -> DhcpOptions
DhcpOptions'
      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
"dhcpConfigurationSet"
                      forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty
                      forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (forall a. FromXML a => Text -> [Node] -> Either String [a]
Data.parseXMLList Text
"item")
                  )
      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
"dhcpOptionsId")
      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
"ownerId")
      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
"tagSet"
                      forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty
                      forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (forall a. FromXML a => Text -> [Node] -> Either String [a]
Data.parseXMLList Text
"item")
                  )

instance Prelude.Hashable DhcpOptions where
  hashWithSalt :: Int -> DhcpOptions -> Int
hashWithSalt Int
_salt DhcpOptions' {Maybe [DhcpConfiguration]
Maybe [Tag]
Maybe Text
tags :: Maybe [Tag]
ownerId :: Maybe Text
dhcpOptionsId :: Maybe Text
dhcpConfigurations :: Maybe [DhcpConfiguration]
$sel:tags:DhcpOptions' :: DhcpOptions -> Maybe [Tag]
$sel:ownerId:DhcpOptions' :: DhcpOptions -> Maybe Text
$sel:dhcpOptionsId:DhcpOptions' :: DhcpOptions -> Maybe Text
$sel:dhcpConfigurations:DhcpOptions' :: DhcpOptions -> Maybe [DhcpConfiguration]
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [DhcpConfiguration]
dhcpConfigurations
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
dhcpOptionsId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
ownerId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Tag]
tags

instance Prelude.NFData DhcpOptions where
  rnf :: DhcpOptions -> ()
rnf DhcpOptions' {Maybe [DhcpConfiguration]
Maybe [Tag]
Maybe Text
tags :: Maybe [Tag]
ownerId :: Maybe Text
dhcpOptionsId :: Maybe Text
dhcpConfigurations :: Maybe [DhcpConfiguration]
$sel:tags:DhcpOptions' :: DhcpOptions -> Maybe [Tag]
$sel:ownerId:DhcpOptions' :: DhcpOptions -> Maybe Text
$sel:dhcpOptionsId:DhcpOptions' :: DhcpOptions -> Maybe Text
$sel:dhcpConfigurations:DhcpOptions' :: DhcpOptions -> Maybe [DhcpConfiguration]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [DhcpConfiguration]
dhcpConfigurations
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
dhcpOptionsId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
ownerId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Tag]
tags