{-# 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.AutoScaling.Types.MetricGranularityType
-- 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.AutoScaling.Types.MetricGranularityType where

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

-- | Describes a granularity of a metric.
--
-- /See:/ 'newMetricGranularityType' smart constructor.
data MetricGranularityType = MetricGranularityType'
  { -- | The granularity. The only valid value is @1Minute@.
    MetricGranularityType -> Maybe Text
granularity :: Prelude.Maybe Prelude.Text
  }
  deriving (MetricGranularityType -> MetricGranularityType -> Bool
(MetricGranularityType -> MetricGranularityType -> Bool)
-> (MetricGranularityType -> MetricGranularityType -> Bool)
-> Eq MetricGranularityType
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: MetricGranularityType -> MetricGranularityType -> Bool
$c/= :: MetricGranularityType -> MetricGranularityType -> Bool
== :: MetricGranularityType -> MetricGranularityType -> Bool
$c== :: MetricGranularityType -> MetricGranularityType -> Bool
Prelude.Eq, ReadPrec [MetricGranularityType]
ReadPrec MetricGranularityType
Int -> ReadS MetricGranularityType
ReadS [MetricGranularityType]
(Int -> ReadS MetricGranularityType)
-> ReadS [MetricGranularityType]
-> ReadPrec MetricGranularityType
-> ReadPrec [MetricGranularityType]
-> Read MetricGranularityType
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [MetricGranularityType]
$creadListPrec :: ReadPrec [MetricGranularityType]
readPrec :: ReadPrec MetricGranularityType
$creadPrec :: ReadPrec MetricGranularityType
readList :: ReadS [MetricGranularityType]
$creadList :: ReadS [MetricGranularityType]
readsPrec :: Int -> ReadS MetricGranularityType
$creadsPrec :: Int -> ReadS MetricGranularityType
Prelude.Read, Int -> MetricGranularityType -> ShowS
[MetricGranularityType] -> ShowS
MetricGranularityType -> String
(Int -> MetricGranularityType -> ShowS)
-> (MetricGranularityType -> String)
-> ([MetricGranularityType] -> ShowS)
-> Show MetricGranularityType
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [MetricGranularityType] -> ShowS
$cshowList :: [MetricGranularityType] -> ShowS
show :: MetricGranularityType -> String
$cshow :: MetricGranularityType -> String
showsPrec :: Int -> MetricGranularityType -> ShowS
$cshowsPrec :: Int -> MetricGranularityType -> ShowS
Prelude.Show, (forall x. MetricGranularityType -> Rep MetricGranularityType x)
-> (forall x. Rep MetricGranularityType x -> MetricGranularityType)
-> Generic MetricGranularityType
forall x. Rep MetricGranularityType x -> MetricGranularityType
forall x. MetricGranularityType -> Rep MetricGranularityType x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep MetricGranularityType x -> MetricGranularityType
$cfrom :: forall x. MetricGranularityType -> Rep MetricGranularityType x
Prelude.Generic)

-- |
-- Create a value of 'MetricGranularityType' 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:
--
-- 'granularity', 'metricGranularityType_granularity' - The granularity. The only valid value is @1Minute@.
newMetricGranularityType ::
  MetricGranularityType
newMetricGranularityType :: MetricGranularityType
newMetricGranularityType =
  MetricGranularityType' :: Maybe Text -> MetricGranularityType
MetricGranularityType'
    { $sel:granularity:MetricGranularityType' :: Maybe Text
granularity =
        Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The granularity. The only valid value is @1Minute@.
metricGranularityType_granularity :: Lens.Lens' MetricGranularityType (Prelude.Maybe Prelude.Text)
metricGranularityType_granularity :: (Maybe Text -> f (Maybe Text))
-> MetricGranularityType -> f MetricGranularityType
metricGranularityType_granularity = (MetricGranularityType -> Maybe Text)
-> (MetricGranularityType -> Maybe Text -> MetricGranularityType)
-> Lens
     MetricGranularityType
     MetricGranularityType
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MetricGranularityType' {Maybe Text
granularity :: Maybe Text
$sel:granularity:MetricGranularityType' :: MetricGranularityType -> Maybe Text
granularity} -> Maybe Text
granularity) (\s :: MetricGranularityType
s@MetricGranularityType' {} Maybe Text
a -> MetricGranularityType
s {$sel:granularity:MetricGranularityType' :: Maybe Text
granularity = Maybe Text
a} :: MetricGranularityType)

instance Core.FromXML MetricGranularityType where
  parseXML :: [Node] -> Either String MetricGranularityType
parseXML [Node]
x =
    Maybe Text -> MetricGranularityType
MetricGranularityType'
      (Maybe Text -> MetricGranularityType)
-> Either String (Maybe Text)
-> Either String MetricGranularityType
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"Granularity")

instance Prelude.Hashable MetricGranularityType

instance Prelude.NFData MetricGranularityType