{-# 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.CertificateManagerPCA.Types.Validity -- 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.CertificateManagerPCA.Types.Validity where import Amazonka.CertificateManagerPCA.Types.ValidityPeriodType import qualified Amazonka.Core as Core import qualified Amazonka.Core.Lens.Internal as Lens import qualified Amazonka.Data as Data import qualified Amazonka.Prelude as Prelude -- | Validity specifies the period of time during which a certificate is -- valid. Validity can be expressed as an explicit date and time when the -- validity of a certificate starts or expires, or as a span of time after -- issuance, stated in days, months, or years. For more information, see -- <https://tools.ietf.org/html/rfc5280#section-4.1.2.5 Validity> in RFC -- 5280. -- -- Amazon Web Services Private CA API consumes the @Validity@ data type -- differently in two distinct parameters of the @IssueCertificate@ action. -- The required parameter @IssueCertificate@:@Validity@ specifies the end -- of a certificate\'s validity period. The optional parameter -- @IssueCertificate@:@ValidityNotBefore@ specifies a customized starting -- time for the validity period. -- -- /See:/ 'newValidity' smart constructor. data Validity = Validity' { -- | A long integer interpreted according to the value of @Type@, below. Validity -> Natural value :: Prelude.Natural, -- | Determines how /Amazon Web Services Private CA/ interprets the @Value@ -- parameter, an integer. Supported validity types include those listed -- below. Type definitions with values include a sample input value and the -- resulting output. -- -- @END_DATE@: The specific date and time when the certificate will expire, -- expressed using UTCTime (YYMMDDHHMMSS) or GeneralizedTime -- (YYYYMMDDHHMMSS) format. When UTCTime is used, if the year field (YY) is -- greater than or equal to 50, the year is interpreted as 19YY. If the -- year field is less than 50, the year is interpreted as 20YY. -- -- - Sample input value: 491231235959 (UTCTime format) -- -- - Output expiration date\/time: 12\/31\/2049 23:59:59 -- -- @ABSOLUTE@: The specific date and time when the validity of a -- certificate will start or expire, expressed in seconds since the Unix -- Epoch. -- -- - Sample input value: 2524608000 -- -- - Output expiration date\/time: 01\/01\/2050 00:00:00 -- -- @DAYS@, @MONTHS@, @YEARS@: The relative time from the moment of issuance -- until the certificate will expire, expressed in days, months, or years. -- -- Example if @DAYS@, issued on 10\/12\/2020 at 12:34:54 UTC: -- -- - Sample input value: 90 -- -- - Output expiration date: 01\/10\/2020 12:34:54 UTC -- -- The minimum validity duration for a certificate using relative time -- (@DAYS@) is one day. The minimum validity for a certificate using -- absolute time (@ABSOLUTE@ or @END_DATE@) is one second. Validity -> ValidityPeriodType type' :: ValidityPeriodType } deriving (Validity -> Validity -> Bool forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a /= :: Validity -> Validity -> Bool $c/= :: Validity -> Validity -> Bool == :: Validity -> Validity -> Bool $c== :: Validity -> Validity -> Bool Prelude.Eq, ReadPrec [Validity] ReadPrec Validity Int -> ReadS Validity ReadS [Validity] forall a. (Int -> ReadS a) -> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a readListPrec :: ReadPrec [Validity] $creadListPrec :: ReadPrec [Validity] readPrec :: ReadPrec Validity $creadPrec :: ReadPrec Validity readList :: ReadS [Validity] $creadList :: ReadS [Validity] readsPrec :: Int -> ReadS Validity $creadsPrec :: Int -> ReadS Validity Prelude.Read, Int -> Validity -> ShowS [Validity] -> ShowS Validity -> String forall a. (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a showList :: [Validity] -> ShowS $cshowList :: [Validity] -> ShowS show :: Validity -> String $cshow :: Validity -> String showsPrec :: Int -> Validity -> ShowS $cshowsPrec :: Int -> Validity -> ShowS Prelude.Show, forall x. Rep Validity x -> Validity forall x. Validity -> Rep Validity x forall a. (forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a $cto :: forall x. Rep Validity x -> Validity $cfrom :: forall x. Validity -> Rep Validity x Prelude.Generic) -- | -- Create a value of 'Validity' 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: -- -- 'value', 'validity_value' - A long integer interpreted according to the value of @Type@, below. -- -- 'type'', 'validity_type' - Determines how /Amazon Web Services Private CA/ interprets the @Value@ -- parameter, an integer. Supported validity types include those listed -- below. Type definitions with values include a sample input value and the -- resulting output. -- -- @END_DATE@: The specific date and time when the certificate will expire, -- expressed using UTCTime (YYMMDDHHMMSS) or GeneralizedTime -- (YYYYMMDDHHMMSS) format. When UTCTime is used, if the year field (YY) is -- greater than or equal to 50, the year is interpreted as 19YY. If the -- year field is less than 50, the year is interpreted as 20YY. -- -- - Sample input value: 491231235959 (UTCTime format) -- -- - Output expiration date\/time: 12\/31\/2049 23:59:59 -- -- @ABSOLUTE@: The specific date and time when the validity of a -- certificate will start or expire, expressed in seconds since the Unix -- Epoch. -- -- - Sample input value: 2524608000 -- -- - Output expiration date\/time: 01\/01\/2050 00:00:00 -- -- @DAYS@, @MONTHS@, @YEARS@: The relative time from the moment of issuance -- until the certificate will expire, expressed in days, months, or years. -- -- Example if @DAYS@, issued on 10\/12\/2020 at 12:34:54 UTC: -- -- - Sample input value: 90 -- -- - Output expiration date: 01\/10\/2020 12:34:54 UTC -- -- The minimum validity duration for a certificate using relative time -- (@DAYS@) is one day. The minimum validity for a certificate using -- absolute time (@ABSOLUTE@ or @END_DATE@) is one second. newValidity :: -- | 'value' Prelude.Natural -> -- | 'type'' ValidityPeriodType -> Validity newValidity :: Natural -> ValidityPeriodType -> Validity newValidity Natural pValue_ ValidityPeriodType pType_ = Validity' {$sel:value:Validity' :: Natural value = Natural pValue_, $sel:type':Validity' :: ValidityPeriodType type' = ValidityPeriodType pType_} -- | A long integer interpreted according to the value of @Type@, below. validity_value :: Lens.Lens' Validity Prelude.Natural validity_value :: Lens' Validity Natural validity_value = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b Lens.lens (\Validity' {Natural value :: Natural $sel:value:Validity' :: Validity -> Natural value} -> Natural value) (\s :: Validity s@Validity' {} Natural a -> Validity s {$sel:value:Validity' :: Natural value = Natural a} :: Validity) -- | Determines how /Amazon Web Services Private CA/ interprets the @Value@ -- parameter, an integer. Supported validity types include those listed -- below. Type definitions with values include a sample input value and the -- resulting output. -- -- @END_DATE@: The specific date and time when the certificate will expire, -- expressed using UTCTime (YYMMDDHHMMSS) or GeneralizedTime -- (YYYYMMDDHHMMSS) format. When UTCTime is used, if the year field (YY) is -- greater than or equal to 50, the year is interpreted as 19YY. If the -- year field is less than 50, the year is interpreted as 20YY. -- -- - Sample input value: 491231235959 (UTCTime format) -- -- - Output expiration date\/time: 12\/31\/2049 23:59:59 -- -- @ABSOLUTE@: The specific date and time when the validity of a -- certificate will start or expire, expressed in seconds since the Unix -- Epoch. -- -- - Sample input value: 2524608000 -- -- - Output expiration date\/time: 01\/01\/2050 00:00:00 -- -- @DAYS@, @MONTHS@, @YEARS@: The relative time from the moment of issuance -- until the certificate will expire, expressed in days, months, or years. -- -- Example if @DAYS@, issued on 10\/12\/2020 at 12:34:54 UTC: -- -- - Sample input value: 90 -- -- - Output expiration date: 01\/10\/2020 12:34:54 UTC -- -- The minimum validity duration for a certificate using relative time -- (@DAYS@) is one day. The minimum validity for a certificate using -- absolute time (@ABSOLUTE@ or @END_DATE@) is one second. validity_type :: Lens.Lens' Validity ValidityPeriodType validity_type :: Lens' Validity ValidityPeriodType validity_type = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b Lens.lens (\Validity' {ValidityPeriodType type' :: ValidityPeriodType $sel:type':Validity' :: Validity -> ValidityPeriodType type'} -> ValidityPeriodType type') (\s :: Validity s@Validity' {} ValidityPeriodType a -> Validity s {$sel:type':Validity' :: ValidityPeriodType type' = ValidityPeriodType a} :: Validity) instance Prelude.Hashable Validity where hashWithSalt :: Int -> Validity -> Int hashWithSalt Int _salt Validity' {Natural ValidityPeriodType type' :: ValidityPeriodType value :: Natural $sel:type':Validity' :: Validity -> ValidityPeriodType $sel:value:Validity' :: Validity -> Natural ..} = Int _salt forall a. Hashable a => Int -> a -> Int `Prelude.hashWithSalt` Natural value forall a. Hashable a => Int -> a -> Int `Prelude.hashWithSalt` ValidityPeriodType type' instance Prelude.NFData Validity where rnf :: Validity -> () rnf Validity' {Natural ValidityPeriodType type' :: ValidityPeriodType value :: Natural $sel:type':Validity' :: Validity -> ValidityPeriodType $sel:value:Validity' :: Validity -> Natural ..} = forall a. NFData a => a -> () Prelude.rnf Natural value seq :: forall a b. a -> b -> b `Prelude.seq` forall a. NFData a => a -> () Prelude.rnf ValidityPeriodType type' instance Data.ToJSON Validity where toJSON :: Validity -> Value toJSON Validity' {Natural ValidityPeriodType type' :: ValidityPeriodType value :: Natural $sel:type':Validity' :: Validity -> ValidityPeriodType $sel:value:Validity' :: Validity -> Natural ..} = [Pair] -> Value Data.object ( forall a. [Maybe a] -> [a] Prelude.catMaybes [ forall a. a -> Maybe a Prelude.Just (Key "Value" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv Data..= Natural value), forall a. a -> Maybe a Prelude.Just (Key "Type" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv Data..= ValidityPeriodType type') ] )