updateBranch method
- required String appId,
- required String branchName,
- Backend? backend,
- String? backendEnvironmentArn,
- String? basicAuthCredentials,
- String? buildSpec,
- String? computeRoleArn,
- String? description,
- String? displayName,
- bool? enableAutoBuild,
- bool? enableBasicAuth,
- bool? enableNotification,
- bool? enablePerformanceMode,
- bool? enablePullRequestPreview,
- bool? enableSkewProtection,
- Map<
String, String> ? environmentVariables, - String? framework,
- String? pullRequestEnvironmentName,
- Stage? stage,
- String? ttl,
Updates a branch for an Amplify app.
May throw BadRequestException.
May throw DependentServiceFailureException.
May throw InternalFailureException.
May throw NotFoundException.
May throw UnauthorizedException.
Parameter appId :
The unique ID for an Amplify app.
Parameter branchName :
The name of the branch.
Parameter backend :
The backend for a Branch of an Amplify app. Use for a backend
created from an CloudFormation stack.
This field is available to Amplify Gen 2 apps only. When you deploy an application with Amplify Gen 2, you provision the app's backend infrastructure using Typescript code.
Parameter backendEnvironmentArn :
The Amazon Resource Name (ARN) for a backend environment that is part of a
Gen 1 Amplify app.
This field is available to Amplify Gen 1 apps only where the backend is created using Amplify Studio or the Amplify command line interface (CLI).
Parameter basicAuthCredentials :
The basic authorization credentials for the branch. You must base64-encode
the authorization credentials and provide them in the format
user:password.
Parameter buildSpec :
The build specification (build spec) for the branch.
Parameter computeRoleArn :
The Amazon Resource Name (ARN) of the IAM role to assign to a branch of an
SSR app. The SSR Compute role allows the Amplify Hosting compute service
to securely access specific Amazon Web Services resources based on the
role's permissions. For more information about the SSR Compute role, see
Adding
an SSR Compute role in the Amplify User Guide.
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 enableSkewProtection :
Specifies whether the skew protection feature is enabled for the branch.
Deployment skew protection is available to Amplify applications to eliminate version skew issues between client and servers in web applications. When you apply skew protection to a branch, you can ensure that your clients always interact with the correct version of server-side assets, regardless of when a deployment occurs. For more information about skew protection, see Skew protection for Amplify deployments in the Amplify User Guide.
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,
Backend? backend,
String? backendEnvironmentArn,
String? basicAuthCredentials,
String? buildSpec,
String? computeRoleArn,
String? description,
String? displayName,
bool? enableAutoBuild,
bool? enableBasicAuth,
bool? enableNotification,
bool? enablePerformanceMode,
bool? enablePullRequestPreview,
bool? enableSkewProtection,
Map<String, String>? environmentVariables,
String? framework,
String? pullRequestEnvironmentName,
Stage? stage,
String? ttl,
}) async {
final $payload = <String, dynamic>{
if (backend != null) 'backend': backend,
if (backendEnvironmentArn != null)
'backendEnvironmentArn': backendEnvironmentArn,
if (basicAuthCredentials != null)
'basicAuthCredentials': basicAuthCredentials,
if (buildSpec != null) 'buildSpec': buildSpec,
if (computeRoleArn != null) 'computeRoleArn': computeRoleArn,
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 (enableSkewProtection != null)
'enableSkewProtection': enableSkewProtection,
if (environmentVariables != null)
'environmentVariables': environmentVariables,
if (framework != null) 'framework': framework,
if (pullRequestEnvironmentName != null)
'pullRequestEnvironmentName': pullRequestEnvironmentName,
if (stage != null) 'stage': stage.value,
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);
}