github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/transfer/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 transfer
     5  
     6  import (
     7  	"context"
     8  	"reflect"
     9  
    10  	"errors"
    11  	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/internal"
    12  	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    13  )
    14  
    15  // Provides a AWS Transfer Workflow resource.
    16  //
    17  // ## Example Usage
    18  //
    19  // ### Basic single step example
    20  //
    21  // <!--Start PulumiCodeChooser -->
    22  // ```go
    23  // package main
    24  //
    25  // import (
    26  //
    27  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/transfer"
    28  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    29  //
    30  // )
    31  //
    32  //	func main() {
    33  //		pulumi.Run(func(ctx *pulumi.Context) error {
    34  //			_, err := transfer.NewWorkflow(ctx, "example", &transfer.WorkflowArgs{
    35  //				Steps: transfer.WorkflowStepArray{
    36  //					&transfer.WorkflowStepArgs{
    37  //						DeleteStepDetails: &transfer.WorkflowStepDeleteStepDetailsArgs{
    38  //							Name:               pulumi.String("example"),
    39  //							SourceFileLocation: pulumi.String("${original.file}"),
    40  //						},
    41  //						Type: pulumi.String("DELETE"),
    42  //					},
    43  //				},
    44  //			})
    45  //			if err != nil {
    46  //				return err
    47  //			}
    48  //			return nil
    49  //		})
    50  //	}
    51  //
    52  // ```
    53  // <!--End PulumiCodeChooser -->
    54  //
    55  // ### Multistep example
    56  //
    57  // <!--Start PulumiCodeChooser -->
    58  // ```go
    59  // package main
    60  //
    61  // import (
    62  //
    63  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/transfer"
    64  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    65  //
    66  // )
    67  //
    68  //	func main() {
    69  //		pulumi.Run(func(ctx *pulumi.Context) error {
    70  //			_, err := transfer.NewWorkflow(ctx, "example", &transfer.WorkflowArgs{
    71  //				Steps: transfer.WorkflowStepArray{
    72  //					&transfer.WorkflowStepArgs{
    73  //						CustomStepDetails: &transfer.WorkflowStepCustomStepDetailsArgs{
    74  //							Name:               pulumi.String("example"),
    75  //							SourceFileLocation: pulumi.String("${original.file}"),
    76  //							Target:             pulumi.Any(exampleAwsLambdaFunction.Arn),
    77  //							TimeoutSeconds:     pulumi.Int(60),
    78  //						},
    79  //						Type: pulumi.String("CUSTOM"),
    80  //					},
    81  //					&transfer.WorkflowStepArgs{
    82  //						TagStepDetails: &transfer.WorkflowStepTagStepDetailsArgs{
    83  //							Name:               pulumi.String("example"),
    84  //							SourceFileLocation: pulumi.String("${original.file}"),
    85  //							Tags: transfer.WorkflowStepTagStepDetailsTagArray{
    86  //								&transfer.WorkflowStepTagStepDetailsTagArgs{
    87  //									Key:   pulumi.String("Name"),
    88  //									Value: pulumi.String("Hello World"),
    89  //								},
    90  //							},
    91  //						},
    92  //						Type: pulumi.String("TAG"),
    93  //					},
    94  //				},
    95  //			})
    96  //			if err != nil {
    97  //				return err
    98  //			}
    99  //			return nil
   100  //		})
   101  //	}
   102  //
   103  // ```
   104  // <!--End PulumiCodeChooser -->
   105  //
   106  // ## Import
   107  //
   108  // Using `pulumi import`, import Transfer Workflows using the `worflow_id`. For example:
   109  //
   110  // ```sh
   111  // $ pulumi import aws:transfer/workflow:Workflow example example
   112  // ```
   113  type Workflow struct {
   114  	pulumi.CustomResourceState
   115  
   116  	// The Workflow ARN.
   117  	Arn pulumi.StringOutput `pulumi:"arn"`
   118  	// A textual description for the workflow.
   119  	Description pulumi.StringPtrOutput `pulumi:"description"`
   120  	// Specifies the steps (actions) to take if errors are encountered during execution of the workflow. See Workflow Steps below.
   121  	OnExceptionSteps WorkflowOnExceptionStepArrayOutput `pulumi:"onExceptionSteps"`
   122  	// Specifies the details for the steps that are in the specified workflow. See Workflow Steps below.
   123  	Steps WorkflowStepArrayOutput `pulumi:"steps"`
   124  	// A map of tags to assign to the resource. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   125  	Tags pulumi.StringMapOutput `pulumi:"tags"`
   126  	// A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   127  	//
   128  	// Deprecated: Please use `tags` instead.
   129  	TagsAll pulumi.StringMapOutput `pulumi:"tagsAll"`
   130  }
   131  
   132  // NewWorkflow registers a new resource with the given unique name, arguments, and options.
   133  func NewWorkflow(ctx *pulumi.Context,
   134  	name string, args *WorkflowArgs, opts ...pulumi.ResourceOption) (*Workflow, error) {
   135  	if args == nil {
   136  		return nil, errors.New("missing one or more required arguments")
   137  	}
   138  
   139  	if args.Steps == nil {
   140  		return nil, errors.New("invalid value for required argument 'Steps'")
   141  	}
   142  	opts = internal.PkgResourceDefaultOpts(opts)
   143  	var resource Workflow
   144  	err := ctx.RegisterResource("aws:transfer/workflow:Workflow", name, args, &resource, opts...)
   145  	if err != nil {
   146  		return nil, err
   147  	}
   148  	return &resource, nil
   149  }
   150  
   151  // GetWorkflow gets an existing Workflow resource's state with the given name, ID, and optional
   152  // state properties that are used to uniquely qualify the lookup (nil if not required).
   153  func GetWorkflow(ctx *pulumi.Context,
   154  	name string, id pulumi.IDInput, state *WorkflowState, opts ...pulumi.ResourceOption) (*Workflow, error) {
   155  	var resource Workflow
   156  	err := ctx.ReadResource("aws:transfer/workflow:Workflow", name, id, state, &resource, opts...)
   157  	if err != nil {
   158  		return nil, err
   159  	}
   160  	return &resource, nil
   161  }
   162  
   163  // Input properties used for looking up and filtering Workflow resources.
   164  type workflowState struct {
   165  	// The Workflow ARN.
   166  	Arn *string `pulumi:"arn"`
   167  	// A textual description for the workflow.
   168  	Description *string `pulumi:"description"`
   169  	// Specifies the steps (actions) to take if errors are encountered during execution of the workflow. See Workflow Steps below.
   170  	OnExceptionSteps []WorkflowOnExceptionStep `pulumi:"onExceptionSteps"`
   171  	// Specifies the details for the steps that are in the specified workflow. See Workflow Steps below.
   172  	Steps []WorkflowStep `pulumi:"steps"`
   173  	// A map of tags to assign to the resource. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   174  	Tags map[string]string `pulumi:"tags"`
   175  	// A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   176  	//
   177  	// Deprecated: Please use `tags` instead.
   178  	TagsAll map[string]string `pulumi:"tagsAll"`
   179  }
   180  
   181  type WorkflowState struct {
   182  	// The Workflow ARN.
   183  	Arn pulumi.StringPtrInput
   184  	// A textual description for the workflow.
   185  	Description pulumi.StringPtrInput
   186  	// Specifies the steps (actions) to take if errors are encountered during execution of the workflow. See Workflow Steps below.
   187  	OnExceptionSteps WorkflowOnExceptionStepArrayInput
   188  	// Specifies the details for the steps that are in the specified workflow. See Workflow Steps below.
   189  	Steps WorkflowStepArrayInput
   190  	// A map of tags to assign to the resource. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   191  	Tags pulumi.StringMapInput
   192  	// A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   193  	//
   194  	// Deprecated: Please use `tags` instead.
   195  	TagsAll pulumi.StringMapInput
   196  }
   197  
   198  func (WorkflowState) ElementType() reflect.Type {
   199  	return reflect.TypeOf((*workflowState)(nil)).Elem()
   200  }
   201  
   202  type workflowArgs struct {
   203  	// A textual description for the workflow.
   204  	Description *string `pulumi:"description"`
   205  	// Specifies the steps (actions) to take if errors are encountered during execution of the workflow. See Workflow Steps below.
   206  	OnExceptionSteps []WorkflowOnExceptionStep `pulumi:"onExceptionSteps"`
   207  	// Specifies the details for the steps that are in the specified workflow. See Workflow Steps below.
   208  	Steps []WorkflowStep `pulumi:"steps"`
   209  	// A map of tags to assign to the resource. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   210  	Tags map[string]string `pulumi:"tags"`
   211  }
   212  
   213  // The set of arguments for constructing a Workflow resource.
   214  type WorkflowArgs struct {
   215  	// A textual description for the workflow.
   216  	Description pulumi.StringPtrInput
   217  	// Specifies the steps (actions) to take if errors are encountered during execution of the workflow. See Workflow Steps below.
   218  	OnExceptionSteps WorkflowOnExceptionStepArrayInput
   219  	// Specifies the details for the steps that are in the specified workflow. See Workflow Steps below.
   220  	Steps WorkflowStepArrayInput
   221  	// A map of tags to assign to the resource. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   222  	Tags pulumi.StringMapInput
   223  }
   224  
   225  func (WorkflowArgs) ElementType() reflect.Type {
   226  	return reflect.TypeOf((*workflowArgs)(nil)).Elem()
   227  }
   228  
   229  type WorkflowInput interface {
   230  	pulumi.Input
   231  
   232  	ToWorkflowOutput() WorkflowOutput
   233  	ToWorkflowOutputWithContext(ctx context.Context) WorkflowOutput
   234  }
   235  
   236  func (*Workflow) ElementType() reflect.Type {
   237  	return reflect.TypeOf((**Workflow)(nil)).Elem()
   238  }
   239  
   240  func (i *Workflow) ToWorkflowOutput() WorkflowOutput {
   241  	return i.ToWorkflowOutputWithContext(context.Background())
   242  }
   243  
   244  func (i *Workflow) ToWorkflowOutputWithContext(ctx context.Context) WorkflowOutput {
   245  	return pulumi.ToOutputWithContext(ctx, i).(WorkflowOutput)
   246  }
   247  
   248  // WorkflowArrayInput is an input type that accepts WorkflowArray and WorkflowArrayOutput values.
   249  // You can construct a concrete instance of `WorkflowArrayInput` via:
   250  //
   251  //	WorkflowArray{ WorkflowArgs{...} }
   252  type WorkflowArrayInput interface {
   253  	pulumi.Input
   254  
   255  	ToWorkflowArrayOutput() WorkflowArrayOutput
   256  	ToWorkflowArrayOutputWithContext(context.Context) WorkflowArrayOutput
   257  }
   258  
   259  type WorkflowArray []WorkflowInput
   260  
   261  func (WorkflowArray) ElementType() reflect.Type {
   262  	return reflect.TypeOf((*[]*Workflow)(nil)).Elem()
   263  }
   264  
   265  func (i WorkflowArray) ToWorkflowArrayOutput() WorkflowArrayOutput {
   266  	return i.ToWorkflowArrayOutputWithContext(context.Background())
   267  }
   268  
   269  func (i WorkflowArray) ToWorkflowArrayOutputWithContext(ctx context.Context) WorkflowArrayOutput {
   270  	return pulumi.ToOutputWithContext(ctx, i).(WorkflowArrayOutput)
   271  }
   272  
   273  // WorkflowMapInput is an input type that accepts WorkflowMap and WorkflowMapOutput values.
   274  // You can construct a concrete instance of `WorkflowMapInput` via:
   275  //
   276  //	WorkflowMap{ "key": WorkflowArgs{...} }
   277  type WorkflowMapInput interface {
   278  	pulumi.Input
   279  
   280  	ToWorkflowMapOutput() WorkflowMapOutput
   281  	ToWorkflowMapOutputWithContext(context.Context) WorkflowMapOutput
   282  }
   283  
   284  type WorkflowMap map[string]WorkflowInput
   285  
   286  func (WorkflowMap) ElementType() reflect.Type {
   287  	return reflect.TypeOf((*map[string]*Workflow)(nil)).Elem()
   288  }
   289  
   290  func (i WorkflowMap) ToWorkflowMapOutput() WorkflowMapOutput {
   291  	return i.ToWorkflowMapOutputWithContext(context.Background())
   292  }
   293  
   294  func (i WorkflowMap) ToWorkflowMapOutputWithContext(ctx context.Context) WorkflowMapOutput {
   295  	return pulumi.ToOutputWithContext(ctx, i).(WorkflowMapOutput)
   296  }
   297  
   298  type WorkflowOutput struct{ *pulumi.OutputState }
   299  
   300  func (WorkflowOutput) ElementType() reflect.Type {
   301  	return reflect.TypeOf((**Workflow)(nil)).Elem()
   302  }
   303  
   304  func (o WorkflowOutput) ToWorkflowOutput() WorkflowOutput {
   305  	return o
   306  }
   307  
   308  func (o WorkflowOutput) ToWorkflowOutputWithContext(ctx context.Context) WorkflowOutput {
   309  	return o
   310  }
   311  
   312  // The Workflow ARN.
   313  func (o WorkflowOutput) Arn() pulumi.StringOutput {
   314  	return o.ApplyT(func(v *Workflow) pulumi.StringOutput { return v.Arn }).(pulumi.StringOutput)
   315  }
   316  
   317  // A textual description for the workflow.
   318  func (o WorkflowOutput) Description() pulumi.StringPtrOutput {
   319  	return o.ApplyT(func(v *Workflow) pulumi.StringPtrOutput { return v.Description }).(pulumi.StringPtrOutput)
   320  }
   321  
   322  // Specifies the steps (actions) to take if errors are encountered during execution of the workflow. See Workflow Steps below.
   323  func (o WorkflowOutput) OnExceptionSteps() WorkflowOnExceptionStepArrayOutput {
   324  	return o.ApplyT(func(v *Workflow) WorkflowOnExceptionStepArrayOutput { return v.OnExceptionSteps }).(WorkflowOnExceptionStepArrayOutput)
   325  }
   326  
   327  // Specifies the details for the steps that are in the specified workflow. See Workflow Steps below.
   328  func (o WorkflowOutput) Steps() WorkflowStepArrayOutput {
   329  	return o.ApplyT(func(v *Workflow) WorkflowStepArrayOutput { return v.Steps }).(WorkflowStepArrayOutput)
   330  }
   331  
   332  // A map of tags to assign to the resource. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   333  func (o WorkflowOutput) Tags() pulumi.StringMapOutput {
   334  	return o.ApplyT(func(v *Workflow) pulumi.StringMapOutput { return v.Tags }).(pulumi.StringMapOutput)
   335  }
   336  
   337  // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   338  //
   339  // Deprecated: Please use `tags` instead.
   340  func (o WorkflowOutput) TagsAll() pulumi.StringMapOutput {
   341  	return o.ApplyT(func(v *Workflow) pulumi.StringMapOutput { return v.TagsAll }).(pulumi.StringMapOutput)
   342  }
   343  
   344  type WorkflowArrayOutput struct{ *pulumi.OutputState }
   345  
   346  func (WorkflowArrayOutput) ElementType() reflect.Type {
   347  	return reflect.TypeOf((*[]*Workflow)(nil)).Elem()
   348  }
   349  
   350  func (o WorkflowArrayOutput) ToWorkflowArrayOutput() WorkflowArrayOutput {
   351  	return o
   352  }
   353  
   354  func (o WorkflowArrayOutput) ToWorkflowArrayOutputWithContext(ctx context.Context) WorkflowArrayOutput {
   355  	return o
   356  }
   357  
   358  func (o WorkflowArrayOutput) Index(i pulumi.IntInput) WorkflowOutput {
   359  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *Workflow {
   360  		return vs[0].([]*Workflow)[vs[1].(int)]
   361  	}).(WorkflowOutput)
   362  }
   363  
   364  type WorkflowMapOutput struct{ *pulumi.OutputState }
   365  
   366  func (WorkflowMapOutput) ElementType() reflect.Type {
   367  	return reflect.TypeOf((*map[string]*Workflow)(nil)).Elem()
   368  }
   369  
   370  func (o WorkflowMapOutput) ToWorkflowMapOutput() WorkflowMapOutput {
   371  	return o
   372  }
   373  
   374  func (o WorkflowMapOutput) ToWorkflowMapOutputWithContext(ctx context.Context) WorkflowMapOutput {
   375  	return o
   376  }
   377  
   378  func (o WorkflowMapOutput) MapIndex(k pulumi.StringInput) WorkflowOutput {
   379  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *Workflow {
   380  		return vs[0].(map[string]*Workflow)[vs[1].(string)]
   381  	}).(WorkflowOutput)
   382  }
   383  
   384  func init() {
   385  	pulumi.RegisterInputType(reflect.TypeOf((*WorkflowInput)(nil)).Elem(), &Workflow{})
   386  	pulumi.RegisterInputType(reflect.TypeOf((*WorkflowArrayInput)(nil)).Elem(), WorkflowArray{})
   387  	pulumi.RegisterInputType(reflect.TypeOf((*WorkflowMapInput)(nil)).Elem(), WorkflowMap{})
   388  	pulumi.RegisterOutputType(WorkflowOutput{})
   389  	pulumi.RegisterOutputType(WorkflowArrayOutput{})
   390  	pulumi.RegisterOutputType(WorkflowMapOutput{})
   391  }