{-# 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.GetBuckets
(
GetBuckets (..),
newGetBuckets,
getBuckets_bucketName,
getBuckets_includeConnectedResources,
getBuckets_pageToken,
GetBucketsResponse (..),
newGetBucketsResponse,
getBucketsResponse_nextPageToken,
getBucketsResponse_buckets,
getBucketsResponse_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 GetBuckets = GetBuckets'
{
GetBuckets -> Maybe Text
bucketName :: Prelude.Maybe Prelude.Text,
GetBuckets -> Maybe Bool
includeConnectedResources :: Prelude.Maybe Prelude.Bool,
GetBuckets -> Maybe Text
pageToken :: Prelude.Maybe Prelude.Text
}
deriving (GetBuckets -> GetBuckets -> Bool
(GetBuckets -> GetBuckets -> Bool)
-> (GetBuckets -> GetBuckets -> Bool) -> Eq GetBuckets
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetBuckets -> GetBuckets -> Bool
$c/= :: GetBuckets -> GetBuckets -> Bool
== :: GetBuckets -> GetBuckets -> Bool
$c== :: GetBuckets -> GetBuckets -> Bool
Prelude.Eq, ReadPrec [GetBuckets]
ReadPrec GetBuckets
Int -> ReadS GetBuckets
ReadS [GetBuckets]
(Int -> ReadS GetBuckets)
-> ReadS [GetBuckets]
-> ReadPrec GetBuckets
-> ReadPrec [GetBuckets]
-> Read GetBuckets
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetBuckets]
$creadListPrec :: ReadPrec [GetBuckets]
readPrec :: ReadPrec GetBuckets
$creadPrec :: ReadPrec GetBuckets
readList :: ReadS [GetBuckets]
$creadList :: ReadS [GetBuckets]
readsPrec :: Int -> ReadS GetBuckets
$creadsPrec :: Int -> ReadS GetBuckets
Prelude.Read, Int -> GetBuckets -> ShowS
[GetBuckets] -> ShowS
GetBuckets -> String
(Int -> GetBuckets -> ShowS)
-> (GetBuckets -> String)
-> ([GetBuckets] -> ShowS)
-> Show GetBuckets
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetBuckets] -> ShowS
$cshowList :: [GetBuckets] -> ShowS
show :: GetBuckets -> String
$cshow :: GetBuckets -> String
showsPrec :: Int -> GetBuckets -> ShowS
$cshowsPrec :: Int -> GetBuckets -> ShowS
Prelude.Show, (forall x. GetBuckets -> Rep GetBuckets x)
-> (forall x. Rep GetBuckets x -> GetBuckets) -> Generic GetBuckets
forall x. Rep GetBuckets x -> GetBuckets
forall x. GetBuckets -> Rep GetBuckets x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetBuckets x -> GetBuckets
$cfrom :: forall x. GetBuckets -> Rep GetBuckets x
Prelude.Generic)
newGetBuckets ::
GetBuckets
newGetBuckets :: GetBuckets
newGetBuckets =
GetBuckets' :: Maybe Text -> Maybe Bool -> Maybe Text -> GetBuckets
GetBuckets'
{ $sel:bucketName:GetBuckets' :: Maybe Text
bucketName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:includeConnectedResources:GetBuckets' :: Maybe Bool
includeConnectedResources = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
$sel:pageToken:GetBuckets' :: Maybe Text
pageToken = Maybe Text
forall a. Maybe a
Prelude.Nothing
}
getBuckets_bucketName :: Lens.Lens' GetBuckets (Prelude.Maybe Prelude.Text)
getBuckets_bucketName :: (Maybe Text -> f (Maybe Text)) -> GetBuckets -> f GetBuckets
getBuckets_bucketName = (GetBuckets -> Maybe Text)
-> (GetBuckets -> Maybe Text -> GetBuckets)
-> Lens GetBuckets GetBuckets (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetBuckets' {Maybe Text
bucketName :: Maybe Text
$sel:bucketName:GetBuckets' :: GetBuckets -> Maybe Text
bucketName} -> Maybe Text
bucketName) (\s :: GetBuckets
s@GetBuckets' {} Maybe Text
a -> GetBuckets
s {$sel:bucketName:GetBuckets' :: Maybe Text
bucketName = Maybe Text
a} :: GetBuckets)
getBuckets_includeConnectedResources :: Lens.Lens' GetBuckets (Prelude.Maybe Prelude.Bool)
getBuckets_includeConnectedResources :: (Maybe Bool -> f (Maybe Bool)) -> GetBuckets -> f GetBuckets
getBuckets_includeConnectedResources = (GetBuckets -> Maybe Bool)
-> (GetBuckets -> Maybe Bool -> GetBuckets)
-> Lens GetBuckets GetBuckets (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetBuckets' {Maybe Bool
includeConnectedResources :: Maybe Bool
$sel:includeConnectedResources:GetBuckets' :: GetBuckets -> Maybe Bool
includeConnectedResources} -> Maybe Bool
includeConnectedResources) (\s :: GetBuckets
s@GetBuckets' {} Maybe Bool
a -> GetBuckets
s {$sel:includeConnectedResources:GetBuckets' :: Maybe Bool
includeConnectedResources = Maybe Bool
a} :: GetBuckets)
getBuckets_pageToken :: Lens.Lens' GetBuckets (Prelude.Maybe Prelude.Text)
getBuckets_pageToken :: (Maybe Text -> f (Maybe Text)) -> GetBuckets -> f GetBuckets
getBuckets_pageToken = (GetBuckets -> Maybe Text)
-> (GetBuckets -> Maybe Text -> GetBuckets)
-> Lens GetBuckets GetBuckets (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetBuckets' {Maybe Text
pageToken :: Maybe Text
$sel:pageToken:GetBuckets' :: GetBuckets -> Maybe Text
pageToken} -> Maybe Text
pageToken) (\s :: GetBuckets
s@GetBuckets' {} Maybe Text
a -> GetBuckets
s {$sel:pageToken:GetBuckets' :: Maybe Text
pageToken = Maybe Text
a} :: GetBuckets)
instance Core.AWSRequest GetBuckets where
type AWSResponse GetBuckets = GetBucketsResponse
request :: GetBuckets -> Request GetBuckets
request = Service -> GetBuckets -> Request GetBuckets
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy GetBuckets
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetBuckets)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetBuckets))
-> Logger
-> Service
-> Proxy GetBuckets
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetBuckets)))
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 Text -> Maybe [Bucket] -> Int -> GetBucketsResponse
GetBucketsResponse'
(Maybe Text -> Maybe [Bucket] -> Int -> GetBucketsResponse)
-> Either String (Maybe Text)
-> Either String (Maybe [Bucket] -> Int -> GetBucketsResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"nextPageToken")
Either String (Maybe [Bucket] -> Int -> GetBucketsResponse)
-> Either String (Maybe [Bucket])
-> Either String (Int -> GetBucketsResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe (Maybe [Bucket]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"buckets" Either String (Maybe (Maybe [Bucket]))
-> Maybe [Bucket] -> Either String (Maybe [Bucket])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [Bucket]
forall a. Monoid a => a
Prelude.mempty)
Either String (Int -> GetBucketsResponse)
-> Either String Int -> Either String GetBucketsResponse
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 GetBuckets
instance Prelude.NFData GetBuckets
instance Core.ToHeaders GetBuckets where
toHeaders :: GetBuckets -> ResponseHeaders
toHeaders =
ResponseHeaders -> GetBuckets -> 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.GetBuckets" ::
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 GetBuckets where
toJSON :: GetBuckets -> Value
toJSON GetBuckets' {Maybe Bool
Maybe Text
pageToken :: Maybe Text
includeConnectedResources :: Maybe Bool
bucketName :: Maybe Text
$sel:pageToken:GetBuckets' :: GetBuckets -> Maybe Text
$sel:includeConnectedResources:GetBuckets' :: GetBuckets -> Maybe Bool
$sel:bucketName:GetBuckets' :: GetBuckets -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"bucketName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
bucketName,
(Text
"includeConnectedResources" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
includeConnectedResources,
(Text
"pageToken" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
pageToken
]
)
instance Core.ToPath GetBuckets where
toPath :: GetBuckets -> ByteString
toPath = ByteString -> GetBuckets -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery GetBuckets where
toQuery :: GetBuckets -> QueryString
toQuery = QueryString -> GetBuckets -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data GetBucketsResponse = GetBucketsResponse'
{
GetBucketsResponse -> Maybe Text
nextPageToken :: Prelude.Maybe Prelude.Text,
GetBucketsResponse -> Maybe [Bucket]
buckets :: Prelude.Maybe [Bucket],
GetBucketsResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetBucketsResponse -> GetBucketsResponse -> Bool
(GetBucketsResponse -> GetBucketsResponse -> Bool)
-> (GetBucketsResponse -> GetBucketsResponse -> Bool)
-> Eq GetBucketsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetBucketsResponse -> GetBucketsResponse -> Bool
$c/= :: GetBucketsResponse -> GetBucketsResponse -> Bool
== :: GetBucketsResponse -> GetBucketsResponse -> Bool
$c== :: GetBucketsResponse -> GetBucketsResponse -> Bool
Prelude.Eq, ReadPrec [GetBucketsResponse]
ReadPrec GetBucketsResponse
Int -> ReadS GetBucketsResponse
ReadS [GetBucketsResponse]
(Int -> ReadS GetBucketsResponse)
-> ReadS [GetBucketsResponse]
-> ReadPrec GetBucketsResponse
-> ReadPrec [GetBucketsResponse]
-> Read GetBucketsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetBucketsResponse]
$creadListPrec :: ReadPrec [GetBucketsResponse]
readPrec :: ReadPrec GetBucketsResponse
$creadPrec :: ReadPrec GetBucketsResponse
readList :: ReadS [GetBucketsResponse]
$creadList :: ReadS [GetBucketsResponse]
readsPrec :: Int -> ReadS GetBucketsResponse
$creadsPrec :: Int -> ReadS GetBucketsResponse
Prelude.Read, Int -> GetBucketsResponse -> ShowS
[GetBucketsResponse] -> ShowS
GetBucketsResponse -> String
(Int -> GetBucketsResponse -> ShowS)
-> (GetBucketsResponse -> String)
-> ([GetBucketsResponse] -> ShowS)
-> Show GetBucketsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetBucketsResponse] -> ShowS
$cshowList :: [GetBucketsResponse] -> ShowS
show :: GetBucketsResponse -> String
$cshow :: GetBucketsResponse -> String
showsPrec :: Int -> GetBucketsResponse -> ShowS
$cshowsPrec :: Int -> GetBucketsResponse -> ShowS
Prelude.Show, (forall x. GetBucketsResponse -> Rep GetBucketsResponse x)
-> (forall x. Rep GetBucketsResponse x -> GetBucketsResponse)
-> Generic GetBucketsResponse
forall x. Rep GetBucketsResponse x -> GetBucketsResponse
forall x. GetBucketsResponse -> Rep GetBucketsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetBucketsResponse x -> GetBucketsResponse
$cfrom :: forall x. GetBucketsResponse -> Rep GetBucketsResponse x
Prelude.Generic)
newGetBucketsResponse ::
Prelude.Int ->
GetBucketsResponse
newGetBucketsResponse :: Int -> GetBucketsResponse
newGetBucketsResponse Int
pHttpStatus_ =
GetBucketsResponse' :: Maybe Text -> Maybe [Bucket] -> Int -> GetBucketsResponse
GetBucketsResponse'
{ $sel:nextPageToken:GetBucketsResponse' :: Maybe Text
nextPageToken =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:buckets:GetBucketsResponse' :: Maybe [Bucket]
buckets = Maybe [Bucket]
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetBucketsResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getBucketsResponse_nextPageToken :: Lens.Lens' GetBucketsResponse (Prelude.Maybe Prelude.Text)
getBucketsResponse_nextPageToken :: (Maybe Text -> f (Maybe Text))
-> GetBucketsResponse -> f GetBucketsResponse
getBucketsResponse_nextPageToken = (GetBucketsResponse -> Maybe Text)
-> (GetBucketsResponse -> Maybe Text -> GetBucketsResponse)
-> Lens
GetBucketsResponse GetBucketsResponse (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetBucketsResponse' {Maybe Text
nextPageToken :: Maybe Text
$sel:nextPageToken:GetBucketsResponse' :: GetBucketsResponse -> Maybe Text
nextPageToken} -> Maybe Text
nextPageToken) (\s :: GetBucketsResponse
s@GetBucketsResponse' {} Maybe Text
a -> GetBucketsResponse
s {$sel:nextPageToken:GetBucketsResponse' :: Maybe Text
nextPageToken = Maybe Text
a} :: GetBucketsResponse)
getBucketsResponse_buckets :: Lens.Lens' GetBucketsResponse (Prelude.Maybe [Bucket])
getBucketsResponse_buckets :: (Maybe [Bucket] -> f (Maybe [Bucket]))
-> GetBucketsResponse -> f GetBucketsResponse
getBucketsResponse_buckets = (GetBucketsResponse -> Maybe [Bucket])
-> (GetBucketsResponse -> Maybe [Bucket] -> GetBucketsResponse)
-> Lens
GetBucketsResponse
GetBucketsResponse
(Maybe [Bucket])
(Maybe [Bucket])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetBucketsResponse' {Maybe [Bucket]
buckets :: Maybe [Bucket]
$sel:buckets:GetBucketsResponse' :: GetBucketsResponse -> Maybe [Bucket]
buckets} -> Maybe [Bucket]
buckets) (\s :: GetBucketsResponse
s@GetBucketsResponse' {} Maybe [Bucket]
a -> GetBucketsResponse
s {$sel:buckets:GetBucketsResponse' :: Maybe [Bucket]
buckets = Maybe [Bucket]
a} :: GetBucketsResponse) ((Maybe [Bucket] -> f (Maybe [Bucket]))
-> GetBucketsResponse -> f GetBucketsResponse)
-> ((Maybe [Bucket] -> f (Maybe [Bucket]))
-> Maybe [Bucket] -> f (Maybe [Bucket]))
-> (Maybe [Bucket] -> f (Maybe [Bucket]))
-> GetBucketsResponse
-> f GetBucketsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Bucket] [Bucket] [Bucket] [Bucket]
-> Iso
(Maybe [Bucket]) (Maybe [Bucket]) (Maybe [Bucket]) (Maybe [Bucket])
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 [Bucket] [Bucket] [Bucket] [Bucket]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
getBucketsResponse_httpStatus :: Lens.Lens' GetBucketsResponse Prelude.Int
getBucketsResponse_httpStatus :: (Int -> f Int) -> GetBucketsResponse -> f GetBucketsResponse
getBucketsResponse_httpStatus = (GetBucketsResponse -> Int)
-> (GetBucketsResponse -> Int -> GetBucketsResponse)
-> Lens GetBucketsResponse GetBucketsResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetBucketsResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetBucketsResponse' :: GetBucketsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetBucketsResponse
s@GetBucketsResponse' {} Int
a -> GetBucketsResponse
s {$sel:httpStatus:GetBucketsResponse' :: Int
httpStatus = Int
a} :: GetBucketsResponse)
instance Prelude.NFData GetBucketsResponse