{-# 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.DevOpsGuru.PutFeedback
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Collects customer feedback about the specified insight.
module Amazonka.DevOpsGuru.PutFeedback
  ( -- * Creating a Request
    PutFeedback (..),
    newPutFeedback,

    -- * Request Lenses
    putFeedback_insightFeedback,

    -- * Destructuring the Response
    PutFeedbackResponse (..),
    newPutFeedbackResponse,

    -- * Response Lenses
    putFeedbackResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.DevOpsGuru.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newPutFeedback' smart constructor.
data PutFeedback = PutFeedback'
  { -- | The feedback from customers is about the recommendations in this
    -- insight.
    PutFeedback -> Maybe InsightFeedback
insightFeedback :: Prelude.Maybe InsightFeedback
  }
  deriving (PutFeedback -> PutFeedback -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PutFeedback -> PutFeedback -> Bool
$c/= :: PutFeedback -> PutFeedback -> Bool
== :: PutFeedback -> PutFeedback -> Bool
$c== :: PutFeedback -> PutFeedback -> Bool
Prelude.Eq, ReadPrec [PutFeedback]
ReadPrec PutFeedback
Int -> ReadS PutFeedback
ReadS [PutFeedback]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PutFeedback]
$creadListPrec :: ReadPrec [PutFeedback]
readPrec :: ReadPrec PutFeedback
$creadPrec :: ReadPrec PutFeedback
readList :: ReadS [PutFeedback]
$creadList :: ReadS [PutFeedback]
readsPrec :: Int -> ReadS PutFeedback
$creadsPrec :: Int -> ReadS PutFeedback
Prelude.Read, Int -> PutFeedback -> ShowS
[PutFeedback] -> ShowS
PutFeedback -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PutFeedback] -> ShowS
$cshowList :: [PutFeedback] -> ShowS
show :: PutFeedback -> String
$cshow :: PutFeedback -> String
showsPrec :: Int -> PutFeedback -> ShowS
$cshowsPrec :: Int -> PutFeedback -> ShowS
Prelude.Show, forall x. Rep PutFeedback x -> PutFeedback
forall x. PutFeedback -> Rep PutFeedback x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PutFeedback x -> PutFeedback
$cfrom :: forall x. PutFeedback -> Rep PutFeedback x
Prelude.Generic)

-- |
-- Create a value of 'PutFeedback' 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:
--
-- 'insightFeedback', 'putFeedback_insightFeedback' - The feedback from customers is about the recommendations in this
-- insight.
newPutFeedback ::
  PutFeedback
newPutFeedback :: PutFeedback
newPutFeedback =
  PutFeedback' {$sel:insightFeedback:PutFeedback' :: Maybe InsightFeedback
insightFeedback = forall a. Maybe a
Prelude.Nothing}

-- | The feedback from customers is about the recommendations in this
-- insight.
putFeedback_insightFeedback :: Lens.Lens' PutFeedback (Prelude.Maybe InsightFeedback)
putFeedback_insightFeedback :: Lens' PutFeedback (Maybe InsightFeedback)
putFeedback_insightFeedback = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutFeedback' {Maybe InsightFeedback
insightFeedback :: Maybe InsightFeedback
$sel:insightFeedback:PutFeedback' :: PutFeedback -> Maybe InsightFeedback
insightFeedback} -> Maybe InsightFeedback
insightFeedback) (\s :: PutFeedback
s@PutFeedback' {} Maybe InsightFeedback
a -> PutFeedback
s {$sel:insightFeedback:PutFeedback' :: Maybe InsightFeedback
insightFeedback = Maybe InsightFeedback
a} :: PutFeedback)

instance Core.AWSRequest PutFeedback where
  type AWSResponse PutFeedback = PutFeedbackResponse
  request :: (Service -> Service) -> PutFeedback -> Request PutFeedback
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.putJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy PutFeedback
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse PutFeedback)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
      ( \Int
s ResponseHeaders
h ()
x ->
          Int -> PutFeedbackResponse
PutFeedbackResponse'
            forall (f :: * -> *) a b. Functor 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 PutFeedback where
  hashWithSalt :: Int -> PutFeedback -> Int
hashWithSalt Int
_salt PutFeedback' {Maybe InsightFeedback
insightFeedback :: Maybe InsightFeedback
$sel:insightFeedback:PutFeedback' :: PutFeedback -> Maybe InsightFeedback
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe InsightFeedback
insightFeedback

instance Prelude.NFData PutFeedback where
  rnf :: PutFeedback -> ()
rnf PutFeedback' {Maybe InsightFeedback
insightFeedback :: Maybe InsightFeedback
$sel:insightFeedback:PutFeedback' :: PutFeedback -> Maybe InsightFeedback
..} = forall a. NFData a => a -> ()
Prelude.rnf Maybe InsightFeedback
insightFeedback

instance Data.ToHeaders PutFeedback where
  toHeaders :: PutFeedback -> 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 PutFeedback where
  toJSON :: PutFeedback -> Value
toJSON PutFeedback' {Maybe InsightFeedback
insightFeedback :: Maybe InsightFeedback
$sel:insightFeedback:PutFeedback' :: PutFeedback -> Maybe InsightFeedback
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"InsightFeedback" 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 InsightFeedback
insightFeedback
          ]
      )

instance Data.ToPath PutFeedback where
  toPath :: PutFeedback -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/feedback"

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

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

-- |
-- Create a value of 'PutFeedbackResponse' 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:
--
-- 'httpStatus', 'putFeedbackResponse_httpStatus' - The response's http status code.
newPutFeedbackResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  PutFeedbackResponse
newPutFeedbackResponse :: Int -> PutFeedbackResponse
newPutFeedbackResponse Int
pHttpStatus_ =
  PutFeedbackResponse' {$sel:httpStatus:PutFeedbackResponse' :: Int
httpStatus = Int
pHttpStatus_}

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

instance Prelude.NFData PutFeedbackResponse where
  rnf :: PutFeedbackResponse -> ()
rnf PutFeedbackResponse' {Int
httpStatus :: Int
$sel:httpStatus:PutFeedbackResponse' :: PutFeedbackResponse -> Int
..} = forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus