updateDistribution method
- required String distributionName,
- CacheSettings? cacheBehaviorSettings,
- List<
CacheBehaviorPerPath> ? cacheBehaviors, - String? certificateName,
- CacheBehavior? defaultCacheBehavior,
- bool? isEnabled,
- InputOrigin? origin,
- bool? useDefaultCertificate,
- ViewerMinimumTlsProtocolVersionEnum? viewerMinimumTlsProtocolVersion,
Updates an existing Amazon Lightsail content delivery network (CDN) distribution.
Use this action to update the configuration of your existing distribution.
May throw AccessDeniedException.
May throw InvalidInputException.
May throw NotFoundException.
May throw OperationFailureException.
May throw ServiceException.
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 certificateName :
The name of the SSL/TLS certificate that you want to attach to the
distribution.
Only certificates with a status of ISSUED can be attached to
a distribution.
Use the GetCertificates action to get a list of certificate names that you can specify.
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, bucket, or load balancer.
The distribution pulls, caches, and serves content from the origin.
Parameter useDefaultCertificate :
Indicates whether the default SSL/TLS certificate is attached to the
distribution. The default value is true. When
true, the distribution uses the default domain name such as
d111111abcdef8.cloudfront.net.
Set this value to false to attach a new certificate to the
distribution.
Parameter viewerMinimumTlsProtocolVersion :
Use this parameter to update the minimum TLS protocol version for the
SSL/TLS certificate that's attached to the distribution.
Implementation
Future<UpdateDistributionResult> updateDistribution({
required String distributionName,
CacheSettings? cacheBehaviorSettings,
List<CacheBehaviorPerPath>? cacheBehaviors,
String? certificateName,
CacheBehavior? defaultCacheBehavior,
bool? isEnabled,
InputOrigin? origin,
bool? useDefaultCertificate,
ViewerMinimumTlsProtocolVersionEnum? viewerMinimumTlsProtocolVersion,
}) async {
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 (certificateName != null) 'certificateName': certificateName,
if (defaultCacheBehavior != null)
'defaultCacheBehavior': defaultCacheBehavior,
if (isEnabled != null) 'isEnabled': isEnabled,
if (origin != null) 'origin': origin,
if (useDefaultCertificate != null)
'useDefaultCertificate': useDefaultCertificate,
if (viewerMinimumTlsProtocolVersion != null)
'viewerMinimumTlsProtocolVersion':
viewerMinimumTlsProtocolVersion.value,
},
);
return UpdateDistributionResult.fromJson(jsonResponse.body);
}