{-# 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.FMS.GetResourceSet
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Gets information about a specific resource set.
module Amazonka.FMS.GetResourceSet
  ( -- * Creating a Request
    GetResourceSet (..),
    newGetResourceSet,

    -- * Request Lenses
    getResourceSet_identifier,

    -- * Destructuring the Response
    GetResourceSetResponse (..),
    newGetResourceSetResponse,

    -- * Response Lenses
    getResourceSetResponse_httpStatus,
    getResourceSetResponse_resourceSet,
    getResourceSetResponse_resourceSetArn,
  )
where

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

-- | /See:/ 'newGetResourceSet' smart constructor.
data GetResourceSet = GetResourceSet'
  { -- | A unique identifier for the resource set, used in a TODO to refer to the
    -- resource set.
    GetResourceSet -> Text
identifier :: Prelude.Text
  }
  deriving (GetResourceSet -> GetResourceSet -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetResourceSet -> GetResourceSet -> Bool
$c/= :: GetResourceSet -> GetResourceSet -> Bool
== :: GetResourceSet -> GetResourceSet -> Bool
$c== :: GetResourceSet -> GetResourceSet -> Bool
Prelude.Eq, ReadPrec [GetResourceSet]
ReadPrec GetResourceSet
Int -> ReadS GetResourceSet
ReadS [GetResourceSet]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetResourceSet]
$creadListPrec :: ReadPrec [GetResourceSet]
readPrec :: ReadPrec GetResourceSet
$creadPrec :: ReadPrec GetResourceSet
readList :: ReadS [GetResourceSet]
$creadList :: ReadS [GetResourceSet]
readsPrec :: Int -> ReadS GetResourceSet
$creadsPrec :: Int -> ReadS GetResourceSet
Prelude.Read, Int -> GetResourceSet -> ShowS
[GetResourceSet] -> ShowS
GetResourceSet -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetResourceSet] -> ShowS
$cshowList :: [GetResourceSet] -> ShowS
show :: GetResourceSet -> String
$cshow :: GetResourceSet -> String
showsPrec :: Int -> GetResourceSet -> ShowS
$cshowsPrec :: Int -> GetResourceSet -> ShowS
Prelude.Show, forall x. Rep GetResourceSet x -> GetResourceSet
forall x. GetResourceSet -> Rep GetResourceSet x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetResourceSet x -> GetResourceSet
$cfrom :: forall x. GetResourceSet -> Rep GetResourceSet x
Prelude.Generic)

-- |
-- Create a value of 'GetResourceSet' 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:
--
-- 'identifier', 'getResourceSet_identifier' - A unique identifier for the resource set, used in a TODO to refer to the
-- resource set.
newGetResourceSet ::
  -- | 'identifier'
  Prelude.Text ->
  GetResourceSet
newGetResourceSet :: Text -> GetResourceSet
newGetResourceSet Text
pIdentifier_ =
  GetResourceSet' {$sel:identifier:GetResourceSet' :: Text
identifier = Text
pIdentifier_}

-- | A unique identifier for the resource set, used in a TODO to refer to the
-- resource set.
getResourceSet_identifier :: Lens.Lens' GetResourceSet Prelude.Text
getResourceSet_identifier :: Lens' GetResourceSet Text
getResourceSet_identifier = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetResourceSet' {Text
identifier :: Text
$sel:identifier:GetResourceSet' :: GetResourceSet -> Text
identifier} -> Text
identifier) (\s :: GetResourceSet
s@GetResourceSet' {} Text
a -> GetResourceSet
s {$sel:identifier:GetResourceSet' :: Text
identifier = Text
a} :: GetResourceSet)

instance Core.AWSRequest GetResourceSet where
  type
    AWSResponse GetResourceSet =
      GetResourceSetResponse
  request :: (Service -> Service) -> GetResourceSet -> Request GetResourceSet
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 GetResourceSet
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetResourceSet)))
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 ->
          Int -> ResourceSet -> Text -> GetResourceSetResponse
GetResourceSetResponse'
            forall (f :: * -> *) a b. Functor 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))
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String a
Data..:> Key
"ResourceSet")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String a
Data..:> Key
"ResourceSetArn")
      )

instance Prelude.Hashable GetResourceSet where
  hashWithSalt :: Int -> GetResourceSet -> Int
hashWithSalt Int
_salt GetResourceSet' {Text
identifier :: Text
$sel:identifier:GetResourceSet' :: GetResourceSet -> Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
identifier

instance Prelude.NFData GetResourceSet where
  rnf :: GetResourceSet -> ()
rnf GetResourceSet' {Text
identifier :: Text
$sel:identifier:GetResourceSet' :: GetResourceSet -> Text
..} = forall a. NFData a => a -> ()
Prelude.rnf Text
identifier

instance Data.ToHeaders GetResourceSet where
  toHeaders :: GetResourceSet -> 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
"AWSFMS_20180101.GetResourceSet" ::
                          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 GetResourceSet where
  toJSON :: GetResourceSet -> Value
toJSON GetResourceSet' {Text
identifier :: Text
$sel:identifier:GetResourceSet' :: GetResourceSet -> Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [forall a. a -> Maybe a
Prelude.Just (Key
"Identifier" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
identifier)]
      )

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

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

-- | /See:/ 'newGetResourceSetResponse' smart constructor.
data GetResourceSetResponse = GetResourceSetResponse'
  { -- | The response's http status code.
    GetResourceSetResponse -> Int
httpStatus :: Prelude.Int,
    -- | Information about the specified resource set.
    GetResourceSetResponse -> ResourceSet
resourceSet :: ResourceSet,
    -- | The Amazon Resource Name (ARN) of the resource set.
    GetResourceSetResponse -> Text
resourceSetArn :: Prelude.Text
  }
  deriving (GetResourceSetResponse -> GetResourceSetResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetResourceSetResponse -> GetResourceSetResponse -> Bool
$c/= :: GetResourceSetResponse -> GetResourceSetResponse -> Bool
== :: GetResourceSetResponse -> GetResourceSetResponse -> Bool
$c== :: GetResourceSetResponse -> GetResourceSetResponse -> Bool
Prelude.Eq, ReadPrec [GetResourceSetResponse]
ReadPrec GetResourceSetResponse
Int -> ReadS GetResourceSetResponse
ReadS [GetResourceSetResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetResourceSetResponse]
$creadListPrec :: ReadPrec [GetResourceSetResponse]
readPrec :: ReadPrec GetResourceSetResponse
$creadPrec :: ReadPrec GetResourceSetResponse
readList :: ReadS [GetResourceSetResponse]
$creadList :: ReadS [GetResourceSetResponse]
readsPrec :: Int -> ReadS GetResourceSetResponse
$creadsPrec :: Int -> ReadS GetResourceSetResponse
Prelude.Read, Int -> GetResourceSetResponse -> ShowS
[GetResourceSetResponse] -> ShowS
GetResourceSetResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetResourceSetResponse] -> ShowS
$cshowList :: [GetResourceSetResponse] -> ShowS
show :: GetResourceSetResponse -> String
$cshow :: GetResourceSetResponse -> String
showsPrec :: Int -> GetResourceSetResponse -> ShowS
$cshowsPrec :: Int -> GetResourceSetResponse -> ShowS
Prelude.Show, forall x. Rep GetResourceSetResponse x -> GetResourceSetResponse
forall x. GetResourceSetResponse -> Rep GetResourceSetResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetResourceSetResponse x -> GetResourceSetResponse
$cfrom :: forall x. GetResourceSetResponse -> Rep GetResourceSetResponse x
Prelude.Generic)

-- |
-- Create a value of 'GetResourceSetResponse' 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:
--
-- 'httpStatus', 'getResourceSetResponse_httpStatus' - The response's http status code.
--
-- 'resourceSet', 'getResourceSetResponse_resourceSet' - Information about the specified resource set.
--
-- 'resourceSetArn', 'getResourceSetResponse_resourceSetArn' - The Amazon Resource Name (ARN) of the resource set.
newGetResourceSetResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  -- | 'resourceSet'
  ResourceSet ->
  -- | 'resourceSetArn'
  Prelude.Text ->
  GetResourceSetResponse
newGetResourceSetResponse :: Int -> ResourceSet -> Text -> GetResourceSetResponse
newGetResourceSetResponse
  Int
pHttpStatus_
  ResourceSet
pResourceSet_
  Text
pResourceSetArn_ =
    GetResourceSetResponse'
      { $sel:httpStatus:GetResourceSetResponse' :: Int
httpStatus = Int
pHttpStatus_,
        $sel:resourceSet:GetResourceSetResponse' :: ResourceSet
resourceSet = ResourceSet
pResourceSet_,
        $sel:resourceSetArn:GetResourceSetResponse' :: Text
resourceSetArn = Text
pResourceSetArn_
      }

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

-- | Information about the specified resource set.
getResourceSetResponse_resourceSet :: Lens.Lens' GetResourceSetResponse ResourceSet
getResourceSetResponse_resourceSet :: Lens' GetResourceSetResponse ResourceSet
getResourceSetResponse_resourceSet = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetResourceSetResponse' {ResourceSet
resourceSet :: ResourceSet
$sel:resourceSet:GetResourceSetResponse' :: GetResourceSetResponse -> ResourceSet
resourceSet} -> ResourceSet
resourceSet) (\s :: GetResourceSetResponse
s@GetResourceSetResponse' {} ResourceSet
a -> GetResourceSetResponse
s {$sel:resourceSet:GetResourceSetResponse' :: ResourceSet
resourceSet = ResourceSet
a} :: GetResourceSetResponse)

-- | The Amazon Resource Name (ARN) of the resource set.
getResourceSetResponse_resourceSetArn :: Lens.Lens' GetResourceSetResponse Prelude.Text
getResourceSetResponse_resourceSetArn :: Lens' GetResourceSetResponse Text
getResourceSetResponse_resourceSetArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetResourceSetResponse' {Text
resourceSetArn :: Text
$sel:resourceSetArn:GetResourceSetResponse' :: GetResourceSetResponse -> Text
resourceSetArn} -> Text
resourceSetArn) (\s :: GetResourceSetResponse
s@GetResourceSetResponse' {} Text
a -> GetResourceSetResponse
s {$sel:resourceSetArn:GetResourceSetResponse' :: Text
resourceSetArn = Text
a} :: GetResourceSetResponse)

instance Prelude.NFData GetResourceSetResponse where
  rnf :: GetResourceSetResponse -> ()
rnf GetResourceSetResponse' {Int
Text
ResourceSet
resourceSetArn :: Text
resourceSet :: ResourceSet
httpStatus :: Int
$sel:resourceSetArn:GetResourceSetResponse' :: GetResourceSetResponse -> Text
$sel:resourceSet:GetResourceSetResponse' :: GetResourceSetResponse -> ResourceSet
$sel:httpStatus:GetResourceSetResponse' :: GetResourceSetResponse -> Int
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf ResourceSet
resourceSet
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
resourceSetArn