{-# 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.Lambda.Types.FunctionCodeLocation
-- 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.Lambda.Types.FunctionCodeLocation where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Details about a function\'s deployment package.
--
-- /See:/ 'newFunctionCodeLocation' smart constructor.
data FunctionCodeLocation = FunctionCodeLocation'
  { -- | A presigned URL that you can use to download the deployment package.
    FunctionCodeLocation -> Maybe Text
location :: Prelude.Maybe Prelude.Text,
    -- | The resolved URI for the image.
    FunctionCodeLocation -> Maybe Text
resolvedImageUri :: Prelude.Maybe Prelude.Text,
    -- | URI of a container image in the Amazon ECR registry.
    FunctionCodeLocation -> Maybe Text
imageUri :: Prelude.Maybe Prelude.Text,
    -- | The service that\'s hosting the file.
    FunctionCodeLocation -> Maybe Text
repositoryType :: Prelude.Maybe Prelude.Text
  }
  deriving (FunctionCodeLocation -> FunctionCodeLocation -> Bool
(FunctionCodeLocation -> FunctionCodeLocation -> Bool)
-> (FunctionCodeLocation -> FunctionCodeLocation -> Bool)
-> Eq FunctionCodeLocation
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FunctionCodeLocation -> FunctionCodeLocation -> Bool
$c/= :: FunctionCodeLocation -> FunctionCodeLocation -> Bool
== :: FunctionCodeLocation -> FunctionCodeLocation -> Bool
$c== :: FunctionCodeLocation -> FunctionCodeLocation -> Bool
Prelude.Eq, ReadPrec [FunctionCodeLocation]
ReadPrec FunctionCodeLocation
Int -> ReadS FunctionCodeLocation
ReadS [FunctionCodeLocation]
(Int -> ReadS FunctionCodeLocation)
-> ReadS [FunctionCodeLocation]
-> ReadPrec FunctionCodeLocation
-> ReadPrec [FunctionCodeLocation]
-> Read FunctionCodeLocation
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [FunctionCodeLocation]
$creadListPrec :: ReadPrec [FunctionCodeLocation]
readPrec :: ReadPrec FunctionCodeLocation
$creadPrec :: ReadPrec FunctionCodeLocation
readList :: ReadS [FunctionCodeLocation]
$creadList :: ReadS [FunctionCodeLocation]
readsPrec :: Int -> ReadS FunctionCodeLocation
$creadsPrec :: Int -> ReadS FunctionCodeLocation
Prelude.Read, Int -> FunctionCodeLocation -> ShowS
[FunctionCodeLocation] -> ShowS
FunctionCodeLocation -> String
(Int -> FunctionCodeLocation -> ShowS)
-> (FunctionCodeLocation -> String)
-> ([FunctionCodeLocation] -> ShowS)
-> Show FunctionCodeLocation
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [FunctionCodeLocation] -> ShowS
$cshowList :: [FunctionCodeLocation] -> ShowS
show :: FunctionCodeLocation -> String
$cshow :: FunctionCodeLocation -> String
showsPrec :: Int -> FunctionCodeLocation -> ShowS
$cshowsPrec :: Int -> FunctionCodeLocation -> ShowS
Prelude.Show, (forall x. FunctionCodeLocation -> Rep FunctionCodeLocation x)
-> (forall x. Rep FunctionCodeLocation x -> FunctionCodeLocation)
-> Generic FunctionCodeLocation
forall x. Rep FunctionCodeLocation x -> FunctionCodeLocation
forall x. FunctionCodeLocation -> Rep FunctionCodeLocation x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep FunctionCodeLocation x -> FunctionCodeLocation
$cfrom :: forall x. FunctionCodeLocation -> Rep FunctionCodeLocation x
Prelude.Generic)

-- |
-- Create a value of 'FunctionCodeLocation' 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:
--
-- 'location', 'functionCodeLocation_location' - A presigned URL that you can use to download the deployment package.
--
-- 'resolvedImageUri', 'functionCodeLocation_resolvedImageUri' - The resolved URI for the image.
--
-- 'imageUri', 'functionCodeLocation_imageUri' - URI of a container image in the Amazon ECR registry.
--
-- 'repositoryType', 'functionCodeLocation_repositoryType' - The service that\'s hosting the file.
newFunctionCodeLocation ::
  FunctionCodeLocation
newFunctionCodeLocation :: FunctionCodeLocation
newFunctionCodeLocation =
  FunctionCodeLocation' :: Maybe Text
-> Maybe Text -> Maybe Text -> Maybe Text -> FunctionCodeLocation
FunctionCodeLocation'
    { $sel:location:FunctionCodeLocation' :: Maybe Text
location = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:resolvedImageUri:FunctionCodeLocation' :: Maybe Text
resolvedImageUri = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:imageUri:FunctionCodeLocation' :: Maybe Text
imageUri = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:repositoryType:FunctionCodeLocation' :: Maybe Text
repositoryType = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | A presigned URL that you can use to download the deployment package.
functionCodeLocation_location :: Lens.Lens' FunctionCodeLocation (Prelude.Maybe Prelude.Text)
functionCodeLocation_location :: (Maybe Text -> f (Maybe Text))
-> FunctionCodeLocation -> f FunctionCodeLocation
functionCodeLocation_location = (FunctionCodeLocation -> Maybe Text)
-> (FunctionCodeLocation -> Maybe Text -> FunctionCodeLocation)
-> Lens
     FunctionCodeLocation FunctionCodeLocation (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FunctionCodeLocation' {Maybe Text
location :: Maybe Text
$sel:location:FunctionCodeLocation' :: FunctionCodeLocation -> Maybe Text
location} -> Maybe Text
location) (\s :: FunctionCodeLocation
s@FunctionCodeLocation' {} Maybe Text
a -> FunctionCodeLocation
s {$sel:location:FunctionCodeLocation' :: Maybe Text
location = Maybe Text
a} :: FunctionCodeLocation)

-- | The resolved URI for the image.
functionCodeLocation_resolvedImageUri :: Lens.Lens' FunctionCodeLocation (Prelude.Maybe Prelude.Text)
functionCodeLocation_resolvedImageUri :: (Maybe Text -> f (Maybe Text))
-> FunctionCodeLocation -> f FunctionCodeLocation
functionCodeLocation_resolvedImageUri = (FunctionCodeLocation -> Maybe Text)
-> (FunctionCodeLocation -> Maybe Text -> FunctionCodeLocation)
-> Lens
     FunctionCodeLocation FunctionCodeLocation (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FunctionCodeLocation' {Maybe Text
resolvedImageUri :: Maybe Text
$sel:resolvedImageUri:FunctionCodeLocation' :: FunctionCodeLocation -> Maybe Text
resolvedImageUri} -> Maybe Text
resolvedImageUri) (\s :: FunctionCodeLocation
s@FunctionCodeLocation' {} Maybe Text
a -> FunctionCodeLocation
s {$sel:resolvedImageUri:FunctionCodeLocation' :: Maybe Text
resolvedImageUri = Maybe Text
a} :: FunctionCodeLocation)

-- | URI of a container image in the Amazon ECR registry.
functionCodeLocation_imageUri :: Lens.Lens' FunctionCodeLocation (Prelude.Maybe Prelude.Text)
functionCodeLocation_imageUri :: (Maybe Text -> f (Maybe Text))
-> FunctionCodeLocation -> f FunctionCodeLocation
functionCodeLocation_imageUri = (FunctionCodeLocation -> Maybe Text)
-> (FunctionCodeLocation -> Maybe Text -> FunctionCodeLocation)
-> Lens
     FunctionCodeLocation FunctionCodeLocation (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FunctionCodeLocation' {Maybe Text
imageUri :: Maybe Text
$sel:imageUri:FunctionCodeLocation' :: FunctionCodeLocation -> Maybe Text
imageUri} -> Maybe Text
imageUri) (\s :: FunctionCodeLocation
s@FunctionCodeLocation' {} Maybe Text
a -> FunctionCodeLocation
s {$sel:imageUri:FunctionCodeLocation' :: Maybe Text
imageUri = Maybe Text
a} :: FunctionCodeLocation)

-- | The service that\'s hosting the file.
functionCodeLocation_repositoryType :: Lens.Lens' FunctionCodeLocation (Prelude.Maybe Prelude.Text)
functionCodeLocation_repositoryType :: (Maybe Text -> f (Maybe Text))
-> FunctionCodeLocation -> f FunctionCodeLocation
functionCodeLocation_repositoryType = (FunctionCodeLocation -> Maybe Text)
-> (FunctionCodeLocation -> Maybe Text -> FunctionCodeLocation)
-> Lens
     FunctionCodeLocation FunctionCodeLocation (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FunctionCodeLocation' {Maybe Text
repositoryType :: Maybe Text
$sel:repositoryType:FunctionCodeLocation' :: FunctionCodeLocation -> Maybe Text
repositoryType} -> Maybe Text
repositoryType) (\s :: FunctionCodeLocation
s@FunctionCodeLocation' {} Maybe Text
a -> FunctionCodeLocation
s {$sel:repositoryType:FunctionCodeLocation' :: Maybe Text
repositoryType = Maybe Text
a} :: FunctionCodeLocation)

instance Core.FromJSON FunctionCodeLocation where
  parseJSON :: Value -> Parser FunctionCodeLocation
parseJSON =
    String
-> (Object -> Parser FunctionCodeLocation)
-> Value
-> Parser FunctionCodeLocation
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"FunctionCodeLocation"
      ( \Object
x ->
          Maybe Text
-> Maybe Text -> Maybe Text -> Maybe Text -> FunctionCodeLocation
FunctionCodeLocation'
            (Maybe Text
 -> Maybe Text -> Maybe Text -> Maybe Text -> FunctionCodeLocation)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text -> Maybe Text -> Maybe Text -> FunctionCodeLocation)
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
"Location")
            Parser
  (Maybe Text -> Maybe Text -> Maybe Text -> FunctionCodeLocation)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe Text -> FunctionCodeLocation)
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
"ResolvedImageUri")
            Parser (Maybe Text -> Maybe Text -> FunctionCodeLocation)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> FunctionCodeLocation)
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
"ImageUri")
            Parser (Maybe Text -> FunctionCodeLocation)
-> Parser (Maybe Text) -> Parser FunctionCodeLocation
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
"RepositoryType")
      )

instance Prelude.Hashable FunctionCodeLocation

instance Prelude.NFData FunctionCodeLocation