{-# 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.ElasticInference.DescribeAcceleratorTypes
-- 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)
--
-- Describes the accelerator types available in a given region, as well as
-- their characteristics, such as memory and throughput.
module Amazonka.ElasticInference.DescribeAcceleratorTypes
  ( -- * Creating a Request
    DescribeAcceleratorTypes (..),
    newDescribeAcceleratorTypes,

    -- * Destructuring the Response
    DescribeAcceleratorTypesResponse (..),
    newDescribeAcceleratorTypesResponse,

    -- * Response Lenses
    describeAcceleratorTypesResponse_acceleratorTypes,
    describeAcceleratorTypesResponse_httpStatus,
  )
where

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

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

instance Core.AWSRequest DescribeAcceleratorTypes where
  type
    AWSResponse DescribeAcceleratorTypes =
      DescribeAcceleratorTypesResponse
  request :: DescribeAcceleratorTypes -> Request DescribeAcceleratorTypes
request = Service
-> DescribeAcceleratorTypes -> Request DescribeAcceleratorTypes
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
  response :: Logger
-> Service
-> Proxy DescribeAcceleratorTypes
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeAcceleratorTypes)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse DescribeAcceleratorTypes))
-> Logger
-> Service
-> Proxy DescribeAcceleratorTypes
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeAcceleratorTypes)))
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 [AcceleratorType] -> Int -> DescribeAcceleratorTypesResponse
DescribeAcceleratorTypesResponse'
            (Maybe [AcceleratorType]
 -> Int -> DescribeAcceleratorTypesResponse)
-> Either String (Maybe [AcceleratorType])
-> Either String (Int -> DescribeAcceleratorTypesResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( Object
x Object -> Key -> Either String (Maybe (Maybe [AcceleratorType]))
forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Core..?> Key
"acceleratorTypes"
                            Either String (Maybe (Maybe [AcceleratorType]))
-> Maybe [AcceleratorType]
-> Either String (Maybe [AcceleratorType])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [AcceleratorType]
forall a. Monoid a => a
Prelude.mempty
                        )
            Either String (Int -> DescribeAcceleratorTypesResponse)
-> Either String Int
-> Either String DescribeAcceleratorTypesResponse
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 DescribeAcceleratorTypes

instance Prelude.NFData DescribeAcceleratorTypes

instance Core.ToHeaders DescribeAcceleratorTypes where
  toHeaders :: DescribeAcceleratorTypes -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DescribeAcceleratorTypes -> 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 DescribeAcceleratorTypes where
  toPath :: DescribeAcceleratorTypes -> ByteString
toPath = ByteString -> DescribeAcceleratorTypes -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/describe-accelerator-types"

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

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

-- |
-- Create a value of 'DescribeAcceleratorTypesResponse' 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:
--
-- 'acceleratorTypes', 'describeAcceleratorTypesResponse_acceleratorTypes' - The available accelerator types.
--
-- 'httpStatus', 'describeAcceleratorTypesResponse_httpStatus' - The response's http status code.
newDescribeAcceleratorTypesResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeAcceleratorTypesResponse
newDescribeAcceleratorTypesResponse :: Int -> DescribeAcceleratorTypesResponse
newDescribeAcceleratorTypesResponse Int
pHttpStatus_ =
  DescribeAcceleratorTypesResponse' :: Maybe [AcceleratorType] -> Int -> DescribeAcceleratorTypesResponse
DescribeAcceleratorTypesResponse'
    { $sel:acceleratorTypes:DescribeAcceleratorTypesResponse' :: Maybe [AcceleratorType]
acceleratorTypes =
        Maybe [AcceleratorType]
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DescribeAcceleratorTypesResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The available accelerator types.
describeAcceleratorTypesResponse_acceleratorTypes :: Lens.Lens' DescribeAcceleratorTypesResponse (Prelude.Maybe [AcceleratorType])
describeAcceleratorTypesResponse_acceleratorTypes :: (Maybe [AcceleratorType] -> f (Maybe [AcceleratorType]))
-> DescribeAcceleratorTypesResponse
-> f DescribeAcceleratorTypesResponse
describeAcceleratorTypesResponse_acceleratorTypes = (DescribeAcceleratorTypesResponse -> Maybe [AcceleratorType])
-> (DescribeAcceleratorTypesResponse
    -> Maybe [AcceleratorType] -> DescribeAcceleratorTypesResponse)
-> Lens
     DescribeAcceleratorTypesResponse
     DescribeAcceleratorTypesResponse
     (Maybe [AcceleratorType])
     (Maybe [AcceleratorType])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeAcceleratorTypesResponse' {Maybe [AcceleratorType]
acceleratorTypes :: Maybe [AcceleratorType]
$sel:acceleratorTypes:DescribeAcceleratorTypesResponse' :: DescribeAcceleratorTypesResponse -> Maybe [AcceleratorType]
acceleratorTypes} -> Maybe [AcceleratorType]
acceleratorTypes) (\s :: DescribeAcceleratorTypesResponse
s@DescribeAcceleratorTypesResponse' {} Maybe [AcceleratorType]
a -> DescribeAcceleratorTypesResponse
s {$sel:acceleratorTypes:DescribeAcceleratorTypesResponse' :: Maybe [AcceleratorType]
acceleratorTypes = Maybe [AcceleratorType]
a} :: DescribeAcceleratorTypesResponse) ((Maybe [AcceleratorType] -> f (Maybe [AcceleratorType]))
 -> DescribeAcceleratorTypesResponse
 -> f DescribeAcceleratorTypesResponse)
-> ((Maybe [AcceleratorType] -> f (Maybe [AcceleratorType]))
    -> Maybe [AcceleratorType] -> f (Maybe [AcceleratorType]))
-> (Maybe [AcceleratorType] -> f (Maybe [AcceleratorType]))
-> DescribeAcceleratorTypesResponse
-> f DescribeAcceleratorTypesResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [AcceleratorType]
  [AcceleratorType]
  [AcceleratorType]
  [AcceleratorType]
-> Iso
     (Maybe [AcceleratorType])
     (Maybe [AcceleratorType])
     (Maybe [AcceleratorType])
     (Maybe [AcceleratorType])
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 AnIso
  [AcceleratorType]
  [AcceleratorType]
  [AcceleratorType]
  [AcceleratorType]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance
  Prelude.NFData
    DescribeAcceleratorTypesResponse