{-# 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.RAM.DeleteResourceShare
-- 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 specified resource share.
module Amazonka.RAM.DeleteResourceShare
  ( -- * Creating a Request
    DeleteResourceShare (..),
    newDeleteResourceShare,

    -- * Request Lenses
    deleteResourceShare_clientToken,
    deleteResourceShare_resourceShareArn,

    -- * Destructuring the Response
    DeleteResourceShareResponse (..),
    newDeleteResourceShareResponse,

    -- * Response Lenses
    deleteResourceShareResponse_clientToken,
    deleteResourceShareResponse_returnValue,
    deleteResourceShareResponse_httpStatus,
  )
where

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

-- | /See:/ 'newDeleteResourceShare' smart constructor.
data DeleteResourceShare = DeleteResourceShare'
  { -- | A unique, case-sensitive identifier that you provide to ensure the
    -- idempotency of the request.
    DeleteResourceShare -> Maybe Text
clientToken :: Prelude.Maybe Prelude.Text,
    -- | The Amazon Resource Name (ARN) of the resource share.
    DeleteResourceShare -> Text
resourceShareArn :: Prelude.Text
  }
  deriving (DeleteResourceShare -> DeleteResourceShare -> Bool
(DeleteResourceShare -> DeleteResourceShare -> Bool)
-> (DeleteResourceShare -> DeleteResourceShare -> Bool)
-> Eq DeleteResourceShare
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteResourceShare -> DeleteResourceShare -> Bool
$c/= :: DeleteResourceShare -> DeleteResourceShare -> Bool
== :: DeleteResourceShare -> DeleteResourceShare -> Bool
$c== :: DeleteResourceShare -> DeleteResourceShare -> Bool
Prelude.Eq, ReadPrec [DeleteResourceShare]
ReadPrec DeleteResourceShare
Int -> ReadS DeleteResourceShare
ReadS [DeleteResourceShare]
(Int -> ReadS DeleteResourceShare)
-> ReadS [DeleteResourceShare]
-> ReadPrec DeleteResourceShare
-> ReadPrec [DeleteResourceShare]
-> Read DeleteResourceShare
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteResourceShare]
$creadListPrec :: ReadPrec [DeleteResourceShare]
readPrec :: ReadPrec DeleteResourceShare
$creadPrec :: ReadPrec DeleteResourceShare
readList :: ReadS [DeleteResourceShare]
$creadList :: ReadS [DeleteResourceShare]
readsPrec :: Int -> ReadS DeleteResourceShare
$creadsPrec :: Int -> ReadS DeleteResourceShare
Prelude.Read, Int -> DeleteResourceShare -> ShowS
[DeleteResourceShare] -> ShowS
DeleteResourceShare -> String
(Int -> DeleteResourceShare -> ShowS)
-> (DeleteResourceShare -> String)
-> ([DeleteResourceShare] -> ShowS)
-> Show DeleteResourceShare
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteResourceShare] -> ShowS
$cshowList :: [DeleteResourceShare] -> ShowS
show :: DeleteResourceShare -> String
$cshow :: DeleteResourceShare -> String
showsPrec :: Int -> DeleteResourceShare -> ShowS
$cshowsPrec :: Int -> DeleteResourceShare -> ShowS
Prelude.Show, (forall x. DeleteResourceShare -> Rep DeleteResourceShare x)
-> (forall x. Rep DeleteResourceShare x -> DeleteResourceShare)
-> Generic DeleteResourceShare
forall x. Rep DeleteResourceShare x -> DeleteResourceShare
forall x. DeleteResourceShare -> Rep DeleteResourceShare x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteResourceShare x -> DeleteResourceShare
$cfrom :: forall x. DeleteResourceShare -> Rep DeleteResourceShare x
Prelude.Generic)

-- |
-- Create a value of 'DeleteResourceShare' 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:
--
-- 'clientToken', 'deleteResourceShare_clientToken' - A unique, case-sensitive identifier that you provide to ensure the
-- idempotency of the request.
--
-- 'resourceShareArn', 'deleteResourceShare_resourceShareArn' - The Amazon Resource Name (ARN) of the resource share.
newDeleteResourceShare ::
  -- | 'resourceShareArn'
  Prelude.Text ->
  DeleteResourceShare
newDeleteResourceShare :: Text -> DeleteResourceShare
newDeleteResourceShare Text
pResourceShareArn_ =
  DeleteResourceShare' :: Maybe Text -> Text -> DeleteResourceShare
DeleteResourceShare'
    { $sel:clientToken:DeleteResourceShare' :: Maybe Text
clientToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:resourceShareArn:DeleteResourceShare' :: Text
resourceShareArn = Text
pResourceShareArn_
    }

-- | A unique, case-sensitive identifier that you provide to ensure the
-- idempotency of the request.
deleteResourceShare_clientToken :: Lens.Lens' DeleteResourceShare (Prelude.Maybe Prelude.Text)
deleteResourceShare_clientToken :: (Maybe Text -> f (Maybe Text))
-> DeleteResourceShare -> f DeleteResourceShare
deleteResourceShare_clientToken = (DeleteResourceShare -> Maybe Text)
-> (DeleteResourceShare -> Maybe Text -> DeleteResourceShare)
-> Lens
     DeleteResourceShare DeleteResourceShare (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteResourceShare' {Maybe Text
clientToken :: Maybe Text
$sel:clientToken:DeleteResourceShare' :: DeleteResourceShare -> Maybe Text
clientToken} -> Maybe Text
clientToken) (\s :: DeleteResourceShare
s@DeleteResourceShare' {} Maybe Text
a -> DeleteResourceShare
s {$sel:clientToken:DeleteResourceShare' :: Maybe Text
clientToken = Maybe Text
a} :: DeleteResourceShare)

-- | The Amazon Resource Name (ARN) of the resource share.
deleteResourceShare_resourceShareArn :: Lens.Lens' DeleteResourceShare Prelude.Text
deleteResourceShare_resourceShareArn :: (Text -> f Text) -> DeleteResourceShare -> f DeleteResourceShare
deleteResourceShare_resourceShareArn = (DeleteResourceShare -> Text)
-> (DeleteResourceShare -> Text -> DeleteResourceShare)
-> Lens DeleteResourceShare DeleteResourceShare Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteResourceShare' {Text
resourceShareArn :: Text
$sel:resourceShareArn:DeleteResourceShare' :: DeleteResourceShare -> Text
resourceShareArn} -> Text
resourceShareArn) (\s :: DeleteResourceShare
s@DeleteResourceShare' {} Text
a -> DeleteResourceShare
s {$sel:resourceShareArn:DeleteResourceShare' :: Text
resourceShareArn = Text
a} :: DeleteResourceShare)

instance Core.AWSRequest DeleteResourceShare where
  type
    AWSResponse DeleteResourceShare =
      DeleteResourceShareResponse
  request :: DeleteResourceShare -> Request DeleteResourceShare
request = Service -> DeleteResourceShare -> Request DeleteResourceShare
forall a. ToRequest a => Service -> a -> Request a
Request.delete Service
defaultService
  response :: Logger
-> Service
-> Proxy DeleteResourceShare
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteResourceShare)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse DeleteResourceShare))
-> Logger
-> Service
-> Proxy DeleteResourceShare
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteResourceShare)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe Text -> Maybe Bool -> Int -> DeleteResourceShareResponse
DeleteResourceShareResponse'
            (Maybe Text -> Maybe Bool -> Int -> DeleteResourceShareResponse)
-> Either String (Maybe Text)
-> Either String (Maybe Bool -> Int -> DeleteResourceShareResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"clientToken")
            Either String (Maybe Bool -> Int -> DeleteResourceShareResponse)
-> Either String (Maybe Bool)
-> Either String (Int -> DeleteResourceShareResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"returnValue")
            Either String (Int -> DeleteResourceShareResponse)
-> Either String Int -> Either String DeleteResourceShareResponse
forall (f :: * -> *) a b. Applicative f => 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 DeleteResourceShare

instance Prelude.NFData DeleteResourceShare

instance Core.ToHeaders DeleteResourceShare where
  toHeaders :: DeleteResourceShare -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DeleteResourceShare -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ 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.ToPath DeleteResourceShare where
  toPath :: DeleteResourceShare -> ByteString
toPath = ByteString -> DeleteResourceShare -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/deleteresourceshare"

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

-- | /See:/ 'newDeleteResourceShareResponse' smart constructor.
data DeleteResourceShareResponse = DeleteResourceShareResponse'
  { -- | A unique, case-sensitive identifier that you provide to ensure the
    -- idempotency of the request.
    DeleteResourceShareResponse -> Maybe Text
clientToken :: Prelude.Maybe Prelude.Text,
    -- | Indicates whether the request succeeded.
    DeleteResourceShareResponse -> Maybe Bool
returnValue :: Prelude.Maybe Prelude.Bool,
    -- | The response's http status code.
    DeleteResourceShareResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DeleteResourceShareResponse -> DeleteResourceShareResponse -> Bool
(DeleteResourceShareResponse
 -> DeleteResourceShareResponse -> Bool)
-> (DeleteResourceShareResponse
    -> DeleteResourceShareResponse -> Bool)
-> Eq DeleteResourceShareResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteResourceShareResponse -> DeleteResourceShareResponse -> Bool
$c/= :: DeleteResourceShareResponse -> DeleteResourceShareResponse -> Bool
== :: DeleteResourceShareResponse -> DeleteResourceShareResponse -> Bool
$c== :: DeleteResourceShareResponse -> DeleteResourceShareResponse -> Bool
Prelude.Eq, ReadPrec [DeleteResourceShareResponse]
ReadPrec DeleteResourceShareResponse
Int -> ReadS DeleteResourceShareResponse
ReadS [DeleteResourceShareResponse]
(Int -> ReadS DeleteResourceShareResponse)
-> ReadS [DeleteResourceShareResponse]
-> ReadPrec DeleteResourceShareResponse
-> ReadPrec [DeleteResourceShareResponse]
-> Read DeleteResourceShareResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteResourceShareResponse]
$creadListPrec :: ReadPrec [DeleteResourceShareResponse]
readPrec :: ReadPrec DeleteResourceShareResponse
$creadPrec :: ReadPrec DeleteResourceShareResponse
readList :: ReadS [DeleteResourceShareResponse]
$creadList :: ReadS [DeleteResourceShareResponse]
readsPrec :: Int -> ReadS DeleteResourceShareResponse
$creadsPrec :: Int -> ReadS DeleteResourceShareResponse
Prelude.Read, Int -> DeleteResourceShareResponse -> ShowS
[DeleteResourceShareResponse] -> ShowS
DeleteResourceShareResponse -> String
(Int -> DeleteResourceShareResponse -> ShowS)
-> (DeleteResourceShareResponse -> String)
-> ([DeleteResourceShareResponse] -> ShowS)
-> Show DeleteResourceShareResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteResourceShareResponse] -> ShowS
$cshowList :: [DeleteResourceShareResponse] -> ShowS
show :: DeleteResourceShareResponse -> String
$cshow :: DeleteResourceShareResponse -> String
showsPrec :: Int -> DeleteResourceShareResponse -> ShowS
$cshowsPrec :: Int -> DeleteResourceShareResponse -> ShowS
Prelude.Show, (forall x.
 DeleteResourceShareResponse -> Rep DeleteResourceShareResponse x)
-> (forall x.
    Rep DeleteResourceShareResponse x -> DeleteResourceShareResponse)
-> Generic DeleteResourceShareResponse
forall x.
Rep DeleteResourceShareResponse x -> DeleteResourceShareResponse
forall x.
DeleteResourceShareResponse -> Rep DeleteResourceShareResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DeleteResourceShareResponse x -> DeleteResourceShareResponse
$cfrom :: forall x.
DeleteResourceShareResponse -> Rep DeleteResourceShareResponse x
Prelude.Generic)

-- |
-- Create a value of 'DeleteResourceShareResponse' 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:
--
-- 'clientToken', 'deleteResourceShareResponse_clientToken' - A unique, case-sensitive identifier that you provide to ensure the
-- idempotency of the request.
--
-- 'returnValue', 'deleteResourceShareResponse_returnValue' - Indicates whether the request succeeded.
--
-- 'httpStatus', 'deleteResourceShareResponse_httpStatus' - The response's http status code.
newDeleteResourceShareResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DeleteResourceShareResponse
newDeleteResourceShareResponse :: Int -> DeleteResourceShareResponse
newDeleteResourceShareResponse Int
pHttpStatus_ =
  DeleteResourceShareResponse' :: Maybe Text -> Maybe Bool -> Int -> DeleteResourceShareResponse
DeleteResourceShareResponse'
    { $sel:clientToken:DeleteResourceShareResponse' :: Maybe Text
clientToken =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:returnValue:DeleteResourceShareResponse' :: Maybe Bool
returnValue = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DeleteResourceShareResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | A unique, case-sensitive identifier that you provide to ensure the
-- idempotency of the request.
deleteResourceShareResponse_clientToken :: Lens.Lens' DeleteResourceShareResponse (Prelude.Maybe Prelude.Text)
deleteResourceShareResponse_clientToken :: (Maybe Text -> f (Maybe Text))
-> DeleteResourceShareResponse -> f DeleteResourceShareResponse
deleteResourceShareResponse_clientToken = (DeleteResourceShareResponse -> Maybe Text)
-> (DeleteResourceShareResponse
    -> Maybe Text -> DeleteResourceShareResponse)
-> Lens
     DeleteResourceShareResponse
     DeleteResourceShareResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteResourceShareResponse' {Maybe Text
clientToken :: Maybe Text
$sel:clientToken:DeleteResourceShareResponse' :: DeleteResourceShareResponse -> Maybe Text
clientToken} -> Maybe Text
clientToken) (\s :: DeleteResourceShareResponse
s@DeleteResourceShareResponse' {} Maybe Text
a -> DeleteResourceShareResponse
s {$sel:clientToken:DeleteResourceShareResponse' :: Maybe Text
clientToken = Maybe Text
a} :: DeleteResourceShareResponse)

-- | Indicates whether the request succeeded.
deleteResourceShareResponse_returnValue :: Lens.Lens' DeleteResourceShareResponse (Prelude.Maybe Prelude.Bool)
deleteResourceShareResponse_returnValue :: (Maybe Bool -> f (Maybe Bool))
-> DeleteResourceShareResponse -> f DeleteResourceShareResponse
deleteResourceShareResponse_returnValue = (DeleteResourceShareResponse -> Maybe Bool)
-> (DeleteResourceShareResponse
    -> Maybe Bool -> DeleteResourceShareResponse)
-> Lens
     DeleteResourceShareResponse
     DeleteResourceShareResponse
     (Maybe Bool)
     (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteResourceShareResponse' {Maybe Bool
returnValue :: Maybe Bool
$sel:returnValue:DeleteResourceShareResponse' :: DeleteResourceShareResponse -> Maybe Bool
returnValue} -> Maybe Bool
returnValue) (\s :: DeleteResourceShareResponse
s@DeleteResourceShareResponse' {} Maybe Bool
a -> DeleteResourceShareResponse
s {$sel:returnValue:DeleteResourceShareResponse' :: Maybe Bool
returnValue = Maybe Bool
a} :: DeleteResourceShareResponse)

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

instance Prelude.NFData DeleteResourceShareResponse