{-# 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.AuditManager.GetServicesInScope
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Returns a list of all of the Amazon Web Services that you can choose to
-- include in your assessment. When you
-- <https://docs.aws.amazon.com/audit-manager/latest/APIReference/API_CreateAssessment.html create an assessment>,
-- specify which of these services you want to include to narrow the
-- assessment\'s
-- <https://docs.aws.amazon.com/audit-manager/latest/APIReference/API_Scope.html scope>.
module Amazonka.AuditManager.GetServicesInScope
  ( -- * Creating a Request
    GetServicesInScope (..),
    newGetServicesInScope,

    -- * Destructuring the Response
    GetServicesInScopeResponse (..),
    newGetServicesInScopeResponse,

    -- * Response Lenses
    getServicesInScopeResponse_serviceMetadata,
    getServicesInScopeResponse_httpStatus,
  )
where

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

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

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

instance Core.AWSRequest GetServicesInScope where
  type
    AWSResponse GetServicesInScope =
      GetServicesInScopeResponse
  request :: (Service -> Service)
-> GetServicesInScope -> Request GetServicesInScope
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 GetServicesInScope
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse GetServicesInScope)))
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 [ServiceMetadata] -> Int -> GetServicesInScopeResponse
GetServicesInScopeResponse'
            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
"serviceMetadata"
                            forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty
                        )
            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 GetServicesInScope where
  hashWithSalt :: Int -> GetServicesInScope -> Int
hashWithSalt Int
_salt GetServicesInScope
_ =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` ()

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

instance Data.ToHeaders GetServicesInScope where
  toHeaders :: GetServicesInScope -> 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 GetServicesInScope where
  toPath :: GetServicesInScope -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/services"

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

-- | /See:/ 'newGetServicesInScopeResponse' smart constructor.
data GetServicesInScopeResponse = GetServicesInScopeResponse'
  { -- | The metadata that\'s associated with the Amazon Web Service.
    GetServicesInScopeResponse -> Maybe [ServiceMetadata]
serviceMetadata :: Prelude.Maybe [ServiceMetadata],
    -- | The response's http status code.
    GetServicesInScopeResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (GetServicesInScopeResponse -> GetServicesInScopeResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetServicesInScopeResponse -> GetServicesInScopeResponse -> Bool
$c/= :: GetServicesInScopeResponse -> GetServicesInScopeResponse -> Bool
== :: GetServicesInScopeResponse -> GetServicesInScopeResponse -> Bool
$c== :: GetServicesInScopeResponse -> GetServicesInScopeResponse -> Bool
Prelude.Eq, ReadPrec [GetServicesInScopeResponse]
ReadPrec GetServicesInScopeResponse
Int -> ReadS GetServicesInScopeResponse
ReadS [GetServicesInScopeResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetServicesInScopeResponse]
$creadListPrec :: ReadPrec [GetServicesInScopeResponse]
readPrec :: ReadPrec GetServicesInScopeResponse
$creadPrec :: ReadPrec GetServicesInScopeResponse
readList :: ReadS [GetServicesInScopeResponse]
$creadList :: ReadS [GetServicesInScopeResponse]
readsPrec :: Int -> ReadS GetServicesInScopeResponse
$creadsPrec :: Int -> ReadS GetServicesInScopeResponse
Prelude.Read, Int -> GetServicesInScopeResponse -> ShowS
[GetServicesInScopeResponse] -> ShowS
GetServicesInScopeResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetServicesInScopeResponse] -> ShowS
$cshowList :: [GetServicesInScopeResponse] -> ShowS
show :: GetServicesInScopeResponse -> String
$cshow :: GetServicesInScopeResponse -> String
showsPrec :: Int -> GetServicesInScopeResponse -> ShowS
$cshowsPrec :: Int -> GetServicesInScopeResponse -> ShowS
Prelude.Show, forall x.
Rep GetServicesInScopeResponse x -> GetServicesInScopeResponse
forall x.
GetServicesInScopeResponse -> Rep GetServicesInScopeResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetServicesInScopeResponse x -> GetServicesInScopeResponse
$cfrom :: forall x.
GetServicesInScopeResponse -> Rep GetServicesInScopeResponse x
Prelude.Generic)

-- |
-- Create a value of 'GetServicesInScopeResponse' 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:
--
-- 'serviceMetadata', 'getServicesInScopeResponse_serviceMetadata' - The metadata that\'s associated with the Amazon Web Service.
--
-- 'httpStatus', 'getServicesInScopeResponse_httpStatus' - The response's http status code.
newGetServicesInScopeResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetServicesInScopeResponse
newGetServicesInScopeResponse :: Int -> GetServicesInScopeResponse
newGetServicesInScopeResponse Int
pHttpStatus_ =
  GetServicesInScopeResponse'
    { $sel:serviceMetadata:GetServicesInScopeResponse' :: Maybe [ServiceMetadata]
serviceMetadata =
        forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:GetServicesInScopeResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The metadata that\'s associated with the Amazon Web Service.
getServicesInScopeResponse_serviceMetadata :: Lens.Lens' GetServicesInScopeResponse (Prelude.Maybe [ServiceMetadata])
getServicesInScopeResponse_serviceMetadata :: Lens' GetServicesInScopeResponse (Maybe [ServiceMetadata])
getServicesInScopeResponse_serviceMetadata = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetServicesInScopeResponse' {Maybe [ServiceMetadata]
serviceMetadata :: Maybe [ServiceMetadata]
$sel:serviceMetadata:GetServicesInScopeResponse' :: GetServicesInScopeResponse -> Maybe [ServiceMetadata]
serviceMetadata} -> Maybe [ServiceMetadata]
serviceMetadata) (\s :: GetServicesInScopeResponse
s@GetServicesInScopeResponse' {} Maybe [ServiceMetadata]
a -> GetServicesInScopeResponse
s {$sel:serviceMetadata:GetServicesInScopeResponse' :: Maybe [ServiceMetadata]
serviceMetadata = Maybe [ServiceMetadata]
a} :: GetServicesInScopeResponse) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance Prelude.NFData GetServicesInScopeResponse where
  rnf :: GetServicesInScopeResponse -> ()
rnf GetServicesInScopeResponse' {Int
Maybe [ServiceMetadata]
httpStatus :: Int
serviceMetadata :: Maybe [ServiceMetadata]
$sel:httpStatus:GetServicesInScopeResponse' :: GetServicesInScopeResponse -> Int
$sel:serviceMetadata:GetServicesInScopeResponse' :: GetServicesInScopeResponse -> Maybe [ServiceMetadata]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [ServiceMetadata]
serviceMetadata
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus