Skip to content

update_patch_baseline

update_patch_baseline(
    baseline_id: BaselineId,
    *,
    config_overrides: Optional[SSMClientConfig] = None,
    name: Optional[BaselineName] = None,
    global_filters: Optional[PatchFilterGroup] = None,
    approval_rules: Optional[PatchRuleGroup] = None,
    approved_patches: Optional[PatchIdList] = None,
    approved_patches_compliance_level: Optional[PatchComplianceLevel] = None,
    approved_patches_enable_non_security: Optional[Boolean] = None,
    rejected_patches: Optional[PatchIdList] = None,
    rejected_patches_action: Optional[PatchAction] = None,
    description: Optional[BaselineDescription] = None,
    sources: Optional[PatchSourceList] = None,
    available_security_updates_compliance_status: Optional[
        PatchComplianceStatus
    ] = None,
    replace: Optional[Boolean] = None,
) -> UpdatePatchBaselineResult

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

For information about valid key-value pairs in PatchFilters for each supported operating system type, see PatchFilter.

Parameters:

  • baseline_id (BaselineId) –

    The ID of the patch baseline to update.

  • name (Optional[BaselineName], default: None ) –

    The name of the patch baseline.

  • global_filters (Optional[PatchFilterGroup], default: None ) –

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

    The GlobalFilters parameter can be configured only by using the CLI or an Amazon Web Services SDK. It can't be configured from the Patch Manager console, and its value isn't displayed in the console.

  • approval_rules (Optional[PatchRuleGroup], default: None ) –

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

  • approved_patches (Optional[PatchIdList], default: None ) –

    A list of explicitly approved patches for the baseline.

    For information about accepted formats for lists of approved patches and rejected patches, see Package name formats for approved and rejected patch lists in the Amazon Web Services Systems Manager User Guide.

  • approved_patches_compliance_level (Optional[PatchComplianceLevel], default: None ) –

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

  • approved_patches_enable_non_security (Optional[Boolean], default: None ) –

    Indicates whether the list of approved patches includes non-security updates that should be applied to the managed nodes. The default value is false. Applies to Linux managed nodes only.

  • rejected_patches (Optional[PatchIdList], default: None ) –

    A list of explicitly rejected patches for the baseline.

    For information about accepted formats for lists of approved patches and rejected patches, see Package name formats for approved and rejected patch lists in the Amazon Web Services Systems Manager User Guide.

  • rejected_patches_action (Optional[PatchAction], default: None ) –

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

    ALLOW_AS_DEPENDENCY

    Linux and macOS: 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 INSTALLED_OTHER. This is the default action if no option is specified.

    Windows Server: Windows Server doesn't support the concept of package dependencies. If a package in the rejected patches list and already installed on the node, its status is reported as INSTALLED_OTHER. Any package not already installed on the node is skipped. This is the default action if no option is specified.

    BLOCK

    All OSs: Packages in the rejected patches list, and packages that include them as dependencies, aren't installed by Patch Manager under any circumstances.

    State value assignment for patch compliance:

    • If a package was installed before it was added to the rejected patches list, or is installed outside of Patch Manager afterward, it's considered noncompliant with the patch baseline and its status is reported as INSTALLED_REJECTED.

    • If an update attempts to install a dependency package that is now rejected by the baseline, when previous versions of the package were not rejected, the package being updated is reported as MISSING for SCAN operations and as FAILED for INSTALL operations.

  • description (Optional[BaselineDescription], default: None ) –

    A description of the patch baseline.

  • sources (Optional[PatchSourceList], default: None ) –

    Information about the patches to use to update the managed nodes, including target operating systems and source repositories. Applies to Linux managed nodes only.

  • available_security_updates_compliance_status (Optional[PatchComplianceStatus], default: None ) –

    Indicates the status to be assigned to security patches that are available but not approved because they don't meet the installation criteria specified in the patch baseline.

    Example scenario: Security patches that you might want installed can be skipped if you have specified a long period to wait after a patch is released before installation. If an update to the patch is released during your specified waiting period, the waiting period for installing the patch starts over. If the waiting period is too long, multiple versions of the patch could be released but never installed.

    Supported for Windows Server managed nodes only.

  • replace (Optional[Boolean], default: None ) –

    If True, then all fields that are required by the CreatePatchBaseline operation are also required for this API request. Optional fields that aren't specified are set to null.

Raises:

  • DoesNotExistException –

    Error returned when the ID specified for a resource, such as a maintenance window or patch baseline, doesn't exist.

    For information about resource quotas in Amazon Web Services Systems Manager, see Systems Manager service quotas in the Amazon Web Services General Reference.

  • InternalServerError –

    An error occurred on the server side.

  • UnknownServiceError –

    The service returned an error code this client does not model.

Source code in docs_src/capo_ssm/_services/ssm.py
def update_patch_baseline(
    self,
    baseline_id: "capo_ssm.types.baseline_id.BaselineId",
    *,
    config_overrides: Optional[SSMClientConfig] = None,
    name: Optional["capo_ssm.types.baseline_name.BaselineName"] = None,
    global_filters: Optional[
        "capo_ssm.types.patch_filter_group.PatchFilterGroup"
    ] = None,
    approval_rules: Optional[
        "capo_ssm.types.patch_rule_group.PatchRuleGroup"
    ] = None,
    approved_patches: Optional["capo_ssm.types.patch_id_list.PatchIdList"] = None,
    approved_patches_compliance_level: Optional[
        "capo_ssm.types.patch_compliance_level.PatchComplianceLevel"
    ] = None,
    approved_patches_enable_non_security: Optional[
        "capo_ssm.types.boolean.Boolean"
    ] = None,
    rejected_patches: Optional["capo_ssm.types.patch_id_list.PatchIdList"] = None,
    rejected_patches_action: Optional[
        "capo_ssm.types.patch_action.PatchAction"
    ] = None,
    description: Optional[
        "capo_ssm.types.baseline_description.BaselineDescription"
    ] = None,
    sources: Optional["capo_ssm.types.patch_source_list.PatchSourceList"] = None,
    available_security_updates_compliance_status: Optional[
        "capo_ssm.types.patch_compliance_status.PatchComplianceStatus"
    ] = None,
    replace: Optional["capo_ssm.types.boolean.Boolean"] = None,
) -> "capo_ssm.types.update_patch_baseline_result.UpdatePatchBaselineResult":
    """<p>Modifies an existing patch baseline. Fields not specified in the request are left unchanged.</p> <note> <p>For information about valid key-value pairs in <code>PatchFilters</code> for each supported operating system type, see <a>PatchFilter</a>.</p> </note>

    Args:
        baseline_id: <p>The ID of the patch baseline to update.</p>
        name: <p>The name of the patch baseline.</p>
        global_filters: <p>A set of global filters used to include patches in the baseline.</p> <important> <p>The <code>GlobalFilters</code> parameter can be configured only by using the CLI or an Amazon Web Services SDK. It can't be configured from the Patch Manager console, and its value isn't displayed in the console.</p> </important>
        approval_rules: <p>A set of rules used to include patches in the baseline.</p>
        approved_patches: <p>A list of explicitly approved patches for the baseline.</p> <p>For information about accepted formats for lists of approved patches and rejected patches, see <a href="https://docs.aws.amazon.com/systems-manager/latest/userguide/patch-manager-approved-rejected-package-name-formats.html">Package name formats for approved and rejected patch lists</a> in the <i>Amazon Web Services Systems Manager User Guide</i>.</p>
        approved_patches_compliance_level: <p>Assigns a new compliance severity level to an existing patch baseline.</p>
        approved_patches_enable_non_security: <p>Indicates whether the list of approved patches includes non-security updates that should be applied to the managed nodes. The default value is <code>false</code>. Applies to Linux managed nodes only.</p>
        rejected_patches: <p>A list of explicitly rejected patches for the baseline.</p> <p>For information about accepted formats for lists of approved patches and rejected patches, see <a href="https://docs.aws.amazon.com/systems-manager/latest/userguide/patch-manager-approved-rejected-package-name-formats.html">Package name formats for approved and rejected patch lists</a> in the <i>Amazon Web Services Systems Manager User Guide</i>.</p>
        rejected_patches_action: <p>The action for Patch Manager to take on patches included in the <code>RejectedPackages</code> list.</p> <dl> <dt>ALLOW_AS_DEPENDENCY</dt> <dd> <p> <b>Linux and macOS</b>: 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 <code>INSTALLED_OTHER</code>. This is the default action if no option is specified.</p> <p> <b>Windows Server</b>: Windows Server doesn't support the concept of package dependencies. If a package in the rejected patches list and already installed on the node, its status is reported as <code>INSTALLED_OTHER</code>. Any package not already installed on the node is skipped. This is the default action if no option is specified.</p> </dd> <dt>BLOCK</dt> <dd> <p> <b>All OSs</b>: Packages in the rejected patches list, and packages that include them as dependencies, aren't installed by Patch Manager under any circumstances. </p> <p>State value assignment for patch compliance:</p> <ul> <li> <p>If a package was installed before it was added to the rejected patches list, or is installed outside of Patch Manager afterward, it's considered noncompliant with the patch baseline and its status is reported as <code>INSTALLED_REJECTED</code>.</p> </li> <li> <p>If an update attempts to install a dependency package that is now rejected by the baseline, when previous versions of the package were not rejected, the package being updated is reported as <code>MISSING</code> for <code>SCAN</code> operations and as <code>FAILED</code> for <code>INSTALL</code> operations.</p> </li> </ul> </dd> </dl>
        description: <p>A description of the patch baseline.</p>
        sources: <p>Information about the patches to use to update the managed nodes, including target operating systems and source repositories. Applies to Linux managed nodes only.</p>
        available_security_updates_compliance_status: <p>Indicates the status to be assigned to security patches that are available but not approved because they don't meet the installation criteria specified in the patch baseline.</p> <p>Example scenario: Security patches that you might want installed can be skipped if you have specified a long period to wait after a patch is released before installation. If an update to the patch is released during your specified waiting period, the waiting period for installing the patch starts over. If the waiting period is too long, multiple versions of the patch could be released but never installed.</p> <p>Supported for Windows Server managed nodes only.</p>
        replace: <p>If True, then all fields that are required by the <a>CreatePatchBaseline</a> operation are also required for this API request. Optional fields that aren't specified are set to null.</p>

    Raises:
        capo_ssm.errors.does_not_exist_exception.DoesNotExistException: <p>Error returned when the ID specified for a resource, such as a maintenance window or patch baseline, doesn't exist.</p> <p>For information about resource quotas in Amazon Web Services Systems Manager, see <a href="https://docs.aws.amazon.com/general/latest/gr/ssm.html#limits_ssm">Systems Manager service quotas</a> in the <i>Amazon Web Services General Reference</i>.</p>
        capo_ssm.errors.internal_server_error.InternalServerError: <p>An error occurred on the server side.</p>
        capo_ssm.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_ssm.types.update_patch_baseline_request.UpdatePatchBaselineRequest]",
    ) -> OperationResponse[
        "capo_ssm.types.update_patch_baseline_result.UpdatePatchBaselineResult"
    ]:
        import capo_ssm._operations.amazon_ssm.update_patch_baseline

        output, http_response = (
            capo_ssm._operations.amazon_ssm.update_patch_baseline.update_patch_baseline(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    def _redact_input(
        input_: "capo_ssm.types.update_patch_baseline_request.UpdatePatchBaselineRequest",
    ) -> dict[str, Any]:
        import capo_ssm.types.update_patch_baseline_request

        return capo_ssm.types.update_patch_baseline_request.redact_sensitive(input_)

    def _redact_output(
        output: "capo_ssm.types.update_patch_baseline_result.UpdatePatchBaselineResult",
    ) -> dict[str, Any]:
        import capo_ssm.types.update_patch_baseline_result

        return capo_ssm.types.update_patch_baseline_result.redact_sensitive(output)

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging(
            "UpdatePatchBaseline",
            redact_input=_redact_input,
            redact_output=_redact_output,
        ),
    )
    input_: capo_ssm.types.update_patch_baseline_request.UpdatePatchBaselineRequest = {
        "baseline_id": baseline_id
    }
    if name is not None:
        input_["name"] = name
    if global_filters is not None:
        input_["global_filters"] = global_filters
    if approval_rules is not None:
        input_["approval_rules"] = approval_rules
    if approved_patches is not None:
        input_["approved_patches"] = approved_patches
    if approved_patches_compliance_level is not None:
        input_["approved_patches_compliance_level"] = (
            approved_patches_compliance_level
        )
    if approved_patches_enable_non_security is not None:
        input_["approved_patches_enable_non_security"] = (
            approved_patches_enable_non_security
        )
    if rejected_patches is not None:
        input_["rejected_patches"] = rejected_patches
    if rejected_patches_action is not None:
        input_["rejected_patches_action"] = rejected_patches_action
    if description is not None:
        input_["description"] = description
    if sources is not None:
        input_["sources"] = sources
    if available_security_updates_compliance_status is not None:
        input_["available_security_updates_compliance_status"] = (
            available_security_updates_compliance_status
        )
    if replace is not None:
        input_["replace"] = replace

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output