github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/codestarconnections/getConnection.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 codestarconnections
     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 details about CodeStar Connection.
    15  //
    16  // ## Example Usage
    17  //
    18  // ### By ARN
    19  //
    20  // <!--Start PulumiCodeChooser -->
    21  // ```go
    22  // package main
    23  //
    24  // import (
    25  //
    26  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/codestarconnections"
    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 := codestarconnections.LookupConnection(ctx, &codestarconnections.LookupConnectionArgs{
    34  //				Arn: pulumi.StringRef(exampleAwsCodestarconnectionsConnection.Arn),
    35  //			}, nil)
    36  //			if err != nil {
    37  //				return err
    38  //			}
    39  //			return nil
    40  //		})
    41  //	}
    42  //
    43  // ```
    44  // <!--End PulumiCodeChooser -->
    45  //
    46  // ### By Name
    47  //
    48  // <!--Start PulumiCodeChooser -->
    49  // ```go
    50  // package main
    51  //
    52  // import (
    53  //
    54  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/codestarconnections"
    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 := codestarconnections.LookupConnection(ctx, &codestarconnections.LookupConnectionArgs{
    62  //				Name: pulumi.StringRef(exampleAwsCodestarconnectionsConnection.Name),
    63  //			}, nil)
    64  //			if err != nil {
    65  //				return err
    66  //			}
    67  //			return nil
    68  //		})
    69  //	}
    70  //
    71  // ```
    72  // <!--End PulumiCodeChooser -->
    73  func LookupConnection(ctx *pulumi.Context, args *LookupConnectionArgs, opts ...pulumi.InvokeOption) (*LookupConnectionResult, error) {
    74  	opts = internal.PkgInvokeDefaultOpts(opts)
    75  	var rv LookupConnectionResult
    76  	err := ctx.Invoke("aws:codestarconnections/getConnection:getConnection", args, &rv, opts...)
    77  	if err != nil {
    78  		return nil, err
    79  	}
    80  	return &rv, nil
    81  }
    82  
    83  // A collection of arguments for invoking getConnection.
    84  type LookupConnectionArgs struct {
    85  	// CodeStar Connection ARN.
    86  	Arn *string `pulumi:"arn"`
    87  	// CodeStar Connection name.
    88  	//
    89  	// > **NOTE:** When both `arn` and `name` are specified, `arn` takes precedence.
    90  	Name *string `pulumi:"name"`
    91  	// Map of key-value resource tags to associate with the resource.
    92  	Tags map[string]string `pulumi:"tags"`
    93  }
    94  
    95  // A collection of values returned by getConnection.
    96  type LookupConnectionResult struct {
    97  	Arn string `pulumi:"arn"`
    98  	// CodeStar Connection status. Possible values are `PENDING`, `AVAILABLE` and `ERROR`.
    99  	ConnectionStatus string `pulumi:"connectionStatus"`
   100  	// ARN of the host associated with the connection.
   101  	HostArn string `pulumi:"hostArn"`
   102  	// The provider-assigned unique ID for this managed resource.
   103  	Id string `pulumi:"id"`
   104  	// Name of the CodeStar Connection. The name is unique in the calling AWS account.
   105  	Name string `pulumi:"name"`
   106  	// Name of the external provider where your third-party code repository is configured. Possible values are `Bitbucket`, `GitHub` and `GitLab`. For connections to GitHub Enterprise Server or GitLab Self-Managed instances, you must create an codestarconnections.Host resource and use `hostArn` instead.
   107  	ProviderType string `pulumi:"providerType"`
   108  	// Map of key-value resource tags to associate with the resource.
   109  	Tags map[string]string `pulumi:"tags"`
   110  }
   111  
   112  func LookupConnectionOutput(ctx *pulumi.Context, args LookupConnectionOutputArgs, opts ...pulumi.InvokeOption) LookupConnectionResultOutput {
   113  	return pulumi.ToOutputWithContext(context.Background(), args).
   114  		ApplyT(func(v interface{}) (LookupConnectionResult, error) {
   115  			args := v.(LookupConnectionArgs)
   116  			r, err := LookupConnection(ctx, &args, opts...)
   117  			var s LookupConnectionResult
   118  			if r != nil {
   119  				s = *r
   120  			}
   121  			return s, err
   122  		}).(LookupConnectionResultOutput)
   123  }
   124  
   125  // A collection of arguments for invoking getConnection.
   126  type LookupConnectionOutputArgs struct {
   127  	// CodeStar Connection ARN.
   128  	Arn pulumi.StringPtrInput `pulumi:"arn"`
   129  	// CodeStar Connection name.
   130  	//
   131  	// > **NOTE:** When both `arn` and `name` are specified, `arn` takes precedence.
   132  	Name pulumi.StringPtrInput `pulumi:"name"`
   133  	// Map of key-value resource tags to associate with the resource.
   134  	Tags pulumi.StringMapInput `pulumi:"tags"`
   135  }
   136  
   137  func (LookupConnectionOutputArgs) ElementType() reflect.Type {
   138  	return reflect.TypeOf((*LookupConnectionArgs)(nil)).Elem()
   139  }
   140  
   141  // A collection of values returned by getConnection.
   142  type LookupConnectionResultOutput struct{ *pulumi.OutputState }
   143  
   144  func (LookupConnectionResultOutput) ElementType() reflect.Type {
   145  	return reflect.TypeOf((*LookupConnectionResult)(nil)).Elem()
   146  }
   147  
   148  func (o LookupConnectionResultOutput) ToLookupConnectionResultOutput() LookupConnectionResultOutput {
   149  	return o
   150  }
   151  
   152  func (o LookupConnectionResultOutput) ToLookupConnectionResultOutputWithContext(ctx context.Context) LookupConnectionResultOutput {
   153  	return o
   154  }
   155  
   156  func (o LookupConnectionResultOutput) Arn() pulumi.StringOutput {
   157  	return o.ApplyT(func(v LookupConnectionResult) string { return v.Arn }).(pulumi.StringOutput)
   158  }
   159  
   160  // CodeStar Connection status. Possible values are `PENDING`, `AVAILABLE` and `ERROR`.
   161  func (o LookupConnectionResultOutput) ConnectionStatus() pulumi.StringOutput {
   162  	return o.ApplyT(func(v LookupConnectionResult) string { return v.ConnectionStatus }).(pulumi.StringOutput)
   163  }
   164  
   165  // ARN of the host associated with the connection.
   166  func (o LookupConnectionResultOutput) HostArn() pulumi.StringOutput {
   167  	return o.ApplyT(func(v LookupConnectionResult) string { return v.HostArn }).(pulumi.StringOutput)
   168  }
   169  
   170  // The provider-assigned unique ID for this managed resource.
   171  func (o LookupConnectionResultOutput) Id() pulumi.StringOutput {
   172  	return o.ApplyT(func(v LookupConnectionResult) string { return v.Id }).(pulumi.StringOutput)
   173  }
   174  
   175  // Name of the CodeStar Connection. The name is unique in the calling AWS account.
   176  func (o LookupConnectionResultOutput) Name() pulumi.StringOutput {
   177  	return o.ApplyT(func(v LookupConnectionResult) string { return v.Name }).(pulumi.StringOutput)
   178  }
   179  
   180  // Name of the external provider where your third-party code repository is configured. Possible values are `Bitbucket`, `GitHub` and `GitLab`. For connections to GitHub Enterprise Server or GitLab Self-Managed instances, you must create an codestarconnections.Host resource and use `hostArn` instead.
   181  func (o LookupConnectionResultOutput) ProviderType() pulumi.StringOutput {
   182  	return o.ApplyT(func(v LookupConnectionResult) string { return v.ProviderType }).(pulumi.StringOutput)
   183  }
   184  
   185  // Map of key-value resource tags to associate with the resource.
   186  func (o LookupConnectionResultOutput) Tags() pulumi.StringMapOutput {
   187  	return o.ApplyT(func(v LookupConnectionResult) map[string]string { return v.Tags }).(pulumi.StringMapOutput)
   188  }
   189  
   190  func init() {
   191  	pulumi.RegisterOutputType(LookupConnectionResultOutput{})
   192  }