{-# 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.MediaConvert.DisassociateCertificate
-- 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)
--
-- Removes an association between the Amazon Resource Name (ARN) of an AWS
-- Certificate Manager (ACM) certificate and an AWS Elemental MediaConvert
-- resource.
module Amazonka.MediaConvert.DisassociateCertificate
  ( -- * Creating a Request
    DisassociateCertificate (..),
    newDisassociateCertificate,

    -- * Request Lenses
    disassociateCertificate_arn,

    -- * Destructuring the Response
    DisassociateCertificateResponse (..),
    newDisassociateCertificateResponse,

    -- * Response Lenses
    disassociateCertificateResponse_httpStatus,
  )
where

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

-- | /See:/ 'newDisassociateCertificate' smart constructor.
data DisassociateCertificate = DisassociateCertificate'
  { -- | The ARN of the ACM certificate that you want to disassociate from your
    -- MediaConvert resource.
    DisassociateCertificate -> Text
arn :: Prelude.Text
  }
  deriving (DisassociateCertificate -> DisassociateCertificate -> Bool
(DisassociateCertificate -> DisassociateCertificate -> Bool)
-> (DisassociateCertificate -> DisassociateCertificate -> Bool)
-> Eq DisassociateCertificate
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DisassociateCertificate -> DisassociateCertificate -> Bool
$c/= :: DisassociateCertificate -> DisassociateCertificate -> Bool
== :: DisassociateCertificate -> DisassociateCertificate -> Bool
$c== :: DisassociateCertificate -> DisassociateCertificate -> Bool
Prelude.Eq, ReadPrec [DisassociateCertificate]
ReadPrec DisassociateCertificate
Int -> ReadS DisassociateCertificate
ReadS [DisassociateCertificate]
(Int -> ReadS DisassociateCertificate)
-> ReadS [DisassociateCertificate]
-> ReadPrec DisassociateCertificate
-> ReadPrec [DisassociateCertificate]
-> Read DisassociateCertificate
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DisassociateCertificate]
$creadListPrec :: ReadPrec [DisassociateCertificate]
readPrec :: ReadPrec DisassociateCertificate
$creadPrec :: ReadPrec DisassociateCertificate
readList :: ReadS [DisassociateCertificate]
$creadList :: ReadS [DisassociateCertificate]
readsPrec :: Int -> ReadS DisassociateCertificate
$creadsPrec :: Int -> ReadS DisassociateCertificate
Prelude.Read, Int -> DisassociateCertificate -> ShowS
[DisassociateCertificate] -> ShowS
DisassociateCertificate -> String
(Int -> DisassociateCertificate -> ShowS)
-> (DisassociateCertificate -> String)
-> ([DisassociateCertificate] -> ShowS)
-> Show DisassociateCertificate
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DisassociateCertificate] -> ShowS
$cshowList :: [DisassociateCertificate] -> ShowS
show :: DisassociateCertificate -> String
$cshow :: DisassociateCertificate -> String
showsPrec :: Int -> DisassociateCertificate -> ShowS
$cshowsPrec :: Int -> DisassociateCertificate -> ShowS
Prelude.Show, (forall x.
 DisassociateCertificate -> Rep DisassociateCertificate x)
-> (forall x.
    Rep DisassociateCertificate x -> DisassociateCertificate)
-> Generic DisassociateCertificate
forall x. Rep DisassociateCertificate x -> DisassociateCertificate
forall x. DisassociateCertificate -> Rep DisassociateCertificate x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DisassociateCertificate x -> DisassociateCertificate
$cfrom :: forall x. DisassociateCertificate -> Rep DisassociateCertificate x
Prelude.Generic)

-- |
-- Create a value of 'DisassociateCertificate' 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', 'disassociateCertificate_arn' - The ARN of the ACM certificate that you want to disassociate from your
-- MediaConvert resource.
newDisassociateCertificate ::
  -- | 'arn'
  Prelude.Text ->
  DisassociateCertificate
newDisassociateCertificate :: Text -> DisassociateCertificate
newDisassociateCertificate Text
pArn_ =
  DisassociateCertificate' :: Text -> DisassociateCertificate
DisassociateCertificate' {$sel:arn:DisassociateCertificate' :: Text
arn = Text
pArn_}

-- | The ARN of the ACM certificate that you want to disassociate from your
-- MediaConvert resource.
disassociateCertificate_arn :: Lens.Lens' DisassociateCertificate Prelude.Text
disassociateCertificate_arn :: (Text -> f Text)
-> DisassociateCertificate -> f DisassociateCertificate
disassociateCertificate_arn = (DisassociateCertificate -> Text)
-> (DisassociateCertificate -> Text -> DisassociateCertificate)
-> Lens DisassociateCertificate DisassociateCertificate Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DisassociateCertificate' {Text
arn :: Text
$sel:arn:DisassociateCertificate' :: DisassociateCertificate -> Text
arn} -> Text
arn) (\s :: DisassociateCertificate
s@DisassociateCertificate' {} Text
a -> DisassociateCertificate
s {$sel:arn:DisassociateCertificate' :: Text
arn = Text
a} :: DisassociateCertificate)

instance Core.AWSRequest DisassociateCertificate where
  type
    AWSResponse DisassociateCertificate =
      DisassociateCertificateResponse
  request :: DisassociateCertificate -> Request DisassociateCertificate
request = Service
-> DisassociateCertificate -> Request DisassociateCertificate
forall a. ToRequest a => Service -> a -> Request a
Request.delete Service
defaultService
  response :: Logger
-> Service
-> Proxy DisassociateCertificate
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DisassociateCertificate)))
response =
    (Int
 -> ResponseHeaders
 -> ()
 -> Either String (AWSResponse DisassociateCertificate))
-> Logger
-> Service
-> Proxy DisassociateCertificate
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DisassociateCertificate)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
      ( \Int
s ResponseHeaders
h ()
x ->
          Int -> DisassociateCertificateResponse
DisassociateCertificateResponse'
            (Int -> DisassociateCertificateResponse)
-> Either String Int
-> Either String DisassociateCertificateResponse
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 DisassociateCertificate

instance Prelude.NFData DisassociateCertificate

instance Core.ToHeaders DisassociateCertificate where
  toHeaders :: DisassociateCertificate -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DisassociateCertificate -> 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 DisassociateCertificate where
  toPath :: DisassociateCertificate -> ByteString
toPath DisassociateCertificate' {Text
arn :: Text
$sel:arn:DisassociateCertificate' :: DisassociateCertificate -> Text
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ByteString
"/2017-08-29/certificates/", Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
arn]

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

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

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

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

instance
  Prelude.NFData
    DisassociateCertificateResponse