{-# 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.APIGateway.Types.SdkType
-- 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.APIGateway.Types.SdkType where

import Amazonka.APIGateway.Types.SdkConfigurationProperty
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | A type of SDK that API Gateway can generate.
--
-- /See:/ 'newSdkType' smart constructor.
data SdkType = SdkType'
  { -- | The user-friendly name of an SdkType instance.
    SdkType -> Maybe Text
friendlyName :: Prelude.Maybe Prelude.Text,
    -- | A list of configuration properties of an SdkType.
    SdkType -> Maybe [SdkConfigurationProperty]
configurationProperties :: Prelude.Maybe [SdkConfigurationProperty],
    -- | The identifier of an SdkType instance.
    SdkType -> Maybe Text
id :: Prelude.Maybe Prelude.Text,
    -- | The description of an SdkType.
    SdkType -> Maybe Text
description :: Prelude.Maybe Prelude.Text
  }
  deriving (SdkType -> SdkType -> Bool
(SdkType -> SdkType -> Bool)
-> (SdkType -> SdkType -> Bool) -> Eq SdkType
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SdkType -> SdkType -> Bool
$c/= :: SdkType -> SdkType -> Bool
== :: SdkType -> SdkType -> Bool
$c== :: SdkType -> SdkType -> Bool
Prelude.Eq, ReadPrec [SdkType]
ReadPrec SdkType
Int -> ReadS SdkType
ReadS [SdkType]
(Int -> ReadS SdkType)
-> ReadS [SdkType]
-> ReadPrec SdkType
-> ReadPrec [SdkType]
-> Read SdkType
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SdkType]
$creadListPrec :: ReadPrec [SdkType]
readPrec :: ReadPrec SdkType
$creadPrec :: ReadPrec SdkType
readList :: ReadS [SdkType]
$creadList :: ReadS [SdkType]
readsPrec :: Int -> ReadS SdkType
$creadsPrec :: Int -> ReadS SdkType
Prelude.Read, Int -> SdkType -> ShowS
[SdkType] -> ShowS
SdkType -> String
(Int -> SdkType -> ShowS)
-> (SdkType -> String) -> ([SdkType] -> ShowS) -> Show SdkType
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SdkType] -> ShowS
$cshowList :: [SdkType] -> ShowS
show :: SdkType -> String
$cshow :: SdkType -> String
showsPrec :: Int -> SdkType -> ShowS
$cshowsPrec :: Int -> SdkType -> ShowS
Prelude.Show, (forall x. SdkType -> Rep SdkType x)
-> (forall x. Rep SdkType x -> SdkType) -> Generic SdkType
forall x. Rep SdkType x -> SdkType
forall x. SdkType -> Rep SdkType x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SdkType x -> SdkType
$cfrom :: forall x. SdkType -> Rep SdkType x
Prelude.Generic)

-- |
-- Create a value of 'SdkType' 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:
--
-- 'friendlyName', 'sdkType_friendlyName' - The user-friendly name of an SdkType instance.
--
-- 'configurationProperties', 'sdkType_configurationProperties' - A list of configuration properties of an SdkType.
--
-- 'id', 'sdkType_id' - The identifier of an SdkType instance.
--
-- 'description', 'sdkType_description' - The description of an SdkType.
newSdkType ::
  SdkType
newSdkType :: SdkType
newSdkType =
  SdkType' :: Maybe Text
-> Maybe [SdkConfigurationProperty]
-> Maybe Text
-> Maybe Text
-> SdkType
SdkType'
    { $sel:friendlyName:SdkType' :: Maybe Text
friendlyName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:configurationProperties:SdkType' :: Maybe [SdkConfigurationProperty]
configurationProperties = Maybe [SdkConfigurationProperty]
forall a. Maybe a
Prelude.Nothing,
      $sel:id:SdkType' :: Maybe Text
id = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:description:SdkType' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The user-friendly name of an SdkType instance.
sdkType_friendlyName :: Lens.Lens' SdkType (Prelude.Maybe Prelude.Text)
sdkType_friendlyName :: (Maybe Text -> f (Maybe Text)) -> SdkType -> f SdkType
sdkType_friendlyName = (SdkType -> Maybe Text)
-> (SdkType -> Maybe Text -> SdkType)
-> Lens SdkType SdkType (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SdkType' {Maybe Text
friendlyName :: Maybe Text
$sel:friendlyName:SdkType' :: SdkType -> Maybe Text
friendlyName} -> Maybe Text
friendlyName) (\s :: SdkType
s@SdkType' {} Maybe Text
a -> SdkType
s {$sel:friendlyName:SdkType' :: Maybe Text
friendlyName = Maybe Text
a} :: SdkType)

-- | A list of configuration properties of an SdkType.
sdkType_configurationProperties :: Lens.Lens' SdkType (Prelude.Maybe [SdkConfigurationProperty])
sdkType_configurationProperties :: (Maybe [SdkConfigurationProperty]
 -> f (Maybe [SdkConfigurationProperty]))
-> SdkType -> f SdkType
sdkType_configurationProperties = (SdkType -> Maybe [SdkConfigurationProperty])
-> (SdkType -> Maybe [SdkConfigurationProperty] -> SdkType)
-> Lens
     SdkType
     SdkType
     (Maybe [SdkConfigurationProperty])
     (Maybe [SdkConfigurationProperty])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SdkType' {Maybe [SdkConfigurationProperty]
configurationProperties :: Maybe [SdkConfigurationProperty]
$sel:configurationProperties:SdkType' :: SdkType -> Maybe [SdkConfigurationProperty]
configurationProperties} -> Maybe [SdkConfigurationProperty]
configurationProperties) (\s :: SdkType
s@SdkType' {} Maybe [SdkConfigurationProperty]
a -> SdkType
s {$sel:configurationProperties:SdkType' :: Maybe [SdkConfigurationProperty]
configurationProperties = Maybe [SdkConfigurationProperty]
a} :: SdkType) ((Maybe [SdkConfigurationProperty]
  -> f (Maybe [SdkConfigurationProperty]))
 -> SdkType -> f SdkType)
-> ((Maybe [SdkConfigurationProperty]
     -> f (Maybe [SdkConfigurationProperty]))
    -> Maybe [SdkConfigurationProperty]
    -> f (Maybe [SdkConfigurationProperty]))
-> (Maybe [SdkConfigurationProperty]
    -> f (Maybe [SdkConfigurationProperty]))
-> SdkType
-> f SdkType
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [SdkConfigurationProperty]
  [SdkConfigurationProperty]
  [SdkConfigurationProperty]
  [SdkConfigurationProperty]
-> Iso
     (Maybe [SdkConfigurationProperty])
     (Maybe [SdkConfigurationProperty])
     (Maybe [SdkConfigurationProperty])
     (Maybe [SdkConfigurationProperty])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
  [SdkConfigurationProperty]
  [SdkConfigurationProperty]
  [SdkConfigurationProperty]
  [SdkConfigurationProperty]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The identifier of an SdkType instance.
sdkType_id :: Lens.Lens' SdkType (Prelude.Maybe Prelude.Text)
sdkType_id :: (Maybe Text -> f (Maybe Text)) -> SdkType -> f SdkType
sdkType_id = (SdkType -> Maybe Text)
-> (SdkType -> Maybe Text -> SdkType)
-> Lens SdkType SdkType (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SdkType' {Maybe Text
id :: Maybe Text
$sel:id:SdkType' :: SdkType -> Maybe Text
id} -> Maybe Text
id) (\s :: SdkType
s@SdkType' {} Maybe Text
a -> SdkType
s {$sel:id:SdkType' :: Maybe Text
id = Maybe Text
a} :: SdkType)

-- | The description of an SdkType.
sdkType_description :: Lens.Lens' SdkType (Prelude.Maybe Prelude.Text)
sdkType_description :: (Maybe Text -> f (Maybe Text)) -> SdkType -> f SdkType
sdkType_description = (SdkType -> Maybe Text)
-> (SdkType -> Maybe Text -> SdkType)
-> Lens SdkType SdkType (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SdkType' {Maybe Text
description :: Maybe Text
$sel:description:SdkType' :: SdkType -> Maybe Text
description} -> Maybe Text
description) (\s :: SdkType
s@SdkType' {} Maybe Text
a -> SdkType
s {$sel:description:SdkType' :: Maybe Text
description = Maybe Text
a} :: SdkType)

instance Core.FromJSON SdkType where
  parseJSON :: Value -> Parser SdkType
parseJSON =
    String -> (Object -> Parser SdkType) -> Value -> Parser SdkType
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"SdkType"
      ( \Object
x ->
          Maybe Text
-> Maybe [SdkConfigurationProperty]
-> Maybe Text
-> Maybe Text
-> SdkType
SdkType'
            (Maybe Text
 -> Maybe [SdkConfigurationProperty]
 -> Maybe Text
 -> Maybe Text
 -> SdkType)
-> Parser (Maybe Text)
-> Parser
     (Maybe [SdkConfigurationProperty]
      -> Maybe Text -> Maybe Text -> SdkType)
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
"friendlyName")
            Parser
  (Maybe [SdkConfigurationProperty]
   -> Maybe Text -> Maybe Text -> SdkType)
-> Parser (Maybe [SdkConfigurationProperty])
-> Parser (Maybe Text -> Maybe Text -> SdkType)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object -> Text -> Parser (Maybe (Maybe [SdkConfigurationProperty]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"configurationProperties"
                            Parser (Maybe (Maybe [SdkConfigurationProperty]))
-> Maybe [SdkConfigurationProperty]
-> Parser (Maybe [SdkConfigurationProperty])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [SdkConfigurationProperty]
forall a. Monoid a => a
Prelude.mempty
                        )
            Parser (Maybe Text -> Maybe Text -> SdkType)
-> Parser (Maybe Text) -> Parser (Maybe Text -> SdkType)
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
"id")
            Parser (Maybe Text -> SdkType)
-> Parser (Maybe Text) -> Parser SdkType
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
"description")
      )

instance Prelude.Hashable SdkType

instance Prelude.NFData SdkType