{-# 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-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)
--
-- 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.Lens as Lens
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
(DeleteCloudFrontOriginAccessIdentity
 -> DeleteCloudFrontOriginAccessIdentity -> Bool)
-> (DeleteCloudFrontOriginAccessIdentity
    -> DeleteCloudFrontOriginAccessIdentity -> Bool)
-> Eq DeleteCloudFrontOriginAccessIdentity
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]
(Int -> ReadS DeleteCloudFrontOriginAccessIdentity)
-> ReadS [DeleteCloudFrontOriginAccessIdentity]
-> ReadPrec DeleteCloudFrontOriginAccessIdentity
-> ReadPrec [DeleteCloudFrontOriginAccessIdentity]
-> Read 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
(Int -> DeleteCloudFrontOriginAccessIdentity -> ShowS)
-> (DeleteCloudFrontOriginAccessIdentity -> String)
-> ([DeleteCloudFrontOriginAccessIdentity] -> ShowS)
-> Show DeleteCloudFrontOriginAccessIdentity
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.
 DeleteCloudFrontOriginAccessIdentity
 -> Rep DeleteCloudFrontOriginAccessIdentity x)
-> (forall x.
    Rep DeleteCloudFrontOriginAccessIdentity x
    -> DeleteCloudFrontOriginAccessIdentity)
-> Generic DeleteCloudFrontOriginAccessIdentity
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' :: Maybe Text -> Text -> DeleteCloudFrontOriginAccessIdentity
DeleteCloudFrontOriginAccessIdentity'
    { $sel:ifMatch:DeleteCloudFrontOriginAccessIdentity' :: Maybe Text
ifMatch =
        Maybe Text
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 :: (Maybe Text -> f (Maybe Text))
-> DeleteCloudFrontOriginAccessIdentity
-> f DeleteCloudFrontOriginAccessIdentity
deleteCloudFrontOriginAccessIdentity_ifMatch = (DeleteCloudFrontOriginAccessIdentity -> Maybe Text)
-> (DeleteCloudFrontOriginAccessIdentity
    -> Maybe Text -> DeleteCloudFrontOriginAccessIdentity)
-> Lens
     DeleteCloudFrontOriginAccessIdentity
     DeleteCloudFrontOriginAccessIdentity
     (Maybe Text)
     (Maybe Text)
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 :: (Text -> f Text)
-> DeleteCloudFrontOriginAccessIdentity
-> f DeleteCloudFrontOriginAccessIdentity
deleteCloudFrontOriginAccessIdentity_id = (DeleteCloudFrontOriginAccessIdentity -> Text)
-> (DeleteCloudFrontOriginAccessIdentity
    -> Text -> DeleteCloudFrontOriginAccessIdentity)
-> Lens
     DeleteCloudFrontOriginAccessIdentity
     DeleteCloudFrontOriginAccessIdentity
     Text
     Text
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 :: DeleteCloudFrontOriginAccessIdentity
-> Request DeleteCloudFrontOriginAccessIdentity
request = Service
-> DeleteCloudFrontOriginAccessIdentity
-> Request DeleteCloudFrontOriginAccessIdentity
forall a. ToRequest a => Service -> a -> Request a
Request.delete Service
defaultService
  response :: Logger
-> Service
-> Proxy DeleteCloudFrontOriginAccessIdentity
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse
           (AWSResponse DeleteCloudFrontOriginAccessIdentity)))
response =
    AWSResponse DeleteCloudFrontOriginAccessIdentity
-> Logger
-> Service
-> Proxy DeleteCloudFrontOriginAccessIdentity
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse
           (AWSResponse DeleteCloudFrontOriginAccessIdentity)))
forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull
      AWSResponse DeleteCloudFrontOriginAccessIdentity
DeleteCloudFrontOriginAccessIdentityResponse
DeleteCloudFrontOriginAccessIdentityResponse'

instance
  Prelude.Hashable
    DeleteCloudFrontOriginAccessIdentity

instance
  Prelude.NFData
    DeleteCloudFrontOriginAccessIdentity

instance
  Core.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
..} =
    [[Header]] -> [Header]
forall a. Monoid a => [a] -> a
Prelude.mconcat [HeaderName
"If-Match" HeaderName -> Maybe Text -> [Header]
forall a. ToHeader a => HeaderName -> a -> [Header]
Core.=# Maybe Text
ifMatch]

instance
  Core.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
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/2020-05-31/origin-access-identity/cloudfront/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
id
      ]

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

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