github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/codepipeline/webhook.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 codepipeline
     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  // Provides a CodePipeline Webhook.
    16  //
    17  // ## Import
    18  //
    19  // Using `pulumi import`, import CodePipeline Webhooks using their ARN. For example:
    20  //
    21  // ```sh
    22  // $ pulumi import aws:codepipeline/webhook:Webhook example arn:aws:codepipeline:us-west-2:123456789012:webhook:example
    23  // ```
    24  type Webhook struct {
    25  	pulumi.CustomResourceState
    26  
    27  	// The CodePipeline webhook's ARN.
    28  	Arn pulumi.StringOutput `pulumi:"arn"`
    29  	// The type of authentication  to use. One of `IP`, `GITHUB_HMAC`, or `UNAUTHENTICATED`.
    30  	Authentication pulumi.StringOutput `pulumi:"authentication"`
    31  	// An `auth` block. Required for `IP` and `GITHUB_HMAC`. Auth blocks are documented below.
    32  	AuthenticationConfiguration WebhookAuthenticationConfigurationPtrOutput `pulumi:"authenticationConfiguration"`
    33  	// One or more `filter` blocks. Filter blocks are documented below.
    34  	Filters WebhookFilterArrayOutput `pulumi:"filters"`
    35  	// The name of the webhook.
    36  	Name pulumi.StringOutput `pulumi:"name"`
    37  	// A map of tags to assign to the resource. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
    38  	Tags pulumi.StringMapOutput `pulumi:"tags"`
    39  	// A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
    40  	//
    41  	// Deprecated: Please use `tags` instead.
    42  	TagsAll pulumi.StringMapOutput `pulumi:"tagsAll"`
    43  	// The name of the action in a pipeline you want to connect to the webhook. The action must be from the source (first) stage of the pipeline.
    44  	TargetAction pulumi.StringOutput `pulumi:"targetAction"`
    45  	// The name of the pipeline.
    46  	TargetPipeline pulumi.StringOutput `pulumi:"targetPipeline"`
    47  	// The CodePipeline webhook's URL. POST events to this endpoint to trigger the target.
    48  	Url pulumi.StringOutput `pulumi:"url"`
    49  }
    50  
    51  // NewWebhook registers a new resource with the given unique name, arguments, and options.
    52  func NewWebhook(ctx *pulumi.Context,
    53  	name string, args *WebhookArgs, opts ...pulumi.ResourceOption) (*Webhook, error) {
    54  	if args == nil {
    55  		return nil, errors.New("missing one or more required arguments")
    56  	}
    57  
    58  	if args.Authentication == nil {
    59  		return nil, errors.New("invalid value for required argument 'Authentication'")
    60  	}
    61  	if args.Filters == nil {
    62  		return nil, errors.New("invalid value for required argument 'Filters'")
    63  	}
    64  	if args.TargetAction == nil {
    65  		return nil, errors.New("invalid value for required argument 'TargetAction'")
    66  	}
    67  	if args.TargetPipeline == nil {
    68  		return nil, errors.New("invalid value for required argument 'TargetPipeline'")
    69  	}
    70  	opts = internal.PkgResourceDefaultOpts(opts)
    71  	var resource Webhook
    72  	err := ctx.RegisterResource("aws:codepipeline/webhook:Webhook", name, args, &resource, opts...)
    73  	if err != nil {
    74  		return nil, err
    75  	}
    76  	return &resource, nil
    77  }
    78  
    79  // GetWebhook gets an existing Webhook resource's state with the given name, ID, and optional
    80  // state properties that are used to uniquely qualify the lookup (nil if not required).
    81  func GetWebhook(ctx *pulumi.Context,
    82  	name string, id pulumi.IDInput, state *WebhookState, opts ...pulumi.ResourceOption) (*Webhook, error) {
    83  	var resource Webhook
    84  	err := ctx.ReadResource("aws:codepipeline/webhook:Webhook", name, id, state, &resource, opts...)
    85  	if err != nil {
    86  		return nil, err
    87  	}
    88  	return &resource, nil
    89  }
    90  
    91  // Input properties used for looking up and filtering Webhook resources.
    92  type webhookState struct {
    93  	// The CodePipeline webhook's ARN.
    94  	Arn *string `pulumi:"arn"`
    95  	// The type of authentication  to use. One of `IP`, `GITHUB_HMAC`, or `UNAUTHENTICATED`.
    96  	Authentication *string `pulumi:"authentication"`
    97  	// An `auth` block. Required for `IP` and `GITHUB_HMAC`. Auth blocks are documented below.
    98  	AuthenticationConfiguration *WebhookAuthenticationConfiguration `pulumi:"authenticationConfiguration"`
    99  	// One or more `filter` blocks. Filter blocks are documented below.
   100  	Filters []WebhookFilter `pulumi:"filters"`
   101  	// The name of the webhook.
   102  	Name *string `pulumi:"name"`
   103  	// A map of tags to assign to the resource. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   104  	Tags map[string]string `pulumi:"tags"`
   105  	// A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   106  	//
   107  	// Deprecated: Please use `tags` instead.
   108  	TagsAll map[string]string `pulumi:"tagsAll"`
   109  	// The name of the action in a pipeline you want to connect to the webhook. The action must be from the source (first) stage of the pipeline.
   110  	TargetAction *string `pulumi:"targetAction"`
   111  	// The name of the pipeline.
   112  	TargetPipeline *string `pulumi:"targetPipeline"`
   113  	// The CodePipeline webhook's URL. POST events to this endpoint to trigger the target.
   114  	Url *string `pulumi:"url"`
   115  }
   116  
   117  type WebhookState struct {
   118  	// The CodePipeline webhook's ARN.
   119  	Arn pulumi.StringPtrInput
   120  	// The type of authentication  to use. One of `IP`, `GITHUB_HMAC`, or `UNAUTHENTICATED`.
   121  	Authentication pulumi.StringPtrInput
   122  	// An `auth` block. Required for `IP` and `GITHUB_HMAC`. Auth blocks are documented below.
   123  	AuthenticationConfiguration WebhookAuthenticationConfigurationPtrInput
   124  	// One or more `filter` blocks. Filter blocks are documented below.
   125  	Filters WebhookFilterArrayInput
   126  	// The name of the webhook.
   127  	Name pulumi.StringPtrInput
   128  	// A map of tags to assign to the resource. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   129  	Tags pulumi.StringMapInput
   130  	// A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   131  	//
   132  	// Deprecated: Please use `tags` instead.
   133  	TagsAll pulumi.StringMapInput
   134  	// The name of the action in a pipeline you want to connect to the webhook. The action must be from the source (first) stage of the pipeline.
   135  	TargetAction pulumi.StringPtrInput
   136  	// The name of the pipeline.
   137  	TargetPipeline pulumi.StringPtrInput
   138  	// The CodePipeline webhook's URL. POST events to this endpoint to trigger the target.
   139  	Url pulumi.StringPtrInput
   140  }
   141  
   142  func (WebhookState) ElementType() reflect.Type {
   143  	return reflect.TypeOf((*webhookState)(nil)).Elem()
   144  }
   145  
   146  type webhookArgs struct {
   147  	// The type of authentication  to use. One of `IP`, `GITHUB_HMAC`, or `UNAUTHENTICATED`.
   148  	Authentication string `pulumi:"authentication"`
   149  	// An `auth` block. Required for `IP` and `GITHUB_HMAC`. Auth blocks are documented below.
   150  	AuthenticationConfiguration *WebhookAuthenticationConfiguration `pulumi:"authenticationConfiguration"`
   151  	// One or more `filter` blocks. Filter blocks are documented below.
   152  	Filters []WebhookFilter `pulumi:"filters"`
   153  	// The name of the webhook.
   154  	Name *string `pulumi:"name"`
   155  	// A map of tags to assign to the resource. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   156  	Tags map[string]string `pulumi:"tags"`
   157  	// The name of the action in a pipeline you want to connect to the webhook. The action must be from the source (first) stage of the pipeline.
   158  	TargetAction string `pulumi:"targetAction"`
   159  	// The name of the pipeline.
   160  	TargetPipeline string `pulumi:"targetPipeline"`
   161  }
   162  
   163  // The set of arguments for constructing a Webhook resource.
   164  type WebhookArgs struct {
   165  	// The type of authentication  to use. One of `IP`, `GITHUB_HMAC`, or `UNAUTHENTICATED`.
   166  	Authentication pulumi.StringInput
   167  	// An `auth` block. Required for `IP` and `GITHUB_HMAC`. Auth blocks are documented below.
   168  	AuthenticationConfiguration WebhookAuthenticationConfigurationPtrInput
   169  	// One or more `filter` blocks. Filter blocks are documented below.
   170  	Filters WebhookFilterArrayInput
   171  	// The name of the webhook.
   172  	Name pulumi.StringPtrInput
   173  	// A map of tags to assign to the resource. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   174  	Tags pulumi.StringMapInput
   175  	// The name of the action in a pipeline you want to connect to the webhook. The action must be from the source (first) stage of the pipeline.
   176  	TargetAction pulumi.StringInput
   177  	// The name of the pipeline.
   178  	TargetPipeline pulumi.StringInput
   179  }
   180  
   181  func (WebhookArgs) ElementType() reflect.Type {
   182  	return reflect.TypeOf((*webhookArgs)(nil)).Elem()
   183  }
   184  
   185  type WebhookInput interface {
   186  	pulumi.Input
   187  
   188  	ToWebhookOutput() WebhookOutput
   189  	ToWebhookOutputWithContext(ctx context.Context) WebhookOutput
   190  }
   191  
   192  func (*Webhook) ElementType() reflect.Type {
   193  	return reflect.TypeOf((**Webhook)(nil)).Elem()
   194  }
   195  
   196  func (i *Webhook) ToWebhookOutput() WebhookOutput {
   197  	return i.ToWebhookOutputWithContext(context.Background())
   198  }
   199  
   200  func (i *Webhook) ToWebhookOutputWithContext(ctx context.Context) WebhookOutput {
   201  	return pulumi.ToOutputWithContext(ctx, i).(WebhookOutput)
   202  }
   203  
   204  // WebhookArrayInput is an input type that accepts WebhookArray and WebhookArrayOutput values.
   205  // You can construct a concrete instance of `WebhookArrayInput` via:
   206  //
   207  //	WebhookArray{ WebhookArgs{...} }
   208  type WebhookArrayInput interface {
   209  	pulumi.Input
   210  
   211  	ToWebhookArrayOutput() WebhookArrayOutput
   212  	ToWebhookArrayOutputWithContext(context.Context) WebhookArrayOutput
   213  }
   214  
   215  type WebhookArray []WebhookInput
   216  
   217  func (WebhookArray) ElementType() reflect.Type {
   218  	return reflect.TypeOf((*[]*Webhook)(nil)).Elem()
   219  }
   220  
   221  func (i WebhookArray) ToWebhookArrayOutput() WebhookArrayOutput {
   222  	return i.ToWebhookArrayOutputWithContext(context.Background())
   223  }
   224  
   225  func (i WebhookArray) ToWebhookArrayOutputWithContext(ctx context.Context) WebhookArrayOutput {
   226  	return pulumi.ToOutputWithContext(ctx, i).(WebhookArrayOutput)
   227  }
   228  
   229  // WebhookMapInput is an input type that accepts WebhookMap and WebhookMapOutput values.
   230  // You can construct a concrete instance of `WebhookMapInput` via:
   231  //
   232  //	WebhookMap{ "key": WebhookArgs{...} }
   233  type WebhookMapInput interface {
   234  	pulumi.Input
   235  
   236  	ToWebhookMapOutput() WebhookMapOutput
   237  	ToWebhookMapOutputWithContext(context.Context) WebhookMapOutput
   238  }
   239  
   240  type WebhookMap map[string]WebhookInput
   241  
   242  func (WebhookMap) ElementType() reflect.Type {
   243  	return reflect.TypeOf((*map[string]*Webhook)(nil)).Elem()
   244  }
   245  
   246  func (i WebhookMap) ToWebhookMapOutput() WebhookMapOutput {
   247  	return i.ToWebhookMapOutputWithContext(context.Background())
   248  }
   249  
   250  func (i WebhookMap) ToWebhookMapOutputWithContext(ctx context.Context) WebhookMapOutput {
   251  	return pulumi.ToOutputWithContext(ctx, i).(WebhookMapOutput)
   252  }
   253  
   254  type WebhookOutput struct{ *pulumi.OutputState }
   255  
   256  func (WebhookOutput) ElementType() reflect.Type {
   257  	return reflect.TypeOf((**Webhook)(nil)).Elem()
   258  }
   259  
   260  func (o WebhookOutput) ToWebhookOutput() WebhookOutput {
   261  	return o
   262  }
   263  
   264  func (o WebhookOutput) ToWebhookOutputWithContext(ctx context.Context) WebhookOutput {
   265  	return o
   266  }
   267  
   268  // The CodePipeline webhook's ARN.
   269  func (o WebhookOutput) Arn() pulumi.StringOutput {
   270  	return o.ApplyT(func(v *Webhook) pulumi.StringOutput { return v.Arn }).(pulumi.StringOutput)
   271  }
   272  
   273  // The type of authentication  to use. One of `IP`, `GITHUB_HMAC`, or `UNAUTHENTICATED`.
   274  func (o WebhookOutput) Authentication() pulumi.StringOutput {
   275  	return o.ApplyT(func(v *Webhook) pulumi.StringOutput { return v.Authentication }).(pulumi.StringOutput)
   276  }
   277  
   278  // An `auth` block. Required for `IP` and `GITHUB_HMAC`. Auth blocks are documented below.
   279  func (o WebhookOutput) AuthenticationConfiguration() WebhookAuthenticationConfigurationPtrOutput {
   280  	return o.ApplyT(func(v *Webhook) WebhookAuthenticationConfigurationPtrOutput { return v.AuthenticationConfiguration }).(WebhookAuthenticationConfigurationPtrOutput)
   281  }
   282  
   283  // One or more `filter` blocks. Filter blocks are documented below.
   284  func (o WebhookOutput) Filters() WebhookFilterArrayOutput {
   285  	return o.ApplyT(func(v *Webhook) WebhookFilterArrayOutput { return v.Filters }).(WebhookFilterArrayOutput)
   286  }
   287  
   288  // The name of the webhook.
   289  func (o WebhookOutput) Name() pulumi.StringOutput {
   290  	return o.ApplyT(func(v *Webhook) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput)
   291  }
   292  
   293  // A map of tags to assign to the resource. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   294  func (o WebhookOutput) Tags() pulumi.StringMapOutput {
   295  	return o.ApplyT(func(v *Webhook) pulumi.StringMapOutput { return v.Tags }).(pulumi.StringMapOutput)
   296  }
   297  
   298  // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   299  //
   300  // Deprecated: Please use `tags` instead.
   301  func (o WebhookOutput) TagsAll() pulumi.StringMapOutput {
   302  	return o.ApplyT(func(v *Webhook) pulumi.StringMapOutput { return v.TagsAll }).(pulumi.StringMapOutput)
   303  }
   304  
   305  // The name of the action in a pipeline you want to connect to the webhook. The action must be from the source (first) stage of the pipeline.
   306  func (o WebhookOutput) TargetAction() pulumi.StringOutput {
   307  	return o.ApplyT(func(v *Webhook) pulumi.StringOutput { return v.TargetAction }).(pulumi.StringOutput)
   308  }
   309  
   310  // The name of the pipeline.
   311  func (o WebhookOutput) TargetPipeline() pulumi.StringOutput {
   312  	return o.ApplyT(func(v *Webhook) pulumi.StringOutput { return v.TargetPipeline }).(pulumi.StringOutput)
   313  }
   314  
   315  // The CodePipeline webhook's URL. POST events to this endpoint to trigger the target.
   316  func (o WebhookOutput) Url() pulumi.StringOutput {
   317  	return o.ApplyT(func(v *Webhook) pulumi.StringOutput { return v.Url }).(pulumi.StringOutput)
   318  }
   319  
   320  type WebhookArrayOutput struct{ *pulumi.OutputState }
   321  
   322  func (WebhookArrayOutput) ElementType() reflect.Type {
   323  	return reflect.TypeOf((*[]*Webhook)(nil)).Elem()
   324  }
   325  
   326  func (o WebhookArrayOutput) ToWebhookArrayOutput() WebhookArrayOutput {
   327  	return o
   328  }
   329  
   330  func (o WebhookArrayOutput) ToWebhookArrayOutputWithContext(ctx context.Context) WebhookArrayOutput {
   331  	return o
   332  }
   333  
   334  func (o WebhookArrayOutput) Index(i pulumi.IntInput) WebhookOutput {
   335  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *Webhook {
   336  		return vs[0].([]*Webhook)[vs[1].(int)]
   337  	}).(WebhookOutput)
   338  }
   339  
   340  type WebhookMapOutput struct{ *pulumi.OutputState }
   341  
   342  func (WebhookMapOutput) ElementType() reflect.Type {
   343  	return reflect.TypeOf((*map[string]*Webhook)(nil)).Elem()
   344  }
   345  
   346  func (o WebhookMapOutput) ToWebhookMapOutput() WebhookMapOutput {
   347  	return o
   348  }
   349  
   350  func (o WebhookMapOutput) ToWebhookMapOutputWithContext(ctx context.Context) WebhookMapOutput {
   351  	return o
   352  }
   353  
   354  func (o WebhookMapOutput) MapIndex(k pulumi.StringInput) WebhookOutput {
   355  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *Webhook {
   356  		return vs[0].(map[string]*Webhook)[vs[1].(string)]
   357  	}).(WebhookOutput)
   358  }
   359  
   360  func init() {
   361  	pulumi.RegisterInputType(reflect.TypeOf((*WebhookInput)(nil)).Elem(), &Webhook{})
   362  	pulumi.RegisterInputType(reflect.TypeOf((*WebhookArrayInput)(nil)).Elem(), WebhookArray{})
   363  	pulumi.RegisterInputType(reflect.TypeOf((*WebhookMapInput)(nil)).Elem(), WebhookMap{})
   364  	pulumi.RegisterOutputType(WebhookOutput{})
   365  	pulumi.RegisterOutputType(WebhookArrayOutput{})
   366  	pulumi.RegisterOutputType(WebhookMapOutput{})
   367  }