{-# 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.Lightsail.SetResourceAccessForBucket
(
SetResourceAccessForBucket (..),
newSetResourceAccessForBucket,
setResourceAccessForBucket_resourceName,
setResourceAccessForBucket_bucketName,
setResourceAccessForBucket_access,
SetResourceAccessForBucketResponse (..),
newSetResourceAccessForBucketResponse,
setResourceAccessForBucketResponse_operations,
setResourceAccessForBucketResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.Lightsail.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data SetResourceAccessForBucket = SetResourceAccessForBucket'
{
SetResourceAccessForBucket -> Text
resourceName :: Prelude.Text,
SetResourceAccessForBucket -> Text
bucketName :: Prelude.Text,
SetResourceAccessForBucket -> ResourceBucketAccess
access :: ResourceBucketAccess
}
deriving (SetResourceAccessForBucket -> SetResourceAccessForBucket -> Bool
(SetResourceAccessForBucket -> SetResourceAccessForBucket -> Bool)
-> (SetResourceAccessForBucket
-> SetResourceAccessForBucket -> Bool)
-> Eq SetResourceAccessForBucket
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SetResourceAccessForBucket -> SetResourceAccessForBucket -> Bool
$c/= :: SetResourceAccessForBucket -> SetResourceAccessForBucket -> Bool
== :: SetResourceAccessForBucket -> SetResourceAccessForBucket -> Bool
$c== :: SetResourceAccessForBucket -> SetResourceAccessForBucket -> Bool
Prelude.Eq, ReadPrec [SetResourceAccessForBucket]
ReadPrec SetResourceAccessForBucket
Int -> ReadS SetResourceAccessForBucket
ReadS [SetResourceAccessForBucket]
(Int -> ReadS SetResourceAccessForBucket)
-> ReadS [SetResourceAccessForBucket]
-> ReadPrec SetResourceAccessForBucket
-> ReadPrec [SetResourceAccessForBucket]
-> Read SetResourceAccessForBucket
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SetResourceAccessForBucket]
$creadListPrec :: ReadPrec [SetResourceAccessForBucket]
readPrec :: ReadPrec SetResourceAccessForBucket
$creadPrec :: ReadPrec SetResourceAccessForBucket
readList :: ReadS [SetResourceAccessForBucket]
$creadList :: ReadS [SetResourceAccessForBucket]
readsPrec :: Int -> ReadS SetResourceAccessForBucket
$creadsPrec :: Int -> ReadS SetResourceAccessForBucket
Prelude.Read, Int -> SetResourceAccessForBucket -> ShowS
[SetResourceAccessForBucket] -> ShowS
SetResourceAccessForBucket -> String
(Int -> SetResourceAccessForBucket -> ShowS)
-> (SetResourceAccessForBucket -> String)
-> ([SetResourceAccessForBucket] -> ShowS)
-> Show SetResourceAccessForBucket
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SetResourceAccessForBucket] -> ShowS
$cshowList :: [SetResourceAccessForBucket] -> ShowS
show :: SetResourceAccessForBucket -> String
$cshow :: SetResourceAccessForBucket -> String
showsPrec :: Int -> SetResourceAccessForBucket -> ShowS
$cshowsPrec :: Int -> SetResourceAccessForBucket -> ShowS
Prelude.Show, (forall x.
SetResourceAccessForBucket -> Rep SetResourceAccessForBucket x)
-> (forall x.
Rep SetResourceAccessForBucket x -> SetResourceAccessForBucket)
-> Generic SetResourceAccessForBucket
forall x.
Rep SetResourceAccessForBucket x -> SetResourceAccessForBucket
forall x.
SetResourceAccessForBucket -> Rep SetResourceAccessForBucket x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep SetResourceAccessForBucket x -> SetResourceAccessForBucket
$cfrom :: forall x.
SetResourceAccessForBucket -> Rep SetResourceAccessForBucket x
Prelude.Generic)
newSetResourceAccessForBucket ::
Prelude.Text ->
Prelude.Text ->
ResourceBucketAccess ->
SetResourceAccessForBucket
newSetResourceAccessForBucket :: Text -> Text -> ResourceBucketAccess -> SetResourceAccessForBucket
newSetResourceAccessForBucket
Text
pResourceName_
Text
pBucketName_
ResourceBucketAccess
pAccess_ =
SetResourceAccessForBucket' :: Text -> Text -> ResourceBucketAccess -> SetResourceAccessForBucket
SetResourceAccessForBucket'
{ $sel:resourceName:SetResourceAccessForBucket' :: Text
resourceName =
Text
pResourceName_,
$sel:bucketName:SetResourceAccessForBucket' :: Text
bucketName = Text
pBucketName_,
$sel:access:SetResourceAccessForBucket' :: ResourceBucketAccess
access = ResourceBucketAccess
pAccess_
}
setResourceAccessForBucket_resourceName :: Lens.Lens' SetResourceAccessForBucket Prelude.Text
setResourceAccessForBucket_resourceName :: (Text -> f Text)
-> SetResourceAccessForBucket -> f SetResourceAccessForBucket
setResourceAccessForBucket_resourceName = (SetResourceAccessForBucket -> Text)
-> (SetResourceAccessForBucket
-> Text -> SetResourceAccessForBucket)
-> Lens
SetResourceAccessForBucket SetResourceAccessForBucket Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SetResourceAccessForBucket' {Text
resourceName :: Text
$sel:resourceName:SetResourceAccessForBucket' :: SetResourceAccessForBucket -> Text
resourceName} -> Text
resourceName) (\s :: SetResourceAccessForBucket
s@SetResourceAccessForBucket' {} Text
a -> SetResourceAccessForBucket
s {$sel:resourceName:SetResourceAccessForBucket' :: Text
resourceName = Text
a} :: SetResourceAccessForBucket)
setResourceAccessForBucket_bucketName :: Lens.Lens' SetResourceAccessForBucket Prelude.Text
setResourceAccessForBucket_bucketName :: (Text -> f Text)
-> SetResourceAccessForBucket -> f SetResourceAccessForBucket
setResourceAccessForBucket_bucketName = (SetResourceAccessForBucket -> Text)
-> (SetResourceAccessForBucket
-> Text -> SetResourceAccessForBucket)
-> Lens
SetResourceAccessForBucket SetResourceAccessForBucket Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SetResourceAccessForBucket' {Text
bucketName :: Text
$sel:bucketName:SetResourceAccessForBucket' :: SetResourceAccessForBucket -> Text
bucketName} -> Text
bucketName) (\s :: SetResourceAccessForBucket
s@SetResourceAccessForBucket' {} Text
a -> SetResourceAccessForBucket
s {$sel:bucketName:SetResourceAccessForBucket' :: Text
bucketName = Text
a} :: SetResourceAccessForBucket)
setResourceAccessForBucket_access :: Lens.Lens' SetResourceAccessForBucket ResourceBucketAccess
setResourceAccessForBucket_access :: (ResourceBucketAccess -> f ResourceBucketAccess)
-> SetResourceAccessForBucket -> f SetResourceAccessForBucket
setResourceAccessForBucket_access = (SetResourceAccessForBucket -> ResourceBucketAccess)
-> (SetResourceAccessForBucket
-> ResourceBucketAccess -> SetResourceAccessForBucket)
-> Lens
SetResourceAccessForBucket
SetResourceAccessForBucket
ResourceBucketAccess
ResourceBucketAccess
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SetResourceAccessForBucket' {ResourceBucketAccess
access :: ResourceBucketAccess
$sel:access:SetResourceAccessForBucket' :: SetResourceAccessForBucket -> ResourceBucketAccess
access} -> ResourceBucketAccess
access) (\s :: SetResourceAccessForBucket
s@SetResourceAccessForBucket' {} ResourceBucketAccess
a -> SetResourceAccessForBucket
s {$sel:access:SetResourceAccessForBucket' :: ResourceBucketAccess
access = ResourceBucketAccess
a} :: SetResourceAccessForBucket)
instance Core.AWSRequest SetResourceAccessForBucket where
type
AWSResponse SetResourceAccessForBucket =
SetResourceAccessForBucketResponse
request :: SetResourceAccessForBucket -> Request SetResourceAccessForBucket
request = Service
-> SetResourceAccessForBucket -> Request SetResourceAccessForBucket
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy SetResourceAccessForBucket
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse SetResourceAccessForBucket)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse SetResourceAccessForBucket))
-> Logger
-> Service
-> Proxy SetResourceAccessForBucket
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse SetResourceAccessForBucket)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Maybe [Operation] -> Int -> SetResourceAccessForBucketResponse
SetResourceAccessForBucketResponse'
(Maybe [Operation] -> Int -> SetResourceAccessForBucketResponse)
-> Either String (Maybe [Operation])
-> Either String (Int -> SetResourceAccessForBucketResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe (Maybe [Operation]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"operations" Either String (Maybe (Maybe [Operation]))
-> Maybe [Operation] -> Either String (Maybe [Operation])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [Operation]
forall a. Monoid a => a
Prelude.mempty)
Either String (Int -> SetResourceAccessForBucketResponse)
-> Either String Int
-> Either String SetResourceAccessForBucketResponse
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 SetResourceAccessForBucket
instance Prelude.NFData SetResourceAccessForBucket
instance Core.ToHeaders SetResourceAccessForBucket where
toHeaders :: SetResourceAccessForBucket -> ResponseHeaders
toHeaders =
ResponseHeaders -> SetResourceAccessForBucket -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"Lightsail_20161128.SetResourceAccessForBucket" ::
Prelude.ByteString
),
HeaderName
"Content-Type"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Core.ToJSON SetResourceAccessForBucket where
toJSON :: SetResourceAccessForBucket -> Value
toJSON SetResourceAccessForBucket' {Text
ResourceBucketAccess
access :: ResourceBucketAccess
bucketName :: Text
resourceName :: Text
$sel:access:SetResourceAccessForBucket' :: SetResourceAccessForBucket -> ResourceBucketAccess
$sel:bucketName:SetResourceAccessForBucket' :: SetResourceAccessForBucket -> Text
$sel:resourceName:SetResourceAccessForBucket' :: SetResourceAccessForBucket -> Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"resourceName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
resourceName),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"bucketName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
bucketName),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"access" Text -> ResourceBucketAccess -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= ResourceBucketAccess
access)
]
)
instance Core.ToPath SetResourceAccessForBucket where
toPath :: SetResourceAccessForBucket -> ByteString
toPath = ByteString -> SetResourceAccessForBucket -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery SetResourceAccessForBucket where
toQuery :: SetResourceAccessForBucket -> QueryString
toQuery = QueryString -> SetResourceAccessForBucket -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data SetResourceAccessForBucketResponse = SetResourceAccessForBucketResponse'
{
SetResourceAccessForBucketResponse -> Maybe [Operation]
operations :: Prelude.Maybe [Operation],
SetResourceAccessForBucketResponse -> Int
httpStatus :: Prelude.Int
}
deriving (SetResourceAccessForBucketResponse
-> SetResourceAccessForBucketResponse -> Bool
(SetResourceAccessForBucketResponse
-> SetResourceAccessForBucketResponse -> Bool)
-> (SetResourceAccessForBucketResponse
-> SetResourceAccessForBucketResponse -> Bool)
-> Eq SetResourceAccessForBucketResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SetResourceAccessForBucketResponse
-> SetResourceAccessForBucketResponse -> Bool
$c/= :: SetResourceAccessForBucketResponse
-> SetResourceAccessForBucketResponse -> Bool
== :: SetResourceAccessForBucketResponse
-> SetResourceAccessForBucketResponse -> Bool
$c== :: SetResourceAccessForBucketResponse
-> SetResourceAccessForBucketResponse -> Bool
Prelude.Eq, ReadPrec [SetResourceAccessForBucketResponse]
ReadPrec SetResourceAccessForBucketResponse
Int -> ReadS SetResourceAccessForBucketResponse
ReadS [SetResourceAccessForBucketResponse]
(Int -> ReadS SetResourceAccessForBucketResponse)
-> ReadS [SetResourceAccessForBucketResponse]
-> ReadPrec SetResourceAccessForBucketResponse
-> ReadPrec [SetResourceAccessForBucketResponse]
-> Read SetResourceAccessForBucketResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SetResourceAccessForBucketResponse]
$creadListPrec :: ReadPrec [SetResourceAccessForBucketResponse]
readPrec :: ReadPrec SetResourceAccessForBucketResponse
$creadPrec :: ReadPrec SetResourceAccessForBucketResponse
readList :: ReadS [SetResourceAccessForBucketResponse]
$creadList :: ReadS [SetResourceAccessForBucketResponse]
readsPrec :: Int -> ReadS SetResourceAccessForBucketResponse
$creadsPrec :: Int -> ReadS SetResourceAccessForBucketResponse
Prelude.Read, Int -> SetResourceAccessForBucketResponse -> ShowS
[SetResourceAccessForBucketResponse] -> ShowS
SetResourceAccessForBucketResponse -> String
(Int -> SetResourceAccessForBucketResponse -> ShowS)
-> (SetResourceAccessForBucketResponse -> String)
-> ([SetResourceAccessForBucketResponse] -> ShowS)
-> Show SetResourceAccessForBucketResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SetResourceAccessForBucketResponse] -> ShowS
$cshowList :: [SetResourceAccessForBucketResponse] -> ShowS
show :: SetResourceAccessForBucketResponse -> String
$cshow :: SetResourceAccessForBucketResponse -> String
showsPrec :: Int -> SetResourceAccessForBucketResponse -> ShowS
$cshowsPrec :: Int -> SetResourceAccessForBucketResponse -> ShowS
Prelude.Show, (forall x.
SetResourceAccessForBucketResponse
-> Rep SetResourceAccessForBucketResponse x)
-> (forall x.
Rep SetResourceAccessForBucketResponse x
-> SetResourceAccessForBucketResponse)
-> Generic SetResourceAccessForBucketResponse
forall x.
Rep SetResourceAccessForBucketResponse x
-> SetResourceAccessForBucketResponse
forall x.
SetResourceAccessForBucketResponse
-> Rep SetResourceAccessForBucketResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep SetResourceAccessForBucketResponse x
-> SetResourceAccessForBucketResponse
$cfrom :: forall x.
SetResourceAccessForBucketResponse
-> Rep SetResourceAccessForBucketResponse x
Prelude.Generic)
newSetResourceAccessForBucketResponse ::
Prelude.Int ->
SetResourceAccessForBucketResponse
newSetResourceAccessForBucketResponse :: Int -> SetResourceAccessForBucketResponse
newSetResourceAccessForBucketResponse Int
pHttpStatus_ =
SetResourceAccessForBucketResponse' :: Maybe [Operation] -> Int -> SetResourceAccessForBucketResponse
SetResourceAccessForBucketResponse'
{ $sel:operations:SetResourceAccessForBucketResponse' :: Maybe [Operation]
operations =
Maybe [Operation]
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:SetResourceAccessForBucketResponse' :: Int
httpStatus = Int
pHttpStatus_
}
setResourceAccessForBucketResponse_operations :: Lens.Lens' SetResourceAccessForBucketResponse (Prelude.Maybe [Operation])
setResourceAccessForBucketResponse_operations :: (Maybe [Operation] -> f (Maybe [Operation]))
-> SetResourceAccessForBucketResponse
-> f SetResourceAccessForBucketResponse
setResourceAccessForBucketResponse_operations = (SetResourceAccessForBucketResponse -> Maybe [Operation])
-> (SetResourceAccessForBucketResponse
-> Maybe [Operation] -> SetResourceAccessForBucketResponse)
-> Lens
SetResourceAccessForBucketResponse
SetResourceAccessForBucketResponse
(Maybe [Operation])
(Maybe [Operation])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SetResourceAccessForBucketResponse' {Maybe [Operation]
operations :: Maybe [Operation]
$sel:operations:SetResourceAccessForBucketResponse' :: SetResourceAccessForBucketResponse -> Maybe [Operation]
operations} -> Maybe [Operation]
operations) (\s :: SetResourceAccessForBucketResponse
s@SetResourceAccessForBucketResponse' {} Maybe [Operation]
a -> SetResourceAccessForBucketResponse
s {$sel:operations:SetResourceAccessForBucketResponse' :: Maybe [Operation]
operations = Maybe [Operation]
a} :: SetResourceAccessForBucketResponse) ((Maybe [Operation] -> f (Maybe [Operation]))
-> SetResourceAccessForBucketResponse
-> f SetResourceAccessForBucketResponse)
-> ((Maybe [Operation] -> f (Maybe [Operation]))
-> Maybe [Operation] -> f (Maybe [Operation]))
-> (Maybe [Operation] -> f (Maybe [Operation]))
-> SetResourceAccessForBucketResponse
-> f SetResourceAccessForBucketResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Operation] [Operation] [Operation] [Operation]
-> Iso
(Maybe [Operation])
(Maybe [Operation])
(Maybe [Operation])
(Maybe [Operation])
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 [Operation] [Operation] [Operation] [Operation]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
setResourceAccessForBucketResponse_httpStatus :: Lens.Lens' SetResourceAccessForBucketResponse Prelude.Int
setResourceAccessForBucketResponse_httpStatus :: (Int -> f Int)
-> SetResourceAccessForBucketResponse
-> f SetResourceAccessForBucketResponse
setResourceAccessForBucketResponse_httpStatus = (SetResourceAccessForBucketResponse -> Int)
-> (SetResourceAccessForBucketResponse
-> Int -> SetResourceAccessForBucketResponse)
-> Lens
SetResourceAccessForBucketResponse
SetResourceAccessForBucketResponse
Int
Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SetResourceAccessForBucketResponse' {Int
httpStatus :: Int
$sel:httpStatus:SetResourceAccessForBucketResponse' :: SetResourceAccessForBucketResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: SetResourceAccessForBucketResponse
s@SetResourceAccessForBucketResponse' {} Int
a -> SetResourceAccessForBucketResponse
s {$sel:httpStatus:SetResourceAccessForBucketResponse' :: Int
httpStatus = Int
a} :: SetResourceAccessForBucketResponse)
instance
Prelude.NFData
SetResourceAccessForBucketResponse