{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.EMRContainers.Types.VirtualCluster where

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

-- | The ARN of the virtual cluster.
virtualCluster_arn :: Lens.Lens' VirtualCluster (Prelude.Maybe Prelude.Text)
virtualCluster_arn :: Lens' VirtualCluster (Maybe Text)
virtualCluster_arn = 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 container provider of the virtual cluster.
virtualCluster_containerProvider :: Lens.Lens' VirtualCluster (Prelude.Maybe ContainerProvider)
virtualCluster_containerProvider :: Lens' VirtualCluster (Maybe ContainerProvider)
virtualCluster_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 date and time when the virtual cluster is created.
virtualCluster_createdAt :: Lens.Lens' VirtualCluster (Prelude.Maybe Prelude.UTCTime)
virtualCluster_createdAt :: Lens' VirtualCluster (Maybe UTCTime)
virtualCluster_createdAt = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VirtualCluster' {Maybe ISO8601
createdAt :: Maybe ISO8601
$sel:createdAt:VirtualCluster' :: VirtualCluster -> Maybe ISO8601
createdAt} -> Maybe ISO8601
createdAt) (\s :: VirtualCluster
s@VirtualCluster' {} Maybe ISO8601
a -> VirtualCluster
s {$sel:createdAt:VirtualCluster' :: Maybe ISO8601
createdAt = Maybe ISO8601
a} :: VirtualCluster) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | The ID of the virtual cluster.
virtualCluster_id :: Lens.Lens' VirtualCluster (Prelude.Maybe Prelude.Text)
virtualCluster_id :: Lens' VirtualCluster (Maybe Text)
virtualCluster_id = 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 name of the virtual cluster.
virtualCluster_name :: Lens.Lens' VirtualCluster (Prelude.Maybe Prelude.Text)
virtualCluster_name :: Lens' VirtualCluster (Maybe Text)
virtualCluster_name = 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 state of the virtual cluster.
virtualCluster_state :: Lens.Lens' VirtualCluster (Prelude.Maybe VirtualClusterState)
virtualCluster_state :: Lens' VirtualCluster (Maybe VirtualClusterState)
virtualCluster_state = 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 assigned tags of the virtual cluster.
virtualCluster_tags :: Lens.Lens' VirtualCluster (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
virtualCluster_tags :: Lens' VirtualCluster (Maybe (HashMap Text Text))
virtualCluster_tags = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance Prelude.Hashable VirtualCluster where
  hashWithSalt :: Int -> VirtualCluster -> Int
hashWithSalt Int
_salt VirtualCluster' {Maybe Text
Maybe (HashMap Text Text)
Maybe ISO8601
Maybe ContainerProvider
Maybe VirtualClusterState
tags :: Maybe (HashMap Text Text)
state :: Maybe VirtualClusterState
name :: Maybe Text
id :: Maybe Text
createdAt :: Maybe ISO8601
containerProvider :: Maybe ContainerProvider
arn :: Maybe Text
$sel:tags:VirtualCluster' :: VirtualCluster -> Maybe (HashMap Text Text)
$sel:state:VirtualCluster' :: VirtualCluster -> Maybe VirtualClusterState
$sel:name:VirtualCluster' :: VirtualCluster -> Maybe Text
$sel:id:VirtualCluster' :: VirtualCluster -> Maybe Text
$sel:createdAt:VirtualCluster' :: VirtualCluster -> Maybe ISO8601
$sel:containerProvider:VirtualCluster' :: VirtualCluster -> Maybe ContainerProvider
$sel:arn:VirtualCluster' :: VirtualCluster -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
arn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ContainerProvider
containerProvider
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ISO8601
createdAt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
id
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe VirtualClusterState
state
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (HashMap Text Text)
tags

instance Prelude.NFData VirtualCluster where
  rnf :: VirtualCluster -> ()
rnf VirtualCluster' {Maybe Text
Maybe (HashMap Text Text)
Maybe ISO8601
Maybe ContainerProvider
Maybe VirtualClusterState
tags :: Maybe (HashMap Text Text)
state :: Maybe VirtualClusterState
name :: Maybe Text
id :: Maybe Text
createdAt :: Maybe ISO8601
containerProvider :: Maybe ContainerProvider
arn :: Maybe Text
$sel:tags:VirtualCluster' :: VirtualCluster -> Maybe (HashMap Text Text)
$sel:state:VirtualCluster' :: VirtualCluster -> Maybe VirtualClusterState
$sel:name:VirtualCluster' :: VirtualCluster -> Maybe Text
$sel:id:VirtualCluster' :: VirtualCluster -> Maybe Text
$sel:createdAt:VirtualCluster' :: VirtualCluster -> Maybe ISO8601
$sel:containerProvider:VirtualCluster' :: VirtualCluster -> Maybe ContainerProvider
$sel:arn:VirtualCluster' :: VirtualCluster -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
arn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ContainerProvider
containerProvider
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ISO8601
createdAt
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
id
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
name
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe VirtualClusterState
state
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (HashMap Text Text)
tags