{-# 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-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)
--
-- 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.Lens as Lens
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
(StopAccessLogging -> StopAccessLogging -> Bool)
-> (StopAccessLogging -> StopAccessLogging -> Bool)
-> Eq StopAccessLogging
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]
(Int -> ReadS StopAccessLogging)
-> ReadS [StopAccessLogging]
-> ReadPrec StopAccessLogging
-> ReadPrec [StopAccessLogging]
-> Read 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
(Int -> StopAccessLogging -> ShowS)
-> (StopAccessLogging -> String)
-> ([StopAccessLogging] -> ShowS)
-> Show StopAccessLogging
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. StopAccessLogging -> Rep StopAccessLogging x)
-> (forall x. Rep StopAccessLogging x -> StopAccessLogging)
-> Generic StopAccessLogging
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' :: Text -> StopAccessLogging
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 :: (Text -> f Text) -> StopAccessLogging -> f StopAccessLogging
stopAccessLogging_containerName = (StopAccessLogging -> Text)
-> (StopAccessLogging -> Text -> StopAccessLogging)
-> Lens StopAccessLogging StopAccessLogging Text Text
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 :: StopAccessLogging -> Request StopAccessLogging
request = Service -> StopAccessLogging -> Request StopAccessLogging
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy StopAccessLogging
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse StopAccessLogging)))
response =
    (Int
 -> ResponseHeaders
 -> ()
 -> Either String (AWSResponse StopAccessLogging))
-> Logger
-> Service
-> Proxy StopAccessLogging
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse StopAccessLogging)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
      ( \Int
s ResponseHeaders
h ()
x ->
          Int -> StopAccessLoggingResponse
StopAccessLoggingResponse'
            (Int -> StopAccessLoggingResponse)
-> Either String Int -> Either String StopAccessLoggingResponse
forall (f :: * -> *) a b. Functor 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 StopAccessLogging

instance Prelude.NFData StopAccessLogging

instance Core.ToHeaders StopAccessLogging where
  toHeaders :: StopAccessLogging -> ResponseHeaders
toHeaders =
    ResponseHeaders -> StopAccessLogging -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"MediaStore_20170901.StopAccessLogging" ::
                          Prelude.ByteString
                      ),
            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 StopAccessLogging where
  toJSON :: StopAccessLogging -> Value
toJSON StopAccessLogging' {Text
containerName :: Text
$sel:containerName:StopAccessLogging' :: StopAccessLogging -> Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"ContainerName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
containerName)
          ]
      )

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

instance Core.ToQuery StopAccessLogging where
  toQuery :: StopAccessLogging -> QueryString
toQuery = QueryString -> StopAccessLogging -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
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
(StopAccessLoggingResponse -> StopAccessLoggingResponse -> Bool)
-> (StopAccessLoggingResponse -> StopAccessLoggingResponse -> Bool)
-> Eq StopAccessLoggingResponse
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]
(Int -> ReadS StopAccessLoggingResponse)
-> ReadS [StopAccessLoggingResponse]
-> ReadPrec StopAccessLoggingResponse
-> ReadPrec [StopAccessLoggingResponse]
-> Read 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
(Int -> StopAccessLoggingResponse -> ShowS)
-> (StopAccessLoggingResponse -> String)
-> ([StopAccessLoggingResponse] -> ShowS)
-> Show StopAccessLoggingResponse
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.
 StopAccessLoggingResponse -> Rep StopAccessLoggingResponse x)
-> (forall x.
    Rep StopAccessLoggingResponse x -> StopAccessLoggingResponse)
-> Generic StopAccessLoggingResponse
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' :: Int -> StopAccessLoggingResponse
StopAccessLoggingResponse'
    { $sel:httpStatus:StopAccessLoggingResponse' :: Int
httpStatus =
        Int
pHttpStatus_
    }

-- | The response's http status code.
stopAccessLoggingResponse_httpStatus :: Lens.Lens' StopAccessLoggingResponse Prelude.Int
stopAccessLoggingResponse_httpStatus :: (Int -> f Int)
-> StopAccessLoggingResponse -> f StopAccessLoggingResponse
stopAccessLoggingResponse_httpStatus = (StopAccessLoggingResponse -> Int)
-> (StopAccessLoggingResponse -> Int -> StopAccessLoggingResponse)
-> Lens StopAccessLoggingResponse StopAccessLoggingResponse Int Int
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