Package com.pulumi.aws.redshift
Class ScheduledAction
- java.lang.Object
-
- com.pulumi.resources.Resource
-
- com.pulumi.resources.CustomResource
-
- com.pulumi.aws.redshift.ScheduledAction
-
public class ScheduledAction extends com.pulumi.resources.CustomResource
## Example Usage ### Pause Cluster Action <!--Start PulumiCodeChooser -->package generated_program; import com.pulumi.Context; import com.pulumi.Pulumi; import com.pulumi.core.Output; import com.pulumi.aws.iam.IamFunctions; import com.pulumi.aws.iam.inputs.GetPolicyDocumentArgs; import com.pulumi.aws.iam.Role; import com.pulumi.aws.iam.RoleArgs; import com.pulumi.aws.iam.Policy; import com.pulumi.aws.iam.PolicyArgs; import com.pulumi.aws.iam.RolePolicyAttachment; import com.pulumi.aws.iam.RolePolicyAttachmentArgs; import com.pulumi.aws.redshift.ScheduledAction; import com.pulumi.aws.redshift.ScheduledActionArgs; import com.pulumi.aws.redshift.inputs.ScheduledActionTargetActionArgs; import com.pulumi.aws.redshift.inputs.ScheduledActionTargetActionPauseClusterArgs; import java.util.List; import java.util.ArrayList; import java.util.Map; import java.io.File; import java.nio.file.Files; import java.nio.file.Paths; public class App { public static void main(String[] args) { Pulumi.run(App::stack); } public static void stack(Context ctx) { final var assumeRole = IamFunctions.getPolicyDocument(GetPolicyDocumentArgs.builder() .statements(GetPolicyDocumentStatementArgs.builder() .effect("Allow") .principals(GetPolicyDocumentStatementPrincipalArgs.builder() .type("Service") .identifiers("scheduler.redshift.amazonaws.com") .build()) .actions("sts:AssumeRole") .build()) .build()); var exampleRole = new Role("exampleRole", RoleArgs.builder() .name("redshift_scheduled_action") .assumeRolePolicy(assumeRole.applyValue(getPolicyDocumentResult -> getPolicyDocumentResult.json())) .build()); final var example = IamFunctions.getPolicyDocument(GetPolicyDocumentArgs.builder() .statements(GetPolicyDocumentStatementArgs.builder() .effect("Allow") .actions( "redshift:PauseCluster", "redshift:ResumeCluster", "redshift:ResizeCluster") .resources("*") .build()) .build()); var examplePolicy = new Policy("examplePolicy", PolicyArgs.builder() .name("redshift_scheduled_action") .policy(example.applyValue(getPolicyDocumentResult -> getPolicyDocumentResult.json())) .build()); var exampleRolePolicyAttachment = new RolePolicyAttachment("exampleRolePolicyAttachment", RolePolicyAttachmentArgs.builder() .policyArn(examplePolicy.arn()) .role(exampleRole.name()) .build()); var exampleScheduledAction = new ScheduledAction("exampleScheduledAction", ScheduledActionArgs.builder() .name("tf-redshift-scheduled-action") .schedule("cron(00 23 * * ? *)") .iamRole(exampleRole.arn()) .targetAction(ScheduledActionTargetActionArgs.builder() .pauseCluster(ScheduledActionTargetActionPauseClusterArgs.builder() .clusterIdentifier("tf-redshift001") .build()) .build()) .build()); } }
package generated_program; import com.pulumi.Context; import com.pulumi.Pulumi; import com.pulumi.core.Output; import com.pulumi.aws.redshift.ScheduledAction; import com.pulumi.aws.redshift.ScheduledActionArgs; import com.pulumi.aws.redshift.inputs.ScheduledActionTargetActionArgs; import com.pulumi.aws.redshift.inputs.ScheduledActionTargetActionResizeClusterArgs; import java.util.List; import java.util.ArrayList; import java.util.Map; import java.io.File; import java.nio.file.Files; import java.nio.file.Paths; public class App { public static void main(String[] args) { Pulumi.run(App::stack); } public static void stack(Context ctx) { var example = new ScheduledAction("example", ScheduledActionArgs.builder() .name("tf-redshift-scheduled-action") .schedule("cron(00 23 * * ? *)") .iamRole(exampleAwsIamRole.arn()) .targetAction(ScheduledActionTargetActionArgs.builder() .resizeCluster(ScheduledActionTargetActionResizeClusterArgs.builder() .clusterIdentifier("tf-redshift001") .clusterType("multi-node") .nodeType("dc1.large") .numberOfNodes(2) .build()) .build()) .build()); } }
-
-
Constructor Summary
Constructors Constructor Description ScheduledAction(java.lang.String name)
ScheduledAction(java.lang.String name, ScheduledActionArgs args)
ScheduledAction(java.lang.String name, ScheduledActionArgs args, com.pulumi.resources.CustomResourceOptions options)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description com.pulumi.core.Output<java.util.Optional<java.lang.String>>
description()
com.pulumi.core.Output<java.util.Optional<java.lang.Boolean>>
enable()
com.pulumi.core.Output<java.util.Optional<java.lang.String>>
endTime()
static ScheduledAction
get(java.lang.String name, com.pulumi.core.Output<java.lang.String> id, ScheduledActionState state, com.pulumi.resources.CustomResourceOptions options)
Get an existing Host resource's state with the given name, ID, and optional extra properties used to qualify the lookup.com.pulumi.core.Output<java.lang.String>
iamRole()
com.pulumi.core.Output<java.lang.String>
name()
com.pulumi.core.Output<java.lang.String>
schedule()
com.pulumi.core.Output<java.util.Optional<java.lang.String>>
startTime()
com.pulumi.core.Output<ScheduledActionTargetAction>
targetAction()
-
-
-
Constructor Detail
-
ScheduledAction
public ScheduledAction(java.lang.String name)
- Parameters:
name
- The _unique_ name of the resulting resource.
-
ScheduledAction
public ScheduledAction(java.lang.String name, ScheduledActionArgs args)
- Parameters:
name
- The _unique_ name of the resulting resource.args
- The arguments to use to populate this resource's properties.
-
ScheduledAction
public ScheduledAction(java.lang.String name, ScheduledActionArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options)
- Parameters:
name
- The _unique_ name of the resulting resource.args
- The arguments to use to populate this resource's properties.options
- A bag of options that control this resource's behavior.
-
-
Method Detail
-
description
public com.pulumi.core.Output<java.util.Optional<java.lang.String>> description()
- Returns:
- The description of the scheduled action.
-
enable
public com.pulumi.core.Output<java.util.Optional<java.lang.Boolean>> enable()
- Returns:
- Whether to enable the scheduled action. Default is `true` .
-
endTime
public com.pulumi.core.Output<java.util.Optional<java.lang.String>> endTime()
- Returns:
- The end time in UTC when the schedule is active, in UTC RFC3339 format(for example, YYYY-MM-DDTHH:MM:SSZ).
-
iamRole
public com.pulumi.core.Output<java.lang.String> iamRole()
- Returns:
- The IAM role to assume to run the scheduled action.
-
name
public com.pulumi.core.Output<java.lang.String> name()
- Returns:
- The scheduled action name.
-
schedule
public com.pulumi.core.Output<java.lang.String> schedule()
- Returns:
- The schedule of action. The schedule is defined format of "at expression" or "cron expression", for example `at(2016-03-04T17:27:00)` or `cron(0 10 ? * MON *)`. See [Scheduled Action](https://docs.aws.amazon.com/redshift/latest/APIReference/API_ScheduledAction.html) for more information.
-
startTime
public com.pulumi.core.Output<java.util.Optional<java.lang.String>> startTime()
- Returns:
- The start time in UTC when the schedule is active, in UTC RFC3339 format(for example, YYYY-MM-DDTHH:MM:SSZ).
-
targetAction
public com.pulumi.core.Output<ScheduledActionTargetAction> targetAction()
- Returns:
- Target action. Documented below.
-
get
public static ScheduledAction get(java.lang.String name, com.pulumi.core.Output<java.lang.String> id, @Nullable ScheduledActionState state, @Nullable com.pulumi.resources.CustomResourceOptions options)
Get an existing Host resource's state with the given name, ID, and optional extra properties used to qualify the lookup.- Parameters:
name
- The _unique_ name of the resulting resource.id
- The _unique_ provider ID of the resource to lookup.state
-options
- Optional settings to control the behavior of the CustomResource.
-
-