{-# 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.DeleteMetricPolicy
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Deletes the metric policy that is associated with the specified
-- container. If there is no metric policy associated with the container,
-- MediaStore doesn\'t send metrics to CloudWatch.
module Amazonka.MediaStore.DeleteMetricPolicy
  ( -- * Creating a Request
    DeleteMetricPolicy (..),
    newDeleteMetricPolicy,

    -- * Request Lenses
    deleteMetricPolicy_containerName,

    -- * Destructuring the Response
    DeleteMetricPolicyResponse (..),
    newDeleteMetricPolicyResponse,

    -- * Response Lenses
    deleteMetricPolicyResponse_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:/ 'newDeleteMetricPolicy' smart constructor.
data DeleteMetricPolicy = DeleteMetricPolicy'
  { -- | The name of the container that is associated with the metric policy that
    -- you want to delete.
    DeleteMetricPolicy -> Text
containerName :: Prelude.Text
  }
  deriving (DeleteMetricPolicy -> DeleteMetricPolicy -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteMetricPolicy -> DeleteMetricPolicy -> Bool
$c/= :: DeleteMetricPolicy -> DeleteMetricPolicy -> Bool
== :: DeleteMetricPolicy -> DeleteMetricPolicy -> Bool
$c== :: DeleteMetricPolicy -> DeleteMetricPolicy -> Bool
Prelude.Eq, ReadPrec [DeleteMetricPolicy]
ReadPrec DeleteMetricPolicy
Int -> ReadS DeleteMetricPolicy
ReadS [DeleteMetricPolicy]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteMetricPolicy]
$creadListPrec :: ReadPrec [DeleteMetricPolicy]
readPrec :: ReadPrec DeleteMetricPolicy
$creadPrec :: ReadPrec DeleteMetricPolicy
readList :: ReadS [DeleteMetricPolicy]
$creadList :: ReadS [DeleteMetricPolicy]
readsPrec :: Int -> ReadS DeleteMetricPolicy
$creadsPrec :: Int -> ReadS DeleteMetricPolicy
Prelude.Read, Int -> DeleteMetricPolicy -> ShowS
[DeleteMetricPolicy] -> ShowS
DeleteMetricPolicy -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteMetricPolicy] -> ShowS
$cshowList :: [DeleteMetricPolicy] -> ShowS
show :: DeleteMetricPolicy -> String
$cshow :: DeleteMetricPolicy -> String
showsPrec :: Int -> DeleteMetricPolicy -> ShowS
$cshowsPrec :: Int -> DeleteMetricPolicy -> ShowS
Prelude.Show, forall x. Rep DeleteMetricPolicy x -> DeleteMetricPolicy
forall x. DeleteMetricPolicy -> Rep DeleteMetricPolicy x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteMetricPolicy x -> DeleteMetricPolicy
$cfrom :: forall x. DeleteMetricPolicy -> Rep DeleteMetricPolicy x
Prelude.Generic)

-- |
-- Create a value of 'DeleteMetricPolicy' 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', 'deleteMetricPolicy_containerName' - The name of the container that is associated with the metric policy that
-- you want to delete.
newDeleteMetricPolicy ::
  -- | 'containerName'
  Prelude.Text ->
  DeleteMetricPolicy
newDeleteMetricPolicy :: Text -> DeleteMetricPolicy
newDeleteMetricPolicy Text
pContainerName_ =
  DeleteMetricPolicy'
    { $sel:containerName:DeleteMetricPolicy' :: Text
containerName =
        Text
pContainerName_
    }

-- | The name of the container that is associated with the metric policy that
-- you want to delete.
deleteMetricPolicy_containerName :: Lens.Lens' DeleteMetricPolicy Prelude.Text
deleteMetricPolicy_containerName :: Lens' DeleteMetricPolicy Text
deleteMetricPolicy_containerName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteMetricPolicy' {Text
containerName :: Text
$sel:containerName:DeleteMetricPolicy' :: DeleteMetricPolicy -> Text
containerName} -> Text
containerName) (\s :: DeleteMetricPolicy
s@DeleteMetricPolicy' {} Text
a -> DeleteMetricPolicy
s {$sel:containerName:DeleteMetricPolicy' :: Text
containerName = Text
a} :: DeleteMetricPolicy)

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

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

instance Data.ToHeaders DeleteMetricPolicy where
  toHeaders :: DeleteMetricPolicy -> 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.DeleteMetricPolicy" ::
                          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 DeleteMetricPolicy where
  toJSON :: DeleteMetricPolicy -> Value
toJSON DeleteMetricPolicy' {Text
containerName :: Text
$sel:containerName:DeleteMetricPolicy' :: DeleteMetricPolicy -> 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 DeleteMetricPolicy where
  toPath :: DeleteMetricPolicy -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"

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

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

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

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

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