{-# LANGUAGE DisambiguateRecordFields #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.EMRContainers.Types
-- 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
  ( -- * Service Configuration
    defaultService,

    -- * Errors
    _InternalServerException,
    _ResourceNotFoundException,
    _ValidationException,

    -- * ContainerProviderType
    ContainerProviderType (..),

    -- * EndpointState
    EndpointState (..),

    -- * FailureReason
    FailureReason (..),

    -- * JobRunState
    JobRunState (..),

    -- * PersistentAppUI
    PersistentAppUI (..),

    -- * TemplateParameterDataType
    TemplateParameterDataType (..),

    -- * VirtualClusterState
    VirtualClusterState (..),

    -- * Certificate
    Certificate (..),
    newCertificate,
    certificate_certificateArn,
    certificate_certificateData,

    -- * CloudWatchMonitoringConfiguration
    CloudWatchMonitoringConfiguration (..),
    newCloudWatchMonitoringConfiguration,
    cloudWatchMonitoringConfiguration_logStreamNamePrefix,
    cloudWatchMonitoringConfiguration_logGroupName,

    -- * Configuration
    Configuration (..),
    newConfiguration,
    configuration_configurations,
    configuration_properties,
    configuration_classification,

    -- * ConfigurationOverrides
    ConfigurationOverrides (..),
    newConfigurationOverrides,
    configurationOverrides_applicationConfiguration,
    configurationOverrides_monitoringConfiguration,

    -- * ContainerInfo
    ContainerInfo (..),
    newContainerInfo,
    containerInfo_eksInfo,

    -- * ContainerProvider
    ContainerProvider (..),
    newContainerProvider,
    containerProvider_info,
    containerProvider_type,
    containerProvider_id,

    -- * EksInfo
    EksInfo (..),
    newEksInfo,
    eksInfo_namespace,

    -- * Endpoint
    Endpoint (..),
    newEndpoint,
    endpoint_arn,
    endpoint_certificateArn,
    endpoint_certificateAuthority,
    endpoint_configurationOverrides,
    endpoint_createdAt,
    endpoint_executionRoleArn,
    endpoint_failureReason,
    endpoint_id,
    endpoint_name,
    endpoint_releaseLabel,
    endpoint_securityGroup,
    endpoint_serverUrl,
    endpoint_state,
    endpoint_stateDetails,
    endpoint_subnetIds,
    endpoint_tags,
    endpoint_type,
    endpoint_virtualClusterId,

    -- * JobDriver
    JobDriver (..),
    newJobDriver,
    jobDriver_sparkSqlJobDriver,
    jobDriver_sparkSubmitJobDriver,

    -- * JobRun
    JobRun (..),
    newJobRun,
    jobRun_arn,
    jobRun_clientToken,
    jobRun_configurationOverrides,
    jobRun_createdAt,
    jobRun_createdBy,
    jobRun_executionRoleArn,
    jobRun_failureReason,
    jobRun_finishedAt,
    jobRun_id,
    jobRun_jobDriver,
    jobRun_name,
    jobRun_releaseLabel,
    jobRun_state,
    jobRun_stateDetails,
    jobRun_tags,
    jobRun_virtualClusterId,

    -- * JobTemplate
    JobTemplate (..),
    newJobTemplate,
    jobTemplate_arn,
    jobTemplate_createdAt,
    jobTemplate_createdBy,
    jobTemplate_decryptionError,
    jobTemplate_id,
    jobTemplate_kmsKeyArn,
    jobTemplate_name,
    jobTemplate_tags,
    jobTemplate_jobTemplateData,

    -- * JobTemplateData
    JobTemplateData (..),
    newJobTemplateData,
    jobTemplateData_configurationOverrides,
    jobTemplateData_jobTags,
    jobTemplateData_parameterConfiguration,
    jobTemplateData_executionRoleArn,
    jobTemplateData_releaseLabel,
    jobTemplateData_jobDriver,

    -- * MonitoringConfiguration
    MonitoringConfiguration (..),
    newMonitoringConfiguration,
    monitoringConfiguration_cloudWatchMonitoringConfiguration,
    monitoringConfiguration_persistentAppUI,
    monitoringConfiguration_s3MonitoringConfiguration,

    -- * ParametricCloudWatchMonitoringConfiguration
    ParametricCloudWatchMonitoringConfiguration (..),
    newParametricCloudWatchMonitoringConfiguration,
    parametricCloudWatchMonitoringConfiguration_logGroupName,
    parametricCloudWatchMonitoringConfiguration_logStreamNamePrefix,

    -- * ParametricConfigurationOverrides
    ParametricConfigurationOverrides (..),
    newParametricConfigurationOverrides,
    parametricConfigurationOverrides_applicationConfiguration,
    parametricConfigurationOverrides_monitoringConfiguration,

    -- * ParametricMonitoringConfiguration
    ParametricMonitoringConfiguration (..),
    newParametricMonitoringConfiguration,
    parametricMonitoringConfiguration_cloudWatchMonitoringConfiguration,
    parametricMonitoringConfiguration_persistentAppUI,
    parametricMonitoringConfiguration_s3MonitoringConfiguration,

    -- * ParametricS3MonitoringConfiguration
    ParametricS3MonitoringConfiguration (..),
    newParametricS3MonitoringConfiguration,
    parametricS3MonitoringConfiguration_logUri,

    -- * S3MonitoringConfiguration
    S3MonitoringConfiguration (..),
    newS3MonitoringConfiguration,
    s3MonitoringConfiguration_logUri,

    -- * SparkSqlJobDriver
    SparkSqlJobDriver (..),
    newSparkSqlJobDriver,
    sparkSqlJobDriver_entryPoint,
    sparkSqlJobDriver_sparkSqlParameters,

    -- * SparkSubmitJobDriver
    SparkSubmitJobDriver (..),
    newSparkSubmitJobDriver,
    sparkSubmitJobDriver_entryPointArguments,
    sparkSubmitJobDriver_sparkSubmitParameters,
    sparkSubmitJobDriver_entryPoint,

    -- * TemplateParameterConfiguration
    TemplateParameterConfiguration (..),
    newTemplateParameterConfiguration,
    templateParameterConfiguration_defaultValue,
    templateParameterConfiguration_type,

    -- * VirtualCluster
    VirtualCluster (..),
    newVirtualCluster,
    virtualCluster_arn,
    virtualCluster_containerProvider,
    virtualCluster_createdAt,
    virtualCluster_id,
    virtualCluster_name,
    virtualCluster_state,
    virtualCluster_tags,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import Amazonka.EMRContainers.Types.Certificate
import Amazonka.EMRContainers.Types.CloudWatchMonitoringConfiguration
import Amazonka.EMRContainers.Types.Configuration
import Amazonka.EMRContainers.Types.ConfigurationOverrides
import Amazonka.EMRContainers.Types.ContainerInfo
import Amazonka.EMRContainers.Types.ContainerProvider
import Amazonka.EMRContainers.Types.ContainerProviderType
import Amazonka.EMRContainers.Types.EksInfo
import Amazonka.EMRContainers.Types.Endpoint
import Amazonka.EMRContainers.Types.EndpointState
import Amazonka.EMRContainers.Types.FailureReason
import Amazonka.EMRContainers.Types.JobDriver
import Amazonka.EMRContainers.Types.JobRun
import Amazonka.EMRContainers.Types.JobRunState
import Amazonka.EMRContainers.Types.JobTemplate
import Amazonka.EMRContainers.Types.JobTemplateData
import Amazonka.EMRContainers.Types.MonitoringConfiguration
import Amazonka.EMRContainers.Types.ParametricCloudWatchMonitoringConfiguration
import Amazonka.EMRContainers.Types.ParametricConfigurationOverrides
import Amazonka.EMRContainers.Types.ParametricMonitoringConfiguration
import Amazonka.EMRContainers.Types.ParametricS3MonitoringConfiguration
import Amazonka.EMRContainers.Types.PersistentAppUI
import Amazonka.EMRContainers.Types.S3MonitoringConfiguration
import Amazonka.EMRContainers.Types.SparkSqlJobDriver
import Amazonka.EMRContainers.Types.SparkSubmitJobDriver
import Amazonka.EMRContainers.Types.TemplateParameterConfiguration
import Amazonka.EMRContainers.Types.TemplateParameterDataType
import Amazonka.EMRContainers.Types.VirtualCluster
import Amazonka.EMRContainers.Types.VirtualClusterState
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Sign.V4 as Sign

-- | API version @2020-10-01@ of the Amazon EMR Containers SDK configuration.
defaultService :: Core.Service
defaultService :: Service
defaultService =
  Core.Service
    { $sel:abbrev:Service :: Abbrev
Core.abbrev = Abbrev
"EMRContainers",
      $sel:signer:Service :: Signer
Core.signer = Signer
Sign.v4,
      $sel:endpointPrefix:Service :: ByteString
Core.endpointPrefix = ByteString
"emr-containers",
      $sel:signingName:Service :: ByteString
Core.signingName = ByteString
"emr-containers",
      $sel:version:Service :: ByteString
Core.version = ByteString
"2020-10-01",
      $sel:s3AddressingStyle:Service :: S3AddressingStyle
Core.s3AddressingStyle = S3AddressingStyle
Core.S3AddressingStyleAuto,
      $sel:endpoint:Service :: Region -> Endpoint
Core.endpoint = Service -> Region -> Endpoint
Core.defaultEndpoint Service
defaultService,
      $sel:timeout:Service :: Maybe Seconds
Core.timeout = forall a. a -> Maybe a
Prelude.Just Seconds
70,
      $sel:check:Service :: Status -> Bool
Core.check = Status -> Bool
Core.statusSuccess,
      $sel:error:Service :: Status -> [Header] -> ByteStringLazy -> Error
Core.error = Abbrev -> Status -> [Header] -> ByteStringLazy -> Error
Core.parseJSONError Abbrev
"EMRContainers",
      $sel:retry:Service :: Retry
Core.retry = Retry
retry
    }
  where
    retry :: Retry
retry =
      Core.Exponential
        { $sel:base:Exponential :: Double
Core.base = Double
5.0e-2,
          $sel:growth:Exponential :: Int
Core.growth = Int
2,
          $sel:attempts:Exponential :: Int
Core.attempts = Int
5,
          $sel:check:Exponential :: ServiceError -> Maybe Text
Core.check = forall {a}. IsString a => ServiceError -> Maybe a
check
        }
    check :: ServiceError -> Maybe a
check ServiceError
e
      | forall s a. Getting Any s a -> s -> Bool
Lens.has (forall (f :: * -> *) (p :: * -> * -> *).
(Applicative f, Choice p) =>
Int -> Optic' p f ServiceError ServiceError
Core.hasStatus Int
502) ServiceError
e =
          forall a. a -> Maybe a
Prelude.Just a
"bad_gateway"
      | forall s a. Getting Any s a -> s -> Bool
Lens.has (forall (f :: * -> *) (p :: * -> * -> *).
(Applicative f, Choice p) =>
Int -> Optic' p f ServiceError ServiceError
Core.hasStatus Int
504) ServiceError
e =
          forall a. a -> Maybe a
Prelude.Just a
"gateway_timeout"
      | forall s a. Getting Any s a -> s -> Bool
Lens.has (forall (f :: * -> *) (p :: * -> * -> *).
(Applicative f, Choice p) =>
Int -> Optic' p f ServiceError ServiceError
Core.hasStatus Int
500) ServiceError
e =
          forall a. a -> Maybe a
Prelude.Just a
"general_server_error"
      | forall s a. Getting Any s a -> s -> Bool
Lens.has (forall (f :: * -> *) (p :: * -> * -> *).
(Applicative f, Choice p) =>
Int -> Optic' p f ServiceError ServiceError
Core.hasStatus Int
509) ServiceError
e =
          forall a. a -> Maybe a
Prelude.Just a
"limit_exceeded"
      | forall s a. Getting Any s a -> s -> Bool
Lens.has
          ( forall (f :: * -> *) (p :: * -> * -> *).
(Applicative f, Choice p) =>
ErrorCode -> Optic' p f ServiceError ServiceError
Core.hasCode ErrorCode
"RequestThrottledException"
              forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (p :: * -> * -> *).
(Applicative f, Choice p) =>
Int -> Optic' p f ServiceError ServiceError
Core.hasStatus Int
400
          )
          ServiceError
e =
          forall a. a -> Maybe a
Prelude.Just a
"request_throttled_exception"
      | forall s a. Getting Any s a -> s -> Bool
Lens.has (forall (f :: * -> *) (p :: * -> * -> *).
(Applicative f, Choice p) =>
Int -> Optic' p f ServiceError ServiceError
Core.hasStatus Int
503) ServiceError
e =
          forall a. a -> Maybe a
Prelude.Just a
"service_unavailable"
      | forall s a. Getting Any s a -> s -> Bool
Lens.has
          ( forall (f :: * -> *) (p :: * -> * -> *).
(Applicative f, Choice p) =>
ErrorCode -> Optic' p f ServiceError ServiceError
Core.hasCode ErrorCode
"ThrottledException"
              forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (p :: * -> * -> *).
(Applicative f, Choice p) =>
Int -> Optic' p f ServiceError ServiceError
Core.hasStatus Int
400
          )
          ServiceError
e =
          forall a. a -> Maybe a
Prelude.Just a
"throttled_exception"
      | forall s a. Getting Any s a -> s -> Bool
Lens.has
          ( forall (f :: * -> *) (p :: * -> * -> *).
(Applicative f, Choice p) =>
ErrorCode -> Optic' p f ServiceError ServiceError
Core.hasCode ErrorCode
"Throttling"
              forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (p :: * -> * -> *).
(Applicative f, Choice p) =>
Int -> Optic' p f ServiceError ServiceError
Core.hasStatus Int
400
          )
          ServiceError
e =
          forall a. a -> Maybe a
Prelude.Just a
"throttling"
      | forall s a. Getting Any s a -> s -> Bool
Lens.has
          ( forall (f :: * -> *) (p :: * -> * -> *).
(Applicative f, Choice p) =>
ErrorCode -> Optic' p f ServiceError ServiceError
Core.hasCode ErrorCode
"ThrottlingException"
              forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (p :: * -> * -> *).
(Applicative f, Choice p) =>
Int -> Optic' p f ServiceError ServiceError
Core.hasStatus Int
400
          )
          ServiceError
e =
          forall a. a -> Maybe a
Prelude.Just a
"throttling_exception"
      | forall s a. Getting Any s a -> s -> Bool
Lens.has
          ( forall (f :: * -> *) (p :: * -> * -> *).
(Applicative f, Choice p) =>
ErrorCode -> Optic' p f ServiceError ServiceError
Core.hasCode
              ErrorCode
"ProvisionedThroughputExceededException"
              forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (p :: * -> * -> *).
(Applicative f, Choice p) =>
Int -> Optic' p f ServiceError ServiceError
Core.hasStatus Int
400
          )
          ServiceError
e =
          forall a. a -> Maybe a
Prelude.Just a
"throughput_exceeded"
      | forall s a. Getting Any s a -> s -> Bool
Lens.has (forall (f :: * -> *) (p :: * -> * -> *).
(Applicative f, Choice p) =>
Int -> Optic' p f ServiceError ServiceError
Core.hasStatus Int
429) ServiceError
e =
          forall a. a -> Maybe a
Prelude.Just a
"too_many_requests"
      | Bool
Prelude.otherwise = forall a. Maybe a
Prelude.Nothing

-- | This is an internal server exception.
_InternalServerException :: (Core.AsError a) => Lens.Fold a Core.ServiceError
_InternalServerException :: forall a. AsError a => Fold a ServiceError
_InternalServerException =
  forall a. AsError a => Service -> ErrorCode -> Fold a ServiceError
Core._MatchServiceError
    Service
defaultService
    ErrorCode
"InternalServerException"
    forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (p :: * -> * -> *).
(Applicative f, Choice p) =>
Int -> Optic' p f ServiceError ServiceError
Core.hasStatus Int
500

-- | The specified resource was not found.
_ResourceNotFoundException :: (Core.AsError a) => Lens.Fold a Core.ServiceError
_ResourceNotFoundException :: forall a. AsError a => Fold a ServiceError
_ResourceNotFoundException =
  forall a. AsError a => Service -> ErrorCode -> Fold a ServiceError
Core._MatchServiceError
    Service
defaultService
    ErrorCode
"ResourceNotFoundException"
    forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (p :: * -> * -> *).
(Applicative f, Choice p) =>
Int -> Optic' p f ServiceError ServiceError
Core.hasStatus Int
400

-- | There are invalid parameters in the client request.
_ValidationException :: (Core.AsError a) => Lens.Fold a Core.ServiceError
_ValidationException :: forall a. AsError a => Fold a ServiceError
_ValidationException =
  forall a. AsError a => Service -> ErrorCode -> Fold a ServiceError
Core._MatchServiceError
    Service
defaultService
    ErrorCode
"ValidationException"
    forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (p :: * -> * -> *).
(Applicative f, Choice p) =>
Int -> Optic' p f ServiceError ServiceError
Core.hasStatus Int
400