-
Notifications
You must be signed in to change notification settings - Fork 5
/
getAccounts.go
74 lines (69 loc) · 2.26 KB
/
getAccounts.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
// *** 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 polardb
import (
"github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)
// The `polardb.getAccounts` data source provides a collection of PolarDB cluster database account available in Alibaba Cloud account.
// Filters support regular expression for the account name, searches by clusterId.
//
// > **NOTE:** Available in v1.70.0+.
//
// ## Example Usage
//
// ```go
// package main
//
// import (
// "github.com/pulumi/pulumi-alicloud/sdk/v2/go/alicloud/polardb"
// "github.com/pulumi/pulumi/sdk/v2/go/pulumi"
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// opt0 := "pc-\\w+"
// opt1 := "Running"
// polardbClustersDs, err := polardb.GetClusters(ctx, &polardb.GetClustersArgs{
// DescriptionRegex: &opt0,
// Status: &opt1,
// }, nil)
// if err != nil {
// return err
// }
// _default, err := polardb.GetAccounts(ctx, &polardb.GetAccountsArgs{
// DbClusterId: polardbClustersDs.Clusters[0].Id,
// }, nil)
// if err != nil {
// return err
// }
// ctx.Export("account", _default.Accounts[0].AccountName)
// return nil
// })
// }
// ```
func GetAccounts(ctx *pulumi.Context, args *GetAccountsArgs, opts ...pulumi.InvokeOption) (*GetAccountsResult, error) {
var rv GetAccountsResult
err := ctx.Invoke("alicloud:polardb/getAccounts:getAccounts", args, &rv, opts...)
if err != nil {
return nil, err
}
return &rv, nil
}
// A collection of arguments for invoking getAccounts.
type GetAccountsArgs struct {
// The polarDB cluster ID.
DbClusterId string `pulumi:"dbClusterId"`
// A regex string to filter results by account name.
NameRegex *string `pulumi:"nameRegex"`
}
// A collection of values returned by getAccounts.
type GetAccountsResult struct {
// A list of PolarDB cluster accounts. Each element contains the following attributes:
Accounts []GetAccountsAccount `pulumi:"accounts"`
DbClusterId string `pulumi:"dbClusterId"`
// The provider-assigned unique ID for this managed resource.
Id string `pulumi:"id"`
NameRegex *string `pulumi:"nameRegex"`
// Account name of the cluster.
Names []string `pulumi:"names"`
}