{-# 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.Glacier.ListProvisionedCapacity
-- 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)
--
-- This operation lists the provisioned capacity units for the specified
-- AWS account.
module Amazonka.Glacier.ListProvisionedCapacity
  ( -- * Creating a Request
    ListProvisionedCapacity (..),
    newListProvisionedCapacity,

    -- * Request Lenses
    listProvisionedCapacity_accountId,

    -- * Destructuring the Response
    ListProvisionedCapacityResponse (..),
    newListProvisionedCapacityResponse,

    -- * Response Lenses
    listProvisionedCapacityResponse_provisionedCapacityList,
    listProvisionedCapacityResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import Amazonka.Glacier.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:/ 'newListProvisionedCapacity' smart constructor.
data ListProvisionedCapacity = ListProvisionedCapacity'
  { -- | The AWS account ID of the account that owns the vault. You can either
    -- specify an AWS account ID or optionally a single \'-\' (hyphen), in
    -- which case Amazon S3 Glacier uses the AWS account ID associated with the
    -- credentials used to sign the request. If you use an account ID, don\'t
    -- include any hyphens (\'-\') in the ID.
    ListProvisionedCapacity -> Text
accountId :: Prelude.Text
  }
  deriving (ListProvisionedCapacity -> ListProvisionedCapacity -> Bool
(ListProvisionedCapacity -> ListProvisionedCapacity -> Bool)
-> (ListProvisionedCapacity -> ListProvisionedCapacity -> Bool)
-> Eq ListProvisionedCapacity
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListProvisionedCapacity -> ListProvisionedCapacity -> Bool
$c/= :: ListProvisionedCapacity -> ListProvisionedCapacity -> Bool
== :: ListProvisionedCapacity -> ListProvisionedCapacity -> Bool
$c== :: ListProvisionedCapacity -> ListProvisionedCapacity -> Bool
Prelude.Eq, ReadPrec [ListProvisionedCapacity]
ReadPrec ListProvisionedCapacity
Int -> ReadS ListProvisionedCapacity
ReadS [ListProvisionedCapacity]
(Int -> ReadS ListProvisionedCapacity)
-> ReadS [ListProvisionedCapacity]
-> ReadPrec ListProvisionedCapacity
-> ReadPrec [ListProvisionedCapacity]
-> Read ListProvisionedCapacity
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListProvisionedCapacity]
$creadListPrec :: ReadPrec [ListProvisionedCapacity]
readPrec :: ReadPrec ListProvisionedCapacity
$creadPrec :: ReadPrec ListProvisionedCapacity
readList :: ReadS [ListProvisionedCapacity]
$creadList :: ReadS [ListProvisionedCapacity]
readsPrec :: Int -> ReadS ListProvisionedCapacity
$creadsPrec :: Int -> ReadS ListProvisionedCapacity
Prelude.Read, Int -> ListProvisionedCapacity -> ShowS
[ListProvisionedCapacity] -> ShowS
ListProvisionedCapacity -> String
(Int -> ListProvisionedCapacity -> ShowS)
-> (ListProvisionedCapacity -> String)
-> ([ListProvisionedCapacity] -> ShowS)
-> Show ListProvisionedCapacity
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListProvisionedCapacity] -> ShowS
$cshowList :: [ListProvisionedCapacity] -> ShowS
show :: ListProvisionedCapacity -> String
$cshow :: ListProvisionedCapacity -> String
showsPrec :: Int -> ListProvisionedCapacity -> ShowS
$cshowsPrec :: Int -> ListProvisionedCapacity -> ShowS
Prelude.Show, (forall x.
 ListProvisionedCapacity -> Rep ListProvisionedCapacity x)
-> (forall x.
    Rep ListProvisionedCapacity x -> ListProvisionedCapacity)
-> Generic ListProvisionedCapacity
forall x. Rep ListProvisionedCapacity x -> ListProvisionedCapacity
forall x. ListProvisionedCapacity -> Rep ListProvisionedCapacity x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListProvisionedCapacity x -> ListProvisionedCapacity
$cfrom :: forall x. ListProvisionedCapacity -> Rep ListProvisionedCapacity x
Prelude.Generic)

-- |
-- Create a value of 'ListProvisionedCapacity' 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:
--
-- 'accountId', 'listProvisionedCapacity_accountId' - The AWS account ID of the account that owns the vault. You can either
-- specify an AWS account ID or optionally a single \'-\' (hyphen), in
-- which case Amazon S3 Glacier uses the AWS account ID associated with the
-- credentials used to sign the request. If you use an account ID, don\'t
-- include any hyphens (\'-\') in the ID.
newListProvisionedCapacity ::
  -- | 'accountId'
  Prelude.Text ->
  ListProvisionedCapacity
newListProvisionedCapacity :: Text -> ListProvisionedCapacity
newListProvisionedCapacity Text
pAccountId_ =
  ListProvisionedCapacity' :: Text -> ListProvisionedCapacity
ListProvisionedCapacity' {$sel:accountId:ListProvisionedCapacity' :: Text
accountId = Text
pAccountId_}

-- | The AWS account ID of the account that owns the vault. You can either
-- specify an AWS account ID or optionally a single \'-\' (hyphen), in
-- which case Amazon S3 Glacier uses the AWS account ID associated with the
-- credentials used to sign the request. If you use an account ID, don\'t
-- include any hyphens (\'-\') in the ID.
listProvisionedCapacity_accountId :: Lens.Lens' ListProvisionedCapacity Prelude.Text
listProvisionedCapacity_accountId :: (Text -> f Text)
-> ListProvisionedCapacity -> f ListProvisionedCapacity
listProvisionedCapacity_accountId = (ListProvisionedCapacity -> Text)
-> (ListProvisionedCapacity -> Text -> ListProvisionedCapacity)
-> Lens ListProvisionedCapacity ListProvisionedCapacity Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListProvisionedCapacity' {Text
accountId :: Text
$sel:accountId:ListProvisionedCapacity' :: ListProvisionedCapacity -> Text
accountId} -> Text
accountId) (\s :: ListProvisionedCapacity
s@ListProvisionedCapacity' {} Text
a -> ListProvisionedCapacity
s {$sel:accountId:ListProvisionedCapacity' :: Text
accountId = Text
a} :: ListProvisionedCapacity)

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

instance Prelude.NFData ListProvisionedCapacity

instance Core.ToHeaders ListProvisionedCapacity where
  toHeaders :: ListProvisionedCapacity -> ResponseHeaders
toHeaders = ResponseHeaders -> ListProvisionedCapacity -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty

instance Core.ToPath ListProvisionedCapacity where
  toPath :: ListProvisionedCapacity -> ByteString
toPath ListProvisionedCapacity' {Text
accountId :: Text
$sel:accountId:ListProvisionedCapacity' :: ListProvisionedCapacity -> Text
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ByteString
"/", Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
accountId, ByteString
"/provisioned-capacity"]

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

-- | /See:/ 'newListProvisionedCapacityResponse' smart constructor.
data ListProvisionedCapacityResponse = ListProvisionedCapacityResponse'
  { -- | The response body contains the following JSON fields.
    ListProvisionedCapacityResponse
-> Maybe [ProvisionedCapacityDescription]
provisionedCapacityList :: Prelude.Maybe [ProvisionedCapacityDescription],
    -- | The response's http status code.
    ListProvisionedCapacityResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ListProvisionedCapacityResponse
-> ListProvisionedCapacityResponse -> Bool
(ListProvisionedCapacityResponse
 -> ListProvisionedCapacityResponse -> Bool)
-> (ListProvisionedCapacityResponse
    -> ListProvisionedCapacityResponse -> Bool)
-> Eq ListProvisionedCapacityResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListProvisionedCapacityResponse
-> ListProvisionedCapacityResponse -> Bool
$c/= :: ListProvisionedCapacityResponse
-> ListProvisionedCapacityResponse -> Bool
== :: ListProvisionedCapacityResponse
-> ListProvisionedCapacityResponse -> Bool
$c== :: ListProvisionedCapacityResponse
-> ListProvisionedCapacityResponse -> Bool
Prelude.Eq, ReadPrec [ListProvisionedCapacityResponse]
ReadPrec ListProvisionedCapacityResponse
Int -> ReadS ListProvisionedCapacityResponse
ReadS [ListProvisionedCapacityResponse]
(Int -> ReadS ListProvisionedCapacityResponse)
-> ReadS [ListProvisionedCapacityResponse]
-> ReadPrec ListProvisionedCapacityResponse
-> ReadPrec [ListProvisionedCapacityResponse]
-> Read ListProvisionedCapacityResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListProvisionedCapacityResponse]
$creadListPrec :: ReadPrec [ListProvisionedCapacityResponse]
readPrec :: ReadPrec ListProvisionedCapacityResponse
$creadPrec :: ReadPrec ListProvisionedCapacityResponse
readList :: ReadS [ListProvisionedCapacityResponse]
$creadList :: ReadS [ListProvisionedCapacityResponse]
readsPrec :: Int -> ReadS ListProvisionedCapacityResponse
$creadsPrec :: Int -> ReadS ListProvisionedCapacityResponse
Prelude.Read, Int -> ListProvisionedCapacityResponse -> ShowS
[ListProvisionedCapacityResponse] -> ShowS
ListProvisionedCapacityResponse -> String
(Int -> ListProvisionedCapacityResponse -> ShowS)
-> (ListProvisionedCapacityResponse -> String)
-> ([ListProvisionedCapacityResponse] -> ShowS)
-> Show ListProvisionedCapacityResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListProvisionedCapacityResponse] -> ShowS
$cshowList :: [ListProvisionedCapacityResponse] -> ShowS
show :: ListProvisionedCapacityResponse -> String
$cshow :: ListProvisionedCapacityResponse -> String
showsPrec :: Int -> ListProvisionedCapacityResponse -> ShowS
$cshowsPrec :: Int -> ListProvisionedCapacityResponse -> ShowS
Prelude.Show, (forall x.
 ListProvisionedCapacityResponse
 -> Rep ListProvisionedCapacityResponse x)
-> (forall x.
    Rep ListProvisionedCapacityResponse x
    -> ListProvisionedCapacityResponse)
-> Generic ListProvisionedCapacityResponse
forall x.
Rep ListProvisionedCapacityResponse x
-> ListProvisionedCapacityResponse
forall x.
ListProvisionedCapacityResponse
-> Rep ListProvisionedCapacityResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListProvisionedCapacityResponse x
-> ListProvisionedCapacityResponse
$cfrom :: forall x.
ListProvisionedCapacityResponse
-> Rep ListProvisionedCapacityResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListProvisionedCapacityResponse' 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:
--
-- 'provisionedCapacityList', 'listProvisionedCapacityResponse_provisionedCapacityList' - The response body contains the following JSON fields.
--
-- 'httpStatus', 'listProvisionedCapacityResponse_httpStatus' - The response's http status code.
newListProvisionedCapacityResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListProvisionedCapacityResponse
newListProvisionedCapacityResponse :: Int -> ListProvisionedCapacityResponse
newListProvisionedCapacityResponse Int
pHttpStatus_ =
  ListProvisionedCapacityResponse' :: Maybe [ProvisionedCapacityDescription]
-> Int -> ListProvisionedCapacityResponse
ListProvisionedCapacityResponse'
    { $sel:provisionedCapacityList:ListProvisionedCapacityResponse' :: Maybe [ProvisionedCapacityDescription]
provisionedCapacityList =
        Maybe [ProvisionedCapacityDescription]
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListProvisionedCapacityResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The response body contains the following JSON fields.
listProvisionedCapacityResponse_provisionedCapacityList :: Lens.Lens' ListProvisionedCapacityResponse (Prelude.Maybe [ProvisionedCapacityDescription])
listProvisionedCapacityResponse_provisionedCapacityList :: (Maybe [ProvisionedCapacityDescription]
 -> f (Maybe [ProvisionedCapacityDescription]))
-> ListProvisionedCapacityResponse
-> f ListProvisionedCapacityResponse
listProvisionedCapacityResponse_provisionedCapacityList = (ListProvisionedCapacityResponse
 -> Maybe [ProvisionedCapacityDescription])
-> (ListProvisionedCapacityResponse
    -> Maybe [ProvisionedCapacityDescription]
    -> ListProvisionedCapacityResponse)
-> Lens
     ListProvisionedCapacityResponse
     ListProvisionedCapacityResponse
     (Maybe [ProvisionedCapacityDescription])
     (Maybe [ProvisionedCapacityDescription])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListProvisionedCapacityResponse' {Maybe [ProvisionedCapacityDescription]
provisionedCapacityList :: Maybe [ProvisionedCapacityDescription]
$sel:provisionedCapacityList:ListProvisionedCapacityResponse' :: ListProvisionedCapacityResponse
-> Maybe [ProvisionedCapacityDescription]
provisionedCapacityList} -> Maybe [ProvisionedCapacityDescription]
provisionedCapacityList) (\s :: ListProvisionedCapacityResponse
s@ListProvisionedCapacityResponse' {} Maybe [ProvisionedCapacityDescription]
a -> ListProvisionedCapacityResponse
s {$sel:provisionedCapacityList:ListProvisionedCapacityResponse' :: Maybe [ProvisionedCapacityDescription]
provisionedCapacityList = Maybe [ProvisionedCapacityDescription]
a} :: ListProvisionedCapacityResponse) ((Maybe [ProvisionedCapacityDescription]
  -> f (Maybe [ProvisionedCapacityDescription]))
 -> ListProvisionedCapacityResponse
 -> f ListProvisionedCapacityResponse)
-> ((Maybe [ProvisionedCapacityDescription]
     -> f (Maybe [ProvisionedCapacityDescription]))
    -> Maybe [ProvisionedCapacityDescription]
    -> f (Maybe [ProvisionedCapacityDescription]))
-> (Maybe [ProvisionedCapacityDescription]
    -> f (Maybe [ProvisionedCapacityDescription]))
-> ListProvisionedCapacityResponse
-> f ListProvisionedCapacityResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [ProvisionedCapacityDescription]
  [ProvisionedCapacityDescription]
  [ProvisionedCapacityDescription]
  [ProvisionedCapacityDescription]
-> Iso
     (Maybe [ProvisionedCapacityDescription])
     (Maybe [ProvisionedCapacityDescription])
     (Maybe [ProvisionedCapacityDescription])
     (Maybe [ProvisionedCapacityDescription])
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
  [ProvisionedCapacityDescription]
  [ProvisionedCapacityDescription]
  [ProvisionedCapacityDescription]
  [ProvisionedCapacityDescription]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance
  Prelude.NFData
    ListProvisionedCapacityResponse