Class: AWSCDK::SSM::CfnMaintenanceWindowTaskProps

Inherits:
Jsii::Struct
  • Object
show all
Defined in:
ssm/cfn_maintenance_window_task_props.rb

Overview

Properties for defining a CfnMaintenanceWindowTask.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(priority:, task_arn:, task_type:, window_id:, cutoff_behavior: nil, description: nil, logging_info: nil, max_concurrency: nil, max_errors: nil, name: nil, service_role_arn: nil, targets: nil, task_invocation_parameters: nil, task_parameters: nil) ⇒ CfnMaintenanceWindowTaskProps

Returns a new instance of CfnMaintenanceWindowTaskProps.

Parameters:

  • priority (Numeric)

    The priority of the task in the maintenance window.

  • task_arn (String)

    The resource that the task uses during execution.

  • task_type (String)

    The type of task.

  • window_id (String)

    The ID of the maintenance window where the task is registered.

  • cutoff_behavior (String, nil) (defaults to: nil)

    The specification for whether tasks should continue to run after the cutoff time specified in the maintenance windows is reached.

  • description (String, nil) (defaults to: nil)

    A description of the task.

  • logging_info (AWSCDK::IResolvable, AWSCDK::SSM::CfnMaintenanceWindowTask::LoggingInfoProperty, nil) (defaults to: nil)

    LoggingInfo has been deprecated.

  • max_concurrency (String, nil) (defaults to: nil)

    The maximum number of targets this task can be run for, in parallel.

  • max_errors (String, nil) (defaults to: nil)

    The maximum number of errors allowed before this task stops being scheduled.

  • name (String, nil) (defaults to: nil)

    The task name.

  • service_role_arn (String, nil) (defaults to: nil)

    The Amazon Resource Name (ARN) of the IAM service role for AWS Systems Manager to assume when running a maintenance window task.

  • targets (AWSCDK::IResolvable, Array<AWSCDK::IResolvable, AWSCDK::SSM::CfnMaintenanceWindowTask::TargetProperty>, nil) (defaults to: nil)

    The targets, either instances or window target IDs.

  • task_invocation_parameters (AWSCDK::IResolvable, AWSCDK::SSM::CfnMaintenanceWindowTask::TaskInvocationParametersProperty, nil) (defaults to: nil)

    The parameters to pass to the task when it runs.

  • task_parameters (Object, nil) (defaults to: nil)

    TaskParameters has been deprecated.



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'ssm/cfn_maintenance_window_task_props.rb', line 23

def initialize(priority:, task_arn:, task_type:, window_id:, cutoff_behavior: nil, description: nil, logging_info: nil, max_concurrency: nil, max_errors: nil, name: nil, service_role_arn: nil, targets: nil, task_invocation_parameters: nil, task_parameters: nil)
  @priority = priority
  Jsii::Type.check_type(@priority, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "priority")
  @task_arn = task_arn
  Jsii::Type.check_type(@task_arn, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "taskArn")
  @task_type = task_type
  Jsii::Type.check_type(@task_type, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "taskType")
  @window_id = window_id
  Jsii::Type.check_type(@window_id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "windowId")
  @cutoff_behavior = cutoff_behavior
  Jsii::Type.check_type(@cutoff_behavior, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "cutoffBehavior") unless @cutoff_behavior.nil?
  @description = description
  Jsii::Type.check_type(@description, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "description") unless @description.nil?
  @logging_info = logging_info.is_a?(Hash) ? ::AWSCDK::SSM::CfnMaintenanceWindowTask::LoggingInfoProperty.new(**logging_info.transform_keys(&:to_sym)) : logging_info
  Jsii::Type.check_type(@logging_info, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImZxbiI6ImF3cy1jZGstbGliLmF3c19zc20uQ2ZuTWFpbnRlbmFuY2VXaW5kb3dUYXNrLkxvZ2dpbmdJbmZvUHJvcGVydHkifV19fQ==")), "loggingInfo") unless @logging_info.nil?
  @max_concurrency = max_concurrency
  Jsii::Type.check_type(@max_concurrency, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "maxConcurrency") unless @max_concurrency.nil?
  @max_errors = max_errors
  Jsii::Type.check_type(@max_errors, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "maxErrors") unless @max_errors.nil?
  @name = name
  Jsii::Type.check_type(@name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "name") unless @name.nil?
  @service_role_arn = service_role_arn
  Jsii::Type.check_type(@service_role_arn, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "serviceRoleArn") unless @service_role_arn.nil?
  @targets = targets
  Jsii::Type.check_type(@targets, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImNvbGxlY3Rpb24iOnsiZWxlbWVudHR5cGUiOnsidW5pb24iOnsidHlwZXMiOlt7ImZxbiI6ImF3cy1jZGstbGliLklSZXNvbHZhYmxlIn0seyJmcW4iOiJhd3MtY2RrLWxpYi5hd3Nfc3NtLkNmbk1haW50ZW5hbmNlV2luZG93VGFzay5UYXJnZXRQcm9wZXJ0eSJ9XX19LCJraW5kIjoiYXJyYXkifX1dfX0=")), "targets") unless @targets.nil?
  @task_invocation_parameters = task_invocation_parameters.is_a?(Hash) ? ::AWSCDK::SSM::CfnMaintenanceWindowTask::TaskInvocationParametersProperty.new(**task_invocation_parameters.transform_keys(&:to_sym)) : task_invocation_parameters
  Jsii::Type.check_type(@task_invocation_parameters, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImZxbiI6ImF3cy1jZGstbGliLmF3c19zc20uQ2ZuTWFpbnRlbmFuY2VXaW5kb3dUYXNrLlRhc2tJbnZvY2F0aW9uUGFyYW1ldGVyc1Byb3BlcnR5In1dfX0=")), "taskInvocationParameters") unless @task_invocation_parameters.nil?
  @task_parameters = task_parameters
  Jsii::Type.check_type(@task_parameters, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJhbnkifQ==")), "taskParameters") unless @task_parameters.nil?
end

Instance Attribute Details

#cutoff_behaviorString? (readonly)

The specification for whether tasks should continue to run after the cutoff time specified in the maintenance windows is reached.



88
89
90
# File 'ssm/cfn_maintenance_window_task_props.rb', line 88

def cutoff_behavior
  @cutoff_behavior
end

#descriptionString? (readonly)

A description of the task.



93
94
95
# File 'ssm/cfn_maintenance_window_task_props.rb', line 93

def description
  @description
end

#logging_infoAWSCDK::IResolvable, ... (readonly)

LoggingInfo has been deprecated.

To specify an Amazon S3 bucket to contain logs for Run Command tasks, instead use the OutputS3BucketName and OutputS3KeyPrefix options in the TaskInvocationParameters structure. For information about how Systems Manager handles these options for the supported maintenance window task types, see AWS ::SSM::MaintenanceWindowTask MaintenanceWindowRunCommandParameters .

Information about an Amazon S3 bucket to write Run Command task-level logs to.



102
103
104
# File 'ssm/cfn_maintenance_window_task_props.rb', line 102

def logging_info
  @logging_info
end

#max_concurrencyString? (readonly)

The maximum number of targets this task can be run for, in parallel.

Although this element is listed as "Required: No", a value can be omitted only when you are registering or updating a targetless task You must provide a value in all other cases.

For maintenance window tasks without a target specified, you can't supply a value for this option. Instead, the system inserts a placeholder value of 1 . This value doesn't affect the running of your task.



111
112
113
# File 'ssm/cfn_maintenance_window_task_props.rb', line 111

def max_concurrency
  @max_concurrency
end

#max_errorsString? (readonly)

The maximum number of errors allowed before this task stops being scheduled.

Although this element is listed as "Required: No", a value can be omitted only when you are registering or updating a targetless task You must provide a value in all other cases.

For maintenance window tasks without a target specified, you can't supply a value for this option. Instead, the system inserts a placeholder value of 1 . This value doesn't affect the running of your task.



120
121
122
# File 'ssm/cfn_maintenance_window_task_props.rb', line 120

def max_errors
  @max_errors
end

#nameString? (readonly)

The task name.



125
126
127
# File 'ssm/cfn_maintenance_window_task_props.rb', line 125

def name
  @name
end

#priorityNumeric (readonly)

The priority of the task in the maintenance window.

The lower the number, the higher the priority. Tasks that have the same priority are scheduled in parallel.



60
61
62
# File 'ssm/cfn_maintenance_window_task_props.rb', line 60

def priority
  @priority
end

#service_role_arnString? (readonly)

The Amazon Resource Name (ARN) of the IAM service role for AWS Systems Manager to assume when running a maintenance window task.

If you do not specify a service role ARN, Systems Manager uses a service-linked role in your account. If no appropriate service-linked role for Systems Manager exists in your account, it is created when you run RegisterTaskWithMaintenanceWindow .

However, for an improved security posture, we strongly recommend creating a custom policy and custom service role for running your maintenance window tasks. The policy can be crafted to provide only the permissions needed for your particular maintenance window tasks. For more information, see Setting up Maintenance Windows in the in the AWS Systems Manager User Guide .



134
135
136
# File 'ssm/cfn_maintenance_window_task_props.rb', line 134

def service_role_arn
  @service_role_arn
end

#targetsAWSCDK::IResolvable, ... (readonly)

The targets, either instances or window target IDs.

  • Specify instances using Key=InstanceIds,Values= *instanceid1* , *instanceid2* .
  • Specify window target IDs using Key=WindowTargetIds,Values= *window-target-id-1* , *window-target-id-2* .


142
143
144
# File 'ssm/cfn_maintenance_window_task_props.rb', line 142

def targets
  @targets
end

#task_arnString (readonly)

The resource that the task uses during execution.

For RUN_COMMAND and AUTOMATION task types, TaskArn is the SSM document name or Amazon Resource Name (ARN).

For LAMBDA tasks, TaskArn is the function name or ARN.

For STEP_FUNCTIONS tasks, TaskArn is the state machine ARN.



71
72
73
# File 'ssm/cfn_maintenance_window_task_props.rb', line 71

def task_arn
  @task_arn
end

#task_invocation_parametersAWSCDK::IResolvable, ... (readonly)

The parameters to pass to the task when it runs.

Populate only the fields that match the task type. All other fields should be empty.

When you update a maintenance window task that has options specified in TaskInvocationParameters , you must provide again all the TaskInvocationParameters values that you want to retain. The values you do not specify again are removed. For example, suppose that when you registered a Run Command task, you specified TaskInvocationParameters values for Comment , NotificationConfig , and OutputS3BucketName . If you update the maintenance window task and specify only a different OutputS3BucketName value, the values for Comment and NotificationConfig are removed.



151
152
153
# File 'ssm/cfn_maintenance_window_task_props.rb', line 151

def task_invocation_parameters
  @task_invocation_parameters
end

#task_parametersObject? (readonly)

TaskParameters has been deprecated.

To specify parameters to pass to a task when it runs, instead use the Parameters option in the TaskInvocationParameters structure. For information about how Systems Manager handles these options for the supported maintenance window task types, see MaintenanceWindowTaskInvocationParameters .

The parameters to pass to the task when it runs.



160
161
162
# File 'ssm/cfn_maintenance_window_task_props.rb', line 160

def task_parameters
  @task_parameters
end

#task_typeString (readonly)

The type of task.

Valid values: RUN_COMMAND , AUTOMATION , LAMBDA , STEP_FUNCTIONS .



78
79
80
# File 'ssm/cfn_maintenance_window_task_props.rb', line 78

def task_type
  @task_type
end

#window_idString (readonly)

The ID of the maintenance window where the task is registered.



83
84
85
# File 'ssm/cfn_maintenance_window_task_props.rb', line 83

def window_id
  @window_id
end

Class Method Details

.jsii_propertiesObject



162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
# File 'ssm/cfn_maintenance_window_task_props.rb', line 162

def self.jsii_properties
  {
    :priority => "priority",
    :task_arn => "taskArn",
    :task_type => "taskType",
    :window_id => "windowId",
    :cutoff_behavior => "cutoffBehavior",
    :description => "description",
    :logging_info => "loggingInfo",
    :max_concurrency => "maxConcurrency",
    :max_errors => "maxErrors",
    :name => "name",
    :service_role_arn => "serviceRoleArn",
    :targets => "targets",
    :task_invocation_parameters => "taskInvocationParameters",
    :task_parameters => "taskParameters",
  }
end

Instance Method Details

#to_jsiiObject



181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
# File 'ssm/cfn_maintenance_window_task_props.rb', line 181

def to_jsii
  result = {}
  result.merge!({
    "priority" => @priority,
    "taskArn" => @task_arn,
    "taskType" => @task_type,
    "windowId" => @window_id,
    "cutoffBehavior" => @cutoff_behavior,
    "description" => @description,
    "loggingInfo" => @logging_info,
    "maxConcurrency" => @max_concurrency,
    "maxErrors" => @max_errors,
    "name" => @name,
    "serviceRoleArn" => @service_role_arn,
    "targets" => @targets,
    "taskInvocationParameters" => @task_invocation_parameters,
    "taskParameters" => @task_parameters,
  })
  result.compact
end