{-# 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-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)
--
-- 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.Lens as Lens
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
(GetContainerServicePowers -> GetContainerServicePowers -> Bool)
-> (GetContainerServicePowers -> GetContainerServicePowers -> Bool)
-> Eq GetContainerServicePowers
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]
(Int -> ReadS GetContainerServicePowers)
-> ReadS [GetContainerServicePowers]
-> ReadPrec GetContainerServicePowers
-> ReadPrec [GetContainerServicePowers]
-> Read 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
(Int -> GetContainerServicePowers -> ShowS)
-> (GetContainerServicePowers -> String)
-> ([GetContainerServicePowers] -> ShowS)
-> Show GetContainerServicePowers
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.
 GetContainerServicePowers -> Rep GetContainerServicePowers x)
-> (forall x.
    Rep GetContainerServicePowers x -> GetContainerServicePowers)
-> Generic GetContainerServicePowers
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 :: GetContainerServicePowers -> Request GetContainerServicePowers
request = Service
-> GetContainerServicePowers -> Request GetContainerServicePowers
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy GetContainerServicePowers
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse GetContainerServicePowers)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse GetContainerServicePowers))
-> Logger
-> Service
-> Proxy GetContainerServicePowers
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse GetContainerServicePowers)))
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 [ContainerServicePower]
-> Int -> GetContainerServicePowersResponse
GetContainerServicePowersResponse'
            (Maybe [ContainerServicePower]
 -> Int -> GetContainerServicePowersResponse)
-> Either String (Maybe [ContainerServicePower])
-> Either String (Int -> GetContainerServicePowersResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object
-> Key -> Either String (Maybe (Maybe [ContainerServicePower]))
forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Core..?> Key
"powers" Either String (Maybe (Maybe [ContainerServicePower]))
-> Maybe [ContainerServicePower]
-> Either String (Maybe [ContainerServicePower])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [ContainerServicePower]
forall a. Monoid a => a
Prelude.mempty)
            Either String (Int -> GetContainerServicePowersResponse)
-> Either String Int
-> Either String GetContainerServicePowersResponse
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 GetContainerServicePowers

instance Prelude.NFData GetContainerServicePowers

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

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

instance Core.ToQuery GetContainerServicePowers where
  toQuery :: GetContainerServicePowers -> QueryString
toQuery = QueryString -> GetContainerServicePowers -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
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
(GetContainerServicePowersResponse
 -> GetContainerServicePowersResponse -> Bool)
-> (GetContainerServicePowersResponse
    -> GetContainerServicePowersResponse -> Bool)
-> Eq GetContainerServicePowersResponse
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]
(Int -> ReadS GetContainerServicePowersResponse)
-> ReadS [GetContainerServicePowersResponse]
-> ReadPrec GetContainerServicePowersResponse
-> ReadPrec [GetContainerServicePowersResponse]
-> Read 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
(Int -> GetContainerServicePowersResponse -> ShowS)
-> (GetContainerServicePowersResponse -> String)
-> ([GetContainerServicePowersResponse] -> ShowS)
-> Show GetContainerServicePowersResponse
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.
 GetContainerServicePowersResponse
 -> Rep GetContainerServicePowersResponse x)
-> (forall x.
    Rep GetContainerServicePowersResponse x
    -> GetContainerServicePowersResponse)
-> Generic GetContainerServicePowersResponse
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' :: Maybe [ContainerServicePower]
-> Int -> GetContainerServicePowersResponse
GetContainerServicePowersResponse'
    { $sel:powers:GetContainerServicePowersResponse' :: Maybe [ContainerServicePower]
powers =
        Maybe [ContainerServicePower]
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 :: (Maybe [ContainerServicePower]
 -> f (Maybe [ContainerServicePower]))
-> GetContainerServicePowersResponse
-> f GetContainerServicePowersResponse
getContainerServicePowersResponse_powers = (GetContainerServicePowersResponse
 -> Maybe [ContainerServicePower])
-> (GetContainerServicePowersResponse
    -> Maybe [ContainerServicePower]
    -> GetContainerServicePowersResponse)
-> Lens
     GetContainerServicePowersResponse
     GetContainerServicePowersResponse
     (Maybe [ContainerServicePower])
     (Maybe [ContainerServicePower])
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) ((Maybe [ContainerServicePower]
  -> f (Maybe [ContainerServicePower]))
 -> GetContainerServicePowersResponse
 -> f GetContainerServicePowersResponse)
-> ((Maybe [ContainerServicePower]
     -> f (Maybe [ContainerServicePower]))
    -> Maybe [ContainerServicePower]
    -> f (Maybe [ContainerServicePower]))
-> (Maybe [ContainerServicePower]
    -> f (Maybe [ContainerServicePower]))
-> GetContainerServicePowersResponse
-> f GetContainerServicePowersResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [ContainerServicePower]
  [ContainerServicePower]
  [ContainerServicePower]
  [ContainerServicePower]
-> Iso
     (Maybe [ContainerServicePower])
     (Maybe [ContainerServicePower])
     (Maybe [ContainerServicePower])
     (Maybe [ContainerServicePower])
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
  [ContainerServicePower]
  [ContainerServicePower]
  [ContainerServicePower]
  [ContainerServicePower]
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 :: (Int -> f Int)
-> GetContainerServicePowersResponse
-> f GetContainerServicePowersResponse
getContainerServicePowersResponse_httpStatus = (GetContainerServicePowersResponse -> Int)
-> (GetContainerServicePowersResponse
    -> Int -> GetContainerServicePowersResponse)
-> Lens
     GetContainerServicePowersResponse
     GetContainerServicePowersResponse
     Int
     Int
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