github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/batch/getJobDefinition.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 batch
     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  // Data source for managing an AWS Batch Job Definition.
    15  //
    16  // ## Example Usage
    17  //
    18  // ### Lookup via Arn
    19  //
    20  // <!--Start PulumiCodeChooser -->
    21  // ```go
    22  // package main
    23  //
    24  // import (
    25  //
    26  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/batch"
    27  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    28  //
    29  // )
    30  //
    31  //	func main() {
    32  //		pulumi.Run(func(ctx *pulumi.Context) error {
    33  //			_, err := batch.LookupJobDefinition(ctx, &batch.LookupJobDefinitionArgs{
    34  //				Arn: pulumi.StringRef("arn:aws:batch:us-east-1:012345678910:job-definition/example"),
    35  //			}, nil)
    36  //			if err != nil {
    37  //				return err
    38  //			}
    39  //			return nil
    40  //		})
    41  //	}
    42  //
    43  // ```
    44  // <!--End PulumiCodeChooser -->
    45  //
    46  // ### Lookup via Name
    47  //
    48  // <!--Start PulumiCodeChooser -->
    49  // ```go
    50  // package main
    51  //
    52  // import (
    53  //
    54  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/batch"
    55  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    56  //
    57  // )
    58  //
    59  //	func main() {
    60  //		pulumi.Run(func(ctx *pulumi.Context) error {
    61  //			_, err := batch.LookupJobDefinition(ctx, &batch.LookupJobDefinitionArgs{
    62  //				Name:     pulumi.StringRef("example"),
    63  //				Revision: pulumi.IntRef(2),
    64  //			}, nil)
    65  //			if err != nil {
    66  //				return err
    67  //			}
    68  //			return nil
    69  //		})
    70  //	}
    71  //
    72  // ```
    73  // <!--End PulumiCodeChooser -->
    74  func LookupJobDefinition(ctx *pulumi.Context, args *LookupJobDefinitionArgs, opts ...pulumi.InvokeOption) (*LookupJobDefinitionResult, error) {
    75  	opts = internal.PkgInvokeDefaultOpts(opts)
    76  	var rv LookupJobDefinitionResult
    77  	err := ctx.Invoke("aws:batch/getJobDefinition:getJobDefinition", args, &rv, opts...)
    78  	if err != nil {
    79  		return nil, err
    80  	}
    81  	return &rv, nil
    82  }
    83  
    84  // A collection of arguments for invoking getJobDefinition.
    85  type LookupJobDefinitionArgs struct {
    86  	// ARN of the Job Definition. Do not begin the description with "An", "The", "Defines", "Indicates", or "Specifies," as these are verbose. In other words, "Indicates the amount of storage," can be rewritten as "Amount of storage," without losing any information.
    87  	Arn *string `pulumi:"arn"`
    88  	// The name of the job definition to register. It can be up to 128 letters long. It can contain uppercase and lowercase letters, numbers, hyphens (-), and underscores (_).
    89  	Name *string `pulumi:"name"`
    90  	// The revision of the job definition.
    91  	Revision *int `pulumi:"revision"`
    92  	// The status of the job definition.
    93  	Status *string `pulumi:"status"`
    94  }
    95  
    96  // A collection of values returned by getJobDefinition.
    97  type LookupJobDefinitionResult struct {
    98  	Arn       *string `pulumi:"arn"`
    99  	ArnPrefix string  `pulumi:"arnPrefix"`
   100  	// The orchestration type of the compute environment.
   101  	ContainerOrchestrationType string `pulumi:"containerOrchestrationType"`
   102  	// An object with various properties that are specific to Amazon EKS based jobs. This must not be specified for Amazon ECS based job definitions.
   103  	EksProperties []GetJobDefinitionEksProperty `pulumi:"eksProperties"`
   104  	// The ARN
   105  	Id string `pulumi:"id"`
   106  	// The name of the volume.
   107  	Name *string `pulumi:"name"`
   108  	// An object with various properties specific to multi-node parallel jobs. If you specify node properties for a job, it becomes a multi-node parallel job. For more information, see Multi-node Parallel Jobs in the AWS Batch User Guide. If the job definition's type parameter is container, then you must specify either containerProperties or nodeProperties.
   109  	NodeProperties []GetJobDefinitionNodeProperty `pulumi:"nodeProperties"`
   110  	// The retry strategy to use for failed jobs that are submitted with this job definition. Any retry strategy that's specified during a SubmitJob operation overrides the retry strategy defined here. If a job is terminated due to a timeout, it isn't retried.
   111  	RetryStrategies []GetJobDefinitionRetryStrategy `pulumi:"retryStrategies"`
   112  	Revision        *int                            `pulumi:"revision"`
   113  	// The scheduling priority for jobs that are submitted with this job definition. This only affects jobs in job queues with a fair share policy. Jobs with a higher scheduling priority are scheduled before jobs with a lower scheduling priority.
   114  	SchedulingPriority int               `pulumi:"schedulingPriority"`
   115  	Status             *string           `pulumi:"status"`
   116  	Tags               map[string]string `pulumi:"tags"`
   117  	// The timeout configuration for jobs that are submitted with this job definition, after which AWS Batch terminates your jobs if they have not finished. If a job is terminated due to a timeout, it isn't retried. The minimum value for the timeout is 60 seconds.
   118  	Timeouts []GetJobDefinitionTimeout `pulumi:"timeouts"`
   119  	// The type of resource to assign to a container. The supported resources include `GPU`, `MEMORY`, and `VCPU`.
   120  	Type string `pulumi:"type"`
   121  }
   122  
   123  func LookupJobDefinitionOutput(ctx *pulumi.Context, args LookupJobDefinitionOutputArgs, opts ...pulumi.InvokeOption) LookupJobDefinitionResultOutput {
   124  	return pulumi.ToOutputWithContext(context.Background(), args).
   125  		ApplyT(func(v interface{}) (LookupJobDefinitionResult, error) {
   126  			args := v.(LookupJobDefinitionArgs)
   127  			r, err := LookupJobDefinition(ctx, &args, opts...)
   128  			var s LookupJobDefinitionResult
   129  			if r != nil {
   130  				s = *r
   131  			}
   132  			return s, err
   133  		}).(LookupJobDefinitionResultOutput)
   134  }
   135  
   136  // A collection of arguments for invoking getJobDefinition.
   137  type LookupJobDefinitionOutputArgs struct {
   138  	// ARN of the Job Definition. Do not begin the description with "An", "The", "Defines", "Indicates", or "Specifies," as these are verbose. In other words, "Indicates the amount of storage," can be rewritten as "Amount of storage," without losing any information.
   139  	Arn pulumi.StringPtrInput `pulumi:"arn"`
   140  	// The name of the job definition to register. It can be up to 128 letters long. It can contain uppercase and lowercase letters, numbers, hyphens (-), and underscores (_).
   141  	Name pulumi.StringPtrInput `pulumi:"name"`
   142  	// The revision of the job definition.
   143  	Revision pulumi.IntPtrInput `pulumi:"revision"`
   144  	// The status of the job definition.
   145  	Status pulumi.StringPtrInput `pulumi:"status"`
   146  }
   147  
   148  func (LookupJobDefinitionOutputArgs) ElementType() reflect.Type {
   149  	return reflect.TypeOf((*LookupJobDefinitionArgs)(nil)).Elem()
   150  }
   151  
   152  // A collection of values returned by getJobDefinition.
   153  type LookupJobDefinitionResultOutput struct{ *pulumi.OutputState }
   154  
   155  func (LookupJobDefinitionResultOutput) ElementType() reflect.Type {
   156  	return reflect.TypeOf((*LookupJobDefinitionResult)(nil)).Elem()
   157  }
   158  
   159  func (o LookupJobDefinitionResultOutput) ToLookupJobDefinitionResultOutput() LookupJobDefinitionResultOutput {
   160  	return o
   161  }
   162  
   163  func (o LookupJobDefinitionResultOutput) ToLookupJobDefinitionResultOutputWithContext(ctx context.Context) LookupJobDefinitionResultOutput {
   164  	return o
   165  }
   166  
   167  func (o LookupJobDefinitionResultOutput) Arn() pulumi.StringPtrOutput {
   168  	return o.ApplyT(func(v LookupJobDefinitionResult) *string { return v.Arn }).(pulumi.StringPtrOutput)
   169  }
   170  
   171  func (o LookupJobDefinitionResultOutput) ArnPrefix() pulumi.StringOutput {
   172  	return o.ApplyT(func(v LookupJobDefinitionResult) string { return v.ArnPrefix }).(pulumi.StringOutput)
   173  }
   174  
   175  // The orchestration type of the compute environment.
   176  func (o LookupJobDefinitionResultOutput) ContainerOrchestrationType() pulumi.StringOutput {
   177  	return o.ApplyT(func(v LookupJobDefinitionResult) string { return v.ContainerOrchestrationType }).(pulumi.StringOutput)
   178  }
   179  
   180  // An object with various properties that are specific to Amazon EKS based jobs. This must not be specified for Amazon ECS based job definitions.
   181  func (o LookupJobDefinitionResultOutput) EksProperties() GetJobDefinitionEksPropertyArrayOutput {
   182  	return o.ApplyT(func(v LookupJobDefinitionResult) []GetJobDefinitionEksProperty { return v.EksProperties }).(GetJobDefinitionEksPropertyArrayOutput)
   183  }
   184  
   185  // The ARN
   186  func (o LookupJobDefinitionResultOutput) Id() pulumi.StringOutput {
   187  	return o.ApplyT(func(v LookupJobDefinitionResult) string { return v.Id }).(pulumi.StringOutput)
   188  }
   189  
   190  // The name of the volume.
   191  func (o LookupJobDefinitionResultOutput) Name() pulumi.StringPtrOutput {
   192  	return o.ApplyT(func(v LookupJobDefinitionResult) *string { return v.Name }).(pulumi.StringPtrOutput)
   193  }
   194  
   195  // An object with various properties specific to multi-node parallel jobs. If you specify node properties for a job, it becomes a multi-node parallel job. For more information, see Multi-node Parallel Jobs in the AWS Batch User Guide. If the job definition's type parameter is container, then you must specify either containerProperties or nodeProperties.
   196  func (o LookupJobDefinitionResultOutput) NodeProperties() GetJobDefinitionNodePropertyArrayOutput {
   197  	return o.ApplyT(func(v LookupJobDefinitionResult) []GetJobDefinitionNodeProperty { return v.NodeProperties }).(GetJobDefinitionNodePropertyArrayOutput)
   198  }
   199  
   200  // The retry strategy to use for failed jobs that are submitted with this job definition. Any retry strategy that's specified during a SubmitJob operation overrides the retry strategy defined here. If a job is terminated due to a timeout, it isn't retried.
   201  func (o LookupJobDefinitionResultOutput) RetryStrategies() GetJobDefinitionRetryStrategyArrayOutput {
   202  	return o.ApplyT(func(v LookupJobDefinitionResult) []GetJobDefinitionRetryStrategy { return v.RetryStrategies }).(GetJobDefinitionRetryStrategyArrayOutput)
   203  }
   204  
   205  func (o LookupJobDefinitionResultOutput) Revision() pulumi.IntPtrOutput {
   206  	return o.ApplyT(func(v LookupJobDefinitionResult) *int { return v.Revision }).(pulumi.IntPtrOutput)
   207  }
   208  
   209  // The scheduling priority for jobs that are submitted with this job definition. This only affects jobs in job queues with a fair share policy. Jobs with a higher scheduling priority are scheduled before jobs with a lower scheduling priority.
   210  func (o LookupJobDefinitionResultOutput) SchedulingPriority() pulumi.IntOutput {
   211  	return o.ApplyT(func(v LookupJobDefinitionResult) int { return v.SchedulingPriority }).(pulumi.IntOutput)
   212  }
   213  
   214  func (o LookupJobDefinitionResultOutput) Status() pulumi.StringPtrOutput {
   215  	return o.ApplyT(func(v LookupJobDefinitionResult) *string { return v.Status }).(pulumi.StringPtrOutput)
   216  }
   217  
   218  func (o LookupJobDefinitionResultOutput) Tags() pulumi.StringMapOutput {
   219  	return o.ApplyT(func(v LookupJobDefinitionResult) map[string]string { return v.Tags }).(pulumi.StringMapOutput)
   220  }
   221  
   222  // The timeout configuration for jobs that are submitted with this job definition, after which AWS Batch terminates your jobs if they have not finished. If a job is terminated due to a timeout, it isn't retried. The minimum value for the timeout is 60 seconds.
   223  func (o LookupJobDefinitionResultOutput) Timeouts() GetJobDefinitionTimeoutArrayOutput {
   224  	return o.ApplyT(func(v LookupJobDefinitionResult) []GetJobDefinitionTimeout { return v.Timeouts }).(GetJobDefinitionTimeoutArrayOutput)
   225  }
   226  
   227  // The type of resource to assign to a container. The supported resources include `GPU`, `MEMORY`, and `VCPU`.
   228  func (o LookupJobDefinitionResultOutput) Type() pulumi.StringOutput {
   229  	return o.ApplyT(func(v LookupJobDefinitionResult) string { return v.Type }).(pulumi.StringOutput)
   230  }
   231  
   232  func init() {
   233  	pulumi.RegisterOutputType(LookupJobDefinitionResultOutput{})
   234  }