Returns information about one or more Amazon Lightsail buckets. The information returned includes the synchronization status of the Amazon Simple Storage Service (Amazon S3) account-level block public access feature for your Lightsail buckets.
For more information about buckets, see Buckets in Amazon Lightsail in the Amazon Lightsail Developer Guide.
Parameters:
-
bucket_name
(Optional[BucketName], default:
None
)
–
The name of the bucket for which to return information.
When omitted, the response includes all of your buckets in the Amazon Web Services Region where the request is made.
-
page_token
(Optional[string], default:
None
)
–
The token to advance to the next page of results from your request.
To get a page token, perform an initial GetBuckets request. If your results are paginated, the response will return a next page token that you can specify as the page token in a subsequent request.
-
include_connected_resources
(Optional[boolean], default:
None
)
–
A Boolean value that indicates whether to include Lightsail instances that were given access to the bucket using the SetResourceAccessForBucket action.
-
include_cors
(Optional[boolean], default:
None
)
–
A Boolean value that indicates whether to include Lightsail bucket CORS configuration in the response. For more information, see Configuring cross-origin resource sharing (CORS).
This parameter is only supported when getting a single bucket with bucketName specified. The default value for this parameter is False.
Raises:
-
AccessDeniedException
–
Lightsail throws this exception when the user cannot be authenticated or uses invalid credentials to access a resource.
-
InvalidInputException
–
Lightsail throws this exception when user input does not conform to the validation rules of an input field.
Domain and distribution APIs are only available in the N. Virginia (us-east-1) Amazon Web Services Region. Please set your Amazon Web Services Region configuration to us-east-1 to create, view, or edit these resources.
-
NotFoundException
–
Lightsail throws this exception when it cannot find a resource.
-
RegionSetupInProgressException
–
Lightsail throws this exception when an operation is performed on resources in an opt-in Region that is currently being set up.
-
ServiceException
–
A general service exception.
-
UnauthenticatedException
–
Lightsail throws this exception when the user has not been authenticated.
-
UnknownServiceError
–
The service returned an error code this client does not model.
Source code in docs_src/capo_lightsail/_services/async_lightsail.py
| async def get_buckets(
self,
*,
config_overrides: Optional[AsyncLightsailClientConfig] = None,
bucket_name: Optional["capo_lightsail.types.bucket_name.BucketName"] = None,
page_token: Optional["capo_lightsail.types.string.string"] = None,
include_connected_resources: Optional[
"capo_lightsail.types.boolean.boolean"
] = None,
include_cors: Optional["capo_lightsail.types.boolean.boolean"] = None,
) -> "capo_lightsail.types.get_buckets_result.GetBucketsResult":
"""<p>Returns information about one or more Amazon Lightsail buckets. The information returned includes the synchronization status of the Amazon Simple Storage Service (Amazon S3) account-level block public access feature for your Lightsail buckets.</p> <p>For more information about buckets, see <a href="https://docs.aws.amazon.com/lightsail/latest/userguide/buckets-in-amazon-lightsail">Buckets in Amazon Lightsail</a> in the <i>Amazon Lightsail Developer Guide</i>.</p>
Args:
bucket_name: <p>The name of the bucket for which to return information.</p> <p>When omitted, the response includes all of your buckets in the Amazon Web Services Region where the request is made.</p>
page_token: <p>The token to advance to the next page of results from your request.</p> <p>To get a page token, perform an initial <code>GetBuckets</code> request. If your results are paginated, the response will return a next page token that you can specify as the page token in a subsequent request.</p>
include_connected_resources: <p>A Boolean value that indicates whether to include Lightsail instances that were given access to the bucket using the <a href="https://docs.aws.amazon.com/lightsail/2016-11-28/api-reference/API_SetResourceAccessForBucket.html">SetResourceAccessForBucket</a> action.</p>
include_cors: <p>A Boolean value that indicates whether to include Lightsail bucket CORS configuration in the response. For more information, see <a href="https://docs.aws.amazon.com/lightsail/latest/userguide/configure-cors.html">Configuring cross-origin resource sharing (CORS)</a>.</p> <note> <p>This parameter is only supported when getting a single bucket with <code>bucketName</code> specified. The default value for this parameter is <code>False</code>.</p> </note>
Raises:
capo_lightsail.errors.access_denied_exception.AccessDeniedException: <p>Lightsail throws this exception when the user cannot be authenticated or uses invalid credentials to access a resource.</p>
capo_lightsail.errors.invalid_input_exception.InvalidInputException: <p>Lightsail throws this exception when user input does not conform to the validation rules of an input field.</p> <note> <p>Domain and distribution APIs are only available in the N. Virginia (<code>us-east-1</code>) Amazon Web Services Region. Please set your Amazon Web Services Region configuration to <code>us-east-1</code> to create, view, or edit these resources.</p> </note>
capo_lightsail.errors.not_found_exception.NotFoundException: <p>Lightsail throws this exception when it cannot find a resource.</p>
capo_lightsail.errors.region_setup_in_progress_exception.RegionSetupInProgressException: <p>Lightsail throws this exception when an operation is performed on resources in an opt-in Region that is currently being set up.</p>
capo_lightsail.errors.service_exception.ServiceException: <p>A general service exception.</p>
capo_lightsail.errors.unauthenticated_exception.UnauthenticatedException: <p>Lightsail throws this exception when the user has not been authenticated.</p>
capo_lightsail.errors.UnknownServiceError: The service returned an error code this client does not model.
"""
async def _handler(
req: "AsyncOperationRequest[capo_lightsail.types.get_buckets_request.GetBucketsRequest]",
) -> AsyncOperationResponse[
"capo_lightsail.types.get_buckets_result.GetBucketsResult"
]:
import capo_lightsail._operations.lightsail_20161128.get_buckets
(
output,
http_response,
) = await capo_lightsail._operations.lightsail_20161128.get_buckets.async_get_buckets(
req.options, req.input
)
return AsyncOperationResponse(output=output, response=http_response)
interceptors_, options_ = self.operation_options(
config_overrides, OperationLogging("GetBuckets")
)
input_: capo_lightsail.types.get_buckets_request.GetBucketsRequest = {}
if bucket_name is not None:
input_["bucket_name"] = bucket_name
if page_token is not None:
input_["page_token"] = page_token
if include_connected_resources is not None:
input_["include_connected_resources"] = include_connected_resources
if include_cors is not None:
input_["include_cors"] = include_cors
response = await aexecute_pipeline(
AsyncOperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
await response.response.aclose()
return response.output
|