{-# 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.MGN.Types.Licensing
-- 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.MGN.Types.Licensing 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

-- | Configure Licensing.
--
-- /See:/ 'newLicensing' smart constructor.
data Licensing = Licensing'
  { -- | Configure BYOL OS licensing.
    Licensing -> Maybe Bool
osByol :: Prelude.Maybe Prelude.Bool
  }
  deriving (Licensing -> Licensing -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Licensing -> Licensing -> Bool
$c/= :: Licensing -> Licensing -> Bool
== :: Licensing -> Licensing -> Bool
$c== :: Licensing -> Licensing -> Bool
Prelude.Eq, ReadPrec [Licensing]
ReadPrec Licensing
Int -> ReadS Licensing
ReadS [Licensing]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Licensing]
$creadListPrec :: ReadPrec [Licensing]
readPrec :: ReadPrec Licensing
$creadPrec :: ReadPrec Licensing
readList :: ReadS [Licensing]
$creadList :: ReadS [Licensing]
readsPrec :: Int -> ReadS Licensing
$creadsPrec :: Int -> ReadS Licensing
Prelude.Read, Int -> Licensing -> ShowS
[Licensing] -> ShowS
Licensing -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Licensing] -> ShowS
$cshowList :: [Licensing] -> ShowS
show :: Licensing -> String
$cshow :: Licensing -> String
showsPrec :: Int -> Licensing -> ShowS
$cshowsPrec :: Int -> Licensing -> ShowS
Prelude.Show, forall x. Rep Licensing x -> Licensing
forall x. Licensing -> Rep Licensing x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Licensing x -> Licensing
$cfrom :: forall x. Licensing -> Rep Licensing x
Prelude.Generic)

-- |
-- Create a value of 'Licensing' 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:
--
-- 'osByol', 'licensing_osByol' - Configure BYOL OS licensing.
newLicensing ::
  Licensing
newLicensing :: Licensing
newLicensing = Licensing' {$sel:osByol:Licensing' :: Maybe Bool
osByol = forall a. Maybe a
Prelude.Nothing}

-- | Configure BYOL OS licensing.
licensing_osByol :: Lens.Lens' Licensing (Prelude.Maybe Prelude.Bool)
licensing_osByol :: Lens' Licensing (Maybe Bool)
licensing_osByol = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Licensing' {Maybe Bool
osByol :: Maybe Bool
$sel:osByol:Licensing' :: Licensing -> Maybe Bool
osByol} -> Maybe Bool
osByol) (\s :: Licensing
s@Licensing' {} Maybe Bool
a -> Licensing
s {$sel:osByol:Licensing' :: Maybe Bool
osByol = Maybe Bool
a} :: Licensing)

instance Data.FromJSON Licensing where
  parseJSON :: Value -> Parser Licensing
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"Licensing"
      (\Object
x -> Maybe Bool -> Licensing
Licensing' 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
"osByol"))

instance Prelude.Hashable Licensing where
  hashWithSalt :: Int -> Licensing -> Int
hashWithSalt Int
_salt Licensing' {Maybe Bool
osByol :: Maybe Bool
$sel:osByol:Licensing' :: Licensing -> Maybe Bool
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
osByol

instance Prelude.NFData Licensing where
  rnf :: Licensing -> ()
rnf Licensing' {Maybe Bool
osByol :: Maybe Bool
$sel:osByol:Licensing' :: Licensing -> Maybe Bool
..} = forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
osByol

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