# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***

import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union
from .. import _utilities, _tables
from . import outputs
from ._inputs import *

__all__ = ['MaintenanceWindowTask']


class MaintenanceWindowTask(pulumi.CustomResource):
    def __init__(__self__,
                 resource_name: str,
                 opts: Optional[pulumi.ResourceOptions] = None,
                 description: Optional[pulumi.Input[str]] = None,
                 max_concurrency: Optional[pulumi.Input[str]] = None,
                 max_errors: Optional[pulumi.Input[str]] = None,
                 name: Optional[pulumi.Input[str]] = None,
                 priority: Optional[pulumi.Input[int]] = None,
                 service_role_arn: Optional[pulumi.Input[str]] = None,
                 targets: Optional[pulumi.Input[Sequence[pulumi.Input[pulumi.InputType['MaintenanceWindowTaskTargetArgs']]]]] = None,
                 task_arn: Optional[pulumi.Input[str]] = None,
                 task_invocation_parameters: Optional[pulumi.Input[pulumi.InputType['MaintenanceWindowTaskTaskInvocationParametersArgs']]] = None,
                 task_type: Optional[pulumi.Input[str]] = None,
                 window_id: Optional[pulumi.Input[str]] = None,
                 __props__=None,
                 __name__=None,
                 __opts__=None):
        """
        Provides an SSM Maintenance Window Task resource

        ## Example Usage
        ### Automation Tasks

        ```python
        import pulumi
        import pulumi_aws as aws

        example = aws.ssm.MaintenanceWindowTask("example",
            max_concurrency="2",
            max_errors="1",
            priority=1,
            service_role_arn=aws_iam_role["example"]["arn"],
            task_arn="AWS-RestartEC2Instance",
            task_type="AUTOMATION",
            window_id=aws_ssm_maintenance_window["example"]["id"],
            targets=[aws.ssm.MaintenanceWindowTaskTargetArgs(
                key="InstanceIds",
                values=[aws_instance["example"]["id"]],
            )],
            task_invocation_parameters=aws.ssm.MaintenanceWindowTaskTaskInvocationParametersArgs(
                automation_parameters=aws.ssm.MaintenanceWindowTaskTaskInvocationParametersAutomationParametersArgs(
                    document_version="$LATEST",
                    parameters=[aws.ssm.MaintenanceWindowTaskTaskInvocationParametersAutomationParametersParameterArgs(
                        name="InstanceId",
                        values=[aws_instance["example"]["id"]],
                    )],
                ),
            ))
        ```
        ### Run Command Tasks

        ```python
        import pulumi
        import pulumi_aws as aws

        example = aws.ssm.MaintenanceWindowTask("example",
            max_concurrency="2",
            max_errors="1",
            priority=1,
            service_role_arn=aws_iam_role["example"]["arn"],
            task_arn="AWS-RunShellScript",
            task_type="RUN_COMMAND",
            window_id=aws_ssm_maintenance_window["example"]["id"],
            targets=[aws.ssm.MaintenanceWindowTaskTargetArgs(
                key="InstanceIds",
                values=[aws_instance["example"]["id"]],
            )],
            task_invocation_parameters=aws.ssm.MaintenanceWindowTaskTaskInvocationParametersArgs(
                run_command_parameters=aws.ssm.MaintenanceWindowTaskTaskInvocationParametersRunCommandParametersArgs(
                    output_s3_bucket=aws_s3_bucket["example"]["bucket"],
                    output_s3_key_prefix="output",
                    service_role_arn=aws_iam_role["example"]["arn"],
                    timeout_seconds=600,
                    notification_config=aws.ssm.MaintenanceWindowTaskTaskInvocationParametersRunCommandParametersNotificationConfigArgs(
                        notification_arn=aws_sns_topic["example"]["arn"],
                        notification_events=["All"],
                        notification_type="Command",
                    ),
                    parameters=[aws.ssm.MaintenanceWindowTaskTaskInvocationParametersRunCommandParametersParameterArgs(
                        name="commands",
                        values=["date"],
                    )],
                ),
            ))
        ```
        ### Step Function Tasks

        ```python
        import pulumi
        import pulumi_aws as aws

        example = aws.ssm.MaintenanceWindowTask("example",
            max_concurrency="2",
            max_errors="1",
            priority=1,
            service_role_arn=aws_iam_role["example"]["arn"],
            task_arn=aws_sfn_activity["example"]["id"],
            task_type="STEP_FUNCTIONS",
            window_id=aws_ssm_maintenance_window["example"]["id"],
            targets=[aws.ssm.MaintenanceWindowTaskTargetArgs(
                key="InstanceIds",
                values=[aws_instance["example"]["id"]],
            )],
            task_invocation_parameters=aws.ssm.MaintenanceWindowTaskTaskInvocationParametersArgs(
                step_functions_parameters=aws.ssm.MaintenanceWindowTaskTaskInvocationParametersStepFunctionsParametersArgs(
                    input="{\"key1\":\"value1\"}",
                    name="example",
                ),
            ))
        ```

        ## Import

        AWS Maintenance Window Task can be imported using the `window_id` and `window_task_id` separated by `/`.

        ```sh
         $ pulumi import aws:ssm/maintenanceWindowTask:MaintenanceWindowTask task <window_id>/<window_task_id>
        ```

        :param str resource_name: The name of the resource.
        :param pulumi.ResourceOptions opts: Options for the resource.
        :param pulumi.Input[str] description: The description of the maintenance window task.
        :param pulumi.Input[str] max_concurrency: The maximum number of targets this task can be run for in parallel.
        :param pulumi.Input[str] max_errors: The maximum number of errors allowed before this task stops being scheduled.
        :param pulumi.Input[str] name: The name of the maintenance window task.
        :param pulumi.Input[int] priority: The priority of the task in the Maintenance Window, the lower the number the higher the priority. Tasks in a Maintenance Window are scheduled in priority order with tasks that have the same priority scheduled in parallel.
        :param pulumi.Input[str] service_role_arn: The role that should be assumed when executing the task.
        :param pulumi.Input[Sequence[pulumi.Input[pulumi.InputType['MaintenanceWindowTaskTargetArgs']]]] targets: The targets (either instances or window target ids). Instances are specified using Key=InstanceIds,Values=instanceid1,instanceid2. Window target ids are specified using Key=WindowTargetIds,Values=window target id1, window target id2.
        :param pulumi.Input[str] task_arn: The ARN of the task to execute.
        :param pulumi.Input[pulumi.InputType['MaintenanceWindowTaskTaskInvocationParametersArgs']] task_invocation_parameters: Configuration block with parameters for task execution.
        :param pulumi.Input[str] task_type: The type of task being registered. Valid values: `AUTOMATION`, `LAMBDA`, `RUN_COMMAND` or `STEP_FUNCTIONS`.
        :param pulumi.Input[str] window_id: The Id of the maintenance window to register the task with.
        """
        if __name__ is not None:
            warnings.warn("explicit use of __name__ is deprecated", DeprecationWarning)
            resource_name = __name__
        if __opts__ is not None:
            warnings.warn("explicit use of __opts__ is deprecated, use 'opts' instead", DeprecationWarning)
            opts = __opts__
        if opts is None:
            opts = pulumi.ResourceOptions()
        if not isinstance(opts, pulumi.ResourceOptions):
            raise TypeError('Expected resource options to be a ResourceOptions instance')
        if opts.version is None:
            opts.version = _utilities.get_version()
        if opts.id is None:
            if __props__ is not None:
                raise TypeError('__props__ is only valid when passed in combination with a valid opts.id to get an existing resource')
            __props__ = dict()

            __props__['description'] = description
            if max_concurrency is None and not opts.urn:
                raise TypeError("Missing required property 'max_concurrency'")
            __props__['max_concurrency'] = max_concurrency
            if max_errors is None and not opts.urn:
                raise TypeError("Missing required property 'max_errors'")
            __props__['max_errors'] = max_errors
            __props__['name'] = name
            __props__['priority'] = priority
            if service_role_arn is None and not opts.urn:
                raise TypeError("Missing required property 'service_role_arn'")
            __props__['service_role_arn'] = service_role_arn
            if targets is None and not opts.urn:
                raise TypeError("Missing required property 'targets'")
            __props__['targets'] = targets
            if task_arn is None and not opts.urn:
                raise TypeError("Missing required property 'task_arn'")
            __props__['task_arn'] = task_arn
            __props__['task_invocation_parameters'] = task_invocation_parameters
            if task_type is None and not opts.urn:
                raise TypeError("Missing required property 'task_type'")
            __props__['task_type'] = task_type
            if window_id is None and not opts.urn:
                raise TypeError("Missing required property 'window_id'")
            __props__['window_id'] = window_id
        super(MaintenanceWindowTask, __self__).__init__(
            'aws:ssm/maintenanceWindowTask:MaintenanceWindowTask',
            resource_name,
            __props__,
            opts)

    @staticmethod
    def get(resource_name: str,
            id: pulumi.Input[str],
            opts: Optional[pulumi.ResourceOptions] = None,
            description: Optional[pulumi.Input[str]] = None,
            max_concurrency: Optional[pulumi.Input[str]] = None,
            max_errors: Optional[pulumi.Input[str]] = None,
            name: Optional[pulumi.Input[str]] = None,
            priority: Optional[pulumi.Input[int]] = None,
            service_role_arn: Optional[pulumi.Input[str]] = None,
            targets: Optional[pulumi.Input[Sequence[pulumi.Input[pulumi.InputType['MaintenanceWindowTaskTargetArgs']]]]] = None,
            task_arn: Optional[pulumi.Input[str]] = None,
            task_invocation_parameters: Optional[pulumi.Input[pulumi.InputType['MaintenanceWindowTaskTaskInvocationParametersArgs']]] = None,
            task_type: Optional[pulumi.Input[str]] = None,
            window_id: Optional[pulumi.Input[str]] = None) -> 'MaintenanceWindowTask':
        """
        Get an existing MaintenanceWindowTask resource's state with the given name, id, and optional extra
        properties used to qualify the lookup.

        :param str resource_name: The unique name of the resulting resource.
        :param pulumi.Input[str] id: The unique provider ID of the resource to lookup.
        :param pulumi.ResourceOptions opts: Options for the resource.
        :param pulumi.Input[str] description: The description of the maintenance window task.
        :param pulumi.Input[str] max_concurrency: The maximum number of targets this task can be run for in parallel.
        :param pulumi.Input[str] max_errors: The maximum number of errors allowed before this task stops being scheduled.
        :param pulumi.Input[str] name: The name of the maintenance window task.
        :param pulumi.Input[int] priority: The priority of the task in the Maintenance Window, the lower the number the higher the priority. Tasks in a Maintenance Window are scheduled in priority order with tasks that have the same priority scheduled in parallel.
        :param pulumi.Input[str] service_role_arn: The role that should be assumed when executing the task.
        :param pulumi.Input[Sequence[pulumi.Input[pulumi.InputType['MaintenanceWindowTaskTargetArgs']]]] targets: The targets (either instances or window target ids). Instances are specified using Key=InstanceIds,Values=instanceid1,instanceid2. Window target ids are specified using Key=WindowTargetIds,Values=window target id1, window target id2.
        :param pulumi.Input[str] task_arn: The ARN of the task to execute.
        :param pulumi.Input[pulumi.InputType['MaintenanceWindowTaskTaskInvocationParametersArgs']] task_invocation_parameters: Configuration block with parameters for task execution.
        :param pulumi.Input[str] task_type: The type of task being registered. Valid values: `AUTOMATION`, `LAMBDA`, `RUN_COMMAND` or `STEP_FUNCTIONS`.
        :param pulumi.Input[str] window_id: The Id of the maintenance window to register the task with.
        """
        opts = pulumi.ResourceOptions.merge(opts, pulumi.ResourceOptions(id=id))

        __props__ = dict()

        __props__["description"] = description
        __props__["max_concurrency"] = max_concurrency
        __props__["max_errors"] = max_errors
        __props__["name"] = name
        __props__["priority"] = priority
        __props__["service_role_arn"] = service_role_arn
        __props__["targets"] = targets
        __props__["task_arn"] = task_arn
        __props__["task_invocation_parameters"] = task_invocation_parameters
        __props__["task_type"] = task_type
        __props__["window_id"] = window_id
        return MaintenanceWindowTask(resource_name, opts=opts, __props__=__props__)

    @property
    @pulumi.getter
    def description(self) -> pulumi.Output[Optional[str]]:
        """
        The description of the maintenance window task.
        """
        return pulumi.get(self, "description")

    @property
    @pulumi.getter(name="maxConcurrency")
    def max_concurrency(self) -> pulumi.Output[str]:
        """
        The maximum number of targets this task can be run for in parallel.
        """
        return pulumi.get(self, "max_concurrency")

    @property
    @pulumi.getter(name="maxErrors")
    def max_errors(self) -> pulumi.Output[str]:
        """
        The maximum number of errors allowed before this task stops being scheduled.
        """
        return pulumi.get(self, "max_errors")

    @property
    @pulumi.getter
    def name(self) -> pulumi.Output[str]:
        """
        The name of the maintenance window task.
        """
        return pulumi.get(self, "name")

    @property
    @pulumi.getter
    def priority(self) -> pulumi.Output[Optional[int]]:
        """
        The priority of the task in the Maintenance Window, the lower the number the higher the priority. Tasks in a Maintenance Window are scheduled in priority order with tasks that have the same priority scheduled in parallel.
        """
        return pulumi.get(self, "priority")

    @property
    @pulumi.getter(name="serviceRoleArn")
    def service_role_arn(self) -> pulumi.Output[str]:
        """
        The role that should be assumed when executing the task.
        """
        return pulumi.get(self, "service_role_arn")

    @property
    @pulumi.getter
    def targets(self) -> pulumi.Output[Sequence['outputs.MaintenanceWindowTaskTarget']]:
        """
        The targets (either instances or window target ids). Instances are specified using Key=InstanceIds,Values=instanceid1,instanceid2. Window target ids are specified using Key=WindowTargetIds,Values=window target id1, window target id2.
        """
        return pulumi.get(self, "targets")

    @property
    @pulumi.getter(name="taskArn")
    def task_arn(self) -> pulumi.Output[str]:
        """
        The ARN of the task to execute.
        """
        return pulumi.get(self, "task_arn")

    @property
    @pulumi.getter(name="taskInvocationParameters")
    def task_invocation_parameters(self) -> pulumi.Output[Optional['outputs.MaintenanceWindowTaskTaskInvocationParameters']]:
        """
        Configuration block with parameters for task execution.
        """
        return pulumi.get(self, "task_invocation_parameters")

    @property
    @pulumi.getter(name="taskType")
    def task_type(self) -> pulumi.Output[str]:
        """
        The type of task being registered. Valid values: `AUTOMATION`, `LAMBDA`, `RUN_COMMAND` or `STEP_FUNCTIONS`.
        """
        return pulumi.get(self, "task_type")

    @property
    @pulumi.getter(name="windowId")
    def window_id(self) -> pulumi.Output[str]:
        """
        The Id of the maintenance window to register the task with.
        """
        return pulumi.get(self, "window_id")

    def translate_output_property(self, prop):
        return _tables.CAMEL_TO_SNAKE_CASE_TABLE.get(prop) or prop

    def translate_input_property(self, prop):
        return _tables.SNAKE_TO_CAMEL_CASE_TABLE.get(prop) or prop

