updateApp method
- required String appId,
- Source? appSource,
- Map<
AppAttributesKeys, String> ? attributes, - List<
DataSource> ? dataSources, - String? description,
- List<
String> ? domains, - bool? enableSsl,
- List<
EnvironmentVariable> ? environment, - String? name,
- SslConfiguration? sslConfiguration,
- AppType? type,
Updates a specified app.
Required Permissions: To use this action, an IAM user must have a Deploy or Manage permissions level for the stack, or an attached policy that explicitly grants permissions. For more information on user permissions, see Managing User Permissions.
May throw ValidationException. May throw ResourceNotFoundException.
Parameter appId
:
The app ID.
Parameter appSource
:
A Source
object that specifies the app repository.
Parameter attributes
:
One or more user-defined key/value pairs to be added to the stack
attributes.
Parameter dataSources
:
The app's data sources.
Parameter description
:
A description of the app.
Parameter domains
:
The app's virtual host settings, with multiple domains separated by
commas. For example: 'www.example.com, example.com'
Parameter enableSsl
:
Whether SSL is enabled for the app.
Parameter environment
:
An array of EnvironmentVariable
objects that specify
environment variables to be associated with the app. After you deploy the
app, these variables are defined on the associated app server
instances.For more information, see
Environment Variables.
There is no specific limit on the number of environment variables. However, the size of the associated data structure - which includes the variables' names, values, and protected flag values - cannot exceed 20 KB. This limit should accommodate most if not all use cases. Exceeding it will cause an exception with the message, "Environment: is too large (maximum is 20 KB)."
Parameter name
:
The app name.
Parameter sslConfiguration
:
An SslConfiguration
object with the SSL configuration.
Parameter type
:
The app type.
Implementation
Future<void> updateApp({
required String appId,
Source? appSource,
Map<AppAttributesKeys, String>? attributes,
List<DataSource>? dataSources,
String? description,
List<String>? domains,
bool? enableSsl,
List<EnvironmentVariable>? environment,
String? name,
SslConfiguration? sslConfiguration,
AppType? type,
}) async {
ArgumentError.checkNotNull(appId, 'appId');
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.1',
'X-Amz-Target': 'OpsWorks_20130218.UpdateApp'
};
await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'AppId': appId,
if (appSource != null) 'AppSource': appSource,
if (attributes != null)
'Attributes': attributes.map((k, e) => MapEntry(k.toValue(), e)),
if (dataSources != null) 'DataSources': dataSources,
if (description != null) 'Description': description,
if (domains != null) 'Domains': domains,
if (enableSsl != null) 'EnableSsl': enableSsl,
if (environment != null) 'Environment': environment,
if (name != null) 'Name': name,
if (sslConfiguration != null) 'SslConfiguration': sslConfiguration,
if (type != null) 'Type': type.toValue(),
},
);
}