{-# 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.DescribeCustomerMetadata
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Get and view a list of customer agreements, along with their signed
-- status and whether the customer is an NNIPartner, NNIPartnerV2, or a
-- nonPartner.
module Amazonka.DirectConnect.DescribeCustomerMetadata
  ( -- * Creating a Request
    DescribeCustomerMetadata (..),
    newDescribeCustomerMetadata,

    -- * Destructuring the Response
    DescribeCustomerMetadataResponse (..),
    newDescribeCustomerMetadataResponse,

    -- * Response Lenses
    describeCustomerMetadataResponse_agreements,
    describeCustomerMetadataResponse_nniPartnerType,
    describeCustomerMetadataResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.DirectConnect.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

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

-- |
-- Create a value of 'DescribeCustomerMetadata' 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.
newDescribeCustomerMetadata ::
  DescribeCustomerMetadata
newDescribeCustomerMetadata :: DescribeCustomerMetadata
newDescribeCustomerMetadata =
  DescribeCustomerMetadata
DescribeCustomerMetadata'

instance Core.AWSRequest DescribeCustomerMetadata where
  type
    AWSResponse DescribeCustomerMetadata =
      DescribeCustomerMetadataResponse
  request :: (Service -> Service)
-> DescribeCustomerMetadata -> Request DescribeCustomerMetadata
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy DescribeCustomerMetadata
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeCustomerMetadata)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe [CustomerAgreement]
-> Maybe NniPartnerType -> Int -> DescribeCustomerMetadataResponse
DescribeCustomerMetadataResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"agreements" forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty)
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"nniPartnerType")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable DescribeCustomerMetadata where
  hashWithSalt :: Int -> DescribeCustomerMetadata -> Int
hashWithSalt Int
_salt DescribeCustomerMetadata
_ =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` ()

instance Prelude.NFData DescribeCustomerMetadata where
  rnf :: DescribeCustomerMetadata -> ()
rnf DescribeCustomerMetadata
_ = ()

instance Data.ToHeaders DescribeCustomerMetadata where
  toHeaders :: DescribeCustomerMetadata -> ResponseHeaders
toHeaders =
    forall a b. a -> b -> a
Prelude.const
      ( forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"OvertureService.DescribeCustomerMetadata" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Data.ToJSON DescribeCustomerMetadata where
  toJSON :: DescribeCustomerMetadata -> Value
toJSON = forall a b. a -> b -> a
Prelude.const (Object -> Value
Data.Object forall a. Monoid a => a
Prelude.mempty)

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

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

-- | /See:/ 'newDescribeCustomerMetadataResponse' smart constructor.
data DescribeCustomerMetadataResponse = DescribeCustomerMetadataResponse'
  { -- | The list of customer agreements.
    DescribeCustomerMetadataResponse -> Maybe [CustomerAgreement]
agreements :: Prelude.Maybe [CustomerAgreement],
    -- | The type of network-to-network interface (NNI) partner. The partner type
    -- will be one of the following:
    --
    -- -   V1: This partner can only allocate 50Mbps, 100Mbps, 200Mbps,
    --     300Mbps, 400Mbps, or 500Mbps subgigabit connections.
    --
    -- -   V2: This partner can only allocate 1GB, 2GB, 5GB, or 10GB hosted
    --     connections.
    --
    -- -   nonPartner: The customer is not a partner.
    DescribeCustomerMetadataResponse -> Maybe NniPartnerType
nniPartnerType :: Prelude.Maybe NniPartnerType,
    -- | The response's http status code.
    DescribeCustomerMetadataResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DescribeCustomerMetadataResponse
-> DescribeCustomerMetadataResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeCustomerMetadataResponse
-> DescribeCustomerMetadataResponse -> Bool
$c/= :: DescribeCustomerMetadataResponse
-> DescribeCustomerMetadataResponse -> Bool
== :: DescribeCustomerMetadataResponse
-> DescribeCustomerMetadataResponse -> Bool
$c== :: DescribeCustomerMetadataResponse
-> DescribeCustomerMetadataResponse -> Bool
Prelude.Eq, ReadPrec [DescribeCustomerMetadataResponse]
ReadPrec DescribeCustomerMetadataResponse
Int -> ReadS DescribeCustomerMetadataResponse
ReadS [DescribeCustomerMetadataResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeCustomerMetadataResponse]
$creadListPrec :: ReadPrec [DescribeCustomerMetadataResponse]
readPrec :: ReadPrec DescribeCustomerMetadataResponse
$creadPrec :: ReadPrec DescribeCustomerMetadataResponse
readList :: ReadS [DescribeCustomerMetadataResponse]
$creadList :: ReadS [DescribeCustomerMetadataResponse]
readsPrec :: Int -> ReadS DescribeCustomerMetadataResponse
$creadsPrec :: Int -> ReadS DescribeCustomerMetadataResponse
Prelude.Read, Int -> DescribeCustomerMetadataResponse -> ShowS
[DescribeCustomerMetadataResponse] -> ShowS
DescribeCustomerMetadataResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeCustomerMetadataResponse] -> ShowS
$cshowList :: [DescribeCustomerMetadataResponse] -> ShowS
show :: DescribeCustomerMetadataResponse -> String
$cshow :: DescribeCustomerMetadataResponse -> String
showsPrec :: Int -> DescribeCustomerMetadataResponse -> ShowS
$cshowsPrec :: Int -> DescribeCustomerMetadataResponse -> ShowS
Prelude.Show, forall x.
Rep DescribeCustomerMetadataResponse x
-> DescribeCustomerMetadataResponse
forall x.
DescribeCustomerMetadataResponse
-> Rep DescribeCustomerMetadataResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeCustomerMetadataResponse x
-> DescribeCustomerMetadataResponse
$cfrom :: forall x.
DescribeCustomerMetadataResponse
-> Rep DescribeCustomerMetadataResponse x
Prelude.Generic)

-- |
-- Create a value of 'DescribeCustomerMetadataResponse' 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:
--
-- 'agreements', 'describeCustomerMetadataResponse_agreements' - The list of customer agreements.
--
-- 'nniPartnerType', 'describeCustomerMetadataResponse_nniPartnerType' - The type of network-to-network interface (NNI) partner. The partner type
-- will be one of the following:
--
-- -   V1: This partner can only allocate 50Mbps, 100Mbps, 200Mbps,
--     300Mbps, 400Mbps, or 500Mbps subgigabit connections.
--
-- -   V2: This partner can only allocate 1GB, 2GB, 5GB, or 10GB hosted
--     connections.
--
-- -   nonPartner: The customer is not a partner.
--
-- 'httpStatus', 'describeCustomerMetadataResponse_httpStatus' - The response's http status code.
newDescribeCustomerMetadataResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeCustomerMetadataResponse
newDescribeCustomerMetadataResponse :: Int -> DescribeCustomerMetadataResponse
newDescribeCustomerMetadataResponse Int
pHttpStatus_ =
  DescribeCustomerMetadataResponse'
    { $sel:agreements:DescribeCustomerMetadataResponse' :: Maybe [CustomerAgreement]
agreements =
        forall a. Maybe a
Prelude.Nothing,
      $sel:nniPartnerType:DescribeCustomerMetadataResponse' :: Maybe NniPartnerType
nniPartnerType = forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DescribeCustomerMetadataResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The list of customer agreements.
describeCustomerMetadataResponse_agreements :: Lens.Lens' DescribeCustomerMetadataResponse (Prelude.Maybe [CustomerAgreement])
describeCustomerMetadataResponse_agreements :: Lens' DescribeCustomerMetadataResponse (Maybe [CustomerAgreement])
describeCustomerMetadataResponse_agreements = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeCustomerMetadataResponse' {Maybe [CustomerAgreement]
agreements :: Maybe [CustomerAgreement]
$sel:agreements:DescribeCustomerMetadataResponse' :: DescribeCustomerMetadataResponse -> Maybe [CustomerAgreement]
agreements} -> Maybe [CustomerAgreement]
agreements) (\s :: DescribeCustomerMetadataResponse
s@DescribeCustomerMetadataResponse' {} Maybe [CustomerAgreement]
a -> DescribeCustomerMetadataResponse
s {$sel:agreements:DescribeCustomerMetadataResponse' :: Maybe [CustomerAgreement]
agreements = Maybe [CustomerAgreement]
a} :: DescribeCustomerMetadataResponse) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The type of network-to-network interface (NNI) partner. The partner type
-- will be one of the following:
--
-- -   V1: This partner can only allocate 50Mbps, 100Mbps, 200Mbps,
--     300Mbps, 400Mbps, or 500Mbps subgigabit connections.
--
-- -   V2: This partner can only allocate 1GB, 2GB, 5GB, or 10GB hosted
--     connections.
--
-- -   nonPartner: The customer is not a partner.
describeCustomerMetadataResponse_nniPartnerType :: Lens.Lens' DescribeCustomerMetadataResponse (Prelude.Maybe NniPartnerType)
describeCustomerMetadataResponse_nniPartnerType :: Lens' DescribeCustomerMetadataResponse (Maybe NniPartnerType)
describeCustomerMetadataResponse_nniPartnerType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeCustomerMetadataResponse' {Maybe NniPartnerType
nniPartnerType :: Maybe NniPartnerType
$sel:nniPartnerType:DescribeCustomerMetadataResponse' :: DescribeCustomerMetadataResponse -> Maybe NniPartnerType
nniPartnerType} -> Maybe NniPartnerType
nniPartnerType) (\s :: DescribeCustomerMetadataResponse
s@DescribeCustomerMetadataResponse' {} Maybe NniPartnerType
a -> DescribeCustomerMetadataResponse
s {$sel:nniPartnerType:DescribeCustomerMetadataResponse' :: Maybe NniPartnerType
nniPartnerType = Maybe NniPartnerType
a} :: DescribeCustomerMetadataResponse)

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

instance
  Prelude.NFData
    DescribeCustomerMetadataResponse
  where
  rnf :: DescribeCustomerMetadataResponse -> ()
rnf DescribeCustomerMetadataResponse' {Int
Maybe [CustomerAgreement]
Maybe NniPartnerType
httpStatus :: Int
nniPartnerType :: Maybe NniPartnerType
agreements :: Maybe [CustomerAgreement]
$sel:httpStatus:DescribeCustomerMetadataResponse' :: DescribeCustomerMetadataResponse -> Int
$sel:nniPartnerType:DescribeCustomerMetadataResponse' :: DescribeCustomerMetadataResponse -> Maybe NniPartnerType
$sel:agreements:DescribeCustomerMetadataResponse' :: DescribeCustomerMetadataResponse -> Maybe [CustomerAgreement]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [CustomerAgreement]
agreements
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe NniPartnerType
nniPartnerType
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus