{-# 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 #-}
module Amazonka.Lightsail.Types.AccessKey where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.Lightsail.Types.AccessKeyLastUsed
import Amazonka.Lightsail.Types.StatusType
import qualified Amazonka.Prelude as Prelude
data AccessKey = AccessKey'
{
AccessKey -> Maybe StatusType
status :: Prelude.Maybe StatusType,
AccessKey -> Maybe POSIX
createdAt :: Prelude.Maybe Core.POSIX,
AccessKey -> Maybe Text
secretAccessKey :: Prelude.Maybe Prelude.Text,
AccessKey -> Maybe AccessKeyLastUsed
lastUsed :: Prelude.Maybe AccessKeyLastUsed,
AccessKey -> Maybe (Sensitive Text)
accessKeyId :: Prelude.Maybe (Core.Sensitive Prelude.Text)
}
deriving (AccessKey -> AccessKey -> Bool
(AccessKey -> AccessKey -> Bool)
-> (AccessKey -> AccessKey -> Bool) -> Eq AccessKey
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AccessKey -> AccessKey -> Bool
$c/= :: AccessKey -> AccessKey -> Bool
== :: AccessKey -> AccessKey -> Bool
$c== :: AccessKey -> AccessKey -> Bool
Prelude.Eq, Int -> AccessKey -> ShowS
[AccessKey] -> ShowS
AccessKey -> String
(Int -> AccessKey -> ShowS)
-> (AccessKey -> String)
-> ([AccessKey] -> ShowS)
-> Show AccessKey
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AccessKey] -> ShowS
$cshowList :: [AccessKey] -> ShowS
show :: AccessKey -> String
$cshow :: AccessKey -> String
showsPrec :: Int -> AccessKey -> ShowS
$cshowsPrec :: Int -> AccessKey -> ShowS
Prelude.Show, (forall x. AccessKey -> Rep AccessKey x)
-> (forall x. Rep AccessKey x -> AccessKey) -> Generic AccessKey
forall x. Rep AccessKey x -> AccessKey
forall x. AccessKey -> Rep AccessKey x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AccessKey x -> AccessKey
$cfrom :: forall x. AccessKey -> Rep AccessKey x
Prelude.Generic)
newAccessKey ::
AccessKey
newAccessKey :: AccessKey
newAccessKey =
AccessKey' :: Maybe StatusType
-> Maybe POSIX
-> Maybe Text
-> Maybe AccessKeyLastUsed
-> Maybe (Sensitive Text)
-> AccessKey
AccessKey'
{ $sel:status:AccessKey' :: Maybe StatusType
status = Maybe StatusType
forall a. Maybe a
Prelude.Nothing,
$sel:createdAt:AccessKey' :: Maybe POSIX
createdAt = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
$sel:secretAccessKey:AccessKey' :: Maybe Text
secretAccessKey = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:lastUsed:AccessKey' :: Maybe AccessKeyLastUsed
lastUsed = Maybe AccessKeyLastUsed
forall a. Maybe a
Prelude.Nothing,
$sel:accessKeyId:AccessKey' :: Maybe (Sensitive Text)
accessKeyId = Maybe (Sensitive Text)
forall a. Maybe a
Prelude.Nothing
}
accessKey_status :: Lens.Lens' AccessKey (Prelude.Maybe StatusType)
accessKey_status :: (Maybe StatusType -> f (Maybe StatusType))
-> AccessKey -> f AccessKey
accessKey_status = (AccessKey -> Maybe StatusType)
-> (AccessKey -> Maybe StatusType -> AccessKey)
-> Lens AccessKey AccessKey (Maybe StatusType) (Maybe StatusType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AccessKey' {Maybe StatusType
status :: Maybe StatusType
$sel:status:AccessKey' :: AccessKey -> Maybe StatusType
status} -> Maybe StatusType
status) (\s :: AccessKey
s@AccessKey' {} Maybe StatusType
a -> AccessKey
s {$sel:status:AccessKey' :: Maybe StatusType
status = Maybe StatusType
a} :: AccessKey)
accessKey_createdAt :: Lens.Lens' AccessKey (Prelude.Maybe Prelude.UTCTime)
accessKey_createdAt :: (Maybe UTCTime -> f (Maybe UTCTime)) -> AccessKey -> f AccessKey
accessKey_createdAt = (AccessKey -> Maybe POSIX)
-> (AccessKey -> Maybe POSIX -> AccessKey)
-> Lens AccessKey AccessKey (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AccessKey' {Maybe POSIX
createdAt :: Maybe POSIX
$sel:createdAt:AccessKey' :: AccessKey -> Maybe POSIX
createdAt} -> Maybe POSIX
createdAt) (\s :: AccessKey
s@AccessKey' {} Maybe POSIX
a -> AccessKey
s {$sel:createdAt:AccessKey' :: Maybe POSIX
createdAt = Maybe POSIX
a} :: AccessKey) ((Maybe POSIX -> f (Maybe POSIX)) -> AccessKey -> f AccessKey)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
-> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> AccessKey
-> f AccessKey
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 AnIso POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time
accessKey_secretAccessKey :: Lens.Lens' AccessKey (Prelude.Maybe Prelude.Text)
accessKey_secretAccessKey :: (Maybe Text -> f (Maybe Text)) -> AccessKey -> f AccessKey
accessKey_secretAccessKey = (AccessKey -> Maybe Text)
-> (AccessKey -> Maybe Text -> AccessKey)
-> Lens AccessKey AccessKey (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AccessKey' {Maybe Text
secretAccessKey :: Maybe Text
$sel:secretAccessKey:AccessKey' :: AccessKey -> Maybe Text
secretAccessKey} -> Maybe Text
secretAccessKey) (\s :: AccessKey
s@AccessKey' {} Maybe Text
a -> AccessKey
s {$sel:secretAccessKey:AccessKey' :: Maybe Text
secretAccessKey = Maybe Text
a} :: AccessKey)
accessKey_lastUsed :: Lens.Lens' AccessKey (Prelude.Maybe AccessKeyLastUsed)
accessKey_lastUsed :: (Maybe AccessKeyLastUsed -> f (Maybe AccessKeyLastUsed))
-> AccessKey -> f AccessKey
accessKey_lastUsed = (AccessKey -> Maybe AccessKeyLastUsed)
-> (AccessKey -> Maybe AccessKeyLastUsed -> AccessKey)
-> Lens
AccessKey
AccessKey
(Maybe AccessKeyLastUsed)
(Maybe AccessKeyLastUsed)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AccessKey' {Maybe AccessKeyLastUsed
lastUsed :: Maybe AccessKeyLastUsed
$sel:lastUsed:AccessKey' :: AccessKey -> Maybe AccessKeyLastUsed
lastUsed} -> Maybe AccessKeyLastUsed
lastUsed) (\s :: AccessKey
s@AccessKey' {} Maybe AccessKeyLastUsed
a -> AccessKey
s {$sel:lastUsed:AccessKey' :: Maybe AccessKeyLastUsed
lastUsed = Maybe AccessKeyLastUsed
a} :: AccessKey)
accessKey_accessKeyId :: Lens.Lens' AccessKey (Prelude.Maybe Prelude.Text)
accessKey_accessKeyId :: (Maybe Text -> f (Maybe Text)) -> AccessKey -> f AccessKey
accessKey_accessKeyId = (AccessKey -> Maybe (Sensitive Text))
-> (AccessKey -> Maybe (Sensitive Text) -> AccessKey)
-> Lens
AccessKey
AccessKey
(Maybe (Sensitive Text))
(Maybe (Sensitive Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AccessKey' {Maybe (Sensitive Text)
accessKeyId :: Maybe (Sensitive Text)
$sel:accessKeyId:AccessKey' :: AccessKey -> Maybe (Sensitive Text)
accessKeyId} -> Maybe (Sensitive Text)
accessKeyId) (\s :: AccessKey
s@AccessKey' {} Maybe (Sensitive Text)
a -> AccessKey
s {$sel:accessKeyId:AccessKey' :: Maybe (Sensitive Text)
accessKeyId = Maybe (Sensitive Text)
a} :: AccessKey) ((Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> AccessKey -> f AccessKey)
-> ((Maybe Text -> f (Maybe Text))
-> Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> (Maybe Text -> f (Maybe Text))
-> AccessKey
-> f AccessKey
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso (Sensitive Text) (Sensitive Text) Text Text
-> Iso
(Maybe (Sensitive Text))
(Maybe (Sensitive Text))
(Maybe Text)
(Maybe Text)
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 AnIso (Sensitive Text) (Sensitive Text) Text Text
forall a. Iso' (Sensitive a) a
Core._Sensitive
instance Core.FromJSON AccessKey where
parseJSON :: Value -> Parser AccessKey
parseJSON =
String -> (Object -> Parser AccessKey) -> Value -> Parser AccessKey
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"AccessKey"
( \Object
x ->
Maybe StatusType
-> Maybe POSIX
-> Maybe Text
-> Maybe AccessKeyLastUsed
-> Maybe (Sensitive Text)
-> AccessKey
AccessKey'
(Maybe StatusType
-> Maybe POSIX
-> Maybe Text
-> Maybe AccessKeyLastUsed
-> Maybe (Sensitive Text)
-> AccessKey)
-> Parser (Maybe StatusType)
-> Parser
(Maybe POSIX
-> Maybe Text
-> Maybe AccessKeyLastUsed
-> Maybe (Sensitive Text)
-> AccessKey)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe StatusType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"status")
Parser
(Maybe POSIX
-> Maybe Text
-> Maybe AccessKeyLastUsed
-> Maybe (Sensitive Text)
-> AccessKey)
-> Parser (Maybe POSIX)
-> Parser
(Maybe Text
-> Maybe AccessKeyLastUsed -> Maybe (Sensitive Text) -> AccessKey)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"createdAt")
Parser
(Maybe Text
-> Maybe AccessKeyLastUsed -> Maybe (Sensitive Text) -> AccessKey)
-> Parser (Maybe Text)
-> Parser
(Maybe AccessKeyLastUsed -> Maybe (Sensitive Text) -> AccessKey)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"secretAccessKey")
Parser
(Maybe AccessKeyLastUsed -> Maybe (Sensitive Text) -> AccessKey)
-> Parser (Maybe AccessKeyLastUsed)
-> Parser (Maybe (Sensitive Text) -> AccessKey)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe AccessKeyLastUsed)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"lastUsed")
Parser (Maybe (Sensitive Text) -> AccessKey)
-> Parser (Maybe (Sensitive Text)) -> Parser AccessKey
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Sensitive Text))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"accessKeyId")
)
instance Prelude.Hashable AccessKey
instance Prelude.NFData AccessKey