{-# 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.Lightsail.Types.ResourceReceivingAccess
-- 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.Lightsail.Types.ResourceReceivingAccess 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

-- | Describes an Amazon Lightsail instance that has access to a Lightsail
-- bucket.
--
-- /See:/ 'newResourceReceivingAccess' smart constructor.
data ResourceReceivingAccess = ResourceReceivingAccess'
  { -- | The name of the Lightsail instance.
    ResourceReceivingAccess -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The Lightsail resource type (for example, @Instance@).
    ResourceReceivingAccess -> Maybe Text
resourceType :: Prelude.Maybe Prelude.Text
  }
  deriving (ResourceReceivingAccess -> ResourceReceivingAccess -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ResourceReceivingAccess -> ResourceReceivingAccess -> Bool
$c/= :: ResourceReceivingAccess -> ResourceReceivingAccess -> Bool
== :: ResourceReceivingAccess -> ResourceReceivingAccess -> Bool
$c== :: ResourceReceivingAccess -> ResourceReceivingAccess -> Bool
Prelude.Eq, ReadPrec [ResourceReceivingAccess]
ReadPrec ResourceReceivingAccess
Int -> ReadS ResourceReceivingAccess
ReadS [ResourceReceivingAccess]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ResourceReceivingAccess]
$creadListPrec :: ReadPrec [ResourceReceivingAccess]
readPrec :: ReadPrec ResourceReceivingAccess
$creadPrec :: ReadPrec ResourceReceivingAccess
readList :: ReadS [ResourceReceivingAccess]
$creadList :: ReadS [ResourceReceivingAccess]
readsPrec :: Int -> ReadS ResourceReceivingAccess
$creadsPrec :: Int -> ReadS ResourceReceivingAccess
Prelude.Read, Int -> ResourceReceivingAccess -> ShowS
[ResourceReceivingAccess] -> ShowS
ResourceReceivingAccess -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ResourceReceivingAccess] -> ShowS
$cshowList :: [ResourceReceivingAccess] -> ShowS
show :: ResourceReceivingAccess -> String
$cshow :: ResourceReceivingAccess -> String
showsPrec :: Int -> ResourceReceivingAccess -> ShowS
$cshowsPrec :: Int -> ResourceReceivingAccess -> ShowS
Prelude.Show, forall x. Rep ResourceReceivingAccess x -> ResourceReceivingAccess
forall x. ResourceReceivingAccess -> Rep ResourceReceivingAccess x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ResourceReceivingAccess x -> ResourceReceivingAccess
$cfrom :: forall x. ResourceReceivingAccess -> Rep ResourceReceivingAccess x
Prelude.Generic)

-- |
-- Create a value of 'ResourceReceivingAccess' 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:
--
-- 'name', 'resourceReceivingAccess_name' - The name of the Lightsail instance.
--
-- 'resourceType', 'resourceReceivingAccess_resourceType' - The Lightsail resource type (for example, @Instance@).
newResourceReceivingAccess ::
  ResourceReceivingAccess
newResourceReceivingAccess :: ResourceReceivingAccess
newResourceReceivingAccess =
  ResourceReceivingAccess'
    { $sel:name:ResourceReceivingAccess' :: Maybe Text
name = forall a. Maybe a
Prelude.Nothing,
      $sel:resourceType:ResourceReceivingAccess' :: Maybe Text
resourceType = forall a. Maybe a
Prelude.Nothing
    }

-- | The name of the Lightsail instance.
resourceReceivingAccess_name :: Lens.Lens' ResourceReceivingAccess (Prelude.Maybe Prelude.Text)
resourceReceivingAccess_name :: Lens' ResourceReceivingAccess (Maybe Text)
resourceReceivingAccess_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResourceReceivingAccess' {Maybe Text
name :: Maybe Text
$sel:name:ResourceReceivingAccess' :: ResourceReceivingAccess -> Maybe Text
name} -> Maybe Text
name) (\s :: ResourceReceivingAccess
s@ResourceReceivingAccess' {} Maybe Text
a -> ResourceReceivingAccess
s {$sel:name:ResourceReceivingAccess' :: Maybe Text
name = Maybe Text
a} :: ResourceReceivingAccess)

-- | The Lightsail resource type (for example, @Instance@).
resourceReceivingAccess_resourceType :: Lens.Lens' ResourceReceivingAccess (Prelude.Maybe Prelude.Text)
resourceReceivingAccess_resourceType :: Lens' ResourceReceivingAccess (Maybe Text)
resourceReceivingAccess_resourceType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResourceReceivingAccess' {Maybe Text
resourceType :: Maybe Text
$sel:resourceType:ResourceReceivingAccess' :: ResourceReceivingAccess -> Maybe Text
resourceType} -> Maybe Text
resourceType) (\s :: ResourceReceivingAccess
s@ResourceReceivingAccess' {} Maybe Text
a -> ResourceReceivingAccess
s {$sel:resourceType:ResourceReceivingAccess' :: Maybe Text
resourceType = Maybe Text
a} :: ResourceReceivingAccess)

instance Data.FromJSON ResourceReceivingAccess where
  parseJSON :: Value -> Parser ResourceReceivingAccess
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ResourceReceivingAccess"
      ( \Object
x ->
          Maybe Text -> Maybe Text -> ResourceReceivingAccess
ResourceReceivingAccess'
            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
"name")
            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")
      )

instance Prelude.Hashable ResourceReceivingAccess where
  hashWithSalt :: Int -> ResourceReceivingAccess -> Int
hashWithSalt Int
_salt ResourceReceivingAccess' {Maybe Text
resourceType :: Maybe Text
name :: Maybe Text
$sel:resourceType:ResourceReceivingAccess' :: ResourceReceivingAccess -> Maybe Text
$sel:name:ResourceReceivingAccess' :: ResourceReceivingAccess -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
resourceType

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