{-# 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.Snowball.GetSnowballUsage
-- 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 the Snow Family service limit for your
-- account, and also the number of Snow devices your account has in use.
--
-- The default service limit for the number of Snow devices that you can
-- have at one time is 1. If you want to increase your service limit,
-- contact AWS Support.
module Amazonka.Snowball.GetSnowballUsage
  ( -- * Creating a Request
    GetSnowballUsage (..),
    newGetSnowballUsage,

    -- * Destructuring the Response
    GetSnowballUsageResponse (..),
    newGetSnowballUsageResponse,

    -- * Response Lenses
    getSnowballUsageResponse_snowballsInUse,
    getSnowballUsageResponse_snowballLimit,
    getSnowballUsageResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
import Amazonka.Snowball.Types

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

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

instance Core.AWSRequest GetSnowballUsage where
  type
    AWSResponse GetSnowballUsage =
      GetSnowballUsageResponse
  request :: GetSnowballUsage -> Request GetSnowballUsage
request = Service -> GetSnowballUsage -> Request GetSnowballUsage
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy GetSnowballUsage
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetSnowballUsage)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse GetSnowballUsage))
-> Logger
-> Service
-> Proxy GetSnowballUsage
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetSnowballUsage)))
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 Int -> Maybe Int -> Int -> GetSnowballUsageResponse
GetSnowballUsageResponse'
            (Maybe Int -> Maybe Int -> Int -> GetSnowballUsageResponse)
-> Either String (Maybe Int)
-> Either String (Maybe Int -> Int -> GetSnowballUsageResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Key -> Either String (Maybe Int)
forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Core..?> Key
"SnowballsInUse")
            Either String (Maybe Int -> Int -> GetSnowballUsageResponse)
-> Either String (Maybe Int)
-> Either String (Int -> GetSnowballUsageResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Key -> Either String (Maybe Int)
forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Core..?> Key
"SnowballLimit")
            Either String (Int -> GetSnowballUsageResponse)
-> Either String Int -> Either String GetSnowballUsageResponse
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 GetSnowballUsage

instance Prelude.NFData GetSnowballUsage

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

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

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

-- | /See:/ 'newGetSnowballUsageResponse' smart constructor.
data GetSnowballUsageResponse = GetSnowballUsageResponse'
  { -- | The number of Snow devices that this account is currently using.
    GetSnowballUsageResponse -> Maybe Int
snowballsInUse :: Prelude.Maybe Prelude.Int,
    -- | The service limit for number of Snow devices this account can have at
    -- once. The default service limit is 1 (one).
    GetSnowballUsageResponse -> Maybe Int
snowballLimit :: Prelude.Maybe Prelude.Int,
    -- | The response's http status code.
    GetSnowballUsageResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (GetSnowballUsageResponse -> GetSnowballUsageResponse -> Bool
(GetSnowballUsageResponse -> GetSnowballUsageResponse -> Bool)
-> (GetSnowballUsageResponse -> GetSnowballUsageResponse -> Bool)
-> Eq GetSnowballUsageResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetSnowballUsageResponse -> GetSnowballUsageResponse -> Bool
$c/= :: GetSnowballUsageResponse -> GetSnowballUsageResponse -> Bool
== :: GetSnowballUsageResponse -> GetSnowballUsageResponse -> Bool
$c== :: GetSnowballUsageResponse -> GetSnowballUsageResponse -> Bool
Prelude.Eq, ReadPrec [GetSnowballUsageResponse]
ReadPrec GetSnowballUsageResponse
Int -> ReadS GetSnowballUsageResponse
ReadS [GetSnowballUsageResponse]
(Int -> ReadS GetSnowballUsageResponse)
-> ReadS [GetSnowballUsageResponse]
-> ReadPrec GetSnowballUsageResponse
-> ReadPrec [GetSnowballUsageResponse]
-> Read GetSnowballUsageResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetSnowballUsageResponse]
$creadListPrec :: ReadPrec [GetSnowballUsageResponse]
readPrec :: ReadPrec GetSnowballUsageResponse
$creadPrec :: ReadPrec GetSnowballUsageResponse
readList :: ReadS [GetSnowballUsageResponse]
$creadList :: ReadS [GetSnowballUsageResponse]
readsPrec :: Int -> ReadS GetSnowballUsageResponse
$creadsPrec :: Int -> ReadS GetSnowballUsageResponse
Prelude.Read, Int -> GetSnowballUsageResponse -> ShowS
[GetSnowballUsageResponse] -> ShowS
GetSnowballUsageResponse -> String
(Int -> GetSnowballUsageResponse -> ShowS)
-> (GetSnowballUsageResponse -> String)
-> ([GetSnowballUsageResponse] -> ShowS)
-> Show GetSnowballUsageResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetSnowballUsageResponse] -> ShowS
$cshowList :: [GetSnowballUsageResponse] -> ShowS
show :: GetSnowballUsageResponse -> String
$cshow :: GetSnowballUsageResponse -> String
showsPrec :: Int -> GetSnowballUsageResponse -> ShowS
$cshowsPrec :: Int -> GetSnowballUsageResponse -> ShowS
Prelude.Show, (forall x.
 GetSnowballUsageResponse -> Rep GetSnowballUsageResponse x)
-> (forall x.
    Rep GetSnowballUsageResponse x -> GetSnowballUsageResponse)
-> Generic GetSnowballUsageResponse
forall x.
Rep GetSnowballUsageResponse x -> GetSnowballUsageResponse
forall x.
GetSnowballUsageResponse -> Rep GetSnowballUsageResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetSnowballUsageResponse x -> GetSnowballUsageResponse
$cfrom :: forall x.
GetSnowballUsageResponse -> Rep GetSnowballUsageResponse x
Prelude.Generic)

-- |
-- Create a value of 'GetSnowballUsageResponse' 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:
--
-- 'snowballsInUse', 'getSnowballUsageResponse_snowballsInUse' - The number of Snow devices that this account is currently using.
--
-- 'snowballLimit', 'getSnowballUsageResponse_snowballLimit' - The service limit for number of Snow devices this account can have at
-- once. The default service limit is 1 (one).
--
-- 'httpStatus', 'getSnowballUsageResponse_httpStatus' - The response's http status code.
newGetSnowballUsageResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetSnowballUsageResponse
newGetSnowballUsageResponse :: Int -> GetSnowballUsageResponse
newGetSnowballUsageResponse Int
pHttpStatus_ =
  GetSnowballUsageResponse' :: Maybe Int -> Maybe Int -> Int -> GetSnowballUsageResponse
GetSnowballUsageResponse'
    { $sel:snowballsInUse:GetSnowballUsageResponse' :: Maybe Int
snowballsInUse =
        Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:snowballLimit:GetSnowballUsageResponse' :: Maybe Int
snowballLimit = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:GetSnowballUsageResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The number of Snow devices that this account is currently using.
getSnowballUsageResponse_snowballsInUse :: Lens.Lens' GetSnowballUsageResponse (Prelude.Maybe Prelude.Int)
getSnowballUsageResponse_snowballsInUse :: (Maybe Int -> f (Maybe Int))
-> GetSnowballUsageResponse -> f GetSnowballUsageResponse
getSnowballUsageResponse_snowballsInUse = (GetSnowballUsageResponse -> Maybe Int)
-> (GetSnowballUsageResponse
    -> Maybe Int -> GetSnowballUsageResponse)
-> Lens
     GetSnowballUsageResponse
     GetSnowballUsageResponse
     (Maybe Int)
     (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetSnowballUsageResponse' {Maybe Int
snowballsInUse :: Maybe Int
$sel:snowballsInUse:GetSnowballUsageResponse' :: GetSnowballUsageResponse -> Maybe Int
snowballsInUse} -> Maybe Int
snowballsInUse) (\s :: GetSnowballUsageResponse
s@GetSnowballUsageResponse' {} Maybe Int
a -> GetSnowballUsageResponse
s {$sel:snowballsInUse:GetSnowballUsageResponse' :: Maybe Int
snowballsInUse = Maybe Int
a} :: GetSnowballUsageResponse)

-- | The service limit for number of Snow devices this account can have at
-- once. The default service limit is 1 (one).
getSnowballUsageResponse_snowballLimit :: Lens.Lens' GetSnowballUsageResponse (Prelude.Maybe Prelude.Int)
getSnowballUsageResponse_snowballLimit :: (Maybe Int -> f (Maybe Int))
-> GetSnowballUsageResponse -> f GetSnowballUsageResponse
getSnowballUsageResponse_snowballLimit = (GetSnowballUsageResponse -> Maybe Int)
-> (GetSnowballUsageResponse
    -> Maybe Int -> GetSnowballUsageResponse)
-> Lens
     GetSnowballUsageResponse
     GetSnowballUsageResponse
     (Maybe Int)
     (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetSnowballUsageResponse' {Maybe Int
snowballLimit :: Maybe Int
$sel:snowballLimit:GetSnowballUsageResponse' :: GetSnowballUsageResponse -> Maybe Int
snowballLimit} -> Maybe Int
snowballLimit) (\s :: GetSnowballUsageResponse
s@GetSnowballUsageResponse' {} Maybe Int
a -> GetSnowballUsageResponse
s {$sel:snowballLimit:GetSnowballUsageResponse' :: Maybe Int
snowballLimit = Maybe Int
a} :: GetSnowballUsageResponse)

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

instance Prelude.NFData GetSnowballUsageResponse