{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}
module Amazonka.S3.GetBucketLifecycleConfiguration
(
GetBucketLifecycleConfiguration (..),
newGetBucketLifecycleConfiguration,
getBucketLifecycleConfiguration_expectedBucketOwner,
getBucketLifecycleConfiguration_bucket,
GetBucketLifecycleConfigurationResponse (..),
newGetBucketLifecycleConfigurationResponse,
getBucketLifecycleConfigurationResponse_rules,
getBucketLifecycleConfigurationResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
import Amazonka.S3.Types
data GetBucketLifecycleConfiguration = GetBucketLifecycleConfiguration'
{
GetBucketLifecycleConfiguration -> Maybe Text
expectedBucketOwner :: Prelude.Maybe Prelude.Text,
GetBucketLifecycleConfiguration -> BucketName
bucket :: BucketName
}
deriving (GetBucketLifecycleConfiguration
-> GetBucketLifecycleConfiguration -> Bool
(GetBucketLifecycleConfiguration
-> GetBucketLifecycleConfiguration -> Bool)
-> (GetBucketLifecycleConfiguration
-> GetBucketLifecycleConfiguration -> Bool)
-> Eq GetBucketLifecycleConfiguration
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetBucketLifecycleConfiguration
-> GetBucketLifecycleConfiguration -> Bool
$c/= :: GetBucketLifecycleConfiguration
-> GetBucketLifecycleConfiguration -> Bool
== :: GetBucketLifecycleConfiguration
-> GetBucketLifecycleConfiguration -> Bool
$c== :: GetBucketLifecycleConfiguration
-> GetBucketLifecycleConfiguration -> Bool
Prelude.Eq, ReadPrec [GetBucketLifecycleConfiguration]
ReadPrec GetBucketLifecycleConfiguration
Int -> ReadS GetBucketLifecycleConfiguration
ReadS [GetBucketLifecycleConfiguration]
(Int -> ReadS GetBucketLifecycleConfiguration)
-> ReadS [GetBucketLifecycleConfiguration]
-> ReadPrec GetBucketLifecycleConfiguration
-> ReadPrec [GetBucketLifecycleConfiguration]
-> Read GetBucketLifecycleConfiguration
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetBucketLifecycleConfiguration]
$creadListPrec :: ReadPrec [GetBucketLifecycleConfiguration]
readPrec :: ReadPrec GetBucketLifecycleConfiguration
$creadPrec :: ReadPrec GetBucketLifecycleConfiguration
readList :: ReadS [GetBucketLifecycleConfiguration]
$creadList :: ReadS [GetBucketLifecycleConfiguration]
readsPrec :: Int -> ReadS GetBucketLifecycleConfiguration
$creadsPrec :: Int -> ReadS GetBucketLifecycleConfiguration
Prelude.Read, Int -> GetBucketLifecycleConfiguration -> ShowS
[GetBucketLifecycleConfiguration] -> ShowS
GetBucketLifecycleConfiguration -> String
(Int -> GetBucketLifecycleConfiguration -> ShowS)
-> (GetBucketLifecycleConfiguration -> String)
-> ([GetBucketLifecycleConfiguration] -> ShowS)
-> Show GetBucketLifecycleConfiguration
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetBucketLifecycleConfiguration] -> ShowS
$cshowList :: [GetBucketLifecycleConfiguration] -> ShowS
show :: GetBucketLifecycleConfiguration -> String
$cshow :: GetBucketLifecycleConfiguration -> String
showsPrec :: Int -> GetBucketLifecycleConfiguration -> ShowS
$cshowsPrec :: Int -> GetBucketLifecycleConfiguration -> ShowS
Prelude.Show, (forall x.
GetBucketLifecycleConfiguration
-> Rep GetBucketLifecycleConfiguration x)
-> (forall x.
Rep GetBucketLifecycleConfiguration x
-> GetBucketLifecycleConfiguration)
-> Generic GetBucketLifecycleConfiguration
forall x.
Rep GetBucketLifecycleConfiguration x
-> GetBucketLifecycleConfiguration
forall x.
GetBucketLifecycleConfiguration
-> Rep GetBucketLifecycleConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetBucketLifecycleConfiguration x
-> GetBucketLifecycleConfiguration
$cfrom :: forall x.
GetBucketLifecycleConfiguration
-> Rep GetBucketLifecycleConfiguration x
Prelude.Generic)
newGetBucketLifecycleConfiguration ::
BucketName ->
GetBucketLifecycleConfiguration
newGetBucketLifecycleConfiguration :: BucketName -> GetBucketLifecycleConfiguration
newGetBucketLifecycleConfiguration BucketName
pBucket_ =
GetBucketLifecycleConfiguration' :: Maybe Text -> BucketName -> GetBucketLifecycleConfiguration
GetBucketLifecycleConfiguration'
{ $sel:expectedBucketOwner:GetBucketLifecycleConfiguration' :: Maybe Text
expectedBucketOwner =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:bucket:GetBucketLifecycleConfiguration' :: BucketName
bucket = BucketName
pBucket_
}
getBucketLifecycleConfiguration_expectedBucketOwner :: Lens.Lens' GetBucketLifecycleConfiguration (Prelude.Maybe Prelude.Text)
getBucketLifecycleConfiguration_expectedBucketOwner :: (Maybe Text -> f (Maybe Text))
-> GetBucketLifecycleConfiguration
-> f GetBucketLifecycleConfiguration
getBucketLifecycleConfiguration_expectedBucketOwner = (GetBucketLifecycleConfiguration -> Maybe Text)
-> (GetBucketLifecycleConfiguration
-> Maybe Text -> GetBucketLifecycleConfiguration)
-> Lens
GetBucketLifecycleConfiguration
GetBucketLifecycleConfiguration
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetBucketLifecycleConfiguration' {Maybe Text
expectedBucketOwner :: Maybe Text
$sel:expectedBucketOwner:GetBucketLifecycleConfiguration' :: GetBucketLifecycleConfiguration -> Maybe Text
expectedBucketOwner} -> Maybe Text
expectedBucketOwner) (\s :: GetBucketLifecycleConfiguration
s@GetBucketLifecycleConfiguration' {} Maybe Text
a -> GetBucketLifecycleConfiguration
s {$sel:expectedBucketOwner:GetBucketLifecycleConfiguration' :: Maybe Text
expectedBucketOwner = Maybe Text
a} :: GetBucketLifecycleConfiguration)
getBucketLifecycleConfiguration_bucket :: Lens.Lens' GetBucketLifecycleConfiguration BucketName
getBucketLifecycleConfiguration_bucket :: (BucketName -> f BucketName)
-> GetBucketLifecycleConfiguration
-> f GetBucketLifecycleConfiguration
getBucketLifecycleConfiguration_bucket = (GetBucketLifecycleConfiguration -> BucketName)
-> (GetBucketLifecycleConfiguration
-> BucketName -> GetBucketLifecycleConfiguration)
-> Lens
GetBucketLifecycleConfiguration
GetBucketLifecycleConfiguration
BucketName
BucketName
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetBucketLifecycleConfiguration' {BucketName
bucket :: BucketName
$sel:bucket:GetBucketLifecycleConfiguration' :: GetBucketLifecycleConfiguration -> BucketName
bucket} -> BucketName
bucket) (\s :: GetBucketLifecycleConfiguration
s@GetBucketLifecycleConfiguration' {} BucketName
a -> GetBucketLifecycleConfiguration
s {$sel:bucket:GetBucketLifecycleConfiguration' :: BucketName
bucket = BucketName
a} :: GetBucketLifecycleConfiguration)
instance
Core.AWSRequest
GetBucketLifecycleConfiguration
where
type
AWSResponse GetBucketLifecycleConfiguration =
GetBucketLifecycleConfigurationResponse
request :: GetBucketLifecycleConfiguration
-> Request GetBucketLifecycleConfiguration
request =
Request GetBucketLifecycleConfiguration
-> Request GetBucketLifecycleConfiguration
forall a. Request a -> Request a
Request.s3vhost
(Request GetBucketLifecycleConfiguration
-> Request GetBucketLifecycleConfiguration)
-> (GetBucketLifecycleConfiguration
-> Request GetBucketLifecycleConfiguration)
-> GetBucketLifecycleConfiguration
-> Request GetBucketLifecycleConfiguration
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. Service
-> GetBucketLifecycleConfiguration
-> Request GetBucketLifecycleConfiguration
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
response :: Logger
-> Service
-> Proxy GetBucketLifecycleConfiguration
-> ClientResponse ClientBody
-> m (Either
Error
(ClientResponse (AWSResponse GetBucketLifecycleConfiguration)))
response =
(Int
-> ResponseHeaders
-> [Node]
-> Either String (AWSResponse GetBucketLifecycleConfiguration))
-> Logger
-> Service
-> Proxy GetBucketLifecycleConfiguration
-> ClientResponse ClientBody
-> m (Either
Error
(ClientResponse (AWSResponse GetBucketLifecycleConfiguration)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> [Node] -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveXML
( \Int
s ResponseHeaders
h [Node]
x ->
Maybe [LifecycleRule]
-> Int -> GetBucketLifecycleConfigurationResponse
GetBucketLifecycleConfigurationResponse'
(Maybe [LifecycleRule]
-> Int -> GetBucketLifecycleConfigurationResponse)
-> Either String (Maybe [LifecycleRule])
-> Either String (Int -> GetBucketLifecycleConfigurationResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (([Node] -> Either String [LifecycleRule])
-> [Node] -> Either String (Maybe [LifecycleRule])
forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (Text -> [Node] -> Either String [LifecycleRule]
forall a. FromXML a => Text -> [Node] -> Either String [a]
Core.parseXMLList Text
"Rule") [Node]
x)
Either String (Int -> GetBucketLifecycleConfigurationResponse)
-> Either String Int
-> Either String GetBucketLifecycleConfigurationResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance
Prelude.Hashable
GetBucketLifecycleConfiguration
instance
Prelude.NFData
GetBucketLifecycleConfiguration
instance
Core.ToHeaders
GetBucketLifecycleConfiguration
where
toHeaders :: GetBucketLifecycleConfiguration -> ResponseHeaders
toHeaders GetBucketLifecycleConfiguration' {Maybe Text
BucketName
bucket :: BucketName
expectedBucketOwner :: Maybe Text
$sel:bucket:GetBucketLifecycleConfiguration' :: GetBucketLifecycleConfiguration -> BucketName
$sel:expectedBucketOwner:GetBucketLifecycleConfiguration' :: GetBucketLifecycleConfiguration -> Maybe Text
..} =
[ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"x-amz-expected-bucket-owner"
HeaderName -> Maybe Text -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# Maybe Text
expectedBucketOwner
]
instance Core.ToPath GetBucketLifecycleConfiguration where
toPath :: GetBucketLifecycleConfiguration -> ByteString
toPath GetBucketLifecycleConfiguration' {Maybe Text
BucketName
bucket :: BucketName
expectedBucketOwner :: Maybe Text
$sel:bucket:GetBucketLifecycleConfiguration' :: GetBucketLifecycleConfiguration -> BucketName
$sel:expectedBucketOwner:GetBucketLifecycleConfiguration' :: GetBucketLifecycleConfiguration -> Maybe Text
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat [ByteString
"/", BucketName -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS BucketName
bucket]
instance Core.ToQuery GetBucketLifecycleConfiguration where
toQuery :: GetBucketLifecycleConfiguration -> QueryString
toQuery =
QueryString -> GetBucketLifecycleConfiguration -> QueryString
forall a b. a -> b -> a
Prelude.const ([QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat [QueryString
"lifecycle"])
data GetBucketLifecycleConfigurationResponse = GetBucketLifecycleConfigurationResponse'
{
GetBucketLifecycleConfigurationResponse -> Maybe [LifecycleRule]
rules :: Prelude.Maybe [LifecycleRule],
GetBucketLifecycleConfigurationResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetBucketLifecycleConfigurationResponse
-> GetBucketLifecycleConfigurationResponse -> Bool
(GetBucketLifecycleConfigurationResponse
-> GetBucketLifecycleConfigurationResponse -> Bool)
-> (GetBucketLifecycleConfigurationResponse
-> GetBucketLifecycleConfigurationResponse -> Bool)
-> Eq GetBucketLifecycleConfigurationResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetBucketLifecycleConfigurationResponse
-> GetBucketLifecycleConfigurationResponse -> Bool
$c/= :: GetBucketLifecycleConfigurationResponse
-> GetBucketLifecycleConfigurationResponse -> Bool
== :: GetBucketLifecycleConfigurationResponse
-> GetBucketLifecycleConfigurationResponse -> Bool
$c== :: GetBucketLifecycleConfigurationResponse
-> GetBucketLifecycleConfigurationResponse -> Bool
Prelude.Eq, ReadPrec [GetBucketLifecycleConfigurationResponse]
ReadPrec GetBucketLifecycleConfigurationResponse
Int -> ReadS GetBucketLifecycleConfigurationResponse
ReadS [GetBucketLifecycleConfigurationResponse]
(Int -> ReadS GetBucketLifecycleConfigurationResponse)
-> ReadS [GetBucketLifecycleConfigurationResponse]
-> ReadPrec GetBucketLifecycleConfigurationResponse
-> ReadPrec [GetBucketLifecycleConfigurationResponse]
-> Read GetBucketLifecycleConfigurationResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetBucketLifecycleConfigurationResponse]
$creadListPrec :: ReadPrec [GetBucketLifecycleConfigurationResponse]
readPrec :: ReadPrec GetBucketLifecycleConfigurationResponse
$creadPrec :: ReadPrec GetBucketLifecycleConfigurationResponse
readList :: ReadS [GetBucketLifecycleConfigurationResponse]
$creadList :: ReadS [GetBucketLifecycleConfigurationResponse]
readsPrec :: Int -> ReadS GetBucketLifecycleConfigurationResponse
$creadsPrec :: Int -> ReadS GetBucketLifecycleConfigurationResponse
Prelude.Read, Int -> GetBucketLifecycleConfigurationResponse -> ShowS
[GetBucketLifecycleConfigurationResponse] -> ShowS
GetBucketLifecycleConfigurationResponse -> String
(Int -> GetBucketLifecycleConfigurationResponse -> ShowS)
-> (GetBucketLifecycleConfigurationResponse -> String)
-> ([GetBucketLifecycleConfigurationResponse] -> ShowS)
-> Show GetBucketLifecycleConfigurationResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetBucketLifecycleConfigurationResponse] -> ShowS
$cshowList :: [GetBucketLifecycleConfigurationResponse] -> ShowS
show :: GetBucketLifecycleConfigurationResponse -> String
$cshow :: GetBucketLifecycleConfigurationResponse -> String
showsPrec :: Int -> GetBucketLifecycleConfigurationResponse -> ShowS
$cshowsPrec :: Int -> GetBucketLifecycleConfigurationResponse -> ShowS
Prelude.Show, (forall x.
GetBucketLifecycleConfigurationResponse
-> Rep GetBucketLifecycleConfigurationResponse x)
-> (forall x.
Rep GetBucketLifecycleConfigurationResponse x
-> GetBucketLifecycleConfigurationResponse)
-> Generic GetBucketLifecycleConfigurationResponse
forall x.
Rep GetBucketLifecycleConfigurationResponse x
-> GetBucketLifecycleConfigurationResponse
forall x.
GetBucketLifecycleConfigurationResponse
-> Rep GetBucketLifecycleConfigurationResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetBucketLifecycleConfigurationResponse x
-> GetBucketLifecycleConfigurationResponse
$cfrom :: forall x.
GetBucketLifecycleConfigurationResponse
-> Rep GetBucketLifecycleConfigurationResponse x
Prelude.Generic)
newGetBucketLifecycleConfigurationResponse ::
Prelude.Int ->
GetBucketLifecycleConfigurationResponse
newGetBucketLifecycleConfigurationResponse :: Int -> GetBucketLifecycleConfigurationResponse
newGetBucketLifecycleConfigurationResponse
Int
pHttpStatus_ =
GetBucketLifecycleConfigurationResponse' :: Maybe [LifecycleRule]
-> Int -> GetBucketLifecycleConfigurationResponse
GetBucketLifecycleConfigurationResponse'
{ $sel:rules:GetBucketLifecycleConfigurationResponse' :: Maybe [LifecycleRule]
rules =
Maybe [LifecycleRule]
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetBucketLifecycleConfigurationResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getBucketLifecycleConfigurationResponse_rules :: Lens.Lens' GetBucketLifecycleConfigurationResponse (Prelude.Maybe [LifecycleRule])
getBucketLifecycleConfigurationResponse_rules :: (Maybe [LifecycleRule] -> f (Maybe [LifecycleRule]))
-> GetBucketLifecycleConfigurationResponse
-> f GetBucketLifecycleConfigurationResponse
getBucketLifecycleConfigurationResponse_rules = (GetBucketLifecycleConfigurationResponse -> Maybe [LifecycleRule])
-> (GetBucketLifecycleConfigurationResponse
-> Maybe [LifecycleRule]
-> GetBucketLifecycleConfigurationResponse)
-> Lens
GetBucketLifecycleConfigurationResponse
GetBucketLifecycleConfigurationResponse
(Maybe [LifecycleRule])
(Maybe [LifecycleRule])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetBucketLifecycleConfigurationResponse' {Maybe [LifecycleRule]
rules :: Maybe [LifecycleRule]
$sel:rules:GetBucketLifecycleConfigurationResponse' :: GetBucketLifecycleConfigurationResponse -> Maybe [LifecycleRule]
rules} -> Maybe [LifecycleRule]
rules) (\s :: GetBucketLifecycleConfigurationResponse
s@GetBucketLifecycleConfigurationResponse' {} Maybe [LifecycleRule]
a -> GetBucketLifecycleConfigurationResponse
s {$sel:rules:GetBucketLifecycleConfigurationResponse' :: Maybe [LifecycleRule]
rules = Maybe [LifecycleRule]
a} :: GetBucketLifecycleConfigurationResponse) ((Maybe [LifecycleRule] -> f (Maybe [LifecycleRule]))
-> GetBucketLifecycleConfigurationResponse
-> f GetBucketLifecycleConfigurationResponse)
-> ((Maybe [LifecycleRule] -> f (Maybe [LifecycleRule]))
-> Maybe [LifecycleRule] -> f (Maybe [LifecycleRule]))
-> (Maybe [LifecycleRule] -> f (Maybe [LifecycleRule]))
-> GetBucketLifecycleConfigurationResponse
-> f GetBucketLifecycleConfigurationResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
[LifecycleRule] [LifecycleRule] [LifecycleRule] [LifecycleRule]
-> Iso
(Maybe [LifecycleRule])
(Maybe [LifecycleRule])
(Maybe [LifecycleRule])
(Maybe [LifecycleRule])
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
[LifecycleRule] [LifecycleRule] [LifecycleRule] [LifecycleRule]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
getBucketLifecycleConfigurationResponse_httpStatus :: Lens.Lens' GetBucketLifecycleConfigurationResponse Prelude.Int
getBucketLifecycleConfigurationResponse_httpStatus :: (Int -> f Int)
-> GetBucketLifecycleConfigurationResponse
-> f GetBucketLifecycleConfigurationResponse
getBucketLifecycleConfigurationResponse_httpStatus = (GetBucketLifecycleConfigurationResponse -> Int)
-> (GetBucketLifecycleConfigurationResponse
-> Int -> GetBucketLifecycleConfigurationResponse)
-> Lens
GetBucketLifecycleConfigurationResponse
GetBucketLifecycleConfigurationResponse
Int
Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetBucketLifecycleConfigurationResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetBucketLifecycleConfigurationResponse' :: GetBucketLifecycleConfigurationResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetBucketLifecycleConfigurationResponse
s@GetBucketLifecycleConfigurationResponse' {} Int
a -> GetBucketLifecycleConfigurationResponse
s {$sel:httpStatus:GetBucketLifecycleConfigurationResponse' :: Int
httpStatus = Int
a} :: GetBucketLifecycleConfigurationResponse)
instance
Prelude.NFData
GetBucketLifecycleConfigurationResponse