/
getImage.go
169 lines (146 loc) · 6.01 KB
/
getImage.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
// 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 ecr
import (
"context"
"reflect"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// The ECR Image data source allows the details of an image with a particular tag or digest to be retrieved.
//
// ## Example Usage
//
// ```go
// package main
//
// import (
//
// "github.com/pulumi/pulumi-aws/sdk/v5/go/aws/ecr"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
//
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// _, err := ecr.GetImage(ctx, &ecr.GetImageArgs{
// ImageTag: pulumi.StringRef("latest"),
// RepositoryName: "my/service",
// }, nil)
// if err != nil {
// return err
// }
// return nil
// })
// }
//
// ```
func GetImage(ctx *pulumi.Context, args *GetImageArgs, opts ...pulumi.InvokeOption) (*GetImageResult, error) {
var rv GetImageResult
err := ctx.Invoke("aws:ecr/getImage:getImage", args, &rv, opts...)
if err != nil {
return nil, err
}
return &rv, nil
}
// A collection of arguments for invoking getImage.
type GetImageArgs struct {
// Sha256 digest of the image manifest. At least one of `imageDigest`, `imageTag`, or `mostRecent` must be specified.
ImageDigest *string `pulumi:"imageDigest"`
// Tag associated with this image. At least one of `imageDigest`, `imageTag`, or `mostRecent` must be specified.
ImageTag *string `pulumi:"imageTag"`
// Return the most recently pushed image. At least one of `imageDigest`, `imageTag`, or `mostRecent` must be specified.
MostRecent *bool `pulumi:"mostRecent"`
// ID of the Registry where the repository resides.
RegistryId *string `pulumi:"registryId"`
// Name of the ECR Repository.
RepositoryName string `pulumi:"repositoryName"`
}
// A collection of values returned by getImage.
type GetImageResult struct {
// The provider-assigned unique ID for this managed resource.
Id string `pulumi:"id"`
ImageDigest string `pulumi:"imageDigest"`
// Date and time, expressed as a unix timestamp, at which the current image was pushed to the repository.
ImagePushedAt int `pulumi:"imagePushedAt"`
// Size, in bytes, of the image in the repository.
ImageSizeInBytes int `pulumi:"imageSizeInBytes"`
ImageTag *string `pulumi:"imageTag"`
// List of tags associated with this image.
ImageTags []string `pulumi:"imageTags"`
MostRecent *bool `pulumi:"mostRecent"`
RegistryId string `pulumi:"registryId"`
RepositoryName string `pulumi:"repositoryName"`
}
func GetImageOutput(ctx *pulumi.Context, args GetImageOutputArgs, opts ...pulumi.InvokeOption) GetImageResultOutput {
return pulumi.ToOutputWithContext(context.Background(), args).
ApplyT(func(v interface{}) (GetImageResult, error) {
args := v.(GetImageArgs)
r, err := GetImage(ctx, &args, opts...)
var s GetImageResult
if r != nil {
s = *r
}
return s, err
}).(GetImageResultOutput)
}
// A collection of arguments for invoking getImage.
type GetImageOutputArgs struct {
// Sha256 digest of the image manifest. At least one of `imageDigest`, `imageTag`, or `mostRecent` must be specified.
ImageDigest pulumi.StringPtrInput `pulumi:"imageDigest"`
// Tag associated with this image. At least one of `imageDigest`, `imageTag`, or `mostRecent` must be specified.
ImageTag pulumi.StringPtrInput `pulumi:"imageTag"`
// Return the most recently pushed image. At least one of `imageDigest`, `imageTag`, or `mostRecent` must be specified.
MostRecent pulumi.BoolPtrInput `pulumi:"mostRecent"`
// ID of the Registry where the repository resides.
RegistryId pulumi.StringPtrInput `pulumi:"registryId"`
// Name of the ECR Repository.
RepositoryName pulumi.StringInput `pulumi:"repositoryName"`
}
func (GetImageOutputArgs) ElementType() reflect.Type {
return reflect.TypeOf((*GetImageArgs)(nil)).Elem()
}
// A collection of values returned by getImage.
type GetImageResultOutput struct{ *pulumi.OutputState }
func (GetImageResultOutput) ElementType() reflect.Type {
return reflect.TypeOf((*GetImageResult)(nil)).Elem()
}
func (o GetImageResultOutput) ToGetImageResultOutput() GetImageResultOutput {
return o
}
func (o GetImageResultOutput) ToGetImageResultOutputWithContext(ctx context.Context) GetImageResultOutput {
return o
}
// The provider-assigned unique ID for this managed resource.
func (o GetImageResultOutput) Id() pulumi.StringOutput {
return o.ApplyT(func(v GetImageResult) string { return v.Id }).(pulumi.StringOutput)
}
func (o GetImageResultOutput) ImageDigest() pulumi.StringOutput {
return o.ApplyT(func(v GetImageResult) string { return v.ImageDigest }).(pulumi.StringOutput)
}
// Date and time, expressed as a unix timestamp, at which the current image was pushed to the repository.
func (o GetImageResultOutput) ImagePushedAt() pulumi.IntOutput {
return o.ApplyT(func(v GetImageResult) int { return v.ImagePushedAt }).(pulumi.IntOutput)
}
// Size, in bytes, of the image in the repository.
func (o GetImageResultOutput) ImageSizeInBytes() pulumi.IntOutput {
return o.ApplyT(func(v GetImageResult) int { return v.ImageSizeInBytes }).(pulumi.IntOutput)
}
func (o GetImageResultOutput) ImageTag() pulumi.StringPtrOutput {
return o.ApplyT(func(v GetImageResult) *string { return v.ImageTag }).(pulumi.StringPtrOutput)
}
// List of tags associated with this image.
func (o GetImageResultOutput) ImageTags() pulumi.StringArrayOutput {
return o.ApplyT(func(v GetImageResult) []string { return v.ImageTags }).(pulumi.StringArrayOutput)
}
func (o GetImageResultOutput) MostRecent() pulumi.BoolPtrOutput {
return o.ApplyT(func(v GetImageResult) *bool { return v.MostRecent }).(pulumi.BoolPtrOutput)
}
func (o GetImageResultOutput) RegistryId() pulumi.StringOutput {
return o.ApplyT(func(v GetImageResult) string { return v.RegistryId }).(pulumi.StringOutput)
}
func (o GetImageResultOutput) RepositoryName() pulumi.StringOutput {
return o.ApplyT(func(v GetImageResult) string { return v.RepositoryName }).(pulumi.StringOutput)
}
func init() {
pulumi.RegisterOutputType(GetImageResultOutput{})
}