{-# 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.CreateBucketAccessKey
(
CreateBucketAccessKey (..),
newCreateBucketAccessKey,
createBucketAccessKey_bucketName,
CreateBucketAccessKeyResponse (..),
newCreateBucketAccessKeyResponse,
createBucketAccessKeyResponse_accessKey,
createBucketAccessKeyResponse_operations,
createBucketAccessKeyResponse_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 CreateBucketAccessKey = CreateBucketAccessKey'
{
CreateBucketAccessKey -> Text
bucketName :: Prelude.Text
}
deriving (CreateBucketAccessKey -> CreateBucketAccessKey -> Bool
(CreateBucketAccessKey -> CreateBucketAccessKey -> Bool)
-> (CreateBucketAccessKey -> CreateBucketAccessKey -> Bool)
-> Eq CreateBucketAccessKey
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateBucketAccessKey -> CreateBucketAccessKey -> Bool
$c/= :: CreateBucketAccessKey -> CreateBucketAccessKey -> Bool
== :: CreateBucketAccessKey -> CreateBucketAccessKey -> Bool
$c== :: CreateBucketAccessKey -> CreateBucketAccessKey -> Bool
Prelude.Eq, ReadPrec [CreateBucketAccessKey]
ReadPrec CreateBucketAccessKey
Int -> ReadS CreateBucketAccessKey
ReadS [CreateBucketAccessKey]
(Int -> ReadS CreateBucketAccessKey)
-> ReadS [CreateBucketAccessKey]
-> ReadPrec CreateBucketAccessKey
-> ReadPrec [CreateBucketAccessKey]
-> Read CreateBucketAccessKey
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateBucketAccessKey]
$creadListPrec :: ReadPrec [CreateBucketAccessKey]
readPrec :: ReadPrec CreateBucketAccessKey
$creadPrec :: ReadPrec CreateBucketAccessKey
readList :: ReadS [CreateBucketAccessKey]
$creadList :: ReadS [CreateBucketAccessKey]
readsPrec :: Int -> ReadS CreateBucketAccessKey
$creadsPrec :: Int -> ReadS CreateBucketAccessKey
Prelude.Read, Int -> CreateBucketAccessKey -> ShowS
[CreateBucketAccessKey] -> ShowS
CreateBucketAccessKey -> String
(Int -> CreateBucketAccessKey -> ShowS)
-> (CreateBucketAccessKey -> String)
-> ([CreateBucketAccessKey] -> ShowS)
-> Show CreateBucketAccessKey
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateBucketAccessKey] -> ShowS
$cshowList :: [CreateBucketAccessKey] -> ShowS
show :: CreateBucketAccessKey -> String
$cshow :: CreateBucketAccessKey -> String
showsPrec :: Int -> CreateBucketAccessKey -> ShowS
$cshowsPrec :: Int -> CreateBucketAccessKey -> ShowS
Prelude.Show, (forall x. CreateBucketAccessKey -> Rep CreateBucketAccessKey x)
-> (forall x. Rep CreateBucketAccessKey x -> CreateBucketAccessKey)
-> Generic CreateBucketAccessKey
forall x. Rep CreateBucketAccessKey x -> CreateBucketAccessKey
forall x. CreateBucketAccessKey -> Rep CreateBucketAccessKey x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateBucketAccessKey x -> CreateBucketAccessKey
$cfrom :: forall x. CreateBucketAccessKey -> Rep CreateBucketAccessKey x
Prelude.Generic)
newCreateBucketAccessKey ::
Prelude.Text ->
CreateBucketAccessKey
newCreateBucketAccessKey :: Text -> CreateBucketAccessKey
newCreateBucketAccessKey Text
pBucketName_ =
CreateBucketAccessKey' :: Text -> CreateBucketAccessKey
CreateBucketAccessKey' {$sel:bucketName:CreateBucketAccessKey' :: Text
bucketName = Text
pBucketName_}
createBucketAccessKey_bucketName :: Lens.Lens' CreateBucketAccessKey Prelude.Text
createBucketAccessKey_bucketName :: (Text -> f Text)
-> CreateBucketAccessKey -> f CreateBucketAccessKey
createBucketAccessKey_bucketName = (CreateBucketAccessKey -> Text)
-> (CreateBucketAccessKey -> Text -> CreateBucketAccessKey)
-> Lens CreateBucketAccessKey CreateBucketAccessKey Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateBucketAccessKey' {Text
bucketName :: Text
$sel:bucketName:CreateBucketAccessKey' :: CreateBucketAccessKey -> Text
bucketName} -> Text
bucketName) (\s :: CreateBucketAccessKey
s@CreateBucketAccessKey' {} Text
a -> CreateBucketAccessKey
s {$sel:bucketName:CreateBucketAccessKey' :: Text
bucketName = Text
a} :: CreateBucketAccessKey)
instance Core.AWSRequest CreateBucketAccessKey where
type
AWSResponse CreateBucketAccessKey =
CreateBucketAccessKeyResponse
request :: CreateBucketAccessKey -> Request CreateBucketAccessKey
request = Service -> CreateBucketAccessKey -> Request CreateBucketAccessKey
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy CreateBucketAccessKey
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateBucketAccessKey)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse CreateBucketAccessKey))
-> Logger
-> Service
-> Proxy CreateBucketAccessKey
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateBucketAccessKey)))
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 AccessKey
-> Maybe [Operation] -> Int -> CreateBucketAccessKeyResponse
CreateBucketAccessKeyResponse'
(Maybe AccessKey
-> Maybe [Operation] -> Int -> CreateBucketAccessKeyResponse)
-> Either String (Maybe AccessKey)
-> Either
String (Maybe [Operation] -> Int -> CreateBucketAccessKeyResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe AccessKey)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"accessKey")
Either
String (Maybe [Operation] -> Int -> CreateBucketAccessKeyResponse)
-> Either String (Maybe [Operation])
-> Either String (Int -> CreateBucketAccessKeyResponse)
forall (f :: * -> *) a b. Applicative f => 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 -> CreateBucketAccessKeyResponse)
-> Either String Int -> Either String CreateBucketAccessKeyResponse
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 CreateBucketAccessKey
instance Prelude.NFData CreateBucketAccessKey
instance Core.ToHeaders CreateBucketAccessKey where
toHeaders :: CreateBucketAccessKey -> ResponseHeaders
toHeaders =
ResponseHeaders -> CreateBucketAccessKey -> 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.CreateBucketAccessKey" ::
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 CreateBucketAccessKey where
toJSON :: CreateBucketAccessKey -> Value
toJSON CreateBucketAccessKey' {Text
bucketName :: Text
$sel:bucketName:CreateBucketAccessKey' :: CreateBucketAccessKey -> 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
"bucketName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
bucketName)]
)
instance Core.ToPath CreateBucketAccessKey where
toPath :: CreateBucketAccessKey -> ByteString
toPath = ByteString -> CreateBucketAccessKey -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery CreateBucketAccessKey where
toQuery :: CreateBucketAccessKey -> QueryString
toQuery = QueryString -> CreateBucketAccessKey -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data CreateBucketAccessKeyResponse = CreateBucketAccessKeyResponse'
{
CreateBucketAccessKeyResponse -> Maybe AccessKey
accessKey :: Prelude.Maybe AccessKey,
CreateBucketAccessKeyResponse -> Maybe [Operation]
operations :: Prelude.Maybe [Operation],
CreateBucketAccessKeyResponse -> Int
httpStatus :: Prelude.Int
}
deriving (CreateBucketAccessKeyResponse
-> CreateBucketAccessKeyResponse -> Bool
(CreateBucketAccessKeyResponse
-> CreateBucketAccessKeyResponse -> Bool)
-> (CreateBucketAccessKeyResponse
-> CreateBucketAccessKeyResponse -> Bool)
-> Eq CreateBucketAccessKeyResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateBucketAccessKeyResponse
-> CreateBucketAccessKeyResponse -> Bool
$c/= :: CreateBucketAccessKeyResponse
-> CreateBucketAccessKeyResponse -> Bool
== :: CreateBucketAccessKeyResponse
-> CreateBucketAccessKeyResponse -> Bool
$c== :: CreateBucketAccessKeyResponse
-> CreateBucketAccessKeyResponse -> Bool
Prelude.Eq, Int -> CreateBucketAccessKeyResponse -> ShowS
[CreateBucketAccessKeyResponse] -> ShowS
CreateBucketAccessKeyResponse -> String
(Int -> CreateBucketAccessKeyResponse -> ShowS)
-> (CreateBucketAccessKeyResponse -> String)
-> ([CreateBucketAccessKeyResponse] -> ShowS)
-> Show CreateBucketAccessKeyResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateBucketAccessKeyResponse] -> ShowS
$cshowList :: [CreateBucketAccessKeyResponse] -> ShowS
show :: CreateBucketAccessKeyResponse -> String
$cshow :: CreateBucketAccessKeyResponse -> String
showsPrec :: Int -> CreateBucketAccessKeyResponse -> ShowS
$cshowsPrec :: Int -> CreateBucketAccessKeyResponse -> ShowS
Prelude.Show, (forall x.
CreateBucketAccessKeyResponse
-> Rep CreateBucketAccessKeyResponse x)
-> (forall x.
Rep CreateBucketAccessKeyResponse x
-> CreateBucketAccessKeyResponse)
-> Generic CreateBucketAccessKeyResponse
forall x.
Rep CreateBucketAccessKeyResponse x
-> CreateBucketAccessKeyResponse
forall x.
CreateBucketAccessKeyResponse
-> Rep CreateBucketAccessKeyResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateBucketAccessKeyResponse x
-> CreateBucketAccessKeyResponse
$cfrom :: forall x.
CreateBucketAccessKeyResponse
-> Rep CreateBucketAccessKeyResponse x
Prelude.Generic)
newCreateBucketAccessKeyResponse ::
Prelude.Int ->
CreateBucketAccessKeyResponse
newCreateBucketAccessKeyResponse :: Int -> CreateBucketAccessKeyResponse
newCreateBucketAccessKeyResponse Int
pHttpStatus_ =
CreateBucketAccessKeyResponse' :: Maybe AccessKey
-> Maybe [Operation] -> Int -> CreateBucketAccessKeyResponse
CreateBucketAccessKeyResponse'
{ $sel:accessKey:CreateBucketAccessKeyResponse' :: Maybe AccessKey
accessKey =
Maybe AccessKey
forall a. Maybe a
Prelude.Nothing,
$sel:operations:CreateBucketAccessKeyResponse' :: Maybe [Operation]
operations = Maybe [Operation]
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:CreateBucketAccessKeyResponse' :: Int
httpStatus = Int
pHttpStatus_
}
createBucketAccessKeyResponse_accessKey :: Lens.Lens' CreateBucketAccessKeyResponse (Prelude.Maybe AccessKey)
createBucketAccessKeyResponse_accessKey :: (Maybe AccessKey -> f (Maybe AccessKey))
-> CreateBucketAccessKeyResponse -> f CreateBucketAccessKeyResponse
createBucketAccessKeyResponse_accessKey = (CreateBucketAccessKeyResponse -> Maybe AccessKey)
-> (CreateBucketAccessKeyResponse
-> Maybe AccessKey -> CreateBucketAccessKeyResponse)
-> Lens
CreateBucketAccessKeyResponse
CreateBucketAccessKeyResponse
(Maybe AccessKey)
(Maybe AccessKey)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateBucketAccessKeyResponse' {Maybe AccessKey
accessKey :: Maybe AccessKey
$sel:accessKey:CreateBucketAccessKeyResponse' :: CreateBucketAccessKeyResponse -> Maybe AccessKey
accessKey} -> Maybe AccessKey
accessKey) (\s :: CreateBucketAccessKeyResponse
s@CreateBucketAccessKeyResponse' {} Maybe AccessKey
a -> CreateBucketAccessKeyResponse
s {$sel:accessKey:CreateBucketAccessKeyResponse' :: Maybe AccessKey
accessKey = Maybe AccessKey
a} :: CreateBucketAccessKeyResponse)
createBucketAccessKeyResponse_operations :: Lens.Lens' CreateBucketAccessKeyResponse (Prelude.Maybe [Operation])
createBucketAccessKeyResponse_operations :: (Maybe [Operation] -> f (Maybe [Operation]))
-> CreateBucketAccessKeyResponse -> f CreateBucketAccessKeyResponse
createBucketAccessKeyResponse_operations = (CreateBucketAccessKeyResponse -> Maybe [Operation])
-> (CreateBucketAccessKeyResponse
-> Maybe [Operation] -> CreateBucketAccessKeyResponse)
-> Lens
CreateBucketAccessKeyResponse
CreateBucketAccessKeyResponse
(Maybe [Operation])
(Maybe [Operation])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateBucketAccessKeyResponse' {Maybe [Operation]
operations :: Maybe [Operation]
$sel:operations:CreateBucketAccessKeyResponse' :: CreateBucketAccessKeyResponse -> Maybe [Operation]
operations} -> Maybe [Operation]
operations) (\s :: CreateBucketAccessKeyResponse
s@CreateBucketAccessKeyResponse' {} Maybe [Operation]
a -> CreateBucketAccessKeyResponse
s {$sel:operations:CreateBucketAccessKeyResponse' :: Maybe [Operation]
operations = Maybe [Operation]
a} :: CreateBucketAccessKeyResponse) ((Maybe [Operation] -> f (Maybe [Operation]))
-> CreateBucketAccessKeyResponse
-> f CreateBucketAccessKeyResponse)
-> ((Maybe [Operation] -> f (Maybe [Operation]))
-> Maybe [Operation] -> f (Maybe [Operation]))
-> (Maybe [Operation] -> f (Maybe [Operation]))
-> CreateBucketAccessKeyResponse
-> f CreateBucketAccessKeyResponse
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
createBucketAccessKeyResponse_httpStatus :: Lens.Lens' CreateBucketAccessKeyResponse Prelude.Int
createBucketAccessKeyResponse_httpStatus :: (Int -> f Int)
-> CreateBucketAccessKeyResponse -> f CreateBucketAccessKeyResponse
createBucketAccessKeyResponse_httpStatus = (CreateBucketAccessKeyResponse -> Int)
-> (CreateBucketAccessKeyResponse
-> Int -> CreateBucketAccessKeyResponse)
-> Lens
CreateBucketAccessKeyResponse CreateBucketAccessKeyResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateBucketAccessKeyResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateBucketAccessKeyResponse' :: CreateBucketAccessKeyResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateBucketAccessKeyResponse
s@CreateBucketAccessKeyResponse' {} Int
a -> CreateBucketAccessKeyResponse
s {$sel:httpStatus:CreateBucketAccessKeyResponse' :: Int
httpStatus = Int
a} :: CreateBucketAccessKeyResponse)
instance Prelude.NFData CreateBucketAccessKeyResponse