{-# 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.CloudFormation.DeregisterType
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Marks an extension or extension version as @DEPRECATED@ in the
-- CloudFormation registry, removing it from active use. Deprecated
-- extensions or extension versions cannot be used in CloudFormation
-- operations.
--
-- To deregister an entire extension, you must individually deregister all
-- active versions of that extension. If an extension has only a single
-- active version, deregistering that version results in the extension
-- itself being deregistered and marked as deprecated in the registry.
--
-- You can\'t deregister the default version of an extension if there are
-- other active version of that extension. If you do deregister the default
-- version of an extension, the extension type itself is deregistered as
-- well and marked as deprecated.
--
-- To view the deprecation status of an extension or extension version, use
-- <https://docs.aws.amazon.com/AWSCloudFormation/latest/APIReference/API_DescribeType.html DescribeType>.
module Amazonka.CloudFormation.DeregisterType
  ( -- * Creating a Request
    DeregisterType (..),
    newDeregisterType,

    -- * Request Lenses
    deregisterType_arn,
    deregisterType_type,
    deregisterType_typeName,
    deregisterType_versionId,

    -- * Destructuring the Response
    DeregisterTypeResponse (..),
    newDeregisterTypeResponse,

    -- * Response Lenses
    deregisterTypeResponse_httpStatus,
  )
where

import Amazonka.CloudFormation.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:/ 'newDeregisterType' smart constructor.
data DeregisterType = DeregisterType'
  { -- | The Amazon Resource Name (ARN) of the extension.
    --
    -- Conditional: You must specify either @TypeName@ and @Type@, or @Arn@.
    DeregisterType -> Maybe Text
arn :: Prelude.Maybe Prelude.Text,
    -- | The kind of extension.
    --
    -- Conditional: You must specify either @TypeName@ and @Type@, or @Arn@.
    DeregisterType -> Maybe RegistryType
type' :: Prelude.Maybe RegistryType,
    -- | The name of the extension.
    --
    -- Conditional: You must specify either @TypeName@ and @Type@, or @Arn@.
    DeregisterType -> Maybe Text
typeName :: Prelude.Maybe Prelude.Text,
    -- | The ID of a specific version of the extension. The version ID is the
    -- value at the end of the Amazon Resource Name (ARN) assigned to the
    -- extension version when it is registered.
    DeregisterType -> Maybe Text
versionId :: Prelude.Maybe Prelude.Text
  }
  deriving (DeregisterType -> DeregisterType -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeregisterType -> DeregisterType -> Bool
$c/= :: DeregisterType -> DeregisterType -> Bool
== :: DeregisterType -> DeregisterType -> Bool
$c== :: DeregisterType -> DeregisterType -> Bool
Prelude.Eq, ReadPrec [DeregisterType]
ReadPrec DeregisterType
Int -> ReadS DeregisterType
ReadS [DeregisterType]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeregisterType]
$creadListPrec :: ReadPrec [DeregisterType]
readPrec :: ReadPrec DeregisterType
$creadPrec :: ReadPrec DeregisterType
readList :: ReadS [DeregisterType]
$creadList :: ReadS [DeregisterType]
readsPrec :: Int -> ReadS DeregisterType
$creadsPrec :: Int -> ReadS DeregisterType
Prelude.Read, Int -> DeregisterType -> ShowS
[DeregisterType] -> ShowS
DeregisterType -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeregisterType] -> ShowS
$cshowList :: [DeregisterType] -> ShowS
show :: DeregisterType -> String
$cshow :: DeregisterType -> String
showsPrec :: Int -> DeregisterType -> ShowS
$cshowsPrec :: Int -> DeregisterType -> ShowS
Prelude.Show, forall x. Rep DeregisterType x -> DeregisterType
forall x. DeregisterType -> Rep DeregisterType x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeregisterType x -> DeregisterType
$cfrom :: forall x. DeregisterType -> Rep DeregisterType x
Prelude.Generic)

-- |
-- Create a value of 'DeregisterType' 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:
--
-- 'arn', 'deregisterType_arn' - The Amazon Resource Name (ARN) of the extension.
--
-- Conditional: You must specify either @TypeName@ and @Type@, or @Arn@.
--
-- 'type'', 'deregisterType_type' - The kind of extension.
--
-- Conditional: You must specify either @TypeName@ and @Type@, or @Arn@.
--
-- 'typeName', 'deregisterType_typeName' - The name of the extension.
--
-- Conditional: You must specify either @TypeName@ and @Type@, or @Arn@.
--
-- 'versionId', 'deregisterType_versionId' - The ID of a specific version of the extension. The version ID is the
-- value at the end of the Amazon Resource Name (ARN) assigned to the
-- extension version when it is registered.
newDeregisterType ::
  DeregisterType
newDeregisterType :: DeregisterType
newDeregisterType =
  DeregisterType'
    { $sel:arn:DeregisterType' :: Maybe Text
arn = forall a. Maybe a
Prelude.Nothing,
      $sel:type':DeregisterType' :: Maybe RegistryType
type' = forall a. Maybe a
Prelude.Nothing,
      $sel:typeName:DeregisterType' :: Maybe Text
typeName = forall a. Maybe a
Prelude.Nothing,
      $sel:versionId:DeregisterType' :: Maybe Text
versionId = forall a. Maybe a
Prelude.Nothing
    }

-- | The Amazon Resource Name (ARN) of the extension.
--
-- Conditional: You must specify either @TypeName@ and @Type@, or @Arn@.
deregisterType_arn :: Lens.Lens' DeregisterType (Prelude.Maybe Prelude.Text)
deregisterType_arn :: Lens' DeregisterType (Maybe Text)
deregisterType_arn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeregisterType' {Maybe Text
arn :: Maybe Text
$sel:arn:DeregisterType' :: DeregisterType -> Maybe Text
arn} -> Maybe Text
arn) (\s :: DeregisterType
s@DeregisterType' {} Maybe Text
a -> DeregisterType
s {$sel:arn:DeregisterType' :: Maybe Text
arn = Maybe Text
a} :: DeregisterType)

-- | The kind of extension.
--
-- Conditional: You must specify either @TypeName@ and @Type@, or @Arn@.
deregisterType_type :: Lens.Lens' DeregisterType (Prelude.Maybe RegistryType)
deregisterType_type :: Lens' DeregisterType (Maybe RegistryType)
deregisterType_type = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeregisterType' {Maybe RegistryType
type' :: Maybe RegistryType
$sel:type':DeregisterType' :: DeregisterType -> Maybe RegistryType
type'} -> Maybe RegistryType
type') (\s :: DeregisterType
s@DeregisterType' {} Maybe RegistryType
a -> DeregisterType
s {$sel:type':DeregisterType' :: Maybe RegistryType
type' = Maybe RegistryType
a} :: DeregisterType)

-- | The name of the extension.
--
-- Conditional: You must specify either @TypeName@ and @Type@, or @Arn@.
deregisterType_typeName :: Lens.Lens' DeregisterType (Prelude.Maybe Prelude.Text)
deregisterType_typeName :: Lens' DeregisterType (Maybe Text)
deregisterType_typeName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeregisterType' {Maybe Text
typeName :: Maybe Text
$sel:typeName:DeregisterType' :: DeregisterType -> Maybe Text
typeName} -> Maybe Text
typeName) (\s :: DeregisterType
s@DeregisterType' {} Maybe Text
a -> DeregisterType
s {$sel:typeName:DeregisterType' :: Maybe Text
typeName = Maybe Text
a} :: DeregisterType)

-- | The ID of a specific version of the extension. The version ID is the
-- value at the end of the Amazon Resource Name (ARN) assigned to the
-- extension version when it is registered.
deregisterType_versionId :: Lens.Lens' DeregisterType (Prelude.Maybe Prelude.Text)
deregisterType_versionId :: Lens' DeregisterType (Maybe Text)
deregisterType_versionId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeregisterType' {Maybe Text
versionId :: Maybe Text
$sel:versionId:DeregisterType' :: DeregisterType -> Maybe Text
versionId} -> Maybe Text
versionId) (\s :: DeregisterType
s@DeregisterType' {} Maybe Text
a -> DeregisterType
s {$sel:versionId:DeregisterType' :: Maybe Text
versionId = Maybe Text
a} :: DeregisterType)

instance Core.AWSRequest DeregisterType where
  type
    AWSResponse DeregisterType =
      DeregisterTypeResponse
  request :: (Service -> Service) -> DeregisterType -> Request DeregisterType
request Service -> Service
overrides =
    forall a. ToRequest a => Service -> a -> Request a
Request.postQuery (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy DeregisterType
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeregisterType)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
Text
-> (Int
    -> ResponseHeaders -> [Node] -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveXMLWrapper
      Text
"DeregisterTypeResult"
      ( \Int
s ResponseHeaders
h [Node]
x ->
          Int -> DeregisterTypeResponse
DeregisterTypeResponse'
            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 DeregisterType where
  hashWithSalt :: Int -> DeregisterType -> Int
hashWithSalt Int
_salt DeregisterType' {Maybe Text
Maybe RegistryType
versionId :: Maybe Text
typeName :: Maybe Text
type' :: Maybe RegistryType
arn :: Maybe Text
$sel:versionId:DeregisterType' :: DeregisterType -> Maybe Text
$sel:typeName:DeregisterType' :: DeregisterType -> Maybe Text
$sel:type':DeregisterType' :: DeregisterType -> Maybe RegistryType
$sel:arn:DeregisterType' :: DeregisterType -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
arn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe RegistryType
type'
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
typeName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
versionId

instance Prelude.NFData DeregisterType where
  rnf :: DeregisterType -> ()
rnf DeregisterType' {Maybe Text
Maybe RegistryType
versionId :: Maybe Text
typeName :: Maybe Text
type' :: Maybe RegistryType
arn :: Maybe Text
$sel:versionId:DeregisterType' :: DeregisterType -> Maybe Text
$sel:typeName:DeregisterType' :: DeregisterType -> Maybe Text
$sel:type':DeregisterType' :: DeregisterType -> Maybe RegistryType
$sel:arn:DeregisterType' :: DeregisterType -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
arn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe RegistryType
type'
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
typeName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
versionId

instance Data.ToHeaders DeregisterType where
  toHeaders :: DeregisterType -> ResponseHeaders
toHeaders = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty

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

instance Data.ToQuery DeregisterType where
  toQuery :: DeregisterType -> QueryString
toQuery DeregisterType' {Maybe Text
Maybe RegistryType
versionId :: Maybe Text
typeName :: Maybe Text
type' :: Maybe RegistryType
arn :: Maybe Text
$sel:versionId:DeregisterType' :: DeregisterType -> Maybe Text
$sel:typeName:DeregisterType' :: DeregisterType -> Maybe Text
$sel:type':DeregisterType' :: DeregisterType -> Maybe RegistryType
$sel:arn:DeregisterType' :: DeregisterType -> Maybe Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"Action"
          forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: (ByteString
"DeregisterType" :: Prelude.ByteString),
        ByteString
"Version"
          forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: (ByteString
"2010-05-15" :: Prelude.ByteString),
        ByteString
"Arn" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
arn,
        ByteString
"Type" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe RegistryType
type',
        ByteString
"TypeName" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
typeName,
        ByteString
"VersionId" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
versionId
      ]

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

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

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

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