{-# 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.CodeArtifact.Types.LicenseInfo
-- 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.CodeArtifact.Types.LicenseInfo where

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

-- | Details of the license data.
--
-- /See:/ 'newLicenseInfo' smart constructor.
data LicenseInfo = LicenseInfo'
  { -- | The URL for license data.
    LicenseInfo -> Maybe Text
url :: Prelude.Maybe Prelude.Text,
    -- | Name of the license.
    LicenseInfo -> Maybe Text
name :: Prelude.Maybe Prelude.Text
  }
  deriving (LicenseInfo -> LicenseInfo -> Bool
(LicenseInfo -> LicenseInfo -> Bool)
-> (LicenseInfo -> LicenseInfo -> Bool) -> Eq LicenseInfo
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LicenseInfo -> LicenseInfo -> Bool
$c/= :: LicenseInfo -> LicenseInfo -> Bool
== :: LicenseInfo -> LicenseInfo -> Bool
$c== :: LicenseInfo -> LicenseInfo -> Bool
Prelude.Eq, ReadPrec [LicenseInfo]
ReadPrec LicenseInfo
Int -> ReadS LicenseInfo
ReadS [LicenseInfo]
(Int -> ReadS LicenseInfo)
-> ReadS [LicenseInfo]
-> ReadPrec LicenseInfo
-> ReadPrec [LicenseInfo]
-> Read LicenseInfo
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [LicenseInfo]
$creadListPrec :: ReadPrec [LicenseInfo]
readPrec :: ReadPrec LicenseInfo
$creadPrec :: ReadPrec LicenseInfo
readList :: ReadS [LicenseInfo]
$creadList :: ReadS [LicenseInfo]
readsPrec :: Int -> ReadS LicenseInfo
$creadsPrec :: Int -> ReadS LicenseInfo
Prelude.Read, Int -> LicenseInfo -> ShowS
[LicenseInfo] -> ShowS
LicenseInfo -> String
(Int -> LicenseInfo -> ShowS)
-> (LicenseInfo -> String)
-> ([LicenseInfo] -> ShowS)
-> Show LicenseInfo
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [LicenseInfo] -> ShowS
$cshowList :: [LicenseInfo] -> ShowS
show :: LicenseInfo -> String
$cshow :: LicenseInfo -> String
showsPrec :: Int -> LicenseInfo -> ShowS
$cshowsPrec :: Int -> LicenseInfo -> ShowS
Prelude.Show, (forall x. LicenseInfo -> Rep LicenseInfo x)
-> (forall x. Rep LicenseInfo x -> LicenseInfo)
-> Generic LicenseInfo
forall x. Rep LicenseInfo x -> LicenseInfo
forall x. LicenseInfo -> Rep LicenseInfo x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep LicenseInfo x -> LicenseInfo
$cfrom :: forall x. LicenseInfo -> Rep LicenseInfo x
Prelude.Generic)

-- |
-- Create a value of 'LicenseInfo' 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:
--
-- 'url', 'licenseInfo_url' - The URL for license data.
--
-- 'name', 'licenseInfo_name' - Name of the license.
newLicenseInfo ::
  LicenseInfo
newLicenseInfo :: LicenseInfo
newLicenseInfo =
  LicenseInfo' :: Maybe Text -> Maybe Text -> LicenseInfo
LicenseInfo'
    { $sel:url:LicenseInfo' :: Maybe Text
url = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:name:LicenseInfo' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The URL for license data.
licenseInfo_url :: Lens.Lens' LicenseInfo (Prelude.Maybe Prelude.Text)
licenseInfo_url :: (Maybe Text -> f (Maybe Text)) -> LicenseInfo -> f LicenseInfo
licenseInfo_url = (LicenseInfo -> Maybe Text)
-> (LicenseInfo -> Maybe Text -> LicenseInfo)
-> Lens LicenseInfo LicenseInfo (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LicenseInfo' {Maybe Text
url :: Maybe Text
$sel:url:LicenseInfo' :: LicenseInfo -> Maybe Text
url} -> Maybe Text
url) (\s :: LicenseInfo
s@LicenseInfo' {} Maybe Text
a -> LicenseInfo
s {$sel:url:LicenseInfo' :: Maybe Text
url = Maybe Text
a} :: LicenseInfo)

-- | Name of the license.
licenseInfo_name :: Lens.Lens' LicenseInfo (Prelude.Maybe Prelude.Text)
licenseInfo_name :: (Maybe Text -> f (Maybe Text)) -> LicenseInfo -> f LicenseInfo
licenseInfo_name = (LicenseInfo -> Maybe Text)
-> (LicenseInfo -> Maybe Text -> LicenseInfo)
-> Lens LicenseInfo LicenseInfo (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LicenseInfo' {Maybe Text
name :: Maybe Text
$sel:name:LicenseInfo' :: LicenseInfo -> Maybe Text
name} -> Maybe Text
name) (\s :: LicenseInfo
s@LicenseInfo' {} Maybe Text
a -> LicenseInfo
s {$sel:name:LicenseInfo' :: Maybe Text
name = Maybe Text
a} :: LicenseInfo)

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

instance Prelude.NFData LicenseInfo