updateBranch method
- required String appId,
- required String branchName,
- String? backendEnvironmentArn,
- String? basicAuthCredentials,
- String? buildSpec,
- String? description,
- String? displayName,
- bool? enableAutoBuild,
- bool? enableBasicAuth,
- bool? enableNotification,
- bool? enablePerformanceMode,
- bool? enablePullRequestPreview,
- Map<
String, String> ? environmentVariables, - String? framework,
- String? pullRequestEnvironmentName,
- Stage? stage,
- String? ttl,
Updates a branch for an Amplify app.
May throw BadRequestException. May throw UnauthorizedException. May throw NotFoundException. May throw InternalFailureException. May throw DependentServiceFailureException.
Parameter appId
:
The unique ID for an Amplify app.
Parameter branchName
:
The name for the branch.
Parameter backendEnvironmentArn
:
The Amazon Resource Name (ARN) for a backend environment that is part of
an Amplify app.
Parameter basicAuthCredentials
:
The basic authorization credentials for the branch.
Parameter buildSpec
:
The build specification (build spec) for the branch.
Parameter description
:
The description for the branch.
Parameter displayName
:
The display name for a branch. This is used as the default domain prefix.
Parameter enableAutoBuild
:
Enables auto building for the branch.
Parameter enableBasicAuth
:
Enables basic authorization for the branch.
Parameter enableNotification
:
Enables notifications for the branch.
Parameter enablePerformanceMode
:
Enables performance mode for the branch.
Performance mode optimizes for faster hosting performance by keeping content cached at the edge for a longer interval. When performance mode is enabled, hosting configuration or code changes can take up to 10 minutes to roll out.
Parameter enablePullRequestPreview
:
Enables pull request previews for this branch.
Parameter environmentVariables
:
The environment variables for the branch.
Parameter framework
:
The framework for the branch.
Parameter pullRequestEnvironmentName
:
The Amplify environment name for the pull request.
Parameter stage
:
Describes the current stage for the branch.
Parameter ttl
:
The content Time to Live (TTL) for the website in seconds.
Implementation
Future<UpdateBranchResult> updateBranch({
required String appId,
required String branchName,
String? backendEnvironmentArn,
String? basicAuthCredentials,
String? buildSpec,
String? description,
String? displayName,
bool? enableAutoBuild,
bool? enableBasicAuth,
bool? enableNotification,
bool? enablePerformanceMode,
bool? enablePullRequestPreview,
Map<String, String>? environmentVariables,
String? framework,
String? pullRequestEnvironmentName,
Stage? stage,
String? ttl,
}) async {
ArgumentError.checkNotNull(appId, 'appId');
_s.validateStringLength(
'appId',
appId,
1,
20,
isRequired: true,
);
ArgumentError.checkNotNull(branchName, 'branchName');
_s.validateStringLength(
'branchName',
branchName,
1,
255,
isRequired: true,
);
_s.validateStringLength(
'backendEnvironmentArn',
backendEnvironmentArn,
1,
1000,
);
_s.validateStringLength(
'basicAuthCredentials',
basicAuthCredentials,
0,
2000,
);
_s.validateStringLength(
'buildSpec',
buildSpec,
1,
25000,
);
_s.validateStringLength(
'description',
description,
0,
1000,
);
_s.validateStringLength(
'displayName',
displayName,
0,
255,
);
_s.validateStringLength(
'framework',
framework,
0,
255,
);
_s.validateStringLength(
'pullRequestEnvironmentName',
pullRequestEnvironmentName,
0,
20,
);
final $payload = <String, dynamic>{
if (backendEnvironmentArn != null)
'backendEnvironmentArn': backendEnvironmentArn,
if (basicAuthCredentials != null)
'basicAuthCredentials': basicAuthCredentials,
if (buildSpec != null) 'buildSpec': buildSpec,
if (description != null) 'description': description,
if (displayName != null) 'displayName': displayName,
if (enableAutoBuild != null) 'enableAutoBuild': enableAutoBuild,
if (enableBasicAuth != null) 'enableBasicAuth': enableBasicAuth,
if (enableNotification != null) 'enableNotification': enableNotification,
if (enablePerformanceMode != null)
'enablePerformanceMode': enablePerformanceMode,
if (enablePullRequestPreview != null)
'enablePullRequestPreview': enablePullRequestPreview,
if (environmentVariables != null)
'environmentVariables': environmentVariables,
if (framework != null) 'framework': framework,
if (pullRequestEnvironmentName != null)
'pullRequestEnvironmentName': pullRequestEnvironmentName,
if (stage != null) 'stage': stage.toValue(),
if (ttl != null) 'ttl': ttl,
};
final response = await _protocol.send(
payload: $payload,
method: 'POST',
requestUri:
'/apps/${Uri.encodeComponent(appId)}/branches/${Uri.encodeComponent(branchName)}',
exceptionFnMap: _exceptionFns,
);
return UpdateBranchResult.fromJson(response);
}