updateDistribution method
- required String distributionName,
- CacheSettings? cacheBehaviorSettings,
- List<
CacheBehaviorPerPath> ? cacheBehaviors, - CacheBehavior? defaultCacheBehavior,
- bool? isEnabled,
- InputOrigin? origin,
Updates an existing Amazon Lightsail content delivery network (CDN) distribution.
Use this action to update the configuration of your existing distribution
May throw ServiceException. May throw InvalidInputException. May throw NotFoundException. May throw OperationFailureException. May throw AccessDeniedException. May throw UnauthenticatedException.
Parameter distributionName
:
The name of the distribution to update.
Use the GetDistributions
action to get a list of distribution
names that you can specify.
Parameter cacheBehaviorSettings
:
An object that describes the cache behavior settings for the distribution.
Parameter cacheBehaviors
:
An array of objects that describe the per-path cache behavior for the
distribution.
Parameter defaultCacheBehavior
:
An object that describes the default cache behavior for the distribution.
Parameter isEnabled
:
Indicates whether to enable the distribution.
Parameter origin
:
An object that describes the origin resource for the distribution, such as
a Lightsail instance or load balancer.
The distribution pulls, caches, and serves content from the origin.
Implementation
Future<UpdateDistributionResult> updateDistribution({
required String distributionName,
CacheSettings? cacheBehaviorSettings,
List<CacheBehaviorPerPath>? cacheBehaviors,
CacheBehavior? defaultCacheBehavior,
bool? isEnabled,
InputOrigin? origin,
}) async {
ArgumentError.checkNotNull(distributionName, 'distributionName');
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.1',
'X-Amz-Target': 'Lightsail_20161128.UpdateDistribution'
};
final jsonResponse = await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'distributionName': distributionName,
if (cacheBehaviorSettings != null)
'cacheBehaviorSettings': cacheBehaviorSettings,
if (cacheBehaviors != null) 'cacheBehaviors': cacheBehaviors,
if (defaultCacheBehavior != null)
'defaultCacheBehavior': defaultCacheBehavior,
if (isEnabled != null) 'isEnabled': isEnabled,
if (origin != null) 'origin': origin,
},
);
return UpdateDistributionResult.fromJson(jsonResponse.body);
}