{-# 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.ApiGatewayV2.Types.Api
-- 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.ApiGatewayV2.Types.Api where

import Amazonka.ApiGatewayV2.Types.Cors
import Amazonka.ApiGatewayV2.Types.ProtocolType
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Represents an API.
--
-- /See:/ 'newApi' smart constructor.
data Api = Api'
  { -- | The API ID.
    Api -> Maybe Text
apiId :: Prelude.Maybe Prelude.Text,
    -- | Specifies whether clients can invoke your API by using the default
    -- execute-api endpoint. By default, clients can invoke your API with the
    -- default https:\/\/{api_id}.execute-api.{region}.amazonaws.com endpoint.
    -- To require that clients use a custom domain name to invoke your API,
    -- disable the default endpoint.
    Api -> Maybe Bool
disableExecuteApiEndpoint :: Prelude.Maybe Prelude.Bool,
    -- | The URI of the API, of the form
    -- {api-id}.execute-api.{region}.amazonaws.com. The stage name is typically
    -- appended to this URI to form a complete path to a deployed API stage.
    Api -> Maybe Text
apiEndpoint :: Prelude.Maybe Prelude.Text,
    -- | The warning messages reported when failonwarnings is turned on during
    -- API import.
    Api -> Maybe [Text]
warnings :: Prelude.Maybe [Prelude.Text],
    -- | The timestamp when the API was created.
    Api -> Maybe POSIX
createdDate :: Prelude.Maybe Core.POSIX,
    -- | A version identifier for the API.
    Api -> Maybe Text
version :: Prelude.Maybe Prelude.Text,
    -- | Specifies whether an API is managed by API Gateway. You can\'t update or
    -- delete a managed API by using API Gateway. A managed API can be deleted
    -- only through the tooling or service that created it.
    Api -> Maybe Bool
apiGatewayManaged :: Prelude.Maybe Prelude.Bool,
    -- | An API key selection expression. Supported only for WebSocket APIs. See
    -- <https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-websocket-api-selection-expressions.html#apigateway-websocket-api-apikey-selection-expressions API Key Selection Expressions>.
    Api -> Maybe Text
apiKeySelectionExpression :: Prelude.Maybe Prelude.Text,
    -- | A CORS configuration. Supported only for HTTP APIs.
    Api -> Maybe Cors
corsConfiguration :: Prelude.Maybe Cors,
    -- | The validation information during API import. This may include
    -- particular properties of your OpenAPI definition which are ignored
    -- during import. Supported only for HTTP APIs.
    Api -> Maybe [Text]
importInfo :: Prelude.Maybe [Prelude.Text],
    -- | Avoid validating models when creating a deployment. Supported only for
    -- WebSocket APIs.
    Api -> Maybe Bool
disableSchemaValidation :: Prelude.Maybe Prelude.Bool,
    -- | The description of the API.
    Api -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | A collection of tags associated with the API.
    Api -> Maybe (HashMap Text Text)
tags :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | The route selection expression for the API. For HTTP APIs, the
    -- routeSelectionExpression must be ${request.method} ${request.path}. If
    -- not provided, this will be the default for HTTP APIs. This property is
    -- required for WebSocket APIs.
    Api -> Text
routeSelectionExpression :: Prelude.Text,
    -- | The name of the API.
    Api -> Text
name :: Prelude.Text,
    -- | The API protocol.
    Api -> ProtocolType
protocolType :: ProtocolType
  }
  deriving (Api -> Api -> Bool
(Api -> Api -> Bool) -> (Api -> Api -> Bool) -> Eq Api
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Api -> Api -> Bool
$c/= :: Api -> Api -> Bool
== :: Api -> Api -> Bool
$c== :: Api -> Api -> Bool
Prelude.Eq, ReadPrec [Api]
ReadPrec Api
Int -> ReadS Api
ReadS [Api]
(Int -> ReadS Api)
-> ReadS [Api] -> ReadPrec Api -> ReadPrec [Api] -> Read Api
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Api]
$creadListPrec :: ReadPrec [Api]
readPrec :: ReadPrec Api
$creadPrec :: ReadPrec Api
readList :: ReadS [Api]
$creadList :: ReadS [Api]
readsPrec :: Int -> ReadS Api
$creadsPrec :: Int -> ReadS Api
Prelude.Read, Int -> Api -> ShowS
[Api] -> ShowS
Api -> String
(Int -> Api -> ShowS)
-> (Api -> String) -> ([Api] -> ShowS) -> Show Api
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Api] -> ShowS
$cshowList :: [Api] -> ShowS
show :: Api -> String
$cshow :: Api -> String
showsPrec :: Int -> Api -> ShowS
$cshowsPrec :: Int -> Api -> ShowS
Prelude.Show, (forall x. Api -> Rep Api x)
-> (forall x. Rep Api x -> Api) -> Generic Api
forall x. Rep Api x -> Api
forall x. Api -> Rep Api x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Api x -> Api
$cfrom :: forall x. Api -> Rep Api x
Prelude.Generic)

-- |
-- Create a value of 'Api' 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:
--
-- 'apiId', 'api_apiId' - The API ID.
--
-- 'disableExecuteApiEndpoint', 'api_disableExecuteApiEndpoint' - Specifies whether clients can invoke your API by using the default
-- execute-api endpoint. By default, clients can invoke your API with the
-- default https:\/\/{api_id}.execute-api.{region}.amazonaws.com endpoint.
-- To require that clients use a custom domain name to invoke your API,
-- disable the default endpoint.
--
-- 'apiEndpoint', 'api_apiEndpoint' - The URI of the API, of the form
-- {api-id}.execute-api.{region}.amazonaws.com. The stage name is typically
-- appended to this URI to form a complete path to a deployed API stage.
--
-- 'warnings', 'api_warnings' - The warning messages reported when failonwarnings is turned on during
-- API import.
--
-- 'createdDate', 'api_createdDate' - The timestamp when the API was created.
--
-- 'version', 'api_version' - A version identifier for the API.
--
-- 'apiGatewayManaged', 'api_apiGatewayManaged' - Specifies whether an API is managed by API Gateway. You can\'t update or
-- delete a managed API by using API Gateway. A managed API can be deleted
-- only through the tooling or service that created it.
--
-- 'apiKeySelectionExpression', 'api_apiKeySelectionExpression' - An API key selection expression. Supported only for WebSocket APIs. See
-- <https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-websocket-api-selection-expressions.html#apigateway-websocket-api-apikey-selection-expressions API Key Selection Expressions>.
--
-- 'corsConfiguration', 'api_corsConfiguration' - A CORS configuration. Supported only for HTTP APIs.
--
-- 'importInfo', 'api_importInfo' - The validation information during API import. This may include
-- particular properties of your OpenAPI definition which are ignored
-- during import. Supported only for HTTP APIs.
--
-- 'disableSchemaValidation', 'api_disableSchemaValidation' - Avoid validating models when creating a deployment. Supported only for
-- WebSocket APIs.
--
-- 'description', 'api_description' - The description of the API.
--
-- 'tags', 'api_tags' - A collection of tags associated with the API.
--
-- 'routeSelectionExpression', 'api_routeSelectionExpression' - The route selection expression for the API. For HTTP APIs, the
-- routeSelectionExpression must be ${request.method} ${request.path}. If
-- not provided, this will be the default for HTTP APIs. This property is
-- required for WebSocket APIs.
--
-- 'name', 'api_name' - The name of the API.
--
-- 'protocolType', 'api_protocolType' - The API protocol.
newApi ::
  -- | 'routeSelectionExpression'
  Prelude.Text ->
  -- | 'name'
  Prelude.Text ->
  -- | 'protocolType'
  ProtocolType ->
  Api
newApi :: Text -> Text -> ProtocolType -> Api
newApi
  Text
pRouteSelectionExpression_
  Text
pName_
  ProtocolType
pProtocolType_ =
    Api' :: Maybe Text
-> Maybe Bool
-> Maybe Text
-> Maybe [Text]
-> Maybe POSIX
-> Maybe Text
-> Maybe Bool
-> Maybe Text
-> Maybe Cors
-> Maybe [Text]
-> Maybe Bool
-> Maybe Text
-> Maybe (HashMap Text Text)
-> Text
-> Text
-> ProtocolType
-> Api
Api'
      { $sel:apiId:Api' :: Maybe Text
apiId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:disableExecuteApiEndpoint:Api' :: Maybe Bool
disableExecuteApiEndpoint = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
        $sel:apiEndpoint:Api' :: Maybe Text
apiEndpoint = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:warnings:Api' :: Maybe [Text]
warnings = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
        $sel:createdDate:Api' :: Maybe POSIX
createdDate = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
        $sel:version:Api' :: Maybe Text
version = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:apiGatewayManaged:Api' :: Maybe Bool
apiGatewayManaged = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
        $sel:apiKeySelectionExpression:Api' :: Maybe Text
apiKeySelectionExpression = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:corsConfiguration:Api' :: Maybe Cors
corsConfiguration = Maybe Cors
forall a. Maybe a
Prelude.Nothing,
        $sel:importInfo:Api' :: Maybe [Text]
importInfo = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
        $sel:disableSchemaValidation:Api' :: Maybe Bool
disableSchemaValidation = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
        $sel:description:Api' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:tags:Api' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing,
        $sel:routeSelectionExpression:Api' :: Text
routeSelectionExpression =
          Text
pRouteSelectionExpression_,
        $sel:name:Api' :: Text
name = Text
pName_,
        $sel:protocolType:Api' :: ProtocolType
protocolType = ProtocolType
pProtocolType_
      }

-- | The API ID.
api_apiId :: Lens.Lens' Api (Prelude.Maybe Prelude.Text)
api_apiId :: (Maybe Text -> f (Maybe Text)) -> Api -> f Api
api_apiId = (Api -> Maybe Text)
-> (Api -> Maybe Text -> Api)
-> Lens Api Api (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Api' {Maybe Text
apiId :: Maybe Text
$sel:apiId:Api' :: Api -> Maybe Text
apiId} -> Maybe Text
apiId) (\s :: Api
s@Api' {} Maybe Text
a -> Api
s {$sel:apiId:Api' :: Maybe Text
apiId = Maybe Text
a} :: Api)

-- | Specifies whether clients can invoke your API by using the default
-- execute-api endpoint. By default, clients can invoke your API with the
-- default https:\/\/{api_id}.execute-api.{region}.amazonaws.com endpoint.
-- To require that clients use a custom domain name to invoke your API,
-- disable the default endpoint.
api_disableExecuteApiEndpoint :: Lens.Lens' Api (Prelude.Maybe Prelude.Bool)
api_disableExecuteApiEndpoint :: (Maybe Bool -> f (Maybe Bool)) -> Api -> f Api
api_disableExecuteApiEndpoint = (Api -> Maybe Bool)
-> (Api -> Maybe Bool -> Api)
-> Lens Api Api (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Api' {Maybe Bool
disableExecuteApiEndpoint :: Maybe Bool
$sel:disableExecuteApiEndpoint:Api' :: Api -> Maybe Bool
disableExecuteApiEndpoint} -> Maybe Bool
disableExecuteApiEndpoint) (\s :: Api
s@Api' {} Maybe Bool
a -> Api
s {$sel:disableExecuteApiEndpoint:Api' :: Maybe Bool
disableExecuteApiEndpoint = Maybe Bool
a} :: Api)

-- | The URI of the API, of the form
-- {api-id}.execute-api.{region}.amazonaws.com. The stage name is typically
-- appended to this URI to form a complete path to a deployed API stage.
api_apiEndpoint :: Lens.Lens' Api (Prelude.Maybe Prelude.Text)
api_apiEndpoint :: (Maybe Text -> f (Maybe Text)) -> Api -> f Api
api_apiEndpoint = (Api -> Maybe Text)
-> (Api -> Maybe Text -> Api)
-> Lens Api Api (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Api' {Maybe Text
apiEndpoint :: Maybe Text
$sel:apiEndpoint:Api' :: Api -> Maybe Text
apiEndpoint} -> Maybe Text
apiEndpoint) (\s :: Api
s@Api' {} Maybe Text
a -> Api
s {$sel:apiEndpoint:Api' :: Maybe Text
apiEndpoint = Maybe Text
a} :: Api)

-- | The warning messages reported when failonwarnings is turned on during
-- API import.
api_warnings :: Lens.Lens' Api (Prelude.Maybe [Prelude.Text])
api_warnings :: (Maybe [Text] -> f (Maybe [Text])) -> Api -> f Api
api_warnings = (Api -> Maybe [Text])
-> (Api -> Maybe [Text] -> Api)
-> Lens Api Api (Maybe [Text]) (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Api' {Maybe [Text]
warnings :: Maybe [Text]
$sel:warnings:Api' :: Api -> Maybe [Text]
warnings} -> Maybe [Text]
warnings) (\s :: Api
s@Api' {} Maybe [Text]
a -> Api
s {$sel:warnings:Api' :: Maybe [Text]
warnings = Maybe [Text]
a} :: Api) ((Maybe [Text] -> f (Maybe [Text])) -> Api -> f Api)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> Api
-> f Api
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
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 [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The timestamp when the API was created.
api_createdDate :: Lens.Lens' Api (Prelude.Maybe Prelude.UTCTime)
api_createdDate :: (Maybe UTCTime -> f (Maybe UTCTime)) -> Api -> f Api
api_createdDate = (Api -> Maybe POSIX)
-> (Api -> Maybe POSIX -> Api)
-> Lens Api Api (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Api' {Maybe POSIX
createdDate :: Maybe POSIX
$sel:createdDate:Api' :: Api -> Maybe POSIX
createdDate} -> Maybe POSIX
createdDate) (\s :: Api
s@Api' {} Maybe POSIX
a -> Api
s {$sel:createdDate:Api' :: Maybe POSIX
createdDate = Maybe POSIX
a} :: Api) ((Maybe POSIX -> f (Maybe POSIX)) -> Api -> f Api)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> Api
-> f Api
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

-- | A version identifier for the API.
api_version :: Lens.Lens' Api (Prelude.Maybe Prelude.Text)
api_version :: (Maybe Text -> f (Maybe Text)) -> Api -> f Api
api_version = (Api -> Maybe Text)
-> (Api -> Maybe Text -> Api)
-> Lens Api Api (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Api' {Maybe Text
version :: Maybe Text
$sel:version:Api' :: Api -> Maybe Text
version} -> Maybe Text
version) (\s :: Api
s@Api' {} Maybe Text
a -> Api
s {$sel:version:Api' :: Maybe Text
version = Maybe Text
a} :: Api)

-- | Specifies whether an API is managed by API Gateway. You can\'t update or
-- delete a managed API by using API Gateway. A managed API can be deleted
-- only through the tooling or service that created it.
api_apiGatewayManaged :: Lens.Lens' Api (Prelude.Maybe Prelude.Bool)
api_apiGatewayManaged :: (Maybe Bool -> f (Maybe Bool)) -> Api -> f Api
api_apiGatewayManaged = (Api -> Maybe Bool)
-> (Api -> Maybe Bool -> Api)
-> Lens Api Api (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Api' {Maybe Bool
apiGatewayManaged :: Maybe Bool
$sel:apiGatewayManaged:Api' :: Api -> Maybe Bool
apiGatewayManaged} -> Maybe Bool
apiGatewayManaged) (\s :: Api
s@Api' {} Maybe Bool
a -> Api
s {$sel:apiGatewayManaged:Api' :: Maybe Bool
apiGatewayManaged = Maybe Bool
a} :: Api)

-- | An API key selection expression. Supported only for WebSocket APIs. See
-- <https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-websocket-api-selection-expressions.html#apigateway-websocket-api-apikey-selection-expressions API Key Selection Expressions>.
api_apiKeySelectionExpression :: Lens.Lens' Api (Prelude.Maybe Prelude.Text)
api_apiKeySelectionExpression :: (Maybe Text -> f (Maybe Text)) -> Api -> f Api
api_apiKeySelectionExpression = (Api -> Maybe Text)
-> (Api -> Maybe Text -> Api)
-> Lens Api Api (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Api' {Maybe Text
apiKeySelectionExpression :: Maybe Text
$sel:apiKeySelectionExpression:Api' :: Api -> Maybe Text
apiKeySelectionExpression} -> Maybe Text
apiKeySelectionExpression) (\s :: Api
s@Api' {} Maybe Text
a -> Api
s {$sel:apiKeySelectionExpression:Api' :: Maybe Text
apiKeySelectionExpression = Maybe Text
a} :: Api)

-- | A CORS configuration. Supported only for HTTP APIs.
api_corsConfiguration :: Lens.Lens' Api (Prelude.Maybe Cors)
api_corsConfiguration :: (Maybe Cors -> f (Maybe Cors)) -> Api -> f Api
api_corsConfiguration = (Api -> Maybe Cors)
-> (Api -> Maybe Cors -> Api)
-> Lens Api Api (Maybe Cors) (Maybe Cors)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Api' {Maybe Cors
corsConfiguration :: Maybe Cors
$sel:corsConfiguration:Api' :: Api -> Maybe Cors
corsConfiguration} -> Maybe Cors
corsConfiguration) (\s :: Api
s@Api' {} Maybe Cors
a -> Api
s {$sel:corsConfiguration:Api' :: Maybe Cors
corsConfiguration = Maybe Cors
a} :: Api)

-- | The validation information during API import. This may include
-- particular properties of your OpenAPI definition which are ignored
-- during import. Supported only for HTTP APIs.
api_importInfo :: Lens.Lens' Api (Prelude.Maybe [Prelude.Text])
api_importInfo :: (Maybe [Text] -> f (Maybe [Text])) -> Api -> f Api
api_importInfo = (Api -> Maybe [Text])
-> (Api -> Maybe [Text] -> Api)
-> Lens Api Api (Maybe [Text]) (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Api' {Maybe [Text]
importInfo :: Maybe [Text]
$sel:importInfo:Api' :: Api -> Maybe [Text]
importInfo} -> Maybe [Text]
importInfo) (\s :: Api
s@Api' {} Maybe [Text]
a -> Api
s {$sel:importInfo:Api' :: Maybe [Text]
importInfo = Maybe [Text]
a} :: Api) ((Maybe [Text] -> f (Maybe [Text])) -> Api -> f Api)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> Api
-> f Api
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
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 [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Avoid validating models when creating a deployment. Supported only for
-- WebSocket APIs.
api_disableSchemaValidation :: Lens.Lens' Api (Prelude.Maybe Prelude.Bool)
api_disableSchemaValidation :: (Maybe Bool -> f (Maybe Bool)) -> Api -> f Api
api_disableSchemaValidation = (Api -> Maybe Bool)
-> (Api -> Maybe Bool -> Api)
-> Lens Api Api (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Api' {Maybe Bool
disableSchemaValidation :: Maybe Bool
$sel:disableSchemaValidation:Api' :: Api -> Maybe Bool
disableSchemaValidation} -> Maybe Bool
disableSchemaValidation) (\s :: Api
s@Api' {} Maybe Bool
a -> Api
s {$sel:disableSchemaValidation:Api' :: Maybe Bool
disableSchemaValidation = Maybe Bool
a} :: Api)

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

-- | A collection of tags associated with the API.
api_tags :: Lens.Lens' Api (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
api_tags :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> Api -> f Api
api_tags = (Api -> Maybe (HashMap Text Text))
-> (Api -> Maybe (HashMap Text Text) -> Api)
-> Lens
     Api Api (Maybe (HashMap Text Text)) (Maybe (HashMap Text Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Api' {Maybe (HashMap Text Text)
tags :: Maybe (HashMap Text Text)
$sel:tags:Api' :: Api -> Maybe (HashMap Text Text)
tags} -> Maybe (HashMap Text Text)
tags) (\s :: Api
s@Api' {} Maybe (HashMap Text Text)
a -> Api
s {$sel:tags:Api' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
a} :: Api) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
 -> Api -> f Api)
-> ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
    -> Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> Api
-> f Api
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
-> Iso
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
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
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The route selection expression for the API. For HTTP APIs, the
-- routeSelectionExpression must be ${request.method} ${request.path}. If
-- not provided, this will be the default for HTTP APIs. This property is
-- required for WebSocket APIs.
api_routeSelectionExpression :: Lens.Lens' Api Prelude.Text
api_routeSelectionExpression :: (Text -> f Text) -> Api -> f Api
api_routeSelectionExpression = (Api -> Text) -> (Api -> Text -> Api) -> Lens Api Api Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Api' {Text
routeSelectionExpression :: Text
$sel:routeSelectionExpression:Api' :: Api -> Text
routeSelectionExpression} -> Text
routeSelectionExpression) (\s :: Api
s@Api' {} Text
a -> Api
s {$sel:routeSelectionExpression:Api' :: Text
routeSelectionExpression = Text
a} :: Api)

-- | The name of the API.
api_name :: Lens.Lens' Api Prelude.Text
api_name :: (Text -> f Text) -> Api -> f Api
api_name = (Api -> Text) -> (Api -> Text -> Api) -> Lens Api Api Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Api' {Text
name :: Text
$sel:name:Api' :: Api -> Text
name} -> Text
name) (\s :: Api
s@Api' {} Text
a -> Api
s {$sel:name:Api' :: Text
name = Text
a} :: Api)

-- | The API protocol.
api_protocolType :: Lens.Lens' Api ProtocolType
api_protocolType :: (ProtocolType -> f ProtocolType) -> Api -> f Api
api_protocolType = (Api -> ProtocolType)
-> (Api -> ProtocolType -> Api)
-> Lens Api Api ProtocolType ProtocolType
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Api' {ProtocolType
protocolType :: ProtocolType
$sel:protocolType:Api' :: Api -> ProtocolType
protocolType} -> ProtocolType
protocolType) (\s :: Api
s@Api' {} ProtocolType
a -> Api
s {$sel:protocolType:Api' :: ProtocolType
protocolType = ProtocolType
a} :: Api)

instance Core.FromJSON Api where
  parseJSON :: Value -> Parser Api
parseJSON =
    String -> (Object -> Parser Api) -> Value -> Parser Api
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"Api"
      ( \Object
x ->
          Maybe Text
-> Maybe Bool
-> Maybe Text
-> Maybe [Text]
-> Maybe POSIX
-> Maybe Text
-> Maybe Bool
-> Maybe Text
-> Maybe Cors
-> Maybe [Text]
-> Maybe Bool
-> Maybe Text
-> Maybe (HashMap Text Text)
-> Text
-> Text
-> ProtocolType
-> Api
Api'
            (Maybe Text
 -> Maybe Bool
 -> Maybe Text
 -> Maybe [Text]
 -> Maybe POSIX
 -> Maybe Text
 -> Maybe Bool
 -> Maybe Text
 -> Maybe Cors
 -> Maybe [Text]
 -> Maybe Bool
 -> Maybe Text
 -> Maybe (HashMap Text Text)
 -> Text
 -> Text
 -> ProtocolType
 -> Api)
-> Parser (Maybe Text)
-> Parser
     (Maybe Bool
      -> Maybe Text
      -> Maybe [Text]
      -> Maybe POSIX
      -> Maybe Text
      -> Maybe Bool
      -> Maybe Text
      -> Maybe Cors
      -> Maybe [Text]
      -> Maybe Bool
      -> Maybe Text
      -> Maybe (HashMap Text Text)
      -> Text
      -> Text
      -> ProtocolType
      -> Api)
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
"apiId")
            Parser
  (Maybe Bool
   -> Maybe Text
   -> Maybe [Text]
   -> Maybe POSIX
   -> Maybe Text
   -> Maybe Bool
   -> Maybe Text
   -> Maybe Cors
   -> Maybe [Text]
   -> Maybe Bool
   -> Maybe Text
   -> Maybe (HashMap Text Text)
   -> Text
   -> Text
   -> ProtocolType
   -> Api)
-> Parser (Maybe Bool)
-> Parser
     (Maybe Text
      -> Maybe [Text]
      -> Maybe POSIX
      -> Maybe Text
      -> Maybe Bool
      -> Maybe Text
      -> Maybe Cors
      -> Maybe [Text]
      -> Maybe Bool
      -> Maybe Text
      -> Maybe (HashMap Text Text)
      -> Text
      -> Text
      -> ProtocolType
      -> Api)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"disableExecuteApiEndpoint")
            Parser
  (Maybe Text
   -> Maybe [Text]
   -> Maybe POSIX
   -> Maybe Text
   -> Maybe Bool
   -> Maybe Text
   -> Maybe Cors
   -> Maybe [Text]
   -> Maybe Bool
   -> Maybe Text
   -> Maybe (HashMap Text Text)
   -> Text
   -> Text
   -> ProtocolType
   -> Api)
-> Parser (Maybe Text)
-> Parser
     (Maybe [Text]
      -> Maybe POSIX
      -> Maybe Text
      -> Maybe Bool
      -> Maybe Text
      -> Maybe Cors
      -> Maybe [Text]
      -> Maybe Bool
      -> Maybe Text
      -> Maybe (HashMap Text Text)
      -> Text
      -> Text
      -> ProtocolType
      -> Api)
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
"apiEndpoint")
            Parser
  (Maybe [Text]
   -> Maybe POSIX
   -> Maybe Text
   -> Maybe Bool
   -> Maybe Text
   -> Maybe Cors
   -> Maybe [Text]
   -> Maybe Bool
   -> Maybe Text
   -> Maybe (HashMap Text Text)
   -> Text
   -> Text
   -> ProtocolType
   -> Api)
-> Parser (Maybe [Text])
-> Parser
     (Maybe POSIX
      -> Maybe Text
      -> Maybe Bool
      -> Maybe Text
      -> Maybe Cors
      -> Maybe [Text]
      -> Maybe Bool
      -> Maybe Text
      -> Maybe (HashMap Text Text)
      -> Text
      -> Text
      -> ProtocolType
      -> Api)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe [Text]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"warnings" Parser (Maybe (Maybe [Text]))
-> Maybe [Text] -> Parser (Maybe [Text])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [Text]
forall a. Monoid a => a
Prelude.mempty)
            Parser
  (Maybe POSIX
   -> Maybe Text
   -> Maybe Bool
   -> Maybe Text
   -> Maybe Cors
   -> Maybe [Text]
   -> Maybe Bool
   -> Maybe Text
   -> Maybe (HashMap Text Text)
   -> Text
   -> Text
   -> ProtocolType
   -> Api)
-> Parser (Maybe POSIX)
-> Parser
     (Maybe Text
      -> Maybe Bool
      -> Maybe Text
      -> Maybe Cors
      -> Maybe [Text]
      -> Maybe Bool
      -> Maybe Text
      -> Maybe (HashMap Text Text)
      -> Text
      -> Text
      -> ProtocolType
      -> Api)
forall (f :: * -> *) a b. Applicative f => 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 Bool
   -> Maybe Text
   -> Maybe Cors
   -> Maybe [Text]
   -> Maybe Bool
   -> Maybe Text
   -> Maybe (HashMap Text Text)
   -> Text
   -> Text
   -> ProtocolType
   -> Api)
-> Parser (Maybe Text)
-> Parser
     (Maybe Bool
      -> Maybe Text
      -> Maybe Cors
      -> Maybe [Text]
      -> Maybe Bool
      -> Maybe Text
      -> Maybe (HashMap Text Text)
      -> Text
      -> Text
      -> ProtocolType
      -> Api)
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 Bool
   -> Maybe Text
   -> Maybe Cors
   -> Maybe [Text]
   -> Maybe Bool
   -> Maybe Text
   -> Maybe (HashMap Text Text)
   -> Text
   -> Text
   -> ProtocolType
   -> Api)
-> Parser (Maybe Bool)
-> Parser
     (Maybe Text
      -> Maybe Cors
      -> Maybe [Text]
      -> Maybe Bool
      -> Maybe Text
      -> Maybe (HashMap Text Text)
      -> Text
      -> Text
      -> ProtocolType
      -> Api)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"apiGatewayManaged")
            Parser
  (Maybe Text
   -> Maybe Cors
   -> Maybe [Text]
   -> Maybe Bool
   -> Maybe Text
   -> Maybe (HashMap Text Text)
   -> Text
   -> Text
   -> ProtocolType
   -> Api)
-> Parser (Maybe Text)
-> Parser
     (Maybe Cors
      -> Maybe [Text]
      -> Maybe Bool
      -> Maybe Text
      -> Maybe (HashMap Text Text)
      -> Text
      -> Text
      -> ProtocolType
      -> Api)
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
"apiKeySelectionExpression")
            Parser
  (Maybe Cors
   -> Maybe [Text]
   -> Maybe Bool
   -> Maybe Text
   -> Maybe (HashMap Text Text)
   -> Text
   -> Text
   -> ProtocolType
   -> Api)
-> Parser (Maybe Cors)
-> Parser
     (Maybe [Text]
      -> Maybe Bool
      -> Maybe Text
      -> Maybe (HashMap Text Text)
      -> Text
      -> Text
      -> ProtocolType
      -> Api)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Cors)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"corsConfiguration")
            Parser
  (Maybe [Text]
   -> Maybe Bool
   -> Maybe Text
   -> Maybe (HashMap Text Text)
   -> Text
   -> Text
   -> ProtocolType
   -> Api)
-> Parser (Maybe [Text])
-> Parser
     (Maybe Bool
      -> Maybe Text
      -> Maybe (HashMap Text Text)
      -> Text
      -> Text
      -> ProtocolType
      -> Api)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe [Text]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"importInfo" Parser (Maybe (Maybe [Text]))
-> Maybe [Text] -> Parser (Maybe [Text])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [Text]
forall a. Monoid a => a
Prelude.mempty)
            Parser
  (Maybe Bool
   -> Maybe Text
   -> Maybe (HashMap Text Text)
   -> Text
   -> Text
   -> ProtocolType
   -> Api)
-> Parser (Maybe Bool)
-> Parser
     (Maybe Text
      -> Maybe (HashMap Text Text)
      -> Text
      -> Text
      -> ProtocolType
      -> Api)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"disableSchemaValidation")
            Parser
  (Maybe Text
   -> Maybe (HashMap Text Text)
   -> Text
   -> Text
   -> ProtocolType
   -> Api)
-> Parser (Maybe Text)
-> Parser
     (Maybe (HashMap Text Text) -> Text -> Text -> ProtocolType -> Api)
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")
            Parser
  (Maybe (HashMap Text Text) -> Text -> Text -> ProtocolType -> Api)
-> Parser (Maybe (HashMap Text Text))
-> Parser (Text -> Text -> ProtocolType -> Api)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe (HashMap Text Text)))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"tags" Parser (Maybe (Maybe (HashMap Text Text)))
-> Maybe (HashMap Text Text) -> Parser (Maybe (HashMap Text Text))
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe (HashMap Text Text)
forall a. Monoid a => a
Prelude.mempty)
            Parser (Text -> Text -> ProtocolType -> Api)
-> Parser Text -> Parser (Text -> ProtocolType -> Api)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"routeSelectionExpression")
            Parser (Text -> ProtocolType -> Api)
-> Parser Text -> Parser (ProtocolType -> Api)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"name")
            Parser (ProtocolType -> Api) -> Parser ProtocolType -> Parser Api
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser ProtocolType
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"protocolType")
      )

instance Prelude.Hashable Api

instance Prelude.NFData Api