import * as pulumi from "@pulumi/pulumi"; import * as outputs from "../types/output"; /** * Data source for retrieving a Harness Chaos Fault Template. Supports lookup by identity (recommended) or name. * * ## Example Usage * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as harness from "@pulumi/harness"; * * function tryOutput_( * ...fns: Array<() => pulumi.Input> * ): pulumi.Output { * if (fns.length === 0) { * throw new Error("try: all parameters failed"); * } * const [fn, ...rest] = fns; * try { * return pulumi.output(fn()).apply(result => result !== undefined ? result : tryOutput_(...rest)); * } catch { * return tryOutput_(...rest); * } * throw new Error("try: all parameters failed"); * } * * * // Example 1: Lookup Fault Template by Identity (Recommended) * const byIdentity = harness.chaos.getFaultTemplate({ * orgId: "my_org", * projectId: "my_project", * hubIdentity: "my-chaos-hub", * identity: "pod-delete-fault", * }); * export const faultName = byIdentity.then(byIdentity => byIdentity.name); * export const faultCategory = byIdentity.then(byIdentity => byIdentity.categories); * export const faultDescription = byIdentity.then(byIdentity => byIdentity.description); * // Example 2: Lookup Fault Template by Name * const byName = harness.chaos.getFaultTemplate({ * orgId: "my_org", * projectId: "my_project", * hubIdentity: "my-chaos-hub", * name: "Pod Delete Fault", * }); * // Example 3: Use in Chaos Experiment * const example = new harness.chaos.Experiment("example", {fault: [{ * name: byIdentity.then(byIdentity => byIdentity.name), * description: byIdentity.then(byIdentity => byIdentity.description), * }]}); * export const kubernetesImage = tryOutput_( * () => byIdentity.then(byIdentity => byIdentity.spec[0].chaos[0].kubernetes[0].image), * () => "not configured" * ); * export const faultParams = tryOutput_( * () => byIdentity.then(byIdentity => byIdentity.spec[0].chaos[0].params), * () => [] * ); * const hasKubernetesSpec = tryOutput_( * () => byIdentity.then(byIdentity => byIdentity.spec[0].chaos[0].kubernetes), * () => [] * ).length.apply(length => length > 0); * const hasTargets = tryOutput_( * () => byIdentity.then(byIdentity => byIdentity.spec[0].target), * () => [] * ).length.apply(length => length > 0); * export const templateFeatures = { * hasKubernetesSpec: hasKubernetesSpec, * hasTargets: hasTargets, * tags: byIdentity.then(byIdentity => byIdentity.tags), * }; * ``` */ export declare function getFaultTemplate(args: GetFaultTemplateArgs, opts?: pulumi.InvokeOptions): Promise; /** * A collection of arguments for invoking getFaultTemplate. */ export interface GetFaultTemplateArgs { /** * Identity of the chaos hub */ hubIdentity: string; /** * Unique identifier of the fault template (recommended) */ identity?: string; /** * Name of the fault template (may have timing issues with newly created templates) */ name?: string; /** * Organization identifier */ orgId?: string; /** * Project identifier */ projectId?: string; /** * Template revision to query (defaults to v1 if not specified) */ revision?: string; } /** * A collection of values returned by getFaultTemplate. */ export interface GetFaultTemplateResult { /** * Account identifier */ readonly accountId: string; /** * Fault categories */ readonly categories: string[]; /** * Creation timestamp */ readonly createdAt: number; /** * Creator user ID */ readonly createdBy: string; /** * Description of the fault template */ readonly description: string; /** * Name of the fault */ readonly faultName: string; /** * Identity of the chaos hub */ readonly hubIdentity: string; /** * Hub reference */ readonly hubRef: string; /** * The provider-assigned unique ID for this managed resource. */ readonly id: string; /** * Unique identifier of the fault template (recommended) */ readonly identity?: string; /** * Infrastructure type */ readonly infrastructureType: string; /** * List of supported infrastructures */ readonly infrastructures: string[]; /** * Whether this is a default template */ readonly isDefault: boolean; /** * Whether this is an enterprise-only template */ readonly isEnterprise: boolean; /** * Soft delete flag */ readonly isRemoved: boolean; /** * Name of the fault template (may have timing issues with newly created templates) */ readonly name?: string; /** * Organization identifier */ readonly orgId?: string; /** * Required permissions for the fault */ readonly permissionsRequired: string; /** * Project identifier */ readonly projectId?: string; /** * Template revision to query (defaults to v1 if not specified) */ readonly revision: string; /** * Tags associated with the fault template */ readonly tags: string[]; /** * Fault type */ readonly type: string; /** * Update timestamp */ readonly updatedAt: number; /** * Updater user ID */ readonly updatedBy: string; /** * Template variables */ readonly variables: outputs.chaos.GetFaultTemplateVariable[]; } /** * Data source for retrieving a Harness Chaos Fault Template. Supports lookup by identity (recommended) or name. * * ## Example Usage * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as harness from "@pulumi/harness"; * * function tryOutput_( * ...fns: Array<() => pulumi.Input> * ): pulumi.Output { * if (fns.length === 0) { * throw new Error("try: all parameters failed"); * } * const [fn, ...rest] = fns; * try { * return pulumi.output(fn()).apply(result => result !== undefined ? result : tryOutput_(...rest)); * } catch { * return tryOutput_(...rest); * } * throw new Error("try: all parameters failed"); * } * * * // Example 1: Lookup Fault Template by Identity (Recommended) * const byIdentity = harness.chaos.getFaultTemplate({ * orgId: "my_org", * projectId: "my_project", * hubIdentity: "my-chaos-hub", * identity: "pod-delete-fault", * }); * export const faultName = byIdentity.then(byIdentity => byIdentity.name); * export const faultCategory = byIdentity.then(byIdentity => byIdentity.categories); * export const faultDescription = byIdentity.then(byIdentity => byIdentity.description); * // Example 2: Lookup Fault Template by Name * const byName = harness.chaos.getFaultTemplate({ * orgId: "my_org", * projectId: "my_project", * hubIdentity: "my-chaos-hub", * name: "Pod Delete Fault", * }); * // Example 3: Use in Chaos Experiment * const example = new harness.chaos.Experiment("example", {fault: [{ * name: byIdentity.then(byIdentity => byIdentity.name), * description: byIdentity.then(byIdentity => byIdentity.description), * }]}); * export const kubernetesImage = tryOutput_( * () => byIdentity.then(byIdentity => byIdentity.spec[0].chaos[0].kubernetes[0].image), * () => "not configured" * ); * export const faultParams = tryOutput_( * () => byIdentity.then(byIdentity => byIdentity.spec[0].chaos[0].params), * () => [] * ); * const hasKubernetesSpec = tryOutput_( * () => byIdentity.then(byIdentity => byIdentity.spec[0].chaos[0].kubernetes), * () => [] * ).length.apply(length => length > 0); * const hasTargets = tryOutput_( * () => byIdentity.then(byIdentity => byIdentity.spec[0].target), * () => [] * ).length.apply(length => length > 0); * export const templateFeatures = { * hasKubernetesSpec: hasKubernetesSpec, * hasTargets: hasTargets, * tags: byIdentity.then(byIdentity => byIdentity.tags), * }; * ``` */ export declare function getFaultTemplateOutput(args: GetFaultTemplateOutputArgs, opts?: pulumi.InvokeOutputOptions): pulumi.Output; /** * A collection of arguments for invoking getFaultTemplate. */ export interface GetFaultTemplateOutputArgs { /** * Identity of the chaos hub */ hubIdentity: pulumi.Input; /** * Unique identifier of the fault template (recommended) */ identity?: pulumi.Input; /** * Name of the fault template (may have timing issues with newly created templates) */ name?: pulumi.Input; /** * Organization identifier */ orgId?: pulumi.Input; /** * Project identifier */ projectId?: pulumi.Input; /** * Template revision to query (defaults to v1 if not specified) */ revision?: pulumi.Input; } //# sourceMappingURL=getFaultTemplate.d.ts.map