/
getReleaseLink.go
181 lines (157 loc) · 6.81 KB
/
getReleaseLink.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 Terraform Bridge (tfgen) Tool DO NOT EDIT.
// *** WARNING: Do not edit by hand unless you're certain you know what you are doing! ***
package gitlab
import (
"context"
"reflect"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// The `ReleaseLink` data source allows get details of a release link.
//
// **Upstream API**: [GitLab REST API docs](https://docs.gitlab.com/ee/api/releases/links.html)
//
// ## Example Usage
//
// ```go
// package main
//
// import (
//
// "github.com/pulumi/pulumi-gitlab/sdk/v4/go/gitlab"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
//
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// _, err := gitlab.LookupReleaseLink(ctx, &gitlab.LookupReleaseLinkArgs{
// LinkId: 11,
// Project: "foo/bar",
// TagName: "v1.0.1",
// }, nil)
// if err != nil {
// return err
// }
// return nil
// })
// }
//
// ```
func LookupReleaseLink(ctx *pulumi.Context, args *LookupReleaseLinkArgs, opts ...pulumi.InvokeOption) (*LookupReleaseLinkResult, error) {
var rv LookupReleaseLinkResult
err := ctx.Invoke("gitlab:index/getReleaseLink:getReleaseLink", args, &rv, opts...)
if err != nil {
return nil, err
}
return &rv, nil
}
// A collection of arguments for invoking getReleaseLink.
type LookupReleaseLinkArgs struct {
// The ID of the link.
LinkId int `pulumi:"linkId"`
// The ID or [URL-encoded path of the project](https://docs.gitlab.com/ee/api/index.html#namespaced-path-encoding).
Project string `pulumi:"project"`
// The tag associated with the Release.
TagName string `pulumi:"tagName"`
}
// A collection of values returned by getReleaseLink.
type LookupReleaseLinkResult struct {
// Full path for a [Direct Asset link](https://docs.gitlab.com/ee/user/project/releases/index.html#permanent-links-to-release-assets).
DirectAssetUrl string `pulumi:"directAssetUrl"`
// External or internal link.
External bool `pulumi:"external"`
// Relative path for a [Direct Asset link](https://docs.gitlab.com/ee/user/project/releases/index.html#permanent-links-to-release-assets).
Filepath string `pulumi:"filepath"`
// The provider-assigned unique ID for this managed resource.
Id string `pulumi:"id"`
// The ID of the link.
LinkId int `pulumi:"linkId"`
// The type of the link. Valid values are `other`, `runbook`, `image`, `package`. Defaults to other.
LinkType string `pulumi:"linkType"`
// The name of the link. Link names must be unique within the release.
Name string `pulumi:"name"`
// The ID or [URL-encoded path of the project](https://docs.gitlab.com/ee/api/index.html#namespaced-path-encoding).
Project string `pulumi:"project"`
// The tag associated with the Release.
TagName string `pulumi:"tagName"`
// The URL of the link. Link URLs must be unique within the release.
Url string `pulumi:"url"`
}
func LookupReleaseLinkOutput(ctx *pulumi.Context, args LookupReleaseLinkOutputArgs, opts ...pulumi.InvokeOption) LookupReleaseLinkResultOutput {
return pulumi.ToOutputWithContext(context.Background(), args).
ApplyT(func(v interface{}) (LookupReleaseLinkResult, error) {
args := v.(LookupReleaseLinkArgs)
r, err := LookupReleaseLink(ctx, &args, opts...)
var s LookupReleaseLinkResult
if r != nil {
s = *r
}
return s, err
}).(LookupReleaseLinkResultOutput)
}
// A collection of arguments for invoking getReleaseLink.
type LookupReleaseLinkOutputArgs struct {
// The ID of the link.
LinkId pulumi.IntInput `pulumi:"linkId"`
// The ID or [URL-encoded path of the project](https://docs.gitlab.com/ee/api/index.html#namespaced-path-encoding).
Project pulumi.StringInput `pulumi:"project"`
// The tag associated with the Release.
TagName pulumi.StringInput `pulumi:"tagName"`
}
func (LookupReleaseLinkOutputArgs) ElementType() reflect.Type {
return reflect.TypeOf((*LookupReleaseLinkArgs)(nil)).Elem()
}
// A collection of values returned by getReleaseLink.
type LookupReleaseLinkResultOutput struct{ *pulumi.OutputState }
func (LookupReleaseLinkResultOutput) ElementType() reflect.Type {
return reflect.TypeOf((*LookupReleaseLinkResult)(nil)).Elem()
}
func (o LookupReleaseLinkResultOutput) ToLookupReleaseLinkResultOutput() LookupReleaseLinkResultOutput {
return o
}
func (o LookupReleaseLinkResultOutput) ToLookupReleaseLinkResultOutputWithContext(ctx context.Context) LookupReleaseLinkResultOutput {
return o
}
// Full path for a [Direct Asset link](https://docs.gitlab.com/ee/user/project/releases/index.html#permanent-links-to-release-assets).
func (o LookupReleaseLinkResultOutput) DirectAssetUrl() pulumi.StringOutput {
return o.ApplyT(func(v LookupReleaseLinkResult) string { return v.DirectAssetUrl }).(pulumi.StringOutput)
}
// External or internal link.
func (o LookupReleaseLinkResultOutput) External() pulumi.BoolOutput {
return o.ApplyT(func(v LookupReleaseLinkResult) bool { return v.External }).(pulumi.BoolOutput)
}
// Relative path for a [Direct Asset link](https://docs.gitlab.com/ee/user/project/releases/index.html#permanent-links-to-release-assets).
func (o LookupReleaseLinkResultOutput) Filepath() pulumi.StringOutput {
return o.ApplyT(func(v LookupReleaseLinkResult) string { return v.Filepath }).(pulumi.StringOutput)
}
// The provider-assigned unique ID for this managed resource.
func (o LookupReleaseLinkResultOutput) Id() pulumi.StringOutput {
return o.ApplyT(func(v LookupReleaseLinkResult) string { return v.Id }).(pulumi.StringOutput)
}
// The ID of the link.
func (o LookupReleaseLinkResultOutput) LinkId() pulumi.IntOutput {
return o.ApplyT(func(v LookupReleaseLinkResult) int { return v.LinkId }).(pulumi.IntOutput)
}
// The type of the link. Valid values are `other`, `runbook`, `image`, `package`. Defaults to other.
func (o LookupReleaseLinkResultOutput) LinkType() pulumi.StringOutput {
return o.ApplyT(func(v LookupReleaseLinkResult) string { return v.LinkType }).(pulumi.StringOutput)
}
// The name of the link. Link names must be unique within the release.
func (o LookupReleaseLinkResultOutput) Name() pulumi.StringOutput {
return o.ApplyT(func(v LookupReleaseLinkResult) string { return v.Name }).(pulumi.StringOutput)
}
// The ID or [URL-encoded path of the project](https://docs.gitlab.com/ee/api/index.html#namespaced-path-encoding).
func (o LookupReleaseLinkResultOutput) Project() pulumi.StringOutput {
return o.ApplyT(func(v LookupReleaseLinkResult) string { return v.Project }).(pulumi.StringOutput)
}
// The tag associated with the Release.
func (o LookupReleaseLinkResultOutput) TagName() pulumi.StringOutput {
return o.ApplyT(func(v LookupReleaseLinkResult) string { return v.TagName }).(pulumi.StringOutput)
}
// The URL of the link. Link URLs must be unique within the release.
func (o LookupReleaseLinkResultOutput) Url() pulumi.StringOutput {
return o.ApplyT(func(v LookupReleaseLinkResult) string { return v.Url }).(pulumi.StringOutput)
}
func init() {
pulumi.RegisterOutputType(LookupReleaseLinkResultOutput{})
}