{-# 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.DocumentationVersion
-- 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.DocumentationVersion where

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

-- | A snapshot of the documentation of an API.
--
-- Publishing API documentation involves creating a documentation version
-- associated with an API stage and exporting the versioned documentation
-- to an external (e.g., OpenAPI) file.
--
-- <https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-documenting-api.html Documenting an API>,
-- DocumentationPart, DocumentationVersions
--
-- /See:/ 'newDocumentationVersion' smart constructor.
data DocumentationVersion = DocumentationVersion'
  { -- | The date when the API documentation snapshot is created.
    DocumentationVersion -> Maybe POSIX
createdDate :: Prelude.Maybe Core.POSIX,
    -- | The version identifier of the API documentation snapshot.
    DocumentationVersion -> Maybe Text
version :: Prelude.Maybe Prelude.Text,
    -- | The description of the API documentation snapshot.
    DocumentationVersion -> Maybe Text
description :: Prelude.Maybe Prelude.Text
  }
  deriving (DocumentationVersion -> DocumentationVersion -> Bool
(DocumentationVersion -> DocumentationVersion -> Bool)
-> (DocumentationVersion -> DocumentationVersion -> Bool)
-> Eq DocumentationVersion
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DocumentationVersion -> DocumentationVersion -> Bool
$c/= :: DocumentationVersion -> DocumentationVersion -> Bool
== :: DocumentationVersion -> DocumentationVersion -> Bool
$c== :: DocumentationVersion -> DocumentationVersion -> Bool
Prelude.Eq, ReadPrec [DocumentationVersion]
ReadPrec DocumentationVersion
Int -> ReadS DocumentationVersion
ReadS [DocumentationVersion]
(Int -> ReadS DocumentationVersion)
-> ReadS [DocumentationVersion]
-> ReadPrec DocumentationVersion
-> ReadPrec [DocumentationVersion]
-> Read DocumentationVersion
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DocumentationVersion]
$creadListPrec :: ReadPrec [DocumentationVersion]
readPrec :: ReadPrec DocumentationVersion
$creadPrec :: ReadPrec DocumentationVersion
readList :: ReadS [DocumentationVersion]
$creadList :: ReadS [DocumentationVersion]
readsPrec :: Int -> ReadS DocumentationVersion
$creadsPrec :: Int -> ReadS DocumentationVersion
Prelude.Read, Int -> DocumentationVersion -> ShowS
[DocumentationVersion] -> ShowS
DocumentationVersion -> String
(Int -> DocumentationVersion -> ShowS)
-> (DocumentationVersion -> String)
-> ([DocumentationVersion] -> ShowS)
-> Show DocumentationVersion
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DocumentationVersion] -> ShowS
$cshowList :: [DocumentationVersion] -> ShowS
show :: DocumentationVersion -> String
$cshow :: DocumentationVersion -> String
showsPrec :: Int -> DocumentationVersion -> ShowS
$cshowsPrec :: Int -> DocumentationVersion -> ShowS
Prelude.Show, (forall x. DocumentationVersion -> Rep DocumentationVersion x)
-> (forall x. Rep DocumentationVersion x -> DocumentationVersion)
-> Generic DocumentationVersion
forall x. Rep DocumentationVersion x -> DocumentationVersion
forall x. DocumentationVersion -> Rep DocumentationVersion x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DocumentationVersion x -> DocumentationVersion
$cfrom :: forall x. DocumentationVersion -> Rep DocumentationVersion x
Prelude.Generic)

-- |
-- Create a value of 'DocumentationVersion' 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:
--
-- 'createdDate', 'documentationVersion_createdDate' - The date when the API documentation snapshot is created.
--
-- 'version', 'documentationVersion_version' - The version identifier of the API documentation snapshot.
--
-- 'description', 'documentationVersion_description' - The description of the API documentation snapshot.
newDocumentationVersion ::
  DocumentationVersion
newDocumentationVersion :: DocumentationVersion
newDocumentationVersion =
  DocumentationVersion' :: Maybe POSIX -> Maybe Text -> Maybe Text -> DocumentationVersion
DocumentationVersion'
    { $sel:createdDate:DocumentationVersion' :: Maybe POSIX
createdDate =
        Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:version:DocumentationVersion' :: Maybe Text
version = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:description:DocumentationVersion' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The date when the API documentation snapshot is created.
documentationVersion_createdDate :: Lens.Lens' DocumentationVersion (Prelude.Maybe Prelude.UTCTime)
documentationVersion_createdDate :: (Maybe UTCTime -> f (Maybe UTCTime))
-> DocumentationVersion -> f DocumentationVersion
documentationVersion_createdDate = (DocumentationVersion -> Maybe POSIX)
-> (DocumentationVersion -> Maybe POSIX -> DocumentationVersion)
-> Lens
     DocumentationVersion
     DocumentationVersion
     (Maybe POSIX)
     (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DocumentationVersion' {Maybe POSIX
createdDate :: Maybe POSIX
$sel:createdDate:DocumentationVersion' :: DocumentationVersion -> Maybe POSIX
createdDate} -> Maybe POSIX
createdDate) (\s :: DocumentationVersion
s@DocumentationVersion' {} Maybe POSIX
a -> DocumentationVersion
s {$sel:createdDate:DocumentationVersion' :: Maybe POSIX
createdDate = Maybe POSIX
a} :: DocumentationVersion) ((Maybe POSIX -> f (Maybe POSIX))
 -> DocumentationVersion -> f DocumentationVersion)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> DocumentationVersion
-> f DocumentationVersion
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The version identifier of the API documentation snapshot.
documentationVersion_version :: Lens.Lens' DocumentationVersion (Prelude.Maybe Prelude.Text)
documentationVersion_version :: (Maybe Text -> f (Maybe Text))
-> DocumentationVersion -> f DocumentationVersion
documentationVersion_version = (DocumentationVersion -> Maybe Text)
-> (DocumentationVersion -> Maybe Text -> DocumentationVersion)
-> Lens
     DocumentationVersion DocumentationVersion (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DocumentationVersion' {Maybe Text
version :: Maybe Text
$sel:version:DocumentationVersion' :: DocumentationVersion -> Maybe Text
version} -> Maybe Text
version) (\s :: DocumentationVersion
s@DocumentationVersion' {} Maybe Text
a -> DocumentationVersion
s {$sel:version:DocumentationVersion' :: Maybe Text
version = Maybe Text
a} :: DocumentationVersion)

-- | The description of the API documentation snapshot.
documentationVersion_description :: Lens.Lens' DocumentationVersion (Prelude.Maybe Prelude.Text)
documentationVersion_description :: (Maybe Text -> f (Maybe Text))
-> DocumentationVersion -> f DocumentationVersion
documentationVersion_description = (DocumentationVersion -> Maybe Text)
-> (DocumentationVersion -> Maybe Text -> DocumentationVersion)
-> Lens
     DocumentationVersion DocumentationVersion (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DocumentationVersion' {Maybe Text
description :: Maybe Text
$sel:description:DocumentationVersion' :: DocumentationVersion -> Maybe Text
description} -> Maybe Text
description) (\s :: DocumentationVersion
s@DocumentationVersion' {} Maybe Text
a -> DocumentationVersion
s {$sel:description:DocumentationVersion' :: Maybe Text
description = Maybe Text
a} :: DocumentationVersion)

instance Core.FromJSON DocumentationVersion where
  parseJSON :: Value -> Parser DocumentationVersion
parseJSON =
    String
-> (Object -> Parser DocumentationVersion)
-> Value
-> Parser DocumentationVersion
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"DocumentationVersion"
      ( \Object
x ->
          Maybe POSIX -> Maybe Text -> Maybe Text -> DocumentationVersion
DocumentationVersion'
            (Maybe POSIX -> Maybe Text -> Maybe Text -> DocumentationVersion)
-> Parser (Maybe POSIX)
-> Parser (Maybe Text -> Maybe Text -> DocumentationVersion)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"createdDate")
            Parser (Maybe Text -> Maybe Text -> DocumentationVersion)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> DocumentationVersion)
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
"version")
            Parser (Maybe Text -> DocumentationVersion)
-> Parser (Maybe Text) -> Parser DocumentationVersion
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 DocumentationVersion

instance Prelude.NFData DocumentationVersion