{-# 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-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)
--
-- 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.Lens as Lens
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
(DeleteCorsConfiguration -> DeleteCorsConfiguration -> Bool)
-> (DeleteCorsConfiguration -> DeleteCorsConfiguration -> Bool)
-> Eq DeleteCorsConfiguration
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]
(Int -> ReadS DeleteCorsConfiguration)
-> ReadS [DeleteCorsConfiguration]
-> ReadPrec DeleteCorsConfiguration
-> ReadPrec [DeleteCorsConfiguration]
-> Read 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
(Int -> DeleteCorsConfiguration -> ShowS)
-> (DeleteCorsConfiguration -> String)
-> ([DeleteCorsConfiguration] -> ShowS)
-> Show DeleteCorsConfiguration
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.
 DeleteCorsConfiguration -> Rep DeleteCorsConfiguration x)
-> (forall x.
    Rep DeleteCorsConfiguration x -> DeleteCorsConfiguration)
-> Generic DeleteCorsConfiguration
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' :: Text -> DeleteCorsConfiguration
DeleteCorsConfiguration' {$sel:apiId:DeleteCorsConfiguration' :: Text
apiId = Text
pApiId_}

-- | The API identifier.
deleteCorsConfiguration_apiId :: Lens.Lens' DeleteCorsConfiguration Prelude.Text
deleteCorsConfiguration_apiId :: (Text -> f Text)
-> DeleteCorsConfiguration -> f DeleteCorsConfiguration
deleteCorsConfiguration_apiId = (DeleteCorsConfiguration -> Text)
-> (DeleteCorsConfiguration -> Text -> DeleteCorsConfiguration)
-> Lens DeleteCorsConfiguration DeleteCorsConfiguration Text Text
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 :: DeleteCorsConfiguration -> Request DeleteCorsConfiguration
request = Service
-> DeleteCorsConfiguration -> Request DeleteCorsConfiguration
forall a. ToRequest a => Service -> a -> Request a
Request.delete Service
defaultService
  response :: Logger
-> Service
-> Proxy DeleteCorsConfiguration
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteCorsConfiguration)))
response =
    AWSResponse DeleteCorsConfiguration
-> Logger
-> Service
-> Proxy DeleteCorsConfiguration
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteCorsConfiguration)))
forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull
      AWSResponse DeleteCorsConfiguration
DeleteCorsConfigurationResponse
DeleteCorsConfigurationResponse'

instance Prelude.Hashable DeleteCorsConfiguration

instance Prelude.NFData DeleteCorsConfiguration

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

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

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

-- | /See:/ 'newDeleteCorsConfigurationResponse' smart constructor.
data DeleteCorsConfigurationResponse = DeleteCorsConfigurationResponse'
  {
  }
  deriving (DeleteCorsConfigurationResponse
-> DeleteCorsConfigurationResponse -> Bool
(DeleteCorsConfigurationResponse
 -> DeleteCorsConfigurationResponse -> Bool)
-> (DeleteCorsConfigurationResponse
    -> DeleteCorsConfigurationResponse -> Bool)
-> Eq DeleteCorsConfigurationResponse
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]
(Int -> ReadS DeleteCorsConfigurationResponse)
-> ReadS [DeleteCorsConfigurationResponse]
-> ReadPrec DeleteCorsConfigurationResponse
-> ReadPrec [DeleteCorsConfigurationResponse]
-> Read 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
(Int -> DeleteCorsConfigurationResponse -> ShowS)
-> (DeleteCorsConfigurationResponse -> String)
-> ([DeleteCorsConfigurationResponse] -> ShowS)
-> Show DeleteCorsConfigurationResponse
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.
 DeleteCorsConfigurationResponse
 -> Rep DeleteCorsConfigurationResponse x)
-> (forall x.
    Rep DeleteCorsConfigurationResponse x
    -> DeleteCorsConfigurationResponse)
-> Generic DeleteCorsConfigurationResponse
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