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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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
(Licensing -> Licensing -> Bool)
-> (Licensing -> Licensing -> Bool) -> Eq Licensing
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]
(Int -> ReadS Licensing)
-> ReadS [Licensing]
-> ReadPrec Licensing
-> ReadPrec [Licensing]
-> Read 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
(Int -> Licensing -> ShowS)
-> (Licensing -> String)
-> ([Licensing] -> ShowS)
-> Show Licensing
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. Licensing -> Rep Licensing x)
-> (forall x. Rep Licensing x -> Licensing) -> Generic Licensing
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' :: Maybe Bool -> Licensing
Licensing' {$sel:osByol:Licensing' :: Maybe Bool
osByol = Maybe Bool
forall a. Maybe a
Prelude.Nothing}

-- | Configure BYOL OS licensing.
licensing_osByol :: Lens.Lens' Licensing (Prelude.Maybe Prelude.Bool)
licensing_osByol :: (Maybe Bool -> f (Maybe Bool)) -> Licensing -> f Licensing
licensing_osByol = (Licensing -> Maybe Bool)
-> (Licensing -> Maybe Bool -> Licensing)
-> Lens Licensing Licensing (Maybe Bool) (Maybe Bool)
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 Core.FromJSON Licensing where
  parseJSON :: Value -> Parser Licensing
parseJSON =
    String -> (Object -> Parser Licensing) -> Value -> Parser Licensing
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"Licensing"
      (\Object
x -> Maybe Bool -> Licensing
Licensing' (Maybe Bool -> Licensing)
-> Parser (Maybe Bool) -> Parser Licensing
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"osByol"))

instance Prelude.Hashable Licensing

instance Prelude.NFData Licensing

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