{-# 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 #-}
module Amazonka.APIGateway.Types.DocumentationPartLocation where
import Amazonka.APIGateway.Types.DocumentationPartType
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data DocumentationPartLocation = DocumentationPartLocation'
{
DocumentationPartLocation -> Maybe Text
path :: Prelude.Maybe Prelude.Text,
DocumentationPartLocation -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
DocumentationPartLocation -> Maybe Text
method :: Prelude.Maybe Prelude.Text,
DocumentationPartLocation -> Maybe Text
statusCode :: Prelude.Maybe Prelude.Text,
DocumentationPartLocation -> DocumentationPartType
type' :: DocumentationPartType
}
deriving (DocumentationPartLocation -> DocumentationPartLocation -> Bool
(DocumentationPartLocation -> DocumentationPartLocation -> Bool)
-> (DocumentationPartLocation -> DocumentationPartLocation -> Bool)
-> Eq DocumentationPartLocation
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DocumentationPartLocation -> DocumentationPartLocation -> Bool
$c/= :: DocumentationPartLocation -> DocumentationPartLocation -> Bool
== :: DocumentationPartLocation -> DocumentationPartLocation -> Bool
$c== :: DocumentationPartLocation -> DocumentationPartLocation -> Bool
Prelude.Eq, ReadPrec [DocumentationPartLocation]
ReadPrec DocumentationPartLocation
Int -> ReadS DocumentationPartLocation
ReadS [DocumentationPartLocation]
(Int -> ReadS DocumentationPartLocation)
-> ReadS [DocumentationPartLocation]
-> ReadPrec DocumentationPartLocation
-> ReadPrec [DocumentationPartLocation]
-> Read DocumentationPartLocation
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DocumentationPartLocation]
$creadListPrec :: ReadPrec [DocumentationPartLocation]
readPrec :: ReadPrec DocumentationPartLocation
$creadPrec :: ReadPrec DocumentationPartLocation
readList :: ReadS [DocumentationPartLocation]
$creadList :: ReadS [DocumentationPartLocation]
readsPrec :: Int -> ReadS DocumentationPartLocation
$creadsPrec :: Int -> ReadS DocumentationPartLocation
Prelude.Read, Int -> DocumentationPartLocation -> ShowS
[DocumentationPartLocation] -> ShowS
DocumentationPartLocation -> String
(Int -> DocumentationPartLocation -> ShowS)
-> (DocumentationPartLocation -> String)
-> ([DocumentationPartLocation] -> ShowS)
-> Show DocumentationPartLocation
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DocumentationPartLocation] -> ShowS
$cshowList :: [DocumentationPartLocation] -> ShowS
show :: DocumentationPartLocation -> String
$cshow :: DocumentationPartLocation -> String
showsPrec :: Int -> DocumentationPartLocation -> ShowS
$cshowsPrec :: Int -> DocumentationPartLocation -> ShowS
Prelude.Show, (forall x.
DocumentationPartLocation -> Rep DocumentationPartLocation x)
-> (forall x.
Rep DocumentationPartLocation x -> DocumentationPartLocation)
-> Generic DocumentationPartLocation
forall x.
Rep DocumentationPartLocation x -> DocumentationPartLocation
forall x.
DocumentationPartLocation -> Rep DocumentationPartLocation x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DocumentationPartLocation x -> DocumentationPartLocation
$cfrom :: forall x.
DocumentationPartLocation -> Rep DocumentationPartLocation x
Prelude.Generic)
newDocumentationPartLocation ::
DocumentationPartType ->
DocumentationPartLocation
newDocumentationPartLocation :: DocumentationPartType -> DocumentationPartLocation
newDocumentationPartLocation DocumentationPartType
pType_ =
DocumentationPartLocation' :: Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> DocumentationPartType
-> DocumentationPartLocation
DocumentationPartLocation'
{ $sel:path:DocumentationPartLocation' :: Maybe Text
path = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:name:DocumentationPartLocation' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:method:DocumentationPartLocation' :: Maybe Text
method = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:statusCode:DocumentationPartLocation' :: Maybe Text
statusCode = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:type':DocumentationPartLocation' :: DocumentationPartType
type' = DocumentationPartType
pType_
}
documentationPartLocation_path :: Lens.Lens' DocumentationPartLocation (Prelude.Maybe Prelude.Text)
documentationPartLocation_path :: (Maybe Text -> f (Maybe Text))
-> DocumentationPartLocation -> f DocumentationPartLocation
documentationPartLocation_path = (DocumentationPartLocation -> Maybe Text)
-> (DocumentationPartLocation
-> Maybe Text -> DocumentationPartLocation)
-> Lens
DocumentationPartLocation
DocumentationPartLocation
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DocumentationPartLocation' {Maybe Text
path :: Maybe Text
$sel:path:DocumentationPartLocation' :: DocumentationPartLocation -> Maybe Text
path} -> Maybe Text
path) (\s :: DocumentationPartLocation
s@DocumentationPartLocation' {} Maybe Text
a -> DocumentationPartLocation
s {$sel:path:DocumentationPartLocation' :: Maybe Text
path = Maybe Text
a} :: DocumentationPartLocation)
documentationPartLocation_name :: Lens.Lens' DocumentationPartLocation (Prelude.Maybe Prelude.Text)
documentationPartLocation_name :: (Maybe Text -> f (Maybe Text))
-> DocumentationPartLocation -> f DocumentationPartLocation
documentationPartLocation_name = (DocumentationPartLocation -> Maybe Text)
-> (DocumentationPartLocation
-> Maybe Text -> DocumentationPartLocation)
-> Lens
DocumentationPartLocation
DocumentationPartLocation
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DocumentationPartLocation' {Maybe Text
name :: Maybe Text
$sel:name:DocumentationPartLocation' :: DocumentationPartLocation -> Maybe Text
name} -> Maybe Text
name) (\s :: DocumentationPartLocation
s@DocumentationPartLocation' {} Maybe Text
a -> DocumentationPartLocation
s {$sel:name:DocumentationPartLocation' :: Maybe Text
name = Maybe Text
a} :: DocumentationPartLocation)
documentationPartLocation_method :: Lens.Lens' DocumentationPartLocation (Prelude.Maybe Prelude.Text)
documentationPartLocation_method :: (Maybe Text -> f (Maybe Text))
-> DocumentationPartLocation -> f DocumentationPartLocation
documentationPartLocation_method = (DocumentationPartLocation -> Maybe Text)
-> (DocumentationPartLocation
-> Maybe Text -> DocumentationPartLocation)
-> Lens
DocumentationPartLocation
DocumentationPartLocation
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DocumentationPartLocation' {Maybe Text
method :: Maybe Text
$sel:method:DocumentationPartLocation' :: DocumentationPartLocation -> Maybe Text
method} -> Maybe Text
method) (\s :: DocumentationPartLocation
s@DocumentationPartLocation' {} Maybe Text
a -> DocumentationPartLocation
s {$sel:method:DocumentationPartLocation' :: Maybe Text
method = Maybe Text
a} :: DocumentationPartLocation)
documentationPartLocation_statusCode :: Lens.Lens' DocumentationPartLocation (Prelude.Maybe Prelude.Text)
documentationPartLocation_statusCode :: (Maybe Text -> f (Maybe Text))
-> DocumentationPartLocation -> f DocumentationPartLocation
documentationPartLocation_statusCode = (DocumentationPartLocation -> Maybe Text)
-> (DocumentationPartLocation
-> Maybe Text -> DocumentationPartLocation)
-> Lens
DocumentationPartLocation
DocumentationPartLocation
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DocumentationPartLocation' {Maybe Text
statusCode :: Maybe Text
$sel:statusCode:DocumentationPartLocation' :: DocumentationPartLocation -> Maybe Text
statusCode} -> Maybe Text
statusCode) (\s :: DocumentationPartLocation
s@DocumentationPartLocation' {} Maybe Text
a -> DocumentationPartLocation
s {$sel:statusCode:DocumentationPartLocation' :: Maybe Text
statusCode = Maybe Text
a} :: DocumentationPartLocation)
documentationPartLocation_type :: Lens.Lens' DocumentationPartLocation DocumentationPartType
documentationPartLocation_type :: (DocumentationPartType -> f DocumentationPartType)
-> DocumentationPartLocation -> f DocumentationPartLocation
documentationPartLocation_type = (DocumentationPartLocation -> DocumentationPartType)
-> (DocumentationPartLocation
-> DocumentationPartType -> DocumentationPartLocation)
-> Lens
DocumentationPartLocation
DocumentationPartLocation
DocumentationPartType
DocumentationPartType
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DocumentationPartLocation' {DocumentationPartType
type' :: DocumentationPartType
$sel:type':DocumentationPartLocation' :: DocumentationPartLocation -> DocumentationPartType
type'} -> DocumentationPartType
type') (\s :: DocumentationPartLocation
s@DocumentationPartLocation' {} DocumentationPartType
a -> DocumentationPartLocation
s {$sel:type':DocumentationPartLocation' :: DocumentationPartType
type' = DocumentationPartType
a} :: DocumentationPartLocation)
instance Core.FromJSON DocumentationPartLocation where
parseJSON :: Value -> Parser DocumentationPartLocation
parseJSON =
String
-> (Object -> Parser DocumentationPartLocation)
-> Value
-> Parser DocumentationPartLocation
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"DocumentationPartLocation"
( \Object
x ->
Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> DocumentationPartType
-> DocumentationPartLocation
DocumentationPartLocation'
(Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> DocumentationPartType
-> DocumentationPartLocation)
-> Parser (Maybe Text)
-> Parser
(Maybe Text
-> Maybe Text
-> Maybe Text
-> DocumentationPartType
-> DocumentationPartLocation)
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
"path")
Parser
(Maybe Text
-> Maybe Text
-> Maybe Text
-> DocumentationPartType
-> DocumentationPartLocation)
-> Parser (Maybe Text)
-> Parser
(Maybe Text
-> Maybe Text
-> DocumentationPartType
-> DocumentationPartLocation)
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
"name")
Parser
(Maybe Text
-> Maybe Text
-> DocumentationPartType
-> DocumentationPartLocation)
-> Parser (Maybe Text)
-> Parser
(Maybe Text -> DocumentationPartType -> DocumentationPartLocation)
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
"method")
Parser
(Maybe Text -> DocumentationPartType -> DocumentationPartLocation)
-> Parser (Maybe Text)
-> Parser (DocumentationPartType -> DocumentationPartLocation)
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
"statusCode")
Parser (DocumentationPartType -> DocumentationPartLocation)
-> Parser DocumentationPartType -> Parser DocumentationPartLocation
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser DocumentationPartType
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"type")
)
instance Prelude.Hashable DocumentationPartLocation
instance Prelude.NFData DocumentationPartLocation
instance Core.ToJSON DocumentationPartLocation where
toJSON :: DocumentationPartLocation -> Value
toJSON DocumentationPartLocation' {Maybe Text
DocumentationPartType
type' :: DocumentationPartType
statusCode :: Maybe Text
method :: Maybe Text
name :: Maybe Text
path :: Maybe Text
$sel:type':DocumentationPartLocation' :: DocumentationPartLocation -> DocumentationPartType
$sel:statusCode:DocumentationPartLocation' :: DocumentationPartLocation -> Maybe Text
$sel:method:DocumentationPartLocation' :: DocumentationPartLocation -> Maybe Text
$sel:name:DocumentationPartLocation' :: DocumentationPartLocation -> Maybe Text
$sel:path:DocumentationPartLocation' :: DocumentationPartLocation -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"path" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
path,
(Text
"name" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
name,
(Text
"method" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
method,
(Text
"statusCode" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
statusCode,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"type" Text -> DocumentationPartType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= DocumentationPartType
type')
]
)