{-# 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.MediaStore.StopAccessLogging
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Stops access logging on the specified container. When you stop access
-- logging on a container, MediaStore stops sending access logs to Amazon
-- CloudWatch Logs. These access logs are not saved and are not
-- retrievable.
module Amazonka.MediaStore.StopAccessLogging
  ( -- * Creating a Request
    StopAccessLogging (..),
    newStopAccessLogging,

    -- * Request Lenses
    stopAccessLogging_containerName,

    -- * Destructuring the Response
    StopAccessLoggingResponse (..),
    newStopAccessLoggingResponse,

    -- * Response Lenses
    stopAccessLoggingResponse_httpStatus,
  )
where

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

-- | /See:/ 'newStopAccessLogging' smart constructor.
data StopAccessLogging = StopAccessLogging'
  { -- | The name of the container that you want to stop access logging on.
    StopAccessLogging -> Text
containerName :: Prelude.Text
  }
  deriving (StopAccessLogging -> StopAccessLogging -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StopAccessLogging -> StopAccessLogging -> Bool
$c/= :: StopAccessLogging -> StopAccessLogging -> Bool
== :: StopAccessLogging -> StopAccessLogging -> Bool
$c== :: StopAccessLogging -> StopAccessLogging -> Bool
Prelude.Eq, ReadPrec [StopAccessLogging]
ReadPrec StopAccessLogging
Int -> ReadS StopAccessLogging
ReadS [StopAccessLogging]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StopAccessLogging]
$creadListPrec :: ReadPrec [StopAccessLogging]
readPrec :: ReadPrec StopAccessLogging
$creadPrec :: ReadPrec StopAccessLogging
readList :: ReadS [StopAccessLogging]
$creadList :: ReadS [StopAccessLogging]
readsPrec :: Int -> ReadS StopAccessLogging
$creadsPrec :: Int -> ReadS StopAccessLogging
Prelude.Read, Int -> StopAccessLogging -> ShowS
[StopAccessLogging] -> ShowS
StopAccessLogging -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StopAccessLogging] -> ShowS
$cshowList :: [StopAccessLogging] -> ShowS
show :: StopAccessLogging -> String
$cshow :: StopAccessLogging -> String
showsPrec :: Int -> StopAccessLogging -> ShowS
$cshowsPrec :: Int -> StopAccessLogging -> ShowS
Prelude.Show, forall x. Rep StopAccessLogging x -> StopAccessLogging
forall x. StopAccessLogging -> Rep StopAccessLogging x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StopAccessLogging x -> StopAccessLogging
$cfrom :: forall x. StopAccessLogging -> Rep StopAccessLogging x
Prelude.Generic)

-- |
-- Create a value of 'StopAccessLogging' 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:
--
-- 'containerName', 'stopAccessLogging_containerName' - The name of the container that you want to stop access logging on.
newStopAccessLogging ::
  -- | 'containerName'
  Prelude.Text ->
  StopAccessLogging
newStopAccessLogging :: Text -> StopAccessLogging
newStopAccessLogging Text
pContainerName_ =
  StopAccessLogging' {$sel:containerName:StopAccessLogging' :: Text
containerName = Text
pContainerName_}

-- | The name of the container that you want to stop access logging on.
stopAccessLogging_containerName :: Lens.Lens' StopAccessLogging Prelude.Text
stopAccessLogging_containerName :: Lens' StopAccessLogging Text
stopAccessLogging_containerName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StopAccessLogging' {Text
containerName :: Text
$sel:containerName:StopAccessLogging' :: StopAccessLogging -> Text
containerName} -> Text
containerName) (\s :: StopAccessLogging
s@StopAccessLogging' {} Text
a -> StopAccessLogging
s {$sel:containerName:StopAccessLogging' :: Text
containerName = Text
a} :: StopAccessLogging)

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

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

instance Data.ToHeaders StopAccessLogging where
  toHeaders :: StopAccessLogging -> 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
"MediaStore_20170901.StopAccessLogging" ::
                          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 StopAccessLogging where
  toJSON :: StopAccessLogging -> Value
toJSON StopAccessLogging' {Text
containerName :: Text
$sel:containerName:StopAccessLogging' :: StopAccessLogging -> Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ forall a. a -> Maybe a
Prelude.Just
              (Key
"ContainerName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
containerName)
          ]
      )

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

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

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

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

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

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