{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.RAM.Types.ServiceNameAndResourceType
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.RAM.Types.ServiceNameAndResourceType where

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 Amazonka.RAM.Types.ResourceRegionScope

-- | Information about a shareable resource type and the Amazon Web Services
-- service to which resources of that type belong.
--
-- /See:/ 'newServiceNameAndResourceType' smart constructor.
data ServiceNameAndResourceType = ServiceNameAndResourceType'
  { -- | Specifies the scope of visibility of resources of this type:
    --
    -- -   __REGIONAL__ – The resource can be accessed only by using requests
    --     that target the Amazon Web Services Region in which the resource
    --     exists.
    --
    -- -   __GLOBAL__ – The resource can be accessed from any Amazon Web
    --     Services Region.
    ServiceNameAndResourceType -> Maybe ResourceRegionScope
resourceRegionScope :: Prelude.Maybe ResourceRegionScope,
    -- | The type of the resource.
    ServiceNameAndResourceType -> Maybe Text
resourceType :: Prelude.Maybe Prelude.Text,
    -- | The name of the Amazon Web Services service to which resources of this
    -- type belong.
    ServiceNameAndResourceType -> Maybe Text
serviceName :: Prelude.Maybe Prelude.Text
  }
  deriving (ServiceNameAndResourceType -> ServiceNameAndResourceType -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ServiceNameAndResourceType -> ServiceNameAndResourceType -> Bool
$c/= :: ServiceNameAndResourceType -> ServiceNameAndResourceType -> Bool
== :: ServiceNameAndResourceType -> ServiceNameAndResourceType -> Bool
$c== :: ServiceNameAndResourceType -> ServiceNameAndResourceType -> Bool
Prelude.Eq, ReadPrec [ServiceNameAndResourceType]
ReadPrec ServiceNameAndResourceType
Int -> ReadS ServiceNameAndResourceType
ReadS [ServiceNameAndResourceType]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ServiceNameAndResourceType]
$creadListPrec :: ReadPrec [ServiceNameAndResourceType]
readPrec :: ReadPrec ServiceNameAndResourceType
$creadPrec :: ReadPrec ServiceNameAndResourceType
readList :: ReadS [ServiceNameAndResourceType]
$creadList :: ReadS [ServiceNameAndResourceType]
readsPrec :: Int -> ReadS ServiceNameAndResourceType
$creadsPrec :: Int -> ReadS ServiceNameAndResourceType
Prelude.Read, Int -> ServiceNameAndResourceType -> ShowS
[ServiceNameAndResourceType] -> ShowS
ServiceNameAndResourceType -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ServiceNameAndResourceType] -> ShowS
$cshowList :: [ServiceNameAndResourceType] -> ShowS
show :: ServiceNameAndResourceType -> String
$cshow :: ServiceNameAndResourceType -> String
showsPrec :: Int -> ServiceNameAndResourceType -> ShowS
$cshowsPrec :: Int -> ServiceNameAndResourceType -> ShowS
Prelude.Show, forall x.
Rep ServiceNameAndResourceType x -> ServiceNameAndResourceType
forall x.
ServiceNameAndResourceType -> Rep ServiceNameAndResourceType x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ServiceNameAndResourceType x -> ServiceNameAndResourceType
$cfrom :: forall x.
ServiceNameAndResourceType -> Rep ServiceNameAndResourceType x
Prelude.Generic)

-- |
-- Create a value of 'ServiceNameAndResourceType' 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:
--
-- 'resourceRegionScope', 'serviceNameAndResourceType_resourceRegionScope' - Specifies the scope of visibility of resources of this type:
--
-- -   __REGIONAL__ – The resource can be accessed only by using requests
--     that target the Amazon Web Services Region in which the resource
--     exists.
--
-- -   __GLOBAL__ – The resource can be accessed from any Amazon Web
--     Services Region.
--
-- 'resourceType', 'serviceNameAndResourceType_resourceType' - The type of the resource.
--
-- 'serviceName', 'serviceNameAndResourceType_serviceName' - The name of the Amazon Web Services service to which resources of this
-- type belong.
newServiceNameAndResourceType ::
  ServiceNameAndResourceType
newServiceNameAndResourceType :: ServiceNameAndResourceType
newServiceNameAndResourceType =
  ServiceNameAndResourceType'
    { $sel:resourceRegionScope:ServiceNameAndResourceType' :: Maybe ResourceRegionScope
resourceRegionScope =
        forall a. Maybe a
Prelude.Nothing,
      $sel:resourceType:ServiceNameAndResourceType' :: Maybe Text
resourceType = forall a. Maybe a
Prelude.Nothing,
      $sel:serviceName:ServiceNameAndResourceType' :: Maybe Text
serviceName = forall a. Maybe a
Prelude.Nothing
    }

-- | Specifies the scope of visibility of resources of this type:
--
-- -   __REGIONAL__ – The resource can be accessed only by using requests
--     that target the Amazon Web Services Region in which the resource
--     exists.
--
-- -   __GLOBAL__ – The resource can be accessed from any Amazon Web
--     Services Region.
serviceNameAndResourceType_resourceRegionScope :: Lens.Lens' ServiceNameAndResourceType (Prelude.Maybe ResourceRegionScope)
serviceNameAndResourceType_resourceRegionScope :: Lens' ServiceNameAndResourceType (Maybe ResourceRegionScope)
serviceNameAndResourceType_resourceRegionScope = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ServiceNameAndResourceType' {Maybe ResourceRegionScope
resourceRegionScope :: Maybe ResourceRegionScope
$sel:resourceRegionScope:ServiceNameAndResourceType' :: ServiceNameAndResourceType -> Maybe ResourceRegionScope
resourceRegionScope} -> Maybe ResourceRegionScope
resourceRegionScope) (\s :: ServiceNameAndResourceType
s@ServiceNameAndResourceType' {} Maybe ResourceRegionScope
a -> ServiceNameAndResourceType
s {$sel:resourceRegionScope:ServiceNameAndResourceType' :: Maybe ResourceRegionScope
resourceRegionScope = Maybe ResourceRegionScope
a} :: ServiceNameAndResourceType)

-- | The type of the resource.
serviceNameAndResourceType_resourceType :: Lens.Lens' ServiceNameAndResourceType (Prelude.Maybe Prelude.Text)
serviceNameAndResourceType_resourceType :: Lens' ServiceNameAndResourceType (Maybe Text)
serviceNameAndResourceType_resourceType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ServiceNameAndResourceType' {Maybe Text
resourceType :: Maybe Text
$sel:resourceType:ServiceNameAndResourceType' :: ServiceNameAndResourceType -> Maybe Text
resourceType} -> Maybe Text
resourceType) (\s :: ServiceNameAndResourceType
s@ServiceNameAndResourceType' {} Maybe Text
a -> ServiceNameAndResourceType
s {$sel:resourceType:ServiceNameAndResourceType' :: Maybe Text
resourceType = Maybe Text
a} :: ServiceNameAndResourceType)

-- | The name of the Amazon Web Services service to which resources of this
-- type belong.
serviceNameAndResourceType_serviceName :: Lens.Lens' ServiceNameAndResourceType (Prelude.Maybe Prelude.Text)
serviceNameAndResourceType_serviceName :: Lens' ServiceNameAndResourceType (Maybe Text)
serviceNameAndResourceType_serviceName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ServiceNameAndResourceType' {Maybe Text
serviceName :: Maybe Text
$sel:serviceName:ServiceNameAndResourceType' :: ServiceNameAndResourceType -> Maybe Text
serviceName} -> Maybe Text
serviceName) (\s :: ServiceNameAndResourceType
s@ServiceNameAndResourceType' {} Maybe Text
a -> ServiceNameAndResourceType
s {$sel:serviceName:ServiceNameAndResourceType' :: Maybe Text
serviceName = Maybe Text
a} :: ServiceNameAndResourceType)

instance Data.FromJSON ServiceNameAndResourceType where
  parseJSON :: Value -> Parser ServiceNameAndResourceType
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ServiceNameAndResourceType"
      ( \Object
x ->
          Maybe ResourceRegionScope
-> Maybe Text -> Maybe Text -> ServiceNameAndResourceType
ServiceNameAndResourceType'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"resourceRegionScope")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"resourceType")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"serviceName")
      )

instance Prelude.Hashable ServiceNameAndResourceType where
  hashWithSalt :: Int -> ServiceNameAndResourceType -> Int
hashWithSalt Int
_salt ServiceNameAndResourceType' {Maybe Text
Maybe ResourceRegionScope
serviceName :: Maybe Text
resourceType :: Maybe Text
resourceRegionScope :: Maybe ResourceRegionScope
$sel:serviceName:ServiceNameAndResourceType' :: ServiceNameAndResourceType -> Maybe Text
$sel:resourceType:ServiceNameAndResourceType' :: ServiceNameAndResourceType -> Maybe Text
$sel:resourceRegionScope:ServiceNameAndResourceType' :: ServiceNameAndResourceType -> Maybe ResourceRegionScope
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ResourceRegionScope
resourceRegionScope
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
resourceType
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
serviceName

instance Prelude.NFData ServiceNameAndResourceType where
  rnf :: ServiceNameAndResourceType -> ()
rnf ServiceNameAndResourceType' {Maybe Text
Maybe ResourceRegionScope
serviceName :: Maybe Text
resourceType :: Maybe Text
resourceRegionScope :: Maybe ResourceRegionScope
$sel:serviceName:ServiceNameAndResourceType' :: ServiceNameAndResourceType -> Maybe Text
$sel:resourceType:ServiceNameAndResourceType' :: ServiceNameAndResourceType -> Maybe Text
$sel:resourceRegionScope:ServiceNameAndResourceType' :: ServiceNameAndResourceType -> Maybe ResourceRegionScope
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe ResourceRegionScope
resourceRegionScope
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
resourceType
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
serviceName