{-# 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 #-}
module Amazonka.ImageBuilder.Types.Distribution where
import qualified Amazonka.Core as Core
import Amazonka.ImageBuilder.Types.AmiDistributionConfiguration
import Amazonka.ImageBuilder.Types.ContainerDistributionConfiguration
import Amazonka.ImageBuilder.Types.LaunchTemplateConfiguration
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data Distribution = Distribution'
{
Distribution -> Maybe AmiDistributionConfiguration
amiDistributionConfiguration :: Prelude.Maybe AmiDistributionConfiguration,
Distribution -> Maybe (NonEmpty LaunchTemplateConfiguration)
launchTemplateConfigurations :: Prelude.Maybe (Prelude.NonEmpty LaunchTemplateConfiguration),
Distribution -> Maybe (NonEmpty Text)
licenseConfigurationArns :: Prelude.Maybe (Prelude.NonEmpty Prelude.Text),
Distribution -> Maybe ContainerDistributionConfiguration
containerDistributionConfiguration :: Prelude.Maybe ContainerDistributionConfiguration,
Distribution -> Text
region :: Prelude.Text
}
deriving (Distribution -> Distribution -> Bool
(Distribution -> Distribution -> Bool)
-> (Distribution -> Distribution -> Bool) -> Eq Distribution
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Distribution -> Distribution -> Bool
$c/= :: Distribution -> Distribution -> Bool
== :: Distribution -> Distribution -> Bool
$c== :: Distribution -> Distribution -> Bool
Prelude.Eq, ReadPrec [Distribution]
ReadPrec Distribution
Int -> ReadS Distribution
ReadS [Distribution]
(Int -> ReadS Distribution)
-> ReadS [Distribution]
-> ReadPrec Distribution
-> ReadPrec [Distribution]
-> Read Distribution
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Distribution]
$creadListPrec :: ReadPrec [Distribution]
readPrec :: ReadPrec Distribution
$creadPrec :: ReadPrec Distribution
readList :: ReadS [Distribution]
$creadList :: ReadS [Distribution]
readsPrec :: Int -> ReadS Distribution
$creadsPrec :: Int -> ReadS Distribution
Prelude.Read, Int -> Distribution -> ShowS
[Distribution] -> ShowS
Distribution -> String
(Int -> Distribution -> ShowS)
-> (Distribution -> String)
-> ([Distribution] -> ShowS)
-> Show Distribution
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Distribution] -> ShowS
$cshowList :: [Distribution] -> ShowS
show :: Distribution -> String
$cshow :: Distribution -> String
showsPrec :: Int -> Distribution -> ShowS
$cshowsPrec :: Int -> Distribution -> ShowS
Prelude.Show, (forall x. Distribution -> Rep Distribution x)
-> (forall x. Rep Distribution x -> Distribution)
-> Generic Distribution
forall x. Rep Distribution x -> Distribution
forall x. Distribution -> Rep Distribution x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Distribution x -> Distribution
$cfrom :: forall x. Distribution -> Rep Distribution x
Prelude.Generic)
newDistribution ::
Prelude.Text ->
Distribution
newDistribution :: Text -> Distribution
newDistribution Text
pRegion_ =
Distribution' :: Maybe AmiDistributionConfiguration
-> Maybe (NonEmpty LaunchTemplateConfiguration)
-> Maybe (NonEmpty Text)
-> Maybe ContainerDistributionConfiguration
-> Text
-> Distribution
Distribution'
{ $sel:amiDistributionConfiguration:Distribution' :: Maybe AmiDistributionConfiguration
amiDistributionConfiguration =
Maybe AmiDistributionConfiguration
forall a. Maybe a
Prelude.Nothing,
$sel:launchTemplateConfigurations:Distribution' :: Maybe (NonEmpty LaunchTemplateConfiguration)
launchTemplateConfigurations = Maybe (NonEmpty LaunchTemplateConfiguration)
forall a. Maybe a
Prelude.Nothing,
$sel:licenseConfigurationArns:Distribution' :: Maybe (NonEmpty Text)
licenseConfigurationArns = Maybe (NonEmpty Text)
forall a. Maybe a
Prelude.Nothing,
$sel:containerDistributionConfiguration:Distribution' :: Maybe ContainerDistributionConfiguration
containerDistributionConfiguration = Maybe ContainerDistributionConfiguration
forall a. Maybe a
Prelude.Nothing,
$sel:region:Distribution' :: Text
region = Text
pRegion_
}
distribution_amiDistributionConfiguration :: Lens.Lens' Distribution (Prelude.Maybe AmiDistributionConfiguration)
distribution_amiDistributionConfiguration :: (Maybe AmiDistributionConfiguration
-> f (Maybe AmiDistributionConfiguration))
-> Distribution -> f Distribution
distribution_amiDistributionConfiguration = (Distribution -> Maybe AmiDistributionConfiguration)
-> (Distribution
-> Maybe AmiDistributionConfiguration -> Distribution)
-> Lens
Distribution
Distribution
(Maybe AmiDistributionConfiguration)
(Maybe AmiDistributionConfiguration)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Distribution' {Maybe AmiDistributionConfiguration
amiDistributionConfiguration :: Maybe AmiDistributionConfiguration
$sel:amiDistributionConfiguration:Distribution' :: Distribution -> Maybe AmiDistributionConfiguration
amiDistributionConfiguration} -> Maybe AmiDistributionConfiguration
amiDistributionConfiguration) (\s :: Distribution
s@Distribution' {} Maybe AmiDistributionConfiguration
a -> Distribution
s {$sel:amiDistributionConfiguration:Distribution' :: Maybe AmiDistributionConfiguration
amiDistributionConfiguration = Maybe AmiDistributionConfiguration
a} :: Distribution)
distribution_launchTemplateConfigurations :: Lens.Lens' Distribution (Prelude.Maybe (Prelude.NonEmpty LaunchTemplateConfiguration))
distribution_launchTemplateConfigurations :: (Maybe (NonEmpty LaunchTemplateConfiguration)
-> f (Maybe (NonEmpty LaunchTemplateConfiguration)))
-> Distribution -> f Distribution
distribution_launchTemplateConfigurations = (Distribution -> Maybe (NonEmpty LaunchTemplateConfiguration))
-> (Distribution
-> Maybe (NonEmpty LaunchTemplateConfiguration) -> Distribution)
-> Lens
Distribution
Distribution
(Maybe (NonEmpty LaunchTemplateConfiguration))
(Maybe (NonEmpty LaunchTemplateConfiguration))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Distribution' {Maybe (NonEmpty LaunchTemplateConfiguration)
launchTemplateConfigurations :: Maybe (NonEmpty LaunchTemplateConfiguration)
$sel:launchTemplateConfigurations:Distribution' :: Distribution -> Maybe (NonEmpty LaunchTemplateConfiguration)
launchTemplateConfigurations} -> Maybe (NonEmpty LaunchTemplateConfiguration)
launchTemplateConfigurations) (\s :: Distribution
s@Distribution' {} Maybe (NonEmpty LaunchTemplateConfiguration)
a -> Distribution
s {$sel:launchTemplateConfigurations:Distribution' :: Maybe (NonEmpty LaunchTemplateConfiguration)
launchTemplateConfigurations = Maybe (NonEmpty LaunchTemplateConfiguration)
a} :: Distribution) ((Maybe (NonEmpty LaunchTemplateConfiguration)
-> f (Maybe (NonEmpty LaunchTemplateConfiguration)))
-> Distribution -> f Distribution)
-> ((Maybe (NonEmpty LaunchTemplateConfiguration)
-> f (Maybe (NonEmpty LaunchTemplateConfiguration)))
-> Maybe (NonEmpty LaunchTemplateConfiguration)
-> f (Maybe (NonEmpty LaunchTemplateConfiguration)))
-> (Maybe (NonEmpty LaunchTemplateConfiguration)
-> f (Maybe (NonEmpty LaunchTemplateConfiguration)))
-> Distribution
-> f Distribution
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
(NonEmpty LaunchTemplateConfiguration)
(NonEmpty LaunchTemplateConfiguration)
(NonEmpty LaunchTemplateConfiguration)
(NonEmpty LaunchTemplateConfiguration)
-> Iso
(Maybe (NonEmpty LaunchTemplateConfiguration))
(Maybe (NonEmpty LaunchTemplateConfiguration))
(Maybe (NonEmpty LaunchTemplateConfiguration))
(Maybe (NonEmpty LaunchTemplateConfiguration))
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
(NonEmpty LaunchTemplateConfiguration)
(NonEmpty LaunchTemplateConfiguration)
(NonEmpty LaunchTemplateConfiguration)
(NonEmpty LaunchTemplateConfiguration)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
distribution_licenseConfigurationArns :: Lens.Lens' Distribution (Prelude.Maybe (Prelude.NonEmpty Prelude.Text))
distribution_licenseConfigurationArns :: (Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> Distribution -> f Distribution
distribution_licenseConfigurationArns = (Distribution -> Maybe (NonEmpty Text))
-> (Distribution -> Maybe (NonEmpty Text) -> Distribution)
-> Lens
Distribution
Distribution
(Maybe (NonEmpty Text))
(Maybe (NonEmpty Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Distribution' {Maybe (NonEmpty Text)
licenseConfigurationArns :: Maybe (NonEmpty Text)
$sel:licenseConfigurationArns:Distribution' :: Distribution -> Maybe (NonEmpty Text)
licenseConfigurationArns} -> Maybe (NonEmpty Text)
licenseConfigurationArns) (\s :: Distribution
s@Distribution' {} Maybe (NonEmpty Text)
a -> Distribution
s {$sel:licenseConfigurationArns:Distribution' :: Maybe (NonEmpty Text)
licenseConfigurationArns = Maybe (NonEmpty Text)
a} :: Distribution) ((Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> Distribution -> f Distribution)
-> ((Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> (Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> Distribution
-> f Distribution
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
(NonEmpty Text) (NonEmpty Text) (NonEmpty Text) (NonEmpty Text)
-> Iso
(Maybe (NonEmpty Text))
(Maybe (NonEmpty Text))
(Maybe (NonEmpty Text))
(Maybe (NonEmpty Text))
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
(NonEmpty Text) (NonEmpty Text) (NonEmpty Text) (NonEmpty Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
distribution_containerDistributionConfiguration :: Lens.Lens' Distribution (Prelude.Maybe ContainerDistributionConfiguration)
distribution_containerDistributionConfiguration :: (Maybe ContainerDistributionConfiguration
-> f (Maybe ContainerDistributionConfiguration))
-> Distribution -> f Distribution
distribution_containerDistributionConfiguration = (Distribution -> Maybe ContainerDistributionConfiguration)
-> (Distribution
-> Maybe ContainerDistributionConfiguration -> Distribution)
-> Lens
Distribution
Distribution
(Maybe ContainerDistributionConfiguration)
(Maybe ContainerDistributionConfiguration)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Distribution' {Maybe ContainerDistributionConfiguration
containerDistributionConfiguration :: Maybe ContainerDistributionConfiguration
$sel:containerDistributionConfiguration:Distribution' :: Distribution -> Maybe ContainerDistributionConfiguration
containerDistributionConfiguration} -> Maybe ContainerDistributionConfiguration
containerDistributionConfiguration) (\s :: Distribution
s@Distribution' {} Maybe ContainerDistributionConfiguration
a -> Distribution
s {$sel:containerDistributionConfiguration:Distribution' :: Maybe ContainerDistributionConfiguration
containerDistributionConfiguration = Maybe ContainerDistributionConfiguration
a} :: Distribution)
distribution_region :: Lens.Lens' Distribution Prelude.Text
distribution_region :: (Text -> f Text) -> Distribution -> f Distribution
distribution_region = (Distribution -> Text)
-> (Distribution -> Text -> Distribution)
-> Lens Distribution Distribution Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Distribution' {Text
region :: Text
$sel:region:Distribution' :: Distribution -> Text
region} -> Text
region) (\s :: Distribution
s@Distribution' {} Text
a -> Distribution
s {$sel:region:Distribution' :: Text
region = Text
a} :: Distribution)
instance Core.FromJSON Distribution where
parseJSON :: Value -> Parser Distribution
parseJSON =
String
-> (Object -> Parser Distribution) -> Value -> Parser Distribution
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"Distribution"
( \Object
x ->
Maybe AmiDistributionConfiguration
-> Maybe (NonEmpty LaunchTemplateConfiguration)
-> Maybe (NonEmpty Text)
-> Maybe ContainerDistributionConfiguration
-> Text
-> Distribution
Distribution'
(Maybe AmiDistributionConfiguration
-> Maybe (NonEmpty LaunchTemplateConfiguration)
-> Maybe (NonEmpty Text)
-> Maybe ContainerDistributionConfiguration
-> Text
-> Distribution)
-> Parser (Maybe AmiDistributionConfiguration)
-> Parser
(Maybe (NonEmpty LaunchTemplateConfiguration)
-> Maybe (NonEmpty Text)
-> Maybe ContainerDistributionConfiguration
-> Text
-> Distribution)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe AmiDistributionConfiguration)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"amiDistributionConfiguration")
Parser
(Maybe (NonEmpty LaunchTemplateConfiguration)
-> Maybe (NonEmpty Text)
-> Maybe ContainerDistributionConfiguration
-> Text
-> Distribution)
-> Parser (Maybe (NonEmpty LaunchTemplateConfiguration))
-> Parser
(Maybe (NonEmpty Text)
-> Maybe ContainerDistributionConfiguration
-> Text
-> Distribution)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object
-> Text -> Parser (Maybe (NonEmpty LaunchTemplateConfiguration))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"launchTemplateConfigurations")
Parser
(Maybe (NonEmpty Text)
-> Maybe ContainerDistributionConfiguration
-> Text
-> Distribution)
-> Parser (Maybe (NonEmpty Text))
-> Parser
(Maybe ContainerDistributionConfiguration -> Text -> Distribution)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (NonEmpty Text))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"licenseConfigurationArns")
Parser
(Maybe ContainerDistributionConfiguration -> Text -> Distribution)
-> Parser (Maybe ContainerDistributionConfiguration)
-> Parser (Text -> Distribution)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe ContainerDistributionConfiguration)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"containerDistributionConfiguration")
Parser (Text -> Distribution) -> Parser Text -> Parser Distribution
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"region")
)
instance Prelude.Hashable Distribution
instance Prelude.NFData Distribution
instance Core.ToJSON Distribution where
toJSON :: Distribution -> Value
toJSON Distribution' {Maybe (NonEmpty Text)
Maybe (NonEmpty LaunchTemplateConfiguration)
Maybe AmiDistributionConfiguration
Maybe ContainerDistributionConfiguration
Text
region :: Text
containerDistributionConfiguration :: Maybe ContainerDistributionConfiguration
licenseConfigurationArns :: Maybe (NonEmpty Text)
launchTemplateConfigurations :: Maybe (NonEmpty LaunchTemplateConfiguration)
amiDistributionConfiguration :: Maybe AmiDistributionConfiguration
$sel:region:Distribution' :: Distribution -> Text
$sel:containerDistributionConfiguration:Distribution' :: Distribution -> Maybe ContainerDistributionConfiguration
$sel:licenseConfigurationArns:Distribution' :: Distribution -> Maybe (NonEmpty Text)
$sel:launchTemplateConfigurations:Distribution' :: Distribution -> Maybe (NonEmpty LaunchTemplateConfiguration)
$sel:amiDistributionConfiguration:Distribution' :: Distribution -> Maybe AmiDistributionConfiguration
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"amiDistributionConfiguration" Text -> AmiDistributionConfiguration -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(AmiDistributionConfiguration -> Pair)
-> Maybe AmiDistributionConfiguration -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe AmiDistributionConfiguration
amiDistributionConfiguration,
(Text
"launchTemplateConfigurations" Text -> NonEmpty LaunchTemplateConfiguration -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(NonEmpty LaunchTemplateConfiguration -> Pair)
-> Maybe (NonEmpty LaunchTemplateConfiguration) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (NonEmpty LaunchTemplateConfiguration)
launchTemplateConfigurations,
(Text
"licenseConfigurationArns" Text -> NonEmpty Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(NonEmpty Text -> Pair) -> Maybe (NonEmpty Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (NonEmpty Text)
licenseConfigurationArns,
(Text
"containerDistributionConfiguration" Text -> ContainerDistributionConfiguration -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(ContainerDistributionConfiguration -> Pair)
-> Maybe ContainerDistributionConfiguration -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ContainerDistributionConfiguration
containerDistributionConfiguration,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"region" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
region)
]
)