{-# 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.DeactivateType
-- 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)
--
-- Deactivates a public extension that was previously activated in this
-- account and region.
--
-- Once deactivated, an extension cannot be used in any CloudFormation
-- operation. This includes stack update operations where the stack
-- template includes the extension, even if no updates are being made to
-- the extension. In addition, deactivated extensions are not automatically
-- updated if a new version of the extension is released.
module Amazonka.CloudFormation.DeactivateType
  ( -- * Creating a Request
    DeactivateType (..),
    newDeactivateType,

    -- * Request Lenses
    deactivateType_typeName,
    deactivateType_arn,
    deactivateType_type,

    -- * Destructuring the Response
    DeactivateTypeResponse (..),
    newDeactivateTypeResponse,

    -- * Response Lenses
    deactivateTypeResponse_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:/ 'newDeactivateType' smart constructor.
data DeactivateType = DeactivateType'
  { -- | The type name of the extension, in this account and region. If you
    -- specified a type name alias when enabling the extension, use the type
    -- name alias.
    --
    -- Conditional: You must specify either @Arn@, or @TypeName@ and @Type@.
    DeactivateType -> Maybe Text
typeName :: Prelude.Maybe Prelude.Text,
    -- | The Amazon Resource Name (ARN) for the extension, in this account and
    -- region.
    --
    -- Conditional: You must specify either @Arn@, or @TypeName@ and @Type@.
    DeactivateType -> Maybe Text
arn :: Prelude.Maybe Prelude.Text,
    -- | The extension type.
    --
    -- Conditional: You must specify either @Arn@, or @TypeName@ and @Type@.
    DeactivateType -> Maybe ThirdPartyType
type' :: Prelude.Maybe ThirdPartyType
  }
  deriving (DeactivateType -> DeactivateType -> Bool
(DeactivateType -> DeactivateType -> Bool)
-> (DeactivateType -> DeactivateType -> Bool) -> Eq DeactivateType
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeactivateType -> DeactivateType -> Bool
$c/= :: DeactivateType -> DeactivateType -> Bool
== :: DeactivateType -> DeactivateType -> Bool
$c== :: DeactivateType -> DeactivateType -> Bool
Prelude.Eq, ReadPrec [DeactivateType]
ReadPrec DeactivateType
Int -> ReadS DeactivateType
ReadS [DeactivateType]
(Int -> ReadS DeactivateType)
-> ReadS [DeactivateType]
-> ReadPrec DeactivateType
-> ReadPrec [DeactivateType]
-> Read DeactivateType
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeactivateType]
$creadListPrec :: ReadPrec [DeactivateType]
readPrec :: ReadPrec DeactivateType
$creadPrec :: ReadPrec DeactivateType
readList :: ReadS [DeactivateType]
$creadList :: ReadS [DeactivateType]
readsPrec :: Int -> ReadS DeactivateType
$creadsPrec :: Int -> ReadS DeactivateType
Prelude.Read, Int -> DeactivateType -> ShowS
[DeactivateType] -> ShowS
DeactivateType -> String
(Int -> DeactivateType -> ShowS)
-> (DeactivateType -> String)
-> ([DeactivateType] -> ShowS)
-> Show DeactivateType
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeactivateType] -> ShowS
$cshowList :: [DeactivateType] -> ShowS
show :: DeactivateType -> String
$cshow :: DeactivateType -> String
showsPrec :: Int -> DeactivateType -> ShowS
$cshowsPrec :: Int -> DeactivateType -> ShowS
Prelude.Show, (forall x. DeactivateType -> Rep DeactivateType x)
-> (forall x. Rep DeactivateType x -> DeactivateType)
-> Generic DeactivateType
forall x. Rep DeactivateType x -> DeactivateType
forall x. DeactivateType -> Rep DeactivateType x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeactivateType x -> DeactivateType
$cfrom :: forall x. DeactivateType -> Rep DeactivateType x
Prelude.Generic)

-- |
-- Create a value of 'DeactivateType' 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:
--
-- 'typeName', 'deactivateType_typeName' - The type name of the extension, in this account and region. If you
-- specified a type name alias when enabling the extension, use the type
-- name alias.
--
-- Conditional: You must specify either @Arn@, or @TypeName@ and @Type@.
--
-- 'arn', 'deactivateType_arn' - The Amazon Resource Name (ARN) for the extension, in this account and
-- region.
--
-- Conditional: You must specify either @Arn@, or @TypeName@ and @Type@.
--
-- 'type'', 'deactivateType_type' - The extension type.
--
-- Conditional: You must specify either @Arn@, or @TypeName@ and @Type@.
newDeactivateType ::
  DeactivateType
newDeactivateType :: DeactivateType
newDeactivateType =
  DeactivateType' :: Maybe Text -> Maybe Text -> Maybe ThirdPartyType -> DeactivateType
DeactivateType'
    { $sel:typeName:DeactivateType' :: Maybe Text
typeName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:arn:DeactivateType' :: Maybe Text
arn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:type':DeactivateType' :: Maybe ThirdPartyType
type' = Maybe ThirdPartyType
forall a. Maybe a
Prelude.Nothing
    }

-- | The type name of the extension, in this account and region. If you
-- specified a type name alias when enabling the extension, use the type
-- name alias.
--
-- Conditional: You must specify either @Arn@, or @TypeName@ and @Type@.
deactivateType_typeName :: Lens.Lens' DeactivateType (Prelude.Maybe Prelude.Text)
deactivateType_typeName :: (Maybe Text -> f (Maybe Text))
-> DeactivateType -> f DeactivateType
deactivateType_typeName = (DeactivateType -> Maybe Text)
-> (DeactivateType -> Maybe Text -> DeactivateType)
-> Lens DeactivateType DeactivateType (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeactivateType' {Maybe Text
typeName :: Maybe Text
$sel:typeName:DeactivateType' :: DeactivateType -> Maybe Text
typeName} -> Maybe Text
typeName) (\s :: DeactivateType
s@DeactivateType' {} Maybe Text
a -> DeactivateType
s {$sel:typeName:DeactivateType' :: Maybe Text
typeName = Maybe Text
a} :: DeactivateType)

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

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

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

instance Prelude.NFData DeactivateType

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

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

instance Core.ToQuery DeactivateType where
  toQuery :: DeactivateType -> QueryString
toQuery DeactivateType' {Maybe Text
Maybe ThirdPartyType
type' :: Maybe ThirdPartyType
arn :: Maybe Text
typeName :: Maybe Text
$sel:type':DeactivateType' :: DeactivateType -> Maybe ThirdPartyType
$sel:arn:DeactivateType' :: DeactivateType -> Maybe Text
$sel:typeName:DeactivateType' :: DeactivateType -> 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
"DeactivateType" :: Prelude.ByteString),
        ByteString
"Version"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2010-05-15" :: Prelude.ByteString),
        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 ThirdPartyType -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe ThirdPartyType
type'
      ]

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

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

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

instance Prelude.NFData DeactivateTypeResponse