{-# 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.Schemas.DeleteResourcePolicy
-- 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)
--
-- Delete the resource-based policy attached to the specified registry.
module Amazonka.Schemas.DeleteResourcePolicy
  ( -- * Creating a Request
    DeleteResourcePolicy (..),
    newDeleteResourcePolicy,

    -- * Request Lenses
    deleteResourcePolicy_registryName,

    -- * Destructuring the Response
    DeleteResourcePolicyResponse (..),
    newDeleteResourcePolicyResponse,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
import Amazonka.Schemas.Types

-- | /See:/ 'newDeleteResourcePolicy' smart constructor.
data DeleteResourcePolicy = DeleteResourcePolicy'
  { -- | The name of the registry.
    DeleteResourcePolicy -> Maybe Text
registryName :: Prelude.Maybe Prelude.Text
  }
  deriving (DeleteResourcePolicy -> DeleteResourcePolicy -> Bool
(DeleteResourcePolicy -> DeleteResourcePolicy -> Bool)
-> (DeleteResourcePolicy -> DeleteResourcePolicy -> Bool)
-> Eq DeleteResourcePolicy
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteResourcePolicy -> DeleteResourcePolicy -> Bool
$c/= :: DeleteResourcePolicy -> DeleteResourcePolicy -> Bool
== :: DeleteResourcePolicy -> DeleteResourcePolicy -> Bool
$c== :: DeleteResourcePolicy -> DeleteResourcePolicy -> Bool
Prelude.Eq, ReadPrec [DeleteResourcePolicy]
ReadPrec DeleteResourcePolicy
Int -> ReadS DeleteResourcePolicy
ReadS [DeleteResourcePolicy]
(Int -> ReadS DeleteResourcePolicy)
-> ReadS [DeleteResourcePolicy]
-> ReadPrec DeleteResourcePolicy
-> ReadPrec [DeleteResourcePolicy]
-> Read DeleteResourcePolicy
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteResourcePolicy]
$creadListPrec :: ReadPrec [DeleteResourcePolicy]
readPrec :: ReadPrec DeleteResourcePolicy
$creadPrec :: ReadPrec DeleteResourcePolicy
readList :: ReadS [DeleteResourcePolicy]
$creadList :: ReadS [DeleteResourcePolicy]
readsPrec :: Int -> ReadS DeleteResourcePolicy
$creadsPrec :: Int -> ReadS DeleteResourcePolicy
Prelude.Read, Int -> DeleteResourcePolicy -> ShowS
[DeleteResourcePolicy] -> ShowS
DeleteResourcePolicy -> String
(Int -> DeleteResourcePolicy -> ShowS)
-> (DeleteResourcePolicy -> String)
-> ([DeleteResourcePolicy] -> ShowS)
-> Show DeleteResourcePolicy
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteResourcePolicy] -> ShowS
$cshowList :: [DeleteResourcePolicy] -> ShowS
show :: DeleteResourcePolicy -> String
$cshow :: DeleteResourcePolicy -> String
showsPrec :: Int -> DeleteResourcePolicy -> ShowS
$cshowsPrec :: Int -> DeleteResourcePolicy -> ShowS
Prelude.Show, (forall x. DeleteResourcePolicy -> Rep DeleteResourcePolicy x)
-> (forall x. Rep DeleteResourcePolicy x -> DeleteResourcePolicy)
-> Generic DeleteResourcePolicy
forall x. Rep DeleteResourcePolicy x -> DeleteResourcePolicy
forall x. DeleteResourcePolicy -> Rep DeleteResourcePolicy x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteResourcePolicy x -> DeleteResourcePolicy
$cfrom :: forall x. DeleteResourcePolicy -> Rep DeleteResourcePolicy x
Prelude.Generic)

-- |
-- Create a value of 'DeleteResourcePolicy' 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:
--
-- 'registryName', 'deleteResourcePolicy_registryName' - The name of the registry.
newDeleteResourcePolicy ::
  DeleteResourcePolicy
newDeleteResourcePolicy :: DeleteResourcePolicy
newDeleteResourcePolicy =
  DeleteResourcePolicy' :: Maybe Text -> DeleteResourcePolicy
DeleteResourcePolicy'
    { $sel:registryName:DeleteResourcePolicy' :: Maybe Text
registryName =
        Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The name of the registry.
deleteResourcePolicy_registryName :: Lens.Lens' DeleteResourcePolicy (Prelude.Maybe Prelude.Text)
deleteResourcePolicy_registryName :: (Maybe Text -> f (Maybe Text))
-> DeleteResourcePolicy -> f DeleteResourcePolicy
deleteResourcePolicy_registryName = (DeleteResourcePolicy -> Maybe Text)
-> (DeleteResourcePolicy -> Maybe Text -> DeleteResourcePolicy)
-> Lens
     DeleteResourcePolicy DeleteResourcePolicy (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteResourcePolicy' {Maybe Text
registryName :: Maybe Text
$sel:registryName:DeleteResourcePolicy' :: DeleteResourcePolicy -> Maybe Text
registryName} -> Maybe Text
registryName) (\s :: DeleteResourcePolicy
s@DeleteResourcePolicy' {} Maybe Text
a -> DeleteResourcePolicy
s {$sel:registryName:DeleteResourcePolicy' :: Maybe Text
registryName = Maybe Text
a} :: DeleteResourcePolicy)

instance Core.AWSRequest DeleteResourcePolicy where
  type
    AWSResponse DeleteResourcePolicy =
      DeleteResourcePolicyResponse
  request :: DeleteResourcePolicy -> Request DeleteResourcePolicy
request = Service -> DeleteResourcePolicy -> Request DeleteResourcePolicy
forall a. ToRequest a => Service -> a -> Request a
Request.delete Service
defaultService
  response :: Logger
-> Service
-> Proxy DeleteResourcePolicy
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteResourcePolicy)))
response =
    AWSResponse DeleteResourcePolicy
-> Logger
-> Service
-> Proxy DeleteResourcePolicy
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteResourcePolicy)))
forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull AWSResponse DeleteResourcePolicy
DeleteResourcePolicyResponse
DeleteResourcePolicyResponse'

instance Prelude.Hashable DeleteResourcePolicy

instance Prelude.NFData DeleteResourcePolicy

instance Core.ToHeaders DeleteResourcePolicy where
  toHeaders :: DeleteResourcePolicy -> [Header]
toHeaders =
    [Header] -> DeleteResourcePolicy -> [Header]
forall a b. a -> b -> a
Prelude.const
      ( [[Header]] -> [Header]
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"Content-Type"
              HeaderName -> ByteString -> [Header]
forall a. ToHeader a => HeaderName -> a -> [Header]
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

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

instance Core.ToQuery DeleteResourcePolicy where
  toQuery :: DeleteResourcePolicy -> QueryString
toQuery DeleteResourcePolicy' {Maybe Text
registryName :: Maybe Text
$sel:registryName:DeleteResourcePolicy' :: DeleteResourcePolicy -> Maybe Text
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ByteString
"registryName" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
registryName]

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

-- |
-- Create a value of 'DeleteResourcePolicyResponse' 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.
newDeleteResourcePolicyResponse ::
  DeleteResourcePolicyResponse
newDeleteResourcePolicyResponse :: DeleteResourcePolicyResponse
newDeleteResourcePolicyResponse =
  DeleteResourcePolicyResponse
DeleteResourcePolicyResponse'

instance Prelude.NFData DeleteResourcePolicyResponse