{-# 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.DLM.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.DLM.Types
  ( -- * Service Configuration
    defaultService,

    -- * Errors
    _InternalServerException,
    _InvalidRequestException,
    _LimitExceededException,
    _ResourceNotFoundException,

    -- * EventSourceValues
    EventSourceValues (..),

    -- * EventTypeValues
    EventTypeValues (..),

    -- * GettablePolicyStateValues
    GettablePolicyStateValues (..),

    -- * IntervalUnitValues
    IntervalUnitValues (..),

    -- * LocationValues
    LocationValues (..),

    -- * PolicyTypeValues
    PolicyTypeValues (..),

    -- * ResourceLocationValues
    ResourceLocationValues (..),

    -- * ResourceTypeValues
    ResourceTypeValues (..),

    -- * RetentionIntervalUnitValues
    RetentionIntervalUnitValues (..),

    -- * SettablePolicyStateValues
    SettablePolicyStateValues (..),

    -- * Action
    Action (..),
    newAction,
    action_name,
    action_crossRegionCopy,

    -- * ArchiveRetainRule
    ArchiveRetainRule (..),
    newArchiveRetainRule,
    archiveRetainRule_retentionArchiveTier,

    -- * ArchiveRule
    ArchiveRule (..),
    newArchiveRule,
    archiveRule_retainRule,

    -- * CreateRule
    CreateRule (..),
    newCreateRule,
    createRule_cronExpression,
    createRule_interval,
    createRule_intervalUnit,
    createRule_location,
    createRule_times,

    -- * CrossRegionCopyAction
    CrossRegionCopyAction (..),
    newCrossRegionCopyAction,
    crossRegionCopyAction_retainRule,
    crossRegionCopyAction_target,
    crossRegionCopyAction_encryptionConfiguration,

    -- * CrossRegionCopyDeprecateRule
    CrossRegionCopyDeprecateRule (..),
    newCrossRegionCopyDeprecateRule,
    crossRegionCopyDeprecateRule_interval,
    crossRegionCopyDeprecateRule_intervalUnit,

    -- * CrossRegionCopyRetainRule
    CrossRegionCopyRetainRule (..),
    newCrossRegionCopyRetainRule,
    crossRegionCopyRetainRule_interval,
    crossRegionCopyRetainRule_intervalUnit,

    -- * CrossRegionCopyRule
    CrossRegionCopyRule (..),
    newCrossRegionCopyRule,
    crossRegionCopyRule_cmkArn,
    crossRegionCopyRule_copyTags,
    crossRegionCopyRule_deprecateRule,
    crossRegionCopyRule_retainRule,
    crossRegionCopyRule_target,
    crossRegionCopyRule_targetRegion,
    crossRegionCopyRule_encrypted,

    -- * DeprecateRule
    DeprecateRule (..),
    newDeprecateRule,
    deprecateRule_count,
    deprecateRule_interval,
    deprecateRule_intervalUnit,

    -- * EncryptionConfiguration
    EncryptionConfiguration (..),
    newEncryptionConfiguration,
    encryptionConfiguration_cmkArn,
    encryptionConfiguration_encrypted,

    -- * EventParameters
    EventParameters (..),
    newEventParameters,
    eventParameters_eventType,
    eventParameters_snapshotOwner,
    eventParameters_descriptionRegex,

    -- * EventSource
    EventSource (..),
    newEventSource,
    eventSource_parameters,
    eventSource_type,

    -- * FastRestoreRule
    FastRestoreRule (..),
    newFastRestoreRule,
    fastRestoreRule_count,
    fastRestoreRule_interval,
    fastRestoreRule_intervalUnit,
    fastRestoreRule_availabilityZones,

    -- * LifecyclePolicy
    LifecyclePolicy (..),
    newLifecyclePolicy,
    lifecyclePolicy_dateCreated,
    lifecyclePolicy_dateModified,
    lifecyclePolicy_description,
    lifecyclePolicy_executionRoleArn,
    lifecyclePolicy_policyArn,
    lifecyclePolicy_policyDetails,
    lifecyclePolicy_policyId,
    lifecyclePolicy_state,
    lifecyclePolicy_statusMessage,
    lifecyclePolicy_tags,

    -- * LifecyclePolicySummary
    LifecyclePolicySummary (..),
    newLifecyclePolicySummary,
    lifecyclePolicySummary_description,
    lifecyclePolicySummary_policyId,
    lifecyclePolicySummary_policyType,
    lifecyclePolicySummary_state,
    lifecyclePolicySummary_tags,

    -- * Parameters
    Parameters (..),
    newParameters,
    parameters_excludeBootVolume,
    parameters_excludeDataVolumeTags,
    parameters_noReboot,

    -- * PolicyDetails
    PolicyDetails (..),
    newPolicyDetails,
    policyDetails_actions,
    policyDetails_eventSource,
    policyDetails_parameters,
    policyDetails_policyType,
    policyDetails_resourceLocations,
    policyDetails_resourceTypes,
    policyDetails_schedules,
    policyDetails_targetTags,

    -- * RetainRule
    RetainRule (..),
    newRetainRule,
    retainRule_count,
    retainRule_interval,
    retainRule_intervalUnit,

    -- * RetentionArchiveTier
    RetentionArchiveTier (..),
    newRetentionArchiveTier,
    retentionArchiveTier_count,
    retentionArchiveTier_interval,
    retentionArchiveTier_intervalUnit,

    -- * Schedule
    Schedule (..),
    newSchedule,
    schedule_archiveRule,
    schedule_copyTags,
    schedule_createRule,
    schedule_crossRegionCopyRules,
    schedule_deprecateRule,
    schedule_fastRestoreRule,
    schedule_name,
    schedule_retainRule,
    schedule_shareRules,
    schedule_tagsToAdd,
    schedule_variableTags,

    -- * ShareRule
    ShareRule (..),
    newShareRule,
    shareRule_unshareInterval,
    shareRule_unshareIntervalUnit,
    shareRule_targetAccounts,

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

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import Amazonka.DLM.Types.Action
import Amazonka.DLM.Types.ArchiveRetainRule
import Amazonka.DLM.Types.ArchiveRule
import Amazonka.DLM.Types.CreateRule
import Amazonka.DLM.Types.CrossRegionCopyAction
import Amazonka.DLM.Types.CrossRegionCopyDeprecateRule
import Amazonka.DLM.Types.CrossRegionCopyRetainRule
import Amazonka.DLM.Types.CrossRegionCopyRule
import Amazonka.DLM.Types.DeprecateRule
import Amazonka.DLM.Types.EncryptionConfiguration
import Amazonka.DLM.Types.EventParameters
import Amazonka.DLM.Types.EventSource
import Amazonka.DLM.Types.EventSourceValues
import Amazonka.DLM.Types.EventTypeValues
import Amazonka.DLM.Types.FastRestoreRule
import Amazonka.DLM.Types.GettablePolicyStateValues
import Amazonka.DLM.Types.IntervalUnitValues
import Amazonka.DLM.Types.LifecyclePolicy
import Amazonka.DLM.Types.LifecyclePolicySummary
import Amazonka.DLM.Types.LocationValues
import Amazonka.DLM.Types.Parameters
import Amazonka.DLM.Types.PolicyDetails
import Amazonka.DLM.Types.PolicyTypeValues
import Amazonka.DLM.Types.ResourceLocationValues
import Amazonka.DLM.Types.ResourceTypeValues
import Amazonka.DLM.Types.RetainRule
import Amazonka.DLM.Types.RetentionArchiveTier
import Amazonka.DLM.Types.RetentionIntervalUnitValues
import Amazonka.DLM.Types.Schedule
import Amazonka.DLM.Types.SettablePolicyStateValues
import Amazonka.DLM.Types.ShareRule
import Amazonka.DLM.Types.Tag
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Sign.V4 as Sign

-- | API version @2018-01-12@ of the Amazon Data Lifecycle Manager SDK configuration.
defaultService :: Core.Service
defaultService :: Service
defaultService =
  Core.Service
    { $sel:abbrev:Service :: Abbrev
Core.abbrev = Abbrev
"DLM",
      $sel:signer:Service :: Signer
Core.signer = Signer
Sign.v4,
      $sel:endpointPrefix:Service :: ByteString
Core.endpointPrefix = ByteString
"dlm",
      $sel:signingName:Service :: ByteString
Core.signingName = ByteString
"dlm",
      $sel:version:Service :: ByteString
Core.version = ByteString
"2018-01-12",
      $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
"DLM",
      $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

-- | The service failed in an unexpected way.
_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

-- | Bad request. The request is missing required parameters or has invalid
-- parameters.
_InvalidRequestException :: (Core.AsError a) => Lens.Fold a Core.ServiceError
_InvalidRequestException :: forall a. AsError a => Fold a ServiceError
_InvalidRequestException =
  forall a. AsError a => Service -> ErrorCode -> Fold a ServiceError
Core._MatchServiceError
    Service
defaultService
    ErrorCode
"InvalidRequestException"
    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

-- | The request failed because a limit was exceeded.
_LimitExceededException :: (Core.AsError a) => Lens.Fold a Core.ServiceError
_LimitExceededException :: forall a. AsError a => Fold a ServiceError
_LimitExceededException =
  forall a. AsError a => Service -> ErrorCode -> Fold a ServiceError
Core._MatchServiceError
    Service
defaultService
    ErrorCode
"LimitExceededException"
    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
429

-- | A requested 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
404