{-# 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.CodeDeploy.DeleteResourcesByExternalId
-- 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 resources linked to an external ID.
module Amazonka.CodeDeploy.DeleteResourcesByExternalId
  ( -- * Creating a Request
    DeleteResourcesByExternalId (..),
    newDeleteResourcesByExternalId,

    -- * Request Lenses
    deleteResourcesByExternalId_externalId,

    -- * Destructuring the Response
    DeleteResourcesByExternalIdResponse (..),
    newDeleteResourcesByExternalIdResponse,

    -- * Response Lenses
    deleteResourcesByExternalIdResponse_httpStatus,
  )
where

import Amazonka.CodeDeploy.Types
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newDeleteResourcesByExternalId' smart constructor.
data DeleteResourcesByExternalId = DeleteResourcesByExternalId'
  { -- | The unique ID of an external resource (for example, a CloudFormation
    -- stack ID) that is linked to one or more CodeDeploy resources.
    DeleteResourcesByExternalId -> Maybe Text
externalId :: Prelude.Maybe Prelude.Text
  }
  deriving (DeleteResourcesByExternalId -> DeleteResourcesByExternalId -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteResourcesByExternalId -> DeleteResourcesByExternalId -> Bool
$c/= :: DeleteResourcesByExternalId -> DeleteResourcesByExternalId -> Bool
== :: DeleteResourcesByExternalId -> DeleteResourcesByExternalId -> Bool
$c== :: DeleteResourcesByExternalId -> DeleteResourcesByExternalId -> Bool
Prelude.Eq, ReadPrec [DeleteResourcesByExternalId]
ReadPrec DeleteResourcesByExternalId
Int -> ReadS DeleteResourcesByExternalId
ReadS [DeleteResourcesByExternalId]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteResourcesByExternalId]
$creadListPrec :: ReadPrec [DeleteResourcesByExternalId]
readPrec :: ReadPrec DeleteResourcesByExternalId
$creadPrec :: ReadPrec DeleteResourcesByExternalId
readList :: ReadS [DeleteResourcesByExternalId]
$creadList :: ReadS [DeleteResourcesByExternalId]
readsPrec :: Int -> ReadS DeleteResourcesByExternalId
$creadsPrec :: Int -> ReadS DeleteResourcesByExternalId
Prelude.Read, Int -> DeleteResourcesByExternalId -> ShowS
[DeleteResourcesByExternalId] -> ShowS
DeleteResourcesByExternalId -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteResourcesByExternalId] -> ShowS
$cshowList :: [DeleteResourcesByExternalId] -> ShowS
show :: DeleteResourcesByExternalId -> String
$cshow :: DeleteResourcesByExternalId -> String
showsPrec :: Int -> DeleteResourcesByExternalId -> ShowS
$cshowsPrec :: Int -> DeleteResourcesByExternalId -> ShowS
Prelude.Show, forall x.
Rep DeleteResourcesByExternalId x -> DeleteResourcesByExternalId
forall x.
DeleteResourcesByExternalId -> Rep DeleteResourcesByExternalId x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DeleteResourcesByExternalId x -> DeleteResourcesByExternalId
$cfrom :: forall x.
DeleteResourcesByExternalId -> Rep DeleteResourcesByExternalId x
Prelude.Generic)

-- |
-- Create a value of 'DeleteResourcesByExternalId' 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:
--
-- 'externalId', 'deleteResourcesByExternalId_externalId' - The unique ID of an external resource (for example, a CloudFormation
-- stack ID) that is linked to one or more CodeDeploy resources.
newDeleteResourcesByExternalId ::
  DeleteResourcesByExternalId
newDeleteResourcesByExternalId :: DeleteResourcesByExternalId
newDeleteResourcesByExternalId =
  DeleteResourcesByExternalId'
    { $sel:externalId:DeleteResourcesByExternalId' :: Maybe Text
externalId =
        forall a. Maybe a
Prelude.Nothing
    }

-- | The unique ID of an external resource (for example, a CloudFormation
-- stack ID) that is linked to one or more CodeDeploy resources.
deleteResourcesByExternalId_externalId :: Lens.Lens' DeleteResourcesByExternalId (Prelude.Maybe Prelude.Text)
deleteResourcesByExternalId_externalId :: Lens' DeleteResourcesByExternalId (Maybe Text)
deleteResourcesByExternalId_externalId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteResourcesByExternalId' {Maybe Text
externalId :: Maybe Text
$sel:externalId:DeleteResourcesByExternalId' :: DeleteResourcesByExternalId -> Maybe Text
externalId} -> Maybe Text
externalId) (\s :: DeleteResourcesByExternalId
s@DeleteResourcesByExternalId' {} Maybe Text
a -> DeleteResourcesByExternalId
s {$sel:externalId:DeleteResourcesByExternalId' :: Maybe Text
externalId = Maybe Text
a} :: DeleteResourcesByExternalId)

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

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

instance Data.ToHeaders DeleteResourcesByExternalId where
  toHeaders :: DeleteResourcesByExternalId -> 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
"CodeDeploy_20141006.DeleteResourcesByExternalId" ::
                          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 DeleteResourcesByExternalId where
  toJSON :: DeleteResourcesByExternalId -> Value
toJSON DeleteResourcesByExternalId' {Maybe Text
externalId :: Maybe Text
$sel:externalId:DeleteResourcesByExternalId' :: DeleteResourcesByExternalId -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [(Key
"externalId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
externalId]
      )

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

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

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

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

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

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