{-# 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.StorageGateway.Types.BandwidthRateLimitInterval
-- 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.StorageGateway.Types.BandwidthRateLimitInterval where

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

-- | Describes a bandwidth rate limit interval for a gateway. A bandwidth
-- rate limit schedule consists of one or more bandwidth rate limit
-- intervals. A bandwidth rate limit interval defines a period of time on
-- one or more days of the week, during which bandwidth rate limits are
-- specified for uploading, downloading, or both.
--
-- /See:/ 'newBandwidthRateLimitInterval' smart constructor.
data BandwidthRateLimitInterval = BandwidthRateLimitInterval'
  { -- | The average upload rate limit component of the bandwidth rate limit
    -- interval, in bits per second. This field does not appear in the response
    -- if the upload rate limit is not set.
    BandwidthRateLimitInterval -> Maybe Natural
averageUploadRateLimitInBitsPerSec :: Prelude.Maybe Prelude.Natural,
    -- | The average download rate limit component of the bandwidth rate limit
    -- interval, in bits per second. This field does not appear in the response
    -- if the download rate limit is not set.
    BandwidthRateLimitInterval -> Maybe Natural
averageDownloadRateLimitInBitsPerSec :: Prelude.Maybe Prelude.Natural,
    -- | The hour of the day to start the bandwidth rate limit interval.
    BandwidthRateLimitInterval -> Natural
startHourOfDay :: Prelude.Natural,
    -- | The minute of the hour to start the bandwidth rate limit interval. The
    -- interval begins at the start of that minute. To begin an interval
    -- exactly at the start of the hour, use the value @0@.
    BandwidthRateLimitInterval -> Natural
startMinuteOfHour :: Prelude.Natural,
    -- | The hour of the day to end the bandwidth rate limit interval.
    BandwidthRateLimitInterval -> Natural
endHourOfDay :: Prelude.Natural,
    -- | The minute of the hour to end the bandwidth rate limit interval.
    --
    -- The bandwidth rate limit interval ends at the end of the minute. To end
    -- an interval at the end of an hour, use the value @59@.
    BandwidthRateLimitInterval -> Natural
endMinuteOfHour :: Prelude.Natural,
    -- | The days of the week component of the bandwidth rate limit interval,
    -- represented as ordinal numbers from 0 to 6, where 0 represents Sunday
    -- and 6 represents Saturday.
    BandwidthRateLimitInterval -> NonEmpty Natural
daysOfWeek :: Prelude.NonEmpty Prelude.Natural
  }
  deriving (BandwidthRateLimitInterval -> BandwidthRateLimitInterval -> Bool
(BandwidthRateLimitInterval -> BandwidthRateLimitInterval -> Bool)
-> (BandwidthRateLimitInterval
    -> BandwidthRateLimitInterval -> Bool)
-> Eq BandwidthRateLimitInterval
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BandwidthRateLimitInterval -> BandwidthRateLimitInterval -> Bool
$c/= :: BandwidthRateLimitInterval -> BandwidthRateLimitInterval -> Bool
== :: BandwidthRateLimitInterval -> BandwidthRateLimitInterval -> Bool
$c== :: BandwidthRateLimitInterval -> BandwidthRateLimitInterval -> Bool
Prelude.Eq, ReadPrec [BandwidthRateLimitInterval]
ReadPrec BandwidthRateLimitInterval
Int -> ReadS BandwidthRateLimitInterval
ReadS [BandwidthRateLimitInterval]
(Int -> ReadS BandwidthRateLimitInterval)
-> ReadS [BandwidthRateLimitInterval]
-> ReadPrec BandwidthRateLimitInterval
-> ReadPrec [BandwidthRateLimitInterval]
-> Read BandwidthRateLimitInterval
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BandwidthRateLimitInterval]
$creadListPrec :: ReadPrec [BandwidthRateLimitInterval]
readPrec :: ReadPrec BandwidthRateLimitInterval
$creadPrec :: ReadPrec BandwidthRateLimitInterval
readList :: ReadS [BandwidthRateLimitInterval]
$creadList :: ReadS [BandwidthRateLimitInterval]
readsPrec :: Int -> ReadS BandwidthRateLimitInterval
$creadsPrec :: Int -> ReadS BandwidthRateLimitInterval
Prelude.Read, Int -> BandwidthRateLimitInterval -> ShowS
[BandwidthRateLimitInterval] -> ShowS
BandwidthRateLimitInterval -> String
(Int -> BandwidthRateLimitInterval -> ShowS)
-> (BandwidthRateLimitInterval -> String)
-> ([BandwidthRateLimitInterval] -> ShowS)
-> Show BandwidthRateLimitInterval
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BandwidthRateLimitInterval] -> ShowS
$cshowList :: [BandwidthRateLimitInterval] -> ShowS
show :: BandwidthRateLimitInterval -> String
$cshow :: BandwidthRateLimitInterval -> String
showsPrec :: Int -> BandwidthRateLimitInterval -> ShowS
$cshowsPrec :: Int -> BandwidthRateLimitInterval -> ShowS
Prelude.Show, (forall x.
 BandwidthRateLimitInterval -> Rep BandwidthRateLimitInterval x)
-> (forall x.
    Rep BandwidthRateLimitInterval x -> BandwidthRateLimitInterval)
-> Generic BandwidthRateLimitInterval
forall x.
Rep BandwidthRateLimitInterval x -> BandwidthRateLimitInterval
forall x.
BandwidthRateLimitInterval -> Rep BandwidthRateLimitInterval x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep BandwidthRateLimitInterval x -> BandwidthRateLimitInterval
$cfrom :: forall x.
BandwidthRateLimitInterval -> Rep BandwidthRateLimitInterval x
Prelude.Generic)

-- |
-- Create a value of 'BandwidthRateLimitInterval' 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:
--
-- 'averageUploadRateLimitInBitsPerSec', 'bandwidthRateLimitInterval_averageUploadRateLimitInBitsPerSec' - The average upload rate limit component of the bandwidth rate limit
-- interval, in bits per second. This field does not appear in the response
-- if the upload rate limit is not set.
--
-- 'averageDownloadRateLimitInBitsPerSec', 'bandwidthRateLimitInterval_averageDownloadRateLimitInBitsPerSec' - The average download rate limit component of the bandwidth rate limit
-- interval, in bits per second. This field does not appear in the response
-- if the download rate limit is not set.
--
-- 'startHourOfDay', 'bandwidthRateLimitInterval_startHourOfDay' - The hour of the day to start the bandwidth rate limit interval.
--
-- 'startMinuteOfHour', 'bandwidthRateLimitInterval_startMinuteOfHour' - The minute of the hour to start the bandwidth rate limit interval. The
-- interval begins at the start of that minute. To begin an interval
-- exactly at the start of the hour, use the value @0@.
--
-- 'endHourOfDay', 'bandwidthRateLimitInterval_endHourOfDay' - The hour of the day to end the bandwidth rate limit interval.
--
-- 'endMinuteOfHour', 'bandwidthRateLimitInterval_endMinuteOfHour' - The minute of the hour to end the bandwidth rate limit interval.
--
-- The bandwidth rate limit interval ends at the end of the minute. To end
-- an interval at the end of an hour, use the value @59@.
--
-- 'daysOfWeek', 'bandwidthRateLimitInterval_daysOfWeek' - The days of the week component of the bandwidth rate limit interval,
-- represented as ordinal numbers from 0 to 6, where 0 represents Sunday
-- and 6 represents Saturday.
newBandwidthRateLimitInterval ::
  -- | 'startHourOfDay'
  Prelude.Natural ->
  -- | 'startMinuteOfHour'
  Prelude.Natural ->
  -- | 'endHourOfDay'
  Prelude.Natural ->
  -- | 'endMinuteOfHour'
  Prelude.Natural ->
  -- | 'daysOfWeek'
  Prelude.NonEmpty Prelude.Natural ->
  BandwidthRateLimitInterval
newBandwidthRateLimitInterval :: Natural
-> Natural
-> Natural
-> Natural
-> NonEmpty Natural
-> BandwidthRateLimitInterval
newBandwidthRateLimitInterval
  Natural
pStartHourOfDay_
  Natural
pStartMinuteOfHour_
  Natural
pEndHourOfDay_
  Natural
pEndMinuteOfHour_
  NonEmpty Natural
pDaysOfWeek_ =
    BandwidthRateLimitInterval' :: Maybe Natural
-> Maybe Natural
-> Natural
-> Natural
-> Natural
-> Natural
-> NonEmpty Natural
-> BandwidthRateLimitInterval
BandwidthRateLimitInterval'
      { $sel:averageUploadRateLimitInBitsPerSec:BandwidthRateLimitInterval' :: Maybe Natural
averageUploadRateLimitInBitsPerSec =
          Maybe Natural
forall a. Maybe a
Prelude.Nothing,
        $sel:averageDownloadRateLimitInBitsPerSec:BandwidthRateLimitInterval' :: Maybe Natural
averageDownloadRateLimitInBitsPerSec =
          Maybe Natural
forall a. Maybe a
Prelude.Nothing,
        $sel:startHourOfDay:BandwidthRateLimitInterval' :: Natural
startHourOfDay = Natural
pStartHourOfDay_,
        $sel:startMinuteOfHour:BandwidthRateLimitInterval' :: Natural
startMinuteOfHour = Natural
pStartMinuteOfHour_,
        $sel:endHourOfDay:BandwidthRateLimitInterval' :: Natural
endHourOfDay = Natural
pEndHourOfDay_,
        $sel:endMinuteOfHour:BandwidthRateLimitInterval' :: Natural
endMinuteOfHour = Natural
pEndMinuteOfHour_,
        $sel:daysOfWeek:BandwidthRateLimitInterval' :: NonEmpty Natural
daysOfWeek = Tagged (NonEmpty Natural) (Identity (NonEmpty Natural))
-> Tagged (NonEmpty Natural) (Identity (NonEmpty Natural))
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced (Tagged (NonEmpty Natural) (Identity (NonEmpty Natural))
 -> Tagged (NonEmpty Natural) (Identity (NonEmpty Natural)))
-> NonEmpty Natural -> NonEmpty Natural
forall t b. AReview t b -> b -> t
Lens.# NonEmpty Natural
pDaysOfWeek_
      }

-- | The average upload rate limit component of the bandwidth rate limit
-- interval, in bits per second. This field does not appear in the response
-- if the upload rate limit is not set.
bandwidthRateLimitInterval_averageUploadRateLimitInBitsPerSec :: Lens.Lens' BandwidthRateLimitInterval (Prelude.Maybe Prelude.Natural)
bandwidthRateLimitInterval_averageUploadRateLimitInBitsPerSec :: (Maybe Natural -> f (Maybe Natural))
-> BandwidthRateLimitInterval -> f BandwidthRateLimitInterval
bandwidthRateLimitInterval_averageUploadRateLimitInBitsPerSec = (BandwidthRateLimitInterval -> Maybe Natural)
-> (BandwidthRateLimitInterval
    -> Maybe Natural -> BandwidthRateLimitInterval)
-> Lens
     BandwidthRateLimitInterval
     BandwidthRateLimitInterval
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BandwidthRateLimitInterval' {Maybe Natural
averageUploadRateLimitInBitsPerSec :: Maybe Natural
$sel:averageUploadRateLimitInBitsPerSec:BandwidthRateLimitInterval' :: BandwidthRateLimitInterval -> Maybe Natural
averageUploadRateLimitInBitsPerSec} -> Maybe Natural
averageUploadRateLimitInBitsPerSec) (\s :: BandwidthRateLimitInterval
s@BandwidthRateLimitInterval' {} Maybe Natural
a -> BandwidthRateLimitInterval
s {$sel:averageUploadRateLimitInBitsPerSec:BandwidthRateLimitInterval' :: Maybe Natural
averageUploadRateLimitInBitsPerSec = Maybe Natural
a} :: BandwidthRateLimitInterval)

-- | The average download rate limit component of the bandwidth rate limit
-- interval, in bits per second. This field does not appear in the response
-- if the download rate limit is not set.
bandwidthRateLimitInterval_averageDownloadRateLimitInBitsPerSec :: Lens.Lens' BandwidthRateLimitInterval (Prelude.Maybe Prelude.Natural)
bandwidthRateLimitInterval_averageDownloadRateLimitInBitsPerSec :: (Maybe Natural -> f (Maybe Natural))
-> BandwidthRateLimitInterval -> f BandwidthRateLimitInterval
bandwidthRateLimitInterval_averageDownloadRateLimitInBitsPerSec = (BandwidthRateLimitInterval -> Maybe Natural)
-> (BandwidthRateLimitInterval
    -> Maybe Natural -> BandwidthRateLimitInterval)
-> Lens
     BandwidthRateLimitInterval
     BandwidthRateLimitInterval
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BandwidthRateLimitInterval' {Maybe Natural
averageDownloadRateLimitInBitsPerSec :: Maybe Natural
$sel:averageDownloadRateLimitInBitsPerSec:BandwidthRateLimitInterval' :: BandwidthRateLimitInterval -> Maybe Natural
averageDownloadRateLimitInBitsPerSec} -> Maybe Natural
averageDownloadRateLimitInBitsPerSec) (\s :: BandwidthRateLimitInterval
s@BandwidthRateLimitInterval' {} Maybe Natural
a -> BandwidthRateLimitInterval
s {$sel:averageDownloadRateLimitInBitsPerSec:BandwidthRateLimitInterval' :: Maybe Natural
averageDownloadRateLimitInBitsPerSec = Maybe Natural
a} :: BandwidthRateLimitInterval)

-- | The hour of the day to start the bandwidth rate limit interval.
bandwidthRateLimitInterval_startHourOfDay :: Lens.Lens' BandwidthRateLimitInterval Prelude.Natural
bandwidthRateLimitInterval_startHourOfDay :: (Natural -> f Natural)
-> BandwidthRateLimitInterval -> f BandwidthRateLimitInterval
bandwidthRateLimitInterval_startHourOfDay = (BandwidthRateLimitInterval -> Natural)
-> (BandwidthRateLimitInterval
    -> Natural -> BandwidthRateLimitInterval)
-> Lens
     BandwidthRateLimitInterval
     BandwidthRateLimitInterval
     Natural
     Natural
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BandwidthRateLimitInterval' {Natural
startHourOfDay :: Natural
$sel:startHourOfDay:BandwidthRateLimitInterval' :: BandwidthRateLimitInterval -> Natural
startHourOfDay} -> Natural
startHourOfDay) (\s :: BandwidthRateLimitInterval
s@BandwidthRateLimitInterval' {} Natural
a -> BandwidthRateLimitInterval
s {$sel:startHourOfDay:BandwidthRateLimitInterval' :: Natural
startHourOfDay = Natural
a} :: BandwidthRateLimitInterval)

-- | The minute of the hour to start the bandwidth rate limit interval. The
-- interval begins at the start of that minute. To begin an interval
-- exactly at the start of the hour, use the value @0@.
bandwidthRateLimitInterval_startMinuteOfHour :: Lens.Lens' BandwidthRateLimitInterval Prelude.Natural
bandwidthRateLimitInterval_startMinuteOfHour :: (Natural -> f Natural)
-> BandwidthRateLimitInterval -> f BandwidthRateLimitInterval
bandwidthRateLimitInterval_startMinuteOfHour = (BandwidthRateLimitInterval -> Natural)
-> (BandwidthRateLimitInterval
    -> Natural -> BandwidthRateLimitInterval)
-> Lens
     BandwidthRateLimitInterval
     BandwidthRateLimitInterval
     Natural
     Natural
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BandwidthRateLimitInterval' {Natural
startMinuteOfHour :: Natural
$sel:startMinuteOfHour:BandwidthRateLimitInterval' :: BandwidthRateLimitInterval -> Natural
startMinuteOfHour} -> Natural
startMinuteOfHour) (\s :: BandwidthRateLimitInterval
s@BandwidthRateLimitInterval' {} Natural
a -> BandwidthRateLimitInterval
s {$sel:startMinuteOfHour:BandwidthRateLimitInterval' :: Natural
startMinuteOfHour = Natural
a} :: BandwidthRateLimitInterval)

-- | The hour of the day to end the bandwidth rate limit interval.
bandwidthRateLimitInterval_endHourOfDay :: Lens.Lens' BandwidthRateLimitInterval Prelude.Natural
bandwidthRateLimitInterval_endHourOfDay :: (Natural -> f Natural)
-> BandwidthRateLimitInterval -> f BandwidthRateLimitInterval
bandwidthRateLimitInterval_endHourOfDay = (BandwidthRateLimitInterval -> Natural)
-> (BandwidthRateLimitInterval
    -> Natural -> BandwidthRateLimitInterval)
-> Lens
     BandwidthRateLimitInterval
     BandwidthRateLimitInterval
     Natural
     Natural
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BandwidthRateLimitInterval' {Natural
endHourOfDay :: Natural
$sel:endHourOfDay:BandwidthRateLimitInterval' :: BandwidthRateLimitInterval -> Natural
endHourOfDay} -> Natural
endHourOfDay) (\s :: BandwidthRateLimitInterval
s@BandwidthRateLimitInterval' {} Natural
a -> BandwidthRateLimitInterval
s {$sel:endHourOfDay:BandwidthRateLimitInterval' :: Natural
endHourOfDay = Natural
a} :: BandwidthRateLimitInterval)

-- | The minute of the hour to end the bandwidth rate limit interval.
--
-- The bandwidth rate limit interval ends at the end of the minute. To end
-- an interval at the end of an hour, use the value @59@.
bandwidthRateLimitInterval_endMinuteOfHour :: Lens.Lens' BandwidthRateLimitInterval Prelude.Natural
bandwidthRateLimitInterval_endMinuteOfHour :: (Natural -> f Natural)
-> BandwidthRateLimitInterval -> f BandwidthRateLimitInterval
bandwidthRateLimitInterval_endMinuteOfHour = (BandwidthRateLimitInterval -> Natural)
-> (BandwidthRateLimitInterval
    -> Natural -> BandwidthRateLimitInterval)
-> Lens
     BandwidthRateLimitInterval
     BandwidthRateLimitInterval
     Natural
     Natural
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BandwidthRateLimitInterval' {Natural
endMinuteOfHour :: Natural
$sel:endMinuteOfHour:BandwidthRateLimitInterval' :: BandwidthRateLimitInterval -> Natural
endMinuteOfHour} -> Natural
endMinuteOfHour) (\s :: BandwidthRateLimitInterval
s@BandwidthRateLimitInterval' {} Natural
a -> BandwidthRateLimitInterval
s {$sel:endMinuteOfHour:BandwidthRateLimitInterval' :: Natural
endMinuteOfHour = Natural
a} :: BandwidthRateLimitInterval)

-- | The days of the week component of the bandwidth rate limit interval,
-- represented as ordinal numbers from 0 to 6, where 0 represents Sunday
-- and 6 represents Saturday.
bandwidthRateLimitInterval_daysOfWeek :: Lens.Lens' BandwidthRateLimitInterval (Prelude.NonEmpty Prelude.Natural)
bandwidthRateLimitInterval_daysOfWeek :: (NonEmpty Natural -> f (NonEmpty Natural))
-> BandwidthRateLimitInterval -> f BandwidthRateLimitInterval
bandwidthRateLimitInterval_daysOfWeek = (BandwidthRateLimitInterval -> NonEmpty Natural)
-> (BandwidthRateLimitInterval
    -> NonEmpty Natural -> BandwidthRateLimitInterval)
-> Lens
     BandwidthRateLimitInterval
     BandwidthRateLimitInterval
     (NonEmpty Natural)
     (NonEmpty Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BandwidthRateLimitInterval' {NonEmpty Natural
daysOfWeek :: NonEmpty Natural
$sel:daysOfWeek:BandwidthRateLimitInterval' :: BandwidthRateLimitInterval -> NonEmpty Natural
daysOfWeek} -> NonEmpty Natural
daysOfWeek) (\s :: BandwidthRateLimitInterval
s@BandwidthRateLimitInterval' {} NonEmpty Natural
a -> BandwidthRateLimitInterval
s {$sel:daysOfWeek:BandwidthRateLimitInterval' :: NonEmpty Natural
daysOfWeek = NonEmpty Natural
a} :: BandwidthRateLimitInterval) ((NonEmpty Natural -> f (NonEmpty Natural))
 -> BandwidthRateLimitInterval -> f BandwidthRateLimitInterval)
-> ((NonEmpty Natural -> f (NonEmpty Natural))
    -> NonEmpty Natural -> f (NonEmpty Natural))
-> (NonEmpty Natural -> f (NonEmpty Natural))
-> BandwidthRateLimitInterval
-> f BandwidthRateLimitInterval
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (NonEmpty Natural -> f (NonEmpty Natural))
-> NonEmpty Natural -> f (NonEmpty Natural)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.FromJSON BandwidthRateLimitInterval where
  parseJSON :: Value -> Parser BandwidthRateLimitInterval
parseJSON =
    String
-> (Object -> Parser BandwidthRateLimitInterval)
-> Value
-> Parser BandwidthRateLimitInterval
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"BandwidthRateLimitInterval"
      ( \Object
x ->
          Maybe Natural
-> Maybe Natural
-> Natural
-> Natural
-> Natural
-> Natural
-> NonEmpty Natural
-> BandwidthRateLimitInterval
BandwidthRateLimitInterval'
            (Maybe Natural
 -> Maybe Natural
 -> Natural
 -> Natural
 -> Natural
 -> Natural
 -> NonEmpty Natural
 -> BandwidthRateLimitInterval)
-> Parser (Maybe Natural)
-> Parser
     (Maybe Natural
      -> Natural
      -> Natural
      -> Natural
      -> Natural
      -> NonEmpty Natural
      -> BandwidthRateLimitInterval)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Natural)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"AverageUploadRateLimitInBitsPerSec")
            Parser
  (Maybe Natural
   -> Natural
   -> Natural
   -> Natural
   -> Natural
   -> NonEmpty Natural
   -> BandwidthRateLimitInterval)
-> Parser (Maybe Natural)
-> Parser
     (Natural
      -> Natural
      -> Natural
      -> Natural
      -> NonEmpty Natural
      -> BandwidthRateLimitInterval)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Natural)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"AverageDownloadRateLimitInBitsPerSec")
            Parser
  (Natural
   -> Natural
   -> Natural
   -> Natural
   -> NonEmpty Natural
   -> BandwidthRateLimitInterval)
-> Parser Natural
-> Parser
     (Natural
      -> Natural
      -> Natural
      -> NonEmpty Natural
      -> BandwidthRateLimitInterval)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Natural
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"StartHourOfDay")
            Parser
  (Natural
   -> Natural
   -> Natural
   -> NonEmpty Natural
   -> BandwidthRateLimitInterval)
-> Parser Natural
-> Parser
     (Natural
      -> Natural -> NonEmpty Natural -> BandwidthRateLimitInterval)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Natural
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"StartMinuteOfHour")
            Parser
  (Natural
   -> Natural -> NonEmpty Natural -> BandwidthRateLimitInterval)
-> Parser Natural
-> Parser
     (Natural -> NonEmpty Natural -> BandwidthRateLimitInterval)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Natural
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"EndHourOfDay")
            Parser (Natural -> NonEmpty Natural -> BandwidthRateLimitInterval)
-> Parser Natural
-> Parser (NonEmpty Natural -> BandwidthRateLimitInterval)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Natural
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"EndMinuteOfHour")
            Parser (NonEmpty Natural -> BandwidthRateLimitInterval)
-> Parser (NonEmpty Natural) -> Parser BandwidthRateLimitInterval
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (NonEmpty Natural)
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"DaysOfWeek")
      )

instance Prelude.Hashable BandwidthRateLimitInterval

instance Prelude.NFData BandwidthRateLimitInterval

instance Core.ToJSON BandwidthRateLimitInterval where
  toJSON :: BandwidthRateLimitInterval -> Value
toJSON BandwidthRateLimitInterval' {Natural
Maybe Natural
NonEmpty Natural
daysOfWeek :: NonEmpty Natural
endMinuteOfHour :: Natural
endHourOfDay :: Natural
startMinuteOfHour :: Natural
startHourOfDay :: Natural
averageDownloadRateLimitInBitsPerSec :: Maybe Natural
averageUploadRateLimitInBitsPerSec :: Maybe Natural
$sel:daysOfWeek:BandwidthRateLimitInterval' :: BandwidthRateLimitInterval -> NonEmpty Natural
$sel:endMinuteOfHour:BandwidthRateLimitInterval' :: BandwidthRateLimitInterval -> Natural
$sel:endHourOfDay:BandwidthRateLimitInterval' :: BandwidthRateLimitInterval -> Natural
$sel:startMinuteOfHour:BandwidthRateLimitInterval' :: BandwidthRateLimitInterval -> Natural
$sel:startHourOfDay:BandwidthRateLimitInterval' :: BandwidthRateLimitInterval -> Natural
$sel:averageDownloadRateLimitInBitsPerSec:BandwidthRateLimitInterval' :: BandwidthRateLimitInterval -> Maybe Natural
$sel:averageUploadRateLimitInBitsPerSec:BandwidthRateLimitInterval' :: BandwidthRateLimitInterval -> Maybe Natural
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"AverageUploadRateLimitInBitsPerSec" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
averageUploadRateLimitInBitsPerSec,
            (Text
"AverageDownloadRateLimitInBitsPerSec" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
averageDownloadRateLimitInBitsPerSec,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"StartHourOfDay" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Natural
startHourOfDay),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"StartMinuteOfHour" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Natural
startMinuteOfHour),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"EndHourOfDay" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Natural
endHourOfDay),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"EndMinuteOfHour" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Natural
endMinuteOfHour),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"DaysOfWeek" Text -> NonEmpty Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= NonEmpty Natural
daysOfWeek)
          ]
      )