{-# 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.AppStream.DeleteImageBuilder
-- 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 the specified image builder and releases the capacity.
module Amazonka.AppStream.DeleteImageBuilder
  ( -- * Creating a Request
    DeleteImageBuilder (..),
    newDeleteImageBuilder,

    -- * Request Lenses
    deleteImageBuilder_name,

    -- * Destructuring the Response
    DeleteImageBuilderResponse (..),
    newDeleteImageBuilderResponse,

    -- * Response Lenses
    deleteImageBuilderResponse_imageBuilder,
    deleteImageBuilderResponse_httpStatus,
  )
where

import Amazonka.AppStream.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:/ 'newDeleteImageBuilder' smart constructor.
data DeleteImageBuilder = DeleteImageBuilder'
  { -- | The name of the image builder.
    DeleteImageBuilder -> Text
name :: Prelude.Text
  }
  deriving (DeleteImageBuilder -> DeleteImageBuilder -> Bool
(DeleteImageBuilder -> DeleteImageBuilder -> Bool)
-> (DeleteImageBuilder -> DeleteImageBuilder -> Bool)
-> Eq DeleteImageBuilder
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteImageBuilder -> DeleteImageBuilder -> Bool
$c/= :: DeleteImageBuilder -> DeleteImageBuilder -> Bool
== :: DeleteImageBuilder -> DeleteImageBuilder -> Bool
$c== :: DeleteImageBuilder -> DeleteImageBuilder -> Bool
Prelude.Eq, ReadPrec [DeleteImageBuilder]
ReadPrec DeleteImageBuilder
Int -> ReadS DeleteImageBuilder
ReadS [DeleteImageBuilder]
(Int -> ReadS DeleteImageBuilder)
-> ReadS [DeleteImageBuilder]
-> ReadPrec DeleteImageBuilder
-> ReadPrec [DeleteImageBuilder]
-> Read DeleteImageBuilder
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteImageBuilder]
$creadListPrec :: ReadPrec [DeleteImageBuilder]
readPrec :: ReadPrec DeleteImageBuilder
$creadPrec :: ReadPrec DeleteImageBuilder
readList :: ReadS [DeleteImageBuilder]
$creadList :: ReadS [DeleteImageBuilder]
readsPrec :: Int -> ReadS DeleteImageBuilder
$creadsPrec :: Int -> ReadS DeleteImageBuilder
Prelude.Read, Int -> DeleteImageBuilder -> ShowS
[DeleteImageBuilder] -> ShowS
DeleteImageBuilder -> String
(Int -> DeleteImageBuilder -> ShowS)
-> (DeleteImageBuilder -> String)
-> ([DeleteImageBuilder] -> ShowS)
-> Show DeleteImageBuilder
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteImageBuilder] -> ShowS
$cshowList :: [DeleteImageBuilder] -> ShowS
show :: DeleteImageBuilder -> String
$cshow :: DeleteImageBuilder -> String
showsPrec :: Int -> DeleteImageBuilder -> ShowS
$cshowsPrec :: Int -> DeleteImageBuilder -> ShowS
Prelude.Show, (forall x. DeleteImageBuilder -> Rep DeleteImageBuilder x)
-> (forall x. Rep DeleteImageBuilder x -> DeleteImageBuilder)
-> Generic DeleteImageBuilder
forall x. Rep DeleteImageBuilder x -> DeleteImageBuilder
forall x. DeleteImageBuilder -> Rep DeleteImageBuilder x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteImageBuilder x -> DeleteImageBuilder
$cfrom :: forall x. DeleteImageBuilder -> Rep DeleteImageBuilder x
Prelude.Generic)

-- |
-- Create a value of 'DeleteImageBuilder' 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:
--
-- 'name', 'deleteImageBuilder_name' - The name of the image builder.
newDeleteImageBuilder ::
  -- | 'name'
  Prelude.Text ->
  DeleteImageBuilder
newDeleteImageBuilder :: Text -> DeleteImageBuilder
newDeleteImageBuilder Text
pName_ =
  DeleteImageBuilder' :: Text -> DeleteImageBuilder
DeleteImageBuilder' {$sel:name:DeleteImageBuilder' :: Text
name = Text
pName_}

-- | The name of the image builder.
deleteImageBuilder_name :: Lens.Lens' DeleteImageBuilder Prelude.Text
deleteImageBuilder_name :: (Text -> f Text) -> DeleteImageBuilder -> f DeleteImageBuilder
deleteImageBuilder_name = (DeleteImageBuilder -> Text)
-> (DeleteImageBuilder -> Text -> DeleteImageBuilder)
-> Lens DeleteImageBuilder DeleteImageBuilder Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteImageBuilder' {Text
name :: Text
$sel:name:DeleteImageBuilder' :: DeleteImageBuilder -> Text
name} -> Text
name) (\s :: DeleteImageBuilder
s@DeleteImageBuilder' {} Text
a -> DeleteImageBuilder
s {$sel:name:DeleteImageBuilder' :: Text
name = Text
a} :: DeleteImageBuilder)

instance Core.AWSRequest DeleteImageBuilder where
  type
    AWSResponse DeleteImageBuilder =
      DeleteImageBuilderResponse
  request :: DeleteImageBuilder -> Request DeleteImageBuilder
request = Service -> DeleteImageBuilder -> Request DeleteImageBuilder
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy DeleteImageBuilder
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteImageBuilder)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse DeleteImageBuilder))
-> Logger
-> Service
-> Proxy DeleteImageBuilder
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteImageBuilder)))
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 ImageBuilder -> Int -> DeleteImageBuilderResponse
DeleteImageBuilderResponse'
            (Maybe ImageBuilder -> Int -> DeleteImageBuilderResponse)
-> Either String (Maybe ImageBuilder)
-> Either String (Int -> DeleteImageBuilderResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe ImageBuilder)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"ImageBuilder")
            Either String (Int -> DeleteImageBuilderResponse)
-> Either String Int -> Either String DeleteImageBuilderResponse
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 DeleteImageBuilder

instance Prelude.NFData DeleteImageBuilder

instance Core.ToHeaders DeleteImageBuilder where
  toHeaders :: DeleteImageBuilder -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DeleteImageBuilder -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"PhotonAdminProxyService.DeleteImageBuilder" ::
                          Prelude.ByteString
                      ),
            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.ToJSON DeleteImageBuilder where
  toJSON :: DeleteImageBuilder -> Value
toJSON DeleteImageBuilder' {Text
name :: Text
$sel:name:DeleteImageBuilder' :: DeleteImageBuilder -> Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Name" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
name)]
      )

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

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

-- | /See:/ 'newDeleteImageBuilderResponse' smart constructor.
data DeleteImageBuilderResponse = DeleteImageBuilderResponse'
  { -- | Information about the image builder.
    DeleteImageBuilderResponse -> Maybe ImageBuilder
imageBuilder :: Prelude.Maybe ImageBuilder,
    -- | The response's http status code.
    DeleteImageBuilderResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DeleteImageBuilderResponse -> DeleteImageBuilderResponse -> Bool
(DeleteImageBuilderResponse -> DeleteImageBuilderResponse -> Bool)
-> (DeleteImageBuilderResponse
    -> DeleteImageBuilderResponse -> Bool)
-> Eq DeleteImageBuilderResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteImageBuilderResponse -> DeleteImageBuilderResponse -> Bool
$c/= :: DeleteImageBuilderResponse -> DeleteImageBuilderResponse -> Bool
== :: DeleteImageBuilderResponse -> DeleteImageBuilderResponse -> Bool
$c== :: DeleteImageBuilderResponse -> DeleteImageBuilderResponse -> Bool
Prelude.Eq, ReadPrec [DeleteImageBuilderResponse]
ReadPrec DeleteImageBuilderResponse
Int -> ReadS DeleteImageBuilderResponse
ReadS [DeleteImageBuilderResponse]
(Int -> ReadS DeleteImageBuilderResponse)
-> ReadS [DeleteImageBuilderResponse]
-> ReadPrec DeleteImageBuilderResponse
-> ReadPrec [DeleteImageBuilderResponse]
-> Read DeleteImageBuilderResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteImageBuilderResponse]
$creadListPrec :: ReadPrec [DeleteImageBuilderResponse]
readPrec :: ReadPrec DeleteImageBuilderResponse
$creadPrec :: ReadPrec DeleteImageBuilderResponse
readList :: ReadS [DeleteImageBuilderResponse]
$creadList :: ReadS [DeleteImageBuilderResponse]
readsPrec :: Int -> ReadS DeleteImageBuilderResponse
$creadsPrec :: Int -> ReadS DeleteImageBuilderResponse
Prelude.Read, Int -> DeleteImageBuilderResponse -> ShowS
[DeleteImageBuilderResponse] -> ShowS
DeleteImageBuilderResponse -> String
(Int -> DeleteImageBuilderResponse -> ShowS)
-> (DeleteImageBuilderResponse -> String)
-> ([DeleteImageBuilderResponse] -> ShowS)
-> Show DeleteImageBuilderResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteImageBuilderResponse] -> ShowS
$cshowList :: [DeleteImageBuilderResponse] -> ShowS
show :: DeleteImageBuilderResponse -> String
$cshow :: DeleteImageBuilderResponse -> String
showsPrec :: Int -> DeleteImageBuilderResponse -> ShowS
$cshowsPrec :: Int -> DeleteImageBuilderResponse -> ShowS
Prelude.Show, (forall x.
 DeleteImageBuilderResponse -> Rep DeleteImageBuilderResponse x)
-> (forall x.
    Rep DeleteImageBuilderResponse x -> DeleteImageBuilderResponse)
-> Generic DeleteImageBuilderResponse
forall x.
Rep DeleteImageBuilderResponse x -> DeleteImageBuilderResponse
forall x.
DeleteImageBuilderResponse -> Rep DeleteImageBuilderResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DeleteImageBuilderResponse x -> DeleteImageBuilderResponse
$cfrom :: forall x.
DeleteImageBuilderResponse -> Rep DeleteImageBuilderResponse x
Prelude.Generic)

-- |
-- Create a value of 'DeleteImageBuilderResponse' 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:
--
-- 'imageBuilder', 'deleteImageBuilderResponse_imageBuilder' - Information about the image builder.
--
-- 'httpStatus', 'deleteImageBuilderResponse_httpStatus' - The response's http status code.
newDeleteImageBuilderResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DeleteImageBuilderResponse
newDeleteImageBuilderResponse :: Int -> DeleteImageBuilderResponse
newDeleteImageBuilderResponse Int
pHttpStatus_ =
  DeleteImageBuilderResponse' :: Maybe ImageBuilder -> Int -> DeleteImageBuilderResponse
DeleteImageBuilderResponse'
    { $sel:imageBuilder:DeleteImageBuilderResponse' :: Maybe ImageBuilder
imageBuilder =
        Maybe ImageBuilder
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DeleteImageBuilderResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | Information about the image builder.
deleteImageBuilderResponse_imageBuilder :: Lens.Lens' DeleteImageBuilderResponse (Prelude.Maybe ImageBuilder)
deleteImageBuilderResponse_imageBuilder :: (Maybe ImageBuilder -> f (Maybe ImageBuilder))
-> DeleteImageBuilderResponse -> f DeleteImageBuilderResponse
deleteImageBuilderResponse_imageBuilder = (DeleteImageBuilderResponse -> Maybe ImageBuilder)
-> (DeleteImageBuilderResponse
    -> Maybe ImageBuilder -> DeleteImageBuilderResponse)
-> Lens
     DeleteImageBuilderResponse
     DeleteImageBuilderResponse
     (Maybe ImageBuilder)
     (Maybe ImageBuilder)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteImageBuilderResponse' {Maybe ImageBuilder
imageBuilder :: Maybe ImageBuilder
$sel:imageBuilder:DeleteImageBuilderResponse' :: DeleteImageBuilderResponse -> Maybe ImageBuilder
imageBuilder} -> Maybe ImageBuilder
imageBuilder) (\s :: DeleteImageBuilderResponse
s@DeleteImageBuilderResponse' {} Maybe ImageBuilder
a -> DeleteImageBuilderResponse
s {$sel:imageBuilder:DeleteImageBuilderResponse' :: Maybe ImageBuilder
imageBuilder = Maybe ImageBuilder
a} :: DeleteImageBuilderResponse)

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

instance Prelude.NFData DeleteImageBuilderResponse