/
getImage.go
77 lines (72 loc) · 2.47 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
// *** 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 compute
import (
"github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)
// Use this data source to access information about an existing Image.
//
// ## Example Usage
//
// ```go
// package main
//
// import (
// "github.com/pulumi/pulumi-azure/sdk/v3/go/azure/compute"
// "github.com/pulumi/pulumi/sdk/v2/go/pulumi"
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// opt0 := "search-api"
// search, err := compute.LookupImage(ctx, &compute.LookupImageArgs{
// Name: &opt0,
// ResourceGroupName: "packerimages",
// }, nil)
// if err != nil {
// return err
// }
// ctx.Export("imageId", search.Id)
// return nil
// })
// }
// ```
func LookupImage(ctx *pulumi.Context, args *LookupImageArgs, opts ...pulumi.InvokeOption) (*LookupImageResult, error) {
var rv LookupImageResult
err := ctx.Invoke("azure:compute/getImage:getImage", args, &rv, opts...)
if err != nil {
return nil, err
}
return &rv, nil
}
// A collection of arguments for invoking getImage.
type LookupImageArgs struct {
// The name of the Image.
Name *string `pulumi:"name"`
// Regex pattern of the image to match.
NameRegex *string `pulumi:"nameRegex"`
// The Name of the Resource Group where this Image exists.
ResourceGroupName string `pulumi:"resourceGroupName"`
// By default when matching by regex, images are sorted by name in ascending order and the first match is chosen, to sort descending, set this flag.
SortDescending *bool `pulumi:"sortDescending"`
}
// A collection of values returned by getImage.
type LookupImageResult struct {
// a collection of `dataDisk` blocks as defined below.
DataDisks []GetImageDataDisk `pulumi:"dataDisks"`
// The provider-assigned unique ID for this managed resource.
Id string `pulumi:"id"`
// the Azure Location where this Image exists.
Location string `pulumi:"location"`
// the name of the Image.
Name *string `pulumi:"name"`
NameRegex *string `pulumi:"nameRegex"`
// a `osDisk` block as defined below.
OsDisks []GetImageOsDisk `pulumi:"osDisks"`
ResourceGroupName string `pulumi:"resourceGroupName"`
SortDescending *bool `pulumi:"sortDescending"`
// a mapping of tags to assigned to the resource.
Tags map[string]string `pulumi:"tags"`
// is zone resiliency enabled?
ZoneResilient bool `pulumi:"zoneResilient"`
}