{-# 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.GetClassificationScope
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Retrieves the classification scope settings for an account.
module Amazonka.MacieV2.GetClassificationScope
  ( -- * Creating a Request
    GetClassificationScope (..),
    newGetClassificationScope,

    -- * Request Lenses
    getClassificationScope_id,

    -- * Destructuring the Response
    GetClassificationScopeResponse (..),
    newGetClassificationScopeResponse,

    -- * Response Lenses
    getClassificationScopeResponse_id,
    getClassificationScopeResponse_name,
    getClassificationScopeResponse_s3,
    getClassificationScopeResponse_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:/ 'newGetClassificationScope' smart constructor.
data GetClassificationScope = GetClassificationScope'
  { -- | The unique identifier for the Amazon Macie resource that the request
    -- applies to.
    GetClassificationScope -> Text
id :: Prelude.Text
  }
  deriving (GetClassificationScope -> GetClassificationScope -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetClassificationScope -> GetClassificationScope -> Bool
$c/= :: GetClassificationScope -> GetClassificationScope -> Bool
== :: GetClassificationScope -> GetClassificationScope -> Bool
$c== :: GetClassificationScope -> GetClassificationScope -> Bool
Prelude.Eq, ReadPrec [GetClassificationScope]
ReadPrec GetClassificationScope
Int -> ReadS GetClassificationScope
ReadS [GetClassificationScope]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetClassificationScope]
$creadListPrec :: ReadPrec [GetClassificationScope]
readPrec :: ReadPrec GetClassificationScope
$creadPrec :: ReadPrec GetClassificationScope
readList :: ReadS [GetClassificationScope]
$creadList :: ReadS [GetClassificationScope]
readsPrec :: Int -> ReadS GetClassificationScope
$creadsPrec :: Int -> ReadS GetClassificationScope
Prelude.Read, Int -> GetClassificationScope -> ShowS
[GetClassificationScope] -> ShowS
GetClassificationScope -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetClassificationScope] -> ShowS
$cshowList :: [GetClassificationScope] -> ShowS
show :: GetClassificationScope -> String
$cshow :: GetClassificationScope -> String
showsPrec :: Int -> GetClassificationScope -> ShowS
$cshowsPrec :: Int -> GetClassificationScope -> ShowS
Prelude.Show, forall x. Rep GetClassificationScope x -> GetClassificationScope
forall x. GetClassificationScope -> Rep GetClassificationScope x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetClassificationScope x -> GetClassificationScope
$cfrom :: forall x. GetClassificationScope -> Rep GetClassificationScope x
Prelude.Generic)

-- |
-- Create a value of 'GetClassificationScope' 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:
--
-- 'id', 'getClassificationScope_id' - The unique identifier for the Amazon Macie resource that the request
-- applies to.
newGetClassificationScope ::
  -- | 'id'
  Prelude.Text ->
  GetClassificationScope
newGetClassificationScope :: Text -> GetClassificationScope
newGetClassificationScope Text
pId_ =
  GetClassificationScope' {$sel:id:GetClassificationScope' :: Text
id = Text
pId_}

-- | The unique identifier for the Amazon Macie resource that the request
-- applies to.
getClassificationScope_id :: Lens.Lens' GetClassificationScope Prelude.Text
getClassificationScope_id :: Lens' GetClassificationScope Text
getClassificationScope_id = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetClassificationScope' {Text
id :: Text
$sel:id:GetClassificationScope' :: GetClassificationScope -> Text
id} -> Text
id) (\s :: GetClassificationScope
s@GetClassificationScope' {} Text
a -> GetClassificationScope
s {$sel:id:GetClassificationScope' :: Text
id = Text
a} :: GetClassificationScope)

instance Core.AWSRequest GetClassificationScope where
  type
    AWSResponse GetClassificationScope =
      GetClassificationScopeResponse
  request :: (Service -> Service)
-> GetClassificationScope -> Request GetClassificationScope
request Service -> Service
overrides =
    forall a. ToRequest a => Service -> a -> Request a
Request.get (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy GetClassificationScope
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse GetClassificationScope)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe S3ClassificationScope
-> Int
-> GetClassificationScopeResponse
GetClassificationScopeResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"id")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"name")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"s3")
            forall (f :: * -> *) a b. Applicative f => 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 GetClassificationScope where
  hashWithSalt :: Int -> GetClassificationScope -> Int
hashWithSalt Int
_salt GetClassificationScope' {Text
id :: Text
$sel:id:GetClassificationScope' :: GetClassificationScope -> Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
id

instance Prelude.NFData GetClassificationScope where
  rnf :: GetClassificationScope -> ()
rnf GetClassificationScope' {Text
id :: Text
$sel:id:GetClassificationScope' :: GetClassificationScope -> Text
..} = forall a. NFData a => a -> ()
Prelude.rnf Text
id

instance Data.ToHeaders GetClassificationScope where
  toHeaders :: GetClassificationScope -> 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.ToPath GetClassificationScope where
  toPath :: GetClassificationScope -> ByteString
toPath GetClassificationScope' {Text
id :: Text
$sel:id:GetClassificationScope' :: GetClassificationScope -> Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ByteString
"/classification-scopes/", forall a. ToByteString a => a -> ByteString
Data.toBS Text
id]

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

-- | /See:/ 'newGetClassificationScopeResponse' smart constructor.
data GetClassificationScopeResponse = GetClassificationScopeResponse'
  { -- | The unique identifier for the classification scope.
    GetClassificationScopeResponse -> Maybe Text
id :: Prelude.Maybe Prelude.Text,
    -- | The name of the classification scope.
    GetClassificationScopeResponse -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The S3 buckets that are excluded from automated sensitive data
    -- discovery.
    GetClassificationScopeResponse -> Maybe S3ClassificationScope
s3 :: Prelude.Maybe S3ClassificationScope,
    -- | The response's http status code.
    GetClassificationScopeResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (GetClassificationScopeResponse
-> GetClassificationScopeResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetClassificationScopeResponse
-> GetClassificationScopeResponse -> Bool
$c/= :: GetClassificationScopeResponse
-> GetClassificationScopeResponse -> Bool
== :: GetClassificationScopeResponse
-> GetClassificationScopeResponse -> Bool
$c== :: GetClassificationScopeResponse
-> GetClassificationScopeResponse -> Bool
Prelude.Eq, ReadPrec [GetClassificationScopeResponse]
ReadPrec GetClassificationScopeResponse
Int -> ReadS GetClassificationScopeResponse
ReadS [GetClassificationScopeResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetClassificationScopeResponse]
$creadListPrec :: ReadPrec [GetClassificationScopeResponse]
readPrec :: ReadPrec GetClassificationScopeResponse
$creadPrec :: ReadPrec GetClassificationScopeResponse
readList :: ReadS [GetClassificationScopeResponse]
$creadList :: ReadS [GetClassificationScopeResponse]
readsPrec :: Int -> ReadS GetClassificationScopeResponse
$creadsPrec :: Int -> ReadS GetClassificationScopeResponse
Prelude.Read, Int -> GetClassificationScopeResponse -> ShowS
[GetClassificationScopeResponse] -> ShowS
GetClassificationScopeResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetClassificationScopeResponse] -> ShowS
$cshowList :: [GetClassificationScopeResponse] -> ShowS
show :: GetClassificationScopeResponse -> String
$cshow :: GetClassificationScopeResponse -> String
showsPrec :: Int -> GetClassificationScopeResponse -> ShowS
$cshowsPrec :: Int -> GetClassificationScopeResponse -> ShowS
Prelude.Show, forall x.
Rep GetClassificationScopeResponse x
-> GetClassificationScopeResponse
forall x.
GetClassificationScopeResponse
-> Rep GetClassificationScopeResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetClassificationScopeResponse x
-> GetClassificationScopeResponse
$cfrom :: forall x.
GetClassificationScopeResponse
-> Rep GetClassificationScopeResponse x
Prelude.Generic)

-- |
-- Create a value of 'GetClassificationScopeResponse' 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:
--
-- 'id', 'getClassificationScopeResponse_id' - The unique identifier for the classification scope.
--
-- 'name', 'getClassificationScopeResponse_name' - The name of the classification scope.
--
-- 's3', 'getClassificationScopeResponse_s3' - The S3 buckets that are excluded from automated sensitive data
-- discovery.
--
-- 'httpStatus', 'getClassificationScopeResponse_httpStatus' - The response's http status code.
newGetClassificationScopeResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetClassificationScopeResponse
newGetClassificationScopeResponse :: Int -> GetClassificationScopeResponse
newGetClassificationScopeResponse Int
pHttpStatus_ =
  GetClassificationScopeResponse'
    { $sel:id:GetClassificationScopeResponse' :: Maybe Text
id =
        forall a. Maybe a
Prelude.Nothing,
      $sel:name:GetClassificationScopeResponse' :: Maybe Text
name = forall a. Maybe a
Prelude.Nothing,
      $sel:s3:GetClassificationScopeResponse' :: Maybe S3ClassificationScope
s3 = forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:GetClassificationScopeResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The unique identifier for the classification scope.
getClassificationScopeResponse_id :: Lens.Lens' GetClassificationScopeResponse (Prelude.Maybe Prelude.Text)
getClassificationScopeResponse_id :: Lens' GetClassificationScopeResponse (Maybe Text)
getClassificationScopeResponse_id = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetClassificationScopeResponse' {Maybe Text
id :: Maybe Text
$sel:id:GetClassificationScopeResponse' :: GetClassificationScopeResponse -> Maybe Text
id} -> Maybe Text
id) (\s :: GetClassificationScopeResponse
s@GetClassificationScopeResponse' {} Maybe Text
a -> GetClassificationScopeResponse
s {$sel:id:GetClassificationScopeResponse' :: Maybe Text
id = Maybe Text
a} :: GetClassificationScopeResponse)

-- | The name of the classification scope.
getClassificationScopeResponse_name :: Lens.Lens' GetClassificationScopeResponse (Prelude.Maybe Prelude.Text)
getClassificationScopeResponse_name :: Lens' GetClassificationScopeResponse (Maybe Text)
getClassificationScopeResponse_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetClassificationScopeResponse' {Maybe Text
name :: Maybe Text
$sel:name:GetClassificationScopeResponse' :: GetClassificationScopeResponse -> Maybe Text
name} -> Maybe Text
name) (\s :: GetClassificationScopeResponse
s@GetClassificationScopeResponse' {} Maybe Text
a -> GetClassificationScopeResponse
s {$sel:name:GetClassificationScopeResponse' :: Maybe Text
name = Maybe Text
a} :: GetClassificationScopeResponse)

-- | The S3 buckets that are excluded from automated sensitive data
-- discovery.
getClassificationScopeResponse_s3 :: Lens.Lens' GetClassificationScopeResponse (Prelude.Maybe S3ClassificationScope)
getClassificationScopeResponse_s3 :: Lens' GetClassificationScopeResponse (Maybe S3ClassificationScope)
getClassificationScopeResponse_s3 = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetClassificationScopeResponse' {Maybe S3ClassificationScope
s3 :: Maybe S3ClassificationScope
$sel:s3:GetClassificationScopeResponse' :: GetClassificationScopeResponse -> Maybe S3ClassificationScope
s3} -> Maybe S3ClassificationScope
s3) (\s :: GetClassificationScopeResponse
s@GetClassificationScopeResponse' {} Maybe S3ClassificationScope
a -> GetClassificationScopeResponse
s {$sel:s3:GetClassificationScopeResponse' :: Maybe S3ClassificationScope
s3 = Maybe S3ClassificationScope
a} :: GetClassificationScopeResponse)

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

instance
  Prelude.NFData
    GetClassificationScopeResponse
  where
  rnf :: GetClassificationScopeResponse -> ()
rnf GetClassificationScopeResponse' {Int
Maybe Text
Maybe S3ClassificationScope
httpStatus :: Int
s3 :: Maybe S3ClassificationScope
name :: Maybe Text
id :: Maybe Text
$sel:httpStatus:GetClassificationScopeResponse' :: GetClassificationScopeResponse -> Int
$sel:s3:GetClassificationScopeResponse' :: GetClassificationScopeResponse -> Maybe S3ClassificationScope
$sel:name:GetClassificationScopeResponse' :: GetClassificationScopeResponse -> Maybe Text
$sel:id:GetClassificationScopeResponse' :: GetClassificationScopeResponse -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
id
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
name
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe S3ClassificationScope
s3
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus