{-# 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.ServiceCatalog.Types.UsageInstruction
-- 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.ServiceCatalog.Types.UsageInstruction where

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

-- | Additional information provided by the administrator.
--
-- /See:/ 'newUsageInstruction' smart constructor.
data UsageInstruction = UsageInstruction'
  { -- | The usage instruction value for this type.
    UsageInstruction -> Maybe Text
value :: Prelude.Maybe Prelude.Text,
    -- | The usage instruction type for the value.
    UsageInstruction -> Maybe Text
type' :: Prelude.Maybe Prelude.Text
  }
  deriving (UsageInstruction -> UsageInstruction -> Bool
(UsageInstruction -> UsageInstruction -> Bool)
-> (UsageInstruction -> UsageInstruction -> Bool)
-> Eq UsageInstruction
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UsageInstruction -> UsageInstruction -> Bool
$c/= :: UsageInstruction -> UsageInstruction -> Bool
== :: UsageInstruction -> UsageInstruction -> Bool
$c== :: UsageInstruction -> UsageInstruction -> Bool
Prelude.Eq, ReadPrec [UsageInstruction]
ReadPrec UsageInstruction
Int -> ReadS UsageInstruction
ReadS [UsageInstruction]
(Int -> ReadS UsageInstruction)
-> ReadS [UsageInstruction]
-> ReadPrec UsageInstruction
-> ReadPrec [UsageInstruction]
-> Read UsageInstruction
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UsageInstruction]
$creadListPrec :: ReadPrec [UsageInstruction]
readPrec :: ReadPrec UsageInstruction
$creadPrec :: ReadPrec UsageInstruction
readList :: ReadS [UsageInstruction]
$creadList :: ReadS [UsageInstruction]
readsPrec :: Int -> ReadS UsageInstruction
$creadsPrec :: Int -> ReadS UsageInstruction
Prelude.Read, Int -> UsageInstruction -> ShowS
[UsageInstruction] -> ShowS
UsageInstruction -> String
(Int -> UsageInstruction -> ShowS)
-> (UsageInstruction -> String)
-> ([UsageInstruction] -> ShowS)
-> Show UsageInstruction
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UsageInstruction] -> ShowS
$cshowList :: [UsageInstruction] -> ShowS
show :: UsageInstruction -> String
$cshow :: UsageInstruction -> String
showsPrec :: Int -> UsageInstruction -> ShowS
$cshowsPrec :: Int -> UsageInstruction -> ShowS
Prelude.Show, (forall x. UsageInstruction -> Rep UsageInstruction x)
-> (forall x. Rep UsageInstruction x -> UsageInstruction)
-> Generic UsageInstruction
forall x. Rep UsageInstruction x -> UsageInstruction
forall x. UsageInstruction -> Rep UsageInstruction x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UsageInstruction x -> UsageInstruction
$cfrom :: forall x. UsageInstruction -> Rep UsageInstruction x
Prelude.Generic)

-- |
-- Create a value of 'UsageInstruction' 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:
--
-- 'value', 'usageInstruction_value' - The usage instruction value for this type.
--
-- 'type'', 'usageInstruction_type' - The usage instruction type for the value.
newUsageInstruction ::
  UsageInstruction
newUsageInstruction :: UsageInstruction
newUsageInstruction =
  UsageInstruction' :: Maybe Text -> Maybe Text -> UsageInstruction
UsageInstruction'
    { $sel:value:UsageInstruction' :: Maybe Text
value = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:type':UsageInstruction' :: Maybe Text
type' = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The usage instruction value for this type.
usageInstruction_value :: Lens.Lens' UsageInstruction (Prelude.Maybe Prelude.Text)
usageInstruction_value :: (Maybe Text -> f (Maybe Text))
-> UsageInstruction -> f UsageInstruction
usageInstruction_value = (UsageInstruction -> Maybe Text)
-> (UsageInstruction -> Maybe Text -> UsageInstruction)
-> Lens UsageInstruction UsageInstruction (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UsageInstruction' {Maybe Text
value :: Maybe Text
$sel:value:UsageInstruction' :: UsageInstruction -> Maybe Text
value} -> Maybe Text
value) (\s :: UsageInstruction
s@UsageInstruction' {} Maybe Text
a -> UsageInstruction
s {$sel:value:UsageInstruction' :: Maybe Text
value = Maybe Text
a} :: UsageInstruction)

-- | The usage instruction type for the value.
usageInstruction_type :: Lens.Lens' UsageInstruction (Prelude.Maybe Prelude.Text)
usageInstruction_type :: (Maybe Text -> f (Maybe Text))
-> UsageInstruction -> f UsageInstruction
usageInstruction_type = (UsageInstruction -> Maybe Text)
-> (UsageInstruction -> Maybe Text -> UsageInstruction)
-> Lens UsageInstruction UsageInstruction (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UsageInstruction' {Maybe Text
type' :: Maybe Text
$sel:type':UsageInstruction' :: UsageInstruction -> Maybe Text
type'} -> Maybe Text
type') (\s :: UsageInstruction
s@UsageInstruction' {} Maybe Text
a -> UsageInstruction
s {$sel:type':UsageInstruction' :: Maybe Text
type' = Maybe Text
a} :: UsageInstruction)

instance Core.FromJSON UsageInstruction where
  parseJSON :: Value -> Parser UsageInstruction
parseJSON =
    String
-> (Object -> Parser UsageInstruction)
-> Value
-> Parser UsageInstruction
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"UsageInstruction"
      ( \Object
x ->
          Maybe Text -> Maybe Text -> UsageInstruction
UsageInstruction'
            (Maybe Text -> Maybe Text -> UsageInstruction)
-> Parser (Maybe Text) -> Parser (Maybe Text -> UsageInstruction)
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
"Value") Parser (Maybe Text -> UsageInstruction)
-> Parser (Maybe Text) -> Parser UsageInstruction
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
"Type")
      )

instance Prelude.Hashable UsageInstruction

instance Prelude.NFData UsageInstruction