{-# 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.CloudFront.DeleteCloudFrontOriginAccessIdentity
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Delete an origin access identity.
module Amazonka.CloudFront.DeleteCloudFrontOriginAccessIdentity
  ( -- * Creating a Request
    DeleteCloudFrontOriginAccessIdentity (..),
    newDeleteCloudFrontOriginAccessIdentity,

    -- * Request Lenses
    deleteCloudFrontOriginAccessIdentity_ifMatch,
    deleteCloudFrontOriginAccessIdentity_id,

    -- * Destructuring the Response
    DeleteCloudFrontOriginAccessIdentityResponse (..),
    newDeleteCloudFrontOriginAccessIdentityResponse,
  )
where

import Amazonka.CloudFront.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

-- | Deletes a origin access identity.
--
-- /See:/ 'newDeleteCloudFrontOriginAccessIdentity' smart constructor.
data DeleteCloudFrontOriginAccessIdentity = DeleteCloudFrontOriginAccessIdentity'
  { -- | The value of the @ETag@ header you received from a previous @GET@ or
    -- @PUT@ request. For example: @E2QWRUHAPOMQZL@.
    DeleteCloudFrontOriginAccessIdentity -> Maybe Text
ifMatch :: Prelude.Maybe Prelude.Text,
    -- | The origin access identity\'s ID.
    DeleteCloudFrontOriginAccessIdentity -> Text
id :: Prelude.Text
  }
  deriving (DeleteCloudFrontOriginAccessIdentity
-> DeleteCloudFrontOriginAccessIdentity -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteCloudFrontOriginAccessIdentity
-> DeleteCloudFrontOriginAccessIdentity -> Bool
$c/= :: DeleteCloudFrontOriginAccessIdentity
-> DeleteCloudFrontOriginAccessIdentity -> Bool
== :: DeleteCloudFrontOriginAccessIdentity
-> DeleteCloudFrontOriginAccessIdentity -> Bool
$c== :: DeleteCloudFrontOriginAccessIdentity
-> DeleteCloudFrontOriginAccessIdentity -> Bool
Prelude.Eq, ReadPrec [DeleteCloudFrontOriginAccessIdentity]
ReadPrec DeleteCloudFrontOriginAccessIdentity
Int -> ReadS DeleteCloudFrontOriginAccessIdentity
ReadS [DeleteCloudFrontOriginAccessIdentity]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteCloudFrontOriginAccessIdentity]
$creadListPrec :: ReadPrec [DeleteCloudFrontOriginAccessIdentity]
readPrec :: ReadPrec DeleteCloudFrontOriginAccessIdentity
$creadPrec :: ReadPrec DeleteCloudFrontOriginAccessIdentity
readList :: ReadS [DeleteCloudFrontOriginAccessIdentity]
$creadList :: ReadS [DeleteCloudFrontOriginAccessIdentity]
readsPrec :: Int -> ReadS DeleteCloudFrontOriginAccessIdentity
$creadsPrec :: Int -> ReadS DeleteCloudFrontOriginAccessIdentity
Prelude.Read, Int -> DeleteCloudFrontOriginAccessIdentity -> ShowS
[DeleteCloudFrontOriginAccessIdentity] -> ShowS
DeleteCloudFrontOriginAccessIdentity -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteCloudFrontOriginAccessIdentity] -> ShowS
$cshowList :: [DeleteCloudFrontOriginAccessIdentity] -> ShowS
show :: DeleteCloudFrontOriginAccessIdentity -> String
$cshow :: DeleteCloudFrontOriginAccessIdentity -> String
showsPrec :: Int -> DeleteCloudFrontOriginAccessIdentity -> ShowS
$cshowsPrec :: Int -> DeleteCloudFrontOriginAccessIdentity -> ShowS
Prelude.Show, forall x.
Rep DeleteCloudFrontOriginAccessIdentity x
-> DeleteCloudFrontOriginAccessIdentity
forall x.
DeleteCloudFrontOriginAccessIdentity
-> Rep DeleteCloudFrontOriginAccessIdentity x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DeleteCloudFrontOriginAccessIdentity x
-> DeleteCloudFrontOriginAccessIdentity
$cfrom :: forall x.
DeleteCloudFrontOriginAccessIdentity
-> Rep DeleteCloudFrontOriginAccessIdentity x
Prelude.Generic)

-- |
-- Create a value of 'DeleteCloudFrontOriginAccessIdentity' 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:
--
-- 'ifMatch', 'deleteCloudFrontOriginAccessIdentity_ifMatch' - The value of the @ETag@ header you received from a previous @GET@ or
-- @PUT@ request. For example: @E2QWRUHAPOMQZL@.
--
-- 'id', 'deleteCloudFrontOriginAccessIdentity_id' - The origin access identity\'s ID.
newDeleteCloudFrontOriginAccessIdentity ::
  -- | 'id'
  Prelude.Text ->
  DeleteCloudFrontOriginAccessIdentity
newDeleteCloudFrontOriginAccessIdentity :: Text -> DeleteCloudFrontOriginAccessIdentity
newDeleteCloudFrontOriginAccessIdentity Text
pId_ =
  DeleteCloudFrontOriginAccessIdentity'
    { $sel:ifMatch:DeleteCloudFrontOriginAccessIdentity' :: Maybe Text
ifMatch =
        forall a. Maybe a
Prelude.Nothing,
      $sel:id:DeleteCloudFrontOriginAccessIdentity' :: Text
id = Text
pId_
    }

-- | The value of the @ETag@ header you received from a previous @GET@ or
-- @PUT@ request. For example: @E2QWRUHAPOMQZL@.
deleteCloudFrontOriginAccessIdentity_ifMatch :: Lens.Lens' DeleteCloudFrontOriginAccessIdentity (Prelude.Maybe Prelude.Text)
deleteCloudFrontOriginAccessIdentity_ifMatch :: Lens' DeleteCloudFrontOriginAccessIdentity (Maybe Text)
deleteCloudFrontOriginAccessIdentity_ifMatch = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteCloudFrontOriginAccessIdentity' {Maybe Text
ifMatch :: Maybe Text
$sel:ifMatch:DeleteCloudFrontOriginAccessIdentity' :: DeleteCloudFrontOriginAccessIdentity -> Maybe Text
ifMatch} -> Maybe Text
ifMatch) (\s :: DeleteCloudFrontOriginAccessIdentity
s@DeleteCloudFrontOriginAccessIdentity' {} Maybe Text
a -> DeleteCloudFrontOriginAccessIdentity
s {$sel:ifMatch:DeleteCloudFrontOriginAccessIdentity' :: Maybe Text
ifMatch = Maybe Text
a} :: DeleteCloudFrontOriginAccessIdentity)

-- | The origin access identity\'s ID.
deleteCloudFrontOriginAccessIdentity_id :: Lens.Lens' DeleteCloudFrontOriginAccessIdentity Prelude.Text
deleteCloudFrontOriginAccessIdentity_id :: Lens' DeleteCloudFrontOriginAccessIdentity Text
deleteCloudFrontOriginAccessIdentity_id = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteCloudFrontOriginAccessIdentity' {Text
id :: Text
$sel:id:DeleteCloudFrontOriginAccessIdentity' :: DeleteCloudFrontOriginAccessIdentity -> Text
id} -> Text
id) (\s :: DeleteCloudFrontOriginAccessIdentity
s@DeleteCloudFrontOriginAccessIdentity' {} Text
a -> DeleteCloudFrontOriginAccessIdentity
s {$sel:id:DeleteCloudFrontOriginAccessIdentity' :: Text
id = Text
a} :: DeleteCloudFrontOriginAccessIdentity)

instance
  Core.AWSRequest
    DeleteCloudFrontOriginAccessIdentity
  where
  type
    AWSResponse DeleteCloudFrontOriginAccessIdentity =
      DeleteCloudFrontOriginAccessIdentityResponse
  request :: (Service -> Service)
-> DeleteCloudFrontOriginAccessIdentity
-> Request DeleteCloudFrontOriginAccessIdentity
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 DeleteCloudFrontOriginAccessIdentity
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse
           (AWSResponse DeleteCloudFrontOriginAccessIdentity)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull
      DeleteCloudFrontOriginAccessIdentityResponse
DeleteCloudFrontOriginAccessIdentityResponse'

instance
  Prelude.Hashable
    DeleteCloudFrontOriginAccessIdentity
  where
  hashWithSalt :: Int -> DeleteCloudFrontOriginAccessIdentity -> Int
hashWithSalt
    Int
_salt
    DeleteCloudFrontOriginAccessIdentity' {Maybe Text
Text
id :: Text
ifMatch :: Maybe Text
$sel:id:DeleteCloudFrontOriginAccessIdentity' :: DeleteCloudFrontOriginAccessIdentity -> Text
$sel:ifMatch:DeleteCloudFrontOriginAccessIdentity' :: DeleteCloudFrontOriginAccessIdentity -> Maybe Text
..} =
      Int
_salt
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
ifMatch
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
id

instance
  Prelude.NFData
    DeleteCloudFrontOriginAccessIdentity
  where
  rnf :: DeleteCloudFrontOriginAccessIdentity -> ()
rnf DeleteCloudFrontOriginAccessIdentity' {Maybe Text
Text
id :: Text
ifMatch :: Maybe Text
$sel:id:DeleteCloudFrontOriginAccessIdentity' :: DeleteCloudFrontOriginAccessIdentity -> Text
$sel:ifMatch:DeleteCloudFrontOriginAccessIdentity' :: DeleteCloudFrontOriginAccessIdentity -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
ifMatch seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
id

instance
  Data.ToHeaders
    DeleteCloudFrontOriginAccessIdentity
  where
  toHeaders :: DeleteCloudFrontOriginAccessIdentity -> [Header]
toHeaders DeleteCloudFrontOriginAccessIdentity' {Maybe Text
Text
id :: Text
ifMatch :: Maybe Text
$sel:id:DeleteCloudFrontOriginAccessIdentity' :: DeleteCloudFrontOriginAccessIdentity -> Text
$sel:ifMatch:DeleteCloudFrontOriginAccessIdentity' :: DeleteCloudFrontOriginAccessIdentity -> Maybe Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat [HeaderName
"If-Match" forall a. ToHeader a => HeaderName -> a -> [Header]
Data.=# Maybe Text
ifMatch]

instance
  Data.ToPath
    DeleteCloudFrontOriginAccessIdentity
  where
  toPath :: DeleteCloudFrontOriginAccessIdentity -> ByteString
toPath DeleteCloudFrontOriginAccessIdentity' {Maybe Text
Text
id :: Text
ifMatch :: Maybe Text
$sel:id:DeleteCloudFrontOriginAccessIdentity' :: DeleteCloudFrontOriginAccessIdentity -> Text
$sel:ifMatch:DeleteCloudFrontOriginAccessIdentity' :: DeleteCloudFrontOriginAccessIdentity -> Maybe Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/2020-05-31/origin-access-identity/cloudfront/",
        forall a. ToByteString a => a -> ByteString
Data.toBS Text
id
      ]

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

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

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

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