github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/glue/workflow.go (about)

     1  // Code generated by the Pulumi Terraform Bridge (tfgen) Tool DO NOT EDIT.
     2  // *** WARNING: Do not edit by hand unless you're certain you know what you are doing! ***
     3  
     4  package glue
     5  
     6  import (
     7  	"context"
     8  	"reflect"
     9  
    10  	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/internal"
    11  	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    12  )
    13  
    14  // Provides a Glue Workflow resource.
    15  // The workflow graph (DAG) can be build using the `glue.Trigger` resource.
    16  // See the example below for creating a graph with four nodes (two triggers and two jobs).
    17  //
    18  // ## Example Usage
    19  //
    20  // <!--Start PulumiCodeChooser -->
    21  // ```go
    22  // package main
    23  //
    24  // import (
    25  //
    26  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/glue"
    27  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    28  //
    29  // )
    30  //
    31  //	func main() {
    32  //		pulumi.Run(func(ctx *pulumi.Context) error {
    33  //			example, err := glue.NewWorkflow(ctx, "example", &glue.WorkflowArgs{
    34  //				Name: pulumi.String("example"),
    35  //			})
    36  //			if err != nil {
    37  //				return err
    38  //			}
    39  //			_, err = glue.NewTrigger(ctx, "example-start", &glue.TriggerArgs{
    40  //				Name:         pulumi.String("trigger-start"),
    41  //				Type:         pulumi.String("ON_DEMAND"),
    42  //				WorkflowName: example.Name,
    43  //				Actions: glue.TriggerActionArray{
    44  //					&glue.TriggerActionArgs{
    45  //						JobName: pulumi.String("example-job"),
    46  //					},
    47  //				},
    48  //			})
    49  //			if err != nil {
    50  //				return err
    51  //			}
    52  //			_, err = glue.NewTrigger(ctx, "example-inner", &glue.TriggerArgs{
    53  //				Name:         pulumi.String("trigger-inner"),
    54  //				Type:         pulumi.String("CONDITIONAL"),
    55  //				WorkflowName: example.Name,
    56  //				Predicate: &glue.TriggerPredicateArgs{
    57  //					Conditions: glue.TriggerPredicateConditionArray{
    58  //						&glue.TriggerPredicateConditionArgs{
    59  //							JobName: pulumi.String("example-job"),
    60  //							State:   pulumi.String("SUCCEEDED"),
    61  //						},
    62  //					},
    63  //				},
    64  //				Actions: glue.TriggerActionArray{
    65  //					&glue.TriggerActionArgs{
    66  //						JobName: pulumi.String("another-example-job"),
    67  //					},
    68  //				},
    69  //			})
    70  //			if err != nil {
    71  //				return err
    72  //			}
    73  //			return nil
    74  //		})
    75  //	}
    76  //
    77  // ```
    78  // <!--End PulumiCodeChooser -->
    79  //
    80  // ## Import
    81  //
    82  // Using `pulumi import`, import Glue Workflows using `name`. For example:
    83  //
    84  // ```sh
    85  // $ pulumi import aws:glue/workflow:Workflow MyWorkflow MyWorkflow
    86  // ```
    87  type Workflow struct {
    88  	pulumi.CustomResourceState
    89  
    90  	// Amazon Resource Name (ARN) of Glue Workflow
    91  	Arn pulumi.StringOutput `pulumi:"arn"`
    92  	// A map of default run properties for this workflow. These properties are passed to all jobs associated to the workflow.
    93  	DefaultRunProperties pulumi.StringMapOutput `pulumi:"defaultRunProperties"`
    94  	// Description of the workflow.
    95  	Description pulumi.StringPtrOutput `pulumi:"description"`
    96  	// Prevents exceeding the maximum number of concurrent runs of any of the component jobs. If you leave this parameter blank, there is no limit to the number of concurrent workflow runs.
    97  	MaxConcurrentRuns pulumi.IntPtrOutput `pulumi:"maxConcurrentRuns"`
    98  	// The name you assign to this workflow.
    99  	Name pulumi.StringOutput `pulumi:"name"`
   100  	// Key-value map of resource tags. .If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   101  	Tags pulumi.StringMapOutput `pulumi:"tags"`
   102  	// A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   103  	//
   104  	// Deprecated: Please use `tags` instead.
   105  	TagsAll pulumi.StringMapOutput `pulumi:"tagsAll"`
   106  }
   107  
   108  // NewWorkflow registers a new resource with the given unique name, arguments, and options.
   109  func NewWorkflow(ctx *pulumi.Context,
   110  	name string, args *WorkflowArgs, opts ...pulumi.ResourceOption) (*Workflow, error) {
   111  	if args == nil {
   112  		args = &WorkflowArgs{}
   113  	}
   114  
   115  	opts = internal.PkgResourceDefaultOpts(opts)
   116  	var resource Workflow
   117  	err := ctx.RegisterResource("aws:glue/workflow:Workflow", name, args, &resource, opts...)
   118  	if err != nil {
   119  		return nil, err
   120  	}
   121  	return &resource, nil
   122  }
   123  
   124  // GetWorkflow gets an existing Workflow resource's state with the given name, ID, and optional
   125  // state properties that are used to uniquely qualify the lookup (nil if not required).
   126  func GetWorkflow(ctx *pulumi.Context,
   127  	name string, id pulumi.IDInput, state *WorkflowState, opts ...pulumi.ResourceOption) (*Workflow, error) {
   128  	var resource Workflow
   129  	err := ctx.ReadResource("aws:glue/workflow:Workflow", name, id, state, &resource, opts...)
   130  	if err != nil {
   131  		return nil, err
   132  	}
   133  	return &resource, nil
   134  }
   135  
   136  // Input properties used for looking up and filtering Workflow resources.
   137  type workflowState struct {
   138  	// Amazon Resource Name (ARN) of Glue Workflow
   139  	Arn *string `pulumi:"arn"`
   140  	// A map of default run properties for this workflow. These properties are passed to all jobs associated to the workflow.
   141  	DefaultRunProperties map[string]string `pulumi:"defaultRunProperties"`
   142  	// Description of the workflow.
   143  	Description *string `pulumi:"description"`
   144  	// Prevents exceeding the maximum number of concurrent runs of any of the component jobs. If you leave this parameter blank, there is no limit to the number of concurrent workflow runs.
   145  	MaxConcurrentRuns *int `pulumi:"maxConcurrentRuns"`
   146  	// The name you assign to this workflow.
   147  	Name *string `pulumi:"name"`
   148  	// Key-value map of resource tags. .If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   149  	Tags map[string]string `pulumi:"tags"`
   150  	// A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   151  	//
   152  	// Deprecated: Please use `tags` instead.
   153  	TagsAll map[string]string `pulumi:"tagsAll"`
   154  }
   155  
   156  type WorkflowState struct {
   157  	// Amazon Resource Name (ARN) of Glue Workflow
   158  	Arn pulumi.StringPtrInput
   159  	// A map of default run properties for this workflow. These properties are passed to all jobs associated to the workflow.
   160  	DefaultRunProperties pulumi.StringMapInput
   161  	// Description of the workflow.
   162  	Description pulumi.StringPtrInput
   163  	// Prevents exceeding the maximum number of concurrent runs of any of the component jobs. If you leave this parameter blank, there is no limit to the number of concurrent workflow runs.
   164  	MaxConcurrentRuns pulumi.IntPtrInput
   165  	// The name you assign to this workflow.
   166  	Name pulumi.StringPtrInput
   167  	// Key-value map of resource tags. .If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   168  	Tags pulumi.StringMapInput
   169  	// A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   170  	//
   171  	// Deprecated: Please use `tags` instead.
   172  	TagsAll pulumi.StringMapInput
   173  }
   174  
   175  func (WorkflowState) ElementType() reflect.Type {
   176  	return reflect.TypeOf((*workflowState)(nil)).Elem()
   177  }
   178  
   179  type workflowArgs struct {
   180  	// A map of default run properties for this workflow. These properties are passed to all jobs associated to the workflow.
   181  	DefaultRunProperties map[string]string `pulumi:"defaultRunProperties"`
   182  	// Description of the workflow.
   183  	Description *string `pulumi:"description"`
   184  	// Prevents exceeding the maximum number of concurrent runs of any of the component jobs. If you leave this parameter blank, there is no limit to the number of concurrent workflow runs.
   185  	MaxConcurrentRuns *int `pulumi:"maxConcurrentRuns"`
   186  	// The name you assign to this workflow.
   187  	Name *string `pulumi:"name"`
   188  	// Key-value map of resource tags. .If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   189  	Tags map[string]string `pulumi:"tags"`
   190  }
   191  
   192  // The set of arguments for constructing a Workflow resource.
   193  type WorkflowArgs struct {
   194  	// A map of default run properties for this workflow. These properties are passed to all jobs associated to the workflow.
   195  	DefaultRunProperties pulumi.StringMapInput
   196  	// Description of the workflow.
   197  	Description pulumi.StringPtrInput
   198  	// Prevents exceeding the maximum number of concurrent runs of any of the component jobs. If you leave this parameter blank, there is no limit to the number of concurrent workflow runs.
   199  	MaxConcurrentRuns pulumi.IntPtrInput
   200  	// The name you assign to this workflow.
   201  	Name pulumi.StringPtrInput
   202  	// Key-value map of resource tags. .If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   203  	Tags pulumi.StringMapInput
   204  }
   205  
   206  func (WorkflowArgs) ElementType() reflect.Type {
   207  	return reflect.TypeOf((*workflowArgs)(nil)).Elem()
   208  }
   209  
   210  type WorkflowInput interface {
   211  	pulumi.Input
   212  
   213  	ToWorkflowOutput() WorkflowOutput
   214  	ToWorkflowOutputWithContext(ctx context.Context) WorkflowOutput
   215  }
   216  
   217  func (*Workflow) ElementType() reflect.Type {
   218  	return reflect.TypeOf((**Workflow)(nil)).Elem()
   219  }
   220  
   221  func (i *Workflow) ToWorkflowOutput() WorkflowOutput {
   222  	return i.ToWorkflowOutputWithContext(context.Background())
   223  }
   224  
   225  func (i *Workflow) ToWorkflowOutputWithContext(ctx context.Context) WorkflowOutput {
   226  	return pulumi.ToOutputWithContext(ctx, i).(WorkflowOutput)
   227  }
   228  
   229  // WorkflowArrayInput is an input type that accepts WorkflowArray and WorkflowArrayOutput values.
   230  // You can construct a concrete instance of `WorkflowArrayInput` via:
   231  //
   232  //	WorkflowArray{ WorkflowArgs{...} }
   233  type WorkflowArrayInput interface {
   234  	pulumi.Input
   235  
   236  	ToWorkflowArrayOutput() WorkflowArrayOutput
   237  	ToWorkflowArrayOutputWithContext(context.Context) WorkflowArrayOutput
   238  }
   239  
   240  type WorkflowArray []WorkflowInput
   241  
   242  func (WorkflowArray) ElementType() reflect.Type {
   243  	return reflect.TypeOf((*[]*Workflow)(nil)).Elem()
   244  }
   245  
   246  func (i WorkflowArray) ToWorkflowArrayOutput() WorkflowArrayOutput {
   247  	return i.ToWorkflowArrayOutputWithContext(context.Background())
   248  }
   249  
   250  func (i WorkflowArray) ToWorkflowArrayOutputWithContext(ctx context.Context) WorkflowArrayOutput {
   251  	return pulumi.ToOutputWithContext(ctx, i).(WorkflowArrayOutput)
   252  }
   253  
   254  // WorkflowMapInput is an input type that accepts WorkflowMap and WorkflowMapOutput values.
   255  // You can construct a concrete instance of `WorkflowMapInput` via:
   256  //
   257  //	WorkflowMap{ "key": WorkflowArgs{...} }
   258  type WorkflowMapInput interface {
   259  	pulumi.Input
   260  
   261  	ToWorkflowMapOutput() WorkflowMapOutput
   262  	ToWorkflowMapOutputWithContext(context.Context) WorkflowMapOutput
   263  }
   264  
   265  type WorkflowMap map[string]WorkflowInput
   266  
   267  func (WorkflowMap) ElementType() reflect.Type {
   268  	return reflect.TypeOf((*map[string]*Workflow)(nil)).Elem()
   269  }
   270  
   271  func (i WorkflowMap) ToWorkflowMapOutput() WorkflowMapOutput {
   272  	return i.ToWorkflowMapOutputWithContext(context.Background())
   273  }
   274  
   275  func (i WorkflowMap) ToWorkflowMapOutputWithContext(ctx context.Context) WorkflowMapOutput {
   276  	return pulumi.ToOutputWithContext(ctx, i).(WorkflowMapOutput)
   277  }
   278  
   279  type WorkflowOutput struct{ *pulumi.OutputState }
   280  
   281  func (WorkflowOutput) ElementType() reflect.Type {
   282  	return reflect.TypeOf((**Workflow)(nil)).Elem()
   283  }
   284  
   285  func (o WorkflowOutput) ToWorkflowOutput() WorkflowOutput {
   286  	return o
   287  }
   288  
   289  func (o WorkflowOutput) ToWorkflowOutputWithContext(ctx context.Context) WorkflowOutput {
   290  	return o
   291  }
   292  
   293  // Amazon Resource Name (ARN) of Glue Workflow
   294  func (o WorkflowOutput) Arn() pulumi.StringOutput {
   295  	return o.ApplyT(func(v *Workflow) pulumi.StringOutput { return v.Arn }).(pulumi.StringOutput)
   296  }
   297  
   298  // A map of default run properties for this workflow. These properties are passed to all jobs associated to the workflow.
   299  func (o WorkflowOutput) DefaultRunProperties() pulumi.StringMapOutput {
   300  	return o.ApplyT(func(v *Workflow) pulumi.StringMapOutput { return v.DefaultRunProperties }).(pulumi.StringMapOutput)
   301  }
   302  
   303  // Description of the workflow.
   304  func (o WorkflowOutput) Description() pulumi.StringPtrOutput {
   305  	return o.ApplyT(func(v *Workflow) pulumi.StringPtrOutput { return v.Description }).(pulumi.StringPtrOutput)
   306  }
   307  
   308  // Prevents exceeding the maximum number of concurrent runs of any of the component jobs. If you leave this parameter blank, there is no limit to the number of concurrent workflow runs.
   309  func (o WorkflowOutput) MaxConcurrentRuns() pulumi.IntPtrOutput {
   310  	return o.ApplyT(func(v *Workflow) pulumi.IntPtrOutput { return v.MaxConcurrentRuns }).(pulumi.IntPtrOutput)
   311  }
   312  
   313  // The name you assign to this workflow.
   314  func (o WorkflowOutput) Name() pulumi.StringOutput {
   315  	return o.ApplyT(func(v *Workflow) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput)
   316  }
   317  
   318  // Key-value map of resource tags. .If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   319  func (o WorkflowOutput) Tags() pulumi.StringMapOutput {
   320  	return o.ApplyT(func(v *Workflow) pulumi.StringMapOutput { return v.Tags }).(pulumi.StringMapOutput)
   321  }
   322  
   323  // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   324  //
   325  // Deprecated: Please use `tags` instead.
   326  func (o WorkflowOutput) TagsAll() pulumi.StringMapOutput {
   327  	return o.ApplyT(func(v *Workflow) pulumi.StringMapOutput { return v.TagsAll }).(pulumi.StringMapOutput)
   328  }
   329  
   330  type WorkflowArrayOutput struct{ *pulumi.OutputState }
   331  
   332  func (WorkflowArrayOutput) ElementType() reflect.Type {
   333  	return reflect.TypeOf((*[]*Workflow)(nil)).Elem()
   334  }
   335  
   336  func (o WorkflowArrayOutput) ToWorkflowArrayOutput() WorkflowArrayOutput {
   337  	return o
   338  }
   339  
   340  func (o WorkflowArrayOutput) ToWorkflowArrayOutputWithContext(ctx context.Context) WorkflowArrayOutput {
   341  	return o
   342  }
   343  
   344  func (o WorkflowArrayOutput) Index(i pulumi.IntInput) WorkflowOutput {
   345  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *Workflow {
   346  		return vs[0].([]*Workflow)[vs[1].(int)]
   347  	}).(WorkflowOutput)
   348  }
   349  
   350  type WorkflowMapOutput struct{ *pulumi.OutputState }
   351  
   352  func (WorkflowMapOutput) ElementType() reflect.Type {
   353  	return reflect.TypeOf((*map[string]*Workflow)(nil)).Elem()
   354  }
   355  
   356  func (o WorkflowMapOutput) ToWorkflowMapOutput() WorkflowMapOutput {
   357  	return o
   358  }
   359  
   360  func (o WorkflowMapOutput) ToWorkflowMapOutputWithContext(ctx context.Context) WorkflowMapOutput {
   361  	return o
   362  }
   363  
   364  func (o WorkflowMapOutput) MapIndex(k pulumi.StringInput) WorkflowOutput {
   365  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *Workflow {
   366  		return vs[0].(map[string]*Workflow)[vs[1].(string)]
   367  	}).(WorkflowOutput)
   368  }
   369  
   370  func init() {
   371  	pulumi.RegisterInputType(reflect.TypeOf((*WorkflowInput)(nil)).Elem(), &Workflow{})
   372  	pulumi.RegisterInputType(reflect.TypeOf((*WorkflowArrayInput)(nil)).Elem(), WorkflowArray{})
   373  	pulumi.RegisterInputType(reflect.TypeOf((*WorkflowMapInput)(nil)).Elem(), WorkflowMap{})
   374  	pulumi.RegisterOutputType(WorkflowOutput{})
   375  	pulumi.RegisterOutputType(WorkflowArrayOutput{})
   376  	pulumi.RegisterOutputType(WorkflowMapOutput{})
   377  }