{-# 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.ELBV2.RemoveListenerCertificates
-- 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 the specified certificate from the certificate list for the
-- specified HTTPS or TLS listener.
module Amazonka.ELBV2.RemoveListenerCertificates
  ( -- * Creating a Request
    RemoveListenerCertificates (..),
    newRemoveListenerCertificates,

    -- * Request Lenses
    removeListenerCertificates_listenerArn,
    removeListenerCertificates_certificates,

    -- * Destructuring the Response
    RemoveListenerCertificatesResponse (..),
    newRemoveListenerCertificatesResponse,

    -- * Response Lenses
    removeListenerCertificatesResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import Amazonka.ELBV2.Types
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:/ 'newRemoveListenerCertificates' smart constructor.
data RemoveListenerCertificates = RemoveListenerCertificates'
  { -- | The Amazon Resource Name (ARN) of the listener.
    RemoveListenerCertificates -> Text
listenerArn :: Prelude.Text,
    -- | The certificate to remove. You can specify one certificate per call. Set
    -- @CertificateArn@ to the certificate ARN but do not set @IsDefault@.
    RemoveListenerCertificates -> [Certificate]
certificates :: [Certificate]
  }
  deriving (RemoveListenerCertificates -> RemoveListenerCertificates -> Bool
(RemoveListenerCertificates -> RemoveListenerCertificates -> Bool)
-> (RemoveListenerCertificates
    -> RemoveListenerCertificates -> Bool)
-> Eq RemoveListenerCertificates
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RemoveListenerCertificates -> RemoveListenerCertificates -> Bool
$c/= :: RemoveListenerCertificates -> RemoveListenerCertificates -> Bool
== :: RemoveListenerCertificates -> RemoveListenerCertificates -> Bool
$c== :: RemoveListenerCertificates -> RemoveListenerCertificates -> Bool
Prelude.Eq, ReadPrec [RemoveListenerCertificates]
ReadPrec RemoveListenerCertificates
Int -> ReadS RemoveListenerCertificates
ReadS [RemoveListenerCertificates]
(Int -> ReadS RemoveListenerCertificates)
-> ReadS [RemoveListenerCertificates]
-> ReadPrec RemoveListenerCertificates
-> ReadPrec [RemoveListenerCertificates]
-> Read RemoveListenerCertificates
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RemoveListenerCertificates]
$creadListPrec :: ReadPrec [RemoveListenerCertificates]
readPrec :: ReadPrec RemoveListenerCertificates
$creadPrec :: ReadPrec RemoveListenerCertificates
readList :: ReadS [RemoveListenerCertificates]
$creadList :: ReadS [RemoveListenerCertificates]
readsPrec :: Int -> ReadS RemoveListenerCertificates
$creadsPrec :: Int -> ReadS RemoveListenerCertificates
Prelude.Read, Int -> RemoveListenerCertificates -> ShowS
[RemoveListenerCertificates] -> ShowS
RemoveListenerCertificates -> String
(Int -> RemoveListenerCertificates -> ShowS)
-> (RemoveListenerCertificates -> String)
-> ([RemoveListenerCertificates] -> ShowS)
-> Show RemoveListenerCertificates
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RemoveListenerCertificates] -> ShowS
$cshowList :: [RemoveListenerCertificates] -> ShowS
show :: RemoveListenerCertificates -> String
$cshow :: RemoveListenerCertificates -> String
showsPrec :: Int -> RemoveListenerCertificates -> ShowS
$cshowsPrec :: Int -> RemoveListenerCertificates -> ShowS
Prelude.Show, (forall x.
 RemoveListenerCertificates -> Rep RemoveListenerCertificates x)
-> (forall x.
    Rep RemoveListenerCertificates x -> RemoveListenerCertificates)
-> Generic RemoveListenerCertificates
forall x.
Rep RemoveListenerCertificates x -> RemoveListenerCertificates
forall x.
RemoveListenerCertificates -> Rep RemoveListenerCertificates x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep RemoveListenerCertificates x -> RemoveListenerCertificates
$cfrom :: forall x.
RemoveListenerCertificates -> Rep RemoveListenerCertificates x
Prelude.Generic)

-- |
-- Create a value of 'RemoveListenerCertificates' 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:
--
-- 'listenerArn', 'removeListenerCertificates_listenerArn' - The Amazon Resource Name (ARN) of the listener.
--
-- 'certificates', 'removeListenerCertificates_certificates' - The certificate to remove. You can specify one certificate per call. Set
-- @CertificateArn@ to the certificate ARN but do not set @IsDefault@.
newRemoveListenerCertificates ::
  -- | 'listenerArn'
  Prelude.Text ->
  RemoveListenerCertificates
newRemoveListenerCertificates :: Text -> RemoveListenerCertificates
newRemoveListenerCertificates Text
pListenerArn_ =
  RemoveListenerCertificates' :: Text -> [Certificate] -> RemoveListenerCertificates
RemoveListenerCertificates'
    { $sel:listenerArn:RemoveListenerCertificates' :: Text
listenerArn =
        Text
pListenerArn_,
      $sel:certificates:RemoveListenerCertificates' :: [Certificate]
certificates = [Certificate]
forall a. Monoid a => a
Prelude.mempty
    }

-- | The Amazon Resource Name (ARN) of the listener.
removeListenerCertificates_listenerArn :: Lens.Lens' RemoveListenerCertificates Prelude.Text
removeListenerCertificates_listenerArn :: (Text -> f Text)
-> RemoveListenerCertificates -> f RemoveListenerCertificates
removeListenerCertificates_listenerArn = (RemoveListenerCertificates -> Text)
-> (RemoveListenerCertificates
    -> Text -> RemoveListenerCertificates)
-> Lens
     RemoveListenerCertificates RemoveListenerCertificates Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RemoveListenerCertificates' {Text
listenerArn :: Text
$sel:listenerArn:RemoveListenerCertificates' :: RemoveListenerCertificates -> Text
listenerArn} -> Text
listenerArn) (\s :: RemoveListenerCertificates
s@RemoveListenerCertificates' {} Text
a -> RemoveListenerCertificates
s {$sel:listenerArn:RemoveListenerCertificates' :: Text
listenerArn = Text
a} :: RemoveListenerCertificates)

-- | The certificate to remove. You can specify one certificate per call. Set
-- @CertificateArn@ to the certificate ARN but do not set @IsDefault@.
removeListenerCertificates_certificates :: Lens.Lens' RemoveListenerCertificates [Certificate]
removeListenerCertificates_certificates :: ([Certificate] -> f [Certificate])
-> RemoveListenerCertificates -> f RemoveListenerCertificates
removeListenerCertificates_certificates = (RemoveListenerCertificates -> [Certificate])
-> (RemoveListenerCertificates
    -> [Certificate] -> RemoveListenerCertificates)
-> Lens
     RemoveListenerCertificates
     RemoveListenerCertificates
     [Certificate]
     [Certificate]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RemoveListenerCertificates' {[Certificate]
certificates :: [Certificate]
$sel:certificates:RemoveListenerCertificates' :: RemoveListenerCertificates -> [Certificate]
certificates} -> [Certificate]
certificates) (\s :: RemoveListenerCertificates
s@RemoveListenerCertificates' {} [Certificate]
a -> RemoveListenerCertificates
s {$sel:certificates:RemoveListenerCertificates' :: [Certificate]
certificates = [Certificate]
a} :: RemoveListenerCertificates) (([Certificate] -> f [Certificate])
 -> RemoveListenerCertificates -> f RemoveListenerCertificates)
-> (([Certificate] -> f [Certificate])
    -> [Certificate] -> f [Certificate])
-> ([Certificate] -> f [Certificate])
-> RemoveListenerCertificates
-> f RemoveListenerCertificates
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([Certificate] -> f [Certificate])
-> [Certificate] -> f [Certificate]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance Prelude.NFData RemoveListenerCertificates

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

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

instance Core.ToQuery RemoveListenerCertificates where
  toQuery :: RemoveListenerCertificates -> QueryString
toQuery RemoveListenerCertificates' {[Certificate]
Text
certificates :: [Certificate]
listenerArn :: Text
$sel:certificates:RemoveListenerCertificates' :: RemoveListenerCertificates -> [Certificate]
$sel:listenerArn:RemoveListenerCertificates' :: RemoveListenerCertificates -> 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
"RemoveListenerCertificates" :: Prelude.ByteString),
        ByteString
"Version"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2015-12-01" :: Prelude.ByteString),
        ByteString
"ListenerArn" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
listenerArn,
        ByteString
"Certificates"
          ByteString -> QueryString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: ByteString -> [Certificate] -> QueryString
forall a.
(IsList a, ToQuery (Item a)) =>
ByteString -> a -> QueryString
Core.toQueryList ByteString
"member" [Certificate]
certificates
      ]

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

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

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

instance
  Prelude.NFData
    RemoveListenerCertificatesResponse