{-# 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.Lightsail.Types.ContainerServiceRegistryLogin
-- 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.Lightsail.Types.ContainerServiceRegistryLogin where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Describes the login information for the container image registry of an
-- Amazon Lightsail account.
--
-- /See:/ 'newContainerServiceRegistryLogin' smart constructor.
data ContainerServiceRegistryLogin = ContainerServiceRegistryLogin'
  { -- | The timestamp of when the container image registry username and password
    -- expire.
    --
    -- The log in credentials expire 12 hours after they are created, at which
    -- point you will need to create a new set of log in credentials using the
    -- @CreateContainerServiceRegistryLogin@ action.
    ContainerServiceRegistryLogin -> Maybe POSIX
expiresAt :: Prelude.Maybe Core.POSIX,
    -- | The container service registry username to use to push container images
    -- to the container image registry of a Lightsail account.
    ContainerServiceRegistryLogin -> Maybe Text
username :: Prelude.Maybe Prelude.Text,
    -- | The container service registry password to use to push container images
    -- to the container image registry of a Lightsail account
    ContainerServiceRegistryLogin -> Maybe Text
password :: Prelude.Maybe Prelude.Text,
    -- | The address to use to push container images to the container image
    -- registry of a Lightsail account.
    ContainerServiceRegistryLogin -> Maybe Text
registry :: Prelude.Maybe Prelude.Text
  }
  deriving (ContainerServiceRegistryLogin
-> ContainerServiceRegistryLogin -> Bool
(ContainerServiceRegistryLogin
 -> ContainerServiceRegistryLogin -> Bool)
-> (ContainerServiceRegistryLogin
    -> ContainerServiceRegistryLogin -> Bool)
-> Eq ContainerServiceRegistryLogin
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ContainerServiceRegistryLogin
-> ContainerServiceRegistryLogin -> Bool
$c/= :: ContainerServiceRegistryLogin
-> ContainerServiceRegistryLogin -> Bool
== :: ContainerServiceRegistryLogin
-> ContainerServiceRegistryLogin -> Bool
$c== :: ContainerServiceRegistryLogin
-> ContainerServiceRegistryLogin -> Bool
Prelude.Eq, ReadPrec [ContainerServiceRegistryLogin]
ReadPrec ContainerServiceRegistryLogin
Int -> ReadS ContainerServiceRegistryLogin
ReadS [ContainerServiceRegistryLogin]
(Int -> ReadS ContainerServiceRegistryLogin)
-> ReadS [ContainerServiceRegistryLogin]
-> ReadPrec ContainerServiceRegistryLogin
-> ReadPrec [ContainerServiceRegistryLogin]
-> Read ContainerServiceRegistryLogin
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ContainerServiceRegistryLogin]
$creadListPrec :: ReadPrec [ContainerServiceRegistryLogin]
readPrec :: ReadPrec ContainerServiceRegistryLogin
$creadPrec :: ReadPrec ContainerServiceRegistryLogin
readList :: ReadS [ContainerServiceRegistryLogin]
$creadList :: ReadS [ContainerServiceRegistryLogin]
readsPrec :: Int -> ReadS ContainerServiceRegistryLogin
$creadsPrec :: Int -> ReadS ContainerServiceRegistryLogin
Prelude.Read, Int -> ContainerServiceRegistryLogin -> ShowS
[ContainerServiceRegistryLogin] -> ShowS
ContainerServiceRegistryLogin -> String
(Int -> ContainerServiceRegistryLogin -> ShowS)
-> (ContainerServiceRegistryLogin -> String)
-> ([ContainerServiceRegistryLogin] -> ShowS)
-> Show ContainerServiceRegistryLogin
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ContainerServiceRegistryLogin] -> ShowS
$cshowList :: [ContainerServiceRegistryLogin] -> ShowS
show :: ContainerServiceRegistryLogin -> String
$cshow :: ContainerServiceRegistryLogin -> String
showsPrec :: Int -> ContainerServiceRegistryLogin -> ShowS
$cshowsPrec :: Int -> ContainerServiceRegistryLogin -> ShowS
Prelude.Show, (forall x.
 ContainerServiceRegistryLogin
 -> Rep ContainerServiceRegistryLogin x)
-> (forall x.
    Rep ContainerServiceRegistryLogin x
    -> ContainerServiceRegistryLogin)
-> Generic ContainerServiceRegistryLogin
forall x.
Rep ContainerServiceRegistryLogin x
-> ContainerServiceRegistryLogin
forall x.
ContainerServiceRegistryLogin
-> Rep ContainerServiceRegistryLogin x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ContainerServiceRegistryLogin x
-> ContainerServiceRegistryLogin
$cfrom :: forall x.
ContainerServiceRegistryLogin
-> Rep ContainerServiceRegistryLogin x
Prelude.Generic)

-- |
-- Create a value of 'ContainerServiceRegistryLogin' 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:
--
-- 'expiresAt', 'containerServiceRegistryLogin_expiresAt' - The timestamp of when the container image registry username and password
-- expire.
--
-- The log in credentials expire 12 hours after they are created, at which
-- point you will need to create a new set of log in credentials using the
-- @CreateContainerServiceRegistryLogin@ action.
--
-- 'username', 'containerServiceRegistryLogin_username' - The container service registry username to use to push container images
-- to the container image registry of a Lightsail account.
--
-- 'password', 'containerServiceRegistryLogin_password' - The container service registry password to use to push container images
-- to the container image registry of a Lightsail account
--
-- 'registry', 'containerServiceRegistryLogin_registry' - The address to use to push container images to the container image
-- registry of a Lightsail account.
newContainerServiceRegistryLogin ::
  ContainerServiceRegistryLogin
newContainerServiceRegistryLogin :: ContainerServiceRegistryLogin
newContainerServiceRegistryLogin =
  ContainerServiceRegistryLogin' :: Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> ContainerServiceRegistryLogin
ContainerServiceRegistryLogin'
    { $sel:expiresAt:ContainerServiceRegistryLogin' :: Maybe POSIX
expiresAt =
        Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:username:ContainerServiceRegistryLogin' :: Maybe Text
username = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:password:ContainerServiceRegistryLogin' :: Maybe Text
password = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:registry:ContainerServiceRegistryLogin' :: Maybe Text
registry = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The timestamp of when the container image registry username and password
-- expire.
--
-- The log in credentials expire 12 hours after they are created, at which
-- point you will need to create a new set of log in credentials using the
-- @CreateContainerServiceRegistryLogin@ action.
containerServiceRegistryLogin_expiresAt :: Lens.Lens' ContainerServiceRegistryLogin (Prelude.Maybe Prelude.UTCTime)
containerServiceRegistryLogin_expiresAt :: (Maybe UTCTime -> f (Maybe UTCTime))
-> ContainerServiceRegistryLogin -> f ContainerServiceRegistryLogin
containerServiceRegistryLogin_expiresAt = (ContainerServiceRegistryLogin -> Maybe POSIX)
-> (ContainerServiceRegistryLogin
    -> Maybe POSIX -> ContainerServiceRegistryLogin)
-> Lens
     ContainerServiceRegistryLogin
     ContainerServiceRegistryLogin
     (Maybe POSIX)
     (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ContainerServiceRegistryLogin' {Maybe POSIX
expiresAt :: Maybe POSIX
$sel:expiresAt:ContainerServiceRegistryLogin' :: ContainerServiceRegistryLogin -> Maybe POSIX
expiresAt} -> Maybe POSIX
expiresAt) (\s :: ContainerServiceRegistryLogin
s@ContainerServiceRegistryLogin' {} Maybe POSIX
a -> ContainerServiceRegistryLogin
s {$sel:expiresAt:ContainerServiceRegistryLogin' :: Maybe POSIX
expiresAt = Maybe POSIX
a} :: ContainerServiceRegistryLogin) ((Maybe POSIX -> f (Maybe POSIX))
 -> ContainerServiceRegistryLogin
 -> f ContainerServiceRegistryLogin)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> ContainerServiceRegistryLogin
-> f ContainerServiceRegistryLogin
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

-- | The container service registry username to use to push container images
-- to the container image registry of a Lightsail account.
containerServiceRegistryLogin_username :: Lens.Lens' ContainerServiceRegistryLogin (Prelude.Maybe Prelude.Text)
containerServiceRegistryLogin_username :: (Maybe Text -> f (Maybe Text))
-> ContainerServiceRegistryLogin -> f ContainerServiceRegistryLogin
containerServiceRegistryLogin_username = (ContainerServiceRegistryLogin -> Maybe Text)
-> (ContainerServiceRegistryLogin
    -> Maybe Text -> ContainerServiceRegistryLogin)
-> Lens
     ContainerServiceRegistryLogin
     ContainerServiceRegistryLogin
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ContainerServiceRegistryLogin' {Maybe Text
username :: Maybe Text
$sel:username:ContainerServiceRegistryLogin' :: ContainerServiceRegistryLogin -> Maybe Text
username} -> Maybe Text
username) (\s :: ContainerServiceRegistryLogin
s@ContainerServiceRegistryLogin' {} Maybe Text
a -> ContainerServiceRegistryLogin
s {$sel:username:ContainerServiceRegistryLogin' :: Maybe Text
username = Maybe Text
a} :: ContainerServiceRegistryLogin)

-- | The container service registry password to use to push container images
-- to the container image registry of a Lightsail account
containerServiceRegistryLogin_password :: Lens.Lens' ContainerServiceRegistryLogin (Prelude.Maybe Prelude.Text)
containerServiceRegistryLogin_password :: (Maybe Text -> f (Maybe Text))
-> ContainerServiceRegistryLogin -> f ContainerServiceRegistryLogin
containerServiceRegistryLogin_password = (ContainerServiceRegistryLogin -> Maybe Text)
-> (ContainerServiceRegistryLogin
    -> Maybe Text -> ContainerServiceRegistryLogin)
-> Lens
     ContainerServiceRegistryLogin
     ContainerServiceRegistryLogin
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ContainerServiceRegistryLogin' {Maybe Text
password :: Maybe Text
$sel:password:ContainerServiceRegistryLogin' :: ContainerServiceRegistryLogin -> Maybe Text
password} -> Maybe Text
password) (\s :: ContainerServiceRegistryLogin
s@ContainerServiceRegistryLogin' {} Maybe Text
a -> ContainerServiceRegistryLogin
s {$sel:password:ContainerServiceRegistryLogin' :: Maybe Text
password = Maybe Text
a} :: ContainerServiceRegistryLogin)

-- | The address to use to push container images to the container image
-- registry of a Lightsail account.
containerServiceRegistryLogin_registry :: Lens.Lens' ContainerServiceRegistryLogin (Prelude.Maybe Prelude.Text)
containerServiceRegistryLogin_registry :: (Maybe Text -> f (Maybe Text))
-> ContainerServiceRegistryLogin -> f ContainerServiceRegistryLogin
containerServiceRegistryLogin_registry = (ContainerServiceRegistryLogin -> Maybe Text)
-> (ContainerServiceRegistryLogin
    -> Maybe Text -> ContainerServiceRegistryLogin)
-> Lens
     ContainerServiceRegistryLogin
     ContainerServiceRegistryLogin
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ContainerServiceRegistryLogin' {Maybe Text
registry :: Maybe Text
$sel:registry:ContainerServiceRegistryLogin' :: ContainerServiceRegistryLogin -> Maybe Text
registry} -> Maybe Text
registry) (\s :: ContainerServiceRegistryLogin
s@ContainerServiceRegistryLogin' {} Maybe Text
a -> ContainerServiceRegistryLogin
s {$sel:registry:ContainerServiceRegistryLogin' :: Maybe Text
registry = Maybe Text
a} :: ContainerServiceRegistryLogin)

instance Core.FromJSON ContainerServiceRegistryLogin where
  parseJSON :: Value -> Parser ContainerServiceRegistryLogin
parseJSON =
    String
-> (Object -> Parser ContainerServiceRegistryLogin)
-> Value
-> Parser ContainerServiceRegistryLogin
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ContainerServiceRegistryLogin"
      ( \Object
x ->
          Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> ContainerServiceRegistryLogin
ContainerServiceRegistryLogin'
            (Maybe POSIX
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> ContainerServiceRegistryLogin)
-> Parser (Maybe POSIX)
-> Parser
     (Maybe Text
      -> Maybe Text -> Maybe Text -> ContainerServiceRegistryLogin)
forall (f :: * -> *) a b. Functor 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
"expiresAt")
            Parser
  (Maybe Text
   -> Maybe Text -> Maybe Text -> ContainerServiceRegistryLogin)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text -> Maybe Text -> ContainerServiceRegistryLogin)
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
"username")
            Parser (Maybe Text -> Maybe Text -> ContainerServiceRegistryLogin)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> ContainerServiceRegistryLogin)
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
"password")
            Parser (Maybe Text -> ContainerServiceRegistryLogin)
-> Parser (Maybe Text) -> Parser ContainerServiceRegistryLogin
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
"registry")
      )

instance
  Prelude.Hashable
    ContainerServiceRegistryLogin

instance Prelude.NFData ContainerServiceRegistryLogin