{-# 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.Config.GetComplianceDetailsByResource
-- 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 the evaluation results for the specified Amazon Web Services
-- resource. The results indicate which Config rules were used to evaluate
-- the resource, when each rule was last invoked, and whether the resource
-- complies with each rule.
--
-- This operation returns paginated results.
module Amazonka.Config.GetComplianceDetailsByResource
  ( -- * Creating a Request
    GetComplianceDetailsByResource (..),
    newGetComplianceDetailsByResource,

    -- * Request Lenses
    getComplianceDetailsByResource_complianceTypes,
    getComplianceDetailsByResource_nextToken,
    getComplianceDetailsByResource_resourceEvaluationId,
    getComplianceDetailsByResource_resourceId,
    getComplianceDetailsByResource_resourceType,

    -- * Destructuring the Response
    GetComplianceDetailsByResourceResponse (..),
    newGetComplianceDetailsByResourceResponse,

    -- * Response Lenses
    getComplianceDetailsByResourceResponse_evaluationResults,
    getComplianceDetailsByResourceResponse_nextToken,
    getComplianceDetailsByResourceResponse_httpStatus,
  )
where

import Amazonka.Config.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:/ 'newGetComplianceDetailsByResource' smart constructor.
data GetComplianceDetailsByResource = GetComplianceDetailsByResource'
  { -- | Filters the results by compliance.
    --
    -- The allowed values are @COMPLIANT@, @NON_COMPLIANT@, and
    -- @NOT_APPLICABLE@.
    GetComplianceDetailsByResource -> Maybe [ComplianceType]
complianceTypes :: Prelude.Maybe [ComplianceType],
    -- | The @nextToken@ string returned on a previous page that you use to get
    -- the next page of results in a paginated response.
    GetComplianceDetailsByResource -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The unique ID of Amazon Web Services resource execution for which you
    -- want to retrieve evaluation results.
    --
    -- You need to only provide either a @ResourceEvaluationID@ or a
    -- @ResourceID @and @ResourceType@.
    GetComplianceDetailsByResource -> Maybe Text
resourceEvaluationId :: Prelude.Maybe Prelude.Text,
    -- | The ID of the Amazon Web Services resource for which you want compliance
    -- information.
    GetComplianceDetailsByResource -> Maybe Text
resourceId :: Prelude.Maybe Prelude.Text,
    -- | The type of the Amazon Web Services resource for which you want
    -- compliance information.
    GetComplianceDetailsByResource -> Maybe Text
resourceType :: Prelude.Maybe Prelude.Text
  }
  deriving (GetComplianceDetailsByResource
-> GetComplianceDetailsByResource -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetComplianceDetailsByResource
-> GetComplianceDetailsByResource -> Bool
$c/= :: GetComplianceDetailsByResource
-> GetComplianceDetailsByResource -> Bool
== :: GetComplianceDetailsByResource
-> GetComplianceDetailsByResource -> Bool
$c== :: GetComplianceDetailsByResource
-> GetComplianceDetailsByResource -> Bool
Prelude.Eq, ReadPrec [GetComplianceDetailsByResource]
ReadPrec GetComplianceDetailsByResource
Int -> ReadS GetComplianceDetailsByResource
ReadS [GetComplianceDetailsByResource]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetComplianceDetailsByResource]
$creadListPrec :: ReadPrec [GetComplianceDetailsByResource]
readPrec :: ReadPrec GetComplianceDetailsByResource
$creadPrec :: ReadPrec GetComplianceDetailsByResource
readList :: ReadS [GetComplianceDetailsByResource]
$creadList :: ReadS [GetComplianceDetailsByResource]
readsPrec :: Int -> ReadS GetComplianceDetailsByResource
$creadsPrec :: Int -> ReadS GetComplianceDetailsByResource
Prelude.Read, Int -> GetComplianceDetailsByResource -> ShowS
[GetComplianceDetailsByResource] -> ShowS
GetComplianceDetailsByResource -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetComplianceDetailsByResource] -> ShowS
$cshowList :: [GetComplianceDetailsByResource] -> ShowS
show :: GetComplianceDetailsByResource -> String
$cshow :: GetComplianceDetailsByResource -> String
showsPrec :: Int -> GetComplianceDetailsByResource -> ShowS
$cshowsPrec :: Int -> GetComplianceDetailsByResource -> ShowS
Prelude.Show, forall x.
Rep GetComplianceDetailsByResource x
-> GetComplianceDetailsByResource
forall x.
GetComplianceDetailsByResource
-> Rep GetComplianceDetailsByResource x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetComplianceDetailsByResource x
-> GetComplianceDetailsByResource
$cfrom :: forall x.
GetComplianceDetailsByResource
-> Rep GetComplianceDetailsByResource x
Prelude.Generic)

-- |
-- Create a value of 'GetComplianceDetailsByResource' 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:
--
-- 'complianceTypes', 'getComplianceDetailsByResource_complianceTypes' - Filters the results by compliance.
--
-- The allowed values are @COMPLIANT@, @NON_COMPLIANT@, and
-- @NOT_APPLICABLE@.
--
-- 'nextToken', 'getComplianceDetailsByResource_nextToken' - The @nextToken@ string returned on a previous page that you use to get
-- the next page of results in a paginated response.
--
-- 'resourceEvaluationId', 'getComplianceDetailsByResource_resourceEvaluationId' - The unique ID of Amazon Web Services resource execution for which you
-- want to retrieve evaluation results.
--
-- You need to only provide either a @ResourceEvaluationID@ or a
-- @ResourceID @and @ResourceType@.
--
-- 'resourceId', 'getComplianceDetailsByResource_resourceId' - The ID of the Amazon Web Services resource for which you want compliance
-- information.
--
-- 'resourceType', 'getComplianceDetailsByResource_resourceType' - The type of the Amazon Web Services resource for which you want
-- compliance information.
newGetComplianceDetailsByResource ::
  GetComplianceDetailsByResource
newGetComplianceDetailsByResource :: GetComplianceDetailsByResource
newGetComplianceDetailsByResource =
  GetComplianceDetailsByResource'
    { $sel:complianceTypes:GetComplianceDetailsByResource' :: Maybe [ComplianceType]
complianceTypes =
        forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:GetComplianceDetailsByResource' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
      $sel:resourceEvaluationId:GetComplianceDetailsByResource' :: Maybe Text
resourceEvaluationId = forall a. Maybe a
Prelude.Nothing,
      $sel:resourceId:GetComplianceDetailsByResource' :: Maybe Text
resourceId = forall a. Maybe a
Prelude.Nothing,
      $sel:resourceType:GetComplianceDetailsByResource' :: Maybe Text
resourceType = forall a. Maybe a
Prelude.Nothing
    }

-- | Filters the results by compliance.
--
-- The allowed values are @COMPLIANT@, @NON_COMPLIANT@, and
-- @NOT_APPLICABLE@.
getComplianceDetailsByResource_complianceTypes :: Lens.Lens' GetComplianceDetailsByResource (Prelude.Maybe [ComplianceType])
getComplianceDetailsByResource_complianceTypes :: Lens' GetComplianceDetailsByResource (Maybe [ComplianceType])
getComplianceDetailsByResource_complianceTypes = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetComplianceDetailsByResource' {Maybe [ComplianceType]
complianceTypes :: Maybe [ComplianceType]
$sel:complianceTypes:GetComplianceDetailsByResource' :: GetComplianceDetailsByResource -> Maybe [ComplianceType]
complianceTypes} -> Maybe [ComplianceType]
complianceTypes) (\s :: GetComplianceDetailsByResource
s@GetComplianceDetailsByResource' {} Maybe [ComplianceType]
a -> GetComplianceDetailsByResource
s {$sel:complianceTypes:GetComplianceDetailsByResource' :: Maybe [ComplianceType]
complianceTypes = Maybe [ComplianceType]
a} :: GetComplianceDetailsByResource) 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 @nextToken@ string returned on a previous page that you use to get
-- the next page of results in a paginated response.
getComplianceDetailsByResource_nextToken :: Lens.Lens' GetComplianceDetailsByResource (Prelude.Maybe Prelude.Text)
getComplianceDetailsByResource_nextToken :: Lens' GetComplianceDetailsByResource (Maybe Text)
getComplianceDetailsByResource_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetComplianceDetailsByResource' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:GetComplianceDetailsByResource' :: GetComplianceDetailsByResource -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: GetComplianceDetailsByResource
s@GetComplianceDetailsByResource' {} Maybe Text
a -> GetComplianceDetailsByResource
s {$sel:nextToken:GetComplianceDetailsByResource' :: Maybe Text
nextToken = Maybe Text
a} :: GetComplianceDetailsByResource)

-- | The unique ID of Amazon Web Services resource execution for which you
-- want to retrieve evaluation results.
--
-- You need to only provide either a @ResourceEvaluationID@ or a
-- @ResourceID @and @ResourceType@.
getComplianceDetailsByResource_resourceEvaluationId :: Lens.Lens' GetComplianceDetailsByResource (Prelude.Maybe Prelude.Text)
getComplianceDetailsByResource_resourceEvaluationId :: Lens' GetComplianceDetailsByResource (Maybe Text)
getComplianceDetailsByResource_resourceEvaluationId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetComplianceDetailsByResource' {Maybe Text
resourceEvaluationId :: Maybe Text
$sel:resourceEvaluationId:GetComplianceDetailsByResource' :: GetComplianceDetailsByResource -> Maybe Text
resourceEvaluationId} -> Maybe Text
resourceEvaluationId) (\s :: GetComplianceDetailsByResource
s@GetComplianceDetailsByResource' {} Maybe Text
a -> GetComplianceDetailsByResource
s {$sel:resourceEvaluationId:GetComplianceDetailsByResource' :: Maybe Text
resourceEvaluationId = Maybe Text
a} :: GetComplianceDetailsByResource)

-- | The ID of the Amazon Web Services resource for which you want compliance
-- information.
getComplianceDetailsByResource_resourceId :: Lens.Lens' GetComplianceDetailsByResource (Prelude.Maybe Prelude.Text)
getComplianceDetailsByResource_resourceId :: Lens' GetComplianceDetailsByResource (Maybe Text)
getComplianceDetailsByResource_resourceId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetComplianceDetailsByResource' {Maybe Text
resourceId :: Maybe Text
$sel:resourceId:GetComplianceDetailsByResource' :: GetComplianceDetailsByResource -> Maybe Text
resourceId} -> Maybe Text
resourceId) (\s :: GetComplianceDetailsByResource
s@GetComplianceDetailsByResource' {} Maybe Text
a -> GetComplianceDetailsByResource
s {$sel:resourceId:GetComplianceDetailsByResource' :: Maybe Text
resourceId = Maybe Text
a} :: GetComplianceDetailsByResource)

-- | The type of the Amazon Web Services resource for which you want
-- compliance information.
getComplianceDetailsByResource_resourceType :: Lens.Lens' GetComplianceDetailsByResource (Prelude.Maybe Prelude.Text)
getComplianceDetailsByResource_resourceType :: Lens' GetComplianceDetailsByResource (Maybe Text)
getComplianceDetailsByResource_resourceType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetComplianceDetailsByResource' {Maybe Text
resourceType :: Maybe Text
$sel:resourceType:GetComplianceDetailsByResource' :: GetComplianceDetailsByResource -> Maybe Text
resourceType} -> Maybe Text
resourceType) (\s :: GetComplianceDetailsByResource
s@GetComplianceDetailsByResource' {} Maybe Text
a -> GetComplianceDetailsByResource
s {$sel:resourceType:GetComplianceDetailsByResource' :: Maybe Text
resourceType = Maybe Text
a} :: GetComplianceDetailsByResource)

instance Core.AWSPager GetComplianceDetailsByResource where
  page :: GetComplianceDetailsByResource
-> AWSResponse GetComplianceDetailsByResource
-> Maybe GetComplianceDetailsByResource
page GetComplianceDetailsByResource
rq AWSResponse GetComplianceDetailsByResource
rs
    | forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse GetComplianceDetailsByResource
rs
            forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' GetComplianceDetailsByResourceResponse (Maybe Text)
getComplianceDetailsByResourceResponse_nextToken
            forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
        forall a. Maybe a
Prelude.Nothing
    | forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse GetComplianceDetailsByResource
rs
            forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens'
  GetComplianceDetailsByResourceResponse (Maybe [EvaluationResult])
getComplianceDetailsByResourceResponse_evaluationResults
            forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
        forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
        forall a. a -> Maybe a
Prelude.Just
          forall a b. (a -> b) -> a -> b
Prelude.$ GetComplianceDetailsByResource
rq
          forall a b. a -> (a -> b) -> b
Prelude.& Lens' GetComplianceDetailsByResource (Maybe Text)
getComplianceDetailsByResource_nextToken
          forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse GetComplianceDetailsByResource
rs
          forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' GetComplianceDetailsByResourceResponse (Maybe Text)
getComplianceDetailsByResourceResponse_nextToken
          forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just

instance
  Core.AWSRequest
    GetComplianceDetailsByResource
  where
  type
    AWSResponse GetComplianceDetailsByResource =
      GetComplianceDetailsByResourceResponse
  request :: (Service -> Service)
-> GetComplianceDetailsByResource
-> Request GetComplianceDetailsByResource
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy GetComplianceDetailsByResource
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse (AWSResponse GetComplianceDetailsByResource)))
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 [EvaluationResult]
-> Maybe Text -> Int -> GetComplianceDetailsByResourceResponse
GetComplianceDetailsByResourceResponse'
            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
"EvaluationResults"
                            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.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"NextToken")
            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
    GetComplianceDetailsByResource
  where
  hashWithSalt :: Int -> GetComplianceDetailsByResource -> Int
hashWithSalt
    Int
_salt
    GetComplianceDetailsByResource' {Maybe [ComplianceType]
Maybe Text
resourceType :: Maybe Text
resourceId :: Maybe Text
resourceEvaluationId :: Maybe Text
nextToken :: Maybe Text
complianceTypes :: Maybe [ComplianceType]
$sel:resourceType:GetComplianceDetailsByResource' :: GetComplianceDetailsByResource -> Maybe Text
$sel:resourceId:GetComplianceDetailsByResource' :: GetComplianceDetailsByResource -> Maybe Text
$sel:resourceEvaluationId:GetComplianceDetailsByResource' :: GetComplianceDetailsByResource -> Maybe Text
$sel:nextToken:GetComplianceDetailsByResource' :: GetComplianceDetailsByResource -> Maybe Text
$sel:complianceTypes:GetComplianceDetailsByResource' :: GetComplianceDetailsByResource -> Maybe [ComplianceType]
..} =
      Int
_salt
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [ComplianceType]
complianceTypes
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
nextToken
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
resourceEvaluationId
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
resourceId
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
resourceType

instance
  Prelude.NFData
    GetComplianceDetailsByResource
  where
  rnf :: GetComplianceDetailsByResource -> ()
rnf GetComplianceDetailsByResource' {Maybe [ComplianceType]
Maybe Text
resourceType :: Maybe Text
resourceId :: Maybe Text
resourceEvaluationId :: Maybe Text
nextToken :: Maybe Text
complianceTypes :: Maybe [ComplianceType]
$sel:resourceType:GetComplianceDetailsByResource' :: GetComplianceDetailsByResource -> Maybe Text
$sel:resourceId:GetComplianceDetailsByResource' :: GetComplianceDetailsByResource -> Maybe Text
$sel:resourceEvaluationId:GetComplianceDetailsByResource' :: GetComplianceDetailsByResource -> Maybe Text
$sel:nextToken:GetComplianceDetailsByResource' :: GetComplianceDetailsByResource -> Maybe Text
$sel:complianceTypes:GetComplianceDetailsByResource' :: GetComplianceDetailsByResource -> Maybe [ComplianceType]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [ComplianceType]
complianceTypes
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextToken
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
resourceEvaluationId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
resourceId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
resourceType

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

instance Data.ToJSON GetComplianceDetailsByResource where
  toJSON :: GetComplianceDetailsByResource -> Value
toJSON GetComplianceDetailsByResource' {Maybe [ComplianceType]
Maybe Text
resourceType :: Maybe Text
resourceId :: Maybe Text
resourceEvaluationId :: Maybe Text
nextToken :: Maybe Text
complianceTypes :: Maybe [ComplianceType]
$sel:resourceType:GetComplianceDetailsByResource' :: GetComplianceDetailsByResource -> Maybe Text
$sel:resourceId:GetComplianceDetailsByResource' :: GetComplianceDetailsByResource -> Maybe Text
$sel:resourceEvaluationId:GetComplianceDetailsByResource' :: GetComplianceDetailsByResource -> Maybe Text
$sel:nextToken:GetComplianceDetailsByResource' :: GetComplianceDetailsByResource -> Maybe Text
$sel:complianceTypes:GetComplianceDetailsByResource' :: GetComplianceDetailsByResource -> Maybe [ComplianceType]
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"ComplianceTypes" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [ComplianceType]
complianceTypes,
            (Key
"NextToken" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
nextToken,
            (Key
"ResourceEvaluationId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
resourceEvaluationId,
            (Key
"ResourceId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
resourceId,
            (Key
"ResourceType" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
resourceType
          ]
      )

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

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

-- |
--
-- /See:/ 'newGetComplianceDetailsByResourceResponse' smart constructor.
data GetComplianceDetailsByResourceResponse = GetComplianceDetailsByResourceResponse'
  { -- | Indicates whether the specified Amazon Web Services resource complies
    -- each Config rule.
    GetComplianceDetailsByResourceResponse -> Maybe [EvaluationResult]
evaluationResults :: Prelude.Maybe [EvaluationResult],
    -- | The string that you use in a subsequent request to get the next page of
    -- results in a paginated response.
    GetComplianceDetailsByResourceResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    GetComplianceDetailsByResourceResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (GetComplianceDetailsByResourceResponse
-> GetComplianceDetailsByResourceResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetComplianceDetailsByResourceResponse
-> GetComplianceDetailsByResourceResponse -> Bool
$c/= :: GetComplianceDetailsByResourceResponse
-> GetComplianceDetailsByResourceResponse -> Bool
== :: GetComplianceDetailsByResourceResponse
-> GetComplianceDetailsByResourceResponse -> Bool
$c== :: GetComplianceDetailsByResourceResponse
-> GetComplianceDetailsByResourceResponse -> Bool
Prelude.Eq, ReadPrec [GetComplianceDetailsByResourceResponse]
ReadPrec GetComplianceDetailsByResourceResponse
Int -> ReadS GetComplianceDetailsByResourceResponse
ReadS [GetComplianceDetailsByResourceResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetComplianceDetailsByResourceResponse]
$creadListPrec :: ReadPrec [GetComplianceDetailsByResourceResponse]
readPrec :: ReadPrec GetComplianceDetailsByResourceResponse
$creadPrec :: ReadPrec GetComplianceDetailsByResourceResponse
readList :: ReadS [GetComplianceDetailsByResourceResponse]
$creadList :: ReadS [GetComplianceDetailsByResourceResponse]
readsPrec :: Int -> ReadS GetComplianceDetailsByResourceResponse
$creadsPrec :: Int -> ReadS GetComplianceDetailsByResourceResponse
Prelude.Read, Int -> GetComplianceDetailsByResourceResponse -> ShowS
[GetComplianceDetailsByResourceResponse] -> ShowS
GetComplianceDetailsByResourceResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetComplianceDetailsByResourceResponse] -> ShowS
$cshowList :: [GetComplianceDetailsByResourceResponse] -> ShowS
show :: GetComplianceDetailsByResourceResponse -> String
$cshow :: GetComplianceDetailsByResourceResponse -> String
showsPrec :: Int -> GetComplianceDetailsByResourceResponse -> ShowS
$cshowsPrec :: Int -> GetComplianceDetailsByResourceResponse -> ShowS
Prelude.Show, forall x.
Rep GetComplianceDetailsByResourceResponse x
-> GetComplianceDetailsByResourceResponse
forall x.
GetComplianceDetailsByResourceResponse
-> Rep GetComplianceDetailsByResourceResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetComplianceDetailsByResourceResponse x
-> GetComplianceDetailsByResourceResponse
$cfrom :: forall x.
GetComplianceDetailsByResourceResponse
-> Rep GetComplianceDetailsByResourceResponse x
Prelude.Generic)

-- |
-- Create a value of 'GetComplianceDetailsByResourceResponse' 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:
--
-- 'evaluationResults', 'getComplianceDetailsByResourceResponse_evaluationResults' - Indicates whether the specified Amazon Web Services resource complies
-- each Config rule.
--
-- 'nextToken', 'getComplianceDetailsByResourceResponse_nextToken' - The string that you use in a subsequent request to get the next page of
-- results in a paginated response.
--
-- 'httpStatus', 'getComplianceDetailsByResourceResponse_httpStatus' - The response's http status code.
newGetComplianceDetailsByResourceResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetComplianceDetailsByResourceResponse
newGetComplianceDetailsByResourceResponse :: Int -> GetComplianceDetailsByResourceResponse
newGetComplianceDetailsByResourceResponse
  Int
pHttpStatus_ =
    GetComplianceDetailsByResourceResponse'
      { $sel:evaluationResults:GetComplianceDetailsByResourceResponse' :: Maybe [EvaluationResult]
evaluationResults =
          forall a. Maybe a
Prelude.Nothing,
        $sel:nextToken:GetComplianceDetailsByResourceResponse' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
        $sel:httpStatus:GetComplianceDetailsByResourceResponse' :: Int
httpStatus = Int
pHttpStatus_
      }

-- | Indicates whether the specified Amazon Web Services resource complies
-- each Config rule.
getComplianceDetailsByResourceResponse_evaluationResults :: Lens.Lens' GetComplianceDetailsByResourceResponse (Prelude.Maybe [EvaluationResult])
getComplianceDetailsByResourceResponse_evaluationResults :: Lens'
  GetComplianceDetailsByResourceResponse (Maybe [EvaluationResult])
getComplianceDetailsByResourceResponse_evaluationResults = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetComplianceDetailsByResourceResponse' {Maybe [EvaluationResult]
evaluationResults :: Maybe [EvaluationResult]
$sel:evaluationResults:GetComplianceDetailsByResourceResponse' :: GetComplianceDetailsByResourceResponse -> Maybe [EvaluationResult]
evaluationResults} -> Maybe [EvaluationResult]
evaluationResults) (\s :: GetComplianceDetailsByResourceResponse
s@GetComplianceDetailsByResourceResponse' {} Maybe [EvaluationResult]
a -> GetComplianceDetailsByResourceResponse
s {$sel:evaluationResults:GetComplianceDetailsByResourceResponse' :: Maybe [EvaluationResult]
evaluationResults = Maybe [EvaluationResult]
a} :: GetComplianceDetailsByResourceResponse) 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 string that you use in a subsequent request to get the next page of
-- results in a paginated response.
getComplianceDetailsByResourceResponse_nextToken :: Lens.Lens' GetComplianceDetailsByResourceResponse (Prelude.Maybe Prelude.Text)
getComplianceDetailsByResourceResponse_nextToken :: Lens' GetComplianceDetailsByResourceResponse (Maybe Text)
getComplianceDetailsByResourceResponse_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetComplianceDetailsByResourceResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:GetComplianceDetailsByResourceResponse' :: GetComplianceDetailsByResourceResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: GetComplianceDetailsByResourceResponse
s@GetComplianceDetailsByResourceResponse' {} Maybe Text
a -> GetComplianceDetailsByResourceResponse
s {$sel:nextToken:GetComplianceDetailsByResourceResponse' :: Maybe Text
nextToken = Maybe Text
a} :: GetComplianceDetailsByResourceResponse)

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

instance
  Prelude.NFData
    GetComplianceDetailsByResourceResponse
  where
  rnf :: GetComplianceDetailsByResourceResponse -> ()
rnf GetComplianceDetailsByResourceResponse' {Int
Maybe [EvaluationResult]
Maybe Text
httpStatus :: Int
nextToken :: Maybe Text
evaluationResults :: Maybe [EvaluationResult]
$sel:httpStatus:GetComplianceDetailsByResourceResponse' :: GetComplianceDetailsByResourceResponse -> Int
$sel:nextToken:GetComplianceDetailsByResourceResponse' :: GetComplianceDetailsByResourceResponse -> Maybe Text
$sel:evaluationResults:GetComplianceDetailsByResourceResponse' :: GetComplianceDetailsByResourceResponse -> Maybe [EvaluationResult]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [EvaluationResult]
evaluationResults
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextToken
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus