{-# 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.GetBucketAccessKeys
(
GetBucketAccessKeys (..),
newGetBucketAccessKeys,
getBucketAccessKeys_bucketName,
GetBucketAccessKeysResponse (..),
newGetBucketAccessKeysResponse,
getBucketAccessKeysResponse_accessKeys,
getBucketAccessKeysResponse_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 GetBucketAccessKeys = GetBucketAccessKeys'
{
GetBucketAccessKeys -> Text
bucketName :: Prelude.Text
}
deriving (GetBucketAccessKeys -> GetBucketAccessKeys -> Bool
(GetBucketAccessKeys -> GetBucketAccessKeys -> Bool)
-> (GetBucketAccessKeys -> GetBucketAccessKeys -> Bool)
-> Eq GetBucketAccessKeys
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetBucketAccessKeys -> GetBucketAccessKeys -> Bool
$c/= :: GetBucketAccessKeys -> GetBucketAccessKeys -> Bool
== :: GetBucketAccessKeys -> GetBucketAccessKeys -> Bool
$c== :: GetBucketAccessKeys -> GetBucketAccessKeys -> Bool
Prelude.Eq, ReadPrec [GetBucketAccessKeys]
ReadPrec GetBucketAccessKeys
Int -> ReadS GetBucketAccessKeys
ReadS [GetBucketAccessKeys]
(Int -> ReadS GetBucketAccessKeys)
-> ReadS [GetBucketAccessKeys]
-> ReadPrec GetBucketAccessKeys
-> ReadPrec [GetBucketAccessKeys]
-> Read GetBucketAccessKeys
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetBucketAccessKeys]
$creadListPrec :: ReadPrec [GetBucketAccessKeys]
readPrec :: ReadPrec GetBucketAccessKeys
$creadPrec :: ReadPrec GetBucketAccessKeys
readList :: ReadS [GetBucketAccessKeys]
$creadList :: ReadS [GetBucketAccessKeys]
readsPrec :: Int -> ReadS GetBucketAccessKeys
$creadsPrec :: Int -> ReadS GetBucketAccessKeys
Prelude.Read, Int -> GetBucketAccessKeys -> ShowS
[GetBucketAccessKeys] -> ShowS
GetBucketAccessKeys -> String
(Int -> GetBucketAccessKeys -> ShowS)
-> (GetBucketAccessKeys -> String)
-> ([GetBucketAccessKeys] -> ShowS)
-> Show GetBucketAccessKeys
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetBucketAccessKeys] -> ShowS
$cshowList :: [GetBucketAccessKeys] -> ShowS
show :: GetBucketAccessKeys -> String
$cshow :: GetBucketAccessKeys -> String
showsPrec :: Int -> GetBucketAccessKeys -> ShowS
$cshowsPrec :: Int -> GetBucketAccessKeys -> ShowS
Prelude.Show, (forall x. GetBucketAccessKeys -> Rep GetBucketAccessKeys x)
-> (forall x. Rep GetBucketAccessKeys x -> GetBucketAccessKeys)
-> Generic GetBucketAccessKeys
forall x. Rep GetBucketAccessKeys x -> GetBucketAccessKeys
forall x. GetBucketAccessKeys -> Rep GetBucketAccessKeys x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetBucketAccessKeys x -> GetBucketAccessKeys
$cfrom :: forall x. GetBucketAccessKeys -> Rep GetBucketAccessKeys x
Prelude.Generic)
newGetBucketAccessKeys ::
Prelude.Text ->
GetBucketAccessKeys
newGetBucketAccessKeys :: Text -> GetBucketAccessKeys
newGetBucketAccessKeys Text
pBucketName_ =
GetBucketAccessKeys' :: Text -> GetBucketAccessKeys
GetBucketAccessKeys' {$sel:bucketName:GetBucketAccessKeys' :: Text
bucketName = Text
pBucketName_}
getBucketAccessKeys_bucketName :: Lens.Lens' GetBucketAccessKeys Prelude.Text
getBucketAccessKeys_bucketName :: (Text -> f Text) -> GetBucketAccessKeys -> f GetBucketAccessKeys
getBucketAccessKeys_bucketName = (GetBucketAccessKeys -> Text)
-> (GetBucketAccessKeys -> Text -> GetBucketAccessKeys)
-> Lens GetBucketAccessKeys GetBucketAccessKeys Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetBucketAccessKeys' {Text
bucketName :: Text
$sel:bucketName:GetBucketAccessKeys' :: GetBucketAccessKeys -> Text
bucketName} -> Text
bucketName) (\s :: GetBucketAccessKeys
s@GetBucketAccessKeys' {} Text
a -> GetBucketAccessKeys
s {$sel:bucketName:GetBucketAccessKeys' :: Text
bucketName = Text
a} :: GetBucketAccessKeys)
instance Core.AWSRequest GetBucketAccessKeys where
type
AWSResponse GetBucketAccessKeys =
GetBucketAccessKeysResponse
request :: GetBucketAccessKeys -> Request GetBucketAccessKeys
request = Service -> GetBucketAccessKeys -> Request GetBucketAccessKeys
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy GetBucketAccessKeys
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetBucketAccessKeys)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetBucketAccessKeys))
-> Logger
-> Service
-> Proxy GetBucketAccessKeys
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetBucketAccessKeys)))
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] -> Int -> GetBucketAccessKeysResponse
GetBucketAccessKeysResponse'
(Maybe [AccessKey] -> Int -> GetBucketAccessKeysResponse)
-> Either String (Maybe [AccessKey])
-> Either String (Int -> GetBucketAccessKeysResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe (Maybe [AccessKey]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"accessKeys" Either String (Maybe (Maybe [AccessKey]))
-> Maybe [AccessKey] -> Either String (Maybe [AccessKey])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [AccessKey]
forall a. Monoid a => a
Prelude.mempty)
Either String (Int -> GetBucketAccessKeysResponse)
-> Either String Int -> Either String GetBucketAccessKeysResponse
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 GetBucketAccessKeys
instance Prelude.NFData GetBucketAccessKeys
instance Core.ToHeaders GetBucketAccessKeys where
toHeaders :: GetBucketAccessKeys -> ResponseHeaders
toHeaders =
ResponseHeaders -> GetBucketAccessKeys -> 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.GetBucketAccessKeys" ::
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 GetBucketAccessKeys where
toJSON :: GetBucketAccessKeys -> Value
toJSON GetBucketAccessKeys' {Text
bucketName :: Text
$sel:bucketName:GetBucketAccessKeys' :: GetBucketAccessKeys -> 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 GetBucketAccessKeys where
toPath :: GetBucketAccessKeys -> ByteString
toPath = ByteString -> GetBucketAccessKeys -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery GetBucketAccessKeys where
toQuery :: GetBucketAccessKeys -> QueryString
toQuery = QueryString -> GetBucketAccessKeys -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data GetBucketAccessKeysResponse = GetBucketAccessKeysResponse'
{
GetBucketAccessKeysResponse -> Maybe [AccessKey]
accessKeys :: Prelude.Maybe [AccessKey],
GetBucketAccessKeysResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetBucketAccessKeysResponse -> GetBucketAccessKeysResponse -> Bool
(GetBucketAccessKeysResponse
-> GetBucketAccessKeysResponse -> Bool)
-> (GetBucketAccessKeysResponse
-> GetBucketAccessKeysResponse -> Bool)
-> Eq GetBucketAccessKeysResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetBucketAccessKeysResponse -> GetBucketAccessKeysResponse -> Bool
$c/= :: GetBucketAccessKeysResponse -> GetBucketAccessKeysResponse -> Bool
== :: GetBucketAccessKeysResponse -> GetBucketAccessKeysResponse -> Bool
$c== :: GetBucketAccessKeysResponse -> GetBucketAccessKeysResponse -> Bool
Prelude.Eq, Int -> GetBucketAccessKeysResponse -> ShowS
[GetBucketAccessKeysResponse] -> ShowS
GetBucketAccessKeysResponse -> String
(Int -> GetBucketAccessKeysResponse -> ShowS)
-> (GetBucketAccessKeysResponse -> String)
-> ([GetBucketAccessKeysResponse] -> ShowS)
-> Show GetBucketAccessKeysResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetBucketAccessKeysResponse] -> ShowS
$cshowList :: [GetBucketAccessKeysResponse] -> ShowS
show :: GetBucketAccessKeysResponse -> String
$cshow :: GetBucketAccessKeysResponse -> String
showsPrec :: Int -> GetBucketAccessKeysResponse -> ShowS
$cshowsPrec :: Int -> GetBucketAccessKeysResponse -> ShowS
Prelude.Show, (forall x.
GetBucketAccessKeysResponse -> Rep GetBucketAccessKeysResponse x)
-> (forall x.
Rep GetBucketAccessKeysResponse x -> GetBucketAccessKeysResponse)
-> Generic GetBucketAccessKeysResponse
forall x.
Rep GetBucketAccessKeysResponse x -> GetBucketAccessKeysResponse
forall x.
GetBucketAccessKeysResponse -> Rep GetBucketAccessKeysResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetBucketAccessKeysResponse x -> GetBucketAccessKeysResponse
$cfrom :: forall x.
GetBucketAccessKeysResponse -> Rep GetBucketAccessKeysResponse x
Prelude.Generic)
newGetBucketAccessKeysResponse ::
Prelude.Int ->
GetBucketAccessKeysResponse
newGetBucketAccessKeysResponse :: Int -> GetBucketAccessKeysResponse
newGetBucketAccessKeysResponse Int
pHttpStatus_ =
GetBucketAccessKeysResponse' :: Maybe [AccessKey] -> Int -> GetBucketAccessKeysResponse
GetBucketAccessKeysResponse'
{ $sel:accessKeys:GetBucketAccessKeysResponse' :: Maybe [AccessKey]
accessKeys =
Maybe [AccessKey]
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetBucketAccessKeysResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getBucketAccessKeysResponse_accessKeys :: Lens.Lens' GetBucketAccessKeysResponse (Prelude.Maybe [AccessKey])
getBucketAccessKeysResponse_accessKeys :: (Maybe [AccessKey] -> f (Maybe [AccessKey]))
-> GetBucketAccessKeysResponse -> f GetBucketAccessKeysResponse
getBucketAccessKeysResponse_accessKeys = (GetBucketAccessKeysResponse -> Maybe [AccessKey])
-> (GetBucketAccessKeysResponse
-> Maybe [AccessKey] -> GetBucketAccessKeysResponse)
-> Lens
GetBucketAccessKeysResponse
GetBucketAccessKeysResponse
(Maybe [AccessKey])
(Maybe [AccessKey])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetBucketAccessKeysResponse' {Maybe [AccessKey]
accessKeys :: Maybe [AccessKey]
$sel:accessKeys:GetBucketAccessKeysResponse' :: GetBucketAccessKeysResponse -> Maybe [AccessKey]
accessKeys} -> Maybe [AccessKey]
accessKeys) (\s :: GetBucketAccessKeysResponse
s@GetBucketAccessKeysResponse' {} Maybe [AccessKey]
a -> GetBucketAccessKeysResponse
s {$sel:accessKeys:GetBucketAccessKeysResponse' :: Maybe [AccessKey]
accessKeys = Maybe [AccessKey]
a} :: GetBucketAccessKeysResponse) ((Maybe [AccessKey] -> f (Maybe [AccessKey]))
-> GetBucketAccessKeysResponse -> f GetBucketAccessKeysResponse)
-> ((Maybe [AccessKey] -> f (Maybe [AccessKey]))
-> Maybe [AccessKey] -> f (Maybe [AccessKey]))
-> (Maybe [AccessKey] -> f (Maybe [AccessKey]))
-> GetBucketAccessKeysResponse
-> f GetBucketAccessKeysResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [AccessKey] [AccessKey] [AccessKey] [AccessKey]
-> Iso
(Maybe [AccessKey])
(Maybe [AccessKey])
(Maybe [AccessKey])
(Maybe [AccessKey])
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 [AccessKey] [AccessKey] [AccessKey] [AccessKey]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
getBucketAccessKeysResponse_httpStatus :: Lens.Lens' GetBucketAccessKeysResponse Prelude.Int
getBucketAccessKeysResponse_httpStatus :: (Int -> f Int)
-> GetBucketAccessKeysResponse -> f GetBucketAccessKeysResponse
getBucketAccessKeysResponse_httpStatus = (GetBucketAccessKeysResponse -> Int)
-> (GetBucketAccessKeysResponse
-> Int -> GetBucketAccessKeysResponse)
-> Lens
GetBucketAccessKeysResponse GetBucketAccessKeysResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetBucketAccessKeysResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetBucketAccessKeysResponse' :: GetBucketAccessKeysResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetBucketAccessKeysResponse
s@GetBucketAccessKeysResponse' {} Int
a -> GetBucketAccessKeysResponse
s {$sel:httpStatus:GetBucketAccessKeysResponse' :: Int
httpStatus = Int
a} :: GetBucketAccessKeysResponse)
instance Prelude.NFData GetBucketAccessKeysResponse