{-# 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.UpdateResourceProfileDetections
-- 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 scoring settings for an S3 bucket.
module Amazonka.MacieV2.UpdateResourceProfileDetections
  ( -- * Creating a Request
    UpdateResourceProfileDetections (..),
    newUpdateResourceProfileDetections,

    -- * Request Lenses
    updateResourceProfileDetections_suppressDataIdentifiers,
    updateResourceProfileDetections_resourceArn,

    -- * Destructuring the Response
    UpdateResourceProfileDetectionsResponse (..),
    newUpdateResourceProfileDetectionsResponse,

    -- * Response Lenses
    updateResourceProfileDetectionsResponse_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:/ 'newUpdateResourceProfileDetections' smart constructor.
data UpdateResourceProfileDetections = UpdateResourceProfileDetections'
  { -- | An array of objects, one for each custom data identifier or managed data
    -- identifier that detected the type of sensitive data to start excluding
    -- or including in the bucket\'s score. To start including all sensitive
    -- data types in the score, don\'t specify any values for this array.
    UpdateResourceProfileDetections -> Maybe [SuppressDataIdentifier]
suppressDataIdentifiers :: Prelude.Maybe [SuppressDataIdentifier],
    -- | The Amazon Resource Name (ARN) of the S3 bucket that the request applies
    -- to.
    UpdateResourceProfileDetections -> Text
resourceArn :: Prelude.Text
  }
  deriving (UpdateResourceProfileDetections
-> UpdateResourceProfileDetections -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateResourceProfileDetections
-> UpdateResourceProfileDetections -> Bool
$c/= :: UpdateResourceProfileDetections
-> UpdateResourceProfileDetections -> Bool
== :: UpdateResourceProfileDetections
-> UpdateResourceProfileDetections -> Bool
$c== :: UpdateResourceProfileDetections
-> UpdateResourceProfileDetections -> Bool
Prelude.Eq, ReadPrec [UpdateResourceProfileDetections]
ReadPrec UpdateResourceProfileDetections
Int -> ReadS UpdateResourceProfileDetections
ReadS [UpdateResourceProfileDetections]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateResourceProfileDetections]
$creadListPrec :: ReadPrec [UpdateResourceProfileDetections]
readPrec :: ReadPrec UpdateResourceProfileDetections
$creadPrec :: ReadPrec UpdateResourceProfileDetections
readList :: ReadS [UpdateResourceProfileDetections]
$creadList :: ReadS [UpdateResourceProfileDetections]
readsPrec :: Int -> ReadS UpdateResourceProfileDetections
$creadsPrec :: Int -> ReadS UpdateResourceProfileDetections
Prelude.Read, Int -> UpdateResourceProfileDetections -> ShowS
[UpdateResourceProfileDetections] -> ShowS
UpdateResourceProfileDetections -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateResourceProfileDetections] -> ShowS
$cshowList :: [UpdateResourceProfileDetections] -> ShowS
show :: UpdateResourceProfileDetections -> String
$cshow :: UpdateResourceProfileDetections -> String
showsPrec :: Int -> UpdateResourceProfileDetections -> ShowS
$cshowsPrec :: Int -> UpdateResourceProfileDetections -> ShowS
Prelude.Show, forall x.
Rep UpdateResourceProfileDetections x
-> UpdateResourceProfileDetections
forall x.
UpdateResourceProfileDetections
-> Rep UpdateResourceProfileDetections x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UpdateResourceProfileDetections x
-> UpdateResourceProfileDetections
$cfrom :: forall x.
UpdateResourceProfileDetections
-> Rep UpdateResourceProfileDetections x
Prelude.Generic)

-- |
-- Create a value of 'UpdateResourceProfileDetections' 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:
--
-- 'suppressDataIdentifiers', 'updateResourceProfileDetections_suppressDataIdentifiers' - An array of objects, one for each custom data identifier or managed data
-- identifier that detected the type of sensitive data to start excluding
-- or including in the bucket\'s score. To start including all sensitive
-- data types in the score, don\'t specify any values for this array.
--
-- 'resourceArn', 'updateResourceProfileDetections_resourceArn' - The Amazon Resource Name (ARN) of the S3 bucket that the request applies
-- to.
newUpdateResourceProfileDetections ::
  -- | 'resourceArn'
  Prelude.Text ->
  UpdateResourceProfileDetections
newUpdateResourceProfileDetections :: Text -> UpdateResourceProfileDetections
newUpdateResourceProfileDetections Text
pResourceArn_ =
  UpdateResourceProfileDetections'
    { $sel:suppressDataIdentifiers:UpdateResourceProfileDetections' :: Maybe [SuppressDataIdentifier]
suppressDataIdentifiers =
        forall a. Maybe a
Prelude.Nothing,
      $sel:resourceArn:UpdateResourceProfileDetections' :: Text
resourceArn = Text
pResourceArn_
    }

-- | An array of objects, one for each custom data identifier or managed data
-- identifier that detected the type of sensitive data to start excluding
-- or including in the bucket\'s score. To start including all sensitive
-- data types in the score, don\'t specify any values for this array.
updateResourceProfileDetections_suppressDataIdentifiers :: Lens.Lens' UpdateResourceProfileDetections (Prelude.Maybe [SuppressDataIdentifier])
updateResourceProfileDetections_suppressDataIdentifiers :: Lens'
  UpdateResourceProfileDetections (Maybe [SuppressDataIdentifier])
updateResourceProfileDetections_suppressDataIdentifiers = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateResourceProfileDetections' {Maybe [SuppressDataIdentifier]
suppressDataIdentifiers :: Maybe [SuppressDataIdentifier]
$sel:suppressDataIdentifiers:UpdateResourceProfileDetections' :: UpdateResourceProfileDetections -> Maybe [SuppressDataIdentifier]
suppressDataIdentifiers} -> Maybe [SuppressDataIdentifier]
suppressDataIdentifiers) (\s :: UpdateResourceProfileDetections
s@UpdateResourceProfileDetections' {} Maybe [SuppressDataIdentifier]
a -> UpdateResourceProfileDetections
s {$sel:suppressDataIdentifiers:UpdateResourceProfileDetections' :: Maybe [SuppressDataIdentifier]
suppressDataIdentifiers = Maybe [SuppressDataIdentifier]
a} :: UpdateResourceProfileDetections) 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 Amazon Resource Name (ARN) of the S3 bucket that the request applies
-- to.
updateResourceProfileDetections_resourceArn :: Lens.Lens' UpdateResourceProfileDetections Prelude.Text
updateResourceProfileDetections_resourceArn :: Lens' UpdateResourceProfileDetections Text
updateResourceProfileDetections_resourceArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateResourceProfileDetections' {Text
resourceArn :: Text
$sel:resourceArn:UpdateResourceProfileDetections' :: UpdateResourceProfileDetections -> Text
resourceArn} -> Text
resourceArn) (\s :: UpdateResourceProfileDetections
s@UpdateResourceProfileDetections' {} Text
a -> UpdateResourceProfileDetections
s {$sel:resourceArn:UpdateResourceProfileDetections' :: Text
resourceArn = Text
a} :: UpdateResourceProfileDetections)

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

instance
  Prelude.NFData
    UpdateResourceProfileDetections
  where
  rnf :: UpdateResourceProfileDetections -> ()
rnf UpdateResourceProfileDetections' {Maybe [SuppressDataIdentifier]
Text
resourceArn :: Text
suppressDataIdentifiers :: Maybe [SuppressDataIdentifier]
$sel:resourceArn:UpdateResourceProfileDetections' :: UpdateResourceProfileDetections -> Text
$sel:suppressDataIdentifiers:UpdateResourceProfileDetections' :: UpdateResourceProfileDetections -> Maybe [SuppressDataIdentifier]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [SuppressDataIdentifier]
suppressDataIdentifiers
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
resourceArn

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

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

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

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

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

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

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