{-# 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.LookoutEquipment.UpdateLabelGroup
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Updates the label group.
module Amazonka.LookoutEquipment.UpdateLabelGroup
  ( -- * Creating a Request
    UpdateLabelGroup (..),
    newUpdateLabelGroup,

    -- * Request Lenses
    updateLabelGroup_faultCodes,
    updateLabelGroup_labelGroupName,

    -- * Destructuring the Response
    UpdateLabelGroupResponse (..),
    newUpdateLabelGroupResponse,
  )
where

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

-- | /See:/ 'newUpdateLabelGroup' smart constructor.
data UpdateLabelGroup = UpdateLabelGroup'
  { -- | Updates the code indicating the type of anomaly associated with the
    -- label.
    --
    -- Data in this field will be retained for service usage. Follow best
    -- practices for the security of your data.
    UpdateLabelGroup -> Maybe [Text]
faultCodes :: Prelude.Maybe [Prelude.Text],
    -- | The name of the label group to be updated.
    UpdateLabelGroup -> Text
labelGroupName :: Prelude.Text
  }
  deriving (UpdateLabelGroup -> UpdateLabelGroup -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateLabelGroup -> UpdateLabelGroup -> Bool
$c/= :: UpdateLabelGroup -> UpdateLabelGroup -> Bool
== :: UpdateLabelGroup -> UpdateLabelGroup -> Bool
$c== :: UpdateLabelGroup -> UpdateLabelGroup -> Bool
Prelude.Eq, ReadPrec [UpdateLabelGroup]
ReadPrec UpdateLabelGroup
Int -> ReadS UpdateLabelGroup
ReadS [UpdateLabelGroup]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateLabelGroup]
$creadListPrec :: ReadPrec [UpdateLabelGroup]
readPrec :: ReadPrec UpdateLabelGroup
$creadPrec :: ReadPrec UpdateLabelGroup
readList :: ReadS [UpdateLabelGroup]
$creadList :: ReadS [UpdateLabelGroup]
readsPrec :: Int -> ReadS UpdateLabelGroup
$creadsPrec :: Int -> ReadS UpdateLabelGroup
Prelude.Read, Int -> UpdateLabelGroup -> ShowS
[UpdateLabelGroup] -> ShowS
UpdateLabelGroup -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateLabelGroup] -> ShowS
$cshowList :: [UpdateLabelGroup] -> ShowS
show :: UpdateLabelGroup -> String
$cshow :: UpdateLabelGroup -> String
showsPrec :: Int -> UpdateLabelGroup -> ShowS
$cshowsPrec :: Int -> UpdateLabelGroup -> ShowS
Prelude.Show, forall x. Rep UpdateLabelGroup x -> UpdateLabelGroup
forall x. UpdateLabelGroup -> Rep UpdateLabelGroup x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateLabelGroup x -> UpdateLabelGroup
$cfrom :: forall x. UpdateLabelGroup -> Rep UpdateLabelGroup x
Prelude.Generic)

-- |
-- Create a value of 'UpdateLabelGroup' 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:
--
-- 'faultCodes', 'updateLabelGroup_faultCodes' - Updates the code indicating the type of anomaly associated with the
-- label.
--
-- Data in this field will be retained for service usage. Follow best
-- practices for the security of your data.
--
-- 'labelGroupName', 'updateLabelGroup_labelGroupName' - The name of the label group to be updated.
newUpdateLabelGroup ::
  -- | 'labelGroupName'
  Prelude.Text ->
  UpdateLabelGroup
newUpdateLabelGroup :: Text -> UpdateLabelGroup
newUpdateLabelGroup Text
pLabelGroupName_ =
  UpdateLabelGroup'
    { $sel:faultCodes:UpdateLabelGroup' :: Maybe [Text]
faultCodes = forall a. Maybe a
Prelude.Nothing,
      $sel:labelGroupName:UpdateLabelGroup' :: Text
labelGroupName = Text
pLabelGroupName_
    }

-- | Updates the code indicating the type of anomaly associated with the
-- label.
--
-- Data in this field will be retained for service usage. Follow best
-- practices for the security of your data.
updateLabelGroup_faultCodes :: Lens.Lens' UpdateLabelGroup (Prelude.Maybe [Prelude.Text])
updateLabelGroup_faultCodes :: Lens' UpdateLabelGroup (Maybe [Text])
updateLabelGroup_faultCodes = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateLabelGroup' {Maybe [Text]
faultCodes :: Maybe [Text]
$sel:faultCodes:UpdateLabelGroup' :: UpdateLabelGroup -> Maybe [Text]
faultCodes} -> Maybe [Text]
faultCodes) (\s :: UpdateLabelGroup
s@UpdateLabelGroup' {} Maybe [Text]
a -> UpdateLabelGroup
s {$sel:faultCodes:UpdateLabelGroup' :: Maybe [Text]
faultCodes = Maybe [Text]
a} :: UpdateLabelGroup) 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

-- | The name of the label group to be updated.
updateLabelGroup_labelGroupName :: Lens.Lens' UpdateLabelGroup Prelude.Text
updateLabelGroup_labelGroupName :: Lens' UpdateLabelGroup Text
updateLabelGroup_labelGroupName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateLabelGroup' {Text
labelGroupName :: Text
$sel:labelGroupName:UpdateLabelGroup' :: UpdateLabelGroup -> Text
labelGroupName} -> Text
labelGroupName) (\s :: UpdateLabelGroup
s@UpdateLabelGroup' {} Text
a -> UpdateLabelGroup
s {$sel:labelGroupName:UpdateLabelGroup' :: Text
labelGroupName = Text
a} :: UpdateLabelGroup)

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

instance Prelude.Hashable UpdateLabelGroup where
  hashWithSalt :: Int -> UpdateLabelGroup -> Int
hashWithSalt Int
_salt UpdateLabelGroup' {Maybe [Text]
Text
labelGroupName :: Text
faultCodes :: Maybe [Text]
$sel:labelGroupName:UpdateLabelGroup' :: UpdateLabelGroup -> Text
$sel:faultCodes:UpdateLabelGroup' :: UpdateLabelGroup -> Maybe [Text]
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Text]
faultCodes
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
labelGroupName

instance Prelude.NFData UpdateLabelGroup where
  rnf :: UpdateLabelGroup -> ()
rnf UpdateLabelGroup' {Maybe [Text]
Text
labelGroupName :: Text
faultCodes :: Maybe [Text]
$sel:labelGroupName:UpdateLabelGroup' :: UpdateLabelGroup -> Text
$sel:faultCodes:UpdateLabelGroup' :: UpdateLabelGroup -> Maybe [Text]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
faultCodes
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
labelGroupName

instance Data.ToHeaders UpdateLabelGroup where
  toHeaders :: UpdateLabelGroup -> [Header]
toHeaders =
    forall a b. a -> b -> a
Prelude.const
      ( forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              forall a. ToHeader a => HeaderName -> a -> [Header]
Data.=# ( ByteString
"AWSLookoutEquipmentFrontendService.UpdateLabelGroup" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              forall a. ToHeader a => HeaderName -> a -> [Header]
Data.=# ( ByteString
"application/x-amz-json-1.0" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Data.ToJSON UpdateLabelGroup where
  toJSON :: UpdateLabelGroup -> Value
toJSON UpdateLabelGroup' {Maybe [Text]
Text
labelGroupName :: Text
faultCodes :: Maybe [Text]
$sel:labelGroupName:UpdateLabelGroup' :: UpdateLabelGroup -> Text
$sel:faultCodes:UpdateLabelGroup' :: UpdateLabelGroup -> Maybe [Text]
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"FaultCodes" 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]
faultCodes,
            forall a. a -> Maybe a
Prelude.Just
              (Key
"LabelGroupName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
labelGroupName)
          ]
      )

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

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

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

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

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