Skip to content

update_maintenance_window_target

update_maintenance_window_target(
    window_id: MaintenanceWindowId,
    window_target_id: MaintenanceWindowTargetId,
    *,
    config_overrides: Optional[SSMClientConfig] = None,
    targets: Optional[Targets] = None,
    owner_information: Optional[OwnerInformation] = None,
    name: Optional[MaintenanceWindowName] = None,
    description: Optional[MaintenanceWindowDescription] = None,
    replace: Optional[Boolean] = None,
) -> UpdateMaintenanceWindowTargetResult

Modifies the target of an existing maintenance window. You can change the following:

  • Name

  • Description

  • Owner

  • IDs for an ID target

  • Tags for a Tag target

  • From any supported tag type to another. The three supported tag types are ID target, Tag target, and resource group. For more information, see Target.

If a parameter is null, then the corresponding field isn't modified.

Parameters:

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_maintenance_window_target(
    self,
    window_id: "capo_ssm.types.maintenance_window_id.MaintenanceWindowId",
    window_target_id: "capo_ssm.types.maintenance_window_target_id.MaintenanceWindowTargetId",
    *,
    config_overrides: Optional[SSMClientConfig] = None,
    targets: Optional["capo_ssm.types.targets.Targets"] = None,
    owner_information: Optional[
        "capo_ssm.types.owner_information.OwnerInformation"
    ] = None,
    name: Optional[
        "capo_ssm.types.maintenance_window_name.MaintenanceWindowName"
    ] = None,
    description: Optional[
        "capo_ssm.types.maintenance_window_description.MaintenanceWindowDescription"
    ] = None,
    replace: Optional["capo_ssm.types.boolean.Boolean"] = None,
) -> "capo_ssm.types.update_maintenance_window_target_result.UpdateMaintenanceWindowTargetResult":
    """<p>Modifies the target of an existing maintenance window. You can change the following:</p> <ul> <li> <p>Name</p> </li> <li> <p>Description</p> </li> <li> <p>Owner</p> </li> <li> <p>IDs for an ID target</p> </li> <li> <p>Tags for a Tag target</p> </li> <li> <p>From any supported tag type to another. The three supported tag types are ID target, Tag target, and resource group. For more information, see <a>Target</a>.</p> </li> </ul> <note> <p>If a parameter is null, then the corresponding field isn't modified.</p> </note>

    Args:
        window_id: <p>The maintenance window ID with which to modify the target.</p>
        window_target_id: <p>The target ID to modify.</p>
        targets: <p>The targets to add or replace.</p>
        owner_information: <p>User-provided value that will be included in any Amazon CloudWatch Events events raised while running tasks for these targets in this maintenance window.</p>
        name: <p>A name for the update.</p>
        description: <p>An optional description for the update.</p>
        replace: <p>If <code>True</code>, then all fields that are required by the <a>RegisterTargetWithMaintenanceWindow</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_maintenance_window_target_request.UpdateMaintenanceWindowTargetRequest]",
    ) -> OperationResponse[
        "capo_ssm.types.update_maintenance_window_target_result.UpdateMaintenanceWindowTargetResult"
    ]:
        import capo_ssm._operations.amazon_ssm.update_maintenance_window_target

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

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

        return capo_ssm.types.update_maintenance_window_target_request.redact_sensitive(
            input_
        )

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

        return (
            capo_ssm.types.update_maintenance_window_target_result.redact_sensitive(
                output
            )
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging(
            "UpdateMaintenanceWindowTarget",
            redact_input=_redact_input,
            redact_output=_redact_output,
        ),
    )
    input_: capo_ssm.types.update_maintenance_window_target_request.UpdateMaintenanceWindowTargetRequest = {
        "window_id": window_id,
        "window_target_id": window_target_id,
    }
    if targets is not None:
        input_["targets"] = targets
    if owner_information is not None:
        input_["owner_information"] = owner_information
    if name is not None:
        input_["name"] = name
    if description is not None:
        input_["description"] = description
    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