{-# 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-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)
--
-- 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 cannot 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 textensionype 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_versionId,
    deregisterType_typeName,
    deregisterType_arn,
    deregisterType_type,

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

    -- * Response Lenses
    deregisterTypeResponse_httpStatus,
  )
where

import Amazonka.CloudFormation.Types
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

-- | /See:/ 'newDeregisterType' smart constructor.
data DeregisterType = 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 -> Maybe Text
versionId :: Prelude.Maybe Prelude.Text,
    -- | The name of the extension.
    --
    -- Conditional: You must specify either @TypeName@ and @Type@, or @Arn@.
    DeregisterType -> Maybe Text
typeName :: Prelude.Maybe Prelude.Text,
    -- | 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
  }
  deriving (DeregisterType -> DeregisterType -> Bool
(DeregisterType -> DeregisterType -> Bool)
-> (DeregisterType -> DeregisterType -> Bool) -> Eq DeregisterType
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]
(Int -> ReadS DeregisterType)
-> ReadS [DeregisterType]
-> ReadPrec DeregisterType
-> ReadPrec [DeregisterType]
-> Read 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
(Int -> DeregisterType -> ShowS)
-> (DeregisterType -> String)
-> ([DeregisterType] -> ShowS)
-> Show DeregisterType
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. DeregisterType -> Rep DeregisterType x)
-> (forall x. Rep DeregisterType x -> DeregisterType)
-> Generic DeregisterType
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:
--
-- '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.
--
-- 'typeName', 'deregisterType_typeName' - The name of the extension.
--
-- Conditional: You must specify either @TypeName@ and @Type@, or @Arn@.
--
-- '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@.
newDeregisterType ::
  DeregisterType
newDeregisterType :: DeregisterType
newDeregisterType =
  DeregisterType' :: Maybe Text
-> Maybe Text -> Maybe Text -> Maybe RegistryType -> DeregisterType
DeregisterType'
    { $sel:versionId:DeregisterType' :: Maybe Text
versionId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:typeName:DeregisterType' :: Maybe Text
typeName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:arn:DeregisterType' :: Maybe Text
arn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:type':DeregisterType' :: Maybe RegistryType
type' = Maybe RegistryType
forall a. Maybe a
Prelude.Nothing
    }

-- | 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 :: (Maybe Text -> f (Maybe Text))
-> DeregisterType -> f DeregisterType
deregisterType_versionId = (DeregisterType -> Maybe Text)
-> (DeregisterType -> Maybe Text -> DeregisterType)
-> Lens DeregisterType DeregisterType (Maybe Text) (Maybe Text)
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)

-- | 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 :: (Maybe Text -> f (Maybe Text))
-> DeregisterType -> f DeregisterType
deregisterType_typeName = (DeregisterType -> Maybe Text)
-> (DeregisterType -> Maybe Text -> DeregisterType)
-> Lens DeregisterType DeregisterType (Maybe Text) (Maybe Text)
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 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 :: (Maybe Text -> f (Maybe Text))
-> DeregisterType -> f DeregisterType
deregisterType_arn = (DeregisterType -> Maybe Text)
-> (DeregisterType -> Maybe Text -> DeregisterType)
-> Lens DeregisterType DeregisterType (Maybe Text) (Maybe Text)
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 :: (Maybe RegistryType -> f (Maybe RegistryType))
-> DeregisterType -> f DeregisterType
deregisterType_type = (DeregisterType -> Maybe RegistryType)
-> (DeregisterType -> Maybe RegistryType -> DeregisterType)
-> Lens
     DeregisterType
     DeregisterType
     (Maybe RegistryType)
     (Maybe RegistryType)
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)

instance Core.AWSRequest DeregisterType where
  type
    AWSResponse DeregisterType =
      DeregisterTypeResponse
  request :: DeregisterType -> Request DeregisterType
request = Service -> DeregisterType -> Request DeregisterType
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
  response :: Logger
-> Service
-> Proxy DeregisterType
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeregisterType)))
response =
    Text
-> (Int
    -> ResponseHeaders
    -> [Node]
    -> Either String (AWSResponse DeregisterType))
-> Logger
-> Service
-> Proxy DeregisterType
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeregisterType)))
forall (m :: * -> *) a.
MonadResource m =>
Text
-> (Int
    -> ResponseHeaders -> [Node] -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveXMLWrapper
      Text
"DeregisterTypeResult"
      ( \Int
s ResponseHeaders
h [Node]
x ->
          Int -> DeregisterTypeResponse
DeregisterTypeResponse'
            (Int -> DeregisterTypeResponse)
-> Either String Int -> Either String DeregisterTypeResponse
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 DeregisterType

instance Prelude.NFData DeregisterType

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

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

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

-- | /See:/ 'newDeregisterTypeResponse' smart constructor.
data DeregisterTypeResponse = DeregisterTypeResponse'
  { -- | The response's http status code.
    DeregisterTypeResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DeregisterTypeResponse -> DeregisterTypeResponse -> Bool
(DeregisterTypeResponse -> DeregisterTypeResponse -> Bool)
-> (DeregisterTypeResponse -> DeregisterTypeResponse -> Bool)
-> Eq DeregisterTypeResponse
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]
(Int -> ReadS DeregisterTypeResponse)
-> ReadS [DeregisterTypeResponse]
-> ReadPrec DeregisterTypeResponse
-> ReadPrec [DeregisterTypeResponse]
-> Read 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
(Int -> DeregisterTypeResponse -> ShowS)
-> (DeregisterTypeResponse -> String)
-> ([DeregisterTypeResponse] -> ShowS)
-> Show DeregisterTypeResponse
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. DeregisterTypeResponse -> Rep DeregisterTypeResponse x)
-> (forall x.
    Rep DeregisterTypeResponse x -> DeregisterTypeResponse)
-> Generic DeregisterTypeResponse
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' :: Int -> DeregisterTypeResponse
DeregisterTypeResponse' {$sel:httpStatus:DeregisterTypeResponse' :: Int
httpStatus = Int
pHttpStatus_}

-- | The response's http status code.
deregisterTypeResponse_httpStatus :: Lens.Lens' DeregisterTypeResponse Prelude.Int
deregisterTypeResponse_httpStatus :: (Int -> f Int)
-> DeregisterTypeResponse -> f DeregisterTypeResponse
deregisterTypeResponse_httpStatus = (DeregisterTypeResponse -> Int)
-> (DeregisterTypeResponse -> Int -> DeregisterTypeResponse)
-> Lens DeregisterTypeResponse DeregisterTypeResponse Int Int
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