updateLayer method

Future<void> updateLayer({
  1. required String layerId,
  2. Map<LayerAttributesKeys, String>? attributes,
  3. bool? autoAssignElasticIps,
  4. bool? autoAssignPublicIps,
  5. CloudWatchLogsConfiguration? cloudWatchLogsConfiguration,
  6. String? customInstanceProfileArn,
  7. String? customJson,
  8. Recipes? customRecipes,
  9. List<String>? customSecurityGroupIds,
  10. bool? enableAutoHealing,
  11. bool? installUpdatesOnBoot,
  12. LifecycleEventConfiguration? lifecycleEventConfiguration,
  13. String? name,
  14. List<String>? packages,
  15. String? shortname,
  16. bool? useEbsOptimizedInstances,
  17. List<VolumeConfiguration>? volumeConfigurations,
})

Updates a specified layer.

Required Permissions: To use this action, an IAM user must have a 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 layerId : The layer ID.

Parameter attributes : One or more user-defined key/value pairs to be added to the stack attributes.

Parameter autoAssignElasticIps : Whether to automatically assign an Elastic IP address to the layer's instances. For more information, see How to Edit a Layer.

Parameter autoAssignPublicIps : For stacks that are running in a VPC, whether to automatically assign a public IP address to the layer's instances. For more information, see How to Edit a Layer.

Parameter cloudWatchLogsConfiguration : Specifies CloudWatch Logs configuration options for the layer. For more information, see CloudWatchLogsLogStream.

Parameter customInstanceProfileArn : The ARN of an IAM profile to be used for all of the layer's EC2 instances. For more information about IAM ARNs, see Using Identifiers.

Parameter customJson : A JSON-formatted string containing custom stack configuration and deployment attributes to be installed on the layer's instances. For more information, see Using Custom JSON.

Parameter customRecipes : A LayerCustomRecipes object that specifies the layer's custom recipes.

Parameter customSecurityGroupIds : An array containing the layer's custom security group IDs.

Parameter enableAutoHealing : Whether to disable auto healing for the layer.

Parameter installUpdatesOnBoot : Whether to install operating system and package updates when the instance boots. The default value is true. To control when updates are installed, set this value to false. You must then update your instances manually by using CreateDeployment to run the update_dependencies stack command or manually running yum (Amazon Linux) or apt-get (Ubuntu) on the instances.

Parameter lifecycleEventConfiguration :

Parameter name : The layer name, which is used by the console.

Parameter packages : An array of Package objects that describe the layer's packages.

Parameter shortname : For custom layers only, use this parameter to specify the layer's short name, which is used internally by AWS OpsWorks Stacks and by Chef. The short name is also used as the name for the directory where your app files are installed. It can have a maximum of 200 characters and must be in the following format: /\Aa-z0-9\-\_\.+\Z/.

The built-in layers' short names are defined by AWS OpsWorks Stacks. For more information, see the Layer Reference

Parameter useEbsOptimizedInstances : Whether to use Amazon EBS-optimized instances.

Parameter volumeConfigurations : A VolumeConfigurations object that describes the layer's Amazon EBS volumes.

Implementation

Future<void> updateLayer({
  required String layerId,
  Map<LayerAttributesKeys, String>? attributes,
  bool? autoAssignElasticIps,
  bool? autoAssignPublicIps,
  CloudWatchLogsConfiguration? cloudWatchLogsConfiguration,
  String? customInstanceProfileArn,
  String? customJson,
  Recipes? customRecipes,
  List<String>? customSecurityGroupIds,
  bool? enableAutoHealing,
  bool? installUpdatesOnBoot,
  LifecycleEventConfiguration? lifecycleEventConfiguration,
  String? name,
  List<String>? packages,
  String? shortname,
  bool? useEbsOptimizedInstances,
  List<VolumeConfiguration>? volumeConfigurations,
}) async {
  ArgumentError.checkNotNull(layerId, 'layerId');
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'OpsWorks_20130218.UpdateLayer'
  };
  await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'LayerId': layerId,
      if (attributes != null)
        'Attributes': attributes.map((k, e) => MapEntry(k.toValue(), e)),
      if (autoAssignElasticIps != null)
        'AutoAssignElasticIps': autoAssignElasticIps,
      if (autoAssignPublicIps != null)
        'AutoAssignPublicIps': autoAssignPublicIps,
      if (cloudWatchLogsConfiguration != null)
        'CloudWatchLogsConfiguration': cloudWatchLogsConfiguration,
      if (customInstanceProfileArn != null)
        'CustomInstanceProfileArn': customInstanceProfileArn,
      if (customJson != null) 'CustomJson': customJson,
      if (customRecipes != null) 'CustomRecipes': customRecipes,
      if (customSecurityGroupIds != null)
        'CustomSecurityGroupIds': customSecurityGroupIds,
      if (enableAutoHealing != null) 'EnableAutoHealing': enableAutoHealing,
      if (installUpdatesOnBoot != null)
        'InstallUpdatesOnBoot': installUpdatesOnBoot,
      if (lifecycleEventConfiguration != null)
        'LifecycleEventConfiguration': lifecycleEventConfiguration,
      if (name != null) 'Name': name,
      if (packages != null) 'Packages': packages,
      if (shortname != null) 'Shortname': shortname,
      if (useEbsOptimizedInstances != null)
        'UseEbsOptimizedInstances': useEbsOptimizedInstances,
      if (volumeConfigurations != null)
        'VolumeConfigurations': volumeConfigurations,
    },
  );
}