{-# 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.MediaStore.Types.Container
-- 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.MediaStore.Types.Container where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MediaStore.Types.ContainerStatus
import qualified Amazonka.Prelude as Prelude

-- | This section describes operations that you can perform on an AWS
-- Elemental MediaStore container.
--
-- /See:/ 'newContainer' smart constructor.
data Container = Container'
  { -- | Unix timestamp.
    Container -> Maybe POSIX
creationTime :: Prelude.Maybe Core.POSIX,
    -- | The status of container creation or deletion. The status is one of the
    -- following: @CREATING@, @ACTIVE@, or @DELETING@. While the service is
    -- creating the container, the status is @CREATING@. When the endpoint is
    -- available, the status changes to @ACTIVE@.
    Container -> Maybe ContainerStatus
status :: Prelude.Maybe ContainerStatus,
    -- | The state of access logging on the container. This value is @false@ by
    -- default, indicating that AWS Elemental MediaStore does not send access
    -- logs to Amazon CloudWatch Logs. When you enable access logging on the
    -- container, MediaStore changes this value to @true@, indicating that the
    -- service delivers access logs for objects stored in that container to
    -- CloudWatch Logs.
    Container -> Maybe Bool
accessLoggingEnabled :: Prelude.Maybe Prelude.Bool,
    -- | The Amazon Resource Name (ARN) of the container. The ARN has the
    -- following format:
    --
    -- arn:aws:\<region>:\<account that owns this container>:container\/\<name
    -- of container>
    --
    -- For example: arn:aws:mediastore:us-west-2:111122223333:container\/movies
    Container -> Maybe Text
arn :: Prelude.Maybe Prelude.Text,
    -- | The name of the container.
    Container -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The DNS endpoint of the container. Use the endpoint to identify the
    -- specific container when sending requests to the data plane. The service
    -- assigns this value when the container is created. Once the value has
    -- been assigned, it does not change.
    Container -> Maybe Text
endpoint :: Prelude.Maybe Prelude.Text
  }
  deriving (Container -> Container -> Bool
(Container -> Container -> Bool)
-> (Container -> Container -> Bool) -> Eq Container
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Container -> Container -> Bool
$c/= :: Container -> Container -> Bool
== :: Container -> Container -> Bool
$c== :: Container -> Container -> Bool
Prelude.Eq, ReadPrec [Container]
ReadPrec Container
Int -> ReadS Container
ReadS [Container]
(Int -> ReadS Container)
-> ReadS [Container]
-> ReadPrec Container
-> ReadPrec [Container]
-> Read Container
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Container]
$creadListPrec :: ReadPrec [Container]
readPrec :: ReadPrec Container
$creadPrec :: ReadPrec Container
readList :: ReadS [Container]
$creadList :: ReadS [Container]
readsPrec :: Int -> ReadS Container
$creadsPrec :: Int -> ReadS Container
Prelude.Read, Int -> Container -> ShowS
[Container] -> ShowS
Container -> String
(Int -> Container -> ShowS)
-> (Container -> String)
-> ([Container] -> ShowS)
-> Show Container
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Container] -> ShowS
$cshowList :: [Container] -> ShowS
show :: Container -> String
$cshow :: Container -> String
showsPrec :: Int -> Container -> ShowS
$cshowsPrec :: Int -> Container -> ShowS
Prelude.Show, (forall x. Container -> Rep Container x)
-> (forall x. Rep Container x -> Container) -> Generic Container
forall x. Rep Container x -> Container
forall x. Container -> Rep Container x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Container x -> Container
$cfrom :: forall x. Container -> Rep Container x
Prelude.Generic)

-- |
-- Create a value of 'Container' 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:
--
-- 'creationTime', 'container_creationTime' - Unix timestamp.
--
-- 'status', 'container_status' - The status of container creation or deletion. The status is one of the
-- following: @CREATING@, @ACTIVE@, or @DELETING@. While the service is
-- creating the container, the status is @CREATING@. When the endpoint is
-- available, the status changes to @ACTIVE@.
--
-- 'accessLoggingEnabled', 'container_accessLoggingEnabled' - The state of access logging on the container. This value is @false@ by
-- default, indicating that AWS Elemental MediaStore does not send access
-- logs to Amazon CloudWatch Logs. When you enable access logging on the
-- container, MediaStore changes this value to @true@, indicating that the
-- service delivers access logs for objects stored in that container to
-- CloudWatch Logs.
--
-- 'arn', 'container_arn' - The Amazon Resource Name (ARN) of the container. The ARN has the
-- following format:
--
-- arn:aws:\<region>:\<account that owns this container>:container\/\<name
-- of container>
--
-- For example: arn:aws:mediastore:us-west-2:111122223333:container\/movies
--
-- 'name', 'container_name' - The name of the container.
--
-- 'endpoint', 'container_endpoint' - The DNS endpoint of the container. Use the endpoint to identify the
-- specific container when sending requests to the data plane. The service
-- assigns this value when the container is created. Once the value has
-- been assigned, it does not change.
newContainer ::
  Container
newContainer :: Container
newContainer =
  Container' :: Maybe POSIX
-> Maybe ContainerStatus
-> Maybe Bool
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Container
Container'
    { $sel:creationTime:Container' :: Maybe POSIX
creationTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:status:Container' :: Maybe ContainerStatus
status = Maybe ContainerStatus
forall a. Maybe a
Prelude.Nothing,
      $sel:accessLoggingEnabled:Container' :: Maybe Bool
accessLoggingEnabled = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:arn:Container' :: Maybe Text
arn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:name:Container' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:endpoint:Container' :: Maybe Text
endpoint = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | Unix timestamp.
container_creationTime :: Lens.Lens' Container (Prelude.Maybe Prelude.UTCTime)
container_creationTime :: (Maybe UTCTime -> f (Maybe UTCTime)) -> Container -> f Container
container_creationTime = (Container -> Maybe POSIX)
-> (Container -> Maybe POSIX -> Container)
-> Lens Container Container (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Container' {Maybe POSIX
creationTime :: Maybe POSIX
$sel:creationTime:Container' :: Container -> Maybe POSIX
creationTime} -> Maybe POSIX
creationTime) (\s :: Container
s@Container' {} Maybe POSIX
a -> Container
s {$sel:creationTime:Container' :: Maybe POSIX
creationTime = Maybe POSIX
a} :: Container) ((Maybe POSIX -> f (Maybe POSIX)) -> Container -> f Container)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> Container
-> f Container
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 status of container creation or deletion. The status is one of the
-- following: @CREATING@, @ACTIVE@, or @DELETING@. While the service is
-- creating the container, the status is @CREATING@. When the endpoint is
-- available, the status changes to @ACTIVE@.
container_status :: Lens.Lens' Container (Prelude.Maybe ContainerStatus)
container_status :: (Maybe ContainerStatus -> f (Maybe ContainerStatus))
-> Container -> f Container
container_status = (Container -> Maybe ContainerStatus)
-> (Container -> Maybe ContainerStatus -> Container)
-> Lens
     Container Container (Maybe ContainerStatus) (Maybe ContainerStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Container' {Maybe ContainerStatus
status :: Maybe ContainerStatus
$sel:status:Container' :: Container -> Maybe ContainerStatus
status} -> Maybe ContainerStatus
status) (\s :: Container
s@Container' {} Maybe ContainerStatus
a -> Container
s {$sel:status:Container' :: Maybe ContainerStatus
status = Maybe ContainerStatus
a} :: Container)

-- | The state of access logging on the container. This value is @false@ by
-- default, indicating that AWS Elemental MediaStore does not send access
-- logs to Amazon CloudWatch Logs. When you enable access logging on the
-- container, MediaStore changes this value to @true@, indicating that the
-- service delivers access logs for objects stored in that container to
-- CloudWatch Logs.
container_accessLoggingEnabled :: Lens.Lens' Container (Prelude.Maybe Prelude.Bool)
container_accessLoggingEnabled :: (Maybe Bool -> f (Maybe Bool)) -> Container -> f Container
container_accessLoggingEnabled = (Container -> Maybe Bool)
-> (Container -> Maybe Bool -> Container)
-> Lens Container Container (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Container' {Maybe Bool
accessLoggingEnabled :: Maybe Bool
$sel:accessLoggingEnabled:Container' :: Container -> Maybe Bool
accessLoggingEnabled} -> Maybe Bool
accessLoggingEnabled) (\s :: Container
s@Container' {} Maybe Bool
a -> Container
s {$sel:accessLoggingEnabled:Container' :: Maybe Bool
accessLoggingEnabled = Maybe Bool
a} :: Container)

-- | The Amazon Resource Name (ARN) of the container. The ARN has the
-- following format:
--
-- arn:aws:\<region>:\<account that owns this container>:container\/\<name
-- of container>
--
-- For example: arn:aws:mediastore:us-west-2:111122223333:container\/movies
container_arn :: Lens.Lens' Container (Prelude.Maybe Prelude.Text)
container_arn :: (Maybe Text -> f (Maybe Text)) -> Container -> f Container
container_arn = (Container -> Maybe Text)
-> (Container -> Maybe Text -> Container)
-> Lens Container Container (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Container' {Maybe Text
arn :: Maybe Text
$sel:arn:Container' :: Container -> Maybe Text
arn} -> Maybe Text
arn) (\s :: Container
s@Container' {} Maybe Text
a -> Container
s {$sel:arn:Container' :: Maybe Text
arn = Maybe Text
a} :: Container)

-- | The name of the container.
container_name :: Lens.Lens' Container (Prelude.Maybe Prelude.Text)
container_name :: (Maybe Text -> f (Maybe Text)) -> Container -> f Container
container_name = (Container -> Maybe Text)
-> (Container -> Maybe Text -> Container)
-> Lens Container Container (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Container' {Maybe Text
name :: Maybe Text
$sel:name:Container' :: Container -> Maybe Text
name} -> Maybe Text
name) (\s :: Container
s@Container' {} Maybe Text
a -> Container
s {$sel:name:Container' :: Maybe Text
name = Maybe Text
a} :: Container)

-- | The DNS endpoint of the container. Use the endpoint to identify the
-- specific container when sending requests to the data plane. The service
-- assigns this value when the container is created. Once the value has
-- been assigned, it does not change.
container_endpoint :: Lens.Lens' Container (Prelude.Maybe Prelude.Text)
container_endpoint :: (Maybe Text -> f (Maybe Text)) -> Container -> f Container
container_endpoint = (Container -> Maybe Text)
-> (Container -> Maybe Text -> Container)
-> Lens Container Container (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Container' {Maybe Text
endpoint :: Maybe Text
$sel:endpoint:Container' :: Container -> Maybe Text
endpoint} -> Maybe Text
endpoint) (\s :: Container
s@Container' {} Maybe Text
a -> Container
s {$sel:endpoint:Container' :: Maybe Text
endpoint = Maybe Text
a} :: Container)

instance Core.FromJSON Container where
  parseJSON :: Value -> Parser Container
parseJSON =
    String -> (Object -> Parser Container) -> Value -> Parser Container
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"Container"
      ( \Object
x ->
          Maybe POSIX
-> Maybe ContainerStatus
-> Maybe Bool
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Container
Container'
            (Maybe POSIX
 -> Maybe ContainerStatus
 -> Maybe Bool
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Container)
-> Parser (Maybe POSIX)
-> Parser
     (Maybe ContainerStatus
      -> Maybe Bool
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Container)
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
"CreationTime")
            Parser
  (Maybe ContainerStatus
   -> Maybe Bool
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Container)
-> Parser (Maybe ContainerStatus)
-> Parser
     (Maybe Bool -> Maybe Text -> Maybe Text -> Maybe Text -> Container)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe ContainerStatus)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Status")
            Parser
  (Maybe Bool -> Maybe Text -> Maybe Text -> Maybe Text -> Container)
-> Parser (Maybe Bool)
-> Parser (Maybe Text -> Maybe Text -> Maybe Text -> Container)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"AccessLoggingEnabled")
            Parser (Maybe Text -> Maybe Text -> Maybe Text -> Container)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe Text -> Container)
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
"ARN")
            Parser (Maybe Text -> Maybe Text -> Container)
-> Parser (Maybe Text) -> Parser (Maybe Text -> Container)
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
"Name")
            Parser (Maybe Text -> Container)
-> Parser (Maybe Text) -> Parser Container
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
"Endpoint")
      )

instance Prelude.Hashable Container

instance Prelude.NFData Container