{-# 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.DisassociateAttributeGroup
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Disassociates an attribute group from an application to remove the extra
-- attributes contained in the attribute group from the application\'s
-- metadata. This operation reverts @AssociateAttributeGroup@.
module Amazonka.ServiceCatalogAppRegistry.DisassociateAttributeGroup
  ( -- * Creating a Request
    DisassociateAttributeGroup (..),
    newDisassociateAttributeGroup,

    -- * Request Lenses
    disassociateAttributeGroup_application,
    disassociateAttributeGroup_attributeGroup,

    -- * Destructuring the Response
    DisassociateAttributeGroupResponse (..),
    newDisassociateAttributeGroupResponse,

    -- * Response Lenses
    disassociateAttributeGroupResponse_applicationArn,
    disassociateAttributeGroupResponse_attributeGroupArn,
    disassociateAttributeGroupResponse_httpStatus,
  )
where

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

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

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

-- | The name or ID of the application.
disassociateAttributeGroup_application :: Lens.Lens' DisassociateAttributeGroup Prelude.Text
disassociateAttributeGroup_application :: Lens' DisassociateAttributeGroup Text
disassociateAttributeGroup_application = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DisassociateAttributeGroup' {Text
application :: Text
$sel:application:DisassociateAttributeGroup' :: DisassociateAttributeGroup -> Text
application} -> Text
application) (\s :: DisassociateAttributeGroup
s@DisassociateAttributeGroup' {} Text
a -> DisassociateAttributeGroup
s {$sel:application:DisassociateAttributeGroup' :: Text
application = Text
a} :: DisassociateAttributeGroup)

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

instance Core.AWSRequest DisassociateAttributeGroup where
  type
    AWSResponse DisassociateAttributeGroup =
      DisassociateAttributeGroupResponse
  request :: (Service -> Service)
-> DisassociateAttributeGroup -> Request DisassociateAttributeGroup
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 DisassociateAttributeGroup
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DisassociateAttributeGroup)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe Text
-> Maybe Text -> Int -> DisassociateAttributeGroupResponse
DisassociateAttributeGroupResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"applicationArn")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"attributeGroupArn")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable DisassociateAttributeGroup where
  hashWithSalt :: Int -> DisassociateAttributeGroup -> Int
hashWithSalt Int
_salt DisassociateAttributeGroup' {Text
attributeGroup :: Text
application :: Text
$sel:attributeGroup:DisassociateAttributeGroup' :: DisassociateAttributeGroup -> Text
$sel:application:DisassociateAttributeGroup' :: DisassociateAttributeGroup -> Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
application
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
attributeGroup

instance Prelude.NFData DisassociateAttributeGroup where
  rnf :: DisassociateAttributeGroup -> ()
rnf DisassociateAttributeGroup' {Text
attributeGroup :: Text
application :: Text
$sel:attributeGroup:DisassociateAttributeGroup' :: DisassociateAttributeGroup -> Text
$sel:application:DisassociateAttributeGroup' :: DisassociateAttributeGroup -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
application
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
attributeGroup

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

instance Data.ToPath DisassociateAttributeGroup where
  toPath :: DisassociateAttributeGroup -> ByteString
toPath DisassociateAttributeGroup' {Text
attributeGroup :: Text
application :: Text
$sel:attributeGroup:DisassociateAttributeGroup' :: DisassociateAttributeGroup -> Text
$sel:application:DisassociateAttributeGroup' :: DisassociateAttributeGroup -> Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/applications/",
        forall a. ToByteString a => a -> ByteString
Data.toBS Text
application,
        ByteString
"/attribute-groups/",
        forall a. ToByteString a => a -> ByteString
Data.toBS Text
attributeGroup
      ]

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

-- | /See:/ 'newDisassociateAttributeGroupResponse' smart constructor.
data DisassociateAttributeGroupResponse = DisassociateAttributeGroupResponse'
  { -- | The Amazon resource name (ARN) that specifies the application.
    DisassociateAttributeGroupResponse -> Maybe Text
applicationArn :: Prelude.Maybe Prelude.Text,
    -- | The Amazon resource name (ARN) that specifies the attribute group.
    DisassociateAttributeGroupResponse -> Maybe Text
attributeGroupArn :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    DisassociateAttributeGroupResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DisassociateAttributeGroupResponse
-> DisassociateAttributeGroupResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DisassociateAttributeGroupResponse
-> DisassociateAttributeGroupResponse -> Bool
$c/= :: DisassociateAttributeGroupResponse
-> DisassociateAttributeGroupResponse -> Bool
== :: DisassociateAttributeGroupResponse
-> DisassociateAttributeGroupResponse -> Bool
$c== :: DisassociateAttributeGroupResponse
-> DisassociateAttributeGroupResponse -> Bool
Prelude.Eq, ReadPrec [DisassociateAttributeGroupResponse]
ReadPrec DisassociateAttributeGroupResponse
Int -> ReadS DisassociateAttributeGroupResponse
ReadS [DisassociateAttributeGroupResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DisassociateAttributeGroupResponse]
$creadListPrec :: ReadPrec [DisassociateAttributeGroupResponse]
readPrec :: ReadPrec DisassociateAttributeGroupResponse
$creadPrec :: ReadPrec DisassociateAttributeGroupResponse
readList :: ReadS [DisassociateAttributeGroupResponse]
$creadList :: ReadS [DisassociateAttributeGroupResponse]
readsPrec :: Int -> ReadS DisassociateAttributeGroupResponse
$creadsPrec :: Int -> ReadS DisassociateAttributeGroupResponse
Prelude.Read, Int -> DisassociateAttributeGroupResponse -> ShowS
[DisassociateAttributeGroupResponse] -> ShowS
DisassociateAttributeGroupResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DisassociateAttributeGroupResponse] -> ShowS
$cshowList :: [DisassociateAttributeGroupResponse] -> ShowS
show :: DisassociateAttributeGroupResponse -> String
$cshow :: DisassociateAttributeGroupResponse -> String
showsPrec :: Int -> DisassociateAttributeGroupResponse -> ShowS
$cshowsPrec :: Int -> DisassociateAttributeGroupResponse -> ShowS
Prelude.Show, forall x.
Rep DisassociateAttributeGroupResponse x
-> DisassociateAttributeGroupResponse
forall x.
DisassociateAttributeGroupResponse
-> Rep DisassociateAttributeGroupResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DisassociateAttributeGroupResponse x
-> DisassociateAttributeGroupResponse
$cfrom :: forall x.
DisassociateAttributeGroupResponse
-> Rep DisassociateAttributeGroupResponse x
Prelude.Generic)

-- |
-- Create a value of 'DisassociateAttributeGroupResponse' 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:
--
-- 'applicationArn', 'disassociateAttributeGroupResponse_applicationArn' - The Amazon resource name (ARN) that specifies the application.
--
-- 'attributeGroupArn', 'disassociateAttributeGroupResponse_attributeGroupArn' - The Amazon resource name (ARN) that specifies the attribute group.
--
-- 'httpStatus', 'disassociateAttributeGroupResponse_httpStatus' - The response's http status code.
newDisassociateAttributeGroupResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DisassociateAttributeGroupResponse
newDisassociateAttributeGroupResponse :: Int -> DisassociateAttributeGroupResponse
newDisassociateAttributeGroupResponse Int
pHttpStatus_ =
  DisassociateAttributeGroupResponse'
    { $sel:applicationArn:DisassociateAttributeGroupResponse' :: Maybe Text
applicationArn =
        forall a. Maybe a
Prelude.Nothing,
      $sel:attributeGroupArn:DisassociateAttributeGroupResponse' :: Maybe Text
attributeGroupArn = forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DisassociateAttributeGroupResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The Amazon resource name (ARN) that specifies the application.
disassociateAttributeGroupResponse_applicationArn :: Lens.Lens' DisassociateAttributeGroupResponse (Prelude.Maybe Prelude.Text)
disassociateAttributeGroupResponse_applicationArn :: Lens' DisassociateAttributeGroupResponse (Maybe Text)
disassociateAttributeGroupResponse_applicationArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DisassociateAttributeGroupResponse' {Maybe Text
applicationArn :: Maybe Text
$sel:applicationArn:DisassociateAttributeGroupResponse' :: DisassociateAttributeGroupResponse -> Maybe Text
applicationArn} -> Maybe Text
applicationArn) (\s :: DisassociateAttributeGroupResponse
s@DisassociateAttributeGroupResponse' {} Maybe Text
a -> DisassociateAttributeGroupResponse
s {$sel:applicationArn:DisassociateAttributeGroupResponse' :: Maybe Text
applicationArn = Maybe Text
a} :: DisassociateAttributeGroupResponse)

-- | The Amazon resource name (ARN) that specifies the attribute group.
disassociateAttributeGroupResponse_attributeGroupArn :: Lens.Lens' DisassociateAttributeGroupResponse (Prelude.Maybe Prelude.Text)
disassociateAttributeGroupResponse_attributeGroupArn :: Lens' DisassociateAttributeGroupResponse (Maybe Text)
disassociateAttributeGroupResponse_attributeGroupArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DisassociateAttributeGroupResponse' {Maybe Text
attributeGroupArn :: Maybe Text
$sel:attributeGroupArn:DisassociateAttributeGroupResponse' :: DisassociateAttributeGroupResponse -> Maybe Text
attributeGroupArn} -> Maybe Text
attributeGroupArn) (\s :: DisassociateAttributeGroupResponse
s@DisassociateAttributeGroupResponse' {} Maybe Text
a -> DisassociateAttributeGroupResponse
s {$sel:attributeGroupArn:DisassociateAttributeGroupResponse' :: Maybe Text
attributeGroupArn = Maybe Text
a} :: DisassociateAttributeGroupResponse)

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

instance
  Prelude.NFData
    DisassociateAttributeGroupResponse
  where
  rnf :: DisassociateAttributeGroupResponse -> ()
rnf DisassociateAttributeGroupResponse' {Int
Maybe Text
httpStatus :: Int
attributeGroupArn :: Maybe Text
applicationArn :: Maybe Text
$sel:httpStatus:DisassociateAttributeGroupResponse' :: DisassociateAttributeGroupResponse -> Int
$sel:attributeGroupArn:DisassociateAttributeGroupResponse' :: DisassociateAttributeGroupResponse -> Maybe Text
$sel:applicationArn:DisassociateAttributeGroupResponse' :: DisassociateAttributeGroupResponse -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
applicationArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
attributeGroupArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus