{-# 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.ServiceCatalogAppRegistry.DeleteAttributeGroup
-- 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 an attribute group, specified either by its attribute group ID
-- or name.
module Amazonka.ServiceCatalogAppRegistry.DeleteAttributeGroup
  ( -- * Creating a Request
    DeleteAttributeGroup (..),
    newDeleteAttributeGroup,

    -- * Request Lenses
    deleteAttributeGroup_attributeGroup,

    -- * Destructuring the Response
    DeleteAttributeGroupResponse (..),
    newDeleteAttributeGroupResponse,

    -- * Response Lenses
    deleteAttributeGroupResponse_attributeGroup,
    deleteAttributeGroupResponse_httpStatus,
  )
where

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
import Amazonka.ServiceCatalogAppRegistry.Types

-- | /See:/ 'newDeleteAttributeGroup' smart constructor.
data DeleteAttributeGroup = DeleteAttributeGroup'
  { -- | The name or ID of the attribute group that holds the attributes to
    -- describe the application.
    DeleteAttributeGroup -> Text
attributeGroup :: Prelude.Text
  }
  deriving (DeleteAttributeGroup -> DeleteAttributeGroup -> Bool
(DeleteAttributeGroup -> DeleteAttributeGroup -> Bool)
-> (DeleteAttributeGroup -> DeleteAttributeGroup -> Bool)
-> Eq DeleteAttributeGroup
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteAttributeGroup -> DeleteAttributeGroup -> Bool
$c/= :: DeleteAttributeGroup -> DeleteAttributeGroup -> Bool
== :: DeleteAttributeGroup -> DeleteAttributeGroup -> Bool
$c== :: DeleteAttributeGroup -> DeleteAttributeGroup -> Bool
Prelude.Eq, ReadPrec [DeleteAttributeGroup]
ReadPrec DeleteAttributeGroup
Int -> ReadS DeleteAttributeGroup
ReadS [DeleteAttributeGroup]
(Int -> ReadS DeleteAttributeGroup)
-> ReadS [DeleteAttributeGroup]
-> ReadPrec DeleteAttributeGroup
-> ReadPrec [DeleteAttributeGroup]
-> Read DeleteAttributeGroup
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteAttributeGroup]
$creadListPrec :: ReadPrec [DeleteAttributeGroup]
readPrec :: ReadPrec DeleteAttributeGroup
$creadPrec :: ReadPrec DeleteAttributeGroup
readList :: ReadS [DeleteAttributeGroup]
$creadList :: ReadS [DeleteAttributeGroup]
readsPrec :: Int -> ReadS DeleteAttributeGroup
$creadsPrec :: Int -> ReadS DeleteAttributeGroup
Prelude.Read, Int -> DeleteAttributeGroup -> ShowS
[DeleteAttributeGroup] -> ShowS
DeleteAttributeGroup -> String
(Int -> DeleteAttributeGroup -> ShowS)
-> (DeleteAttributeGroup -> String)
-> ([DeleteAttributeGroup] -> ShowS)
-> Show DeleteAttributeGroup
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteAttributeGroup] -> ShowS
$cshowList :: [DeleteAttributeGroup] -> ShowS
show :: DeleteAttributeGroup -> String
$cshow :: DeleteAttributeGroup -> String
showsPrec :: Int -> DeleteAttributeGroup -> ShowS
$cshowsPrec :: Int -> DeleteAttributeGroup -> ShowS
Prelude.Show, (forall x. DeleteAttributeGroup -> Rep DeleteAttributeGroup x)
-> (forall x. Rep DeleteAttributeGroup x -> DeleteAttributeGroup)
-> Generic DeleteAttributeGroup
forall x. Rep DeleteAttributeGroup x -> DeleteAttributeGroup
forall x. DeleteAttributeGroup -> Rep DeleteAttributeGroup x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteAttributeGroup x -> DeleteAttributeGroup
$cfrom :: forall x. DeleteAttributeGroup -> Rep DeleteAttributeGroup x
Prelude.Generic)

-- |
-- Create a value of 'DeleteAttributeGroup' 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:
--
-- 'attributeGroup', 'deleteAttributeGroup_attributeGroup' - The name or ID of the attribute group that holds the attributes to
-- describe the application.
newDeleteAttributeGroup ::
  -- | 'attributeGroup'
  Prelude.Text ->
  DeleteAttributeGroup
newDeleteAttributeGroup :: Text -> DeleteAttributeGroup
newDeleteAttributeGroup Text
pAttributeGroup_ =
  DeleteAttributeGroup' :: Text -> DeleteAttributeGroup
DeleteAttributeGroup'
    { $sel:attributeGroup:DeleteAttributeGroup' :: Text
attributeGroup =
        Text
pAttributeGroup_
    }

-- | The name or ID of the attribute group that holds the attributes to
-- describe the application.
deleteAttributeGroup_attributeGroup :: Lens.Lens' DeleteAttributeGroup Prelude.Text
deleteAttributeGroup_attributeGroup :: (Text -> f Text) -> DeleteAttributeGroup -> f DeleteAttributeGroup
deleteAttributeGroup_attributeGroup = (DeleteAttributeGroup -> Text)
-> (DeleteAttributeGroup -> Text -> DeleteAttributeGroup)
-> Lens DeleteAttributeGroup DeleteAttributeGroup Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteAttributeGroup' {Text
attributeGroup :: Text
$sel:attributeGroup:DeleteAttributeGroup' :: DeleteAttributeGroup -> Text
attributeGroup} -> Text
attributeGroup) (\s :: DeleteAttributeGroup
s@DeleteAttributeGroup' {} Text
a -> DeleteAttributeGroup
s {$sel:attributeGroup:DeleteAttributeGroup' :: Text
attributeGroup = Text
a} :: DeleteAttributeGroup)

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

instance Prelude.NFData DeleteAttributeGroup

instance Core.ToHeaders DeleteAttributeGroup where
  toHeaders :: DeleteAttributeGroup -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DeleteAttributeGroup -> 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 DeleteAttributeGroup where
  toPath :: DeleteAttributeGroup -> ByteString
toPath DeleteAttributeGroup' {Text
attributeGroup :: Text
$sel:attributeGroup:DeleteAttributeGroup' :: DeleteAttributeGroup -> Text
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ByteString
"/attribute-groups/", Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
attributeGroup]

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

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

-- |
-- Create a value of 'DeleteAttributeGroupResponse' 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:
--
-- 'attributeGroup', 'deleteAttributeGroupResponse_attributeGroup' - Information about the deleted attribute group.
--
-- 'httpStatus', 'deleteAttributeGroupResponse_httpStatus' - The response's http status code.
newDeleteAttributeGroupResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DeleteAttributeGroupResponse
newDeleteAttributeGroupResponse :: Int -> DeleteAttributeGroupResponse
newDeleteAttributeGroupResponse Int
pHttpStatus_ =
  DeleteAttributeGroupResponse' :: Maybe AttributeGroupSummary -> Int -> DeleteAttributeGroupResponse
DeleteAttributeGroupResponse'
    { $sel:attributeGroup:DeleteAttributeGroupResponse' :: Maybe AttributeGroupSummary
attributeGroup =
        Maybe AttributeGroupSummary
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DeleteAttributeGroupResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | Information about the deleted attribute group.
deleteAttributeGroupResponse_attributeGroup :: Lens.Lens' DeleteAttributeGroupResponse (Prelude.Maybe AttributeGroupSummary)
deleteAttributeGroupResponse_attributeGroup :: (Maybe AttributeGroupSummary -> f (Maybe AttributeGroupSummary))
-> DeleteAttributeGroupResponse -> f DeleteAttributeGroupResponse
deleteAttributeGroupResponse_attributeGroup = (DeleteAttributeGroupResponse -> Maybe AttributeGroupSummary)
-> (DeleteAttributeGroupResponse
    -> Maybe AttributeGroupSummary -> DeleteAttributeGroupResponse)
-> Lens
     DeleteAttributeGroupResponse
     DeleteAttributeGroupResponse
     (Maybe AttributeGroupSummary)
     (Maybe AttributeGroupSummary)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteAttributeGroupResponse' {Maybe AttributeGroupSummary
attributeGroup :: Maybe AttributeGroupSummary
$sel:attributeGroup:DeleteAttributeGroupResponse' :: DeleteAttributeGroupResponse -> Maybe AttributeGroupSummary
attributeGroup} -> Maybe AttributeGroupSummary
attributeGroup) (\s :: DeleteAttributeGroupResponse
s@DeleteAttributeGroupResponse' {} Maybe AttributeGroupSummary
a -> DeleteAttributeGroupResponse
s {$sel:attributeGroup:DeleteAttributeGroupResponse' :: Maybe AttributeGroupSummary
attributeGroup = Maybe AttributeGroupSummary
a} :: DeleteAttributeGroupResponse)

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

instance Prelude.NFData DeleteAttributeGroupResponse