{-# 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.EMRContainers.Types.VirtualCluster
-- 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.EMRContainers.Types.VirtualCluster where

import qualified Amazonka.Core as Core
import Amazonka.EMRContainers.Types.ContainerProvider
import Amazonka.EMRContainers.Types.VirtualClusterState
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | This entity describes a virtual cluster. A virtual cluster is a
-- Kubernetes namespace that Amazon EMR is registered with. Amazon EMR uses
-- virtual clusters to run jobs and host endpoints. Multiple virtual
-- clusters can be backed by the same physical cluster. However, each
-- virtual cluster maps to one namespace on an EKS cluster. Virtual
-- clusters do not create any active resources that contribute to your bill
-- or that require lifecycle management outside the service.
--
-- /See:/ 'newVirtualCluster' smart constructor.
data VirtualCluster = VirtualCluster'
  { -- | The state of the virtual cluster.
    VirtualCluster -> Maybe VirtualClusterState
state :: Prelude.Maybe VirtualClusterState,
    -- | The ARN of the virtual cluster.
    VirtualCluster -> Maybe Text
arn :: Prelude.Maybe Prelude.Text,
    -- | The date and time when the virtual cluster is created.
    VirtualCluster -> Maybe POSIX
createdAt :: Prelude.Maybe Core.POSIX,
    -- | The name of the virtual cluster.
    VirtualCluster -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The ID of the virtual cluster.
    VirtualCluster -> Maybe Text
id :: Prelude.Maybe Prelude.Text,
    -- | The container provider of the virtual cluster.
    VirtualCluster -> Maybe ContainerProvider
containerProvider :: Prelude.Maybe ContainerProvider,
    -- | The assigned tags of the virtual cluster.
    VirtualCluster -> Maybe (HashMap Text Text)
tags :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text)
  }
  deriving (VirtualCluster -> VirtualCluster -> Bool
(VirtualCluster -> VirtualCluster -> Bool)
-> (VirtualCluster -> VirtualCluster -> Bool) -> Eq VirtualCluster
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: VirtualCluster -> VirtualCluster -> Bool
$c/= :: VirtualCluster -> VirtualCluster -> Bool
== :: VirtualCluster -> VirtualCluster -> Bool
$c== :: VirtualCluster -> VirtualCluster -> Bool
Prelude.Eq, ReadPrec [VirtualCluster]
ReadPrec VirtualCluster
Int -> ReadS VirtualCluster
ReadS [VirtualCluster]
(Int -> ReadS VirtualCluster)
-> ReadS [VirtualCluster]
-> ReadPrec VirtualCluster
-> ReadPrec [VirtualCluster]
-> Read VirtualCluster
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [VirtualCluster]
$creadListPrec :: ReadPrec [VirtualCluster]
readPrec :: ReadPrec VirtualCluster
$creadPrec :: ReadPrec VirtualCluster
readList :: ReadS [VirtualCluster]
$creadList :: ReadS [VirtualCluster]
readsPrec :: Int -> ReadS VirtualCluster
$creadsPrec :: Int -> ReadS VirtualCluster
Prelude.Read, Int -> VirtualCluster -> ShowS
[VirtualCluster] -> ShowS
VirtualCluster -> String
(Int -> VirtualCluster -> ShowS)
-> (VirtualCluster -> String)
-> ([VirtualCluster] -> ShowS)
-> Show VirtualCluster
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [VirtualCluster] -> ShowS
$cshowList :: [VirtualCluster] -> ShowS
show :: VirtualCluster -> String
$cshow :: VirtualCluster -> String
showsPrec :: Int -> VirtualCluster -> ShowS
$cshowsPrec :: Int -> VirtualCluster -> ShowS
Prelude.Show, (forall x. VirtualCluster -> Rep VirtualCluster x)
-> (forall x. Rep VirtualCluster x -> VirtualCluster)
-> Generic VirtualCluster
forall x. Rep VirtualCluster x -> VirtualCluster
forall x. VirtualCluster -> Rep VirtualCluster x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep VirtualCluster x -> VirtualCluster
$cfrom :: forall x. VirtualCluster -> Rep VirtualCluster x
Prelude.Generic)

-- |
-- Create a value of 'VirtualCluster' 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:
--
-- 'state', 'virtualCluster_state' - The state of the virtual cluster.
--
-- 'arn', 'virtualCluster_arn' - The ARN of the virtual cluster.
--
-- 'createdAt', 'virtualCluster_createdAt' - The date and time when the virtual cluster is created.
--
-- 'name', 'virtualCluster_name' - The name of the virtual cluster.
--
-- 'id', 'virtualCluster_id' - The ID of the virtual cluster.
--
-- 'containerProvider', 'virtualCluster_containerProvider' - The container provider of the virtual cluster.
--
-- 'tags', 'virtualCluster_tags' - The assigned tags of the virtual cluster.
newVirtualCluster ::
  VirtualCluster
newVirtualCluster :: VirtualCluster
newVirtualCluster =
  VirtualCluster' :: Maybe VirtualClusterState
-> Maybe Text
-> Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Maybe ContainerProvider
-> Maybe (HashMap Text Text)
-> VirtualCluster
VirtualCluster'
    { $sel:state:VirtualCluster' :: Maybe VirtualClusterState
state = Maybe VirtualClusterState
forall a. Maybe a
Prelude.Nothing,
      $sel:arn:VirtualCluster' :: Maybe Text
arn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:createdAt:VirtualCluster' :: Maybe POSIX
createdAt = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:name:VirtualCluster' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:id:VirtualCluster' :: Maybe Text
id = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:containerProvider:VirtualCluster' :: Maybe ContainerProvider
containerProvider = Maybe ContainerProvider
forall a. Maybe a
Prelude.Nothing,
      $sel:tags:VirtualCluster' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing
    }

-- | The state of the virtual cluster.
virtualCluster_state :: Lens.Lens' VirtualCluster (Prelude.Maybe VirtualClusterState)
virtualCluster_state :: (Maybe VirtualClusterState -> f (Maybe VirtualClusterState))
-> VirtualCluster -> f VirtualCluster
virtualCluster_state = (VirtualCluster -> Maybe VirtualClusterState)
-> (VirtualCluster -> Maybe VirtualClusterState -> VirtualCluster)
-> Lens
     VirtualCluster
     VirtualCluster
     (Maybe VirtualClusterState)
     (Maybe VirtualClusterState)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VirtualCluster' {Maybe VirtualClusterState
state :: Maybe VirtualClusterState
$sel:state:VirtualCluster' :: VirtualCluster -> Maybe VirtualClusterState
state} -> Maybe VirtualClusterState
state) (\s :: VirtualCluster
s@VirtualCluster' {} Maybe VirtualClusterState
a -> VirtualCluster
s {$sel:state:VirtualCluster' :: Maybe VirtualClusterState
state = Maybe VirtualClusterState
a} :: VirtualCluster)

-- | The ARN of the virtual cluster.
virtualCluster_arn :: Lens.Lens' VirtualCluster (Prelude.Maybe Prelude.Text)
virtualCluster_arn :: (Maybe Text -> f (Maybe Text))
-> VirtualCluster -> f VirtualCluster
virtualCluster_arn = (VirtualCluster -> Maybe Text)
-> (VirtualCluster -> Maybe Text -> VirtualCluster)
-> Lens VirtualCluster VirtualCluster (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VirtualCluster' {Maybe Text
arn :: Maybe Text
$sel:arn:VirtualCluster' :: VirtualCluster -> Maybe Text
arn} -> Maybe Text
arn) (\s :: VirtualCluster
s@VirtualCluster' {} Maybe Text
a -> VirtualCluster
s {$sel:arn:VirtualCluster' :: Maybe Text
arn = Maybe Text
a} :: VirtualCluster)

-- | The date and time when the virtual cluster is created.
virtualCluster_createdAt :: Lens.Lens' VirtualCluster (Prelude.Maybe Prelude.UTCTime)
virtualCluster_createdAt :: (Maybe UTCTime -> f (Maybe UTCTime))
-> VirtualCluster -> f VirtualCluster
virtualCluster_createdAt = (VirtualCluster -> Maybe POSIX)
-> (VirtualCluster -> Maybe POSIX -> VirtualCluster)
-> Lens VirtualCluster VirtualCluster (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VirtualCluster' {Maybe POSIX
createdAt :: Maybe POSIX
$sel:createdAt:VirtualCluster' :: VirtualCluster -> Maybe POSIX
createdAt} -> Maybe POSIX
createdAt) (\s :: VirtualCluster
s@VirtualCluster' {} Maybe POSIX
a -> VirtualCluster
s {$sel:createdAt:VirtualCluster' :: Maybe POSIX
createdAt = Maybe POSIX
a} :: VirtualCluster) ((Maybe POSIX -> f (Maybe POSIX))
 -> VirtualCluster -> f VirtualCluster)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> VirtualCluster
-> f VirtualCluster
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The name of the virtual cluster.
virtualCluster_name :: Lens.Lens' VirtualCluster (Prelude.Maybe Prelude.Text)
virtualCluster_name :: (Maybe Text -> f (Maybe Text))
-> VirtualCluster -> f VirtualCluster
virtualCluster_name = (VirtualCluster -> Maybe Text)
-> (VirtualCluster -> Maybe Text -> VirtualCluster)
-> Lens VirtualCluster VirtualCluster (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VirtualCluster' {Maybe Text
name :: Maybe Text
$sel:name:VirtualCluster' :: VirtualCluster -> Maybe Text
name} -> Maybe Text
name) (\s :: VirtualCluster
s@VirtualCluster' {} Maybe Text
a -> VirtualCluster
s {$sel:name:VirtualCluster' :: Maybe Text
name = Maybe Text
a} :: VirtualCluster)

-- | The ID of the virtual cluster.
virtualCluster_id :: Lens.Lens' VirtualCluster (Prelude.Maybe Prelude.Text)
virtualCluster_id :: (Maybe Text -> f (Maybe Text))
-> VirtualCluster -> f VirtualCluster
virtualCluster_id = (VirtualCluster -> Maybe Text)
-> (VirtualCluster -> Maybe Text -> VirtualCluster)
-> Lens VirtualCluster VirtualCluster (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VirtualCluster' {Maybe Text
id :: Maybe Text
$sel:id:VirtualCluster' :: VirtualCluster -> Maybe Text
id} -> Maybe Text
id) (\s :: VirtualCluster
s@VirtualCluster' {} Maybe Text
a -> VirtualCluster
s {$sel:id:VirtualCluster' :: Maybe Text
id = Maybe Text
a} :: VirtualCluster)

-- | The container provider of the virtual cluster.
virtualCluster_containerProvider :: Lens.Lens' VirtualCluster (Prelude.Maybe ContainerProvider)
virtualCluster_containerProvider :: (Maybe ContainerProvider -> f (Maybe ContainerProvider))
-> VirtualCluster -> f VirtualCluster
virtualCluster_containerProvider = (VirtualCluster -> Maybe ContainerProvider)
-> (VirtualCluster -> Maybe ContainerProvider -> VirtualCluster)
-> Lens
     VirtualCluster
     VirtualCluster
     (Maybe ContainerProvider)
     (Maybe ContainerProvider)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VirtualCluster' {Maybe ContainerProvider
containerProvider :: Maybe ContainerProvider
$sel:containerProvider:VirtualCluster' :: VirtualCluster -> Maybe ContainerProvider
containerProvider} -> Maybe ContainerProvider
containerProvider) (\s :: VirtualCluster
s@VirtualCluster' {} Maybe ContainerProvider
a -> VirtualCluster
s {$sel:containerProvider:VirtualCluster' :: Maybe ContainerProvider
containerProvider = Maybe ContainerProvider
a} :: VirtualCluster)

-- | The assigned tags of the virtual cluster.
virtualCluster_tags :: Lens.Lens' VirtualCluster (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
virtualCluster_tags :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> VirtualCluster -> f VirtualCluster
virtualCluster_tags = (VirtualCluster -> Maybe (HashMap Text Text))
-> (VirtualCluster -> Maybe (HashMap Text Text) -> VirtualCluster)
-> Lens
     VirtualCluster
     VirtualCluster
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VirtualCluster' {Maybe (HashMap Text Text)
tags :: Maybe (HashMap Text Text)
$sel:tags:VirtualCluster' :: VirtualCluster -> Maybe (HashMap Text Text)
tags} -> Maybe (HashMap Text Text)
tags) (\s :: VirtualCluster
s@VirtualCluster' {} Maybe (HashMap Text Text)
a -> VirtualCluster
s {$sel:tags:VirtualCluster' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
a} :: VirtualCluster) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
 -> VirtualCluster -> f VirtualCluster)
-> ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
    -> Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> VirtualCluster
-> f VirtualCluster
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
-> Iso
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text 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
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.FromJSON VirtualCluster where
  parseJSON :: Value -> Parser VirtualCluster
parseJSON =
    String
-> (Object -> Parser VirtualCluster)
-> Value
-> Parser VirtualCluster
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"VirtualCluster"
      ( \Object
x ->
          Maybe VirtualClusterState
-> Maybe Text
-> Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Maybe ContainerProvider
-> Maybe (HashMap Text Text)
-> VirtualCluster
VirtualCluster'
            (Maybe VirtualClusterState
 -> Maybe Text
 -> Maybe POSIX
 -> Maybe Text
 -> Maybe Text
 -> Maybe ContainerProvider
 -> Maybe (HashMap Text Text)
 -> VirtualCluster)
-> Parser (Maybe VirtualClusterState)
-> Parser
     (Maybe Text
      -> Maybe POSIX
      -> Maybe Text
      -> Maybe Text
      -> Maybe ContainerProvider
      -> Maybe (HashMap Text Text)
      -> VirtualCluster)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe VirtualClusterState)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"state")
            Parser
  (Maybe Text
   -> Maybe POSIX
   -> Maybe Text
   -> Maybe Text
   -> Maybe ContainerProvider
   -> Maybe (HashMap Text Text)
   -> VirtualCluster)
-> Parser (Maybe Text)
-> Parser
     (Maybe POSIX
      -> Maybe Text
      -> Maybe Text
      -> Maybe ContainerProvider
      -> Maybe (HashMap Text Text)
      -> VirtualCluster)
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
"arn")
            Parser
  (Maybe POSIX
   -> Maybe Text
   -> Maybe Text
   -> Maybe ContainerProvider
   -> Maybe (HashMap Text Text)
   -> VirtualCluster)
-> Parser (Maybe POSIX)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe ContainerProvider
      -> Maybe (HashMap Text Text)
      -> VirtualCluster)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"createdAt")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe ContainerProvider
   -> Maybe (HashMap Text Text)
   -> VirtualCluster)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe ContainerProvider
      -> Maybe (HashMap Text Text)
      -> VirtualCluster)
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")
            Parser
  (Maybe Text
   -> Maybe ContainerProvider
   -> Maybe (HashMap Text Text)
   -> VirtualCluster)
-> Parser (Maybe Text)
-> Parser
     (Maybe ContainerProvider
      -> Maybe (HashMap Text Text) -> VirtualCluster)
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
"id")
            Parser
  (Maybe ContainerProvider
   -> Maybe (HashMap Text Text) -> VirtualCluster)
-> Parser (Maybe ContainerProvider)
-> Parser (Maybe (HashMap Text Text) -> VirtualCluster)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe ContainerProvider)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"containerProvider")
            Parser (Maybe (HashMap Text Text) -> VirtualCluster)
-> Parser (Maybe (HashMap Text Text)) -> Parser VirtualCluster
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe (HashMap Text Text)))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"tags" Parser (Maybe (Maybe (HashMap Text Text)))
-> Maybe (HashMap Text Text) -> Parser (Maybe (HashMap Text Text))
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe (HashMap Text Text)
forall a. Monoid a => a
Prelude.mempty)
      )

instance Prelude.Hashable VirtualCluster

instance Prelude.NFData VirtualCluster