createBucketAccessKey method

Future<CreateBucketAccessKeyResult> createBucketAccessKey({
  1. required String bucketName,
})

Creates a new access key for the specified Amazon Lightsail bucket. Access keys consist of an access key ID and corresponding secret access key.

Access keys grant full programmatic access to the specified bucket and its objects. You can have a maximum of two access keys per bucket. Use the GetBucketAccessKeys action to get a list of current access keys for a specific bucket. For more information about access keys, see Creating access keys for a bucket in Amazon Lightsail in the Amazon Lightsail Developer Guide.

May throw AccessDeniedException. May throw InvalidInputException. May throw NotFoundException. May throw RegionSetupInProgressException. May throw ServiceException. May throw UnauthenticatedException.

Parameter bucketName : The name of the bucket that the new access key will belong to, and grant access to.

Implementation

Future<CreateBucketAccessKeyResult> createBucketAccessKey({
  required String bucketName,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'Lightsail_20161128.CreateBucketAccessKey'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'bucketName': bucketName,
    },
  );

  return CreateBucketAccessKeyResult.fromJson(jsonResponse.body);
}