{-# 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.MacieV2.UpdateResourceProfile
-- 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 sensitivity score for an S3 bucket.
module Amazonka.MacieV2.UpdateResourceProfile
  ( -- * Creating a Request
    UpdateResourceProfile (..),
    newUpdateResourceProfile,

    -- * Request Lenses
    updateResourceProfile_sensitivityScoreOverride,
    updateResourceProfile_resourceArn,

    -- * Destructuring the Response
    UpdateResourceProfileResponse (..),
    newUpdateResourceProfileResponse,

    -- * Response Lenses
    updateResourceProfileResponse_httpStatus,
  )
where

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

-- | /See:/ 'newUpdateResourceProfile' smart constructor.
data UpdateResourceProfile = UpdateResourceProfile'
  { -- | The new sensitivity score for the bucket. Valid values are: 100, assign
    -- the maximum score and apply the /Sensitive/ label to the bucket; and,
    -- null (empty), assign a score that Amazon Macie calculates automatically
    -- after you submit the request.
    UpdateResourceProfile -> Maybe Int
sensitivityScoreOverride :: Prelude.Maybe Prelude.Int,
    -- | The Amazon Resource Name (ARN) of the S3 bucket that the request applies
    -- to.
    UpdateResourceProfile -> Text
resourceArn :: Prelude.Text
  }
  deriving (UpdateResourceProfile -> UpdateResourceProfile -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateResourceProfile -> UpdateResourceProfile -> Bool
$c/= :: UpdateResourceProfile -> UpdateResourceProfile -> Bool
== :: UpdateResourceProfile -> UpdateResourceProfile -> Bool
$c== :: UpdateResourceProfile -> UpdateResourceProfile -> Bool
Prelude.Eq, ReadPrec [UpdateResourceProfile]
ReadPrec UpdateResourceProfile
Int -> ReadS UpdateResourceProfile
ReadS [UpdateResourceProfile]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateResourceProfile]
$creadListPrec :: ReadPrec [UpdateResourceProfile]
readPrec :: ReadPrec UpdateResourceProfile
$creadPrec :: ReadPrec UpdateResourceProfile
readList :: ReadS [UpdateResourceProfile]
$creadList :: ReadS [UpdateResourceProfile]
readsPrec :: Int -> ReadS UpdateResourceProfile
$creadsPrec :: Int -> ReadS UpdateResourceProfile
Prelude.Read, Int -> UpdateResourceProfile -> ShowS
[UpdateResourceProfile] -> ShowS
UpdateResourceProfile -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateResourceProfile] -> ShowS
$cshowList :: [UpdateResourceProfile] -> ShowS
show :: UpdateResourceProfile -> String
$cshow :: UpdateResourceProfile -> String
showsPrec :: Int -> UpdateResourceProfile -> ShowS
$cshowsPrec :: Int -> UpdateResourceProfile -> ShowS
Prelude.Show, forall x. Rep UpdateResourceProfile x -> UpdateResourceProfile
forall x. UpdateResourceProfile -> Rep UpdateResourceProfile x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateResourceProfile x -> UpdateResourceProfile
$cfrom :: forall x. UpdateResourceProfile -> Rep UpdateResourceProfile x
Prelude.Generic)

-- |
-- Create a value of 'UpdateResourceProfile' 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:
--
-- 'sensitivityScoreOverride', 'updateResourceProfile_sensitivityScoreOverride' - The new sensitivity score for the bucket. Valid values are: 100, assign
-- the maximum score and apply the /Sensitive/ label to the bucket; and,
-- null (empty), assign a score that Amazon Macie calculates automatically
-- after you submit the request.
--
-- 'resourceArn', 'updateResourceProfile_resourceArn' - The Amazon Resource Name (ARN) of the S3 bucket that the request applies
-- to.
newUpdateResourceProfile ::
  -- | 'resourceArn'
  Prelude.Text ->
  UpdateResourceProfile
newUpdateResourceProfile :: Text -> UpdateResourceProfile
newUpdateResourceProfile Text
pResourceArn_ =
  UpdateResourceProfile'
    { $sel:sensitivityScoreOverride:UpdateResourceProfile' :: Maybe Int
sensitivityScoreOverride =
        forall a. Maybe a
Prelude.Nothing,
      $sel:resourceArn:UpdateResourceProfile' :: Text
resourceArn = Text
pResourceArn_
    }

-- | The new sensitivity score for the bucket. Valid values are: 100, assign
-- the maximum score and apply the /Sensitive/ label to the bucket; and,
-- null (empty), assign a score that Amazon Macie calculates automatically
-- after you submit the request.
updateResourceProfile_sensitivityScoreOverride :: Lens.Lens' UpdateResourceProfile (Prelude.Maybe Prelude.Int)
updateResourceProfile_sensitivityScoreOverride :: Lens' UpdateResourceProfile (Maybe Int)
updateResourceProfile_sensitivityScoreOverride = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateResourceProfile' {Maybe Int
sensitivityScoreOverride :: Maybe Int
$sel:sensitivityScoreOverride:UpdateResourceProfile' :: UpdateResourceProfile -> Maybe Int
sensitivityScoreOverride} -> Maybe Int
sensitivityScoreOverride) (\s :: UpdateResourceProfile
s@UpdateResourceProfile' {} Maybe Int
a -> UpdateResourceProfile
s {$sel:sensitivityScoreOverride:UpdateResourceProfile' :: Maybe Int
sensitivityScoreOverride = Maybe Int
a} :: UpdateResourceProfile)

-- | The Amazon Resource Name (ARN) of the S3 bucket that the request applies
-- to.
updateResourceProfile_resourceArn :: Lens.Lens' UpdateResourceProfile Prelude.Text
updateResourceProfile_resourceArn :: Lens' UpdateResourceProfile Text
updateResourceProfile_resourceArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateResourceProfile' {Text
resourceArn :: Text
$sel:resourceArn:UpdateResourceProfile' :: UpdateResourceProfile -> Text
resourceArn} -> Text
resourceArn) (\s :: UpdateResourceProfile
s@UpdateResourceProfile' {} Text
a -> UpdateResourceProfile
s {$sel:resourceArn:UpdateResourceProfile' :: Text
resourceArn = Text
a} :: UpdateResourceProfile)

instance Core.AWSRequest UpdateResourceProfile where
  type
    AWSResponse UpdateResourceProfile =
      UpdateResourceProfileResponse
  request :: (Service -> Service)
-> UpdateResourceProfile -> Request UpdateResourceProfile
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 UpdateResourceProfile
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse UpdateResourceProfile)))
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 -> UpdateResourceProfileResponse
UpdateResourceProfileResponse'
            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 UpdateResourceProfile where
  hashWithSalt :: Int -> UpdateResourceProfile -> Int
hashWithSalt Int
_salt UpdateResourceProfile' {Maybe Int
Text
resourceArn :: Text
sensitivityScoreOverride :: Maybe Int
$sel:resourceArn:UpdateResourceProfile' :: UpdateResourceProfile -> Text
$sel:sensitivityScoreOverride:UpdateResourceProfile' :: UpdateResourceProfile -> Maybe Int
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
sensitivityScoreOverride
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
resourceArn

instance Prelude.NFData UpdateResourceProfile where
  rnf :: UpdateResourceProfile -> ()
rnf UpdateResourceProfile' {Maybe Int
Text
resourceArn :: Text
sensitivityScoreOverride :: Maybe Int
$sel:resourceArn:UpdateResourceProfile' :: UpdateResourceProfile -> Text
$sel:sensitivityScoreOverride:UpdateResourceProfile' :: UpdateResourceProfile -> Maybe Int
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
sensitivityScoreOverride
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
resourceArn

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

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

instance Data.ToQuery UpdateResourceProfile where
  toQuery :: UpdateResourceProfile -> QueryString
toQuery UpdateResourceProfile' {Maybe Int
Text
resourceArn :: Text
sensitivityScoreOverride :: Maybe Int
$sel:resourceArn:UpdateResourceProfile' :: UpdateResourceProfile -> Text
$sel:sensitivityScoreOverride:UpdateResourceProfile' :: UpdateResourceProfile -> Maybe Int
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat [ByteString
"resourceArn" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Text
resourceArn]

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

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

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

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