{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- 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.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude

-- | A type of SDK that API Gateway can generate.
--
-- /See:/ 'newSdkType' smart constructor.
data SdkType = SdkType'
  { -- | A list of configuration properties of an SdkType.
    SdkType -> Maybe [SdkConfigurationProperty]
configurationProperties :: Prelude.Maybe [SdkConfigurationProperty],
    -- | The description of an SdkType.
    SdkType -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | The user-friendly name of an SdkType instance.
    SdkType -> Maybe Text
friendlyName :: Prelude.Maybe Prelude.Text,
    -- | The identifier of an SdkType instance.
    SdkType -> Maybe Text
id :: Prelude.Maybe Prelude.Text
  }
  deriving (SdkType -> SdkType -> Bool
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]
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
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. 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:
--
-- 'configurationProperties', 'sdkType_configurationProperties' - A list of configuration properties of an SdkType.
--
-- 'description', 'sdkType_description' - The description of an SdkType.
--
-- 'friendlyName', 'sdkType_friendlyName' - The user-friendly name of an SdkType instance.
--
-- 'id', 'sdkType_id' - The identifier of an SdkType instance.
newSdkType ::
  SdkType
newSdkType :: SdkType
newSdkType =
  SdkType'
    { $sel:configurationProperties:SdkType' :: Maybe [SdkConfigurationProperty]
configurationProperties = forall a. Maybe a
Prelude.Nothing,
      $sel:description:SdkType' :: Maybe Text
description = forall a. Maybe a
Prelude.Nothing,
      $sel:friendlyName:SdkType' :: Maybe Text
friendlyName = forall a. Maybe a
Prelude.Nothing,
      $sel:id:SdkType' :: Maybe Text
id = forall a. Maybe a
Prelude.Nothing
    }

-- | A list of configuration properties of an SdkType.
sdkType_configurationProperties :: Lens.Lens' SdkType (Prelude.Maybe [SdkConfigurationProperty])
sdkType_configurationProperties :: Lens' SdkType (Maybe [SdkConfigurationProperty])
sdkType_configurationProperties = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The description of an SdkType.
sdkType_description :: Lens.Lens' SdkType (Prelude.Maybe Prelude.Text)
sdkType_description :: Lens' SdkType (Maybe Text)
sdkType_description = 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)

-- | The user-friendly name of an SdkType instance.
sdkType_friendlyName :: Lens.Lens' SdkType (Prelude.Maybe Prelude.Text)
sdkType_friendlyName :: Lens' SdkType (Maybe Text)
sdkType_friendlyName = 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)

-- | The identifier of an SdkType instance.
sdkType_id :: Lens.Lens' SdkType (Prelude.Maybe Prelude.Text)
sdkType_id :: Lens' SdkType (Maybe Text)
sdkType_id = 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)

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

instance Prelude.Hashable SdkType where
  hashWithSalt :: Int -> SdkType -> Int
hashWithSalt Int
_salt SdkType' {Maybe [SdkConfigurationProperty]
Maybe Text
id :: Maybe Text
friendlyName :: Maybe Text
description :: Maybe Text
configurationProperties :: Maybe [SdkConfigurationProperty]
$sel:id:SdkType' :: SdkType -> Maybe Text
$sel:friendlyName:SdkType' :: SdkType -> Maybe Text
$sel:description:SdkType' :: SdkType -> Maybe Text
$sel:configurationProperties:SdkType' :: SdkType -> Maybe [SdkConfigurationProperty]
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [SdkConfigurationProperty]
configurationProperties
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
description
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
friendlyName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
id

instance Prelude.NFData SdkType where
  rnf :: SdkType -> ()
rnf SdkType' {Maybe [SdkConfigurationProperty]
Maybe Text
id :: Maybe Text
friendlyName :: Maybe Text
description :: Maybe Text
configurationProperties :: Maybe [SdkConfigurationProperty]
$sel:id:SdkType' :: SdkType -> Maybe Text
$sel:friendlyName:SdkType' :: SdkType -> Maybe Text
$sel:description:SdkType' :: SdkType -> Maybe Text
$sel:configurationProperties:SdkType' :: SdkType -> Maybe [SdkConfigurationProperty]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [SdkConfigurationProperty]
configurationProperties
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
description
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
friendlyName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
id