{-# 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.ImageBuilder.DeleteDistributionConfiguration
-- 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 distribution configuration.
module Amazonka.ImageBuilder.DeleteDistributionConfiguration
  ( -- * Creating a Request
    DeleteDistributionConfiguration (..),
    newDeleteDistributionConfiguration,

    -- * Request Lenses
    deleteDistributionConfiguration_distributionConfigurationArn,

    -- * Destructuring the Response
    DeleteDistributionConfigurationResponse (..),
    newDeleteDistributionConfigurationResponse,

    -- * Response Lenses
    deleteDistributionConfigurationResponse_requestId,
    deleteDistributionConfigurationResponse_distributionConfigurationArn,
    deleteDistributionConfigurationResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import Amazonka.ImageBuilder.Types
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:/ 'newDeleteDistributionConfiguration' smart constructor.
data DeleteDistributionConfiguration = DeleteDistributionConfiguration'
  { -- | The Amazon Resource Name (ARN) of the distribution configuration to
    -- delete.
    DeleteDistributionConfiguration -> Text
distributionConfigurationArn :: Prelude.Text
  }
  deriving (DeleteDistributionConfiguration
-> DeleteDistributionConfiguration -> Bool
(DeleteDistributionConfiguration
 -> DeleteDistributionConfiguration -> Bool)
-> (DeleteDistributionConfiguration
    -> DeleteDistributionConfiguration -> Bool)
-> Eq DeleteDistributionConfiguration
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteDistributionConfiguration
-> DeleteDistributionConfiguration -> Bool
$c/= :: DeleteDistributionConfiguration
-> DeleteDistributionConfiguration -> Bool
== :: DeleteDistributionConfiguration
-> DeleteDistributionConfiguration -> Bool
$c== :: DeleteDistributionConfiguration
-> DeleteDistributionConfiguration -> Bool
Prelude.Eq, ReadPrec [DeleteDistributionConfiguration]
ReadPrec DeleteDistributionConfiguration
Int -> ReadS DeleteDistributionConfiguration
ReadS [DeleteDistributionConfiguration]
(Int -> ReadS DeleteDistributionConfiguration)
-> ReadS [DeleteDistributionConfiguration]
-> ReadPrec DeleteDistributionConfiguration
-> ReadPrec [DeleteDistributionConfiguration]
-> Read DeleteDistributionConfiguration
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteDistributionConfiguration]
$creadListPrec :: ReadPrec [DeleteDistributionConfiguration]
readPrec :: ReadPrec DeleteDistributionConfiguration
$creadPrec :: ReadPrec DeleteDistributionConfiguration
readList :: ReadS [DeleteDistributionConfiguration]
$creadList :: ReadS [DeleteDistributionConfiguration]
readsPrec :: Int -> ReadS DeleteDistributionConfiguration
$creadsPrec :: Int -> ReadS DeleteDistributionConfiguration
Prelude.Read, Int -> DeleteDistributionConfiguration -> ShowS
[DeleteDistributionConfiguration] -> ShowS
DeleteDistributionConfiguration -> String
(Int -> DeleteDistributionConfiguration -> ShowS)
-> (DeleteDistributionConfiguration -> String)
-> ([DeleteDistributionConfiguration] -> ShowS)
-> Show DeleteDistributionConfiguration
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteDistributionConfiguration] -> ShowS
$cshowList :: [DeleteDistributionConfiguration] -> ShowS
show :: DeleteDistributionConfiguration -> String
$cshow :: DeleteDistributionConfiguration -> String
showsPrec :: Int -> DeleteDistributionConfiguration -> ShowS
$cshowsPrec :: Int -> DeleteDistributionConfiguration -> ShowS
Prelude.Show, (forall x.
 DeleteDistributionConfiguration
 -> Rep DeleteDistributionConfiguration x)
-> (forall x.
    Rep DeleteDistributionConfiguration x
    -> DeleteDistributionConfiguration)
-> Generic DeleteDistributionConfiguration
forall x.
Rep DeleteDistributionConfiguration x
-> DeleteDistributionConfiguration
forall x.
DeleteDistributionConfiguration
-> Rep DeleteDistributionConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DeleteDistributionConfiguration x
-> DeleteDistributionConfiguration
$cfrom :: forall x.
DeleteDistributionConfiguration
-> Rep DeleteDistributionConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'DeleteDistributionConfiguration' 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:
--
-- 'distributionConfigurationArn', 'deleteDistributionConfiguration_distributionConfigurationArn' - The Amazon Resource Name (ARN) of the distribution configuration to
-- delete.
newDeleteDistributionConfiguration ::
  -- | 'distributionConfigurationArn'
  Prelude.Text ->
  DeleteDistributionConfiguration
newDeleteDistributionConfiguration :: Text -> DeleteDistributionConfiguration
newDeleteDistributionConfiguration
  Text
pDistributionConfigurationArn_ =
    DeleteDistributionConfiguration' :: Text -> DeleteDistributionConfiguration
DeleteDistributionConfiguration'
      { $sel:distributionConfigurationArn:DeleteDistributionConfiguration' :: Text
distributionConfigurationArn =
          Text
pDistributionConfigurationArn_
      }

-- | The Amazon Resource Name (ARN) of the distribution configuration to
-- delete.
deleteDistributionConfiguration_distributionConfigurationArn :: Lens.Lens' DeleteDistributionConfiguration Prelude.Text
deleteDistributionConfiguration_distributionConfigurationArn :: (Text -> f Text)
-> DeleteDistributionConfiguration
-> f DeleteDistributionConfiguration
deleteDistributionConfiguration_distributionConfigurationArn = (DeleteDistributionConfiguration -> Text)
-> (DeleteDistributionConfiguration
    -> Text -> DeleteDistributionConfiguration)
-> Lens
     DeleteDistributionConfiguration
     DeleteDistributionConfiguration
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteDistributionConfiguration' {Text
distributionConfigurationArn :: Text
$sel:distributionConfigurationArn:DeleteDistributionConfiguration' :: DeleteDistributionConfiguration -> Text
distributionConfigurationArn} -> Text
distributionConfigurationArn) (\s :: DeleteDistributionConfiguration
s@DeleteDistributionConfiguration' {} Text
a -> DeleteDistributionConfiguration
s {$sel:distributionConfigurationArn:DeleteDistributionConfiguration' :: Text
distributionConfigurationArn = Text
a} :: DeleteDistributionConfiguration)

instance
  Core.AWSRequest
    DeleteDistributionConfiguration
  where
  type
    AWSResponse DeleteDistributionConfiguration =
      DeleteDistributionConfigurationResponse
  request :: DeleteDistributionConfiguration
-> Request DeleteDistributionConfiguration
request = Service
-> DeleteDistributionConfiguration
-> Request DeleteDistributionConfiguration
forall a. ToRequest a => Service -> a -> Request a
Request.delete Service
defaultService
  response :: Logger
-> Service
-> Proxy DeleteDistributionConfiguration
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse (AWSResponse DeleteDistributionConfiguration)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse DeleteDistributionConfiguration))
-> Logger
-> Service
-> Proxy DeleteDistributionConfiguration
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse (AWSResponse DeleteDistributionConfiguration)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe Text
-> Maybe Text -> Int -> DeleteDistributionConfigurationResponse
DeleteDistributionConfigurationResponse'
            (Maybe Text
 -> Maybe Text -> Int -> DeleteDistributionConfigurationResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe Text -> Int -> DeleteDistributionConfigurationResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"requestId")
            Either
  String
  (Maybe Text -> Int -> DeleteDistributionConfigurationResponse)
-> Either String (Maybe Text)
-> Either String (Int -> DeleteDistributionConfigurationResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"distributionConfigurationArn")
            Either String (Int -> DeleteDistributionConfigurationResponse)
-> Either String Int
-> Either String DeleteDistributionConfigurationResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance
  Prelude.Hashable
    DeleteDistributionConfiguration

instance
  Prelude.NFData
    DeleteDistributionConfiguration

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

instance Core.ToPath DeleteDistributionConfiguration where
  toPath :: DeleteDistributionConfiguration -> ByteString
toPath =
    ByteString -> DeleteDistributionConfiguration -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/DeleteDistributionConfiguration"

instance Core.ToQuery DeleteDistributionConfiguration where
  toQuery :: DeleteDistributionConfiguration -> QueryString
toQuery DeleteDistributionConfiguration' {Text
distributionConfigurationArn :: Text
$sel:distributionConfigurationArn:DeleteDistributionConfiguration' :: DeleteDistributionConfiguration -> Text
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"distributionConfigurationArn"
          ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
distributionConfigurationArn
      ]

-- | /See:/ 'newDeleteDistributionConfigurationResponse' smart constructor.
data DeleteDistributionConfigurationResponse = DeleteDistributionConfigurationResponse'
  { -- | The request ID that uniquely identifies this request.
    DeleteDistributionConfigurationResponse -> Maybe Text
requestId :: Prelude.Maybe Prelude.Text,
    -- | The Amazon Resource Name (ARN) of the distribution configuration that
    -- was deleted.
    DeleteDistributionConfigurationResponse -> Maybe Text
distributionConfigurationArn :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    DeleteDistributionConfigurationResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DeleteDistributionConfigurationResponse
-> DeleteDistributionConfigurationResponse -> Bool
(DeleteDistributionConfigurationResponse
 -> DeleteDistributionConfigurationResponse -> Bool)
-> (DeleteDistributionConfigurationResponse
    -> DeleteDistributionConfigurationResponse -> Bool)
-> Eq DeleteDistributionConfigurationResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteDistributionConfigurationResponse
-> DeleteDistributionConfigurationResponse -> Bool
$c/= :: DeleteDistributionConfigurationResponse
-> DeleteDistributionConfigurationResponse -> Bool
== :: DeleteDistributionConfigurationResponse
-> DeleteDistributionConfigurationResponse -> Bool
$c== :: DeleteDistributionConfigurationResponse
-> DeleteDistributionConfigurationResponse -> Bool
Prelude.Eq, ReadPrec [DeleteDistributionConfigurationResponse]
ReadPrec DeleteDistributionConfigurationResponse
Int -> ReadS DeleteDistributionConfigurationResponse
ReadS [DeleteDistributionConfigurationResponse]
(Int -> ReadS DeleteDistributionConfigurationResponse)
-> ReadS [DeleteDistributionConfigurationResponse]
-> ReadPrec DeleteDistributionConfigurationResponse
-> ReadPrec [DeleteDistributionConfigurationResponse]
-> Read DeleteDistributionConfigurationResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteDistributionConfigurationResponse]
$creadListPrec :: ReadPrec [DeleteDistributionConfigurationResponse]
readPrec :: ReadPrec DeleteDistributionConfigurationResponse
$creadPrec :: ReadPrec DeleteDistributionConfigurationResponse
readList :: ReadS [DeleteDistributionConfigurationResponse]
$creadList :: ReadS [DeleteDistributionConfigurationResponse]
readsPrec :: Int -> ReadS DeleteDistributionConfigurationResponse
$creadsPrec :: Int -> ReadS DeleteDistributionConfigurationResponse
Prelude.Read, Int -> DeleteDistributionConfigurationResponse -> ShowS
[DeleteDistributionConfigurationResponse] -> ShowS
DeleteDistributionConfigurationResponse -> String
(Int -> DeleteDistributionConfigurationResponse -> ShowS)
-> (DeleteDistributionConfigurationResponse -> String)
-> ([DeleteDistributionConfigurationResponse] -> ShowS)
-> Show DeleteDistributionConfigurationResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteDistributionConfigurationResponse] -> ShowS
$cshowList :: [DeleteDistributionConfigurationResponse] -> ShowS
show :: DeleteDistributionConfigurationResponse -> String
$cshow :: DeleteDistributionConfigurationResponse -> String
showsPrec :: Int -> DeleteDistributionConfigurationResponse -> ShowS
$cshowsPrec :: Int -> DeleteDistributionConfigurationResponse -> ShowS
Prelude.Show, (forall x.
 DeleteDistributionConfigurationResponse
 -> Rep DeleteDistributionConfigurationResponse x)
-> (forall x.
    Rep DeleteDistributionConfigurationResponse x
    -> DeleteDistributionConfigurationResponse)
-> Generic DeleteDistributionConfigurationResponse
forall x.
Rep DeleteDistributionConfigurationResponse x
-> DeleteDistributionConfigurationResponse
forall x.
DeleteDistributionConfigurationResponse
-> Rep DeleteDistributionConfigurationResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DeleteDistributionConfigurationResponse x
-> DeleteDistributionConfigurationResponse
$cfrom :: forall x.
DeleteDistributionConfigurationResponse
-> Rep DeleteDistributionConfigurationResponse x
Prelude.Generic)

-- |
-- Create a value of 'DeleteDistributionConfigurationResponse' 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:
--
-- 'requestId', 'deleteDistributionConfigurationResponse_requestId' - The request ID that uniquely identifies this request.
--
-- 'distributionConfigurationArn', 'deleteDistributionConfigurationResponse_distributionConfigurationArn' - The Amazon Resource Name (ARN) of the distribution configuration that
-- was deleted.
--
-- 'httpStatus', 'deleteDistributionConfigurationResponse_httpStatus' - The response's http status code.
newDeleteDistributionConfigurationResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DeleteDistributionConfigurationResponse
newDeleteDistributionConfigurationResponse :: Int -> DeleteDistributionConfigurationResponse
newDeleteDistributionConfigurationResponse
  Int
pHttpStatus_ =
    DeleteDistributionConfigurationResponse' :: Maybe Text
-> Maybe Text -> Int -> DeleteDistributionConfigurationResponse
DeleteDistributionConfigurationResponse'
      { $sel:requestId:DeleteDistributionConfigurationResponse' :: Maybe Text
requestId =
          Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:distributionConfigurationArn:DeleteDistributionConfigurationResponse' :: Maybe Text
distributionConfigurationArn =
          Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:httpStatus:DeleteDistributionConfigurationResponse' :: Int
httpStatus = Int
pHttpStatus_
      }

-- | The request ID that uniquely identifies this request.
deleteDistributionConfigurationResponse_requestId :: Lens.Lens' DeleteDistributionConfigurationResponse (Prelude.Maybe Prelude.Text)
deleteDistributionConfigurationResponse_requestId :: (Maybe Text -> f (Maybe Text))
-> DeleteDistributionConfigurationResponse
-> f DeleteDistributionConfigurationResponse
deleteDistributionConfigurationResponse_requestId = (DeleteDistributionConfigurationResponse -> Maybe Text)
-> (DeleteDistributionConfigurationResponse
    -> Maybe Text -> DeleteDistributionConfigurationResponse)
-> Lens
     DeleteDistributionConfigurationResponse
     DeleteDistributionConfigurationResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteDistributionConfigurationResponse' {Maybe Text
requestId :: Maybe Text
$sel:requestId:DeleteDistributionConfigurationResponse' :: DeleteDistributionConfigurationResponse -> Maybe Text
requestId} -> Maybe Text
requestId) (\s :: DeleteDistributionConfigurationResponse
s@DeleteDistributionConfigurationResponse' {} Maybe Text
a -> DeleteDistributionConfigurationResponse
s {$sel:requestId:DeleteDistributionConfigurationResponse' :: Maybe Text
requestId = Maybe Text
a} :: DeleteDistributionConfigurationResponse)

-- | The Amazon Resource Name (ARN) of the distribution configuration that
-- was deleted.
deleteDistributionConfigurationResponse_distributionConfigurationArn :: Lens.Lens' DeleteDistributionConfigurationResponse (Prelude.Maybe Prelude.Text)
deleteDistributionConfigurationResponse_distributionConfigurationArn :: (Maybe Text -> f (Maybe Text))
-> DeleteDistributionConfigurationResponse
-> f DeleteDistributionConfigurationResponse
deleteDistributionConfigurationResponse_distributionConfigurationArn = (DeleteDistributionConfigurationResponse -> Maybe Text)
-> (DeleteDistributionConfigurationResponse
    -> Maybe Text -> DeleteDistributionConfigurationResponse)
-> Lens
     DeleteDistributionConfigurationResponse
     DeleteDistributionConfigurationResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteDistributionConfigurationResponse' {Maybe Text
distributionConfigurationArn :: Maybe Text
$sel:distributionConfigurationArn:DeleteDistributionConfigurationResponse' :: DeleteDistributionConfigurationResponse -> Maybe Text
distributionConfigurationArn} -> Maybe Text
distributionConfigurationArn) (\s :: DeleteDistributionConfigurationResponse
s@DeleteDistributionConfigurationResponse' {} Maybe Text
a -> DeleteDistributionConfigurationResponse
s {$sel:distributionConfigurationArn:DeleteDistributionConfigurationResponse' :: Maybe Text
distributionConfigurationArn = Maybe Text
a} :: DeleteDistributionConfigurationResponse)

-- | The response's http status code.
deleteDistributionConfigurationResponse_httpStatus :: Lens.Lens' DeleteDistributionConfigurationResponse Prelude.Int
deleteDistributionConfigurationResponse_httpStatus :: (Int -> f Int)
-> DeleteDistributionConfigurationResponse
-> f DeleteDistributionConfigurationResponse
deleteDistributionConfigurationResponse_httpStatus = (DeleteDistributionConfigurationResponse -> Int)
-> (DeleteDistributionConfigurationResponse
    -> Int -> DeleteDistributionConfigurationResponse)
-> Lens
     DeleteDistributionConfigurationResponse
     DeleteDistributionConfigurationResponse
     Int
     Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteDistributionConfigurationResponse' {Int
httpStatus :: Int
$sel:httpStatus:DeleteDistributionConfigurationResponse' :: DeleteDistributionConfigurationResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DeleteDistributionConfigurationResponse
s@DeleteDistributionConfigurationResponse' {} Int
a -> DeleteDistributionConfigurationResponse
s {$sel:httpStatus:DeleteDistributionConfigurationResponse' :: Int
httpStatus = Int
a} :: DeleteDistributionConfigurationResponse)

instance
  Prelude.NFData
    DeleteDistributionConfigurationResponse