{-# 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.GetObjectLockConfiguration
(
GetObjectLockConfiguration (..),
newGetObjectLockConfiguration,
getObjectLockConfiguration_expectedBucketOwner,
getObjectLockConfiguration_bucket,
GetObjectLockConfigurationResponse (..),
newGetObjectLockConfigurationResponse,
getObjectLockConfigurationResponse_objectLockConfiguration,
getObjectLockConfigurationResponse_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 GetObjectLockConfiguration = GetObjectLockConfiguration'
{
GetObjectLockConfiguration -> Maybe Text
expectedBucketOwner :: Prelude.Maybe Prelude.Text,
GetObjectLockConfiguration -> BucketName
bucket :: BucketName
}
deriving (GetObjectLockConfiguration -> GetObjectLockConfiguration -> Bool
(GetObjectLockConfiguration -> GetObjectLockConfiguration -> Bool)
-> (GetObjectLockConfiguration
-> GetObjectLockConfiguration -> Bool)
-> Eq GetObjectLockConfiguration
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetObjectLockConfiguration -> GetObjectLockConfiguration -> Bool
$c/= :: GetObjectLockConfiguration -> GetObjectLockConfiguration -> Bool
== :: GetObjectLockConfiguration -> GetObjectLockConfiguration -> Bool
$c== :: GetObjectLockConfiguration -> GetObjectLockConfiguration -> Bool
Prelude.Eq, ReadPrec [GetObjectLockConfiguration]
ReadPrec GetObjectLockConfiguration
Int -> ReadS GetObjectLockConfiguration
ReadS [GetObjectLockConfiguration]
(Int -> ReadS GetObjectLockConfiguration)
-> ReadS [GetObjectLockConfiguration]
-> ReadPrec GetObjectLockConfiguration
-> ReadPrec [GetObjectLockConfiguration]
-> Read GetObjectLockConfiguration
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetObjectLockConfiguration]
$creadListPrec :: ReadPrec [GetObjectLockConfiguration]
readPrec :: ReadPrec GetObjectLockConfiguration
$creadPrec :: ReadPrec GetObjectLockConfiguration
readList :: ReadS [GetObjectLockConfiguration]
$creadList :: ReadS [GetObjectLockConfiguration]
readsPrec :: Int -> ReadS GetObjectLockConfiguration
$creadsPrec :: Int -> ReadS GetObjectLockConfiguration
Prelude.Read, Int -> GetObjectLockConfiguration -> ShowS
[GetObjectLockConfiguration] -> ShowS
GetObjectLockConfiguration -> String
(Int -> GetObjectLockConfiguration -> ShowS)
-> (GetObjectLockConfiguration -> String)
-> ([GetObjectLockConfiguration] -> ShowS)
-> Show GetObjectLockConfiguration
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetObjectLockConfiguration] -> ShowS
$cshowList :: [GetObjectLockConfiguration] -> ShowS
show :: GetObjectLockConfiguration -> String
$cshow :: GetObjectLockConfiguration -> String
showsPrec :: Int -> GetObjectLockConfiguration -> ShowS
$cshowsPrec :: Int -> GetObjectLockConfiguration -> ShowS
Prelude.Show, (forall x.
GetObjectLockConfiguration -> Rep GetObjectLockConfiguration x)
-> (forall x.
Rep GetObjectLockConfiguration x -> GetObjectLockConfiguration)
-> Generic GetObjectLockConfiguration
forall x.
Rep GetObjectLockConfiguration x -> GetObjectLockConfiguration
forall x.
GetObjectLockConfiguration -> Rep GetObjectLockConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetObjectLockConfiguration x -> GetObjectLockConfiguration
$cfrom :: forall x.
GetObjectLockConfiguration -> Rep GetObjectLockConfiguration x
Prelude.Generic)
newGetObjectLockConfiguration ::
BucketName ->
GetObjectLockConfiguration
newGetObjectLockConfiguration :: BucketName -> GetObjectLockConfiguration
newGetObjectLockConfiguration BucketName
pBucket_ =
GetObjectLockConfiguration' :: Maybe Text -> BucketName -> GetObjectLockConfiguration
GetObjectLockConfiguration'
{ $sel:expectedBucketOwner:GetObjectLockConfiguration' :: Maybe Text
expectedBucketOwner =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:bucket:GetObjectLockConfiguration' :: BucketName
bucket = BucketName
pBucket_
}
getObjectLockConfiguration_expectedBucketOwner :: Lens.Lens' GetObjectLockConfiguration (Prelude.Maybe Prelude.Text)
getObjectLockConfiguration_expectedBucketOwner :: (Maybe Text -> f (Maybe Text))
-> GetObjectLockConfiguration -> f GetObjectLockConfiguration
getObjectLockConfiguration_expectedBucketOwner = (GetObjectLockConfiguration -> Maybe Text)
-> (GetObjectLockConfiguration
-> Maybe Text -> GetObjectLockConfiguration)
-> Lens
GetObjectLockConfiguration
GetObjectLockConfiguration
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetObjectLockConfiguration' {Maybe Text
expectedBucketOwner :: Maybe Text
$sel:expectedBucketOwner:GetObjectLockConfiguration' :: GetObjectLockConfiguration -> Maybe Text
expectedBucketOwner} -> Maybe Text
expectedBucketOwner) (\s :: GetObjectLockConfiguration
s@GetObjectLockConfiguration' {} Maybe Text
a -> GetObjectLockConfiguration
s {$sel:expectedBucketOwner:GetObjectLockConfiguration' :: Maybe Text
expectedBucketOwner = Maybe Text
a} :: GetObjectLockConfiguration)
getObjectLockConfiguration_bucket :: Lens.Lens' GetObjectLockConfiguration BucketName
getObjectLockConfiguration_bucket :: (BucketName -> f BucketName)
-> GetObjectLockConfiguration -> f GetObjectLockConfiguration
getObjectLockConfiguration_bucket = (GetObjectLockConfiguration -> BucketName)
-> (GetObjectLockConfiguration
-> BucketName -> GetObjectLockConfiguration)
-> Lens
GetObjectLockConfiguration
GetObjectLockConfiguration
BucketName
BucketName
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetObjectLockConfiguration' {BucketName
bucket :: BucketName
$sel:bucket:GetObjectLockConfiguration' :: GetObjectLockConfiguration -> BucketName
bucket} -> BucketName
bucket) (\s :: GetObjectLockConfiguration
s@GetObjectLockConfiguration' {} BucketName
a -> GetObjectLockConfiguration
s {$sel:bucket:GetObjectLockConfiguration' :: BucketName
bucket = BucketName
a} :: GetObjectLockConfiguration)
instance Core.AWSRequest GetObjectLockConfiguration where
type
AWSResponse GetObjectLockConfiguration =
GetObjectLockConfigurationResponse
request :: GetObjectLockConfiguration -> Request GetObjectLockConfiguration
request =
Request GetObjectLockConfiguration
-> Request GetObjectLockConfiguration
forall a. Request a -> Request a
Request.s3vhost
(Request GetObjectLockConfiguration
-> Request GetObjectLockConfiguration)
-> (GetObjectLockConfiguration
-> Request GetObjectLockConfiguration)
-> GetObjectLockConfiguration
-> Request GetObjectLockConfiguration
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. Service
-> GetObjectLockConfiguration -> Request GetObjectLockConfiguration
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
response :: Logger
-> Service
-> Proxy GetObjectLockConfiguration
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetObjectLockConfiguration)))
response =
(Int
-> ResponseHeaders
-> [Node]
-> Either String (AWSResponse GetObjectLockConfiguration))
-> Logger
-> Service
-> Proxy GetObjectLockConfiguration
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetObjectLockConfiguration)))
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 ObjectLockConfiguration
-> Int -> GetObjectLockConfigurationResponse
GetObjectLockConfigurationResponse'
(Maybe ObjectLockConfiguration
-> Int -> GetObjectLockConfigurationResponse)
-> Either String (Maybe ObjectLockConfiguration)
-> Either String (Int -> GetObjectLockConfigurationResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node] -> Either String (Maybe ObjectLockConfiguration)
forall a. FromXML a => [Node] -> Either String a
Core.parseXML [Node]
x)
Either String (Int -> GetObjectLockConfigurationResponse)
-> Either String Int
-> Either String GetObjectLockConfigurationResponse
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 GetObjectLockConfiguration
instance Prelude.NFData GetObjectLockConfiguration
instance Core.ToHeaders GetObjectLockConfiguration where
toHeaders :: GetObjectLockConfiguration -> ResponseHeaders
toHeaders GetObjectLockConfiguration' {Maybe Text
BucketName
bucket :: BucketName
expectedBucketOwner :: Maybe Text
$sel:bucket:GetObjectLockConfiguration' :: GetObjectLockConfiguration -> BucketName
$sel:expectedBucketOwner:GetObjectLockConfiguration' :: GetObjectLockConfiguration -> 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 GetObjectLockConfiguration where
toPath :: GetObjectLockConfiguration -> ByteString
toPath GetObjectLockConfiguration' {Maybe Text
BucketName
bucket :: BucketName
expectedBucketOwner :: Maybe Text
$sel:bucket:GetObjectLockConfiguration' :: GetObjectLockConfiguration -> BucketName
$sel:expectedBucketOwner:GetObjectLockConfiguration' :: GetObjectLockConfiguration -> 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 GetObjectLockConfiguration where
toQuery :: GetObjectLockConfiguration -> QueryString
toQuery =
QueryString -> GetObjectLockConfiguration -> QueryString
forall a b. a -> b -> a
Prelude.const ([QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat [QueryString
"object-lock"])
data GetObjectLockConfigurationResponse = GetObjectLockConfigurationResponse'
{
GetObjectLockConfigurationResponse -> Maybe ObjectLockConfiguration
objectLockConfiguration :: Prelude.Maybe ObjectLockConfiguration,
GetObjectLockConfigurationResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetObjectLockConfigurationResponse
-> GetObjectLockConfigurationResponse -> Bool
(GetObjectLockConfigurationResponse
-> GetObjectLockConfigurationResponse -> Bool)
-> (GetObjectLockConfigurationResponse
-> GetObjectLockConfigurationResponse -> Bool)
-> Eq GetObjectLockConfigurationResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetObjectLockConfigurationResponse
-> GetObjectLockConfigurationResponse -> Bool
$c/= :: GetObjectLockConfigurationResponse
-> GetObjectLockConfigurationResponse -> Bool
== :: GetObjectLockConfigurationResponse
-> GetObjectLockConfigurationResponse -> Bool
$c== :: GetObjectLockConfigurationResponse
-> GetObjectLockConfigurationResponse -> Bool
Prelude.Eq, ReadPrec [GetObjectLockConfigurationResponse]
ReadPrec GetObjectLockConfigurationResponse
Int -> ReadS GetObjectLockConfigurationResponse
ReadS [GetObjectLockConfigurationResponse]
(Int -> ReadS GetObjectLockConfigurationResponse)
-> ReadS [GetObjectLockConfigurationResponse]
-> ReadPrec GetObjectLockConfigurationResponse
-> ReadPrec [GetObjectLockConfigurationResponse]
-> Read GetObjectLockConfigurationResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetObjectLockConfigurationResponse]
$creadListPrec :: ReadPrec [GetObjectLockConfigurationResponse]
readPrec :: ReadPrec GetObjectLockConfigurationResponse
$creadPrec :: ReadPrec GetObjectLockConfigurationResponse
readList :: ReadS [GetObjectLockConfigurationResponse]
$creadList :: ReadS [GetObjectLockConfigurationResponse]
readsPrec :: Int -> ReadS GetObjectLockConfigurationResponse
$creadsPrec :: Int -> ReadS GetObjectLockConfigurationResponse
Prelude.Read, Int -> GetObjectLockConfigurationResponse -> ShowS
[GetObjectLockConfigurationResponse] -> ShowS
GetObjectLockConfigurationResponse -> String
(Int -> GetObjectLockConfigurationResponse -> ShowS)
-> (GetObjectLockConfigurationResponse -> String)
-> ([GetObjectLockConfigurationResponse] -> ShowS)
-> Show GetObjectLockConfigurationResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetObjectLockConfigurationResponse] -> ShowS
$cshowList :: [GetObjectLockConfigurationResponse] -> ShowS
show :: GetObjectLockConfigurationResponse -> String
$cshow :: GetObjectLockConfigurationResponse -> String
showsPrec :: Int -> GetObjectLockConfigurationResponse -> ShowS
$cshowsPrec :: Int -> GetObjectLockConfigurationResponse -> ShowS
Prelude.Show, (forall x.
GetObjectLockConfigurationResponse
-> Rep GetObjectLockConfigurationResponse x)
-> (forall x.
Rep GetObjectLockConfigurationResponse x
-> GetObjectLockConfigurationResponse)
-> Generic GetObjectLockConfigurationResponse
forall x.
Rep GetObjectLockConfigurationResponse x
-> GetObjectLockConfigurationResponse
forall x.
GetObjectLockConfigurationResponse
-> Rep GetObjectLockConfigurationResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetObjectLockConfigurationResponse x
-> GetObjectLockConfigurationResponse
$cfrom :: forall x.
GetObjectLockConfigurationResponse
-> Rep GetObjectLockConfigurationResponse x
Prelude.Generic)
newGetObjectLockConfigurationResponse ::
Prelude.Int ->
GetObjectLockConfigurationResponse
newGetObjectLockConfigurationResponse :: Int -> GetObjectLockConfigurationResponse
newGetObjectLockConfigurationResponse Int
pHttpStatus_ =
GetObjectLockConfigurationResponse' :: Maybe ObjectLockConfiguration
-> Int -> GetObjectLockConfigurationResponse
GetObjectLockConfigurationResponse'
{ $sel:objectLockConfiguration:GetObjectLockConfigurationResponse' :: Maybe ObjectLockConfiguration
objectLockConfiguration =
Maybe ObjectLockConfiguration
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetObjectLockConfigurationResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getObjectLockConfigurationResponse_objectLockConfiguration :: Lens.Lens' GetObjectLockConfigurationResponse (Prelude.Maybe ObjectLockConfiguration)
getObjectLockConfigurationResponse_objectLockConfiguration :: (Maybe ObjectLockConfiguration
-> f (Maybe ObjectLockConfiguration))
-> GetObjectLockConfigurationResponse
-> f GetObjectLockConfigurationResponse
getObjectLockConfigurationResponse_objectLockConfiguration = (GetObjectLockConfigurationResponse
-> Maybe ObjectLockConfiguration)
-> (GetObjectLockConfigurationResponse
-> Maybe ObjectLockConfiguration
-> GetObjectLockConfigurationResponse)
-> Lens
GetObjectLockConfigurationResponse
GetObjectLockConfigurationResponse
(Maybe ObjectLockConfiguration)
(Maybe ObjectLockConfiguration)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetObjectLockConfigurationResponse' {Maybe ObjectLockConfiguration
objectLockConfiguration :: Maybe ObjectLockConfiguration
$sel:objectLockConfiguration:GetObjectLockConfigurationResponse' :: GetObjectLockConfigurationResponse -> Maybe ObjectLockConfiguration
objectLockConfiguration} -> Maybe ObjectLockConfiguration
objectLockConfiguration) (\s :: GetObjectLockConfigurationResponse
s@GetObjectLockConfigurationResponse' {} Maybe ObjectLockConfiguration
a -> GetObjectLockConfigurationResponse
s {$sel:objectLockConfiguration:GetObjectLockConfigurationResponse' :: Maybe ObjectLockConfiguration
objectLockConfiguration = Maybe ObjectLockConfiguration
a} :: GetObjectLockConfigurationResponse)
getObjectLockConfigurationResponse_httpStatus :: Lens.Lens' GetObjectLockConfigurationResponse Prelude.Int
getObjectLockConfigurationResponse_httpStatus :: (Int -> f Int)
-> GetObjectLockConfigurationResponse
-> f GetObjectLockConfigurationResponse
getObjectLockConfigurationResponse_httpStatus = (GetObjectLockConfigurationResponse -> Int)
-> (GetObjectLockConfigurationResponse
-> Int -> GetObjectLockConfigurationResponse)
-> Lens
GetObjectLockConfigurationResponse
GetObjectLockConfigurationResponse
Int
Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetObjectLockConfigurationResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetObjectLockConfigurationResponse' :: GetObjectLockConfigurationResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetObjectLockConfigurationResponse
s@GetObjectLockConfigurationResponse' {} Int
a -> GetObjectLockConfigurationResponse
s {$sel:httpStatus:GetObjectLockConfigurationResponse' :: Int
httpStatus = Int
a} :: GetObjectLockConfigurationResponse)
instance
Prelude.NFData
GetObjectLockConfigurationResponse