/
repositoryFile.go
202 lines (189 loc) · 6.91 KB
/
repositoryFile.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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
// *** 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 (
"reflect"
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)
// This resource allows you to create and manage files within a
// GitHub repository.
//
// ## Example Usage
//
// ```go
// package main
//
// import (
// "github.com/pulumi/pulumi-github/sdk/v2/go/github"
// "github.com/pulumi/pulumi/sdk/v2/go/pulumi"
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// fooRepository, err := github.NewRepository(ctx, "fooRepository", &github.RepositoryArgs{
// AutoInit: pulumi.Bool(true),
// })
// if err != nil {
// return err
// }
// _, err = github.NewRepositoryFile(ctx, "fooRepositoryFile", &github.RepositoryFileArgs{
// Repository: fooRepository.Name,
// Branch: pulumi.String("main"),
// File: pulumi.String(".gitignore"),
// Content: pulumi.String("**/*.tfstate"),
// CommitMessage: pulumi.String("Managed by Terraform"),
// CommitAuthor: pulumi.String("Terraform User"),
// CommitEmail: pulumi.String("terraform@example.com"),
// OverwriteOnCreate: pulumi.Bool(true),
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
// ```
type RepositoryFile struct {
pulumi.CustomResourceState
// Git branch (defaults to `master`).
// The branch must already exist, it will not be created if it does not already exist.
Branch pulumi.StringPtrOutput `pulumi:"branch"`
// Committer author name to use.
CommitAuthor pulumi.StringOutput `pulumi:"commitAuthor"`
// Committer email address to use.
CommitEmail pulumi.StringOutput `pulumi:"commitEmail"`
// Commit message when adding or updating the managed file.
CommitMessage pulumi.StringOutput `pulumi:"commitMessage"`
// The file content.
Content pulumi.StringOutput `pulumi:"content"`
// The path of the file to manage.
File pulumi.StringOutput `pulumi:"file"`
// Enable overwriting existing files
OverwriteOnCreate pulumi.BoolPtrOutput `pulumi:"overwriteOnCreate"`
// The repository name
Repository pulumi.StringOutput `pulumi:"repository"`
// The SHA blob of the file.
Sha pulumi.StringOutput `pulumi:"sha"`
}
// NewRepositoryFile registers a new resource with the given unique name, arguments, and options.
func NewRepositoryFile(ctx *pulumi.Context,
name string, args *RepositoryFileArgs, opts ...pulumi.ResourceOption) (*RepositoryFile, error) {
if args == nil || args.Content == nil {
return nil, errors.New("missing required argument 'Content'")
}
if args == nil || args.File == nil {
return nil, errors.New("missing required argument 'File'")
}
if args == nil || args.Repository == nil {
return nil, errors.New("missing required argument 'Repository'")
}
if args == nil {
args = &RepositoryFileArgs{}
}
var resource RepositoryFile
err := ctx.RegisterResource("github:index/repositoryFile:RepositoryFile", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetRepositoryFile gets an existing RepositoryFile 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 GetRepositoryFile(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *RepositoryFileState, opts ...pulumi.ResourceOption) (*RepositoryFile, error) {
var resource RepositoryFile
err := ctx.ReadResource("github:index/repositoryFile:RepositoryFile", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering RepositoryFile resources.
type repositoryFileState struct {
// Git branch (defaults to `master`).
// The branch must already exist, it will not be created if it does not already exist.
Branch *string `pulumi:"branch"`
// Committer author name to use.
CommitAuthor *string `pulumi:"commitAuthor"`
// Committer email address to use.
CommitEmail *string `pulumi:"commitEmail"`
// Commit message when adding or updating the managed file.
CommitMessage *string `pulumi:"commitMessage"`
// The file content.
Content *string `pulumi:"content"`
// The path of the file to manage.
File *string `pulumi:"file"`
// Enable overwriting existing files
OverwriteOnCreate *bool `pulumi:"overwriteOnCreate"`
// The repository name
Repository *string `pulumi:"repository"`
// The SHA blob of the file.
Sha *string `pulumi:"sha"`
}
type RepositoryFileState struct {
// Git branch (defaults to `master`).
// The branch must already exist, it will not be created if it does not already exist.
Branch pulumi.StringPtrInput
// Committer author name to use.
CommitAuthor pulumi.StringPtrInput
// Committer email address to use.
CommitEmail pulumi.StringPtrInput
// Commit message when adding or updating the managed file.
CommitMessage pulumi.StringPtrInput
// The file content.
Content pulumi.StringPtrInput
// The path of the file to manage.
File pulumi.StringPtrInput
// Enable overwriting existing files
OverwriteOnCreate pulumi.BoolPtrInput
// The repository name
Repository pulumi.StringPtrInput
// The SHA blob of the file.
Sha pulumi.StringPtrInput
}
func (RepositoryFileState) ElementType() reflect.Type {
return reflect.TypeOf((*repositoryFileState)(nil)).Elem()
}
type repositoryFileArgs struct {
// Git branch (defaults to `master`).
// The branch must already exist, it will not be created if it does not already exist.
Branch *string `pulumi:"branch"`
// Committer author name to use.
CommitAuthor *string `pulumi:"commitAuthor"`
// Committer email address to use.
CommitEmail *string `pulumi:"commitEmail"`
// Commit message when adding or updating the managed file.
CommitMessage *string `pulumi:"commitMessage"`
// The file content.
Content string `pulumi:"content"`
// The path of the file to manage.
File string `pulumi:"file"`
// Enable overwriting existing files
OverwriteOnCreate *bool `pulumi:"overwriteOnCreate"`
// The repository name
Repository string `pulumi:"repository"`
}
// The set of arguments for constructing a RepositoryFile resource.
type RepositoryFileArgs struct {
// Git branch (defaults to `master`).
// The branch must already exist, it will not be created if it does not already exist.
Branch pulumi.StringPtrInput
// Committer author name to use.
CommitAuthor pulumi.StringPtrInput
// Committer email address to use.
CommitEmail pulumi.StringPtrInput
// Commit message when adding or updating the managed file.
CommitMessage pulumi.StringPtrInput
// The file content.
Content pulumi.StringInput
// The path of the file to manage.
File pulumi.StringInput
// Enable overwriting existing files
OverwriteOnCreate pulumi.BoolPtrInput
// The repository name
Repository pulumi.StringInput
}
func (RepositoryFileArgs) ElementType() reflect.Type {
return reflect.TypeOf((*repositoryFileArgs)(nil)).Elem()
}