{-# 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.PutClassificationExportConfiguration
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Creates or updates the configuration settings for storing data
-- classification results.
module Amazonka.MacieV2.PutClassificationExportConfiguration
  ( -- * Creating a Request
    PutClassificationExportConfiguration (..),
    newPutClassificationExportConfiguration,

    -- * Request Lenses
    putClassificationExportConfiguration_configuration,

    -- * Destructuring the Response
    PutClassificationExportConfigurationResponse (..),
    newPutClassificationExportConfigurationResponse,

    -- * Response Lenses
    putClassificationExportConfigurationResponse_configuration,
    putClassificationExportConfigurationResponse_httpStatus,
  )
where

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

-- | /See:/ 'newPutClassificationExportConfiguration' smart constructor.
data PutClassificationExportConfiguration = PutClassificationExportConfiguration'
  { -- | The location to store data classification results in, and the encryption
    -- settings to use when storing results in that location.
    PutClassificationExportConfiguration
-> ClassificationExportConfiguration
configuration :: ClassificationExportConfiguration
  }
  deriving (PutClassificationExportConfiguration
-> PutClassificationExportConfiguration -> Bool
(PutClassificationExportConfiguration
 -> PutClassificationExportConfiguration -> Bool)
-> (PutClassificationExportConfiguration
    -> PutClassificationExportConfiguration -> Bool)
-> Eq PutClassificationExportConfiguration
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PutClassificationExportConfiguration
-> PutClassificationExportConfiguration -> Bool
$c/= :: PutClassificationExportConfiguration
-> PutClassificationExportConfiguration -> Bool
== :: PutClassificationExportConfiguration
-> PutClassificationExportConfiguration -> Bool
$c== :: PutClassificationExportConfiguration
-> PutClassificationExportConfiguration -> Bool
Prelude.Eq, ReadPrec [PutClassificationExportConfiguration]
ReadPrec PutClassificationExportConfiguration
Int -> ReadS PutClassificationExportConfiguration
ReadS [PutClassificationExportConfiguration]
(Int -> ReadS PutClassificationExportConfiguration)
-> ReadS [PutClassificationExportConfiguration]
-> ReadPrec PutClassificationExportConfiguration
-> ReadPrec [PutClassificationExportConfiguration]
-> Read PutClassificationExportConfiguration
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PutClassificationExportConfiguration]
$creadListPrec :: ReadPrec [PutClassificationExportConfiguration]
readPrec :: ReadPrec PutClassificationExportConfiguration
$creadPrec :: ReadPrec PutClassificationExportConfiguration
readList :: ReadS [PutClassificationExportConfiguration]
$creadList :: ReadS [PutClassificationExportConfiguration]
readsPrec :: Int -> ReadS PutClassificationExportConfiguration
$creadsPrec :: Int -> ReadS PutClassificationExportConfiguration
Prelude.Read, Int -> PutClassificationExportConfiguration -> ShowS
[PutClassificationExportConfiguration] -> ShowS
PutClassificationExportConfiguration -> String
(Int -> PutClassificationExportConfiguration -> ShowS)
-> (PutClassificationExportConfiguration -> String)
-> ([PutClassificationExportConfiguration] -> ShowS)
-> Show PutClassificationExportConfiguration
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PutClassificationExportConfiguration] -> ShowS
$cshowList :: [PutClassificationExportConfiguration] -> ShowS
show :: PutClassificationExportConfiguration -> String
$cshow :: PutClassificationExportConfiguration -> String
showsPrec :: Int -> PutClassificationExportConfiguration -> ShowS
$cshowsPrec :: Int -> PutClassificationExportConfiguration -> ShowS
Prelude.Show, (forall x.
 PutClassificationExportConfiguration
 -> Rep PutClassificationExportConfiguration x)
-> (forall x.
    Rep PutClassificationExportConfiguration x
    -> PutClassificationExportConfiguration)
-> Generic PutClassificationExportConfiguration
forall x.
Rep PutClassificationExportConfiguration x
-> PutClassificationExportConfiguration
forall x.
PutClassificationExportConfiguration
-> Rep PutClassificationExportConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep PutClassificationExportConfiguration x
-> PutClassificationExportConfiguration
$cfrom :: forall x.
PutClassificationExportConfiguration
-> Rep PutClassificationExportConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'PutClassificationExportConfiguration' 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:
--
-- 'configuration', 'putClassificationExportConfiguration_configuration' - The location to store data classification results in, and the encryption
-- settings to use when storing results in that location.
newPutClassificationExportConfiguration ::
  -- | 'configuration'
  ClassificationExportConfiguration ->
  PutClassificationExportConfiguration
newPutClassificationExportConfiguration :: ClassificationExportConfiguration
-> PutClassificationExportConfiguration
newPutClassificationExportConfiguration
  ClassificationExportConfiguration
pConfiguration_ =
    PutClassificationExportConfiguration' :: ClassificationExportConfiguration
-> PutClassificationExportConfiguration
PutClassificationExportConfiguration'
      { $sel:configuration:PutClassificationExportConfiguration' :: ClassificationExportConfiguration
configuration =
          ClassificationExportConfiguration
pConfiguration_
      }

-- | The location to store data classification results in, and the encryption
-- settings to use when storing results in that location.
putClassificationExportConfiguration_configuration :: Lens.Lens' PutClassificationExportConfiguration ClassificationExportConfiguration
putClassificationExportConfiguration_configuration :: (ClassificationExportConfiguration
 -> f ClassificationExportConfiguration)
-> PutClassificationExportConfiguration
-> f PutClassificationExportConfiguration
putClassificationExportConfiguration_configuration = (PutClassificationExportConfiguration
 -> ClassificationExportConfiguration)
-> (PutClassificationExportConfiguration
    -> ClassificationExportConfiguration
    -> PutClassificationExportConfiguration)
-> Lens
     PutClassificationExportConfiguration
     PutClassificationExportConfiguration
     ClassificationExportConfiguration
     ClassificationExportConfiguration
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutClassificationExportConfiguration' {ClassificationExportConfiguration
configuration :: ClassificationExportConfiguration
$sel:configuration:PutClassificationExportConfiguration' :: PutClassificationExportConfiguration
-> ClassificationExportConfiguration
configuration} -> ClassificationExportConfiguration
configuration) (\s :: PutClassificationExportConfiguration
s@PutClassificationExportConfiguration' {} ClassificationExportConfiguration
a -> PutClassificationExportConfiguration
s {$sel:configuration:PutClassificationExportConfiguration' :: ClassificationExportConfiguration
configuration = ClassificationExportConfiguration
a} :: PutClassificationExportConfiguration)

instance
  Core.AWSRequest
    PutClassificationExportConfiguration
  where
  type
    AWSResponse PutClassificationExportConfiguration =
      PutClassificationExportConfigurationResponse
  request :: PutClassificationExportConfiguration
-> Request PutClassificationExportConfiguration
request = Service
-> PutClassificationExportConfiguration
-> Request PutClassificationExportConfiguration
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.putJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy PutClassificationExportConfiguration
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse
           (AWSResponse PutClassificationExportConfiguration)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either
      String (AWSResponse PutClassificationExportConfiguration))
-> Logger
-> Service
-> Proxy PutClassificationExportConfiguration
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse
           (AWSResponse PutClassificationExportConfiguration)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe ClassificationExportConfiguration
-> Int -> PutClassificationExportConfigurationResponse
PutClassificationExportConfigurationResponse'
            (Maybe ClassificationExportConfiguration
 -> Int -> PutClassificationExportConfigurationResponse)
-> Either String (Maybe ClassificationExportConfiguration)
-> Either
     String (Int -> PutClassificationExportConfigurationResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object
-> Key -> Either String (Maybe ClassificationExportConfiguration)
forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Core..?> Key
"configuration")
              Either String (Int -> PutClassificationExportConfigurationResponse)
-> Either String Int
-> Either String PutClassificationExportConfigurationResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance
  Prelude.Hashable
    PutClassificationExportConfiguration

instance
  Prelude.NFData
    PutClassificationExportConfiguration

instance
  Core.ToHeaders
    PutClassificationExportConfiguration
  where
  toHeaders :: PutClassificationExportConfiguration -> ResponseHeaders
toHeaders =
    ResponseHeaders
-> PutClassificationExportConfiguration -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"Content-Type"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance
  Core.ToJSON
    PutClassificationExportConfiguration
  where
  toJSON :: PutClassificationExportConfiguration -> Value
toJSON PutClassificationExportConfiguration' {ClassificationExportConfiguration
configuration :: ClassificationExportConfiguration
$sel:configuration:PutClassificationExportConfiguration' :: PutClassificationExportConfiguration
-> ClassificationExportConfiguration
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Key
"configuration" Key -> ClassificationExportConfiguration -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Core..= ClassificationExportConfiguration
configuration)
          ]
      )

instance
  Core.ToPath
    PutClassificationExportConfiguration
  where
  toPath :: PutClassificationExportConfiguration -> ByteString
toPath =
    ByteString -> PutClassificationExportConfiguration -> ByteString
forall a b. a -> b -> a
Prelude.const
      ByteString
"/classification-export-configuration"

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

-- | /See:/ 'newPutClassificationExportConfigurationResponse' smart constructor.
data PutClassificationExportConfigurationResponse = PutClassificationExportConfigurationResponse'
  { -- | The location where the data classification results are stored, and the
    -- encryption settings that are used when storing results in that location.
    PutClassificationExportConfigurationResponse
-> Maybe ClassificationExportConfiguration
configuration :: Prelude.Maybe ClassificationExportConfiguration,
    -- | The response's http status code.
    PutClassificationExportConfigurationResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (PutClassificationExportConfigurationResponse
-> PutClassificationExportConfigurationResponse -> Bool
(PutClassificationExportConfigurationResponse
 -> PutClassificationExportConfigurationResponse -> Bool)
-> (PutClassificationExportConfigurationResponse
    -> PutClassificationExportConfigurationResponse -> Bool)
-> Eq PutClassificationExportConfigurationResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PutClassificationExportConfigurationResponse
-> PutClassificationExportConfigurationResponse -> Bool
$c/= :: PutClassificationExportConfigurationResponse
-> PutClassificationExportConfigurationResponse -> Bool
== :: PutClassificationExportConfigurationResponse
-> PutClassificationExportConfigurationResponse -> Bool
$c== :: PutClassificationExportConfigurationResponse
-> PutClassificationExportConfigurationResponse -> Bool
Prelude.Eq, ReadPrec [PutClassificationExportConfigurationResponse]
ReadPrec PutClassificationExportConfigurationResponse
Int -> ReadS PutClassificationExportConfigurationResponse
ReadS [PutClassificationExportConfigurationResponse]
(Int -> ReadS PutClassificationExportConfigurationResponse)
-> ReadS [PutClassificationExportConfigurationResponse]
-> ReadPrec PutClassificationExportConfigurationResponse
-> ReadPrec [PutClassificationExportConfigurationResponse]
-> Read PutClassificationExportConfigurationResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PutClassificationExportConfigurationResponse]
$creadListPrec :: ReadPrec [PutClassificationExportConfigurationResponse]
readPrec :: ReadPrec PutClassificationExportConfigurationResponse
$creadPrec :: ReadPrec PutClassificationExportConfigurationResponse
readList :: ReadS [PutClassificationExportConfigurationResponse]
$creadList :: ReadS [PutClassificationExportConfigurationResponse]
readsPrec :: Int -> ReadS PutClassificationExportConfigurationResponse
$creadsPrec :: Int -> ReadS PutClassificationExportConfigurationResponse
Prelude.Read, Int -> PutClassificationExportConfigurationResponse -> ShowS
[PutClassificationExportConfigurationResponse] -> ShowS
PutClassificationExportConfigurationResponse -> String
(Int -> PutClassificationExportConfigurationResponse -> ShowS)
-> (PutClassificationExportConfigurationResponse -> String)
-> ([PutClassificationExportConfigurationResponse] -> ShowS)
-> Show PutClassificationExportConfigurationResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PutClassificationExportConfigurationResponse] -> ShowS
$cshowList :: [PutClassificationExportConfigurationResponse] -> ShowS
show :: PutClassificationExportConfigurationResponse -> String
$cshow :: PutClassificationExportConfigurationResponse -> String
showsPrec :: Int -> PutClassificationExportConfigurationResponse -> ShowS
$cshowsPrec :: Int -> PutClassificationExportConfigurationResponse -> ShowS
Prelude.Show, (forall x.
 PutClassificationExportConfigurationResponse
 -> Rep PutClassificationExportConfigurationResponse x)
-> (forall x.
    Rep PutClassificationExportConfigurationResponse x
    -> PutClassificationExportConfigurationResponse)
-> Generic PutClassificationExportConfigurationResponse
forall x.
Rep PutClassificationExportConfigurationResponse x
-> PutClassificationExportConfigurationResponse
forall x.
PutClassificationExportConfigurationResponse
-> Rep PutClassificationExportConfigurationResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep PutClassificationExportConfigurationResponse x
-> PutClassificationExportConfigurationResponse
$cfrom :: forall x.
PutClassificationExportConfigurationResponse
-> Rep PutClassificationExportConfigurationResponse x
Prelude.Generic)

-- |
-- Create a value of 'PutClassificationExportConfigurationResponse' 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:
--
-- 'configuration', 'putClassificationExportConfigurationResponse_configuration' - The location where the data classification results are stored, and the
-- encryption settings that are used when storing results in that location.
--
-- 'httpStatus', 'putClassificationExportConfigurationResponse_httpStatus' - The response's http status code.
newPutClassificationExportConfigurationResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  PutClassificationExportConfigurationResponse
newPutClassificationExportConfigurationResponse :: Int -> PutClassificationExportConfigurationResponse
newPutClassificationExportConfigurationResponse
  Int
pHttpStatus_ =
    PutClassificationExportConfigurationResponse' :: Maybe ClassificationExportConfiguration
-> Int -> PutClassificationExportConfigurationResponse
PutClassificationExportConfigurationResponse'
      { $sel:configuration:PutClassificationExportConfigurationResponse' :: Maybe ClassificationExportConfiguration
configuration =
          Maybe ClassificationExportConfiguration
forall a. Maybe a
Prelude.Nothing,
        $sel:httpStatus:PutClassificationExportConfigurationResponse' :: Int
httpStatus = Int
pHttpStatus_
      }

-- | The location where the data classification results are stored, and the
-- encryption settings that are used when storing results in that location.
putClassificationExportConfigurationResponse_configuration :: Lens.Lens' PutClassificationExportConfigurationResponse (Prelude.Maybe ClassificationExportConfiguration)
putClassificationExportConfigurationResponse_configuration :: (Maybe ClassificationExportConfiguration
 -> f (Maybe ClassificationExportConfiguration))
-> PutClassificationExportConfigurationResponse
-> f PutClassificationExportConfigurationResponse
putClassificationExportConfigurationResponse_configuration = (PutClassificationExportConfigurationResponse
 -> Maybe ClassificationExportConfiguration)
-> (PutClassificationExportConfigurationResponse
    -> Maybe ClassificationExportConfiguration
    -> PutClassificationExportConfigurationResponse)
-> Lens
     PutClassificationExportConfigurationResponse
     PutClassificationExportConfigurationResponse
     (Maybe ClassificationExportConfiguration)
     (Maybe ClassificationExportConfiguration)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutClassificationExportConfigurationResponse' {Maybe ClassificationExportConfiguration
configuration :: Maybe ClassificationExportConfiguration
$sel:configuration:PutClassificationExportConfigurationResponse' :: PutClassificationExportConfigurationResponse
-> Maybe ClassificationExportConfiguration
configuration} -> Maybe ClassificationExportConfiguration
configuration) (\s :: PutClassificationExportConfigurationResponse
s@PutClassificationExportConfigurationResponse' {} Maybe ClassificationExportConfiguration
a -> PutClassificationExportConfigurationResponse
s {$sel:configuration:PutClassificationExportConfigurationResponse' :: Maybe ClassificationExportConfiguration
configuration = Maybe ClassificationExportConfiguration
a} :: PutClassificationExportConfigurationResponse)

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

instance
  Prelude.NFData
    PutClassificationExportConfigurationResponse