-
Notifications
You must be signed in to change notification settings - Fork 0
/
repositoryWebhook.go
136 lines (121 loc) · 5.37 KB
/
repositoryWebhook.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
// *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
package github
import (
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/go/pulumi"
)
// This resource allows you to create and manage webhooks for repositories within your
// GitHub organization.
//
// This resource cannot currently be used to manage webhooks for *personal* repositories,
// outside of organizations.
//
// > This content is derived from https://github.com/terraform-providers/terraform-provider-github/blob/master/website/docs/r/repository_webhook.html.markdown.
type RepositoryWebhook struct {
s *pulumi.ResourceState
}
// NewRepositoryWebhook registers a new resource with the given unique name, arguments, and options.
func NewRepositoryWebhook(ctx *pulumi.Context,
name string, args *RepositoryWebhookArgs, opts ...pulumi.ResourceOpt) (*RepositoryWebhook, error) {
if args == nil || args.Events == nil {
return nil, errors.New("missing required argument 'Events'")
}
if args == nil || args.Repository == nil {
return nil, errors.New("missing required argument 'Repository'")
}
inputs := make(map[string]interface{})
if args == nil {
inputs["active"] = nil
inputs["configuration"] = nil
inputs["events"] = nil
inputs["repository"] = nil
} else {
inputs["active"] = args.Active
inputs["configuration"] = args.Configuration
inputs["events"] = args.Events
inputs["repository"] = args.Repository
}
inputs["etag"] = nil
inputs["url"] = nil
s, err := ctx.RegisterResource("github:index/repositoryWebhook:RepositoryWebhook", name, true, inputs, opts...)
if err != nil {
return nil, err
}
return &RepositoryWebhook{s: s}, nil
}
// GetRepositoryWebhook gets an existing RepositoryWebhook resource's state with the given name, ID, and optional
// state properties that are used to uniquely qualify the lookup (nil if not required).
func GetRepositoryWebhook(ctx *pulumi.Context,
name string, id pulumi.ID, state *RepositoryWebhookState, opts ...pulumi.ResourceOpt) (*RepositoryWebhook, error) {
inputs := make(map[string]interface{})
if state != nil {
inputs["active"] = state.Active
inputs["configuration"] = state.Configuration
inputs["etag"] = state.Etag
inputs["events"] = state.Events
inputs["repository"] = state.Repository
inputs["url"] = state.Url
}
s, err := ctx.ReadResource("github:index/repositoryWebhook:RepositoryWebhook", name, id, inputs, opts...)
if err != nil {
return nil, err
}
return &RepositoryWebhook{s: s}, nil
}
// URN is this resource's unique name assigned by Pulumi.
func (r *RepositoryWebhook) URN() *pulumi.URNOutput {
return r.s.URN()
}
// ID is this resource's unique identifier assigned by its provider.
func (r *RepositoryWebhook) ID() *pulumi.IDOutput {
return r.s.ID()
}
// Indicate of the webhook should receive events. Defaults to `true`.
func (r *RepositoryWebhook) Active() *pulumi.BoolOutput {
return (*pulumi.BoolOutput)(r.s.State["active"])
}
// key/value pair of configuration for this webhook. Available keys are `url`, `contentType`, `secret` and `insecureSsl`. `secret` is [the shared secret, see API documentation](https://developer.github.com/v3/repos/hooks/#create-a-hook).
func (r *RepositoryWebhook) Configuration() *pulumi.Output {
return r.s.State["configuration"]
}
func (r *RepositoryWebhook) Etag() *pulumi.StringOutput {
return (*pulumi.StringOutput)(r.s.State["etag"])
}
// A list of events which should trigger the webhook. See a list of [available events](https://developer.github.com/v3/activity/events/types/).
func (r *RepositoryWebhook) Events() *pulumi.ArrayOutput {
return (*pulumi.ArrayOutput)(r.s.State["events"])
}
// The repository of the webhook.
func (r *RepositoryWebhook) Repository() *pulumi.StringOutput {
return (*pulumi.StringOutput)(r.s.State["repository"])
}
// URL of the webhook
func (r *RepositoryWebhook) Url() *pulumi.StringOutput {
return (*pulumi.StringOutput)(r.s.State["url"])
}
// Input properties used for looking up and filtering RepositoryWebhook resources.
type RepositoryWebhookState struct {
// Indicate of the webhook should receive events. Defaults to `true`.
Active interface{}
// key/value pair of configuration for this webhook. Available keys are `url`, `contentType`, `secret` and `insecureSsl`. `secret` is [the shared secret, see API documentation](https://developer.github.com/v3/repos/hooks/#create-a-hook).
Configuration interface{}
Etag interface{}
// A list of events which should trigger the webhook. See a list of [available events](https://developer.github.com/v3/activity/events/types/).
Events interface{}
// The repository of the webhook.
Repository interface{}
// URL of the webhook
Url interface{}
}
// The set of arguments for constructing a RepositoryWebhook resource.
type RepositoryWebhookArgs struct {
// Indicate of the webhook should receive events. Defaults to `true`.
Active interface{}
// key/value pair of configuration for this webhook. Available keys are `url`, `contentType`, `secret` and `insecureSsl`. `secret` is [the shared secret, see API documentation](https://developer.github.com/v3/repos/hooks/#create-a-hook).
Configuration interface{}
// A list of events which should trigger the webhook. See a list of [available events](https://developer.github.com/v3/activity/events/types/).
Events interface{}
// The repository of the webhook.
Repository interface{}
}