205 lines
5.8 KiB
Go
Generated
205 lines
5.8 KiB
Go
Generated
// Code generated by pulumi-language-go DO NOT EDIT.
|
|
// *** WARNING: Do not edit by hand unless you're certain you know what you are doing! ***
|
|
|
|
package incus
|
|
|
|
import (
|
|
"context"
|
|
"reflect"
|
|
|
|
"git.kalinow.ski/kiterun/pulumi-incus/sdk/go/incus/internal"
|
|
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
|
|
)
|
|
|
|
// ## # getCluster
|
|
//
|
|
// Provides information about an Incus cluster.
|
|
//
|
|
// ## Example Usage
|
|
//
|
|
// ```go
|
|
// package main
|
|
//
|
|
// import (
|
|
//
|
|
// "git.kalinow.ski/kiterun/pulumi-incus/sdk/go/incus"
|
|
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
|
|
//
|
|
// )
|
|
//
|
|
// func main() {
|
|
// pulumi.Run(func(ctx *pulumi.Context) error {
|
|
// _, err := incus.GetCluster(ctx, &incus.GetClusterArgs{}, nil)
|
|
// if err != nil {
|
|
// return err
|
|
// }
|
|
// return nil
|
|
// })
|
|
// }
|
|
//
|
|
// ```
|
|
//
|
|
// ## Example prevent execution if any cluster member is not online
|
|
//
|
|
// ```go
|
|
// package main
|
|
//
|
|
// import (
|
|
//
|
|
// "git.kalinow.ski/kiterun/pulumi-incus/sdk/go/incus"
|
|
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
|
|
//
|
|
// )
|
|
//
|
|
// func main() {
|
|
// pulumi.Run(func(ctx *pulumi.Context) error {
|
|
// _, err := incus.GetCluster(ctx, &incus.GetClusterArgs{
|
|
// Remote: pulumi.StringRef("cluster"),
|
|
// }, nil)
|
|
// if err != nil {
|
|
// return err
|
|
// }
|
|
// return nil
|
|
// })
|
|
// }
|
|
//
|
|
// ```
|
|
//
|
|
// ## Example create resource for each cluster member
|
|
//
|
|
// In this example, we define the server configuration [`core.bgp_address`](https://linuxcontainers.org/incus/docs/main/server_config/#core-configuration),
|
|
//
|
|
// which has scope `local`, on each cluster member.
|
|
//
|
|
// ```go
|
|
// package main
|
|
//
|
|
// import (
|
|
//
|
|
// "git.kalinow.ski/kiterun/pulumi-incus/sdk/go/incus"
|
|
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
|
|
//
|
|
// )
|
|
//
|
|
// func main() {
|
|
// pulumi.Run(func(ctx *pulumi.Context) error {
|
|
// this, err := incus.GetCluster(ctx, &incus.GetClusterArgs{}, nil)
|
|
// if err != nil {
|
|
// return err
|
|
// }
|
|
// var tmp0 pulumi.String
|
|
// if this.IsClustered {
|
|
// tmp0 = pulumi.String(key0)
|
|
// } else {
|
|
// tmp0 = nil
|
|
// }
|
|
// var nodes []*incus.Server
|
|
// for key0, _ := range this.Members {
|
|
// __res, err := incus.NewServer(ctx, fmt.Sprintf("nodes-%v", key0), &incus.ServerArgs{
|
|
// Target: pulumi.String(tmp0),
|
|
// Config: pulumi.StringMap{
|
|
// "core.bgp_address": pulumi.String(":179"),
|
|
// },
|
|
// })
|
|
// if err != nil {
|
|
// return err
|
|
// }
|
|
// nodes = append(nodes, __res)
|
|
// }
|
|
// return nil
|
|
// })
|
|
// }
|
|
//
|
|
// ```
|
|
//
|
|
// ## Notes
|
|
//
|
|
// * For non-clustered setups, the `members` attribute will be `null`.
|
|
func GetCluster(ctx *pulumi.Context, args *GetClusterArgs, opts ...pulumi.InvokeOption) (*GetClusterResult, error) {
|
|
opts = internal.PkgInvokeDefaultOpts(opts)
|
|
var rv GetClusterResult
|
|
err := ctx.Invoke("incus:index/getCluster:getCluster", args, &rv, opts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return &rv, nil
|
|
}
|
|
|
|
// A collection of arguments for invoking getCluster.
|
|
type GetClusterArgs struct {
|
|
// *Optional* - The remote for which the Incus cluster information
|
|
// should be queried. If not provided, the provider's default remote will be used.
|
|
Remote *string `pulumi:"remote"`
|
|
}
|
|
|
|
// A collection of values returned by getCluster.
|
|
type GetClusterResult struct {
|
|
// The provider-assigned unique ID for this managed resource.
|
|
Id string `pulumi:"id"`
|
|
// Whether this is a clustered setup.
|
|
IsClustered bool `pulumi:"isClustered"`
|
|
// A map of cluster members. The key is the member name and the value
|
|
// is a member object. See reference below.
|
|
Members map[string]GetClusterMembers `pulumi:"members"`
|
|
Remote *string `pulumi:"remote"`
|
|
}
|
|
|
|
func GetClusterOutput(ctx *pulumi.Context, args GetClusterOutputArgs, opts ...pulumi.InvokeOption) GetClusterResultOutput {
|
|
return pulumi.ToOutputWithContext(ctx.Context(), args).
|
|
ApplyT(func(v interface{}) (GetClusterResultOutput, error) {
|
|
args := v.(GetClusterArgs)
|
|
options := pulumi.InvokeOutputOptions{InvokeOptions: internal.PkgInvokeDefaultOpts(opts)}
|
|
return ctx.InvokeOutput("incus:index/getCluster:getCluster", args, GetClusterResultOutput{}, options).(GetClusterResultOutput), nil
|
|
}).(GetClusterResultOutput)
|
|
}
|
|
|
|
// A collection of arguments for invoking getCluster.
|
|
type GetClusterOutputArgs struct {
|
|
// *Optional* - The remote for which the Incus cluster information
|
|
// should be queried. If not provided, the provider's default remote will be used.
|
|
Remote pulumi.StringPtrInput `pulumi:"remote"`
|
|
}
|
|
|
|
func (GetClusterOutputArgs) ElementType() reflect.Type {
|
|
return reflect.TypeOf((*GetClusterArgs)(nil)).Elem()
|
|
}
|
|
|
|
// A collection of values returned by getCluster.
|
|
type GetClusterResultOutput struct{ *pulumi.OutputState }
|
|
|
|
func (GetClusterResultOutput) ElementType() reflect.Type {
|
|
return reflect.TypeOf((*GetClusterResult)(nil)).Elem()
|
|
}
|
|
|
|
func (o GetClusterResultOutput) ToGetClusterResultOutput() GetClusterResultOutput {
|
|
return o
|
|
}
|
|
|
|
func (o GetClusterResultOutput) ToGetClusterResultOutputWithContext(ctx context.Context) GetClusterResultOutput {
|
|
return o
|
|
}
|
|
|
|
// The provider-assigned unique ID for this managed resource.
|
|
func (o GetClusterResultOutput) Id() pulumi.StringOutput {
|
|
return o.ApplyT(func(v GetClusterResult) string { return v.Id }).(pulumi.StringOutput)
|
|
}
|
|
|
|
// Whether this is a clustered setup.
|
|
func (o GetClusterResultOutput) IsClustered() pulumi.BoolOutput {
|
|
return o.ApplyT(func(v GetClusterResult) bool { return v.IsClustered }).(pulumi.BoolOutput)
|
|
}
|
|
|
|
// A map of cluster members. The key is the member name and the value
|
|
// is a member object. See reference below.
|
|
func (o GetClusterResultOutput) Members() GetClusterMembersMapOutput {
|
|
return o.ApplyT(func(v GetClusterResult) map[string]GetClusterMembers { return v.Members }).(GetClusterMembersMapOutput)
|
|
}
|
|
|
|
func (o GetClusterResultOutput) Remote() pulumi.StringPtrOutput {
|
|
return o.ApplyT(func(v GetClusterResult) *string { return v.Remote }).(pulumi.StringPtrOutput)
|
|
}
|
|
|
|
func init() {
|
|
pulumi.RegisterOutputType(GetClusterResultOutput{})
|
|
}
|