{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# 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.DeleteCorsConfiguration
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Deletes a CORS configuration.
module Amazonka.ApiGatewayV2.DeleteCorsConfiguration
  ( -- * Creating a Request
    DeleteCorsConfiguration (..),
    newDeleteCorsConfiguration,

    -- * Request Lenses
    deleteCorsConfiguration_apiId,

    -- * Destructuring the Response
    DeleteCorsConfigurationResponse (..),
    newDeleteCorsConfigurationResponse,
  )
where

import Amazonka.ApiGatewayV2.Types
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
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newDeleteCorsConfiguration' smart constructor.
data DeleteCorsConfiguration = DeleteCorsConfiguration'
  { -- | The API identifier.
    DeleteCorsConfiguration -> Text
apiId :: Prelude.Text
  }
  deriving (DeleteCorsConfiguration -> DeleteCorsConfiguration -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteCorsConfiguration -> DeleteCorsConfiguration -> Bool
$c/= :: DeleteCorsConfiguration -> DeleteCorsConfiguration -> Bool
== :: DeleteCorsConfiguration -> DeleteCorsConfiguration -> Bool
$c== :: DeleteCorsConfiguration -> DeleteCorsConfiguration -> Bool
Prelude.Eq, ReadPrec [DeleteCorsConfiguration]
ReadPrec DeleteCorsConfiguration
Int -> ReadS DeleteCorsConfiguration
ReadS [DeleteCorsConfiguration]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteCorsConfiguration]
$creadListPrec :: ReadPrec [DeleteCorsConfiguration]
readPrec :: ReadPrec DeleteCorsConfiguration
$creadPrec :: ReadPrec DeleteCorsConfiguration
readList :: ReadS [DeleteCorsConfiguration]
$creadList :: ReadS [DeleteCorsConfiguration]
readsPrec :: Int -> ReadS DeleteCorsConfiguration
$creadsPrec :: Int -> ReadS DeleteCorsConfiguration
Prelude.Read, Int -> DeleteCorsConfiguration -> ShowS
[DeleteCorsConfiguration] -> ShowS
DeleteCorsConfiguration -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteCorsConfiguration] -> ShowS
$cshowList :: [DeleteCorsConfiguration] -> ShowS
show :: DeleteCorsConfiguration -> String
$cshow :: DeleteCorsConfiguration -> String
showsPrec :: Int -> DeleteCorsConfiguration -> ShowS
$cshowsPrec :: Int -> DeleteCorsConfiguration -> ShowS
Prelude.Show, forall x. Rep DeleteCorsConfiguration x -> DeleteCorsConfiguration
forall x. DeleteCorsConfiguration -> Rep DeleteCorsConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteCorsConfiguration x -> DeleteCorsConfiguration
$cfrom :: forall x. DeleteCorsConfiguration -> Rep DeleteCorsConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'DeleteCorsConfiguration' 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', 'deleteCorsConfiguration_apiId' - The API identifier.
newDeleteCorsConfiguration ::
  -- | 'apiId'
  Prelude.Text ->
  DeleteCorsConfiguration
newDeleteCorsConfiguration :: Text -> DeleteCorsConfiguration
newDeleteCorsConfiguration Text
pApiId_ =
  DeleteCorsConfiguration' {$sel:apiId:DeleteCorsConfiguration' :: Text
apiId = Text
pApiId_}

-- | The API identifier.
deleteCorsConfiguration_apiId :: Lens.Lens' DeleteCorsConfiguration Prelude.Text
deleteCorsConfiguration_apiId :: Lens' DeleteCorsConfiguration Text
deleteCorsConfiguration_apiId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteCorsConfiguration' {Text
apiId :: Text
$sel:apiId:DeleteCorsConfiguration' :: DeleteCorsConfiguration -> Text
apiId} -> Text
apiId) (\s :: DeleteCorsConfiguration
s@DeleteCorsConfiguration' {} Text
a -> DeleteCorsConfiguration
s {$sel:apiId:DeleteCorsConfiguration' :: Text
apiId = Text
a} :: DeleteCorsConfiguration)

instance Core.AWSRequest DeleteCorsConfiguration where
  type
    AWSResponse DeleteCorsConfiguration =
      DeleteCorsConfigurationResponse
  request :: (Service -> Service)
-> DeleteCorsConfiguration -> Request DeleteCorsConfiguration
request Service -> Service
overrides =
    forall a. ToRequest a => Service -> a -> Request a
Request.delete (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy DeleteCorsConfiguration
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteCorsConfiguration)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull
      DeleteCorsConfigurationResponse
DeleteCorsConfigurationResponse'

instance Prelude.Hashable DeleteCorsConfiguration where
  hashWithSalt :: Int -> DeleteCorsConfiguration -> Int
hashWithSalt Int
_salt DeleteCorsConfiguration' {Text
apiId :: Text
$sel:apiId:DeleteCorsConfiguration' :: DeleteCorsConfiguration -> Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
apiId

instance Prelude.NFData DeleteCorsConfiguration where
  rnf :: DeleteCorsConfiguration -> ()
rnf DeleteCorsConfiguration' {Text
apiId :: Text
$sel:apiId:DeleteCorsConfiguration' :: DeleteCorsConfiguration -> Text
..} = forall a. NFData a => a -> ()
Prelude.rnf Text
apiId

instance Data.ToHeaders DeleteCorsConfiguration where
  toHeaders :: DeleteCorsConfiguration -> [Header]
toHeaders =
    forall a b. a -> b -> a
Prelude.const
      ( forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"Content-Type"
              forall a. ToHeader a => HeaderName -> a -> [Header]
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Data.ToPath DeleteCorsConfiguration where
  toPath :: DeleteCorsConfiguration -> ByteString
toPath DeleteCorsConfiguration' {Text
apiId :: Text
$sel:apiId:DeleteCorsConfiguration' :: DeleteCorsConfiguration -> Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ByteString
"/v2/apis/", forall a. ToByteString a => a -> ByteString
Data.toBS Text
apiId, ByteString
"/cors"]

instance Data.ToQuery DeleteCorsConfiguration where
  toQuery :: DeleteCorsConfiguration -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty

-- | /See:/ 'newDeleteCorsConfigurationResponse' smart constructor.
data DeleteCorsConfigurationResponse = DeleteCorsConfigurationResponse'
  {
  }
  deriving (DeleteCorsConfigurationResponse
-> DeleteCorsConfigurationResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteCorsConfigurationResponse
-> DeleteCorsConfigurationResponse -> Bool
$c/= :: DeleteCorsConfigurationResponse
-> DeleteCorsConfigurationResponse -> Bool
== :: DeleteCorsConfigurationResponse
-> DeleteCorsConfigurationResponse -> Bool
$c== :: DeleteCorsConfigurationResponse
-> DeleteCorsConfigurationResponse -> Bool
Prelude.Eq, ReadPrec [DeleteCorsConfigurationResponse]
ReadPrec DeleteCorsConfigurationResponse
Int -> ReadS DeleteCorsConfigurationResponse
ReadS [DeleteCorsConfigurationResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteCorsConfigurationResponse]
$creadListPrec :: ReadPrec [DeleteCorsConfigurationResponse]
readPrec :: ReadPrec DeleteCorsConfigurationResponse
$creadPrec :: ReadPrec DeleteCorsConfigurationResponse
readList :: ReadS [DeleteCorsConfigurationResponse]
$creadList :: ReadS [DeleteCorsConfigurationResponse]
readsPrec :: Int -> ReadS DeleteCorsConfigurationResponse
$creadsPrec :: Int -> ReadS DeleteCorsConfigurationResponse
Prelude.Read, Int -> DeleteCorsConfigurationResponse -> ShowS
[DeleteCorsConfigurationResponse] -> ShowS
DeleteCorsConfigurationResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteCorsConfigurationResponse] -> ShowS
$cshowList :: [DeleteCorsConfigurationResponse] -> ShowS
show :: DeleteCorsConfigurationResponse -> String
$cshow :: DeleteCorsConfigurationResponse -> String
showsPrec :: Int -> DeleteCorsConfigurationResponse -> ShowS
$cshowsPrec :: Int -> DeleteCorsConfigurationResponse -> ShowS
Prelude.Show, forall x.
Rep DeleteCorsConfigurationResponse x
-> DeleteCorsConfigurationResponse
forall x.
DeleteCorsConfigurationResponse
-> Rep DeleteCorsConfigurationResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DeleteCorsConfigurationResponse x
-> DeleteCorsConfigurationResponse
$cfrom :: forall x.
DeleteCorsConfigurationResponse
-> Rep DeleteCorsConfigurationResponse x
Prelude.Generic)

-- |
-- Create a value of 'DeleteCorsConfigurationResponse' 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.
newDeleteCorsConfigurationResponse ::
  DeleteCorsConfigurationResponse
newDeleteCorsConfigurationResponse :: DeleteCorsConfigurationResponse
newDeleteCorsConfigurationResponse =
  DeleteCorsConfigurationResponse
DeleteCorsConfigurationResponse'

instance
  Prelude.NFData
    DeleteCorsConfigurationResponse
  where
  rnf :: DeleteCorsConfigurationResponse -> ()
rnf DeleteCorsConfigurationResponse
_ = ()