github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/imagebuilder/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 imagebuilder
     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  // Resource for managing an AWS EC2 Image Builder Workflow.
    16  //
    17  // ## Example Usage
    18  //
    19  // ### Basic Usage
    20  //
    21  // <!--Start PulumiCodeChooser -->
    22  // ```go
    23  // package main
    24  //
    25  // import (
    26  //
    27  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/imagebuilder"
    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 := imagebuilder.NewWorkflow(ctx, "example", &imagebuilder.WorkflowArgs{
    35  //				Name:    pulumi.String("example"),
    36  //				Version: pulumi.String("1.0.0"),
    37  //				Type:    pulumi.String("TEST"),
    38  //				Data: pulumi.String(`name: example
    39  //
    40  // description: Workflow to test an image
    41  // schemaVersion: 1.0
    42  //
    43  // parameters:
    44  //   - name: waitForActionAtEnd
    45  //     type: boolean
    46  //
    47  // steps:
    48  //
    49  //   - name: LaunchTestInstance
    50  //     action: LaunchInstance
    51  //     onFailure: Abort
    52  //     inputs:
    53  //     waitFor: "ssmAgent"
    54  //
    55  //   - name: TerminateTestInstance
    56  //     action: TerminateInstance
    57  //     onFailure: Continue
    58  //     inputs:
    59  //     instanceId.$: "$.stepOutputs.LaunchTestInstance.instanceId"
    60  //
    61  //   - name: WaitForActionAtEnd
    62  //     action: WaitForAction
    63  //     if:
    64  //     booleanEquals: true
    65  //     value: "$.parameters.waitForActionAtEnd"
    66  //
    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 EC2 Image Builder Workflow using the `example_id_arg`. For example:
    83  //
    84  // ```sh
    85  // $ pulumi import aws:imagebuilder/workflow:Workflow example arn:aws:imagebuilder:us-east-1:aws:workflow/test/example/1.0.1/1
    86  // ```
    87  // Certain resource arguments, such as `uri`, cannot be read via the API and imported into Terraform. Terraform will display a difference for these arguments the first run after import if declared in the Terraform configuration for an imported resource.
    88  type Workflow struct {
    89  	pulumi.CustomResourceState
    90  
    91  	// Amazon Resource Name (ARN) of the workflow.
    92  	Arn pulumi.StringOutput `pulumi:"arn"`
    93  	// Change description of the workflow.
    94  	ChangeDescription pulumi.StringPtrOutput `pulumi:"changeDescription"`
    95  	// Inline YAML string with data of the workflow. Exactly one of `data` and `uri` can be specified.
    96  	Data pulumi.StringOutput `pulumi:"data"`
    97  	// Date the workflow was created.
    98  	DateCreated pulumi.StringOutput `pulumi:"dateCreated"`
    99  	// Description of the workflow.
   100  	Description pulumi.StringPtrOutput `pulumi:"description"`
   101  	// Amazon Resource Name (ARN) of the Key Management Service (KMS) Key used to encrypt the workflow.
   102  	KmsKeyId pulumi.StringPtrOutput `pulumi:"kmsKeyId"`
   103  	// Name of the workflow.
   104  	Name pulumi.StringOutput `pulumi:"name"`
   105  	// Owner of the workflow.
   106  	Owner pulumi.StringOutput `pulumi:"owner"`
   107  	// Key-value map of resource tags for the workflow. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   108  	Tags pulumi.StringMapOutput `pulumi:"tags"`
   109  	// Deprecated: Please use `tags` instead.
   110  	TagsAll pulumi.StringMapOutput `pulumi:"tagsAll"`
   111  	// Type of the workflow. Valid values: `BUILD`, `TEST`, `DISTRIBUTION`.
   112  	Type pulumi.StringOutput `pulumi:"type"`
   113  	// S3 URI with data of the workflow. Exactly one of `data` and `uri` can be specified.
   114  	Uri pulumi.StringPtrOutput `pulumi:"uri"`
   115  	// Version of the workflow.
   116  	//
   117  	// The following arguments are optional:
   118  	Version pulumi.StringOutput `pulumi:"version"`
   119  }
   120  
   121  // NewWorkflow registers a new resource with the given unique name, arguments, and options.
   122  func NewWorkflow(ctx *pulumi.Context,
   123  	name string, args *WorkflowArgs, opts ...pulumi.ResourceOption) (*Workflow, error) {
   124  	if args == nil {
   125  		return nil, errors.New("missing one or more required arguments")
   126  	}
   127  
   128  	if args.Type == nil {
   129  		return nil, errors.New("invalid value for required argument 'Type'")
   130  	}
   131  	if args.Version == nil {
   132  		return nil, errors.New("invalid value for required argument 'Version'")
   133  	}
   134  	opts = internal.PkgResourceDefaultOpts(opts)
   135  	var resource Workflow
   136  	err := ctx.RegisterResource("aws:imagebuilder/workflow:Workflow", name, args, &resource, opts...)
   137  	if err != nil {
   138  		return nil, err
   139  	}
   140  	return &resource, nil
   141  }
   142  
   143  // GetWorkflow gets an existing Workflow resource's state with the given name, ID, and optional
   144  // state properties that are used to uniquely qualify the lookup (nil if not required).
   145  func GetWorkflow(ctx *pulumi.Context,
   146  	name string, id pulumi.IDInput, state *WorkflowState, opts ...pulumi.ResourceOption) (*Workflow, error) {
   147  	var resource Workflow
   148  	err := ctx.ReadResource("aws:imagebuilder/workflow:Workflow", name, id, state, &resource, opts...)
   149  	if err != nil {
   150  		return nil, err
   151  	}
   152  	return &resource, nil
   153  }
   154  
   155  // Input properties used for looking up and filtering Workflow resources.
   156  type workflowState struct {
   157  	// Amazon Resource Name (ARN) of the workflow.
   158  	Arn *string `pulumi:"arn"`
   159  	// Change description of the workflow.
   160  	ChangeDescription *string `pulumi:"changeDescription"`
   161  	// Inline YAML string with data of the workflow. Exactly one of `data` and `uri` can be specified.
   162  	Data *string `pulumi:"data"`
   163  	// Date the workflow was created.
   164  	DateCreated *string `pulumi:"dateCreated"`
   165  	// Description of the workflow.
   166  	Description *string `pulumi:"description"`
   167  	// Amazon Resource Name (ARN) of the Key Management Service (KMS) Key used to encrypt the workflow.
   168  	KmsKeyId *string `pulumi:"kmsKeyId"`
   169  	// Name of the workflow.
   170  	Name *string `pulumi:"name"`
   171  	// Owner of the workflow.
   172  	Owner *string `pulumi:"owner"`
   173  	// Key-value map of resource tags for the workflow. 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  	// Deprecated: Please use `tags` instead.
   176  	TagsAll map[string]string `pulumi:"tagsAll"`
   177  	// Type of the workflow. Valid values: `BUILD`, `TEST`, `DISTRIBUTION`.
   178  	Type *string `pulumi:"type"`
   179  	// S3 URI with data of the workflow. Exactly one of `data` and `uri` can be specified.
   180  	Uri *string `pulumi:"uri"`
   181  	// Version of the workflow.
   182  	//
   183  	// The following arguments are optional:
   184  	Version *string `pulumi:"version"`
   185  }
   186  
   187  type WorkflowState struct {
   188  	// Amazon Resource Name (ARN) of the workflow.
   189  	Arn pulumi.StringPtrInput
   190  	// Change description of the workflow.
   191  	ChangeDescription pulumi.StringPtrInput
   192  	// Inline YAML string with data of the workflow. Exactly one of `data` and `uri` can be specified.
   193  	Data pulumi.StringPtrInput
   194  	// Date the workflow was created.
   195  	DateCreated pulumi.StringPtrInput
   196  	// Description of the workflow.
   197  	Description pulumi.StringPtrInput
   198  	// Amazon Resource Name (ARN) of the Key Management Service (KMS) Key used to encrypt the workflow.
   199  	KmsKeyId pulumi.StringPtrInput
   200  	// Name of the workflow.
   201  	Name pulumi.StringPtrInput
   202  	// Owner of the workflow.
   203  	Owner pulumi.StringPtrInput
   204  	// Key-value map of resource tags for the workflow. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   205  	Tags pulumi.StringMapInput
   206  	// Deprecated: Please use `tags` instead.
   207  	TagsAll pulumi.StringMapInput
   208  	// Type of the workflow. Valid values: `BUILD`, `TEST`, `DISTRIBUTION`.
   209  	Type pulumi.StringPtrInput
   210  	// S3 URI with data of the workflow. Exactly one of `data` and `uri` can be specified.
   211  	Uri pulumi.StringPtrInput
   212  	// Version of the workflow.
   213  	//
   214  	// The following arguments are optional:
   215  	Version pulumi.StringPtrInput
   216  }
   217  
   218  func (WorkflowState) ElementType() reflect.Type {
   219  	return reflect.TypeOf((*workflowState)(nil)).Elem()
   220  }
   221  
   222  type workflowArgs struct {
   223  	// Change description of the workflow.
   224  	ChangeDescription *string `pulumi:"changeDescription"`
   225  	// Inline YAML string with data of the workflow. Exactly one of `data` and `uri` can be specified.
   226  	Data *string `pulumi:"data"`
   227  	// Description of the workflow.
   228  	Description *string `pulumi:"description"`
   229  	// Amazon Resource Name (ARN) of the Key Management Service (KMS) Key used to encrypt the workflow.
   230  	KmsKeyId *string `pulumi:"kmsKeyId"`
   231  	// Name of the workflow.
   232  	Name *string `pulumi:"name"`
   233  	// Key-value map of resource tags for the workflow. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   234  	Tags map[string]string `pulumi:"tags"`
   235  	// Type of the workflow. Valid values: `BUILD`, `TEST`, `DISTRIBUTION`.
   236  	Type string `pulumi:"type"`
   237  	// S3 URI with data of the workflow. Exactly one of `data` and `uri` can be specified.
   238  	Uri *string `pulumi:"uri"`
   239  	// Version of the workflow.
   240  	//
   241  	// The following arguments are optional:
   242  	Version string `pulumi:"version"`
   243  }
   244  
   245  // The set of arguments for constructing a Workflow resource.
   246  type WorkflowArgs struct {
   247  	// Change description of the workflow.
   248  	ChangeDescription pulumi.StringPtrInput
   249  	// Inline YAML string with data of the workflow. Exactly one of `data` and `uri` can be specified.
   250  	Data pulumi.StringPtrInput
   251  	// Description of the workflow.
   252  	Description pulumi.StringPtrInput
   253  	// Amazon Resource Name (ARN) of the Key Management Service (KMS) Key used to encrypt the workflow.
   254  	KmsKeyId pulumi.StringPtrInput
   255  	// Name of the workflow.
   256  	Name pulumi.StringPtrInput
   257  	// Key-value map of resource tags for the workflow. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   258  	Tags pulumi.StringMapInput
   259  	// Type of the workflow. Valid values: `BUILD`, `TEST`, `DISTRIBUTION`.
   260  	Type pulumi.StringInput
   261  	// S3 URI with data of the workflow. Exactly one of `data` and `uri` can be specified.
   262  	Uri pulumi.StringPtrInput
   263  	// Version of the workflow.
   264  	//
   265  	// The following arguments are optional:
   266  	Version pulumi.StringInput
   267  }
   268  
   269  func (WorkflowArgs) ElementType() reflect.Type {
   270  	return reflect.TypeOf((*workflowArgs)(nil)).Elem()
   271  }
   272  
   273  type WorkflowInput interface {
   274  	pulumi.Input
   275  
   276  	ToWorkflowOutput() WorkflowOutput
   277  	ToWorkflowOutputWithContext(ctx context.Context) WorkflowOutput
   278  }
   279  
   280  func (*Workflow) ElementType() reflect.Type {
   281  	return reflect.TypeOf((**Workflow)(nil)).Elem()
   282  }
   283  
   284  func (i *Workflow) ToWorkflowOutput() WorkflowOutput {
   285  	return i.ToWorkflowOutputWithContext(context.Background())
   286  }
   287  
   288  func (i *Workflow) ToWorkflowOutputWithContext(ctx context.Context) WorkflowOutput {
   289  	return pulumi.ToOutputWithContext(ctx, i).(WorkflowOutput)
   290  }
   291  
   292  // WorkflowArrayInput is an input type that accepts WorkflowArray and WorkflowArrayOutput values.
   293  // You can construct a concrete instance of `WorkflowArrayInput` via:
   294  //
   295  //	WorkflowArray{ WorkflowArgs{...} }
   296  type WorkflowArrayInput interface {
   297  	pulumi.Input
   298  
   299  	ToWorkflowArrayOutput() WorkflowArrayOutput
   300  	ToWorkflowArrayOutputWithContext(context.Context) WorkflowArrayOutput
   301  }
   302  
   303  type WorkflowArray []WorkflowInput
   304  
   305  func (WorkflowArray) ElementType() reflect.Type {
   306  	return reflect.TypeOf((*[]*Workflow)(nil)).Elem()
   307  }
   308  
   309  func (i WorkflowArray) ToWorkflowArrayOutput() WorkflowArrayOutput {
   310  	return i.ToWorkflowArrayOutputWithContext(context.Background())
   311  }
   312  
   313  func (i WorkflowArray) ToWorkflowArrayOutputWithContext(ctx context.Context) WorkflowArrayOutput {
   314  	return pulumi.ToOutputWithContext(ctx, i).(WorkflowArrayOutput)
   315  }
   316  
   317  // WorkflowMapInput is an input type that accepts WorkflowMap and WorkflowMapOutput values.
   318  // You can construct a concrete instance of `WorkflowMapInput` via:
   319  //
   320  //	WorkflowMap{ "key": WorkflowArgs{...} }
   321  type WorkflowMapInput interface {
   322  	pulumi.Input
   323  
   324  	ToWorkflowMapOutput() WorkflowMapOutput
   325  	ToWorkflowMapOutputWithContext(context.Context) WorkflowMapOutput
   326  }
   327  
   328  type WorkflowMap map[string]WorkflowInput
   329  
   330  func (WorkflowMap) ElementType() reflect.Type {
   331  	return reflect.TypeOf((*map[string]*Workflow)(nil)).Elem()
   332  }
   333  
   334  func (i WorkflowMap) ToWorkflowMapOutput() WorkflowMapOutput {
   335  	return i.ToWorkflowMapOutputWithContext(context.Background())
   336  }
   337  
   338  func (i WorkflowMap) ToWorkflowMapOutputWithContext(ctx context.Context) WorkflowMapOutput {
   339  	return pulumi.ToOutputWithContext(ctx, i).(WorkflowMapOutput)
   340  }
   341  
   342  type WorkflowOutput struct{ *pulumi.OutputState }
   343  
   344  func (WorkflowOutput) ElementType() reflect.Type {
   345  	return reflect.TypeOf((**Workflow)(nil)).Elem()
   346  }
   347  
   348  func (o WorkflowOutput) ToWorkflowOutput() WorkflowOutput {
   349  	return o
   350  }
   351  
   352  func (o WorkflowOutput) ToWorkflowOutputWithContext(ctx context.Context) WorkflowOutput {
   353  	return o
   354  }
   355  
   356  // Amazon Resource Name (ARN) of the workflow.
   357  func (o WorkflowOutput) Arn() pulumi.StringOutput {
   358  	return o.ApplyT(func(v *Workflow) pulumi.StringOutput { return v.Arn }).(pulumi.StringOutput)
   359  }
   360  
   361  // Change description of the workflow.
   362  func (o WorkflowOutput) ChangeDescription() pulumi.StringPtrOutput {
   363  	return o.ApplyT(func(v *Workflow) pulumi.StringPtrOutput { return v.ChangeDescription }).(pulumi.StringPtrOutput)
   364  }
   365  
   366  // Inline YAML string with data of the workflow. Exactly one of `data` and `uri` can be specified.
   367  func (o WorkflowOutput) Data() pulumi.StringOutput {
   368  	return o.ApplyT(func(v *Workflow) pulumi.StringOutput { return v.Data }).(pulumi.StringOutput)
   369  }
   370  
   371  // Date the workflow was created.
   372  func (o WorkflowOutput) DateCreated() pulumi.StringOutput {
   373  	return o.ApplyT(func(v *Workflow) pulumi.StringOutput { return v.DateCreated }).(pulumi.StringOutput)
   374  }
   375  
   376  // Description of the workflow.
   377  func (o WorkflowOutput) Description() pulumi.StringPtrOutput {
   378  	return o.ApplyT(func(v *Workflow) pulumi.StringPtrOutput { return v.Description }).(pulumi.StringPtrOutput)
   379  }
   380  
   381  // Amazon Resource Name (ARN) of the Key Management Service (KMS) Key used to encrypt the workflow.
   382  func (o WorkflowOutput) KmsKeyId() pulumi.StringPtrOutput {
   383  	return o.ApplyT(func(v *Workflow) pulumi.StringPtrOutput { return v.KmsKeyId }).(pulumi.StringPtrOutput)
   384  }
   385  
   386  // Name of the workflow.
   387  func (o WorkflowOutput) Name() pulumi.StringOutput {
   388  	return o.ApplyT(func(v *Workflow) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput)
   389  }
   390  
   391  // Owner of the workflow.
   392  func (o WorkflowOutput) Owner() pulumi.StringOutput {
   393  	return o.ApplyT(func(v *Workflow) pulumi.StringOutput { return v.Owner }).(pulumi.StringOutput)
   394  }
   395  
   396  // Key-value map of resource tags for the workflow. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   397  func (o WorkflowOutput) Tags() pulumi.StringMapOutput {
   398  	return o.ApplyT(func(v *Workflow) pulumi.StringMapOutput { return v.Tags }).(pulumi.StringMapOutput)
   399  }
   400  
   401  // Deprecated: Please use `tags` instead.
   402  func (o WorkflowOutput) TagsAll() pulumi.StringMapOutput {
   403  	return o.ApplyT(func(v *Workflow) pulumi.StringMapOutput { return v.TagsAll }).(pulumi.StringMapOutput)
   404  }
   405  
   406  // Type of the workflow. Valid values: `BUILD`, `TEST`, `DISTRIBUTION`.
   407  func (o WorkflowOutput) Type() pulumi.StringOutput {
   408  	return o.ApplyT(func(v *Workflow) pulumi.StringOutput { return v.Type }).(pulumi.StringOutput)
   409  }
   410  
   411  // S3 URI with data of the workflow. Exactly one of `data` and `uri` can be specified.
   412  func (o WorkflowOutput) Uri() pulumi.StringPtrOutput {
   413  	return o.ApplyT(func(v *Workflow) pulumi.StringPtrOutput { return v.Uri }).(pulumi.StringPtrOutput)
   414  }
   415  
   416  // Version of the workflow.
   417  //
   418  // The following arguments are optional:
   419  func (o WorkflowOutput) Version() pulumi.StringOutput {
   420  	return o.ApplyT(func(v *Workflow) pulumi.StringOutput { return v.Version }).(pulumi.StringOutput)
   421  }
   422  
   423  type WorkflowArrayOutput struct{ *pulumi.OutputState }
   424  
   425  func (WorkflowArrayOutput) ElementType() reflect.Type {
   426  	return reflect.TypeOf((*[]*Workflow)(nil)).Elem()
   427  }
   428  
   429  func (o WorkflowArrayOutput) ToWorkflowArrayOutput() WorkflowArrayOutput {
   430  	return o
   431  }
   432  
   433  func (o WorkflowArrayOutput) ToWorkflowArrayOutputWithContext(ctx context.Context) WorkflowArrayOutput {
   434  	return o
   435  }
   436  
   437  func (o WorkflowArrayOutput) Index(i pulumi.IntInput) WorkflowOutput {
   438  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *Workflow {
   439  		return vs[0].([]*Workflow)[vs[1].(int)]
   440  	}).(WorkflowOutput)
   441  }
   442  
   443  type WorkflowMapOutput struct{ *pulumi.OutputState }
   444  
   445  func (WorkflowMapOutput) ElementType() reflect.Type {
   446  	return reflect.TypeOf((*map[string]*Workflow)(nil)).Elem()
   447  }
   448  
   449  func (o WorkflowMapOutput) ToWorkflowMapOutput() WorkflowMapOutput {
   450  	return o
   451  }
   452  
   453  func (o WorkflowMapOutput) ToWorkflowMapOutputWithContext(ctx context.Context) WorkflowMapOutput {
   454  	return o
   455  }
   456  
   457  func (o WorkflowMapOutput) MapIndex(k pulumi.StringInput) WorkflowOutput {
   458  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *Workflow {
   459  		return vs[0].(map[string]*Workflow)[vs[1].(string)]
   460  	}).(WorkflowOutput)
   461  }
   462  
   463  func init() {
   464  	pulumi.RegisterInputType(reflect.TypeOf((*WorkflowInput)(nil)).Elem(), &Workflow{})
   465  	pulumi.RegisterInputType(reflect.TypeOf((*WorkflowArrayInput)(nil)).Elem(), WorkflowArray{})
   466  	pulumi.RegisterInputType(reflect.TypeOf((*WorkflowMapInput)(nil)).Elem(), WorkflowMap{})
   467  	pulumi.RegisterOutputType(WorkflowOutput{})
   468  	pulumi.RegisterOutputType(WorkflowArrayOutput{})
   469  	pulumi.RegisterOutputType(WorkflowMapOutput{})
   470  }