/
tag.go
181 lines (150 loc) · 7 KB
/
tag.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
// Code generated by the Pulumi SDK Generator DO NOT EDIT.
// *** WARNING: Do not edit by hand unless you're certain you know what you are doing! ***
package v1beta1
import (
"context"
"reflect"
"errors"
"github.com/pulumi/pulumi-google-native/sdk/go/google/internal"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Creates a tag.
type Tag struct {
pulumi.CustomResourceState
Location pulumi.StringOutput `pulumi:"location"`
// The name of the tag, for example: "projects/p1/locations/us-central1/repositories/repo1/packages/pkg1/tags/tag1". If the package part contains slashes, the slashes are escaped. The tag part can only have characters in [a-zA-Z0-9\-._~:@], anything else must be URL encoded.
Name pulumi.StringOutput `pulumi:"name"`
PackageId pulumi.StringOutput `pulumi:"packageId"`
Project pulumi.StringOutput `pulumi:"project"`
RepositoryId pulumi.StringOutput `pulumi:"repositoryId"`
// The tag id to use for this repository.
TagId pulumi.StringPtrOutput `pulumi:"tagId"`
// The name of the version the tag refers to, for example: "projects/p1/locations/us-central1/repositories/repo1/packages/pkg1/versions/sha256:5243811" If the package or version ID parts contain slashes, the slashes are escaped.
Version pulumi.StringOutput `pulumi:"version"`
}
// NewTag registers a new resource with the given unique name, arguments, and options.
func NewTag(ctx *pulumi.Context,
name string, args *TagArgs, opts ...pulumi.ResourceOption) (*Tag, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.PackageId == nil {
return nil, errors.New("invalid value for required argument 'PackageId'")
}
if args.RepositoryId == nil {
return nil, errors.New("invalid value for required argument 'RepositoryId'")
}
replaceOnChanges := pulumi.ReplaceOnChanges([]string{
"location",
"packageId",
"project",
"repositoryId",
})
opts = append(opts, replaceOnChanges)
opts = internal.PkgResourceDefaultOpts(opts)
var resource Tag
err := ctx.RegisterResource("google-native:artifactregistry/v1beta1:Tag", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetTag gets an existing Tag 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 GetTag(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *TagState, opts ...pulumi.ResourceOption) (*Tag, error) {
var resource Tag
err := ctx.ReadResource("google-native:artifactregistry/v1beta1:Tag", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering Tag resources.
type tagState struct {
}
type TagState struct {
}
func (TagState) ElementType() reflect.Type {
return reflect.TypeOf((*tagState)(nil)).Elem()
}
type tagArgs struct {
Location *string `pulumi:"location"`
// The name of the tag, for example: "projects/p1/locations/us-central1/repositories/repo1/packages/pkg1/tags/tag1". If the package part contains slashes, the slashes are escaped. The tag part can only have characters in [a-zA-Z0-9\-._~:@], anything else must be URL encoded.
Name *string `pulumi:"name"`
PackageId string `pulumi:"packageId"`
Project *string `pulumi:"project"`
RepositoryId string `pulumi:"repositoryId"`
// The tag id to use for this repository.
TagId *string `pulumi:"tagId"`
// The name of the version the tag refers to, for example: "projects/p1/locations/us-central1/repositories/repo1/packages/pkg1/versions/sha256:5243811" If the package or version ID parts contain slashes, the slashes are escaped.
Version *string `pulumi:"version"`
}
// The set of arguments for constructing a Tag resource.
type TagArgs struct {
Location pulumi.StringPtrInput
// The name of the tag, for example: "projects/p1/locations/us-central1/repositories/repo1/packages/pkg1/tags/tag1". If the package part contains slashes, the slashes are escaped. The tag part can only have characters in [a-zA-Z0-9\-._~:@], anything else must be URL encoded.
Name pulumi.StringPtrInput
PackageId pulumi.StringInput
Project pulumi.StringPtrInput
RepositoryId pulumi.StringInput
// The tag id to use for this repository.
TagId pulumi.StringPtrInput
// The name of the version the tag refers to, for example: "projects/p1/locations/us-central1/repositories/repo1/packages/pkg1/versions/sha256:5243811" If the package or version ID parts contain slashes, the slashes are escaped.
Version pulumi.StringPtrInput
}
func (TagArgs) ElementType() reflect.Type {
return reflect.TypeOf((*tagArgs)(nil)).Elem()
}
type TagInput interface {
pulumi.Input
ToTagOutput() TagOutput
ToTagOutputWithContext(ctx context.Context) TagOutput
}
func (*Tag) ElementType() reflect.Type {
return reflect.TypeOf((**Tag)(nil)).Elem()
}
func (i *Tag) ToTagOutput() TagOutput {
return i.ToTagOutputWithContext(context.Background())
}
func (i *Tag) ToTagOutputWithContext(ctx context.Context) TagOutput {
return pulumi.ToOutputWithContext(ctx, i).(TagOutput)
}
type TagOutput struct{ *pulumi.OutputState }
func (TagOutput) ElementType() reflect.Type {
return reflect.TypeOf((**Tag)(nil)).Elem()
}
func (o TagOutput) ToTagOutput() TagOutput {
return o
}
func (o TagOutput) ToTagOutputWithContext(ctx context.Context) TagOutput {
return o
}
func (o TagOutput) Location() pulumi.StringOutput {
return o.ApplyT(func(v *Tag) pulumi.StringOutput { return v.Location }).(pulumi.StringOutput)
}
// The name of the tag, for example: "projects/p1/locations/us-central1/repositories/repo1/packages/pkg1/tags/tag1". If the package part contains slashes, the slashes are escaped. The tag part can only have characters in [a-zA-Z0-9\-._~:@], anything else must be URL encoded.
func (o TagOutput) Name() pulumi.StringOutput {
return o.ApplyT(func(v *Tag) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput)
}
func (o TagOutput) PackageId() pulumi.StringOutput {
return o.ApplyT(func(v *Tag) pulumi.StringOutput { return v.PackageId }).(pulumi.StringOutput)
}
func (o TagOutput) Project() pulumi.StringOutput {
return o.ApplyT(func(v *Tag) pulumi.StringOutput { return v.Project }).(pulumi.StringOutput)
}
func (o TagOutput) RepositoryId() pulumi.StringOutput {
return o.ApplyT(func(v *Tag) pulumi.StringOutput { return v.RepositoryId }).(pulumi.StringOutput)
}
// The tag id to use for this repository.
func (o TagOutput) TagId() pulumi.StringPtrOutput {
return o.ApplyT(func(v *Tag) pulumi.StringPtrOutput { return v.TagId }).(pulumi.StringPtrOutput)
}
// The name of the version the tag refers to, for example: "projects/p1/locations/us-central1/repositories/repo1/packages/pkg1/versions/sha256:5243811" If the package or version ID parts contain slashes, the slashes are escaped.
func (o TagOutput) Version() pulumi.StringOutput {
return o.ApplyT(func(v *Tag) pulumi.StringOutput { return v.Version }).(pulumi.StringOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*TagInput)(nil)).Elem(), &Tag{})
pulumi.RegisterOutputType(TagOutput{})
}