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

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

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

    -- * Errors
    _InvalidRequestException,
    _ResourceAlreadyExistsException,
    _ThrottlingException,
    _InternalFailureException,
    _ResourceNotFoundException,
    _LimitExceededException,
    _ResourceInUseException,

    -- * DefinitionLanguage
    DefinitionLanguage (..),

    -- * DeploymentTarget
    DeploymentTarget (..),

    -- * EntityFilterName
    EntityFilterName (..),

    -- * EntityType
    EntityType (..),

    -- * FlowExecutionEventType
    FlowExecutionEventType (..),

    -- * FlowExecutionStatus
    FlowExecutionStatus (..),

    -- * FlowTemplateFilterName
    FlowTemplateFilterName (..),

    -- * NamespaceDeletionStatus
    NamespaceDeletionStatus (..),

    -- * NamespaceDeletionStatusErrorCodes
    NamespaceDeletionStatusErrorCodes (..),

    -- * SystemInstanceDeploymentStatus
    SystemInstanceDeploymentStatus (..),

    -- * SystemInstanceFilterName
    SystemInstanceFilterName (..),

    -- * SystemTemplateFilterName
    SystemTemplateFilterName (..),

    -- * UploadStatus
    UploadStatus (..),

    -- * DefinitionDocument
    DefinitionDocument (..),
    newDefinitionDocument,
    definitionDocument_language,
    definitionDocument_text,

    -- * DependencyRevision
    DependencyRevision (..),
    newDependencyRevision,
    dependencyRevision_revisionNumber,
    dependencyRevision_id,

    -- * EntityDescription
    EntityDescription (..),
    newEntityDescription,
    entityDescription_arn,
    entityDescription_createdAt,
    entityDescription_definition,
    entityDescription_id,
    entityDescription_type,

    -- * EntityFilter
    EntityFilter (..),
    newEntityFilter,
    entityFilter_value,
    entityFilter_name,

    -- * FlowExecutionMessage
    FlowExecutionMessage (..),
    newFlowExecutionMessage,
    flowExecutionMessage_payload,
    flowExecutionMessage_eventType,
    flowExecutionMessage_timestamp,
    flowExecutionMessage_messageId,

    -- * FlowExecutionSummary
    FlowExecutionSummary (..),
    newFlowExecutionSummary,
    flowExecutionSummary_status,
    flowExecutionSummary_flowTemplateId,
    flowExecutionSummary_createdAt,
    flowExecutionSummary_flowExecutionId,
    flowExecutionSummary_systemInstanceId,
    flowExecutionSummary_updatedAt,

    -- * FlowTemplateDescription
    FlowTemplateDescription (..),
    newFlowTemplateDescription,
    flowTemplateDescription_summary,
    flowTemplateDescription_definition,
    flowTemplateDescription_validatedNamespaceVersion,

    -- * FlowTemplateFilter
    FlowTemplateFilter (..),
    newFlowTemplateFilter,
    flowTemplateFilter_name,
    flowTemplateFilter_value,

    -- * FlowTemplateSummary
    FlowTemplateSummary (..),
    newFlowTemplateSummary,
    flowTemplateSummary_arn,
    flowTemplateSummary_createdAt,
    flowTemplateSummary_revisionNumber,
    flowTemplateSummary_id,

    -- * MetricsConfiguration
    MetricsConfiguration (..),
    newMetricsConfiguration,
    metricsConfiguration_cloudMetricEnabled,
    metricsConfiguration_metricRuleRoleArn,

    -- * SystemInstanceDescription
    SystemInstanceDescription (..),
    newSystemInstanceDescription,
    systemInstanceDescription_summary,
    systemInstanceDescription_metricsConfiguration,
    systemInstanceDescription_validatedDependencyRevisions,
    systemInstanceDescription_definition,
    systemInstanceDescription_validatedNamespaceVersion,
    systemInstanceDescription_flowActionsRoleArn,
    systemInstanceDescription_s3BucketName,

    -- * SystemInstanceFilter
    SystemInstanceFilter (..),
    newSystemInstanceFilter,
    systemInstanceFilter_value,
    systemInstanceFilter_name,

    -- * SystemInstanceSummary
    SystemInstanceSummary (..),
    newSystemInstanceSummary,
    systemInstanceSummary_status,
    systemInstanceSummary_greengrassGroupName,
    systemInstanceSummary_arn,
    systemInstanceSummary_createdAt,
    systemInstanceSummary_greengrassGroupId,
    systemInstanceSummary_greengrassGroupVersionId,
    systemInstanceSummary_id,
    systemInstanceSummary_updatedAt,
    systemInstanceSummary_target,

    -- * SystemTemplateDescription
    SystemTemplateDescription (..),
    newSystemTemplateDescription,
    systemTemplateDescription_summary,
    systemTemplateDescription_definition,
    systemTemplateDescription_validatedNamespaceVersion,

    -- * SystemTemplateFilter
    SystemTemplateFilter (..),
    newSystemTemplateFilter,
    systemTemplateFilter_name,
    systemTemplateFilter_value,

    -- * SystemTemplateSummary
    SystemTemplateSummary (..),
    newSystemTemplateSummary,
    systemTemplateSummary_arn,
    systemTemplateSummary_createdAt,
    systemTemplateSummary_revisionNumber,
    systemTemplateSummary_id,

    -- * Tag
    Tag (..),
    newTag,
    tag_key,
    tag_value,

    -- * Thing
    Thing (..),
    newThing,
    thing_thingArn,
    thing_thingName,
  )
where

import qualified Amazonka.Core as Core
import Amazonka.IoTThingsGraph.Types.DefinitionDocument
import Amazonka.IoTThingsGraph.Types.DefinitionLanguage
import Amazonka.IoTThingsGraph.Types.DependencyRevision
import Amazonka.IoTThingsGraph.Types.DeploymentTarget
import Amazonka.IoTThingsGraph.Types.EntityDescription
import Amazonka.IoTThingsGraph.Types.EntityFilter
import Amazonka.IoTThingsGraph.Types.EntityFilterName
import Amazonka.IoTThingsGraph.Types.EntityType
import Amazonka.IoTThingsGraph.Types.FlowExecutionEventType
import Amazonka.IoTThingsGraph.Types.FlowExecutionMessage
import Amazonka.IoTThingsGraph.Types.FlowExecutionStatus
import Amazonka.IoTThingsGraph.Types.FlowExecutionSummary
import Amazonka.IoTThingsGraph.Types.FlowTemplateDescription
import Amazonka.IoTThingsGraph.Types.FlowTemplateFilter
import Amazonka.IoTThingsGraph.Types.FlowTemplateFilterName
import Amazonka.IoTThingsGraph.Types.FlowTemplateSummary
import Amazonka.IoTThingsGraph.Types.MetricsConfiguration
import Amazonka.IoTThingsGraph.Types.NamespaceDeletionStatus
import Amazonka.IoTThingsGraph.Types.NamespaceDeletionStatusErrorCodes
import Amazonka.IoTThingsGraph.Types.SystemInstanceDeploymentStatus
import Amazonka.IoTThingsGraph.Types.SystemInstanceDescription
import Amazonka.IoTThingsGraph.Types.SystemInstanceFilter
import Amazonka.IoTThingsGraph.Types.SystemInstanceFilterName
import Amazonka.IoTThingsGraph.Types.SystemInstanceSummary
import Amazonka.IoTThingsGraph.Types.SystemTemplateDescription
import Amazonka.IoTThingsGraph.Types.SystemTemplateFilter
import Amazonka.IoTThingsGraph.Types.SystemTemplateFilterName
import Amazonka.IoTThingsGraph.Types.SystemTemplateSummary
import Amazonka.IoTThingsGraph.Types.Tag
import Amazonka.IoTThingsGraph.Types.Thing
import Amazonka.IoTThingsGraph.Types.UploadStatus
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Sign.V4 as Sign

-- | API version @2018-09-06@ of the Amazon IoT Things Graph SDK configuration.
defaultService :: Core.Service
defaultService :: Service
defaultService =
  Service :: Abbrev
-> Signer
-> ByteString
-> ByteString
-> ByteString
-> (Region -> Endpoint)
-> Maybe Seconds
-> (Status -> Bool)
-> (Status -> [Header] -> ByteStringLazy -> Error)
-> Retry
-> Service
Core.Service
    { $sel:_serviceAbbrev:Service :: Abbrev
Core._serviceAbbrev =
        Abbrev
"IoTThingsGraph",
      $sel:_serviceSigner:Service :: Signer
Core._serviceSigner = Signer
Sign.v4,
      $sel:_serviceEndpointPrefix:Service :: ByteString
Core._serviceEndpointPrefix = ByteString
"iotthingsgraph",
      $sel:_serviceSigningName:Service :: ByteString
Core._serviceSigningName = ByteString
"iotthingsgraph",
      $sel:_serviceVersion:Service :: ByteString
Core._serviceVersion = ByteString
"2018-09-06",
      $sel:_serviceEndpoint:Service :: Region -> Endpoint
Core._serviceEndpoint =
        Service -> Region -> Endpoint
Core.defaultEndpoint Service
defaultService,
      $sel:_serviceTimeout:Service :: Maybe Seconds
Core._serviceTimeout = Seconds -> Maybe Seconds
forall a. a -> Maybe a
Prelude.Just Seconds
70,
      $sel:_serviceCheck:Service :: Status -> Bool
Core._serviceCheck = Status -> Bool
Core.statusSuccess,
      $sel:_serviceError:Service :: Status -> [Header] -> ByteStringLazy -> Error
Core._serviceError =
        Abbrev -> Status -> [Header] -> ByteStringLazy -> Error
Core.parseJSONError Abbrev
"IoTThingsGraph",
      $sel:_serviceRetry:Service :: Retry
Core._serviceRetry = Retry
retry
    }
  where
    retry :: Retry
retry =
      Exponential :: Double -> Int -> Int -> (ServiceError -> Maybe Text) -> Retry
Core.Exponential
        { $sel:_retryBase:Exponential :: Double
Core._retryBase = Double
5.0e-2,
          $sel:_retryGrowth:Exponential :: Int
Core._retryGrowth = Int
2,
          $sel:_retryAttempts:Exponential :: Int
Core._retryAttempts = Int
5,
          $sel:_retryCheck:Exponential :: ServiceError -> Maybe Text
Core._retryCheck = ServiceError -> Maybe Text
forall a. IsString a => ServiceError -> Maybe a
check
        }
    check :: ServiceError -> Maybe a
check ServiceError
e
      | Getting Any ServiceError ServiceError -> ServiceError -> Bool
forall s a. Getting Any s a -> s -> Bool
Lens.has
          ( ErrorCode -> Getting Any ServiceError ServiceError
forall (f :: * -> *) (p :: * -> * -> *).
(Applicative f, Choice p) =>
ErrorCode -> Optic' p f ServiceError ServiceError
Core.hasCode ErrorCode
"ThrottledException"
              Getting Any ServiceError ServiceError
-> Getting Any ServiceError ServiceError
-> Getting Any ServiceError ServiceError
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. Int -> Getting Any ServiceError ServiceError
forall (f :: * -> *) (p :: * -> * -> *).
(Applicative f, Choice p) =>
Int -> Optic' p f ServiceError ServiceError
Core.hasStatus Int
400
          )
          ServiceError
e =
        a -> Maybe a
forall a. a -> Maybe a
Prelude.Just a
"throttled_exception"
      | Getting Any ServiceError ServiceError -> ServiceError -> Bool
forall s a. Getting Any s a -> s -> Bool
Lens.has (Int -> Getting Any ServiceError ServiceError
forall (f :: * -> *) (p :: * -> * -> *).
(Applicative f, Choice p) =>
Int -> Optic' p f ServiceError ServiceError
Core.hasStatus Int
429) ServiceError
e =
        a -> Maybe a
forall a. a -> Maybe a
Prelude.Just a
"too_many_requests"
      | Getting Any ServiceError ServiceError -> ServiceError -> Bool
forall s a. Getting Any s a -> s -> Bool
Lens.has
          ( ErrorCode -> Getting Any ServiceError ServiceError
forall (f :: * -> *) (p :: * -> * -> *).
(Applicative f, Choice p) =>
ErrorCode -> Optic' p f ServiceError ServiceError
Core.hasCode ErrorCode
"ThrottlingException"
              Getting Any ServiceError ServiceError
-> Getting Any ServiceError ServiceError
-> Getting Any ServiceError ServiceError
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. Int -> Getting Any ServiceError ServiceError
forall (f :: * -> *) (p :: * -> * -> *).
(Applicative f, Choice p) =>
Int -> Optic' p f ServiceError ServiceError
Core.hasStatus Int
400
          )
          ServiceError
e =
        a -> Maybe a
forall a. a -> Maybe a
Prelude.Just a
"throttling_exception"
      | Getting Any ServiceError ServiceError -> ServiceError -> Bool
forall s a. Getting Any s a -> s -> Bool
Lens.has
          ( ErrorCode -> Getting Any ServiceError ServiceError
forall (f :: * -> *) (p :: * -> * -> *).
(Applicative f, Choice p) =>
ErrorCode -> Optic' p f ServiceError ServiceError
Core.hasCode ErrorCode
"Throttling"
              Getting Any ServiceError ServiceError
-> Getting Any ServiceError ServiceError
-> Getting Any ServiceError ServiceError
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. Int -> Getting Any ServiceError ServiceError
forall (f :: * -> *) (p :: * -> * -> *).
(Applicative f, Choice p) =>
Int -> Optic' p f ServiceError ServiceError
Core.hasStatus Int
400
          )
          ServiceError
e =
        a -> Maybe a
forall a. a -> Maybe a
Prelude.Just a
"throttling"
      | Getting Any ServiceError ServiceError -> ServiceError -> Bool
forall s a. Getting Any s a -> s -> Bool
Lens.has
          ( ErrorCode -> Getting Any ServiceError ServiceError
forall (f :: * -> *) (p :: * -> * -> *).
(Applicative f, Choice p) =>
ErrorCode -> Optic' p f ServiceError ServiceError
Core.hasCode
              ErrorCode
"ProvisionedThroughputExceededException"
              Getting Any ServiceError ServiceError
-> Getting Any ServiceError ServiceError
-> Getting Any ServiceError ServiceError
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. Int -> Getting Any ServiceError ServiceError
forall (f :: * -> *) (p :: * -> * -> *).
(Applicative f, Choice p) =>
Int -> Optic' p f ServiceError ServiceError
Core.hasStatus Int
400
          )
          ServiceError
e =
        a -> Maybe a
forall a. a -> Maybe a
Prelude.Just a
"throughput_exceeded"
      | Getting Any ServiceError ServiceError -> ServiceError -> Bool
forall s a. Getting Any s a -> s -> Bool
Lens.has (Int -> Getting Any ServiceError ServiceError
forall (f :: * -> *) (p :: * -> * -> *).
(Applicative f, Choice p) =>
Int -> Optic' p f ServiceError ServiceError
Core.hasStatus Int
504) ServiceError
e =
        a -> Maybe a
forall a. a -> Maybe a
Prelude.Just a
"gateway_timeout"
      | Getting Any ServiceError ServiceError -> ServiceError -> Bool
forall s a. Getting Any s a -> s -> Bool
Lens.has
          ( ErrorCode -> Getting Any ServiceError ServiceError
forall (f :: * -> *) (p :: * -> * -> *).
(Applicative f, Choice p) =>
ErrorCode -> Optic' p f ServiceError ServiceError
Core.hasCode ErrorCode
"RequestThrottledException"
              Getting Any ServiceError ServiceError
-> Getting Any ServiceError ServiceError
-> Getting Any ServiceError ServiceError
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. Int -> Getting Any ServiceError ServiceError
forall (f :: * -> *) (p :: * -> * -> *).
(Applicative f, Choice p) =>
Int -> Optic' p f ServiceError ServiceError
Core.hasStatus Int
400
          )
          ServiceError
e =
        a -> Maybe a
forall a. a -> Maybe a
Prelude.Just a
"request_throttled_exception"
      | Getting Any ServiceError ServiceError -> ServiceError -> Bool
forall s a. Getting Any s a -> s -> Bool
Lens.has (Int -> Getting Any ServiceError ServiceError
forall (f :: * -> *) (p :: * -> * -> *).
(Applicative f, Choice p) =>
Int -> Optic' p f ServiceError ServiceError
Core.hasStatus Int
502) ServiceError
e =
        a -> Maybe a
forall a. a -> Maybe a
Prelude.Just a
"bad_gateway"
      | Getting Any ServiceError ServiceError -> ServiceError -> Bool
forall s a. Getting Any s a -> s -> Bool
Lens.has (Int -> Getting Any ServiceError ServiceError
forall (f :: * -> *) (p :: * -> * -> *).
(Applicative f, Choice p) =>
Int -> Optic' p f ServiceError ServiceError
Core.hasStatus Int
503) ServiceError
e =
        a -> Maybe a
forall a. a -> Maybe a
Prelude.Just a
"service_unavailable"
      | Getting Any ServiceError ServiceError -> ServiceError -> Bool
forall s a. Getting Any s a -> s -> Bool
Lens.has (Int -> Getting Any ServiceError ServiceError
forall (f :: * -> *) (p :: * -> * -> *).
(Applicative f, Choice p) =>
Int -> Optic' p f ServiceError ServiceError
Core.hasStatus Int
500) ServiceError
e =
        a -> Maybe a
forall a. a -> Maybe a
Prelude.Just a
"general_server_error"
      | Getting Any ServiceError ServiceError -> ServiceError -> Bool
forall s a. Getting Any s a -> s -> Bool
Lens.has (Int -> Getting Any ServiceError ServiceError
forall (f :: * -> *) (p :: * -> * -> *).
(Applicative f, Choice p) =>
Int -> Optic' p f ServiceError ServiceError
Core.hasStatus Int
509) ServiceError
e =
        a -> Maybe a
forall a. a -> Maybe a
Prelude.Just a
"limit_exceeded"
      | Bool
Prelude.otherwise = Maybe a
forall a. Maybe a
Prelude.Nothing

-- |
_InvalidRequestException :: Core.AsError a => Lens.Getting (Prelude.First Core.ServiceError) a Core.ServiceError
_InvalidRequestException :: Getting (First ServiceError) a ServiceError
_InvalidRequestException =
  Service -> ErrorCode -> Getting (First ServiceError) a ServiceError
forall a.
AsError a =>
Service -> ErrorCode -> Getting (First ServiceError) a ServiceError
Core._MatchServiceError
    Service
defaultService
    ErrorCode
"InvalidRequestException"

-- |
_ResourceAlreadyExistsException :: Core.AsError a => Lens.Getting (Prelude.First Core.ServiceError) a Core.ServiceError
_ResourceAlreadyExistsException :: Getting (First ServiceError) a ServiceError
_ResourceAlreadyExistsException =
  Service -> ErrorCode -> Getting (First ServiceError) a ServiceError
forall a.
AsError a =>
Service -> ErrorCode -> Getting (First ServiceError) a ServiceError
Core._MatchServiceError
    Service
defaultService
    ErrorCode
"ResourceAlreadyExistsException"

-- |
_ThrottlingException :: Core.AsError a => Lens.Getting (Prelude.First Core.ServiceError) a Core.ServiceError
_ThrottlingException :: Getting (First ServiceError) a ServiceError
_ThrottlingException =
  Service -> ErrorCode -> Getting (First ServiceError) a ServiceError
forall a.
AsError a =>
Service -> ErrorCode -> Getting (First ServiceError) a ServiceError
Core._MatchServiceError
    Service
defaultService
    ErrorCode
"ThrottlingException"

-- |
_InternalFailureException :: Core.AsError a => Lens.Getting (Prelude.First Core.ServiceError) a Core.ServiceError
_InternalFailureException :: Getting (First ServiceError) a ServiceError
_InternalFailureException =
  Service -> ErrorCode -> Getting (First ServiceError) a ServiceError
forall a.
AsError a =>
Service -> ErrorCode -> Getting (First ServiceError) a ServiceError
Core._MatchServiceError
    Service
defaultService
    ErrorCode
"InternalFailureException"

-- |
_ResourceNotFoundException :: Core.AsError a => Lens.Getting (Prelude.First Core.ServiceError) a Core.ServiceError
_ResourceNotFoundException :: Getting (First ServiceError) a ServiceError
_ResourceNotFoundException =
  Service -> ErrorCode -> Getting (First ServiceError) a ServiceError
forall a.
AsError a =>
Service -> ErrorCode -> Getting (First ServiceError) a ServiceError
Core._MatchServiceError
    Service
defaultService
    ErrorCode
"ResourceNotFoundException"

-- |
_LimitExceededException :: Core.AsError a => Lens.Getting (Prelude.First Core.ServiceError) a Core.ServiceError
_LimitExceededException :: Getting (First ServiceError) a ServiceError
_LimitExceededException =
  Service -> ErrorCode -> Getting (First ServiceError) a ServiceError
forall a.
AsError a =>
Service -> ErrorCode -> Getting (First ServiceError) a ServiceError
Core._MatchServiceError
    Service
defaultService
    ErrorCode
"LimitExceededException"

-- |
_ResourceInUseException :: Core.AsError a => Lens.Getting (Prelude.First Core.ServiceError) a Core.ServiceError
_ResourceInUseException :: Getting (First ServiceError) a ServiceError
_ResourceInUseException =
  Service -> ErrorCode -> Getting (First ServiceError) a ServiceError
forall a.
AsError a =>
Service -> ErrorCode -> Getting (First ServiceError) a ServiceError
Core._MatchServiceError
    Service
defaultService
    ErrorCode
"ResourceInUseException"