{-# 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.Lightsail.GetContainerServicePowers
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Returns the list of powers that can be specified for your Amazon
-- Lightsail container services.
--
-- The power specifies the amount of memory, the number of vCPUs, and the
-- base price of the container service.
module Amazonka.Lightsail.GetContainerServicePowers
  ( -- * Creating a Request
    GetContainerServicePowers (..),
    newGetContainerServicePowers,

    -- * Destructuring the Response
    GetContainerServicePowersResponse (..),
    newGetContainerServicePowersResponse,

    -- * Response Lenses
    getContainerServicePowersResponse_powers,
    getContainerServicePowersResponse_httpStatus,
  )
where

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

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

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

instance Core.AWSRequest GetContainerServicePowers where
  type
    AWSResponse GetContainerServicePowers =
      GetContainerServicePowersResponse
  request :: (Service -> Service)
-> GetContainerServicePowers -> Request GetContainerServicePowers
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 GetContainerServicePowers
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse GetContainerServicePowers)))
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 [ContainerServicePower]
-> Int -> GetContainerServicePowersResponse
GetContainerServicePowersResponse'
            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
"powers" 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.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

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

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

instance Data.ToHeaders GetContainerServicePowers where
  toHeaders :: GetContainerServicePowers -> 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
"Lightsail_20161128.GetContainerServicePowers" ::
                          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 GetContainerServicePowers where
  toJSON :: GetContainerServicePowers -> Value
toJSON = forall a b. a -> b -> a
Prelude.const (Object -> Value
Data.Object forall a. Monoid a => a
Prelude.mempty)

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

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

-- | /See:/ 'newGetContainerServicePowersResponse' smart constructor.
data GetContainerServicePowersResponse = GetContainerServicePowersResponse'
  { -- | An array of objects that describe the powers that can be specified for a
    -- container service.
    GetContainerServicePowersResponse -> Maybe [ContainerServicePower]
powers :: Prelude.Maybe [ContainerServicePower],
    -- | The response's http status code.
    GetContainerServicePowersResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (GetContainerServicePowersResponse
-> GetContainerServicePowersResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetContainerServicePowersResponse
-> GetContainerServicePowersResponse -> Bool
$c/= :: GetContainerServicePowersResponse
-> GetContainerServicePowersResponse -> Bool
== :: GetContainerServicePowersResponse
-> GetContainerServicePowersResponse -> Bool
$c== :: GetContainerServicePowersResponse
-> GetContainerServicePowersResponse -> Bool
Prelude.Eq, ReadPrec [GetContainerServicePowersResponse]
ReadPrec GetContainerServicePowersResponse
Int -> ReadS GetContainerServicePowersResponse
ReadS [GetContainerServicePowersResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetContainerServicePowersResponse]
$creadListPrec :: ReadPrec [GetContainerServicePowersResponse]
readPrec :: ReadPrec GetContainerServicePowersResponse
$creadPrec :: ReadPrec GetContainerServicePowersResponse
readList :: ReadS [GetContainerServicePowersResponse]
$creadList :: ReadS [GetContainerServicePowersResponse]
readsPrec :: Int -> ReadS GetContainerServicePowersResponse
$creadsPrec :: Int -> ReadS GetContainerServicePowersResponse
Prelude.Read, Int -> GetContainerServicePowersResponse -> ShowS
[GetContainerServicePowersResponse] -> ShowS
GetContainerServicePowersResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetContainerServicePowersResponse] -> ShowS
$cshowList :: [GetContainerServicePowersResponse] -> ShowS
show :: GetContainerServicePowersResponse -> String
$cshow :: GetContainerServicePowersResponse -> String
showsPrec :: Int -> GetContainerServicePowersResponse -> ShowS
$cshowsPrec :: Int -> GetContainerServicePowersResponse -> ShowS
Prelude.Show, forall x.
Rep GetContainerServicePowersResponse x
-> GetContainerServicePowersResponse
forall x.
GetContainerServicePowersResponse
-> Rep GetContainerServicePowersResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetContainerServicePowersResponse x
-> GetContainerServicePowersResponse
$cfrom :: forall x.
GetContainerServicePowersResponse
-> Rep GetContainerServicePowersResponse x
Prelude.Generic)

-- |
-- Create a value of 'GetContainerServicePowersResponse' 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:
--
-- 'powers', 'getContainerServicePowersResponse_powers' - An array of objects that describe the powers that can be specified for a
-- container service.
--
-- 'httpStatus', 'getContainerServicePowersResponse_httpStatus' - The response's http status code.
newGetContainerServicePowersResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetContainerServicePowersResponse
newGetContainerServicePowersResponse :: Int -> GetContainerServicePowersResponse
newGetContainerServicePowersResponse Int
pHttpStatus_ =
  GetContainerServicePowersResponse'
    { $sel:powers:GetContainerServicePowersResponse' :: Maybe [ContainerServicePower]
powers =
        forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:GetContainerServicePowersResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | An array of objects that describe the powers that can be specified for a
-- container service.
getContainerServicePowersResponse_powers :: Lens.Lens' GetContainerServicePowersResponse (Prelude.Maybe [ContainerServicePower])
getContainerServicePowersResponse_powers :: Lens'
  GetContainerServicePowersResponse (Maybe [ContainerServicePower])
getContainerServicePowersResponse_powers = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetContainerServicePowersResponse' {Maybe [ContainerServicePower]
powers :: Maybe [ContainerServicePower]
$sel:powers:GetContainerServicePowersResponse' :: GetContainerServicePowersResponse -> Maybe [ContainerServicePower]
powers} -> Maybe [ContainerServicePower]
powers) (\s :: GetContainerServicePowersResponse
s@GetContainerServicePowersResponse' {} Maybe [ContainerServicePower]
a -> GetContainerServicePowersResponse
s {$sel:powers:GetContainerServicePowersResponse' :: Maybe [ContainerServicePower]
powers = Maybe [ContainerServicePower]
a} :: GetContainerServicePowersResponse) 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 response's http status code.
getContainerServicePowersResponse_httpStatus :: Lens.Lens' GetContainerServicePowersResponse Prelude.Int
getContainerServicePowersResponse_httpStatus :: Lens' GetContainerServicePowersResponse Int
getContainerServicePowersResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetContainerServicePowersResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetContainerServicePowersResponse' :: GetContainerServicePowersResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetContainerServicePowersResponse
s@GetContainerServicePowersResponse' {} Int
a -> GetContainerServicePowersResponse
s {$sel:httpStatus:GetContainerServicePowersResponse' :: Int
httpStatus = Int
a} :: GetContainerServicePowersResponse)

instance
  Prelude.NFData
    GetContainerServicePowersResponse
  where
  rnf :: GetContainerServicePowersResponse -> ()
rnf GetContainerServicePowersResponse' {Int
Maybe [ContainerServicePower]
httpStatus :: Int
powers :: Maybe [ContainerServicePower]
$sel:httpStatus:GetContainerServicePowersResponse' :: GetContainerServicePowersResponse -> Int
$sel:powers:GetContainerServicePowersResponse' :: GetContainerServicePowersResponse -> Maybe [ContainerServicePower]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [ContainerServicePower]
powers
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus