{-# 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.Glue.DeleteColumnStatisticsForTable
-- 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 table statistics of columns.
--
-- The Identity and Access Management (IAM) permission required for this
-- operation is @DeleteTable@.
module Amazonka.Glue.DeleteColumnStatisticsForTable
  ( -- * Creating a Request
    DeleteColumnStatisticsForTable (..),
    newDeleteColumnStatisticsForTable,

    -- * Request Lenses
    deleteColumnStatisticsForTable_catalogId,
    deleteColumnStatisticsForTable_databaseName,
    deleteColumnStatisticsForTable_tableName,
    deleteColumnStatisticsForTable_columnName,

    -- * Destructuring the Response
    DeleteColumnStatisticsForTableResponse (..),
    newDeleteColumnStatisticsForTableResponse,

    -- * Response Lenses
    deleteColumnStatisticsForTableResponse_httpStatus,
  )
where

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

-- | /See:/ 'newDeleteColumnStatisticsForTable' smart constructor.
data DeleteColumnStatisticsForTable = DeleteColumnStatisticsForTable'
  { -- | The ID of the Data Catalog where the partitions in question reside. If
    -- none is supplied, the Amazon Web Services account ID is used by default.
    DeleteColumnStatisticsForTable -> Maybe Text
catalogId :: Prelude.Maybe Prelude.Text,
    -- | The name of the catalog database where the partitions reside.
    DeleteColumnStatisticsForTable -> Text
databaseName :: Prelude.Text,
    -- | The name of the partitions\' table.
    DeleteColumnStatisticsForTable -> Text
tableName :: Prelude.Text,
    -- | The name of the column.
    DeleteColumnStatisticsForTable -> Text
columnName :: Prelude.Text
  }
  deriving (DeleteColumnStatisticsForTable
-> DeleteColumnStatisticsForTable -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteColumnStatisticsForTable
-> DeleteColumnStatisticsForTable -> Bool
$c/= :: DeleteColumnStatisticsForTable
-> DeleteColumnStatisticsForTable -> Bool
== :: DeleteColumnStatisticsForTable
-> DeleteColumnStatisticsForTable -> Bool
$c== :: DeleteColumnStatisticsForTable
-> DeleteColumnStatisticsForTable -> Bool
Prelude.Eq, ReadPrec [DeleteColumnStatisticsForTable]
ReadPrec DeleteColumnStatisticsForTable
Int -> ReadS DeleteColumnStatisticsForTable
ReadS [DeleteColumnStatisticsForTable]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteColumnStatisticsForTable]
$creadListPrec :: ReadPrec [DeleteColumnStatisticsForTable]
readPrec :: ReadPrec DeleteColumnStatisticsForTable
$creadPrec :: ReadPrec DeleteColumnStatisticsForTable
readList :: ReadS [DeleteColumnStatisticsForTable]
$creadList :: ReadS [DeleteColumnStatisticsForTable]
readsPrec :: Int -> ReadS DeleteColumnStatisticsForTable
$creadsPrec :: Int -> ReadS DeleteColumnStatisticsForTable
Prelude.Read, Int -> DeleteColumnStatisticsForTable -> ShowS
[DeleteColumnStatisticsForTable] -> ShowS
DeleteColumnStatisticsForTable -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteColumnStatisticsForTable] -> ShowS
$cshowList :: [DeleteColumnStatisticsForTable] -> ShowS
show :: DeleteColumnStatisticsForTable -> String
$cshow :: DeleteColumnStatisticsForTable -> String
showsPrec :: Int -> DeleteColumnStatisticsForTable -> ShowS
$cshowsPrec :: Int -> DeleteColumnStatisticsForTable -> ShowS
Prelude.Show, forall x.
Rep DeleteColumnStatisticsForTable x
-> DeleteColumnStatisticsForTable
forall x.
DeleteColumnStatisticsForTable
-> Rep DeleteColumnStatisticsForTable x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DeleteColumnStatisticsForTable x
-> DeleteColumnStatisticsForTable
$cfrom :: forall x.
DeleteColumnStatisticsForTable
-> Rep DeleteColumnStatisticsForTable x
Prelude.Generic)

-- |
-- Create a value of 'DeleteColumnStatisticsForTable' 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:
--
-- 'catalogId', 'deleteColumnStatisticsForTable_catalogId' - The ID of the Data Catalog where the partitions in question reside. If
-- none is supplied, the Amazon Web Services account ID is used by default.
--
-- 'databaseName', 'deleteColumnStatisticsForTable_databaseName' - The name of the catalog database where the partitions reside.
--
-- 'tableName', 'deleteColumnStatisticsForTable_tableName' - The name of the partitions\' table.
--
-- 'columnName', 'deleteColumnStatisticsForTable_columnName' - The name of the column.
newDeleteColumnStatisticsForTable ::
  -- | 'databaseName'
  Prelude.Text ->
  -- | 'tableName'
  Prelude.Text ->
  -- | 'columnName'
  Prelude.Text ->
  DeleteColumnStatisticsForTable
newDeleteColumnStatisticsForTable :: Text -> Text -> Text -> DeleteColumnStatisticsForTable
newDeleteColumnStatisticsForTable
  Text
pDatabaseName_
  Text
pTableName_
  Text
pColumnName_ =
    DeleteColumnStatisticsForTable'
      { $sel:catalogId:DeleteColumnStatisticsForTable' :: Maybe Text
catalogId =
          forall a. Maybe a
Prelude.Nothing,
        $sel:databaseName:DeleteColumnStatisticsForTable' :: Text
databaseName = Text
pDatabaseName_,
        $sel:tableName:DeleteColumnStatisticsForTable' :: Text
tableName = Text
pTableName_,
        $sel:columnName:DeleteColumnStatisticsForTable' :: Text
columnName = Text
pColumnName_
      }

-- | The ID of the Data Catalog where the partitions in question reside. If
-- none is supplied, the Amazon Web Services account ID is used by default.
deleteColumnStatisticsForTable_catalogId :: Lens.Lens' DeleteColumnStatisticsForTable (Prelude.Maybe Prelude.Text)
deleteColumnStatisticsForTable_catalogId :: Lens' DeleteColumnStatisticsForTable (Maybe Text)
deleteColumnStatisticsForTable_catalogId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteColumnStatisticsForTable' {Maybe Text
catalogId :: Maybe Text
$sel:catalogId:DeleteColumnStatisticsForTable' :: DeleteColumnStatisticsForTable -> Maybe Text
catalogId} -> Maybe Text
catalogId) (\s :: DeleteColumnStatisticsForTable
s@DeleteColumnStatisticsForTable' {} Maybe Text
a -> DeleteColumnStatisticsForTable
s {$sel:catalogId:DeleteColumnStatisticsForTable' :: Maybe Text
catalogId = Maybe Text
a} :: DeleteColumnStatisticsForTable)

-- | The name of the catalog database where the partitions reside.
deleteColumnStatisticsForTable_databaseName :: Lens.Lens' DeleteColumnStatisticsForTable Prelude.Text
deleteColumnStatisticsForTable_databaseName :: Lens' DeleteColumnStatisticsForTable Text
deleteColumnStatisticsForTable_databaseName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteColumnStatisticsForTable' {Text
databaseName :: Text
$sel:databaseName:DeleteColumnStatisticsForTable' :: DeleteColumnStatisticsForTable -> Text
databaseName} -> Text
databaseName) (\s :: DeleteColumnStatisticsForTable
s@DeleteColumnStatisticsForTable' {} Text
a -> DeleteColumnStatisticsForTable
s {$sel:databaseName:DeleteColumnStatisticsForTable' :: Text
databaseName = Text
a} :: DeleteColumnStatisticsForTable)

-- | The name of the partitions\' table.
deleteColumnStatisticsForTable_tableName :: Lens.Lens' DeleteColumnStatisticsForTable Prelude.Text
deleteColumnStatisticsForTable_tableName :: Lens' DeleteColumnStatisticsForTable Text
deleteColumnStatisticsForTable_tableName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteColumnStatisticsForTable' {Text
tableName :: Text
$sel:tableName:DeleteColumnStatisticsForTable' :: DeleteColumnStatisticsForTable -> Text
tableName} -> Text
tableName) (\s :: DeleteColumnStatisticsForTable
s@DeleteColumnStatisticsForTable' {} Text
a -> DeleteColumnStatisticsForTable
s {$sel:tableName:DeleteColumnStatisticsForTable' :: Text
tableName = Text
a} :: DeleteColumnStatisticsForTable)

-- | The name of the column.
deleteColumnStatisticsForTable_columnName :: Lens.Lens' DeleteColumnStatisticsForTable Prelude.Text
deleteColumnStatisticsForTable_columnName :: Lens' DeleteColumnStatisticsForTable Text
deleteColumnStatisticsForTable_columnName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteColumnStatisticsForTable' {Text
columnName :: Text
$sel:columnName:DeleteColumnStatisticsForTable' :: DeleteColumnStatisticsForTable -> Text
columnName} -> Text
columnName) (\s :: DeleteColumnStatisticsForTable
s@DeleteColumnStatisticsForTable' {} Text
a -> DeleteColumnStatisticsForTable
s {$sel:columnName:DeleteColumnStatisticsForTable' :: Text
columnName = Text
a} :: DeleteColumnStatisticsForTable)

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

instance
  Prelude.NFData
    DeleteColumnStatisticsForTable
  where
  rnf :: DeleteColumnStatisticsForTable -> ()
rnf DeleteColumnStatisticsForTable' {Maybe Text
Text
columnName :: Text
tableName :: Text
databaseName :: Text
catalogId :: Maybe Text
$sel:columnName:DeleteColumnStatisticsForTable' :: DeleteColumnStatisticsForTable -> Text
$sel:tableName:DeleteColumnStatisticsForTable' :: DeleteColumnStatisticsForTable -> Text
$sel:databaseName:DeleteColumnStatisticsForTable' :: DeleteColumnStatisticsForTable -> Text
$sel:catalogId:DeleteColumnStatisticsForTable' :: DeleteColumnStatisticsForTable -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
catalogId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
databaseName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
tableName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
columnName

instance
  Data.ToHeaders
    DeleteColumnStatisticsForTable
  where
  toHeaders :: DeleteColumnStatisticsForTable -> ResponseHeaders
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 -> ResponseHeaders
Data.=# ( ByteString
"AWSGlue.DeleteColumnStatisticsForTable" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Data.ToJSON DeleteColumnStatisticsForTable where
  toJSON :: DeleteColumnStatisticsForTable -> Value
toJSON DeleteColumnStatisticsForTable' {Maybe Text
Text
columnName :: Text
tableName :: Text
databaseName :: Text
catalogId :: Maybe Text
$sel:columnName:DeleteColumnStatisticsForTable' :: DeleteColumnStatisticsForTable -> Text
$sel:tableName:DeleteColumnStatisticsForTable' :: DeleteColumnStatisticsForTable -> Text
$sel:databaseName:DeleteColumnStatisticsForTable' :: DeleteColumnStatisticsForTable -> Text
$sel:catalogId:DeleteColumnStatisticsForTable' :: DeleteColumnStatisticsForTable -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"CatalogId" 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
catalogId,
            forall a. a -> Maybe a
Prelude.Just (Key
"DatabaseName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
databaseName),
            forall a. a -> Maybe a
Prelude.Just (Key
"TableName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
tableName),
            forall a. a -> Maybe a
Prelude.Just (Key
"ColumnName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
columnName)
          ]
      )

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

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

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

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

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

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