{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.MediaStore.Types.Container where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
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'
  { -- | 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 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,
    -- | Unix timestamp.
    Container -> Maybe POSIX
creationTime :: Prelude.Maybe Data.POSIX,
    -- | 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,
    -- | The name of the container.
    Container -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | 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
  }
  deriving (Container -> Container -> Bool
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]
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
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. 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:
--
-- '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
--
-- '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.
--
-- 'creationTime', 'container_creationTime' - Unix timestamp.
--
-- '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.
--
-- 'name', 'container_name' - The name of the container.
--
-- '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@.
newContainer ::
  Container
newContainer :: Container
newContainer =
  Container'
    { $sel:arn:Container' :: Maybe Text
arn = forall a. Maybe a
Prelude.Nothing,
      $sel:accessLoggingEnabled:Container' :: Maybe Bool
accessLoggingEnabled = forall a. Maybe a
Prelude.Nothing,
      $sel:creationTime:Container' :: Maybe POSIX
creationTime = forall a. Maybe a
Prelude.Nothing,
      $sel:endpoint:Container' :: Maybe Text
endpoint = forall a. Maybe a
Prelude.Nothing,
      $sel:name:Container' :: Maybe Text
name = forall a. Maybe a
Prelude.Nothing,
      $sel:status:Container' :: Maybe ContainerStatus
status = forall a. Maybe a
Prelude.Nothing
    }

-- | 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 :: Lens' Container (Maybe Text)
container_arn = 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 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 :: Lens' Container (Maybe Bool)
container_accessLoggingEnabled = 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)

-- | Unix timestamp.
container_creationTime :: Lens.Lens' Container (Prelude.Maybe Prelude.UTCTime)
container_creationTime :: Lens' Container (Maybe UTCTime)
container_creationTime = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | 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 :: Lens' Container (Maybe Text)
container_endpoint = 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)

-- | The name of the container.
container_name :: Lens.Lens' Container (Prelude.Maybe Prelude.Text)
container_name :: Lens' Container (Maybe Text)
container_name = 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 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 :: Lens' Container (Maybe ContainerStatus)
container_status = 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)

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

instance Prelude.Hashable Container where
  hashWithSalt :: Int -> Container -> Int
hashWithSalt Int
_salt Container' {Maybe Bool
Maybe Text
Maybe POSIX
Maybe ContainerStatus
status :: Maybe ContainerStatus
name :: Maybe Text
endpoint :: Maybe Text
creationTime :: Maybe POSIX
accessLoggingEnabled :: Maybe Bool
arn :: Maybe Text
$sel:status:Container' :: Container -> Maybe ContainerStatus
$sel:name:Container' :: Container -> Maybe Text
$sel:endpoint:Container' :: Container -> Maybe Text
$sel:creationTime:Container' :: Container -> Maybe POSIX
$sel:accessLoggingEnabled:Container' :: Container -> Maybe Bool
$sel:arn:Container' :: Container -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
arn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
accessLoggingEnabled
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
creationTime
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
endpoint
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ContainerStatus
status

instance Prelude.NFData Container where
  rnf :: Container -> ()
rnf Container' {Maybe Bool
Maybe Text
Maybe POSIX
Maybe ContainerStatus
status :: Maybe ContainerStatus
name :: Maybe Text
endpoint :: Maybe Text
creationTime :: Maybe POSIX
accessLoggingEnabled :: Maybe Bool
arn :: Maybe Text
$sel:status:Container' :: Container -> Maybe ContainerStatus
$sel:name:Container' :: Container -> Maybe Text
$sel:endpoint:Container' :: Container -> Maybe Text
$sel:creationTime:Container' :: Container -> Maybe POSIX
$sel:accessLoggingEnabled:Container' :: Container -> Maybe Bool
$sel:arn:Container' :: Container -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
arn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
accessLoggingEnabled
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
creationTime
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
endpoint
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
name
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ContainerStatus
status