github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/amplify/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 amplify
     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 an Amplify Webhook resource.
    16  //
    17  // ## Example Usage
    18  //
    19  // <!--Start PulumiCodeChooser -->
    20  // ```go
    21  // package main
    22  //
    23  // import (
    24  //
    25  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/amplify"
    26  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    27  //
    28  // )
    29  //
    30  //	func main() {
    31  //		pulumi.Run(func(ctx *pulumi.Context) error {
    32  //			example, err := amplify.NewApp(ctx, "example", &amplify.AppArgs{
    33  //				Name: pulumi.String("app"),
    34  //			})
    35  //			if err != nil {
    36  //				return err
    37  //			}
    38  //			master, err := amplify.NewBranch(ctx, "master", &amplify.BranchArgs{
    39  //				AppId:      example.ID(),
    40  //				BranchName: pulumi.String("master"),
    41  //			})
    42  //			if err != nil {
    43  //				return err
    44  //			}
    45  //			_, err = amplify.NewWebhook(ctx, "master", &amplify.WebhookArgs{
    46  //				AppId:       example.ID(),
    47  //				BranchName:  master.BranchName,
    48  //				Description: pulumi.String("triggermaster"),
    49  //			})
    50  //			if err != nil {
    51  //				return err
    52  //			}
    53  //			return nil
    54  //		})
    55  //	}
    56  //
    57  // ```
    58  // <!--End PulumiCodeChooser -->
    59  //
    60  // ## Import
    61  //
    62  // Using `pulumi import`, import Amplify webhook using a webhook ID. For example:
    63  //
    64  // ```sh
    65  // $ pulumi import aws:amplify/webhook:Webhook master a26b22a0-748b-4b57-b9a0-ae7e601fe4b1
    66  // ```
    67  type Webhook struct {
    68  	pulumi.CustomResourceState
    69  
    70  	// Unique ID for an Amplify app.
    71  	AppId pulumi.StringOutput `pulumi:"appId"`
    72  	// ARN for the webhook.
    73  	Arn pulumi.StringOutput `pulumi:"arn"`
    74  	// Name for a branch that is part of the Amplify app.
    75  	BranchName pulumi.StringOutput `pulumi:"branchName"`
    76  	// Description for a webhook.
    77  	Description pulumi.StringPtrOutput `pulumi:"description"`
    78  	// URL of the webhook.
    79  	Url pulumi.StringOutput `pulumi:"url"`
    80  }
    81  
    82  // NewWebhook registers a new resource with the given unique name, arguments, and options.
    83  func NewWebhook(ctx *pulumi.Context,
    84  	name string, args *WebhookArgs, opts ...pulumi.ResourceOption) (*Webhook, error) {
    85  	if args == nil {
    86  		return nil, errors.New("missing one or more required arguments")
    87  	}
    88  
    89  	if args.AppId == nil {
    90  		return nil, errors.New("invalid value for required argument 'AppId'")
    91  	}
    92  	if args.BranchName == nil {
    93  		return nil, errors.New("invalid value for required argument 'BranchName'")
    94  	}
    95  	opts = internal.PkgResourceDefaultOpts(opts)
    96  	var resource Webhook
    97  	err := ctx.RegisterResource("aws:amplify/webhook:Webhook", name, args, &resource, opts...)
    98  	if err != nil {
    99  		return nil, err
   100  	}
   101  	return &resource, nil
   102  }
   103  
   104  // GetWebhook gets an existing Webhook resource's state with the given name, ID, and optional
   105  // state properties that are used to uniquely qualify the lookup (nil if not required).
   106  func GetWebhook(ctx *pulumi.Context,
   107  	name string, id pulumi.IDInput, state *WebhookState, opts ...pulumi.ResourceOption) (*Webhook, error) {
   108  	var resource Webhook
   109  	err := ctx.ReadResource("aws:amplify/webhook:Webhook", name, id, state, &resource, opts...)
   110  	if err != nil {
   111  		return nil, err
   112  	}
   113  	return &resource, nil
   114  }
   115  
   116  // Input properties used for looking up and filtering Webhook resources.
   117  type webhookState struct {
   118  	// Unique ID for an Amplify app.
   119  	AppId *string `pulumi:"appId"`
   120  	// ARN for the webhook.
   121  	Arn *string `pulumi:"arn"`
   122  	// Name for a branch that is part of the Amplify app.
   123  	BranchName *string `pulumi:"branchName"`
   124  	// Description for a webhook.
   125  	Description *string `pulumi:"description"`
   126  	// URL of the webhook.
   127  	Url *string `pulumi:"url"`
   128  }
   129  
   130  type WebhookState struct {
   131  	// Unique ID for an Amplify app.
   132  	AppId pulumi.StringPtrInput
   133  	// ARN for the webhook.
   134  	Arn pulumi.StringPtrInput
   135  	// Name for a branch that is part of the Amplify app.
   136  	BranchName pulumi.StringPtrInput
   137  	// Description for a webhook.
   138  	Description pulumi.StringPtrInput
   139  	// URL of the webhook.
   140  	Url pulumi.StringPtrInput
   141  }
   142  
   143  func (WebhookState) ElementType() reflect.Type {
   144  	return reflect.TypeOf((*webhookState)(nil)).Elem()
   145  }
   146  
   147  type webhookArgs struct {
   148  	// Unique ID for an Amplify app.
   149  	AppId string `pulumi:"appId"`
   150  	// Name for a branch that is part of the Amplify app.
   151  	BranchName string `pulumi:"branchName"`
   152  	// Description for a webhook.
   153  	Description *string `pulumi:"description"`
   154  }
   155  
   156  // The set of arguments for constructing a Webhook resource.
   157  type WebhookArgs struct {
   158  	// Unique ID for an Amplify app.
   159  	AppId pulumi.StringInput
   160  	// Name for a branch that is part of the Amplify app.
   161  	BranchName pulumi.StringInput
   162  	// Description for a webhook.
   163  	Description pulumi.StringPtrInput
   164  }
   165  
   166  func (WebhookArgs) ElementType() reflect.Type {
   167  	return reflect.TypeOf((*webhookArgs)(nil)).Elem()
   168  }
   169  
   170  type WebhookInput interface {
   171  	pulumi.Input
   172  
   173  	ToWebhookOutput() WebhookOutput
   174  	ToWebhookOutputWithContext(ctx context.Context) WebhookOutput
   175  }
   176  
   177  func (*Webhook) ElementType() reflect.Type {
   178  	return reflect.TypeOf((**Webhook)(nil)).Elem()
   179  }
   180  
   181  func (i *Webhook) ToWebhookOutput() WebhookOutput {
   182  	return i.ToWebhookOutputWithContext(context.Background())
   183  }
   184  
   185  func (i *Webhook) ToWebhookOutputWithContext(ctx context.Context) WebhookOutput {
   186  	return pulumi.ToOutputWithContext(ctx, i).(WebhookOutput)
   187  }
   188  
   189  // WebhookArrayInput is an input type that accepts WebhookArray and WebhookArrayOutput values.
   190  // You can construct a concrete instance of `WebhookArrayInput` via:
   191  //
   192  //	WebhookArray{ WebhookArgs{...} }
   193  type WebhookArrayInput interface {
   194  	pulumi.Input
   195  
   196  	ToWebhookArrayOutput() WebhookArrayOutput
   197  	ToWebhookArrayOutputWithContext(context.Context) WebhookArrayOutput
   198  }
   199  
   200  type WebhookArray []WebhookInput
   201  
   202  func (WebhookArray) ElementType() reflect.Type {
   203  	return reflect.TypeOf((*[]*Webhook)(nil)).Elem()
   204  }
   205  
   206  func (i WebhookArray) ToWebhookArrayOutput() WebhookArrayOutput {
   207  	return i.ToWebhookArrayOutputWithContext(context.Background())
   208  }
   209  
   210  func (i WebhookArray) ToWebhookArrayOutputWithContext(ctx context.Context) WebhookArrayOutput {
   211  	return pulumi.ToOutputWithContext(ctx, i).(WebhookArrayOutput)
   212  }
   213  
   214  // WebhookMapInput is an input type that accepts WebhookMap and WebhookMapOutput values.
   215  // You can construct a concrete instance of `WebhookMapInput` via:
   216  //
   217  //	WebhookMap{ "key": WebhookArgs{...} }
   218  type WebhookMapInput interface {
   219  	pulumi.Input
   220  
   221  	ToWebhookMapOutput() WebhookMapOutput
   222  	ToWebhookMapOutputWithContext(context.Context) WebhookMapOutput
   223  }
   224  
   225  type WebhookMap map[string]WebhookInput
   226  
   227  func (WebhookMap) ElementType() reflect.Type {
   228  	return reflect.TypeOf((*map[string]*Webhook)(nil)).Elem()
   229  }
   230  
   231  func (i WebhookMap) ToWebhookMapOutput() WebhookMapOutput {
   232  	return i.ToWebhookMapOutputWithContext(context.Background())
   233  }
   234  
   235  func (i WebhookMap) ToWebhookMapOutputWithContext(ctx context.Context) WebhookMapOutput {
   236  	return pulumi.ToOutputWithContext(ctx, i).(WebhookMapOutput)
   237  }
   238  
   239  type WebhookOutput struct{ *pulumi.OutputState }
   240  
   241  func (WebhookOutput) ElementType() reflect.Type {
   242  	return reflect.TypeOf((**Webhook)(nil)).Elem()
   243  }
   244  
   245  func (o WebhookOutput) ToWebhookOutput() WebhookOutput {
   246  	return o
   247  }
   248  
   249  func (o WebhookOutput) ToWebhookOutputWithContext(ctx context.Context) WebhookOutput {
   250  	return o
   251  }
   252  
   253  // Unique ID for an Amplify app.
   254  func (o WebhookOutput) AppId() pulumi.StringOutput {
   255  	return o.ApplyT(func(v *Webhook) pulumi.StringOutput { return v.AppId }).(pulumi.StringOutput)
   256  }
   257  
   258  // ARN for the webhook.
   259  func (o WebhookOutput) Arn() pulumi.StringOutput {
   260  	return o.ApplyT(func(v *Webhook) pulumi.StringOutput { return v.Arn }).(pulumi.StringOutput)
   261  }
   262  
   263  // Name for a branch that is part of the Amplify app.
   264  func (o WebhookOutput) BranchName() pulumi.StringOutput {
   265  	return o.ApplyT(func(v *Webhook) pulumi.StringOutput { return v.BranchName }).(pulumi.StringOutput)
   266  }
   267  
   268  // Description for a webhook.
   269  func (o WebhookOutput) Description() pulumi.StringPtrOutput {
   270  	return o.ApplyT(func(v *Webhook) pulumi.StringPtrOutput { return v.Description }).(pulumi.StringPtrOutput)
   271  }
   272  
   273  // URL of the webhook.
   274  func (o WebhookOutput) Url() pulumi.StringOutput {
   275  	return o.ApplyT(func(v *Webhook) pulumi.StringOutput { return v.Url }).(pulumi.StringOutput)
   276  }
   277  
   278  type WebhookArrayOutput struct{ *pulumi.OutputState }
   279  
   280  func (WebhookArrayOutput) ElementType() reflect.Type {
   281  	return reflect.TypeOf((*[]*Webhook)(nil)).Elem()
   282  }
   283  
   284  func (o WebhookArrayOutput) ToWebhookArrayOutput() WebhookArrayOutput {
   285  	return o
   286  }
   287  
   288  func (o WebhookArrayOutput) ToWebhookArrayOutputWithContext(ctx context.Context) WebhookArrayOutput {
   289  	return o
   290  }
   291  
   292  func (o WebhookArrayOutput) Index(i pulumi.IntInput) WebhookOutput {
   293  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *Webhook {
   294  		return vs[0].([]*Webhook)[vs[1].(int)]
   295  	}).(WebhookOutput)
   296  }
   297  
   298  type WebhookMapOutput struct{ *pulumi.OutputState }
   299  
   300  func (WebhookMapOutput) ElementType() reflect.Type {
   301  	return reflect.TypeOf((*map[string]*Webhook)(nil)).Elem()
   302  }
   303  
   304  func (o WebhookMapOutput) ToWebhookMapOutput() WebhookMapOutput {
   305  	return o
   306  }
   307  
   308  func (o WebhookMapOutput) ToWebhookMapOutputWithContext(ctx context.Context) WebhookMapOutput {
   309  	return o
   310  }
   311  
   312  func (o WebhookMapOutput) MapIndex(k pulumi.StringInput) WebhookOutput {
   313  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *Webhook {
   314  		return vs[0].(map[string]*Webhook)[vs[1].(string)]
   315  	}).(WebhookOutput)
   316  }
   317  
   318  func init() {
   319  	pulumi.RegisterInputType(reflect.TypeOf((*WebhookInput)(nil)).Elem(), &Webhook{})
   320  	pulumi.RegisterInputType(reflect.TypeOf((*WebhookArrayInput)(nil)).Elem(), WebhookArray{})
   321  	pulumi.RegisterInputType(reflect.TypeOf((*WebhookMapInput)(nil)).Elem(), WebhookMap{})
   322  	pulumi.RegisterOutputType(WebhookOutput{})
   323  	pulumi.RegisterOutputType(WebhookArrayOutput{})
   324  	pulumi.RegisterOutputType(WebhookMapOutput{})
   325  }