updatePatchBaseline method

Future<UpdatePatchBaselineResult> updatePatchBaseline({
  1. required String baselineId,
  2. PatchRuleGroup? approvalRules,
  3. List<String>? approvedPatches,
  4. PatchComplianceLevel? approvedPatchesComplianceLevel,
  5. bool? approvedPatchesEnableNonSecurity,
  6. String? description,
  7. PatchFilterGroup? globalFilters,
  8. String? name,
  9. List<String>? rejectedPatches,
  10. PatchAction? rejectedPatchesAction,
  11. bool? replace,
  12. List<PatchSource>? sources,
})

Modifies an existing patch baseline. Fields not specified in the request are left unchanged.

May throw DoesNotExistException. May throw InternalServerError.

Parameter baselineId : The ID of the patch baseline to update.

Parameter approvalRules : A set of rules used to include patches in the baseline.

Parameter approvedPatches : A list of explicitly approved patches for the baseline.

For information about accepted formats for lists of approved patches and rejected patches, see About package name formats for approved and rejected patch lists in the AWS Systems Manager User Guide.

Parameter approvedPatchesComplianceLevel : Assigns a new compliance severity level to an existing patch baseline.

Parameter approvedPatchesEnableNonSecurity : Indicates whether the list of approved patches includes non-security updates that should be applied to the instances. The default value is 'false'. Applies to Linux instances only.

Parameter description : A description of the patch baseline.

Parameter globalFilters : A set of global filters used to include patches in the baseline.

Parameter name : The name of the patch baseline.

Parameter rejectedPatches : A list of explicitly rejected patches for the baseline.

For information about accepted formats for lists of approved patches and rejected patches, see About package name formats for approved and rejected patch lists in the AWS Systems Manager User Guide.

Parameter rejectedPatchesAction : The action for Patch Manager to take on patches included in the RejectedPackages list.

  • ALLOW_AS_DEPENDENCY: A package in the Rejected patches list is installed only if it is a dependency of another package. It is considered compliant with the patch baseline, and its status is reported as InstalledOther. This is the default action if no option is specified.
  • BLOCK: Packages in the RejectedPatches list, and packages that include them as dependencies, are not installed under any circumstances. If a package was installed before it was added to the Rejected patches list, it is considered non-compliant with the patch baseline, and its status is reported as InstalledRejected.

Parameter replace : If True, then all fields that are required by the CreatePatchBaseline action are also required for this API request. Optional fields that are not specified are set to null.

Parameter sources : Information about the patches to use to update the instances, including target operating systems and source repositories. Applies to Linux instances only.

Implementation

Future<UpdatePatchBaselineResult> updatePatchBaseline({
  required String baselineId,
  PatchRuleGroup? approvalRules,
  List<String>? approvedPatches,
  PatchComplianceLevel? approvedPatchesComplianceLevel,
  bool? approvedPatchesEnableNonSecurity,
  String? description,
  PatchFilterGroup? globalFilters,
  String? name,
  List<String>? rejectedPatches,
  PatchAction? rejectedPatchesAction,
  bool? replace,
  List<PatchSource>? sources,
}) async {
  ArgumentError.checkNotNull(baselineId, 'baselineId');
  _s.validateStringLength(
    'baselineId',
    baselineId,
    20,
    128,
    isRequired: true,
  );
  _s.validateStringLength(
    'description',
    description,
    1,
    1024,
  );
  _s.validateStringLength(
    'name',
    name,
    3,
    128,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'AmazonSSM.UpdatePatchBaseline'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'BaselineId': baselineId,
      if (approvalRules != null) 'ApprovalRules': approvalRules,
      if (approvedPatches != null) 'ApprovedPatches': approvedPatches,
      if (approvedPatchesComplianceLevel != null)
        'ApprovedPatchesComplianceLevel':
            approvedPatchesComplianceLevel.toValue(),
      if (approvedPatchesEnableNonSecurity != null)
        'ApprovedPatchesEnableNonSecurity': approvedPatchesEnableNonSecurity,
      if (description != null) 'Description': description,
      if (globalFilters != null) 'GlobalFilters': globalFilters,
      if (name != null) 'Name': name,
      if (rejectedPatches != null) 'RejectedPatches': rejectedPatches,
      if (rejectedPatchesAction != null)
        'RejectedPatchesAction': rejectedPatchesAction.toValue(),
      if (replace != null) 'Replace': replace,
      if (sources != null) 'Sources': sources,
    },
  );

  return UpdatePatchBaselineResult.fromJson(jsonResponse.body);
}