182 lines
4.8 KiB
TypeScript
Generated
182 lines
4.8 KiB
TypeScript
Generated
// *** WARNING: this file was generated by pulumi-language-nodejs. ***
|
|
// *** Do not edit by hand unless you're certain you know what you are doing! ***
|
|
|
|
import * as pulumi from "@pulumi/pulumi";
|
|
import * as outputs from "./types/output";
|
|
import * as utilities from "./utilities";
|
|
|
|
/**
|
|
* ## # incus.getCluster
|
|
*
|
|
* Provides information about an Incus cluster.
|
|
*
|
|
* ## Example Usage
|
|
*
|
|
* ```typescript
|
|
* import * as pulumi from "@pulumi/pulumi";
|
|
* import * as incus from "@kiterun/incus";
|
|
*
|
|
* const _this = incus.getCluster({});
|
|
* ```
|
|
*
|
|
* ## Example prevent execution if any cluster member is not online
|
|
*
|
|
* ```typescript
|
|
* import * as pulumi from "@pulumi/pulumi";
|
|
* import * as incus from "@kiterun/incus";
|
|
*
|
|
* const _this = incus.getCluster({
|
|
* remote: "cluster",
|
|
* });
|
|
* ```
|
|
*
|
|
* ## 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.
|
|
*
|
|
* ```typescript
|
|
* import * as pulumi from "@pulumi/pulumi";
|
|
* import * as incus from "@kiterun/incus";
|
|
*
|
|
* export = async () => {
|
|
* const _this = await incus.getCluster({});
|
|
* const nodes: incus.Server[] = [];
|
|
* for (const range of Object.entries(_this.members).map(([k, v]) => ({key: k, value: v}))) {
|
|
* nodes.push(new incus.Server(`nodes-${range.key}`, {
|
|
* target: _this.isClustered ? range.key : null,
|
|
* config: {
|
|
* "core.bgp_address": ":179",
|
|
* },
|
|
* }));
|
|
* }
|
|
* }
|
|
* ```
|
|
*
|
|
* ## Notes
|
|
*
|
|
* * For non-clustered setups, the `members` attribute will be `null`.
|
|
*/
|
|
export function getCluster(
|
|
args?: GetClusterArgs,
|
|
opts?: pulumi.InvokeOptions,
|
|
): Promise<GetClusterResult> {
|
|
args = args || {};
|
|
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts || {});
|
|
return pulumi.runtime.invoke(
|
|
"incus:index/getCluster:getCluster",
|
|
{
|
|
remote: args.remote,
|
|
},
|
|
opts,
|
|
);
|
|
}
|
|
|
|
/**
|
|
* A collection of arguments for invoking getCluster.
|
|
*/
|
|
export interface GetClusterArgs {
|
|
/**
|
|
* *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;
|
|
}
|
|
|
|
/**
|
|
* A collection of values returned by getCluster.
|
|
*/
|
|
export interface GetClusterResult {
|
|
/**
|
|
* The provider-assigned unique ID for this managed resource.
|
|
*/
|
|
readonly id: string;
|
|
/**
|
|
* Whether this is a clustered setup.
|
|
*/
|
|
readonly isClustered: boolean;
|
|
/**
|
|
* A map of cluster members. The key is the member name and the value
|
|
* is a member object. See reference below.
|
|
*/
|
|
readonly members: { [key: string]: outputs.GetClusterMembers };
|
|
readonly remote?: string;
|
|
}
|
|
/**
|
|
* ## # incus.getCluster
|
|
*
|
|
* Provides information about an Incus cluster.
|
|
*
|
|
* ## Example Usage
|
|
*
|
|
* ```typescript
|
|
* import * as pulumi from "@pulumi/pulumi";
|
|
* import * as incus from "@kiterun/incus";
|
|
*
|
|
* const _this = incus.getCluster({});
|
|
* ```
|
|
*
|
|
* ## Example prevent execution if any cluster member is not online
|
|
*
|
|
* ```typescript
|
|
* import * as pulumi from "@pulumi/pulumi";
|
|
* import * as incus from "@kiterun/incus";
|
|
*
|
|
* const _this = incus.getCluster({
|
|
* remote: "cluster",
|
|
* });
|
|
* ```
|
|
*
|
|
* ## 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.
|
|
*
|
|
* ```typescript
|
|
* import * as pulumi from "@pulumi/pulumi";
|
|
* import * as incus from "@kiterun/incus";
|
|
*
|
|
* export = async () => {
|
|
* const _this = await incus.getCluster({});
|
|
* const nodes: incus.Server[] = [];
|
|
* for (const range of Object.entries(_this.members).map(([k, v]) => ({key: k, value: v}))) {
|
|
* nodes.push(new incus.Server(`nodes-${range.key}`, {
|
|
* target: _this.isClustered ? range.key : null,
|
|
* config: {
|
|
* "core.bgp_address": ":179",
|
|
* },
|
|
* }));
|
|
* }
|
|
* }
|
|
* ```
|
|
*
|
|
* ## Notes
|
|
*
|
|
* * For non-clustered setups, the `members` attribute will be `null`.
|
|
*/
|
|
export function getClusterOutput(
|
|
args?: GetClusterOutputArgs,
|
|
opts?: pulumi.InvokeOutputOptions,
|
|
): pulumi.Output<GetClusterResult> {
|
|
args = args || {};
|
|
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts || {});
|
|
return pulumi.runtime.invokeOutput(
|
|
"incus:index/getCluster:getCluster",
|
|
{
|
|
remote: args.remote,
|
|
},
|
|
opts,
|
|
);
|
|
}
|
|
|
|
/**
|
|
* A collection of arguments for invoking getCluster.
|
|
*/
|
|
export interface GetClusterOutputArgs {
|
|
/**
|
|
* *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.Input<string>;
|
|
}
|