{-# 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.MacieV2.GetInvitationsCount
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Retrieves the count of Amazon Macie membership invitations that were
-- received by an account.
module Amazonka.MacieV2.GetInvitationsCount
  ( -- * Creating a Request
    GetInvitationsCount (..),
    newGetInvitationsCount,

    -- * Destructuring the Response
    GetInvitationsCountResponse (..),
    newGetInvitationsCountResponse,

    -- * Response Lenses
    getInvitationsCountResponse_invitationsCount,
    getInvitationsCountResponse_httpStatus,
  )
where

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

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

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

instance Core.AWSRequest GetInvitationsCount where
  type
    AWSResponse GetInvitationsCount =
      GetInvitationsCountResponse
  request :: (Service -> Service)
-> GetInvitationsCount -> Request GetInvitationsCount
request Service -> Service
overrides =
    forall a. ToRequest a => Service -> a -> Request a
Request.get (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy GetInvitationsCount
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse GetInvitationsCount)))
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 Integer -> Int -> GetInvitationsCountResponse
GetInvitationsCountResponse'
            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
"invitationsCount")
            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 GetInvitationsCount where
  hashWithSalt :: Int -> GetInvitationsCount -> Int
hashWithSalt Int
_salt GetInvitationsCount
_ =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` ()

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

instance Data.ToHeaders GetInvitationsCount where
  toHeaders :: GetInvitationsCount -> ResponseHeaders
toHeaders =
    forall a b. a -> b -> a
Prelude.const
      ( forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"Content-Type"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

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

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

-- | /See:/ 'newGetInvitationsCountResponse' smart constructor.
data GetInvitationsCountResponse = GetInvitationsCountResponse'
  { -- | The total number of invitations that were received by the account, not
    -- including the currently accepted invitation.
    GetInvitationsCountResponse -> Maybe Integer
invitationsCount :: Prelude.Maybe Prelude.Integer,
    -- | The response's http status code.
    GetInvitationsCountResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (GetInvitationsCountResponse -> GetInvitationsCountResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetInvitationsCountResponse -> GetInvitationsCountResponse -> Bool
$c/= :: GetInvitationsCountResponse -> GetInvitationsCountResponse -> Bool
== :: GetInvitationsCountResponse -> GetInvitationsCountResponse -> Bool
$c== :: GetInvitationsCountResponse -> GetInvitationsCountResponse -> Bool
Prelude.Eq, ReadPrec [GetInvitationsCountResponse]
ReadPrec GetInvitationsCountResponse
Int -> ReadS GetInvitationsCountResponse
ReadS [GetInvitationsCountResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetInvitationsCountResponse]
$creadListPrec :: ReadPrec [GetInvitationsCountResponse]
readPrec :: ReadPrec GetInvitationsCountResponse
$creadPrec :: ReadPrec GetInvitationsCountResponse
readList :: ReadS [GetInvitationsCountResponse]
$creadList :: ReadS [GetInvitationsCountResponse]
readsPrec :: Int -> ReadS GetInvitationsCountResponse
$creadsPrec :: Int -> ReadS GetInvitationsCountResponse
Prelude.Read, Int -> GetInvitationsCountResponse -> ShowS
[GetInvitationsCountResponse] -> ShowS
GetInvitationsCountResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetInvitationsCountResponse] -> ShowS
$cshowList :: [GetInvitationsCountResponse] -> ShowS
show :: GetInvitationsCountResponse -> String
$cshow :: GetInvitationsCountResponse -> String
showsPrec :: Int -> GetInvitationsCountResponse -> ShowS
$cshowsPrec :: Int -> GetInvitationsCountResponse -> ShowS
Prelude.Show, forall x.
Rep GetInvitationsCountResponse x -> GetInvitationsCountResponse
forall x.
GetInvitationsCountResponse -> Rep GetInvitationsCountResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetInvitationsCountResponse x -> GetInvitationsCountResponse
$cfrom :: forall x.
GetInvitationsCountResponse -> Rep GetInvitationsCountResponse x
Prelude.Generic)

-- |
-- Create a value of 'GetInvitationsCountResponse' 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:
--
-- 'invitationsCount', 'getInvitationsCountResponse_invitationsCount' - The total number of invitations that were received by the account, not
-- including the currently accepted invitation.
--
-- 'httpStatus', 'getInvitationsCountResponse_httpStatus' - The response's http status code.
newGetInvitationsCountResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetInvitationsCountResponse
newGetInvitationsCountResponse :: Int -> GetInvitationsCountResponse
newGetInvitationsCountResponse Int
pHttpStatus_ =
  GetInvitationsCountResponse'
    { $sel:invitationsCount:GetInvitationsCountResponse' :: Maybe Integer
invitationsCount =
        forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:GetInvitationsCountResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The total number of invitations that were received by the account, not
-- including the currently accepted invitation.
getInvitationsCountResponse_invitationsCount :: Lens.Lens' GetInvitationsCountResponse (Prelude.Maybe Prelude.Integer)
getInvitationsCountResponse_invitationsCount :: Lens' GetInvitationsCountResponse (Maybe Integer)
getInvitationsCountResponse_invitationsCount = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetInvitationsCountResponse' {Maybe Integer
invitationsCount :: Maybe Integer
$sel:invitationsCount:GetInvitationsCountResponse' :: GetInvitationsCountResponse -> Maybe Integer
invitationsCount} -> Maybe Integer
invitationsCount) (\s :: GetInvitationsCountResponse
s@GetInvitationsCountResponse' {} Maybe Integer
a -> GetInvitationsCountResponse
s {$sel:invitationsCount:GetInvitationsCountResponse' :: Maybe Integer
invitationsCount = Maybe Integer
a} :: GetInvitationsCountResponse)

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

instance Prelude.NFData GetInvitationsCountResponse where
  rnf :: GetInvitationsCountResponse -> ()
rnf GetInvitationsCountResponse' {Int
Maybe Integer
httpStatus :: Int
invitationsCount :: Maybe Integer
$sel:httpStatus:GetInvitationsCountResponse' :: GetInvitationsCountResponse -> Int
$sel:invitationsCount:GetInvitationsCountResponse' :: GetInvitationsCountResponse -> Maybe Integer
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Integer
invitationsCount
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus