github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/cloudwatch/getEventSource.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 cloudwatch
     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 EventBridge Partner Event Source. This data source will only return one partner event source. An error will be returned if multiple sources match the same name prefix.
    15  //
    16  // > **Note:** EventBridge was formerly known as CloudWatch Events. The functionality is identical.
    17  //
    18  // ## Example Usage
    19  //
    20  // <!--Start PulumiCodeChooser -->
    21  // ```go
    22  // package main
    23  //
    24  // import (
    25  //
    26  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/cloudwatch"
    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 := cloudwatch.GetEventSource(ctx, &cloudwatch.GetEventSourceArgs{
    34  //				NamePrefix: pulumi.StringRef("aws.partner/examplepartner.com"),
    35  //			}, nil)
    36  //			if err != nil {
    37  //				return err
    38  //			}
    39  //			return nil
    40  //		})
    41  //	}
    42  //
    43  // ```
    44  // <!--End PulumiCodeChooser -->
    45  func GetEventSource(ctx *pulumi.Context, args *GetEventSourceArgs, opts ...pulumi.InvokeOption) (*GetEventSourceResult, error) {
    46  	opts = internal.PkgInvokeDefaultOpts(opts)
    47  	var rv GetEventSourceResult
    48  	err := ctx.Invoke("aws:cloudwatch/getEventSource:getEventSource", args, &rv, opts...)
    49  	if err != nil {
    50  		return nil, err
    51  	}
    52  	return &rv, nil
    53  }
    54  
    55  // A collection of arguments for invoking getEventSource.
    56  type GetEventSourceArgs struct {
    57  	// Specifying this limits the results to only those partner event sources with names that start with the specified prefix
    58  	NamePrefix *string `pulumi:"namePrefix"`
    59  }
    60  
    61  // A collection of values returned by getEventSource.
    62  type GetEventSourceResult struct {
    63  	// ARN of the partner event source
    64  	Arn string `pulumi:"arn"`
    65  	// Name of the SaaS partner that created the event source
    66  	CreatedBy string `pulumi:"createdBy"`
    67  	// The provider-assigned unique ID for this managed resource.
    68  	Id string `pulumi:"id"`
    69  	// Name of the event source
    70  	Name       string  `pulumi:"name"`
    71  	NamePrefix *string `pulumi:"namePrefix"`
    72  	// State of the event source (`ACTIVE` or `PENDING`)
    73  	State string `pulumi:"state"`
    74  }
    75  
    76  func GetEventSourceOutput(ctx *pulumi.Context, args GetEventSourceOutputArgs, opts ...pulumi.InvokeOption) GetEventSourceResultOutput {
    77  	return pulumi.ToOutputWithContext(context.Background(), args).
    78  		ApplyT(func(v interface{}) (GetEventSourceResult, error) {
    79  			args := v.(GetEventSourceArgs)
    80  			r, err := GetEventSource(ctx, &args, opts...)
    81  			var s GetEventSourceResult
    82  			if r != nil {
    83  				s = *r
    84  			}
    85  			return s, err
    86  		}).(GetEventSourceResultOutput)
    87  }
    88  
    89  // A collection of arguments for invoking getEventSource.
    90  type GetEventSourceOutputArgs struct {
    91  	// Specifying this limits the results to only those partner event sources with names that start with the specified prefix
    92  	NamePrefix pulumi.StringPtrInput `pulumi:"namePrefix"`
    93  }
    94  
    95  func (GetEventSourceOutputArgs) ElementType() reflect.Type {
    96  	return reflect.TypeOf((*GetEventSourceArgs)(nil)).Elem()
    97  }
    98  
    99  // A collection of values returned by getEventSource.
   100  type GetEventSourceResultOutput struct{ *pulumi.OutputState }
   101  
   102  func (GetEventSourceResultOutput) ElementType() reflect.Type {
   103  	return reflect.TypeOf((*GetEventSourceResult)(nil)).Elem()
   104  }
   105  
   106  func (o GetEventSourceResultOutput) ToGetEventSourceResultOutput() GetEventSourceResultOutput {
   107  	return o
   108  }
   109  
   110  func (o GetEventSourceResultOutput) ToGetEventSourceResultOutputWithContext(ctx context.Context) GetEventSourceResultOutput {
   111  	return o
   112  }
   113  
   114  // ARN of the partner event source
   115  func (o GetEventSourceResultOutput) Arn() pulumi.StringOutput {
   116  	return o.ApplyT(func(v GetEventSourceResult) string { return v.Arn }).(pulumi.StringOutput)
   117  }
   118  
   119  // Name of the SaaS partner that created the event source
   120  func (o GetEventSourceResultOutput) CreatedBy() pulumi.StringOutput {
   121  	return o.ApplyT(func(v GetEventSourceResult) string { return v.CreatedBy }).(pulumi.StringOutput)
   122  }
   123  
   124  // The provider-assigned unique ID for this managed resource.
   125  func (o GetEventSourceResultOutput) Id() pulumi.StringOutput {
   126  	return o.ApplyT(func(v GetEventSourceResult) string { return v.Id }).(pulumi.StringOutput)
   127  }
   128  
   129  // Name of the event source
   130  func (o GetEventSourceResultOutput) Name() pulumi.StringOutput {
   131  	return o.ApplyT(func(v GetEventSourceResult) string { return v.Name }).(pulumi.StringOutput)
   132  }
   133  
   134  func (o GetEventSourceResultOutput) NamePrefix() pulumi.StringPtrOutput {
   135  	return o.ApplyT(func(v GetEventSourceResult) *string { return v.NamePrefix }).(pulumi.StringPtrOutput)
   136  }
   137  
   138  // State of the event source (`ACTIVE` or `PENDING`)
   139  func (o GetEventSourceResultOutput) State() pulumi.StringOutput {
   140  	return o.ApplyT(func(v GetEventSourceResult) string { return v.State }).(pulumi.StringOutput)
   141  }
   142  
   143  func init() {
   144  	pulumi.RegisterOutputType(GetEventSourceResultOutput{})
   145  }