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

import Amazonka.APIGateway.Types.ApiKeySourceType
import Amazonka.APIGateway.Types.EndpointConfiguration
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Represents a REST API.
--
-- <https://docs.aws.amazon.com/apigateway/latest/developerguide/how-to-create-api.html Create an API>
--
-- /See:/ 'newRestApi' smart constructor.
data RestApi = RestApi'
  { -- | A nullable integer that is used to enable compression (with non-negative
    -- between 0 and 10485760 (10M) bytes, inclusive) or disable compression
    -- (with a null value) on an API. When compression is enabled, compression
    -- or decompression is not applied on the payload if the payload size is
    -- smaller than this value. Setting it to zero allows compression for any
    -- payload size.
    RestApi -> Maybe Int
minimumCompressionSize :: Prelude.Maybe Prelude.Int,
    -- | 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.
    RestApi -> Maybe Bool
disableExecuteApiEndpoint :: Prelude.Maybe Prelude.Bool,
    -- | The list of binary media types supported by the RestApi. By default, the
    -- RestApi supports only UTF-8-encoded text payloads.
    RestApi -> Maybe [Text]
binaryMediaTypes :: Prelude.Maybe [Prelude.Text],
    -- | The warning messages reported when @failonwarnings@ is turned on during
    -- API import.
    RestApi -> Maybe [Text]
warnings :: Prelude.Maybe [Prelude.Text],
    -- | The timestamp when the API was created.
    RestApi -> Maybe POSIX
createdDate :: Prelude.Maybe Core.POSIX,
    -- | The API\'s name.
    RestApi -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | A version identifier for the API.
    RestApi -> Maybe Text
version :: Prelude.Maybe Prelude.Text,
    -- | The source of the API key for metering requests according to a usage
    -- plan. Valid values are:
    --
    -- -   @HEADER@ to read the API key from the @X-API-Key@ header of a
    --     request.
    -- -   @AUTHORIZER@ to read the API key from the @UsageIdentifierKey@ from
    --     a custom authorizer.
    RestApi -> Maybe ApiKeySourceType
apiKeySource :: Prelude.Maybe ApiKeySourceType,
    -- | The API\'s identifier. This identifier is unique across all of your APIs
    -- in API Gateway.
    RestApi -> Maybe Text
id :: Prelude.Maybe Prelude.Text,
    -- | A stringified JSON policy document that applies to this RestApi
    -- regardless of the caller and Method configuration.
    RestApi -> Maybe Text
policy :: Prelude.Maybe Prelude.Text,
    -- | The endpoint configuration of this RestApi showing the endpoint types of
    -- the API.
    RestApi -> Maybe EndpointConfiguration
endpointConfiguration :: Prelude.Maybe EndpointConfiguration,
    -- | The API\'s description.
    RestApi -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | The collection of tags. Each tag element is associated with a given
    -- resource.
    RestApi -> Maybe (HashMap Text Text)
tags :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text)
  }
  deriving (RestApi -> RestApi -> Bool
(RestApi -> RestApi -> Bool)
-> (RestApi -> RestApi -> Bool) -> Eq RestApi
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RestApi -> RestApi -> Bool
$c/= :: RestApi -> RestApi -> Bool
== :: RestApi -> RestApi -> Bool
$c== :: RestApi -> RestApi -> Bool
Prelude.Eq, ReadPrec [RestApi]
ReadPrec RestApi
Int -> ReadS RestApi
ReadS [RestApi]
(Int -> ReadS RestApi)
-> ReadS [RestApi]
-> ReadPrec RestApi
-> ReadPrec [RestApi]
-> Read RestApi
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RestApi]
$creadListPrec :: ReadPrec [RestApi]
readPrec :: ReadPrec RestApi
$creadPrec :: ReadPrec RestApi
readList :: ReadS [RestApi]
$creadList :: ReadS [RestApi]
readsPrec :: Int -> ReadS RestApi
$creadsPrec :: Int -> ReadS RestApi
Prelude.Read, Int -> RestApi -> ShowS
[RestApi] -> ShowS
RestApi -> String
(Int -> RestApi -> ShowS)
-> (RestApi -> String) -> ([RestApi] -> ShowS) -> Show RestApi
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RestApi] -> ShowS
$cshowList :: [RestApi] -> ShowS
show :: RestApi -> String
$cshow :: RestApi -> String
showsPrec :: Int -> RestApi -> ShowS
$cshowsPrec :: Int -> RestApi -> ShowS
Prelude.Show, (forall x. RestApi -> Rep RestApi x)
-> (forall x. Rep RestApi x -> RestApi) -> Generic RestApi
forall x. Rep RestApi x -> RestApi
forall x. RestApi -> Rep RestApi x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RestApi x -> RestApi
$cfrom :: forall x. RestApi -> Rep RestApi x
Prelude.Generic)

-- |
-- Create a value of 'RestApi' 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:
--
-- 'minimumCompressionSize', 'restApi_minimumCompressionSize' - A nullable integer that is used to enable compression (with non-negative
-- between 0 and 10485760 (10M) bytes, inclusive) or disable compression
-- (with a null value) on an API. When compression is enabled, compression
-- or decompression is not applied on the payload if the payload size is
-- smaller than this value. Setting it to zero allows compression for any
-- payload size.
--
-- 'disableExecuteApiEndpoint', 'restApi_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.
--
-- 'binaryMediaTypes', 'restApi_binaryMediaTypes' - The list of binary media types supported by the RestApi. By default, the
-- RestApi supports only UTF-8-encoded text payloads.
--
-- 'warnings', 'restApi_warnings' - The warning messages reported when @failonwarnings@ is turned on during
-- API import.
--
-- 'createdDate', 'restApi_createdDate' - The timestamp when the API was created.
--
-- 'name', 'restApi_name' - The API\'s name.
--
-- 'version', 'restApi_version' - A version identifier for the API.
--
-- 'apiKeySource', 'restApi_apiKeySource' - The source of the API key for metering requests according to a usage
-- plan. Valid values are:
--
-- -   @HEADER@ to read the API key from the @X-API-Key@ header of a
--     request.
-- -   @AUTHORIZER@ to read the API key from the @UsageIdentifierKey@ from
--     a custom authorizer.
--
-- 'id', 'restApi_id' - The API\'s identifier. This identifier is unique across all of your APIs
-- in API Gateway.
--
-- 'policy', 'restApi_policy' - A stringified JSON policy document that applies to this RestApi
-- regardless of the caller and Method configuration.
--
-- 'endpointConfiguration', 'restApi_endpointConfiguration' - The endpoint configuration of this RestApi showing the endpoint types of
-- the API.
--
-- 'description', 'restApi_description' - The API\'s description.
--
-- 'tags', 'restApi_tags' - The collection of tags. Each tag element is associated with a given
-- resource.
newRestApi ::
  RestApi
newRestApi :: RestApi
newRestApi =
  RestApi' :: Maybe Int
-> Maybe Bool
-> Maybe [Text]
-> Maybe [Text]
-> Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Maybe ApiKeySourceType
-> Maybe Text
-> Maybe Text
-> Maybe EndpointConfiguration
-> Maybe Text
-> Maybe (HashMap Text Text)
-> RestApi
RestApi'
    { $sel:minimumCompressionSize:RestApi' :: Maybe Int
minimumCompressionSize = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:disableExecuteApiEndpoint:RestApi' :: Maybe Bool
disableExecuteApiEndpoint = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:binaryMediaTypes:RestApi' :: Maybe [Text]
binaryMediaTypes = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:warnings:RestApi' :: Maybe [Text]
warnings = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:createdDate:RestApi' :: Maybe POSIX
createdDate = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:name:RestApi' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:version:RestApi' :: Maybe Text
version = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:apiKeySource:RestApi' :: Maybe ApiKeySourceType
apiKeySource = Maybe ApiKeySourceType
forall a. Maybe a
Prelude.Nothing,
      $sel:id:RestApi' :: Maybe Text
id = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:policy:RestApi' :: Maybe Text
policy = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:endpointConfiguration:RestApi' :: Maybe EndpointConfiguration
endpointConfiguration = Maybe EndpointConfiguration
forall a. Maybe a
Prelude.Nothing,
      $sel:description:RestApi' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:tags:RestApi' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing
    }

-- | A nullable integer that is used to enable compression (with non-negative
-- between 0 and 10485760 (10M) bytes, inclusive) or disable compression
-- (with a null value) on an API. When compression is enabled, compression
-- or decompression is not applied on the payload if the payload size is
-- smaller than this value. Setting it to zero allows compression for any
-- payload size.
restApi_minimumCompressionSize :: Lens.Lens' RestApi (Prelude.Maybe Prelude.Int)
restApi_minimumCompressionSize :: (Maybe Int -> f (Maybe Int)) -> RestApi -> f RestApi
restApi_minimumCompressionSize = (RestApi -> Maybe Int)
-> (RestApi -> Maybe Int -> RestApi)
-> Lens RestApi RestApi (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RestApi' {Maybe Int
minimumCompressionSize :: Maybe Int
$sel:minimumCompressionSize:RestApi' :: RestApi -> Maybe Int
minimumCompressionSize} -> Maybe Int
minimumCompressionSize) (\s :: RestApi
s@RestApi' {} Maybe Int
a -> RestApi
s {$sel:minimumCompressionSize:RestApi' :: Maybe Int
minimumCompressionSize = Maybe Int
a} :: RestApi)

-- | 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.
restApi_disableExecuteApiEndpoint :: Lens.Lens' RestApi (Prelude.Maybe Prelude.Bool)
restApi_disableExecuteApiEndpoint :: (Maybe Bool -> f (Maybe Bool)) -> RestApi -> f RestApi
restApi_disableExecuteApiEndpoint = (RestApi -> Maybe Bool)
-> (RestApi -> Maybe Bool -> RestApi)
-> Lens RestApi RestApi (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RestApi' {Maybe Bool
disableExecuteApiEndpoint :: Maybe Bool
$sel:disableExecuteApiEndpoint:RestApi' :: RestApi -> Maybe Bool
disableExecuteApiEndpoint} -> Maybe Bool
disableExecuteApiEndpoint) (\s :: RestApi
s@RestApi' {} Maybe Bool
a -> RestApi
s {$sel:disableExecuteApiEndpoint:RestApi' :: Maybe Bool
disableExecuteApiEndpoint = Maybe Bool
a} :: RestApi)

-- | The list of binary media types supported by the RestApi. By default, the
-- RestApi supports only UTF-8-encoded text payloads.
restApi_binaryMediaTypes :: Lens.Lens' RestApi (Prelude.Maybe [Prelude.Text])
restApi_binaryMediaTypes :: (Maybe [Text] -> f (Maybe [Text])) -> RestApi -> f RestApi
restApi_binaryMediaTypes = (RestApi -> Maybe [Text])
-> (RestApi -> Maybe [Text] -> RestApi)
-> Lens RestApi RestApi (Maybe [Text]) (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RestApi' {Maybe [Text]
binaryMediaTypes :: Maybe [Text]
$sel:binaryMediaTypes:RestApi' :: RestApi -> Maybe [Text]
binaryMediaTypes} -> Maybe [Text]
binaryMediaTypes) (\s :: RestApi
s@RestApi' {} Maybe [Text]
a -> RestApi
s {$sel:binaryMediaTypes:RestApi' :: Maybe [Text]
binaryMediaTypes = Maybe [Text]
a} :: RestApi) ((Maybe [Text] -> f (Maybe [Text])) -> RestApi -> f RestApi)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> RestApi
-> f RestApi
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 warning messages reported when @failonwarnings@ is turned on during
-- API import.
restApi_warnings :: Lens.Lens' RestApi (Prelude.Maybe [Prelude.Text])
restApi_warnings :: (Maybe [Text] -> f (Maybe [Text])) -> RestApi -> f RestApi
restApi_warnings = (RestApi -> Maybe [Text])
-> (RestApi -> Maybe [Text] -> RestApi)
-> Lens RestApi RestApi (Maybe [Text]) (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RestApi' {Maybe [Text]
warnings :: Maybe [Text]
$sel:warnings:RestApi' :: RestApi -> Maybe [Text]
warnings} -> Maybe [Text]
warnings) (\s :: RestApi
s@RestApi' {} Maybe [Text]
a -> RestApi
s {$sel:warnings:RestApi' :: Maybe [Text]
warnings = Maybe [Text]
a} :: RestApi) ((Maybe [Text] -> f (Maybe [Text])) -> RestApi -> f RestApi)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> RestApi
-> f RestApi
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.
restApi_createdDate :: Lens.Lens' RestApi (Prelude.Maybe Prelude.UTCTime)
restApi_createdDate :: (Maybe UTCTime -> f (Maybe UTCTime)) -> RestApi -> f RestApi
restApi_createdDate = (RestApi -> Maybe POSIX)
-> (RestApi -> Maybe POSIX -> RestApi)
-> Lens RestApi RestApi (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RestApi' {Maybe POSIX
createdDate :: Maybe POSIX
$sel:createdDate:RestApi' :: RestApi -> Maybe POSIX
createdDate} -> Maybe POSIX
createdDate) (\s :: RestApi
s@RestApi' {} Maybe POSIX
a -> RestApi
s {$sel:createdDate:RestApi' :: Maybe POSIX
createdDate = Maybe POSIX
a} :: RestApi) ((Maybe POSIX -> f (Maybe POSIX)) -> RestApi -> f RestApi)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> RestApi
-> f RestApi
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 API\'s name.
restApi_name :: Lens.Lens' RestApi (Prelude.Maybe Prelude.Text)
restApi_name :: (Maybe Text -> f (Maybe Text)) -> RestApi -> f RestApi
restApi_name = (RestApi -> Maybe Text)
-> (RestApi -> Maybe Text -> RestApi)
-> Lens RestApi RestApi (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RestApi' {Maybe Text
name :: Maybe Text
$sel:name:RestApi' :: RestApi -> Maybe Text
name} -> Maybe Text
name) (\s :: RestApi
s@RestApi' {} Maybe Text
a -> RestApi
s {$sel:name:RestApi' :: Maybe Text
name = Maybe Text
a} :: RestApi)

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

-- | The source of the API key for metering requests according to a usage
-- plan. Valid values are:
--
-- -   @HEADER@ to read the API key from the @X-API-Key@ header of a
--     request.
-- -   @AUTHORIZER@ to read the API key from the @UsageIdentifierKey@ from
--     a custom authorizer.
restApi_apiKeySource :: Lens.Lens' RestApi (Prelude.Maybe ApiKeySourceType)
restApi_apiKeySource :: (Maybe ApiKeySourceType -> f (Maybe ApiKeySourceType))
-> RestApi -> f RestApi
restApi_apiKeySource = (RestApi -> Maybe ApiKeySourceType)
-> (RestApi -> Maybe ApiKeySourceType -> RestApi)
-> Lens
     RestApi RestApi (Maybe ApiKeySourceType) (Maybe ApiKeySourceType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RestApi' {Maybe ApiKeySourceType
apiKeySource :: Maybe ApiKeySourceType
$sel:apiKeySource:RestApi' :: RestApi -> Maybe ApiKeySourceType
apiKeySource} -> Maybe ApiKeySourceType
apiKeySource) (\s :: RestApi
s@RestApi' {} Maybe ApiKeySourceType
a -> RestApi
s {$sel:apiKeySource:RestApi' :: Maybe ApiKeySourceType
apiKeySource = Maybe ApiKeySourceType
a} :: RestApi)

-- | The API\'s identifier. This identifier is unique across all of your APIs
-- in API Gateway.
restApi_id :: Lens.Lens' RestApi (Prelude.Maybe Prelude.Text)
restApi_id :: (Maybe Text -> f (Maybe Text)) -> RestApi -> f RestApi
restApi_id = (RestApi -> Maybe Text)
-> (RestApi -> Maybe Text -> RestApi)
-> Lens RestApi RestApi (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RestApi' {Maybe Text
id :: Maybe Text
$sel:id:RestApi' :: RestApi -> Maybe Text
id} -> Maybe Text
id) (\s :: RestApi
s@RestApi' {} Maybe Text
a -> RestApi
s {$sel:id:RestApi' :: Maybe Text
id = Maybe Text
a} :: RestApi)

-- | A stringified JSON policy document that applies to this RestApi
-- regardless of the caller and Method configuration.
restApi_policy :: Lens.Lens' RestApi (Prelude.Maybe Prelude.Text)
restApi_policy :: (Maybe Text -> f (Maybe Text)) -> RestApi -> f RestApi
restApi_policy = (RestApi -> Maybe Text)
-> (RestApi -> Maybe Text -> RestApi)
-> Lens RestApi RestApi (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RestApi' {Maybe Text
policy :: Maybe Text
$sel:policy:RestApi' :: RestApi -> Maybe Text
policy} -> Maybe Text
policy) (\s :: RestApi
s@RestApi' {} Maybe Text
a -> RestApi
s {$sel:policy:RestApi' :: Maybe Text
policy = Maybe Text
a} :: RestApi)

-- | The endpoint configuration of this RestApi showing the endpoint types of
-- the API.
restApi_endpointConfiguration :: Lens.Lens' RestApi (Prelude.Maybe EndpointConfiguration)
restApi_endpointConfiguration :: (Maybe EndpointConfiguration -> f (Maybe EndpointConfiguration))
-> RestApi -> f RestApi
restApi_endpointConfiguration = (RestApi -> Maybe EndpointConfiguration)
-> (RestApi -> Maybe EndpointConfiguration -> RestApi)
-> Lens
     RestApi
     RestApi
     (Maybe EndpointConfiguration)
     (Maybe EndpointConfiguration)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RestApi' {Maybe EndpointConfiguration
endpointConfiguration :: Maybe EndpointConfiguration
$sel:endpointConfiguration:RestApi' :: RestApi -> Maybe EndpointConfiguration
endpointConfiguration} -> Maybe EndpointConfiguration
endpointConfiguration) (\s :: RestApi
s@RestApi' {} Maybe EndpointConfiguration
a -> RestApi
s {$sel:endpointConfiguration:RestApi' :: Maybe EndpointConfiguration
endpointConfiguration = Maybe EndpointConfiguration
a} :: RestApi)

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

-- | The collection of tags. Each tag element is associated with a given
-- resource.
restApi_tags :: Lens.Lens' RestApi (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
restApi_tags :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> RestApi -> f RestApi
restApi_tags = (RestApi -> Maybe (HashMap Text Text))
-> (RestApi -> Maybe (HashMap Text Text) -> RestApi)
-> Lens
     RestApi
     RestApi
     (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 (\RestApi' {Maybe (HashMap Text Text)
tags :: Maybe (HashMap Text Text)
$sel:tags:RestApi' :: RestApi -> Maybe (HashMap Text Text)
tags} -> Maybe (HashMap Text Text)
tags) (\s :: RestApi
s@RestApi' {} Maybe (HashMap Text Text)
a -> RestApi
s {$sel:tags:RestApi' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
a} :: RestApi) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
 -> RestApi -> f RestApi)
-> ((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)))
-> RestApi
-> f RestApi
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

instance Core.FromJSON RestApi where
  parseJSON :: Value -> Parser RestApi
parseJSON =
    String -> (Object -> Parser RestApi) -> Value -> Parser RestApi
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"RestApi"
      ( \Object
x ->
          Maybe Int
-> Maybe Bool
-> Maybe [Text]
-> Maybe [Text]
-> Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Maybe ApiKeySourceType
-> Maybe Text
-> Maybe Text
-> Maybe EndpointConfiguration
-> Maybe Text
-> Maybe (HashMap Text Text)
-> RestApi
RestApi'
            (Maybe Int
 -> Maybe Bool
 -> Maybe [Text]
 -> Maybe [Text]
 -> Maybe POSIX
 -> Maybe Text
 -> Maybe Text
 -> Maybe ApiKeySourceType
 -> Maybe Text
 -> Maybe Text
 -> Maybe EndpointConfiguration
 -> Maybe Text
 -> Maybe (HashMap Text Text)
 -> RestApi)
-> Parser (Maybe Int)
-> Parser
     (Maybe Bool
      -> Maybe [Text]
      -> Maybe [Text]
      -> Maybe POSIX
      -> Maybe Text
      -> Maybe Text
      -> Maybe ApiKeySourceType
      -> Maybe Text
      -> Maybe Text
      -> Maybe EndpointConfiguration
      -> Maybe Text
      -> Maybe (HashMap Text Text)
      -> RestApi)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"minimumCompressionSize")
            Parser
  (Maybe Bool
   -> Maybe [Text]
   -> Maybe [Text]
   -> Maybe POSIX
   -> Maybe Text
   -> Maybe Text
   -> Maybe ApiKeySourceType
   -> Maybe Text
   -> Maybe Text
   -> Maybe EndpointConfiguration
   -> Maybe Text
   -> Maybe (HashMap Text Text)
   -> RestApi)
-> Parser (Maybe Bool)
-> Parser
     (Maybe [Text]
      -> Maybe [Text]
      -> Maybe POSIX
      -> Maybe Text
      -> Maybe Text
      -> Maybe ApiKeySourceType
      -> Maybe Text
      -> Maybe Text
      -> Maybe EndpointConfiguration
      -> Maybe Text
      -> Maybe (HashMap Text Text)
      -> RestApi)
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 Text
   -> Maybe ApiKeySourceType
   -> Maybe Text
   -> Maybe Text
   -> Maybe EndpointConfiguration
   -> Maybe Text
   -> Maybe (HashMap Text Text)
   -> RestApi)
-> Parser (Maybe [Text])
-> Parser
     (Maybe [Text]
      -> Maybe POSIX
      -> Maybe Text
      -> Maybe Text
      -> Maybe ApiKeySourceType
      -> Maybe Text
      -> Maybe Text
      -> Maybe EndpointConfiguration
      -> Maybe Text
      -> Maybe (HashMap Text Text)
      -> RestApi)
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
"binaryMediaTypes"
                            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 [Text]
   -> Maybe POSIX
   -> Maybe Text
   -> Maybe Text
   -> Maybe ApiKeySourceType
   -> Maybe Text
   -> Maybe Text
   -> Maybe EndpointConfiguration
   -> Maybe Text
   -> Maybe (HashMap Text Text)
   -> RestApi)
-> Parser (Maybe [Text])
-> Parser
     (Maybe POSIX
      -> Maybe Text
      -> Maybe Text
      -> Maybe ApiKeySourceType
      -> Maybe Text
      -> Maybe Text
      -> Maybe EndpointConfiguration
      -> Maybe Text
      -> Maybe (HashMap Text Text)
      -> RestApi)
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 Text
   -> Maybe ApiKeySourceType
   -> Maybe Text
   -> Maybe Text
   -> Maybe EndpointConfiguration
   -> Maybe Text
   -> Maybe (HashMap Text Text)
   -> RestApi)
-> Parser (Maybe POSIX)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe ApiKeySourceType
      -> Maybe Text
      -> Maybe Text
      -> Maybe EndpointConfiguration
      -> Maybe Text
      -> Maybe (HashMap Text Text)
      -> RestApi)
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 Text
   -> Maybe ApiKeySourceType
   -> Maybe Text
   -> Maybe Text
   -> Maybe EndpointConfiguration
   -> Maybe Text
   -> Maybe (HashMap Text Text)
   -> RestApi)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe ApiKeySourceType
      -> Maybe Text
      -> Maybe Text
      -> Maybe EndpointConfiguration
      -> Maybe Text
      -> Maybe (HashMap Text Text)
      -> RestApi)
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 ApiKeySourceType
   -> Maybe Text
   -> Maybe Text
   -> Maybe EndpointConfiguration
   -> Maybe Text
   -> Maybe (HashMap Text Text)
   -> RestApi)
-> Parser (Maybe Text)
-> Parser
     (Maybe ApiKeySourceType
      -> Maybe Text
      -> Maybe Text
      -> Maybe EndpointConfiguration
      -> Maybe Text
      -> Maybe (HashMap Text Text)
      -> RestApi)
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 ApiKeySourceType
   -> Maybe Text
   -> Maybe Text
   -> Maybe EndpointConfiguration
   -> Maybe Text
   -> Maybe (HashMap Text Text)
   -> RestApi)
-> Parser (Maybe ApiKeySourceType)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe EndpointConfiguration
      -> Maybe Text
      -> Maybe (HashMap Text Text)
      -> RestApi)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe ApiKeySourceType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"apiKeySource")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe EndpointConfiguration
   -> Maybe Text
   -> Maybe (HashMap Text Text)
   -> RestApi)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe EndpointConfiguration
      -> Maybe Text
      -> Maybe (HashMap Text Text)
      -> RestApi)
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
   -> Maybe EndpointConfiguration
   -> Maybe Text
   -> Maybe (HashMap Text Text)
   -> RestApi)
-> Parser (Maybe Text)
-> Parser
     (Maybe EndpointConfiguration
      -> Maybe Text -> Maybe (HashMap Text Text) -> RestApi)
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
"policy")
            Parser
  (Maybe EndpointConfiguration
   -> Maybe Text -> Maybe (HashMap Text Text) -> RestApi)
-> Parser (Maybe EndpointConfiguration)
-> Parser (Maybe Text -> Maybe (HashMap Text Text) -> RestApi)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe EndpointConfiguration)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"endpointConfiguration")
            Parser (Maybe Text -> Maybe (HashMap Text Text) -> RestApi)
-> Parser (Maybe Text)
-> Parser (Maybe (HashMap Text Text) -> RestApi)
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) -> RestApi)
-> Parser (Maybe (HashMap Text Text)) -> Parser RestApi
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)
      )

instance Prelude.Hashable RestApi

instance Prelude.NFData RestApi