{-# 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-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)
--
-- Disassociate a lens from a workload.
--
-- The AWS 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.Lens as Lens
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
(DisassociateLenses -> DisassociateLenses -> Bool)
-> (DisassociateLenses -> DisassociateLenses -> Bool)
-> Eq DisassociateLenses
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]
(Int -> ReadS DisassociateLenses)
-> ReadS [DisassociateLenses]
-> ReadPrec DisassociateLenses
-> ReadPrec [DisassociateLenses]
-> Read 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
(Int -> DisassociateLenses -> ShowS)
-> (DisassociateLenses -> String)
-> ([DisassociateLenses] -> ShowS)
-> Show DisassociateLenses
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. DisassociateLenses -> Rep DisassociateLenses x)
-> (forall x. Rep DisassociateLenses x -> DisassociateLenses)
-> Generic DisassociateLenses
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' :: Text -> NonEmpty Text -> DisassociateLenses
DisassociateLenses'
    { $sel:workloadId:DisassociateLenses' :: Text
workloadId = Text
pWorkloadId_,
      $sel:lensAliases:DisassociateLenses' :: NonEmpty Text
lensAliases = Tagged (NonEmpty Text) (Identity (NonEmpty Text))
-> Tagged (NonEmpty Text) (Identity (NonEmpty Text))
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced (Tagged (NonEmpty Text) (Identity (NonEmpty Text))
 -> Tagged (NonEmpty Text) (Identity (NonEmpty Text)))
-> NonEmpty Text -> NonEmpty Text
forall t b. AReview t b -> b -> t
Lens.# NonEmpty Text
pLensAliases_
    }

-- | Undocumented member.
disassociateLenses_workloadId :: Lens.Lens' DisassociateLenses Prelude.Text
disassociateLenses_workloadId :: (Text -> f Text) -> DisassociateLenses -> f DisassociateLenses
disassociateLenses_workloadId = (DisassociateLenses -> Text)
-> (DisassociateLenses -> Text -> DisassociateLenses)
-> Lens DisassociateLenses DisassociateLenses Text Text
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 :: (NonEmpty Text -> f (NonEmpty Text))
-> DisassociateLenses -> f DisassociateLenses
disassociateLenses_lensAliases = (DisassociateLenses -> NonEmpty Text)
-> (DisassociateLenses -> NonEmpty Text -> DisassociateLenses)
-> Lens
     DisassociateLenses
     DisassociateLenses
     (NonEmpty Text)
     (NonEmpty Text)
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) ((NonEmpty Text -> f (NonEmpty Text))
 -> DisassociateLenses -> f DisassociateLenses)
-> ((NonEmpty Text -> f (NonEmpty Text))
    -> NonEmpty Text -> f (NonEmpty Text))
-> (NonEmpty Text -> f (NonEmpty Text))
-> DisassociateLenses
-> f DisassociateLenses
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (NonEmpty Text -> f (NonEmpty Text))
-> NonEmpty Text -> f (NonEmpty Text)
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 :: DisassociateLenses -> Request DisassociateLenses
request = Service -> DisassociateLenses -> Request DisassociateLenses
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.patchJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy DisassociateLenses
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DisassociateLenses)))
response =
    AWSResponse DisassociateLenses
-> Logger
-> Service
-> Proxy DisassociateLenses
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DisassociateLenses)))
forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull AWSResponse DisassociateLenses
DisassociateLensesResponse
DisassociateLensesResponse'

instance Prelude.Hashable DisassociateLenses

instance Prelude.NFData DisassociateLenses

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

instance Core.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
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"LensAliases" Text -> NonEmpty Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= NonEmpty Text
lensAliases)]
      )

instance Core.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
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/workloads/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
workloadId,
        ByteString
"/disassociateLenses"
      ]

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

-- | /See:/ 'newDisassociateLensesResponse' smart constructor.
data DisassociateLensesResponse = DisassociateLensesResponse'
  {
  }
  deriving (DisassociateLensesResponse -> DisassociateLensesResponse -> Bool
(DisassociateLensesResponse -> DisassociateLensesResponse -> Bool)
-> (DisassociateLensesResponse
    -> DisassociateLensesResponse -> Bool)
-> Eq DisassociateLensesResponse
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]
(Int -> ReadS DisassociateLensesResponse)
-> ReadS [DisassociateLensesResponse]
-> ReadPrec DisassociateLensesResponse
-> ReadPrec [DisassociateLensesResponse]
-> Read 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
(Int -> DisassociateLensesResponse -> ShowS)
-> (DisassociateLensesResponse -> String)
-> ([DisassociateLensesResponse] -> ShowS)
-> Show DisassociateLensesResponse
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.
 DisassociateLensesResponse -> Rep DisassociateLensesResponse x)
-> (forall x.
    Rep DisassociateLensesResponse x -> DisassociateLensesResponse)
-> Generic DisassociateLensesResponse
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