{-# 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-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.Lightsail.Types.ResourceReceivingAccess where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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 Lightsail resource type (for example, @Instance@).
    ResourceReceivingAccess -> Maybe Text
resourceType :: Prelude.Maybe Prelude.Text,
    -- | The name of the Lightsail instance.
    ResourceReceivingAccess -> Maybe Text
name :: Prelude.Maybe Prelude.Text
  }
  deriving (ResourceReceivingAccess -> ResourceReceivingAccess -> Bool
(ResourceReceivingAccess -> ResourceReceivingAccess -> Bool)
-> (ResourceReceivingAccess -> ResourceReceivingAccess -> Bool)
-> Eq ResourceReceivingAccess
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]
(Int -> ReadS ResourceReceivingAccess)
-> ReadS [ResourceReceivingAccess]
-> ReadPrec ResourceReceivingAccess
-> ReadPrec [ResourceReceivingAccess]
-> Read 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
(Int -> ResourceReceivingAccess -> ShowS)
-> (ResourceReceivingAccess -> String)
-> ([ResourceReceivingAccess] -> ShowS)
-> Show ResourceReceivingAccess
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.
 ResourceReceivingAccess -> Rep ResourceReceivingAccess x)
-> (forall x.
    Rep ResourceReceivingAccess x -> ResourceReceivingAccess)
-> Generic ResourceReceivingAccess
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:
--
-- 'resourceType', 'resourceReceivingAccess_resourceType' - The Lightsail resource type (for example, @Instance@).
--
-- 'name', 'resourceReceivingAccess_name' - The name of the Lightsail instance.
newResourceReceivingAccess ::
  ResourceReceivingAccess
newResourceReceivingAccess :: ResourceReceivingAccess
newResourceReceivingAccess =
  ResourceReceivingAccess' :: Maybe Text -> Maybe Text -> ResourceReceivingAccess
ResourceReceivingAccess'
    { $sel:resourceType:ResourceReceivingAccess' :: Maybe Text
resourceType =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:name:ResourceReceivingAccess' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The Lightsail resource type (for example, @Instance@).
resourceReceivingAccess_resourceType :: Lens.Lens' ResourceReceivingAccess (Prelude.Maybe Prelude.Text)
resourceReceivingAccess_resourceType :: (Maybe Text -> f (Maybe Text))
-> ResourceReceivingAccess -> f ResourceReceivingAccess
resourceReceivingAccess_resourceType = (ResourceReceivingAccess -> Maybe Text)
-> (ResourceReceivingAccess
    -> Maybe Text -> ResourceReceivingAccess)
-> Lens
     ResourceReceivingAccess
     ResourceReceivingAccess
     (Maybe Text)
     (Maybe Text)
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)

-- | The name of the Lightsail instance.
resourceReceivingAccess_name :: Lens.Lens' ResourceReceivingAccess (Prelude.Maybe Prelude.Text)
resourceReceivingAccess_name :: (Maybe Text -> f (Maybe Text))
-> ResourceReceivingAccess -> f ResourceReceivingAccess
resourceReceivingAccess_name = (ResourceReceivingAccess -> Maybe Text)
-> (ResourceReceivingAccess
    -> Maybe Text -> ResourceReceivingAccess)
-> Lens
     ResourceReceivingAccess
     ResourceReceivingAccess
     (Maybe Text)
     (Maybe Text)
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)

instance Core.FromJSON ResourceReceivingAccess where
  parseJSON :: Value -> Parser ResourceReceivingAccess
parseJSON =
    String
-> (Object -> Parser ResourceReceivingAccess)
-> Value
-> Parser ResourceReceivingAccess
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ResourceReceivingAccess"
      ( \Object
x ->
          Maybe Text -> Maybe Text -> ResourceReceivingAccess
ResourceReceivingAccess'
            (Maybe Text -> Maybe Text -> ResourceReceivingAccess)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> ResourceReceivingAccess)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"resourceType")
            Parser (Maybe Text -> ResourceReceivingAccess)
-> Parser (Maybe Text) -> Parser ResourceReceivingAccess
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"name")
      )

instance Prelude.Hashable ResourceReceivingAccess

instance Prelude.NFData ResourceReceivingAccess