/
getRegions.go
65 lines (60 loc) · 1.85 KB
/
getRegions.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
// *** 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 alicloud
import (
"github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)
// This data source provides Alibaba Cloud regions.
//
// ## Example Usage
//
// ```go
// package main
//
// import (
// "github.com/pulumi/pulumi-alicloud/sdk/v2/go/alicloud"
// "github.com/pulumi/pulumi/sdk/v2/go/pulumi"
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// opt0 := true
// currentRegionDs, err := alicloud.GetRegions(ctx, &alicloud.GetRegionsArgs{
// Current: &opt0,
// }, nil)
// if err != nil {
// return err
// }
// ctx.Export("currentRegionId", currentRegionDs.Regions[0].Id)
// return nil
// })
// }
// ```
func GetRegions(ctx *pulumi.Context, args *GetRegionsArgs, opts ...pulumi.InvokeOption) (*GetRegionsResult, error) {
var rv GetRegionsResult
err := ctx.Invoke("alicloud:index/getRegions:getRegions", args, &rv, opts...)
if err != nil {
return nil, err
}
return &rv, nil
}
// A collection of arguments for invoking getRegions.
type GetRegionsArgs struct {
// Set to true to match only the region configured in the provider.
Current *bool `pulumi:"current"`
// The name of the region to select, such as `eu-central-1`.
Name *string `pulumi:"name"`
OutputFile *string `pulumi:"outputFile"`
}
// A collection of values returned by getRegions.
type GetRegionsResult struct {
Current bool `pulumi:"current"`
// The provider-assigned unique ID for this managed resource.
Id string `pulumi:"id"`
// A list of region IDs.
Ids []string `pulumi:"ids"`
Name string `pulumi:"name"`
OutputFile *string `pulumi:"outputFile"`
// A list of regions. Each element contains the following attributes:
Regions []GetRegionsRegion `pulumi:"regions"`
}