{-# 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.WellArchitected.DisassociateLenses
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Disassociate a lens from a workload.
--
-- Up to 10 lenses can be disassociated from a workload in a single API
-- operation.
--
-- The Amazon Web Services Well-Architected Framework lens
-- (@wellarchitected@) cannot be removed from a workload.
module Amazonka.WellArchitected.DisassociateLenses
  ( -- * Creating a Request
    DisassociateLenses (..),
    newDisassociateLenses,

    -- * Request Lenses
    disassociateLenses_workloadId,
    disassociateLenses_lensAliases,

    -- * Destructuring the Response
    DisassociateLensesResponse (..),
    newDisassociateLensesResponse,
  )
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.WellArchitected.Types

-- | Input to disassociate lens reviews.
--
-- /See:/ 'newDisassociateLenses' smart constructor.
data DisassociateLenses = DisassociateLenses'
  { DisassociateLenses -> Text
workloadId :: Prelude.Text,
    DisassociateLenses -> NonEmpty Text
lensAliases :: Prelude.NonEmpty Prelude.Text
  }
  deriving (DisassociateLenses -> DisassociateLenses -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DisassociateLenses -> DisassociateLenses -> Bool
$c/= :: DisassociateLenses -> DisassociateLenses -> Bool
== :: DisassociateLenses -> DisassociateLenses -> Bool
$c== :: DisassociateLenses -> DisassociateLenses -> Bool
Prelude.Eq, ReadPrec [DisassociateLenses]
ReadPrec DisassociateLenses
Int -> ReadS DisassociateLenses
ReadS [DisassociateLenses]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DisassociateLenses]
$creadListPrec :: ReadPrec [DisassociateLenses]
readPrec :: ReadPrec DisassociateLenses
$creadPrec :: ReadPrec DisassociateLenses
readList :: ReadS [DisassociateLenses]
$creadList :: ReadS [DisassociateLenses]
readsPrec :: Int -> ReadS DisassociateLenses
$creadsPrec :: Int -> ReadS DisassociateLenses
Prelude.Read, Int -> DisassociateLenses -> ShowS
[DisassociateLenses] -> ShowS
DisassociateLenses -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DisassociateLenses] -> ShowS
$cshowList :: [DisassociateLenses] -> ShowS
show :: DisassociateLenses -> String
$cshow :: DisassociateLenses -> String
showsPrec :: Int -> DisassociateLenses -> ShowS
$cshowsPrec :: Int -> DisassociateLenses -> ShowS
Prelude.Show, forall x. Rep DisassociateLenses x -> DisassociateLenses
forall x. DisassociateLenses -> Rep DisassociateLenses x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DisassociateLenses x -> DisassociateLenses
$cfrom :: forall x. DisassociateLenses -> Rep DisassociateLenses x
Prelude.Generic)

-- |
-- Create a value of 'DisassociateLenses' 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:
--
-- 'workloadId', 'disassociateLenses_workloadId' - Undocumented member.
--
-- 'lensAliases', 'disassociateLenses_lensAliases' - Undocumented member.
newDisassociateLenses ::
  -- | 'workloadId'
  Prelude.Text ->
  -- | 'lensAliases'
  Prelude.NonEmpty Prelude.Text ->
  DisassociateLenses
newDisassociateLenses :: Text -> NonEmpty Text -> DisassociateLenses
newDisassociateLenses Text
pWorkloadId_ NonEmpty Text
pLensAliases_ =
  DisassociateLenses'
    { $sel:workloadId:DisassociateLenses' :: Text
workloadId = Text
pWorkloadId_,
      $sel:lensAliases:DisassociateLenses' :: NonEmpty Text
lensAliases = forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced forall t b. AReview t b -> b -> t
Lens.# NonEmpty Text
pLensAliases_
    }

-- | Undocumented member.
disassociateLenses_workloadId :: Lens.Lens' DisassociateLenses Prelude.Text
disassociateLenses_workloadId :: Lens' DisassociateLenses Text
disassociateLenses_workloadId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DisassociateLenses' {Text
workloadId :: Text
$sel:workloadId:DisassociateLenses' :: DisassociateLenses -> Text
workloadId} -> Text
workloadId) (\s :: DisassociateLenses
s@DisassociateLenses' {} Text
a -> DisassociateLenses
s {$sel:workloadId:DisassociateLenses' :: Text
workloadId = Text
a} :: DisassociateLenses)

-- | Undocumented member.
disassociateLenses_lensAliases :: Lens.Lens' DisassociateLenses (Prelude.NonEmpty Prelude.Text)
disassociateLenses_lensAliases :: Lens' DisassociateLenses (NonEmpty Text)
disassociateLenses_lensAliases = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DisassociateLenses' {NonEmpty Text
lensAliases :: NonEmpty Text
$sel:lensAliases:DisassociateLenses' :: DisassociateLenses -> NonEmpty Text
lensAliases} -> NonEmpty Text
lensAliases) (\s :: DisassociateLenses
s@DisassociateLenses' {} NonEmpty Text
a -> DisassociateLenses
s {$sel:lensAliases:DisassociateLenses' :: NonEmpty Text
lensAliases = NonEmpty Text
a} :: DisassociateLenses) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.AWSRequest DisassociateLenses where
  type
    AWSResponse DisassociateLenses =
      DisassociateLensesResponse
  request :: (Service -> Service)
-> DisassociateLenses -> Request DisassociateLenses
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.patchJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy DisassociateLenses
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DisassociateLenses)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull DisassociateLensesResponse
DisassociateLensesResponse'

instance Prelude.Hashable DisassociateLenses where
  hashWithSalt :: Int -> DisassociateLenses -> Int
hashWithSalt Int
_salt DisassociateLenses' {NonEmpty Text
Text
lensAliases :: NonEmpty Text
workloadId :: Text
$sel:lensAliases:DisassociateLenses' :: DisassociateLenses -> NonEmpty Text
$sel:workloadId:DisassociateLenses' :: DisassociateLenses -> Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
workloadId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` NonEmpty Text
lensAliases

instance Prelude.NFData DisassociateLenses where
  rnf :: DisassociateLenses -> ()
rnf DisassociateLenses' {NonEmpty Text
Text
lensAliases :: NonEmpty Text
workloadId :: Text
$sel:lensAliases:DisassociateLenses' :: DisassociateLenses -> NonEmpty Text
$sel:workloadId:DisassociateLenses' :: DisassociateLenses -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
workloadId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf NonEmpty Text
lensAliases

instance Data.ToHeaders DisassociateLenses where
  toHeaders :: DisassociateLenses -> [Header]
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 -> [Header]
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Data.ToJSON DisassociateLenses where
  toJSON :: DisassociateLenses -> Value
toJSON DisassociateLenses' {NonEmpty Text
Text
lensAliases :: NonEmpty Text
workloadId :: Text
$sel:lensAliases:DisassociateLenses' :: DisassociateLenses -> NonEmpty Text
$sel:workloadId:DisassociateLenses' :: DisassociateLenses -> Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [forall a. a -> Maybe a
Prelude.Just (Key
"LensAliases" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= NonEmpty Text
lensAliases)]
      )

instance Data.ToPath DisassociateLenses where
  toPath :: DisassociateLenses -> ByteString
toPath DisassociateLenses' {NonEmpty Text
Text
lensAliases :: NonEmpty Text
workloadId :: Text
$sel:lensAliases:DisassociateLenses' :: DisassociateLenses -> NonEmpty Text
$sel:workloadId:DisassociateLenses' :: DisassociateLenses -> Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/workloads/",
        forall a. ToByteString a => a -> ByteString
Data.toBS Text
workloadId,
        ByteString
"/disassociateLenses"
      ]

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

-- | /See:/ 'newDisassociateLensesResponse' smart constructor.
data DisassociateLensesResponse = DisassociateLensesResponse'
  {
  }
  deriving (DisassociateLensesResponse -> DisassociateLensesResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DisassociateLensesResponse -> DisassociateLensesResponse -> Bool
$c/= :: DisassociateLensesResponse -> DisassociateLensesResponse -> Bool
== :: DisassociateLensesResponse -> DisassociateLensesResponse -> Bool
$c== :: DisassociateLensesResponse -> DisassociateLensesResponse -> Bool
Prelude.Eq, ReadPrec [DisassociateLensesResponse]
ReadPrec DisassociateLensesResponse
Int -> ReadS DisassociateLensesResponse
ReadS [DisassociateLensesResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DisassociateLensesResponse]
$creadListPrec :: ReadPrec [DisassociateLensesResponse]
readPrec :: ReadPrec DisassociateLensesResponse
$creadPrec :: ReadPrec DisassociateLensesResponse
readList :: ReadS [DisassociateLensesResponse]
$creadList :: ReadS [DisassociateLensesResponse]
readsPrec :: Int -> ReadS DisassociateLensesResponse
$creadsPrec :: Int -> ReadS DisassociateLensesResponse
Prelude.Read, Int -> DisassociateLensesResponse -> ShowS
[DisassociateLensesResponse] -> ShowS
DisassociateLensesResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DisassociateLensesResponse] -> ShowS
$cshowList :: [DisassociateLensesResponse] -> ShowS
show :: DisassociateLensesResponse -> String
$cshow :: DisassociateLensesResponse -> String
showsPrec :: Int -> DisassociateLensesResponse -> ShowS
$cshowsPrec :: Int -> DisassociateLensesResponse -> ShowS
Prelude.Show, forall x.
Rep DisassociateLensesResponse x -> DisassociateLensesResponse
forall x.
DisassociateLensesResponse -> Rep DisassociateLensesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DisassociateLensesResponse x -> DisassociateLensesResponse
$cfrom :: forall x.
DisassociateLensesResponse -> Rep DisassociateLensesResponse x
Prelude.Generic)

-- |
-- Create a value of 'DisassociateLensesResponse' 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.
newDisassociateLensesResponse ::
  DisassociateLensesResponse
newDisassociateLensesResponse :: DisassociateLensesResponse
newDisassociateLensesResponse =
  DisassociateLensesResponse
DisassociateLensesResponse'

instance Prelude.NFData DisassociateLensesResponse where
  rnf :: DisassociateLensesResponse -> ()
rnf DisassociateLensesResponse
_ = ()