{-# 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.UpdateAnswer
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Update the answer to a specific question in a workload review.
module Amazonka.WellArchitected.UpdateAnswer
  ( -- * Creating a Request
    UpdateAnswer (..),
    newUpdateAnswer,

    -- * Request Lenses
    updateAnswer_choiceUpdates,
    updateAnswer_isApplicable,
    updateAnswer_notes,
    updateAnswer_reason,
    updateAnswer_selectedChoices,
    updateAnswer_workloadId,
    updateAnswer_lensAlias,
    updateAnswer_questionId,

    -- * Destructuring the Response
    UpdateAnswerResponse (..),
    newUpdateAnswerResponse,

    -- * Response Lenses
    updateAnswerResponse_answer,
    updateAnswerResponse_lensAlias,
    updateAnswerResponse_lensArn,
    updateAnswerResponse_workloadId,
    updateAnswerResponse_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.WellArchitected.Types

-- | Input to update answer.
--
-- /See:/ 'newUpdateAnswer' smart constructor.
data UpdateAnswer = UpdateAnswer'
  { -- | A list of choices to update on a question in your workload. The String
    -- key corresponds to the choice ID to be updated.
    UpdateAnswer -> Maybe (HashMap Text ChoiceUpdate)
choiceUpdates :: Prelude.Maybe (Prelude.HashMap Prelude.Text ChoiceUpdate),
    UpdateAnswer -> Maybe Bool
isApplicable :: Prelude.Maybe Prelude.Bool,
    UpdateAnswer -> Maybe Text
notes :: Prelude.Maybe Prelude.Text,
    -- | The reason why a question is not applicable to your workload.
    UpdateAnswer -> Maybe AnswerReason
reason :: Prelude.Maybe AnswerReason,
    UpdateAnswer -> Maybe [Text]
selectedChoices :: Prelude.Maybe [Prelude.Text],
    UpdateAnswer -> Text
workloadId :: Prelude.Text,
    UpdateAnswer -> Text
lensAlias :: Prelude.Text,
    UpdateAnswer -> Text
questionId :: Prelude.Text
  }
  deriving (UpdateAnswer -> UpdateAnswer -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateAnswer -> UpdateAnswer -> Bool
$c/= :: UpdateAnswer -> UpdateAnswer -> Bool
== :: UpdateAnswer -> UpdateAnswer -> Bool
$c== :: UpdateAnswer -> UpdateAnswer -> Bool
Prelude.Eq, ReadPrec [UpdateAnswer]
ReadPrec UpdateAnswer
Int -> ReadS UpdateAnswer
ReadS [UpdateAnswer]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateAnswer]
$creadListPrec :: ReadPrec [UpdateAnswer]
readPrec :: ReadPrec UpdateAnswer
$creadPrec :: ReadPrec UpdateAnswer
readList :: ReadS [UpdateAnswer]
$creadList :: ReadS [UpdateAnswer]
readsPrec :: Int -> ReadS UpdateAnswer
$creadsPrec :: Int -> ReadS UpdateAnswer
Prelude.Read, Int -> UpdateAnswer -> ShowS
[UpdateAnswer] -> ShowS
UpdateAnswer -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateAnswer] -> ShowS
$cshowList :: [UpdateAnswer] -> ShowS
show :: UpdateAnswer -> String
$cshow :: UpdateAnswer -> String
showsPrec :: Int -> UpdateAnswer -> ShowS
$cshowsPrec :: Int -> UpdateAnswer -> ShowS
Prelude.Show, forall x. Rep UpdateAnswer x -> UpdateAnswer
forall x. UpdateAnswer -> Rep UpdateAnswer x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateAnswer x -> UpdateAnswer
$cfrom :: forall x. UpdateAnswer -> Rep UpdateAnswer x
Prelude.Generic)

-- |
-- Create a value of 'UpdateAnswer' 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:
--
-- 'choiceUpdates', 'updateAnswer_choiceUpdates' - A list of choices to update on a question in your workload. The String
-- key corresponds to the choice ID to be updated.
--
-- 'isApplicable', 'updateAnswer_isApplicable' - Undocumented member.
--
-- 'notes', 'updateAnswer_notes' - Undocumented member.
--
-- 'reason', 'updateAnswer_reason' - The reason why a question is not applicable to your workload.
--
-- 'selectedChoices', 'updateAnswer_selectedChoices' - Undocumented member.
--
-- 'workloadId', 'updateAnswer_workloadId' - Undocumented member.
--
-- 'lensAlias', 'updateAnswer_lensAlias' - Undocumented member.
--
-- 'questionId', 'updateAnswer_questionId' - Undocumented member.
newUpdateAnswer ::
  -- | 'workloadId'
  Prelude.Text ->
  -- | 'lensAlias'
  Prelude.Text ->
  -- | 'questionId'
  Prelude.Text ->
  UpdateAnswer
newUpdateAnswer :: Text -> Text -> Text -> UpdateAnswer
newUpdateAnswer Text
pWorkloadId_ Text
pLensAlias_ Text
pQuestionId_ =
  UpdateAnswer'
    { $sel:choiceUpdates:UpdateAnswer' :: Maybe (HashMap Text ChoiceUpdate)
choiceUpdates = forall a. Maybe a
Prelude.Nothing,
      $sel:isApplicable:UpdateAnswer' :: Maybe Bool
isApplicable = forall a. Maybe a
Prelude.Nothing,
      $sel:notes:UpdateAnswer' :: Maybe Text
notes = forall a. Maybe a
Prelude.Nothing,
      $sel:reason:UpdateAnswer' :: Maybe AnswerReason
reason = forall a. Maybe a
Prelude.Nothing,
      $sel:selectedChoices:UpdateAnswer' :: Maybe [Text]
selectedChoices = forall a. Maybe a
Prelude.Nothing,
      $sel:workloadId:UpdateAnswer' :: Text
workloadId = Text
pWorkloadId_,
      $sel:lensAlias:UpdateAnswer' :: Text
lensAlias = Text
pLensAlias_,
      $sel:questionId:UpdateAnswer' :: Text
questionId = Text
pQuestionId_
    }

-- | A list of choices to update on a question in your workload. The String
-- key corresponds to the choice ID to be updated.
updateAnswer_choiceUpdates :: Lens.Lens' UpdateAnswer (Prelude.Maybe (Prelude.HashMap Prelude.Text ChoiceUpdate))
updateAnswer_choiceUpdates :: Lens' UpdateAnswer (Maybe (HashMap Text ChoiceUpdate))
updateAnswer_choiceUpdates = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateAnswer' {Maybe (HashMap Text ChoiceUpdate)
choiceUpdates :: Maybe (HashMap Text ChoiceUpdate)
$sel:choiceUpdates:UpdateAnswer' :: UpdateAnswer -> Maybe (HashMap Text ChoiceUpdate)
choiceUpdates} -> Maybe (HashMap Text ChoiceUpdate)
choiceUpdates) (\s :: UpdateAnswer
s@UpdateAnswer' {} Maybe (HashMap Text ChoiceUpdate)
a -> UpdateAnswer
s {$sel:choiceUpdates:UpdateAnswer' :: Maybe (HashMap Text ChoiceUpdate)
choiceUpdates = Maybe (HashMap Text ChoiceUpdate)
a} :: UpdateAnswer) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Undocumented member.
updateAnswer_isApplicable :: Lens.Lens' UpdateAnswer (Prelude.Maybe Prelude.Bool)
updateAnswer_isApplicable :: Lens' UpdateAnswer (Maybe Bool)
updateAnswer_isApplicable = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateAnswer' {Maybe Bool
isApplicable :: Maybe Bool
$sel:isApplicable:UpdateAnswer' :: UpdateAnswer -> Maybe Bool
isApplicable} -> Maybe Bool
isApplicable) (\s :: UpdateAnswer
s@UpdateAnswer' {} Maybe Bool
a -> UpdateAnswer
s {$sel:isApplicable:UpdateAnswer' :: Maybe Bool
isApplicable = Maybe Bool
a} :: UpdateAnswer)

-- | Undocumented member.
updateAnswer_notes :: Lens.Lens' UpdateAnswer (Prelude.Maybe Prelude.Text)
updateAnswer_notes :: Lens' UpdateAnswer (Maybe Text)
updateAnswer_notes = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateAnswer' {Maybe Text
notes :: Maybe Text
$sel:notes:UpdateAnswer' :: UpdateAnswer -> Maybe Text
notes} -> Maybe Text
notes) (\s :: UpdateAnswer
s@UpdateAnswer' {} Maybe Text
a -> UpdateAnswer
s {$sel:notes:UpdateAnswer' :: Maybe Text
notes = Maybe Text
a} :: UpdateAnswer)

-- | The reason why a question is not applicable to your workload.
updateAnswer_reason :: Lens.Lens' UpdateAnswer (Prelude.Maybe AnswerReason)
updateAnswer_reason :: Lens' UpdateAnswer (Maybe AnswerReason)
updateAnswer_reason = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateAnswer' {Maybe AnswerReason
reason :: Maybe AnswerReason
$sel:reason:UpdateAnswer' :: UpdateAnswer -> Maybe AnswerReason
reason} -> Maybe AnswerReason
reason) (\s :: UpdateAnswer
s@UpdateAnswer' {} Maybe AnswerReason
a -> UpdateAnswer
s {$sel:reason:UpdateAnswer' :: Maybe AnswerReason
reason = Maybe AnswerReason
a} :: UpdateAnswer)

-- | Undocumented member.
updateAnswer_selectedChoices :: Lens.Lens' UpdateAnswer (Prelude.Maybe [Prelude.Text])
updateAnswer_selectedChoices :: Lens' UpdateAnswer (Maybe [Text])
updateAnswer_selectedChoices = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateAnswer' {Maybe [Text]
selectedChoices :: Maybe [Text]
$sel:selectedChoices:UpdateAnswer' :: UpdateAnswer -> Maybe [Text]
selectedChoices} -> Maybe [Text]
selectedChoices) (\s :: UpdateAnswer
s@UpdateAnswer' {} Maybe [Text]
a -> UpdateAnswer
s {$sel:selectedChoices:UpdateAnswer' :: Maybe [Text]
selectedChoices = Maybe [Text]
a} :: UpdateAnswer) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

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

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

instance Core.AWSRequest UpdateAnswer where
  type AWSResponse UpdateAnswer = UpdateAnswerResponse
  request :: (Service -> Service) -> UpdateAnswer -> Request UpdateAnswer
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 UpdateAnswer
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateAnswer)))
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 Answer
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Int
-> UpdateAnswerResponse
UpdateAnswerResponse'
            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
"Answer")
            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
"LensAlias")
            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
"LensArn")
            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
"WorkloadId")
            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 UpdateAnswer where
  hashWithSalt :: Int -> UpdateAnswer -> Int
hashWithSalt Int
_salt UpdateAnswer' {Maybe Bool
Maybe [Text]
Maybe Text
Maybe (HashMap Text ChoiceUpdate)
Maybe AnswerReason
Text
questionId :: Text
lensAlias :: Text
workloadId :: Text
selectedChoices :: Maybe [Text]
reason :: Maybe AnswerReason
notes :: Maybe Text
isApplicable :: Maybe Bool
choiceUpdates :: Maybe (HashMap Text ChoiceUpdate)
$sel:questionId:UpdateAnswer' :: UpdateAnswer -> Text
$sel:lensAlias:UpdateAnswer' :: UpdateAnswer -> Text
$sel:workloadId:UpdateAnswer' :: UpdateAnswer -> Text
$sel:selectedChoices:UpdateAnswer' :: UpdateAnswer -> Maybe [Text]
$sel:reason:UpdateAnswer' :: UpdateAnswer -> Maybe AnswerReason
$sel:notes:UpdateAnswer' :: UpdateAnswer -> Maybe Text
$sel:isApplicable:UpdateAnswer' :: UpdateAnswer -> Maybe Bool
$sel:choiceUpdates:UpdateAnswer' :: UpdateAnswer -> Maybe (HashMap Text ChoiceUpdate)
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (HashMap Text ChoiceUpdate)
choiceUpdates
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
isApplicable
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
notes
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe AnswerReason
reason
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Text]
selectedChoices
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
workloadId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
lensAlias
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
questionId

instance Prelude.NFData UpdateAnswer where
  rnf :: UpdateAnswer -> ()
rnf UpdateAnswer' {Maybe Bool
Maybe [Text]
Maybe Text
Maybe (HashMap Text ChoiceUpdate)
Maybe AnswerReason
Text
questionId :: Text
lensAlias :: Text
workloadId :: Text
selectedChoices :: Maybe [Text]
reason :: Maybe AnswerReason
notes :: Maybe Text
isApplicable :: Maybe Bool
choiceUpdates :: Maybe (HashMap Text ChoiceUpdate)
$sel:questionId:UpdateAnswer' :: UpdateAnswer -> Text
$sel:lensAlias:UpdateAnswer' :: UpdateAnswer -> Text
$sel:workloadId:UpdateAnswer' :: UpdateAnswer -> Text
$sel:selectedChoices:UpdateAnswer' :: UpdateAnswer -> Maybe [Text]
$sel:reason:UpdateAnswer' :: UpdateAnswer -> Maybe AnswerReason
$sel:notes:UpdateAnswer' :: UpdateAnswer -> Maybe Text
$sel:isApplicable:UpdateAnswer' :: UpdateAnswer -> Maybe Bool
$sel:choiceUpdates:UpdateAnswer' :: UpdateAnswer -> Maybe (HashMap Text ChoiceUpdate)
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe (HashMap Text ChoiceUpdate)
choiceUpdates
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
isApplicable
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
notes
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe AnswerReason
reason
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
selectedChoices
      seq :: forall a b. a -> b -> b
`Prelude.seq` 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 Text
lensAlias
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
questionId

instance Data.ToHeaders UpdateAnswer where
  toHeaders :: UpdateAnswer -> 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.ToJSON UpdateAnswer where
  toJSON :: UpdateAnswer -> Value
toJSON UpdateAnswer' {Maybe Bool
Maybe [Text]
Maybe Text
Maybe (HashMap Text ChoiceUpdate)
Maybe AnswerReason
Text
questionId :: Text
lensAlias :: Text
workloadId :: Text
selectedChoices :: Maybe [Text]
reason :: Maybe AnswerReason
notes :: Maybe Text
isApplicable :: Maybe Bool
choiceUpdates :: Maybe (HashMap Text ChoiceUpdate)
$sel:questionId:UpdateAnswer' :: UpdateAnswer -> Text
$sel:lensAlias:UpdateAnswer' :: UpdateAnswer -> Text
$sel:workloadId:UpdateAnswer' :: UpdateAnswer -> Text
$sel:selectedChoices:UpdateAnswer' :: UpdateAnswer -> Maybe [Text]
$sel:reason:UpdateAnswer' :: UpdateAnswer -> Maybe AnswerReason
$sel:notes:UpdateAnswer' :: UpdateAnswer -> Maybe Text
$sel:isApplicable:UpdateAnswer' :: UpdateAnswer -> Maybe Bool
$sel:choiceUpdates:UpdateAnswer' :: UpdateAnswer -> Maybe (HashMap Text ChoiceUpdate)
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"ChoiceUpdates" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text ChoiceUpdate)
choiceUpdates,
            (Key
"IsApplicable" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
isApplicable,
            (Key
"Notes" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
notes,
            (Key
"Reason" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe AnswerReason
reason,
            (Key
"SelectedChoices" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Text]
selectedChoices
          ]
      )

instance Data.ToPath UpdateAnswer where
  toPath :: UpdateAnswer -> ByteString
toPath UpdateAnswer' {Maybe Bool
Maybe [Text]
Maybe Text
Maybe (HashMap Text ChoiceUpdate)
Maybe AnswerReason
Text
questionId :: Text
lensAlias :: Text
workloadId :: Text
selectedChoices :: Maybe [Text]
reason :: Maybe AnswerReason
notes :: Maybe Text
isApplicable :: Maybe Bool
choiceUpdates :: Maybe (HashMap Text ChoiceUpdate)
$sel:questionId:UpdateAnswer' :: UpdateAnswer -> Text
$sel:lensAlias:UpdateAnswer' :: UpdateAnswer -> Text
$sel:workloadId:UpdateAnswer' :: UpdateAnswer -> Text
$sel:selectedChoices:UpdateAnswer' :: UpdateAnswer -> Maybe [Text]
$sel:reason:UpdateAnswer' :: UpdateAnswer -> Maybe AnswerReason
$sel:notes:UpdateAnswer' :: UpdateAnswer -> Maybe Text
$sel:isApplicable:UpdateAnswer' :: UpdateAnswer -> Maybe Bool
$sel:choiceUpdates:UpdateAnswer' :: UpdateAnswer -> Maybe (HashMap Text ChoiceUpdate)
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/workloads/",
        forall a. ToByteString a => a -> ByteString
Data.toBS Text
workloadId,
        ByteString
"/lensReviews/",
        forall a. ToByteString a => a -> ByteString
Data.toBS Text
lensAlias,
        ByteString
"/answers/",
        forall a. ToByteString a => a -> ByteString
Data.toBS Text
questionId
      ]

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

-- | Output of a update answer call.
--
-- /See:/ 'newUpdateAnswerResponse' smart constructor.
data UpdateAnswerResponse = UpdateAnswerResponse'
  { UpdateAnswerResponse -> Maybe Answer
answer :: Prelude.Maybe Answer,
    UpdateAnswerResponse -> Maybe Text
lensAlias :: Prelude.Maybe Prelude.Text,
    -- | The ARN for the lens.
    UpdateAnswerResponse -> Maybe Text
lensArn :: Prelude.Maybe Prelude.Text,
    UpdateAnswerResponse -> Maybe Text
workloadId :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    UpdateAnswerResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (UpdateAnswerResponse -> UpdateAnswerResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateAnswerResponse -> UpdateAnswerResponse -> Bool
$c/= :: UpdateAnswerResponse -> UpdateAnswerResponse -> Bool
== :: UpdateAnswerResponse -> UpdateAnswerResponse -> Bool
$c== :: UpdateAnswerResponse -> UpdateAnswerResponse -> Bool
Prelude.Eq, ReadPrec [UpdateAnswerResponse]
ReadPrec UpdateAnswerResponse
Int -> ReadS UpdateAnswerResponse
ReadS [UpdateAnswerResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateAnswerResponse]
$creadListPrec :: ReadPrec [UpdateAnswerResponse]
readPrec :: ReadPrec UpdateAnswerResponse
$creadPrec :: ReadPrec UpdateAnswerResponse
readList :: ReadS [UpdateAnswerResponse]
$creadList :: ReadS [UpdateAnswerResponse]
readsPrec :: Int -> ReadS UpdateAnswerResponse
$creadsPrec :: Int -> ReadS UpdateAnswerResponse
Prelude.Read, Int -> UpdateAnswerResponse -> ShowS
[UpdateAnswerResponse] -> ShowS
UpdateAnswerResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateAnswerResponse] -> ShowS
$cshowList :: [UpdateAnswerResponse] -> ShowS
show :: UpdateAnswerResponse -> String
$cshow :: UpdateAnswerResponse -> String
showsPrec :: Int -> UpdateAnswerResponse -> ShowS
$cshowsPrec :: Int -> UpdateAnswerResponse -> ShowS
Prelude.Show, forall x. Rep UpdateAnswerResponse x -> UpdateAnswerResponse
forall x. UpdateAnswerResponse -> Rep UpdateAnswerResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateAnswerResponse x -> UpdateAnswerResponse
$cfrom :: forall x. UpdateAnswerResponse -> Rep UpdateAnswerResponse x
Prelude.Generic)

-- |
-- Create a value of 'UpdateAnswerResponse' 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:
--
-- 'answer', 'updateAnswerResponse_answer' - Undocumented member.
--
-- 'lensAlias', 'updateAnswerResponse_lensAlias' - Undocumented member.
--
-- 'lensArn', 'updateAnswerResponse_lensArn' - The ARN for the lens.
--
-- 'workloadId', 'updateAnswerResponse_workloadId' - Undocumented member.
--
-- 'httpStatus', 'updateAnswerResponse_httpStatus' - The response's http status code.
newUpdateAnswerResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  UpdateAnswerResponse
newUpdateAnswerResponse :: Int -> UpdateAnswerResponse
newUpdateAnswerResponse Int
pHttpStatus_ =
  UpdateAnswerResponse'
    { $sel:answer:UpdateAnswerResponse' :: Maybe Answer
answer = forall a. Maybe a
Prelude.Nothing,
      $sel:lensAlias:UpdateAnswerResponse' :: Maybe Text
lensAlias = forall a. Maybe a
Prelude.Nothing,
      $sel:lensArn:UpdateAnswerResponse' :: Maybe Text
lensArn = forall a. Maybe a
Prelude.Nothing,
      $sel:workloadId:UpdateAnswerResponse' :: Maybe Text
workloadId = forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:UpdateAnswerResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | Undocumented member.
updateAnswerResponse_answer :: Lens.Lens' UpdateAnswerResponse (Prelude.Maybe Answer)
updateAnswerResponse_answer :: Lens' UpdateAnswerResponse (Maybe Answer)
updateAnswerResponse_answer = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateAnswerResponse' {Maybe Answer
answer :: Maybe Answer
$sel:answer:UpdateAnswerResponse' :: UpdateAnswerResponse -> Maybe Answer
answer} -> Maybe Answer
answer) (\s :: UpdateAnswerResponse
s@UpdateAnswerResponse' {} Maybe Answer
a -> UpdateAnswerResponse
s {$sel:answer:UpdateAnswerResponse' :: Maybe Answer
answer = Maybe Answer
a} :: UpdateAnswerResponse)

-- | Undocumented member.
updateAnswerResponse_lensAlias :: Lens.Lens' UpdateAnswerResponse (Prelude.Maybe Prelude.Text)
updateAnswerResponse_lensAlias :: Lens' UpdateAnswerResponse (Maybe Text)
updateAnswerResponse_lensAlias = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateAnswerResponse' {Maybe Text
lensAlias :: Maybe Text
$sel:lensAlias:UpdateAnswerResponse' :: UpdateAnswerResponse -> Maybe Text
lensAlias} -> Maybe Text
lensAlias) (\s :: UpdateAnswerResponse
s@UpdateAnswerResponse' {} Maybe Text
a -> UpdateAnswerResponse
s {$sel:lensAlias:UpdateAnswerResponse' :: Maybe Text
lensAlias = Maybe Text
a} :: UpdateAnswerResponse)

-- | The ARN for the lens.
updateAnswerResponse_lensArn :: Lens.Lens' UpdateAnswerResponse (Prelude.Maybe Prelude.Text)
updateAnswerResponse_lensArn :: Lens' UpdateAnswerResponse (Maybe Text)
updateAnswerResponse_lensArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateAnswerResponse' {Maybe Text
lensArn :: Maybe Text
$sel:lensArn:UpdateAnswerResponse' :: UpdateAnswerResponse -> Maybe Text
lensArn} -> Maybe Text
lensArn) (\s :: UpdateAnswerResponse
s@UpdateAnswerResponse' {} Maybe Text
a -> UpdateAnswerResponse
s {$sel:lensArn:UpdateAnswerResponse' :: Maybe Text
lensArn = Maybe Text
a} :: UpdateAnswerResponse)

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

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

instance Prelude.NFData UpdateAnswerResponse where
  rnf :: UpdateAnswerResponse -> ()
rnf UpdateAnswerResponse' {Int
Maybe Text
Maybe Answer
httpStatus :: Int
workloadId :: Maybe Text
lensArn :: Maybe Text
lensAlias :: Maybe Text
answer :: Maybe Answer
$sel:httpStatus:UpdateAnswerResponse' :: UpdateAnswerResponse -> Int
$sel:workloadId:UpdateAnswerResponse' :: UpdateAnswerResponse -> Maybe Text
$sel:lensArn:UpdateAnswerResponse' :: UpdateAnswerResponse -> Maybe Text
$sel:lensAlias:UpdateAnswerResponse' :: UpdateAnswerResponse -> Maybe Text
$sel:answer:UpdateAnswerResponse' :: UpdateAnswerResponse -> Maybe Answer
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Answer
answer
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
lensAlias
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
lensArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
workloadId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus