setResourceAccessForBucket method
Sets the Amazon Lightsail resources that can access the specified Lightsail bucket.
Lightsail buckets currently support setting access for Lightsail instances in the same Amazon Web Services Region.
May throw AccessDeniedException.
May throw InvalidInputException.
May throw NotFoundException.
May throw RegionSetupInProgressException.
May throw ServiceException.
May throw UnauthenticatedException.
Parameter access :
The access setting.
The following access settings are available:
-
allow- Allows access to the bucket and its objects. -
deny- Denies access to the bucket and its objects. Use this setting to remove access for a resource previously set toallow.
Parameter bucketName :
The name of the bucket for which to set access to another Lightsail
resource.
Parameter resourceName :
The name of the Lightsail instance for which to set bucket access. The
instance must be in a running or stopped state.
Implementation
Future<SetResourceAccessForBucketResult> setResourceAccessForBucket({
required ResourceBucketAccess access,
required String bucketName,
required String resourceName,
}) async {
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.1',
'X-Amz-Target': 'Lightsail_20161128.SetResourceAccessForBucket'
};
final jsonResponse = await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'access': access.value,
'bucketName': bucketName,
'resourceName': resourceName,
},
);
return SetResourceAccessForBucketResult.fromJson(jsonResponse.body);
}