{-# 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.SecurityHub.GetInvitationsCount
-- 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 count of all Security Hub membership invitations that were
-- sent to the current member account, not including the currently accepted
-- invitation.
module Amazonka.SecurityHub.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.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
import Amazonka.SecurityHub.Types

-- | /See:/ 'newGetInvitationsCount' smart constructor.
data GetInvitationsCount = GetInvitationsCount'
  {
  }
  deriving (GetInvitationsCount -> GetInvitationsCount -> Bool
(GetInvitationsCount -> GetInvitationsCount -> Bool)
-> (GetInvitationsCount -> GetInvitationsCount -> Bool)
-> Eq GetInvitationsCount
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]
(Int -> ReadS GetInvitationsCount)
-> ReadS [GetInvitationsCount]
-> ReadPrec GetInvitationsCount
-> ReadPrec [GetInvitationsCount]
-> Read 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
(Int -> GetInvitationsCount -> ShowS)
-> (GetInvitationsCount -> String)
-> ([GetInvitationsCount] -> ShowS)
-> Show GetInvitationsCount
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. GetInvitationsCount -> Rep GetInvitationsCount x)
-> (forall x. Rep GetInvitationsCount x -> GetInvitationsCount)
-> Generic GetInvitationsCount
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 :: GetInvitationsCount -> Request GetInvitationsCount
request = Service -> GetInvitationsCount -> Request GetInvitationsCount
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
  response :: Logger
-> Service
-> Proxy GetInvitationsCount
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse GetInvitationsCount)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse GetInvitationsCount))
-> Logger
-> Service
-> Proxy GetInvitationsCount
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse GetInvitationsCount)))
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 -> Int -> GetInvitationsCountResponse
GetInvitationsCountResponse'
            (Maybe Int -> Int -> GetInvitationsCountResponse)
-> Either String (Maybe Int)
-> Either String (Int -> GetInvitationsCountResponse)
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
"InvitationsCount")
            Either String (Int -> GetInvitationsCountResponse)
-> Either String Int -> Either String GetInvitationsCountResponse
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 GetInvitationsCount

instance Prelude.NFData GetInvitationsCount

instance Core.ToHeaders GetInvitationsCount where
  toHeaders :: GetInvitationsCount -> ResponseHeaders
toHeaders =
    ResponseHeaders -> GetInvitationsCount -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ 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.ToPath GetInvitationsCount where
  toPath :: GetInvitationsCount -> ByteString
toPath = ByteString -> GetInvitationsCount -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/invitations/count"

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

-- | /See:/ 'newGetInvitationsCountResponse' smart constructor.
data GetInvitationsCountResponse = GetInvitationsCountResponse'
  { -- | The number of all membership invitations sent to this Security Hub
    -- member account, not including the currently accepted invitation.
    GetInvitationsCountResponse -> Maybe Int
invitationsCount :: Prelude.Maybe Prelude.Int,
    -- | The response's http status code.
    GetInvitationsCountResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (GetInvitationsCountResponse -> GetInvitationsCountResponse -> Bool
(GetInvitationsCountResponse
 -> GetInvitationsCountResponse -> Bool)
-> (GetInvitationsCountResponse
    -> GetInvitationsCountResponse -> Bool)
-> Eq GetInvitationsCountResponse
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]
(Int -> ReadS GetInvitationsCountResponse)
-> ReadS [GetInvitationsCountResponse]
-> ReadPrec GetInvitationsCountResponse
-> ReadPrec [GetInvitationsCountResponse]
-> Read 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
(Int -> GetInvitationsCountResponse -> ShowS)
-> (GetInvitationsCountResponse -> String)
-> ([GetInvitationsCountResponse] -> ShowS)
-> Show GetInvitationsCountResponse
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.
 GetInvitationsCountResponse -> Rep GetInvitationsCountResponse x)
-> (forall x.
    Rep GetInvitationsCountResponse x -> GetInvitationsCountResponse)
-> Generic GetInvitationsCountResponse
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 number of all membership invitations sent to this Security Hub
-- member 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' :: Maybe Int -> Int -> GetInvitationsCountResponse
GetInvitationsCountResponse'
    { $sel:invitationsCount:GetInvitationsCountResponse' :: Maybe Int
invitationsCount =
        Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:GetInvitationsCountResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The number of all membership invitations sent to this Security Hub
-- member account, not including the currently accepted invitation.
getInvitationsCountResponse_invitationsCount :: Lens.Lens' GetInvitationsCountResponse (Prelude.Maybe Prelude.Int)
getInvitationsCountResponse_invitationsCount :: (Maybe Int -> f (Maybe Int))
-> GetInvitationsCountResponse -> f GetInvitationsCountResponse
getInvitationsCountResponse_invitationsCount = (GetInvitationsCountResponse -> Maybe Int)
-> (GetInvitationsCountResponse
    -> Maybe Int -> GetInvitationsCountResponse)
-> Lens
     GetInvitationsCountResponse
     GetInvitationsCountResponse
     (Maybe Int)
     (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetInvitationsCountResponse' {Maybe Int
invitationsCount :: Maybe Int
$sel:invitationsCount:GetInvitationsCountResponse' :: GetInvitationsCountResponse -> Maybe Int
invitationsCount} -> Maybe Int
invitationsCount) (\s :: GetInvitationsCountResponse
s@GetInvitationsCountResponse' {} Maybe Int
a -> GetInvitationsCountResponse
s {$sel:invitationsCount:GetInvitationsCountResponse' :: Maybe Int
invitationsCount = Maybe Int
a} :: GetInvitationsCountResponse)

-- | The response's http status code.
getInvitationsCountResponse_httpStatus :: Lens.Lens' GetInvitationsCountResponse Prelude.Int
getInvitationsCountResponse_httpStatus :: (Int -> f Int)
-> GetInvitationsCountResponse -> f GetInvitationsCountResponse
getInvitationsCountResponse_httpStatus = (GetInvitationsCountResponse -> Int)
-> (GetInvitationsCountResponse
    -> Int -> GetInvitationsCountResponse)
-> Lens
     GetInvitationsCountResponse GetInvitationsCountResponse Int Int
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