{-# 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.Bucket
-- 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.Bucket where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.Lightsail.Types.AccessRules
import Amazonka.Lightsail.Types.BucketState
import Amazonka.Lightsail.Types.ResourceLocation
import Amazonka.Lightsail.Types.ResourceReceivingAccess
import Amazonka.Lightsail.Types.Tag
import qualified Amazonka.Prelude as Prelude

-- | Describes an Amazon Lightsail bucket.
--
-- /See:/ 'newBucket' smart constructor.
data Bucket = Bucket'
  { -- | An object that describes the state of the bucket.
    Bucket -> Maybe BucketState
state :: Prelude.Maybe BucketState,
    -- | Indicates whether object versioning is enabled for the bucket.
    --
    -- The following options can be configured:
    --
    -- -   @Enabled@ - Object versioning is enabled.
    --
    -- -   @Suspended@ - Object versioning was previously enabled but is
    --     currently suspended. Existing object versions are retained.
    --
    -- -   @NeverEnabled@ - Object versioning has never been enabled.
    Bucket -> Maybe Text
objectVersioning :: Prelude.Maybe Prelude.Text,
    -- | The Lightsail resource type of the bucket (for example, @Bucket@).
    Bucket -> Maybe Text
resourceType :: Prelude.Maybe Prelude.Text,
    -- | The Amazon Resource Name (ARN) of the bucket.
    Bucket -> Maybe Text
arn :: Prelude.Maybe Prelude.Text,
    -- | The timestamp when the distribution was created.
    Bucket -> Maybe POSIX
createdAt :: Prelude.Maybe Core.POSIX,
    Bucket -> Maybe ResourceLocation
location :: Prelude.Maybe ResourceLocation,
    -- | An array of strings that specify the AWS account IDs that have read-only
    -- access to the bucket.
    Bucket -> Maybe [Text]
readonlyAccessAccounts :: Prelude.Maybe [Prelude.Text],
    -- | The URL of the bucket.
    Bucket -> Maybe Text
url :: Prelude.Maybe Prelude.Text,
    -- | An array of objects that describe Lightsail instances that have access
    -- to the bucket.
    --
    -- Use the SetResourceAccessForBucket action to update the instances that
    -- have access to a bucket.
    Bucket -> Maybe [ResourceReceivingAccess]
resourcesReceivingAccess :: Prelude.Maybe [ResourceReceivingAccess],
    -- | The ID of the bundle currently applied to the bucket.
    --
    -- A bucket bundle specifies the monthly cost, storage space, and data
    -- transfer quota for a bucket.
    --
    -- Use the UpdateBucketBundle action to change the bundle of a bucket.
    Bucket -> Maybe Text
bundleId :: Prelude.Maybe Prelude.Text,
    -- | An object that describes the access rules of the bucket.
    Bucket -> Maybe AccessRules
accessRules :: Prelude.Maybe AccessRules,
    -- | Indicates whether the bundle that is currently applied to a bucket can
    -- be changed to another bundle.
    --
    -- You can update a bucket\'s bundle only one time within a monthly AWS
    -- billing cycle.
    --
    -- Use the UpdateBucketBundle action to change a bucket\'s bundle.
    Bucket -> Maybe Bool
ableToUpdateBundle :: Prelude.Maybe Prelude.Bool,
    -- | The name of the bucket.
    Bucket -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The support code for a bucket. Include this code in your email to
    -- support when you have questions about a Lightsail bucket. This code
    -- enables our support team to look up your Lightsail information more
    -- easily.
    Bucket -> Maybe Text
supportCode :: Prelude.Maybe Prelude.Text,
    -- | The tag keys and optional values for the bucket. For more information,
    -- see
    -- <https://lightsail.aws.amazon.com/ls/docs/en/articles/amazon-lightsail-tags Tags in Amazon Lightsail>
    -- in the /Amazon Lightsail Developer Guide/.
    Bucket -> Maybe [Tag]
tags :: Prelude.Maybe [Tag]
  }
  deriving (Bucket -> Bucket -> Bool
(Bucket -> Bucket -> Bool)
-> (Bucket -> Bucket -> Bool) -> Eq Bucket
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Bucket -> Bucket -> Bool
$c/= :: Bucket -> Bucket -> Bool
== :: Bucket -> Bucket -> Bool
$c== :: Bucket -> Bucket -> Bool
Prelude.Eq, ReadPrec [Bucket]
ReadPrec Bucket
Int -> ReadS Bucket
ReadS [Bucket]
(Int -> ReadS Bucket)
-> ReadS [Bucket]
-> ReadPrec Bucket
-> ReadPrec [Bucket]
-> Read Bucket
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Bucket]
$creadListPrec :: ReadPrec [Bucket]
readPrec :: ReadPrec Bucket
$creadPrec :: ReadPrec Bucket
readList :: ReadS [Bucket]
$creadList :: ReadS [Bucket]
readsPrec :: Int -> ReadS Bucket
$creadsPrec :: Int -> ReadS Bucket
Prelude.Read, Int -> Bucket -> ShowS
[Bucket] -> ShowS
Bucket -> String
(Int -> Bucket -> ShowS)
-> (Bucket -> String) -> ([Bucket] -> ShowS) -> Show Bucket
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Bucket] -> ShowS
$cshowList :: [Bucket] -> ShowS
show :: Bucket -> String
$cshow :: Bucket -> String
showsPrec :: Int -> Bucket -> ShowS
$cshowsPrec :: Int -> Bucket -> ShowS
Prelude.Show, (forall x. Bucket -> Rep Bucket x)
-> (forall x. Rep Bucket x -> Bucket) -> Generic Bucket
forall x. Rep Bucket x -> Bucket
forall x. Bucket -> Rep Bucket x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Bucket x -> Bucket
$cfrom :: forall x. Bucket -> Rep Bucket x
Prelude.Generic)

-- |
-- Create a value of 'Bucket' 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:
--
-- 'state', 'bucket_state' - An object that describes the state of the bucket.
--
-- 'objectVersioning', 'bucket_objectVersioning' - Indicates whether object versioning is enabled for the bucket.
--
-- The following options can be configured:
--
-- -   @Enabled@ - Object versioning is enabled.
--
-- -   @Suspended@ - Object versioning was previously enabled but is
--     currently suspended. Existing object versions are retained.
--
-- -   @NeverEnabled@ - Object versioning has never been enabled.
--
-- 'resourceType', 'bucket_resourceType' - The Lightsail resource type of the bucket (for example, @Bucket@).
--
-- 'arn', 'bucket_arn' - The Amazon Resource Name (ARN) of the bucket.
--
-- 'createdAt', 'bucket_createdAt' - The timestamp when the distribution was created.
--
-- 'location', 'bucket_location' - Undocumented member.
--
-- 'readonlyAccessAccounts', 'bucket_readonlyAccessAccounts' - An array of strings that specify the AWS account IDs that have read-only
-- access to the bucket.
--
-- 'url', 'bucket_url' - The URL of the bucket.
--
-- 'resourcesReceivingAccess', 'bucket_resourcesReceivingAccess' - An array of objects that describe Lightsail instances that have access
-- to the bucket.
--
-- Use the SetResourceAccessForBucket action to update the instances that
-- have access to a bucket.
--
-- 'bundleId', 'bucket_bundleId' - The ID of the bundle currently applied to the bucket.
--
-- A bucket bundle specifies the monthly cost, storage space, and data
-- transfer quota for a bucket.
--
-- Use the UpdateBucketBundle action to change the bundle of a bucket.
--
-- 'accessRules', 'bucket_accessRules' - An object that describes the access rules of the bucket.
--
-- 'ableToUpdateBundle', 'bucket_ableToUpdateBundle' - Indicates whether the bundle that is currently applied to a bucket can
-- be changed to another bundle.
--
-- You can update a bucket\'s bundle only one time within a monthly AWS
-- billing cycle.
--
-- Use the UpdateBucketBundle action to change a bucket\'s bundle.
--
-- 'name', 'bucket_name' - The name of the bucket.
--
-- 'supportCode', 'bucket_supportCode' - The support code for a bucket. Include this code in your email to
-- support when you have questions about a Lightsail bucket. This code
-- enables our support team to look up your Lightsail information more
-- easily.
--
-- 'tags', 'bucket_tags' - The tag keys and optional values for the bucket. For more information,
-- see
-- <https://lightsail.aws.amazon.com/ls/docs/en/articles/amazon-lightsail-tags Tags in Amazon Lightsail>
-- in the /Amazon Lightsail Developer Guide/.
newBucket ::
  Bucket
newBucket :: Bucket
newBucket =
  Bucket' :: Maybe BucketState
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe POSIX
-> Maybe ResourceLocation
-> Maybe [Text]
-> Maybe Text
-> Maybe [ResourceReceivingAccess]
-> Maybe Text
-> Maybe AccessRules
-> Maybe Bool
-> Maybe Text
-> Maybe Text
-> Maybe [Tag]
-> Bucket
Bucket'
    { $sel:state:Bucket' :: Maybe BucketState
state = Maybe BucketState
forall a. Maybe a
Prelude.Nothing,
      $sel:objectVersioning:Bucket' :: Maybe Text
objectVersioning = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:resourceType:Bucket' :: Maybe Text
resourceType = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:arn:Bucket' :: Maybe Text
arn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:createdAt:Bucket' :: Maybe POSIX
createdAt = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:location:Bucket' :: Maybe ResourceLocation
location = Maybe ResourceLocation
forall a. Maybe a
Prelude.Nothing,
      $sel:readonlyAccessAccounts:Bucket' :: Maybe [Text]
readonlyAccessAccounts = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:url:Bucket' :: Maybe Text
url = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:resourcesReceivingAccess:Bucket' :: Maybe [ResourceReceivingAccess]
resourcesReceivingAccess = Maybe [ResourceReceivingAccess]
forall a. Maybe a
Prelude.Nothing,
      $sel:bundleId:Bucket' :: Maybe Text
bundleId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:accessRules:Bucket' :: Maybe AccessRules
accessRules = Maybe AccessRules
forall a. Maybe a
Prelude.Nothing,
      $sel:ableToUpdateBundle:Bucket' :: Maybe Bool
ableToUpdateBundle = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:name:Bucket' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:supportCode:Bucket' :: Maybe Text
supportCode = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:tags:Bucket' :: Maybe [Tag]
tags = Maybe [Tag]
forall a. Maybe a
Prelude.Nothing
    }

-- | An object that describes the state of the bucket.
bucket_state :: Lens.Lens' Bucket (Prelude.Maybe BucketState)
bucket_state :: (Maybe BucketState -> f (Maybe BucketState)) -> Bucket -> f Bucket
bucket_state = (Bucket -> Maybe BucketState)
-> (Bucket -> Maybe BucketState -> Bucket)
-> Lens Bucket Bucket (Maybe BucketState) (Maybe BucketState)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Bucket' {Maybe BucketState
state :: Maybe BucketState
$sel:state:Bucket' :: Bucket -> Maybe BucketState
state} -> Maybe BucketState
state) (\s :: Bucket
s@Bucket' {} Maybe BucketState
a -> Bucket
s {$sel:state:Bucket' :: Maybe BucketState
state = Maybe BucketState
a} :: Bucket)

-- | Indicates whether object versioning is enabled for the bucket.
--
-- The following options can be configured:
--
-- -   @Enabled@ - Object versioning is enabled.
--
-- -   @Suspended@ - Object versioning was previously enabled but is
--     currently suspended. Existing object versions are retained.
--
-- -   @NeverEnabled@ - Object versioning has never been enabled.
bucket_objectVersioning :: Lens.Lens' Bucket (Prelude.Maybe Prelude.Text)
bucket_objectVersioning :: (Maybe Text -> f (Maybe Text)) -> Bucket -> f Bucket
bucket_objectVersioning = (Bucket -> Maybe Text)
-> (Bucket -> Maybe Text -> Bucket)
-> Lens Bucket Bucket (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Bucket' {Maybe Text
objectVersioning :: Maybe Text
$sel:objectVersioning:Bucket' :: Bucket -> Maybe Text
objectVersioning} -> Maybe Text
objectVersioning) (\s :: Bucket
s@Bucket' {} Maybe Text
a -> Bucket
s {$sel:objectVersioning:Bucket' :: Maybe Text
objectVersioning = Maybe Text
a} :: Bucket)

-- | The Lightsail resource type of the bucket (for example, @Bucket@).
bucket_resourceType :: Lens.Lens' Bucket (Prelude.Maybe Prelude.Text)
bucket_resourceType :: (Maybe Text -> f (Maybe Text)) -> Bucket -> f Bucket
bucket_resourceType = (Bucket -> Maybe Text)
-> (Bucket -> Maybe Text -> Bucket)
-> Lens Bucket Bucket (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Bucket' {Maybe Text
resourceType :: Maybe Text
$sel:resourceType:Bucket' :: Bucket -> Maybe Text
resourceType} -> Maybe Text
resourceType) (\s :: Bucket
s@Bucket' {} Maybe Text
a -> Bucket
s {$sel:resourceType:Bucket' :: Maybe Text
resourceType = Maybe Text
a} :: Bucket)

-- | The Amazon Resource Name (ARN) of the bucket.
bucket_arn :: Lens.Lens' Bucket (Prelude.Maybe Prelude.Text)
bucket_arn :: (Maybe Text -> f (Maybe Text)) -> Bucket -> f Bucket
bucket_arn = (Bucket -> Maybe Text)
-> (Bucket -> Maybe Text -> Bucket)
-> Lens Bucket Bucket (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Bucket' {Maybe Text
arn :: Maybe Text
$sel:arn:Bucket' :: Bucket -> Maybe Text
arn} -> Maybe Text
arn) (\s :: Bucket
s@Bucket' {} Maybe Text
a -> Bucket
s {$sel:arn:Bucket' :: Maybe Text
arn = Maybe Text
a} :: Bucket)

-- | The timestamp when the distribution was created.
bucket_createdAt :: Lens.Lens' Bucket (Prelude.Maybe Prelude.UTCTime)
bucket_createdAt :: (Maybe UTCTime -> f (Maybe UTCTime)) -> Bucket -> f Bucket
bucket_createdAt = (Bucket -> Maybe POSIX)
-> (Bucket -> Maybe POSIX -> Bucket)
-> Lens Bucket Bucket (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Bucket' {Maybe POSIX
createdAt :: Maybe POSIX
$sel:createdAt:Bucket' :: Bucket -> Maybe POSIX
createdAt} -> Maybe POSIX
createdAt) (\s :: Bucket
s@Bucket' {} Maybe POSIX
a -> Bucket
s {$sel:createdAt:Bucket' :: Maybe POSIX
createdAt = Maybe POSIX
a} :: Bucket) ((Maybe POSIX -> f (Maybe POSIX)) -> Bucket -> f Bucket)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> Bucket
-> f Bucket
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

-- | Undocumented member.
bucket_location :: Lens.Lens' Bucket (Prelude.Maybe ResourceLocation)
bucket_location :: (Maybe ResourceLocation -> f (Maybe ResourceLocation))
-> Bucket -> f Bucket
bucket_location = (Bucket -> Maybe ResourceLocation)
-> (Bucket -> Maybe ResourceLocation -> Bucket)
-> Lens
     Bucket Bucket (Maybe ResourceLocation) (Maybe ResourceLocation)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Bucket' {Maybe ResourceLocation
location :: Maybe ResourceLocation
$sel:location:Bucket' :: Bucket -> Maybe ResourceLocation
location} -> Maybe ResourceLocation
location) (\s :: Bucket
s@Bucket' {} Maybe ResourceLocation
a -> Bucket
s {$sel:location:Bucket' :: Maybe ResourceLocation
location = Maybe ResourceLocation
a} :: Bucket)

-- | An array of strings that specify the AWS account IDs that have read-only
-- access to the bucket.
bucket_readonlyAccessAccounts :: Lens.Lens' Bucket (Prelude.Maybe [Prelude.Text])
bucket_readonlyAccessAccounts :: (Maybe [Text] -> f (Maybe [Text])) -> Bucket -> f Bucket
bucket_readonlyAccessAccounts = (Bucket -> Maybe [Text])
-> (Bucket -> Maybe [Text] -> Bucket)
-> Lens Bucket Bucket (Maybe [Text]) (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Bucket' {Maybe [Text]
readonlyAccessAccounts :: Maybe [Text]
$sel:readonlyAccessAccounts:Bucket' :: Bucket -> Maybe [Text]
readonlyAccessAccounts} -> Maybe [Text]
readonlyAccessAccounts) (\s :: Bucket
s@Bucket' {} Maybe [Text]
a -> Bucket
s {$sel:readonlyAccessAccounts:Bucket' :: Maybe [Text]
readonlyAccessAccounts = Maybe [Text]
a} :: Bucket) ((Maybe [Text] -> f (Maybe [Text])) -> Bucket -> f Bucket)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> Bucket
-> f Bucket
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [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 [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The URL of the bucket.
bucket_url :: Lens.Lens' Bucket (Prelude.Maybe Prelude.Text)
bucket_url :: (Maybe Text -> f (Maybe Text)) -> Bucket -> f Bucket
bucket_url = (Bucket -> Maybe Text)
-> (Bucket -> Maybe Text -> Bucket)
-> Lens Bucket Bucket (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Bucket' {Maybe Text
url :: Maybe Text
$sel:url:Bucket' :: Bucket -> Maybe Text
url} -> Maybe Text
url) (\s :: Bucket
s@Bucket' {} Maybe Text
a -> Bucket
s {$sel:url:Bucket' :: Maybe Text
url = Maybe Text
a} :: Bucket)

-- | An array of objects that describe Lightsail instances that have access
-- to the bucket.
--
-- Use the SetResourceAccessForBucket action to update the instances that
-- have access to a bucket.
bucket_resourcesReceivingAccess :: Lens.Lens' Bucket (Prelude.Maybe [ResourceReceivingAccess])
bucket_resourcesReceivingAccess :: (Maybe [ResourceReceivingAccess]
 -> f (Maybe [ResourceReceivingAccess]))
-> Bucket -> f Bucket
bucket_resourcesReceivingAccess = (Bucket -> Maybe [ResourceReceivingAccess])
-> (Bucket -> Maybe [ResourceReceivingAccess] -> Bucket)
-> Lens
     Bucket
     Bucket
     (Maybe [ResourceReceivingAccess])
     (Maybe [ResourceReceivingAccess])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Bucket' {Maybe [ResourceReceivingAccess]
resourcesReceivingAccess :: Maybe [ResourceReceivingAccess]
$sel:resourcesReceivingAccess:Bucket' :: Bucket -> Maybe [ResourceReceivingAccess]
resourcesReceivingAccess} -> Maybe [ResourceReceivingAccess]
resourcesReceivingAccess) (\s :: Bucket
s@Bucket' {} Maybe [ResourceReceivingAccess]
a -> Bucket
s {$sel:resourcesReceivingAccess:Bucket' :: Maybe [ResourceReceivingAccess]
resourcesReceivingAccess = Maybe [ResourceReceivingAccess]
a} :: Bucket) ((Maybe [ResourceReceivingAccess]
  -> f (Maybe [ResourceReceivingAccess]))
 -> Bucket -> f Bucket)
-> ((Maybe [ResourceReceivingAccess]
     -> f (Maybe [ResourceReceivingAccess]))
    -> Maybe [ResourceReceivingAccess]
    -> f (Maybe [ResourceReceivingAccess]))
-> (Maybe [ResourceReceivingAccess]
    -> f (Maybe [ResourceReceivingAccess]))
-> Bucket
-> f Bucket
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [ResourceReceivingAccess]
  [ResourceReceivingAccess]
  [ResourceReceivingAccess]
  [ResourceReceivingAccess]
-> Iso
     (Maybe [ResourceReceivingAccess])
     (Maybe [ResourceReceivingAccess])
     (Maybe [ResourceReceivingAccess])
     (Maybe [ResourceReceivingAccess])
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
  [ResourceReceivingAccess]
  [ResourceReceivingAccess]
  [ResourceReceivingAccess]
  [ResourceReceivingAccess]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The ID of the bundle currently applied to the bucket.
--
-- A bucket bundle specifies the monthly cost, storage space, and data
-- transfer quota for a bucket.
--
-- Use the UpdateBucketBundle action to change the bundle of a bucket.
bucket_bundleId :: Lens.Lens' Bucket (Prelude.Maybe Prelude.Text)
bucket_bundleId :: (Maybe Text -> f (Maybe Text)) -> Bucket -> f Bucket
bucket_bundleId = (Bucket -> Maybe Text)
-> (Bucket -> Maybe Text -> Bucket)
-> Lens Bucket Bucket (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Bucket' {Maybe Text
bundleId :: Maybe Text
$sel:bundleId:Bucket' :: Bucket -> Maybe Text
bundleId} -> Maybe Text
bundleId) (\s :: Bucket
s@Bucket' {} Maybe Text
a -> Bucket
s {$sel:bundleId:Bucket' :: Maybe Text
bundleId = Maybe Text
a} :: Bucket)

-- | An object that describes the access rules of the bucket.
bucket_accessRules :: Lens.Lens' Bucket (Prelude.Maybe AccessRules)
bucket_accessRules :: (Maybe AccessRules -> f (Maybe AccessRules)) -> Bucket -> f Bucket
bucket_accessRules = (Bucket -> Maybe AccessRules)
-> (Bucket -> Maybe AccessRules -> Bucket)
-> Lens Bucket Bucket (Maybe AccessRules) (Maybe AccessRules)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Bucket' {Maybe AccessRules
accessRules :: Maybe AccessRules
$sel:accessRules:Bucket' :: Bucket -> Maybe AccessRules
accessRules} -> Maybe AccessRules
accessRules) (\s :: Bucket
s@Bucket' {} Maybe AccessRules
a -> Bucket
s {$sel:accessRules:Bucket' :: Maybe AccessRules
accessRules = Maybe AccessRules
a} :: Bucket)

-- | Indicates whether the bundle that is currently applied to a bucket can
-- be changed to another bundle.
--
-- You can update a bucket\'s bundle only one time within a monthly AWS
-- billing cycle.
--
-- Use the UpdateBucketBundle action to change a bucket\'s bundle.
bucket_ableToUpdateBundle :: Lens.Lens' Bucket (Prelude.Maybe Prelude.Bool)
bucket_ableToUpdateBundle :: (Maybe Bool -> f (Maybe Bool)) -> Bucket -> f Bucket
bucket_ableToUpdateBundle = (Bucket -> Maybe Bool)
-> (Bucket -> Maybe Bool -> Bucket)
-> Lens Bucket Bucket (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Bucket' {Maybe Bool
ableToUpdateBundle :: Maybe Bool
$sel:ableToUpdateBundle:Bucket' :: Bucket -> Maybe Bool
ableToUpdateBundle} -> Maybe Bool
ableToUpdateBundle) (\s :: Bucket
s@Bucket' {} Maybe Bool
a -> Bucket
s {$sel:ableToUpdateBundle:Bucket' :: Maybe Bool
ableToUpdateBundle = Maybe Bool
a} :: Bucket)

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

-- | The support code for a bucket. Include this code in your email to
-- support when you have questions about a Lightsail bucket. This code
-- enables our support team to look up your Lightsail information more
-- easily.
bucket_supportCode :: Lens.Lens' Bucket (Prelude.Maybe Prelude.Text)
bucket_supportCode :: (Maybe Text -> f (Maybe Text)) -> Bucket -> f Bucket
bucket_supportCode = (Bucket -> Maybe Text)
-> (Bucket -> Maybe Text -> Bucket)
-> Lens Bucket Bucket (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Bucket' {Maybe Text
supportCode :: Maybe Text
$sel:supportCode:Bucket' :: Bucket -> Maybe Text
supportCode} -> Maybe Text
supportCode) (\s :: Bucket
s@Bucket' {} Maybe Text
a -> Bucket
s {$sel:supportCode:Bucket' :: Maybe Text
supportCode = Maybe Text
a} :: Bucket)

-- | The tag keys and optional values for the bucket. For more information,
-- see
-- <https://lightsail.aws.amazon.com/ls/docs/en/articles/amazon-lightsail-tags Tags in Amazon Lightsail>
-- in the /Amazon Lightsail Developer Guide/.
bucket_tags :: Lens.Lens' Bucket (Prelude.Maybe [Tag])
bucket_tags :: (Maybe [Tag] -> f (Maybe [Tag])) -> Bucket -> f Bucket
bucket_tags = (Bucket -> Maybe [Tag])
-> (Bucket -> Maybe [Tag] -> Bucket)
-> Lens Bucket Bucket (Maybe [Tag]) (Maybe [Tag])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Bucket' {Maybe [Tag]
tags :: Maybe [Tag]
$sel:tags:Bucket' :: Bucket -> Maybe [Tag]
tags} -> Maybe [Tag]
tags) (\s :: Bucket
s@Bucket' {} Maybe [Tag]
a -> Bucket
s {$sel:tags:Bucket' :: Maybe [Tag]
tags = Maybe [Tag]
a} :: Bucket) ((Maybe [Tag] -> f (Maybe [Tag])) -> Bucket -> f Bucket)
-> ((Maybe [Tag] -> f (Maybe [Tag]))
    -> Maybe [Tag] -> f (Maybe [Tag]))
-> (Maybe [Tag] -> f (Maybe [Tag]))
-> Bucket
-> f Bucket
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Tag] [Tag] [Tag] [Tag]
-> Iso (Maybe [Tag]) (Maybe [Tag]) (Maybe [Tag]) (Maybe [Tag])
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 [Tag] [Tag] [Tag] [Tag]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.FromJSON Bucket where
  parseJSON :: Value -> Parser Bucket
parseJSON =
    String -> (Object -> Parser Bucket) -> Value -> Parser Bucket
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"Bucket"
      ( \Object
x ->
          Maybe BucketState
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe POSIX
-> Maybe ResourceLocation
-> Maybe [Text]
-> Maybe Text
-> Maybe [ResourceReceivingAccess]
-> Maybe Text
-> Maybe AccessRules
-> Maybe Bool
-> Maybe Text
-> Maybe Text
-> Maybe [Tag]
-> Bucket
Bucket'
            (Maybe BucketState
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe POSIX
 -> Maybe ResourceLocation
 -> Maybe [Text]
 -> Maybe Text
 -> Maybe [ResourceReceivingAccess]
 -> Maybe Text
 -> Maybe AccessRules
 -> Maybe Bool
 -> Maybe Text
 -> Maybe Text
 -> Maybe [Tag]
 -> Bucket)
-> Parser (Maybe BucketState)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe POSIX
      -> Maybe ResourceLocation
      -> Maybe [Text]
      -> Maybe Text
      -> Maybe [ResourceReceivingAccess]
      -> Maybe Text
      -> Maybe AccessRules
      -> Maybe Bool
      -> Maybe Text
      -> Maybe Text
      -> Maybe [Tag]
      -> Bucket)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe BucketState)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"state")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe POSIX
   -> Maybe ResourceLocation
   -> Maybe [Text]
   -> Maybe Text
   -> Maybe [ResourceReceivingAccess]
   -> Maybe Text
   -> Maybe AccessRules
   -> Maybe Bool
   -> Maybe Text
   -> Maybe Text
   -> Maybe [Tag]
   -> Bucket)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe POSIX
      -> Maybe ResourceLocation
      -> Maybe [Text]
      -> Maybe Text
      -> Maybe [ResourceReceivingAccess]
      -> Maybe Text
      -> Maybe AccessRules
      -> Maybe Bool
      -> Maybe Text
      -> Maybe Text
      -> Maybe [Tag]
      -> Bucket)
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
"objectVersioning")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe POSIX
   -> Maybe ResourceLocation
   -> Maybe [Text]
   -> Maybe Text
   -> Maybe [ResourceReceivingAccess]
   -> Maybe Text
   -> Maybe AccessRules
   -> Maybe Bool
   -> Maybe Text
   -> Maybe Text
   -> Maybe [Tag]
   -> Bucket)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe POSIX
      -> Maybe ResourceLocation
      -> Maybe [Text]
      -> Maybe Text
      -> Maybe [ResourceReceivingAccess]
      -> Maybe Text
      -> Maybe AccessRules
      -> Maybe Bool
      -> Maybe Text
      -> Maybe Text
      -> Maybe [Tag]
      -> Bucket)
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
"resourceType")
            Parser
  (Maybe Text
   -> Maybe POSIX
   -> Maybe ResourceLocation
   -> Maybe [Text]
   -> Maybe Text
   -> Maybe [ResourceReceivingAccess]
   -> Maybe Text
   -> Maybe AccessRules
   -> Maybe Bool
   -> Maybe Text
   -> Maybe Text
   -> Maybe [Tag]
   -> Bucket)
-> Parser (Maybe Text)
-> Parser
     (Maybe POSIX
      -> Maybe ResourceLocation
      -> Maybe [Text]
      -> Maybe Text
      -> Maybe [ResourceReceivingAccess]
      -> Maybe Text
      -> Maybe AccessRules
      -> Maybe Bool
      -> Maybe Text
      -> Maybe Text
      -> Maybe [Tag]
      -> Bucket)
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 POSIX
   -> Maybe ResourceLocation
   -> Maybe [Text]
   -> Maybe Text
   -> Maybe [ResourceReceivingAccess]
   -> Maybe Text
   -> Maybe AccessRules
   -> Maybe Bool
   -> Maybe Text
   -> Maybe Text
   -> Maybe [Tag]
   -> Bucket)
-> Parser (Maybe POSIX)
-> Parser
     (Maybe ResourceLocation
      -> Maybe [Text]
      -> Maybe Text
      -> Maybe [ResourceReceivingAccess]
      -> Maybe Text
      -> Maybe AccessRules
      -> Maybe Bool
      -> Maybe Text
      -> Maybe Text
      -> Maybe [Tag]
      -> Bucket)
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 ResourceLocation
   -> Maybe [Text]
   -> Maybe Text
   -> Maybe [ResourceReceivingAccess]
   -> Maybe Text
   -> Maybe AccessRules
   -> Maybe Bool
   -> Maybe Text
   -> Maybe Text
   -> Maybe [Tag]
   -> Bucket)
-> Parser (Maybe ResourceLocation)
-> Parser
     (Maybe [Text]
      -> Maybe Text
      -> Maybe [ResourceReceivingAccess]
      -> Maybe Text
      -> Maybe AccessRules
      -> Maybe Bool
      -> Maybe Text
      -> Maybe Text
      -> Maybe [Tag]
      -> Bucket)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe ResourceLocation)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"location")
            Parser
  (Maybe [Text]
   -> Maybe Text
   -> Maybe [ResourceReceivingAccess]
   -> Maybe Text
   -> Maybe AccessRules
   -> Maybe Bool
   -> Maybe Text
   -> Maybe Text
   -> Maybe [Tag]
   -> Bucket)
-> Parser (Maybe [Text])
-> Parser
     (Maybe Text
      -> Maybe [ResourceReceivingAccess]
      -> Maybe Text
      -> Maybe AccessRules
      -> Maybe Bool
      -> Maybe Text
      -> Maybe Text
      -> Maybe [Tag]
      -> Bucket)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object -> Text -> Parser (Maybe (Maybe [Text]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"readonlyAccessAccounts"
                            Parser (Maybe (Maybe [Text]))
-> Maybe [Text] -> Parser (Maybe [Text])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [Text]
forall a. Monoid a => a
Prelude.mempty
                        )
            Parser
  (Maybe Text
   -> Maybe [ResourceReceivingAccess]
   -> Maybe Text
   -> Maybe AccessRules
   -> Maybe Bool
   -> Maybe Text
   -> Maybe Text
   -> Maybe [Tag]
   -> Bucket)
-> Parser (Maybe Text)
-> Parser
     (Maybe [ResourceReceivingAccess]
      -> Maybe Text
      -> Maybe AccessRules
      -> Maybe Bool
      -> Maybe Text
      -> Maybe Text
      -> Maybe [Tag]
      -> Bucket)
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
"url")
            Parser
  (Maybe [ResourceReceivingAccess]
   -> Maybe Text
   -> Maybe AccessRules
   -> Maybe Bool
   -> Maybe Text
   -> Maybe Text
   -> Maybe [Tag]
   -> Bucket)
-> Parser (Maybe [ResourceReceivingAccess])
-> Parser
     (Maybe Text
      -> Maybe AccessRules
      -> Maybe Bool
      -> Maybe Text
      -> Maybe Text
      -> Maybe [Tag]
      -> Bucket)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object -> Text -> Parser (Maybe (Maybe [ResourceReceivingAccess]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"resourcesReceivingAccess"
                            Parser (Maybe (Maybe [ResourceReceivingAccess]))
-> Maybe [ResourceReceivingAccess]
-> Parser (Maybe [ResourceReceivingAccess])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [ResourceReceivingAccess]
forall a. Monoid a => a
Prelude.mempty
                        )
            Parser
  (Maybe Text
   -> Maybe AccessRules
   -> Maybe Bool
   -> Maybe Text
   -> Maybe Text
   -> Maybe [Tag]
   -> Bucket)
-> Parser (Maybe Text)
-> Parser
     (Maybe AccessRules
      -> Maybe Bool -> Maybe Text -> Maybe Text -> Maybe [Tag] -> Bucket)
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
"bundleId")
            Parser
  (Maybe AccessRules
   -> Maybe Bool -> Maybe Text -> Maybe Text -> Maybe [Tag] -> Bucket)
-> Parser (Maybe AccessRules)
-> Parser
     (Maybe Bool -> Maybe Text -> Maybe Text -> Maybe [Tag] -> Bucket)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe AccessRules)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"accessRules")
            Parser
  (Maybe Bool -> Maybe Text -> Maybe Text -> Maybe [Tag] -> Bucket)
-> Parser (Maybe Bool)
-> Parser (Maybe Text -> Maybe Text -> Maybe [Tag] -> Bucket)
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
"ableToUpdateBundle")
            Parser (Maybe Text -> Maybe Text -> Maybe [Tag] -> Bucket)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe [Tag] -> Bucket)
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 -> Maybe [Tag] -> Bucket)
-> Parser (Maybe Text) -> Parser (Maybe [Tag] -> Bucket)
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
"supportCode")
            Parser (Maybe [Tag] -> Bucket)
-> Parser (Maybe [Tag]) -> Parser Bucket
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe [Tag]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"tags" Parser (Maybe (Maybe [Tag])) -> Maybe [Tag] -> Parser (Maybe [Tag])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [Tag]
forall a. Monoid a => a
Prelude.mempty)
      )

instance Prelude.Hashable Bucket

instance Prelude.NFData Bucket