github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/serverlessrepository/getApplication.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 serverlessrepository
     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  // Use this data source to get information about an AWS Serverless Application Repository application. For example, this can be used to determine the required `capabilities` for an application.
    15  //
    16  // ## Example Usage
    17  //
    18  // <!--Start PulumiCodeChooser -->
    19  // ```go
    20  // package main
    21  //
    22  // import (
    23  //
    24  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/serverlessrepository"
    25  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    26  //
    27  // )
    28  //
    29  //	func main() {
    30  //		pulumi.Run(func(ctx *pulumi.Context) error {
    31  //			example, err := serverlessrepository.GetApplication(ctx, &serverlessrepository.GetApplicationArgs{
    32  //				ApplicationId: "arn:aws:serverlessrepo:us-east-1:123456789012:applications/ExampleApplication",
    33  //			}, nil)
    34  //			if err != nil {
    35  //				return err
    36  //			}
    37  //			_, err = serverlessrepository.NewCloudFormationStack(ctx, "example", &serverlessrepository.CloudFormationStackArgs{
    38  //				Name:            pulumi.String("Example"),
    39  //				ApplicationId:   pulumi.String(example.ApplicationId),
    40  //				SemanticVersion: pulumi.String(example.SemanticVersion),
    41  //				Capabilities:    interface{}(example.RequiredCapabilities),
    42  //			})
    43  //			if err != nil {
    44  //				return err
    45  //			}
    46  //			return nil
    47  //		})
    48  //	}
    49  //
    50  // ```
    51  // <!--End PulumiCodeChooser -->
    52  func GetApplication(ctx *pulumi.Context, args *GetApplicationArgs, opts ...pulumi.InvokeOption) (*GetApplicationResult, error) {
    53  	opts = internal.PkgInvokeDefaultOpts(opts)
    54  	var rv GetApplicationResult
    55  	err := ctx.Invoke("aws:serverlessrepository/getApplication:getApplication", args, &rv, opts...)
    56  	if err != nil {
    57  		return nil, err
    58  	}
    59  	return &rv, nil
    60  }
    61  
    62  // A collection of arguments for invoking getApplication.
    63  type GetApplicationArgs struct {
    64  	// ARN of the application.
    65  	ApplicationId string `pulumi:"applicationId"`
    66  	// Requested version of the application. By default, retrieves the latest version.
    67  	SemanticVersion *string `pulumi:"semanticVersion"`
    68  }
    69  
    70  // A collection of values returned by getApplication.
    71  type GetApplicationResult struct {
    72  	// ARN of the application.
    73  	ApplicationId string `pulumi:"applicationId"`
    74  	// The provider-assigned unique ID for this managed resource.
    75  	Id string `pulumi:"id"`
    76  	// Name of the application.
    77  	Name string `pulumi:"name"`
    78  	// A list of capabilities describing the permissions needed to deploy the application.
    79  	RequiredCapabilities []string `pulumi:"requiredCapabilities"`
    80  	SemanticVersion      string   `pulumi:"semanticVersion"`
    81  	// URL pointing to the source code of the application version.
    82  	SourceCodeUrl string `pulumi:"sourceCodeUrl"`
    83  	// URL pointing to the Cloud Formation template for the application version.
    84  	TemplateUrl string `pulumi:"templateUrl"`
    85  }
    86  
    87  func GetApplicationOutput(ctx *pulumi.Context, args GetApplicationOutputArgs, opts ...pulumi.InvokeOption) GetApplicationResultOutput {
    88  	return pulumi.ToOutputWithContext(context.Background(), args).
    89  		ApplyT(func(v interface{}) (GetApplicationResult, error) {
    90  			args := v.(GetApplicationArgs)
    91  			r, err := GetApplication(ctx, &args, opts...)
    92  			var s GetApplicationResult
    93  			if r != nil {
    94  				s = *r
    95  			}
    96  			return s, err
    97  		}).(GetApplicationResultOutput)
    98  }
    99  
   100  // A collection of arguments for invoking getApplication.
   101  type GetApplicationOutputArgs struct {
   102  	// ARN of the application.
   103  	ApplicationId pulumi.StringInput `pulumi:"applicationId"`
   104  	// Requested version of the application. By default, retrieves the latest version.
   105  	SemanticVersion pulumi.StringPtrInput `pulumi:"semanticVersion"`
   106  }
   107  
   108  func (GetApplicationOutputArgs) ElementType() reflect.Type {
   109  	return reflect.TypeOf((*GetApplicationArgs)(nil)).Elem()
   110  }
   111  
   112  // A collection of values returned by getApplication.
   113  type GetApplicationResultOutput struct{ *pulumi.OutputState }
   114  
   115  func (GetApplicationResultOutput) ElementType() reflect.Type {
   116  	return reflect.TypeOf((*GetApplicationResult)(nil)).Elem()
   117  }
   118  
   119  func (o GetApplicationResultOutput) ToGetApplicationResultOutput() GetApplicationResultOutput {
   120  	return o
   121  }
   122  
   123  func (o GetApplicationResultOutput) ToGetApplicationResultOutputWithContext(ctx context.Context) GetApplicationResultOutput {
   124  	return o
   125  }
   126  
   127  // ARN of the application.
   128  func (o GetApplicationResultOutput) ApplicationId() pulumi.StringOutput {
   129  	return o.ApplyT(func(v GetApplicationResult) string { return v.ApplicationId }).(pulumi.StringOutput)
   130  }
   131  
   132  // The provider-assigned unique ID for this managed resource.
   133  func (o GetApplicationResultOutput) Id() pulumi.StringOutput {
   134  	return o.ApplyT(func(v GetApplicationResult) string { return v.Id }).(pulumi.StringOutput)
   135  }
   136  
   137  // Name of the application.
   138  func (o GetApplicationResultOutput) Name() pulumi.StringOutput {
   139  	return o.ApplyT(func(v GetApplicationResult) string { return v.Name }).(pulumi.StringOutput)
   140  }
   141  
   142  // A list of capabilities describing the permissions needed to deploy the application.
   143  func (o GetApplicationResultOutput) RequiredCapabilities() pulumi.StringArrayOutput {
   144  	return o.ApplyT(func(v GetApplicationResult) []string { return v.RequiredCapabilities }).(pulumi.StringArrayOutput)
   145  }
   146  
   147  func (o GetApplicationResultOutput) SemanticVersion() pulumi.StringOutput {
   148  	return o.ApplyT(func(v GetApplicationResult) string { return v.SemanticVersion }).(pulumi.StringOutput)
   149  }
   150  
   151  // URL pointing to the source code of the application version.
   152  func (o GetApplicationResultOutput) SourceCodeUrl() pulumi.StringOutput {
   153  	return o.ApplyT(func(v GetApplicationResult) string { return v.SourceCodeUrl }).(pulumi.StringOutput)
   154  }
   155  
   156  // URL pointing to the Cloud Formation template for the application version.
   157  func (o GetApplicationResultOutput) TemplateUrl() pulumi.StringOutput {
   158  	return o.ApplyT(func(v GetApplicationResult) string { return v.TemplateUrl }).(pulumi.StringOutput)
   159  }
   160  
   161  func init() {
   162  	pulumi.RegisterOutputType(GetApplicationResultOutput{})
   163  }