{-# 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.GetContainerAPIMetadata
-- 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 information about Amazon Lightsail containers, such as the
-- current version of the Lightsail Control (lightsailctl) plugin.
module Amazonka.Lightsail.GetContainerAPIMetadata
  ( -- * Creating a Request
    GetContainerAPIMetadata (..),
    newGetContainerAPIMetadata,

    -- * Destructuring the Response
    GetContainerAPIMetadataResponse (..),
    newGetContainerAPIMetadataResponse,

    -- * Response Lenses
    getContainerAPIMetadataResponse_metadata,
    getContainerAPIMetadataResponse_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:/ 'newGetContainerAPIMetadata' smart constructor.
data GetContainerAPIMetadata = GetContainerAPIMetadata'
  {
  }
  deriving (GetContainerAPIMetadata -> GetContainerAPIMetadata -> Bool
(GetContainerAPIMetadata -> GetContainerAPIMetadata -> Bool)
-> (GetContainerAPIMetadata -> GetContainerAPIMetadata -> Bool)
-> Eq GetContainerAPIMetadata
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetContainerAPIMetadata -> GetContainerAPIMetadata -> Bool
$c/= :: GetContainerAPIMetadata -> GetContainerAPIMetadata -> Bool
== :: GetContainerAPIMetadata -> GetContainerAPIMetadata -> Bool
$c== :: GetContainerAPIMetadata -> GetContainerAPIMetadata -> Bool
Prelude.Eq, ReadPrec [GetContainerAPIMetadata]
ReadPrec GetContainerAPIMetadata
Int -> ReadS GetContainerAPIMetadata
ReadS [GetContainerAPIMetadata]
(Int -> ReadS GetContainerAPIMetadata)
-> ReadS [GetContainerAPIMetadata]
-> ReadPrec GetContainerAPIMetadata
-> ReadPrec [GetContainerAPIMetadata]
-> Read GetContainerAPIMetadata
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetContainerAPIMetadata]
$creadListPrec :: ReadPrec [GetContainerAPIMetadata]
readPrec :: ReadPrec GetContainerAPIMetadata
$creadPrec :: ReadPrec GetContainerAPIMetadata
readList :: ReadS [GetContainerAPIMetadata]
$creadList :: ReadS [GetContainerAPIMetadata]
readsPrec :: Int -> ReadS GetContainerAPIMetadata
$creadsPrec :: Int -> ReadS GetContainerAPIMetadata
Prelude.Read, Int -> GetContainerAPIMetadata -> ShowS
[GetContainerAPIMetadata] -> ShowS
GetContainerAPIMetadata -> String
(Int -> GetContainerAPIMetadata -> ShowS)
-> (GetContainerAPIMetadata -> String)
-> ([GetContainerAPIMetadata] -> ShowS)
-> Show GetContainerAPIMetadata
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetContainerAPIMetadata] -> ShowS
$cshowList :: [GetContainerAPIMetadata] -> ShowS
show :: GetContainerAPIMetadata -> String
$cshow :: GetContainerAPIMetadata -> String
showsPrec :: Int -> GetContainerAPIMetadata -> ShowS
$cshowsPrec :: Int -> GetContainerAPIMetadata -> ShowS
Prelude.Show, (forall x.
 GetContainerAPIMetadata -> Rep GetContainerAPIMetadata x)
-> (forall x.
    Rep GetContainerAPIMetadata x -> GetContainerAPIMetadata)
-> Generic GetContainerAPIMetadata
forall x. Rep GetContainerAPIMetadata x -> GetContainerAPIMetadata
forall x. GetContainerAPIMetadata -> Rep GetContainerAPIMetadata x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetContainerAPIMetadata x -> GetContainerAPIMetadata
$cfrom :: forall x. GetContainerAPIMetadata -> Rep GetContainerAPIMetadata x
Prelude.Generic)

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

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

instance Prelude.NFData GetContainerAPIMetadata

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

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

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

-- | /See:/ 'newGetContainerAPIMetadataResponse' smart constructor.
data GetContainerAPIMetadataResponse = GetContainerAPIMetadataResponse'
  { -- | Metadata about Lightsail containers, such as the current version of the
    -- Lightsail Control (lightsailctl) plugin.
    GetContainerAPIMetadataResponse -> Maybe [HashMap Text Text]
metadata :: Prelude.Maybe [Prelude.HashMap Prelude.Text Prelude.Text],
    -- | The response's http status code.
    GetContainerAPIMetadataResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (GetContainerAPIMetadataResponse
-> GetContainerAPIMetadataResponse -> Bool
(GetContainerAPIMetadataResponse
 -> GetContainerAPIMetadataResponse -> Bool)
-> (GetContainerAPIMetadataResponse
    -> GetContainerAPIMetadataResponse -> Bool)
-> Eq GetContainerAPIMetadataResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetContainerAPIMetadataResponse
-> GetContainerAPIMetadataResponse -> Bool
$c/= :: GetContainerAPIMetadataResponse
-> GetContainerAPIMetadataResponse -> Bool
== :: GetContainerAPIMetadataResponse
-> GetContainerAPIMetadataResponse -> Bool
$c== :: GetContainerAPIMetadataResponse
-> GetContainerAPIMetadataResponse -> Bool
Prelude.Eq, ReadPrec [GetContainerAPIMetadataResponse]
ReadPrec GetContainerAPIMetadataResponse
Int -> ReadS GetContainerAPIMetadataResponse
ReadS [GetContainerAPIMetadataResponse]
(Int -> ReadS GetContainerAPIMetadataResponse)
-> ReadS [GetContainerAPIMetadataResponse]
-> ReadPrec GetContainerAPIMetadataResponse
-> ReadPrec [GetContainerAPIMetadataResponse]
-> Read GetContainerAPIMetadataResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetContainerAPIMetadataResponse]
$creadListPrec :: ReadPrec [GetContainerAPIMetadataResponse]
readPrec :: ReadPrec GetContainerAPIMetadataResponse
$creadPrec :: ReadPrec GetContainerAPIMetadataResponse
readList :: ReadS [GetContainerAPIMetadataResponse]
$creadList :: ReadS [GetContainerAPIMetadataResponse]
readsPrec :: Int -> ReadS GetContainerAPIMetadataResponse
$creadsPrec :: Int -> ReadS GetContainerAPIMetadataResponse
Prelude.Read, Int -> GetContainerAPIMetadataResponse -> ShowS
[GetContainerAPIMetadataResponse] -> ShowS
GetContainerAPIMetadataResponse -> String
(Int -> GetContainerAPIMetadataResponse -> ShowS)
-> (GetContainerAPIMetadataResponse -> String)
-> ([GetContainerAPIMetadataResponse] -> ShowS)
-> Show GetContainerAPIMetadataResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetContainerAPIMetadataResponse] -> ShowS
$cshowList :: [GetContainerAPIMetadataResponse] -> ShowS
show :: GetContainerAPIMetadataResponse -> String
$cshow :: GetContainerAPIMetadataResponse -> String
showsPrec :: Int -> GetContainerAPIMetadataResponse -> ShowS
$cshowsPrec :: Int -> GetContainerAPIMetadataResponse -> ShowS
Prelude.Show, (forall x.
 GetContainerAPIMetadataResponse
 -> Rep GetContainerAPIMetadataResponse x)
-> (forall x.
    Rep GetContainerAPIMetadataResponse x
    -> GetContainerAPIMetadataResponse)
-> Generic GetContainerAPIMetadataResponse
forall x.
Rep GetContainerAPIMetadataResponse x
-> GetContainerAPIMetadataResponse
forall x.
GetContainerAPIMetadataResponse
-> Rep GetContainerAPIMetadataResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetContainerAPIMetadataResponse x
-> GetContainerAPIMetadataResponse
$cfrom :: forall x.
GetContainerAPIMetadataResponse
-> Rep GetContainerAPIMetadataResponse x
Prelude.Generic)

-- |
-- Create a value of 'GetContainerAPIMetadataResponse' 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:
--
-- 'metadata', 'getContainerAPIMetadataResponse_metadata' - Metadata about Lightsail containers, such as the current version of the
-- Lightsail Control (lightsailctl) plugin.
--
-- 'httpStatus', 'getContainerAPIMetadataResponse_httpStatus' - The response's http status code.
newGetContainerAPIMetadataResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetContainerAPIMetadataResponse
newGetContainerAPIMetadataResponse :: Int -> GetContainerAPIMetadataResponse
newGetContainerAPIMetadataResponse Int
pHttpStatus_ =
  GetContainerAPIMetadataResponse' :: Maybe [HashMap Text Text] -> Int -> GetContainerAPIMetadataResponse
GetContainerAPIMetadataResponse'
    { $sel:metadata:GetContainerAPIMetadataResponse' :: Maybe [HashMap Text Text]
metadata =
        Maybe [HashMap Text Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:GetContainerAPIMetadataResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | Metadata about Lightsail containers, such as the current version of the
-- Lightsail Control (lightsailctl) plugin.
getContainerAPIMetadataResponse_metadata :: Lens.Lens' GetContainerAPIMetadataResponse (Prelude.Maybe [Prelude.HashMap Prelude.Text Prelude.Text])
getContainerAPIMetadataResponse_metadata :: (Maybe [HashMap Text Text] -> f (Maybe [HashMap Text Text]))
-> GetContainerAPIMetadataResponse
-> f GetContainerAPIMetadataResponse
getContainerAPIMetadataResponse_metadata = (GetContainerAPIMetadataResponse -> Maybe [HashMap Text Text])
-> (GetContainerAPIMetadataResponse
    -> Maybe [HashMap Text Text] -> GetContainerAPIMetadataResponse)
-> Lens
     GetContainerAPIMetadataResponse
     GetContainerAPIMetadataResponse
     (Maybe [HashMap Text Text])
     (Maybe [HashMap Text Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetContainerAPIMetadataResponse' {Maybe [HashMap Text Text]
metadata :: Maybe [HashMap Text Text]
$sel:metadata:GetContainerAPIMetadataResponse' :: GetContainerAPIMetadataResponse -> Maybe [HashMap Text Text]
metadata} -> Maybe [HashMap Text Text]
metadata) (\s :: GetContainerAPIMetadataResponse
s@GetContainerAPIMetadataResponse' {} Maybe [HashMap Text Text]
a -> GetContainerAPIMetadataResponse
s {$sel:metadata:GetContainerAPIMetadataResponse' :: Maybe [HashMap Text Text]
metadata = Maybe [HashMap Text Text]
a} :: GetContainerAPIMetadataResponse) ((Maybe [HashMap Text Text] -> f (Maybe [HashMap Text Text]))
 -> GetContainerAPIMetadataResponse
 -> f GetContainerAPIMetadataResponse)
-> ((Maybe [HashMap Text Text] -> f (Maybe [HashMap Text Text]))
    -> Maybe [HashMap Text Text] -> f (Maybe [HashMap Text Text]))
-> (Maybe [HashMap Text Text] -> f (Maybe [HashMap Text Text]))
-> GetContainerAPIMetadataResponse
-> f GetContainerAPIMetadataResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [HashMap Text Text]
  [HashMap Text Text]
  [HashMap Text Text]
  [HashMap Text Text]
-> Iso
     (Maybe [HashMap Text Text])
     (Maybe [HashMap Text Text])
     (Maybe [HashMap Text Text])
     (Maybe [HashMap Text Text])
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
  [HashMap Text Text]
  [HashMap Text Text]
  [HashMap Text Text]
  [HashMap Text Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance
  Prelude.NFData
    GetContainerAPIMetadataResponse