{-# 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.DeleteContainerPolicy
-- 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)
--
-- Deletes the access policy that is associated with the specified
-- container.
module Amazonka.MediaStore.DeleteContainerPolicy
  ( -- * Creating a Request
    DeleteContainerPolicy (..),
    newDeleteContainerPolicy,

    -- * Request Lenses
    deleteContainerPolicy_containerName,

    -- * Destructuring the Response
    DeleteContainerPolicyResponse (..),
    newDeleteContainerPolicyResponse,

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

-- |
-- Create a value of 'DeleteContainerPolicy' 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', 'deleteContainerPolicy_containerName' - The name of the container that holds the policy.
newDeleteContainerPolicy ::
  -- | 'containerName'
  Prelude.Text ->
  DeleteContainerPolicy
newDeleteContainerPolicy :: Text -> DeleteContainerPolicy
newDeleteContainerPolicy Text
pContainerName_ =
  DeleteContainerPolicy' :: Text -> DeleteContainerPolicy
DeleteContainerPolicy'
    { $sel:containerName:DeleteContainerPolicy' :: Text
containerName =
        Text
pContainerName_
    }

-- | The name of the container that holds the policy.
deleteContainerPolicy_containerName :: Lens.Lens' DeleteContainerPolicy Prelude.Text
deleteContainerPolicy_containerName :: (Text -> f Text)
-> DeleteContainerPolicy -> f DeleteContainerPolicy
deleteContainerPolicy_containerName = (DeleteContainerPolicy -> Text)
-> (DeleteContainerPolicy -> Text -> DeleteContainerPolicy)
-> Lens DeleteContainerPolicy DeleteContainerPolicy Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteContainerPolicy' {Text
containerName :: Text
$sel:containerName:DeleteContainerPolicy' :: DeleteContainerPolicy -> Text
containerName} -> Text
containerName) (\s :: DeleteContainerPolicy
s@DeleteContainerPolicy' {} Text
a -> DeleteContainerPolicy
s {$sel:containerName:DeleteContainerPolicy' :: Text
containerName = Text
a} :: DeleteContainerPolicy)

instance Core.AWSRequest DeleteContainerPolicy where
  type
    AWSResponse DeleteContainerPolicy =
      DeleteContainerPolicyResponse
  request :: DeleteContainerPolicy -> Request DeleteContainerPolicy
request = Service -> DeleteContainerPolicy -> Request DeleteContainerPolicy
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy DeleteContainerPolicy
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteContainerPolicy)))
response =
    (Int
 -> ResponseHeaders
 -> ()
 -> Either String (AWSResponse DeleteContainerPolicy))
-> Logger
-> Service
-> Proxy DeleteContainerPolicy
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteContainerPolicy)))
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 -> DeleteContainerPolicyResponse
DeleteContainerPolicyResponse'
            (Int -> DeleteContainerPolicyResponse)
-> Either String Int -> Either String DeleteContainerPolicyResponse
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 DeleteContainerPolicy

instance Prelude.NFData DeleteContainerPolicy

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

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

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

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

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

instance Prelude.NFData DeleteContainerPolicyResponse