{-# 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.Lightsail.Types.AddOn
-- 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.Lightsail.Types.AddOn where

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

-- | Describes an add-on that is enabled for an Amazon Lightsail resource.
--
-- /See:/ 'newAddOn' smart constructor.
data AddOn = AddOn'
  { -- | The status of the add-on.
    AddOn -> Maybe Text
status :: Prelude.Maybe Prelude.Text,
    -- | The next daily time an automatic snapshot will be created.
    --
    -- The time shown is in @HH:00@ format, and in Coordinated Universal Time
    -- (UTC).
    --
    -- The snapshot is automatically created between the time shown and up to
    -- 45 minutes after.
    AddOn -> Maybe Text
nextSnapshotTimeOfDay :: Prelude.Maybe Prelude.Text,
    -- | The daily time when an automatic snapshot is created.
    --
    -- The time shown is in @HH:00@ format, and in Coordinated Universal Time
    -- (UTC).
    --
    -- The snapshot is automatically created between the time shown and up to
    -- 45 minutes after.
    AddOn -> Maybe Text
snapshotTimeOfDay :: Prelude.Maybe Prelude.Text,
    -- | The name of the add-on.
    AddOn -> Maybe Text
name :: Prelude.Maybe Prelude.Text
  }
  deriving (AddOn -> AddOn -> Bool
(AddOn -> AddOn -> Bool) -> (AddOn -> AddOn -> Bool) -> Eq AddOn
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AddOn -> AddOn -> Bool
$c/= :: AddOn -> AddOn -> Bool
== :: AddOn -> AddOn -> Bool
$c== :: AddOn -> AddOn -> Bool
Prelude.Eq, ReadPrec [AddOn]
ReadPrec AddOn
Int -> ReadS AddOn
ReadS [AddOn]
(Int -> ReadS AddOn)
-> ReadS [AddOn]
-> ReadPrec AddOn
-> ReadPrec [AddOn]
-> Read AddOn
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AddOn]
$creadListPrec :: ReadPrec [AddOn]
readPrec :: ReadPrec AddOn
$creadPrec :: ReadPrec AddOn
readList :: ReadS [AddOn]
$creadList :: ReadS [AddOn]
readsPrec :: Int -> ReadS AddOn
$creadsPrec :: Int -> ReadS AddOn
Prelude.Read, Int -> AddOn -> ShowS
[AddOn] -> ShowS
AddOn -> String
(Int -> AddOn -> ShowS)
-> (AddOn -> String) -> ([AddOn] -> ShowS) -> Show AddOn
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AddOn] -> ShowS
$cshowList :: [AddOn] -> ShowS
show :: AddOn -> String
$cshow :: AddOn -> String
showsPrec :: Int -> AddOn -> ShowS
$cshowsPrec :: Int -> AddOn -> ShowS
Prelude.Show, (forall x. AddOn -> Rep AddOn x)
-> (forall x. Rep AddOn x -> AddOn) -> Generic AddOn
forall x. Rep AddOn x -> AddOn
forall x. AddOn -> Rep AddOn x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AddOn x -> AddOn
$cfrom :: forall x. AddOn -> Rep AddOn x
Prelude.Generic)

-- |
-- Create a value of 'AddOn' 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:
--
-- 'status', 'addOn_status' - The status of the add-on.
--
-- 'nextSnapshotTimeOfDay', 'addOn_nextSnapshotTimeOfDay' - The next daily time an automatic snapshot will be created.
--
-- The time shown is in @HH:00@ format, and in Coordinated Universal Time
-- (UTC).
--
-- The snapshot is automatically created between the time shown and up to
-- 45 minutes after.
--
-- 'snapshotTimeOfDay', 'addOn_snapshotTimeOfDay' - The daily time when an automatic snapshot is created.
--
-- The time shown is in @HH:00@ format, and in Coordinated Universal Time
-- (UTC).
--
-- The snapshot is automatically created between the time shown and up to
-- 45 minutes after.
--
-- 'name', 'addOn_name' - The name of the add-on.
newAddOn ::
  AddOn
newAddOn :: AddOn
newAddOn =
  AddOn' :: Maybe Text -> Maybe Text -> Maybe Text -> Maybe Text -> AddOn
AddOn'
    { $sel:status:AddOn' :: Maybe Text
status = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:nextSnapshotTimeOfDay:AddOn' :: Maybe Text
nextSnapshotTimeOfDay = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:snapshotTimeOfDay:AddOn' :: Maybe Text
snapshotTimeOfDay = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:name:AddOn' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The status of the add-on.
addOn_status :: Lens.Lens' AddOn (Prelude.Maybe Prelude.Text)
addOn_status :: (Maybe Text -> f (Maybe Text)) -> AddOn -> f AddOn
addOn_status = (AddOn -> Maybe Text)
-> (AddOn -> Maybe Text -> AddOn)
-> Lens AddOn AddOn (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AddOn' {Maybe Text
status :: Maybe Text
$sel:status:AddOn' :: AddOn -> Maybe Text
status} -> Maybe Text
status) (\s :: AddOn
s@AddOn' {} Maybe Text
a -> AddOn
s {$sel:status:AddOn' :: Maybe Text
status = Maybe Text
a} :: AddOn)

-- | The next daily time an automatic snapshot will be created.
--
-- The time shown is in @HH:00@ format, and in Coordinated Universal Time
-- (UTC).
--
-- The snapshot is automatically created between the time shown and up to
-- 45 minutes after.
addOn_nextSnapshotTimeOfDay :: Lens.Lens' AddOn (Prelude.Maybe Prelude.Text)
addOn_nextSnapshotTimeOfDay :: (Maybe Text -> f (Maybe Text)) -> AddOn -> f AddOn
addOn_nextSnapshotTimeOfDay = (AddOn -> Maybe Text)
-> (AddOn -> Maybe Text -> AddOn)
-> Lens AddOn AddOn (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AddOn' {Maybe Text
nextSnapshotTimeOfDay :: Maybe Text
$sel:nextSnapshotTimeOfDay:AddOn' :: AddOn -> Maybe Text
nextSnapshotTimeOfDay} -> Maybe Text
nextSnapshotTimeOfDay) (\s :: AddOn
s@AddOn' {} Maybe Text
a -> AddOn
s {$sel:nextSnapshotTimeOfDay:AddOn' :: Maybe Text
nextSnapshotTimeOfDay = Maybe Text
a} :: AddOn)

-- | The daily time when an automatic snapshot is created.
--
-- The time shown is in @HH:00@ format, and in Coordinated Universal Time
-- (UTC).
--
-- The snapshot is automatically created between the time shown and up to
-- 45 minutes after.
addOn_snapshotTimeOfDay :: Lens.Lens' AddOn (Prelude.Maybe Prelude.Text)
addOn_snapshotTimeOfDay :: (Maybe Text -> f (Maybe Text)) -> AddOn -> f AddOn
addOn_snapshotTimeOfDay = (AddOn -> Maybe Text)
-> (AddOn -> Maybe Text -> AddOn)
-> Lens AddOn AddOn (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AddOn' {Maybe Text
snapshotTimeOfDay :: Maybe Text
$sel:snapshotTimeOfDay:AddOn' :: AddOn -> Maybe Text
snapshotTimeOfDay} -> Maybe Text
snapshotTimeOfDay) (\s :: AddOn
s@AddOn' {} Maybe Text
a -> AddOn
s {$sel:snapshotTimeOfDay:AddOn' :: Maybe Text
snapshotTimeOfDay = Maybe Text
a} :: AddOn)

-- | The name of the add-on.
addOn_name :: Lens.Lens' AddOn (Prelude.Maybe Prelude.Text)
addOn_name :: (Maybe Text -> f (Maybe Text)) -> AddOn -> f AddOn
addOn_name = (AddOn -> Maybe Text)
-> (AddOn -> Maybe Text -> AddOn)
-> Lens AddOn AddOn (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AddOn' {Maybe Text
name :: Maybe Text
$sel:name:AddOn' :: AddOn -> Maybe Text
name} -> Maybe Text
name) (\s :: AddOn
s@AddOn' {} Maybe Text
a -> AddOn
s {$sel:name:AddOn' :: Maybe Text
name = Maybe Text
a} :: AddOn)

instance Core.FromJSON AddOn where
  parseJSON :: Value -> Parser AddOn
parseJSON =
    String -> (Object -> Parser AddOn) -> Value -> Parser AddOn
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"AddOn"
      ( \Object
x ->
          Maybe Text -> Maybe Text -> Maybe Text -> Maybe Text -> AddOn
AddOn'
            (Maybe Text -> Maybe Text -> Maybe Text -> Maybe Text -> AddOn)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe Text -> Maybe Text -> AddOn)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"status")
            Parser (Maybe Text -> Maybe Text -> Maybe Text -> AddOn)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe Text -> AddOn)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"nextSnapshotTimeOfDay")
            Parser (Maybe Text -> Maybe Text -> AddOn)
-> Parser (Maybe Text) -> Parser (Maybe Text -> AddOn)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"snapshotTimeOfDay")
            Parser (Maybe Text -> AddOn) -> Parser (Maybe Text) -> Parser AddOn
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"name")
      )

instance Prelude.Hashable AddOn

instance Prelude.NFData AddOn