github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/codecommit/trigger.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 codecommit 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 CodeCommit Trigger 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/codecommit" 26 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 27 // 28 // ) 29 // 30 // func main() { 31 // pulumi.Run(func(ctx *pulumi.Context) error { 32 // test, err := codecommit.NewRepository(ctx, "test", &codecommit.RepositoryArgs{ 33 // RepositoryName: pulumi.String("test"), 34 // }) 35 // if err != nil { 36 // return err 37 // } 38 // _, err = codecommit.NewTrigger(ctx, "test", &codecommit.TriggerArgs{ 39 // RepositoryName: test.RepositoryName, 40 // Triggers: codecommit.TriggerTriggerArray{ 41 // &codecommit.TriggerTriggerArgs{ 42 // Name: pulumi.String("all"), 43 // Events: pulumi.StringArray{ 44 // pulumi.String("all"), 45 // }, 46 // DestinationArn: pulumi.Any(testAwsSnsTopic.Arn), 47 // }, 48 // }, 49 // }) 50 // if err != nil { 51 // return err 52 // } 53 // return nil 54 // }) 55 // } 56 // 57 // ``` 58 // <!--End PulumiCodeChooser --> 59 type Trigger struct { 60 pulumi.CustomResourceState 61 62 // System-generated unique identifier. 63 ConfigurationId pulumi.StringOutput `pulumi:"configurationId"` 64 // The name for the repository. This needs to be less than 100 characters. 65 RepositoryName pulumi.StringOutput `pulumi:"repositoryName"` 66 // The name of the trigger. 67 Triggers TriggerTriggerArrayOutput `pulumi:"triggers"` 68 } 69 70 // NewTrigger registers a new resource with the given unique name, arguments, and options. 71 func NewTrigger(ctx *pulumi.Context, 72 name string, args *TriggerArgs, opts ...pulumi.ResourceOption) (*Trigger, error) { 73 if args == nil { 74 return nil, errors.New("missing one or more required arguments") 75 } 76 77 if args.RepositoryName == nil { 78 return nil, errors.New("invalid value for required argument 'RepositoryName'") 79 } 80 if args.Triggers == nil { 81 return nil, errors.New("invalid value for required argument 'Triggers'") 82 } 83 opts = internal.PkgResourceDefaultOpts(opts) 84 var resource Trigger 85 err := ctx.RegisterResource("aws:codecommit/trigger:Trigger", name, args, &resource, opts...) 86 if err != nil { 87 return nil, err 88 } 89 return &resource, nil 90 } 91 92 // GetTrigger gets an existing Trigger resource's state with the given name, ID, and optional 93 // state properties that are used to uniquely qualify the lookup (nil if not required). 94 func GetTrigger(ctx *pulumi.Context, 95 name string, id pulumi.IDInput, state *TriggerState, opts ...pulumi.ResourceOption) (*Trigger, error) { 96 var resource Trigger 97 err := ctx.ReadResource("aws:codecommit/trigger:Trigger", name, id, state, &resource, opts...) 98 if err != nil { 99 return nil, err 100 } 101 return &resource, nil 102 } 103 104 // Input properties used for looking up and filtering Trigger resources. 105 type triggerState struct { 106 // System-generated unique identifier. 107 ConfigurationId *string `pulumi:"configurationId"` 108 // The name for the repository. This needs to be less than 100 characters. 109 RepositoryName *string `pulumi:"repositoryName"` 110 // The name of the trigger. 111 Triggers []TriggerTrigger `pulumi:"triggers"` 112 } 113 114 type TriggerState struct { 115 // System-generated unique identifier. 116 ConfigurationId pulumi.StringPtrInput 117 // The name for the repository. This needs to be less than 100 characters. 118 RepositoryName pulumi.StringPtrInput 119 // The name of the trigger. 120 Triggers TriggerTriggerArrayInput 121 } 122 123 func (TriggerState) ElementType() reflect.Type { 124 return reflect.TypeOf((*triggerState)(nil)).Elem() 125 } 126 127 type triggerArgs struct { 128 // The name for the repository. This needs to be less than 100 characters. 129 RepositoryName string `pulumi:"repositoryName"` 130 // The name of the trigger. 131 Triggers []TriggerTrigger `pulumi:"triggers"` 132 } 133 134 // The set of arguments for constructing a Trigger resource. 135 type TriggerArgs struct { 136 // The name for the repository. This needs to be less than 100 characters. 137 RepositoryName pulumi.StringInput 138 // The name of the trigger. 139 Triggers TriggerTriggerArrayInput 140 } 141 142 func (TriggerArgs) ElementType() reflect.Type { 143 return reflect.TypeOf((*triggerArgs)(nil)).Elem() 144 } 145 146 type TriggerInput interface { 147 pulumi.Input 148 149 ToTriggerOutput() TriggerOutput 150 ToTriggerOutputWithContext(ctx context.Context) TriggerOutput 151 } 152 153 func (*Trigger) ElementType() reflect.Type { 154 return reflect.TypeOf((**Trigger)(nil)).Elem() 155 } 156 157 func (i *Trigger) ToTriggerOutput() TriggerOutput { 158 return i.ToTriggerOutputWithContext(context.Background()) 159 } 160 161 func (i *Trigger) ToTriggerOutputWithContext(ctx context.Context) TriggerOutput { 162 return pulumi.ToOutputWithContext(ctx, i).(TriggerOutput) 163 } 164 165 // TriggerArrayInput is an input type that accepts TriggerArray and TriggerArrayOutput values. 166 // You can construct a concrete instance of `TriggerArrayInput` via: 167 // 168 // TriggerArray{ TriggerArgs{...} } 169 type TriggerArrayInput interface { 170 pulumi.Input 171 172 ToTriggerArrayOutput() TriggerArrayOutput 173 ToTriggerArrayOutputWithContext(context.Context) TriggerArrayOutput 174 } 175 176 type TriggerArray []TriggerInput 177 178 func (TriggerArray) ElementType() reflect.Type { 179 return reflect.TypeOf((*[]*Trigger)(nil)).Elem() 180 } 181 182 func (i TriggerArray) ToTriggerArrayOutput() TriggerArrayOutput { 183 return i.ToTriggerArrayOutputWithContext(context.Background()) 184 } 185 186 func (i TriggerArray) ToTriggerArrayOutputWithContext(ctx context.Context) TriggerArrayOutput { 187 return pulumi.ToOutputWithContext(ctx, i).(TriggerArrayOutput) 188 } 189 190 // TriggerMapInput is an input type that accepts TriggerMap and TriggerMapOutput values. 191 // You can construct a concrete instance of `TriggerMapInput` via: 192 // 193 // TriggerMap{ "key": TriggerArgs{...} } 194 type TriggerMapInput interface { 195 pulumi.Input 196 197 ToTriggerMapOutput() TriggerMapOutput 198 ToTriggerMapOutputWithContext(context.Context) TriggerMapOutput 199 } 200 201 type TriggerMap map[string]TriggerInput 202 203 func (TriggerMap) ElementType() reflect.Type { 204 return reflect.TypeOf((*map[string]*Trigger)(nil)).Elem() 205 } 206 207 func (i TriggerMap) ToTriggerMapOutput() TriggerMapOutput { 208 return i.ToTriggerMapOutputWithContext(context.Background()) 209 } 210 211 func (i TriggerMap) ToTriggerMapOutputWithContext(ctx context.Context) TriggerMapOutput { 212 return pulumi.ToOutputWithContext(ctx, i).(TriggerMapOutput) 213 } 214 215 type TriggerOutput struct{ *pulumi.OutputState } 216 217 func (TriggerOutput) ElementType() reflect.Type { 218 return reflect.TypeOf((**Trigger)(nil)).Elem() 219 } 220 221 func (o TriggerOutput) ToTriggerOutput() TriggerOutput { 222 return o 223 } 224 225 func (o TriggerOutput) ToTriggerOutputWithContext(ctx context.Context) TriggerOutput { 226 return o 227 } 228 229 // System-generated unique identifier. 230 func (o TriggerOutput) ConfigurationId() pulumi.StringOutput { 231 return o.ApplyT(func(v *Trigger) pulumi.StringOutput { return v.ConfigurationId }).(pulumi.StringOutput) 232 } 233 234 // The name for the repository. This needs to be less than 100 characters. 235 func (o TriggerOutput) RepositoryName() pulumi.StringOutput { 236 return o.ApplyT(func(v *Trigger) pulumi.StringOutput { return v.RepositoryName }).(pulumi.StringOutput) 237 } 238 239 // The name of the trigger. 240 func (o TriggerOutput) Triggers() TriggerTriggerArrayOutput { 241 return o.ApplyT(func(v *Trigger) TriggerTriggerArrayOutput { return v.Triggers }).(TriggerTriggerArrayOutput) 242 } 243 244 type TriggerArrayOutput struct{ *pulumi.OutputState } 245 246 func (TriggerArrayOutput) ElementType() reflect.Type { 247 return reflect.TypeOf((*[]*Trigger)(nil)).Elem() 248 } 249 250 func (o TriggerArrayOutput) ToTriggerArrayOutput() TriggerArrayOutput { 251 return o 252 } 253 254 func (o TriggerArrayOutput) ToTriggerArrayOutputWithContext(ctx context.Context) TriggerArrayOutput { 255 return o 256 } 257 258 func (o TriggerArrayOutput) Index(i pulumi.IntInput) TriggerOutput { 259 return pulumi.All(o, i).ApplyT(func(vs []interface{}) *Trigger { 260 return vs[0].([]*Trigger)[vs[1].(int)] 261 }).(TriggerOutput) 262 } 263 264 type TriggerMapOutput struct{ *pulumi.OutputState } 265 266 func (TriggerMapOutput) ElementType() reflect.Type { 267 return reflect.TypeOf((*map[string]*Trigger)(nil)).Elem() 268 } 269 270 func (o TriggerMapOutput) ToTriggerMapOutput() TriggerMapOutput { 271 return o 272 } 273 274 func (o TriggerMapOutput) ToTriggerMapOutputWithContext(ctx context.Context) TriggerMapOutput { 275 return o 276 } 277 278 func (o TriggerMapOutput) MapIndex(k pulumi.StringInput) TriggerOutput { 279 return pulumi.All(o, k).ApplyT(func(vs []interface{}) *Trigger { 280 return vs[0].(map[string]*Trigger)[vs[1].(string)] 281 }).(TriggerOutput) 282 } 283 284 func init() { 285 pulumi.RegisterInputType(reflect.TypeOf((*TriggerInput)(nil)).Elem(), &Trigger{}) 286 pulumi.RegisterInputType(reflect.TypeOf((*TriggerArrayInput)(nil)).Elem(), TriggerArray{}) 287 pulumi.RegisterInputType(reflect.TypeOf((*TriggerMapInput)(nil)).Elem(), TriggerMap{}) 288 pulumi.RegisterOutputType(TriggerOutput{}) 289 pulumi.RegisterOutputType(TriggerArrayOutput{}) 290 pulumi.RegisterOutputType(TriggerMapOutput{}) 291 }