{-# 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.DirectConnect.ConfirmCustomerAgreement
-- 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)
--
-- The confirmation of the terms of agreement when creating the
-- connection\/link aggregation group (LAG).
module Amazonka.DirectConnect.ConfirmCustomerAgreement
  ( -- * Creating a Request
    ConfirmCustomerAgreement (..),
    newConfirmCustomerAgreement,

    -- * Request Lenses
    confirmCustomerAgreement_agreementName,

    -- * Destructuring the Response
    ConfirmCustomerAgreementResponse (..),
    newConfirmCustomerAgreementResponse,

    -- * Response Lenses
    confirmCustomerAgreementResponse_status,
    confirmCustomerAgreementResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import Amazonka.DirectConnect.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:/ 'newConfirmCustomerAgreement' smart constructor.
data ConfirmCustomerAgreement = ConfirmCustomerAgreement'
  { -- | The name of the customer agreement.
    ConfirmCustomerAgreement -> Maybe Text
agreementName :: Prelude.Maybe Prelude.Text
  }
  deriving (ConfirmCustomerAgreement -> ConfirmCustomerAgreement -> Bool
(ConfirmCustomerAgreement -> ConfirmCustomerAgreement -> Bool)
-> (ConfirmCustomerAgreement -> ConfirmCustomerAgreement -> Bool)
-> Eq ConfirmCustomerAgreement
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ConfirmCustomerAgreement -> ConfirmCustomerAgreement -> Bool
$c/= :: ConfirmCustomerAgreement -> ConfirmCustomerAgreement -> Bool
== :: ConfirmCustomerAgreement -> ConfirmCustomerAgreement -> Bool
$c== :: ConfirmCustomerAgreement -> ConfirmCustomerAgreement -> Bool
Prelude.Eq, ReadPrec [ConfirmCustomerAgreement]
ReadPrec ConfirmCustomerAgreement
Int -> ReadS ConfirmCustomerAgreement
ReadS [ConfirmCustomerAgreement]
(Int -> ReadS ConfirmCustomerAgreement)
-> ReadS [ConfirmCustomerAgreement]
-> ReadPrec ConfirmCustomerAgreement
-> ReadPrec [ConfirmCustomerAgreement]
-> Read ConfirmCustomerAgreement
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ConfirmCustomerAgreement]
$creadListPrec :: ReadPrec [ConfirmCustomerAgreement]
readPrec :: ReadPrec ConfirmCustomerAgreement
$creadPrec :: ReadPrec ConfirmCustomerAgreement
readList :: ReadS [ConfirmCustomerAgreement]
$creadList :: ReadS [ConfirmCustomerAgreement]
readsPrec :: Int -> ReadS ConfirmCustomerAgreement
$creadsPrec :: Int -> ReadS ConfirmCustomerAgreement
Prelude.Read, Int -> ConfirmCustomerAgreement -> ShowS
[ConfirmCustomerAgreement] -> ShowS
ConfirmCustomerAgreement -> String
(Int -> ConfirmCustomerAgreement -> ShowS)
-> (ConfirmCustomerAgreement -> String)
-> ([ConfirmCustomerAgreement] -> ShowS)
-> Show ConfirmCustomerAgreement
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ConfirmCustomerAgreement] -> ShowS
$cshowList :: [ConfirmCustomerAgreement] -> ShowS
show :: ConfirmCustomerAgreement -> String
$cshow :: ConfirmCustomerAgreement -> String
showsPrec :: Int -> ConfirmCustomerAgreement -> ShowS
$cshowsPrec :: Int -> ConfirmCustomerAgreement -> ShowS
Prelude.Show, (forall x.
 ConfirmCustomerAgreement -> Rep ConfirmCustomerAgreement x)
-> (forall x.
    Rep ConfirmCustomerAgreement x -> ConfirmCustomerAgreement)
-> Generic ConfirmCustomerAgreement
forall x.
Rep ConfirmCustomerAgreement x -> ConfirmCustomerAgreement
forall x.
ConfirmCustomerAgreement -> Rep ConfirmCustomerAgreement x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ConfirmCustomerAgreement x -> ConfirmCustomerAgreement
$cfrom :: forall x.
ConfirmCustomerAgreement -> Rep ConfirmCustomerAgreement x
Prelude.Generic)

-- |
-- Create a value of 'ConfirmCustomerAgreement' 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:
--
-- 'agreementName', 'confirmCustomerAgreement_agreementName' - The name of the customer agreement.
newConfirmCustomerAgreement ::
  ConfirmCustomerAgreement
newConfirmCustomerAgreement :: ConfirmCustomerAgreement
newConfirmCustomerAgreement =
  ConfirmCustomerAgreement' :: Maybe Text -> ConfirmCustomerAgreement
ConfirmCustomerAgreement'
    { $sel:agreementName:ConfirmCustomerAgreement' :: Maybe Text
agreementName =
        Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The name of the customer agreement.
confirmCustomerAgreement_agreementName :: Lens.Lens' ConfirmCustomerAgreement (Prelude.Maybe Prelude.Text)
confirmCustomerAgreement_agreementName :: (Maybe Text -> f (Maybe Text))
-> ConfirmCustomerAgreement -> f ConfirmCustomerAgreement
confirmCustomerAgreement_agreementName = (ConfirmCustomerAgreement -> Maybe Text)
-> (ConfirmCustomerAgreement
    -> Maybe Text -> ConfirmCustomerAgreement)
-> Lens
     ConfirmCustomerAgreement
     ConfirmCustomerAgreement
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConfirmCustomerAgreement' {Maybe Text
agreementName :: Maybe Text
$sel:agreementName:ConfirmCustomerAgreement' :: ConfirmCustomerAgreement -> Maybe Text
agreementName} -> Maybe Text
agreementName) (\s :: ConfirmCustomerAgreement
s@ConfirmCustomerAgreement' {} Maybe Text
a -> ConfirmCustomerAgreement
s {$sel:agreementName:ConfirmCustomerAgreement' :: Maybe Text
agreementName = Maybe Text
a} :: ConfirmCustomerAgreement)

instance Core.AWSRequest ConfirmCustomerAgreement where
  type
    AWSResponse ConfirmCustomerAgreement =
      ConfirmCustomerAgreementResponse
  request :: ConfirmCustomerAgreement -> Request ConfirmCustomerAgreement
request = Service
-> ConfirmCustomerAgreement -> Request ConfirmCustomerAgreement
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy ConfirmCustomerAgreement
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ConfirmCustomerAgreement)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse ConfirmCustomerAgreement))
-> Logger
-> Service
-> Proxy ConfirmCustomerAgreement
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ConfirmCustomerAgreement)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe Text -> Int -> ConfirmCustomerAgreementResponse
ConfirmCustomerAgreementResponse'
            (Maybe Text -> Int -> ConfirmCustomerAgreementResponse)
-> Either String (Maybe Text)
-> Either String (Int -> ConfirmCustomerAgreementResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"status")
            Either String (Int -> ConfirmCustomerAgreementResponse)
-> Either String Int
-> Either String ConfirmCustomerAgreementResponse
forall (f :: * -> *) a b. Applicative f => 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 ConfirmCustomerAgreement

instance Prelude.NFData ConfirmCustomerAgreement

instance Core.ToHeaders ConfirmCustomerAgreement where
  toHeaders :: ConfirmCustomerAgreement -> ResponseHeaders
toHeaders =
    ResponseHeaders -> ConfirmCustomerAgreement -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"OvertureService.ConfirmCustomerAgreement" ::
                          Prelude.ByteString
                      ),
            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.ToJSON ConfirmCustomerAgreement where
  toJSON :: ConfirmCustomerAgreement -> Value
toJSON ConfirmCustomerAgreement' {Maybe Text
agreementName :: Maybe Text
$sel:agreementName:ConfirmCustomerAgreement' :: ConfirmCustomerAgreement -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"agreementName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
agreementName
          ]
      )

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

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

-- | /See:/ 'newConfirmCustomerAgreementResponse' smart constructor.
data ConfirmCustomerAgreementResponse = ConfirmCustomerAgreementResponse'
  { -- | The status of the customer agreement when the connection was created.
    -- This will be either @signed@ or @unsigned@.
    ConfirmCustomerAgreementResponse -> Maybe Text
status :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    ConfirmCustomerAgreementResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ConfirmCustomerAgreementResponse
-> ConfirmCustomerAgreementResponse -> Bool
(ConfirmCustomerAgreementResponse
 -> ConfirmCustomerAgreementResponse -> Bool)
-> (ConfirmCustomerAgreementResponse
    -> ConfirmCustomerAgreementResponse -> Bool)
-> Eq ConfirmCustomerAgreementResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ConfirmCustomerAgreementResponse
-> ConfirmCustomerAgreementResponse -> Bool
$c/= :: ConfirmCustomerAgreementResponse
-> ConfirmCustomerAgreementResponse -> Bool
== :: ConfirmCustomerAgreementResponse
-> ConfirmCustomerAgreementResponse -> Bool
$c== :: ConfirmCustomerAgreementResponse
-> ConfirmCustomerAgreementResponse -> Bool
Prelude.Eq, ReadPrec [ConfirmCustomerAgreementResponse]
ReadPrec ConfirmCustomerAgreementResponse
Int -> ReadS ConfirmCustomerAgreementResponse
ReadS [ConfirmCustomerAgreementResponse]
(Int -> ReadS ConfirmCustomerAgreementResponse)
-> ReadS [ConfirmCustomerAgreementResponse]
-> ReadPrec ConfirmCustomerAgreementResponse
-> ReadPrec [ConfirmCustomerAgreementResponse]
-> Read ConfirmCustomerAgreementResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ConfirmCustomerAgreementResponse]
$creadListPrec :: ReadPrec [ConfirmCustomerAgreementResponse]
readPrec :: ReadPrec ConfirmCustomerAgreementResponse
$creadPrec :: ReadPrec ConfirmCustomerAgreementResponse
readList :: ReadS [ConfirmCustomerAgreementResponse]
$creadList :: ReadS [ConfirmCustomerAgreementResponse]
readsPrec :: Int -> ReadS ConfirmCustomerAgreementResponse
$creadsPrec :: Int -> ReadS ConfirmCustomerAgreementResponse
Prelude.Read, Int -> ConfirmCustomerAgreementResponse -> ShowS
[ConfirmCustomerAgreementResponse] -> ShowS
ConfirmCustomerAgreementResponse -> String
(Int -> ConfirmCustomerAgreementResponse -> ShowS)
-> (ConfirmCustomerAgreementResponse -> String)
-> ([ConfirmCustomerAgreementResponse] -> ShowS)
-> Show ConfirmCustomerAgreementResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ConfirmCustomerAgreementResponse] -> ShowS
$cshowList :: [ConfirmCustomerAgreementResponse] -> ShowS
show :: ConfirmCustomerAgreementResponse -> String
$cshow :: ConfirmCustomerAgreementResponse -> String
showsPrec :: Int -> ConfirmCustomerAgreementResponse -> ShowS
$cshowsPrec :: Int -> ConfirmCustomerAgreementResponse -> ShowS
Prelude.Show, (forall x.
 ConfirmCustomerAgreementResponse
 -> Rep ConfirmCustomerAgreementResponse x)
-> (forall x.
    Rep ConfirmCustomerAgreementResponse x
    -> ConfirmCustomerAgreementResponse)
-> Generic ConfirmCustomerAgreementResponse
forall x.
Rep ConfirmCustomerAgreementResponse x
-> ConfirmCustomerAgreementResponse
forall x.
ConfirmCustomerAgreementResponse
-> Rep ConfirmCustomerAgreementResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ConfirmCustomerAgreementResponse x
-> ConfirmCustomerAgreementResponse
$cfrom :: forall x.
ConfirmCustomerAgreementResponse
-> Rep ConfirmCustomerAgreementResponse x
Prelude.Generic)

-- |
-- Create a value of 'ConfirmCustomerAgreementResponse' 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:
--
-- 'status', 'confirmCustomerAgreementResponse_status' - The status of the customer agreement when the connection was created.
-- This will be either @signed@ or @unsigned@.
--
-- 'httpStatus', 'confirmCustomerAgreementResponse_httpStatus' - The response's http status code.
newConfirmCustomerAgreementResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ConfirmCustomerAgreementResponse
newConfirmCustomerAgreementResponse :: Int -> ConfirmCustomerAgreementResponse
newConfirmCustomerAgreementResponse Int
pHttpStatus_ =
  ConfirmCustomerAgreementResponse' :: Maybe Text -> Int -> ConfirmCustomerAgreementResponse
ConfirmCustomerAgreementResponse'
    { $sel:status:ConfirmCustomerAgreementResponse' :: Maybe Text
status =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ConfirmCustomerAgreementResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The status of the customer agreement when the connection was created.
-- This will be either @signed@ or @unsigned@.
confirmCustomerAgreementResponse_status :: Lens.Lens' ConfirmCustomerAgreementResponse (Prelude.Maybe Prelude.Text)
confirmCustomerAgreementResponse_status :: (Maybe Text -> f (Maybe Text))
-> ConfirmCustomerAgreementResponse
-> f ConfirmCustomerAgreementResponse
confirmCustomerAgreementResponse_status = (ConfirmCustomerAgreementResponse -> Maybe Text)
-> (ConfirmCustomerAgreementResponse
    -> Maybe Text -> ConfirmCustomerAgreementResponse)
-> Lens
     ConfirmCustomerAgreementResponse
     ConfirmCustomerAgreementResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConfirmCustomerAgreementResponse' {Maybe Text
status :: Maybe Text
$sel:status:ConfirmCustomerAgreementResponse' :: ConfirmCustomerAgreementResponse -> Maybe Text
status} -> Maybe Text
status) (\s :: ConfirmCustomerAgreementResponse
s@ConfirmCustomerAgreementResponse' {} Maybe Text
a -> ConfirmCustomerAgreementResponse
s {$sel:status:ConfirmCustomerAgreementResponse' :: Maybe Text
status = Maybe Text
a} :: ConfirmCustomerAgreementResponse)

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

instance
  Prelude.NFData
    ConfirmCustomerAgreementResponse