Impart Security v0.7.0 published on Tuesday, Sep 24, 2024 by Impart Security
impart.RuleScript
Explore with Pulumi AI
Impart Security v0.7.0 published on Tuesday, Sep 24, 2024 by Impart Security
Manage a rule script.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as fs from "fs";
import * as impart from "@impart-security/pulumi-impart";
// Create a new rule script
const example = new impart.RuleScript("example", {
name: "example",
disabled: false,
description: "Rule description",
sourceFile: `${path.module}/rule.js`,
sourceHash: "<sha256 hash for the source_file content>",
blockingEffect: "block",
});
// Create a new rule script with content
const exampleContent = new impart.RuleScript("exampleContent", {
name: "example",
disabled: false,
description: "Rule description",
content: fs.readFileSync(`${path.module}/rule.js`, "utf8"),
blockingEffect: "block",
});
import pulumi
import pulumi_impart as impart
# Create a new rule script
example = impart.RuleScript("example",
name="example",
disabled=False,
description="Rule description",
source_file=f"{path['module']}/rule.js",
source_hash="<sha256 hash for the source_file content>",
blocking_effect="block")
# Create a new rule script with content
example_content = impart.RuleScript("exampleContent",
name="example",
disabled=False,
description="Rule description",
content=(lambda path: open(path).read())(f"{path['module']}/rule.js"),
blocking_effect="block")
package main
import (
"fmt"
"os"
"github.com/impart-security/pulumi-impart/sdk/go/impart"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func readFileOrPanic(path string) pulumi.StringPtrInput {
data, err := os.ReadFile(path)
if err != nil {
panic(err.Error())
}
return pulumi.String(string(data))
}
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
// Create a new rule script
_, err := impart.NewRuleScript(ctx, "example", &impart.RuleScriptArgs{
Name: pulumi.String("example"),
Disabled: pulumi.Bool(false),
Description: pulumi.String("Rule description"),
SourceFile: pulumi.String(fmt.Sprintf("%v/rule.js", path.Module)),
SourceHash: pulumi.String("<sha256 hash for the source_file content>"),
BlockingEffect: pulumi.String("block"),
})
if err != nil {
return err
}
// Create a new rule script with content
_, err = impart.NewRuleScript(ctx, "exampleContent", &impart.RuleScriptArgs{
Name: pulumi.String("example"),
Disabled: pulumi.Bool(false),
Description: pulumi.String("Rule description"),
Content: readFileOrPanic(fmt.Sprintf("%v/rule.js", path.Module)),
BlockingEffect: pulumi.String("block"),
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Pulumi;
using Impart = Pulumi.Impart;
return await Deployment.RunAsync(() =>
{
// Create a new rule script
var example = new Impart.RuleScript("example", new()
{
Name = "example",
Disabled = false,
Description = "Rule description",
SourceFile = $"{path.Module}/rule.js",
SourceHash = "<sha256 hash for the source_file content>",
BlockingEffect = "block",
});
// Create a new rule script with content
var exampleContent = new Impart.RuleScript("exampleContent", new()
{
Name = "example",
Disabled = false,
Description = "Rule description",
Content = File.ReadAllText($"{path.Module}/rule.js"),
BlockingEffect = "block",
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.impart.RuleScript;
import com.pulumi.impart.RuleScriptArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
// Create a new rule script
var example = new RuleScript("example", RuleScriptArgs.builder()
.name("example")
.disabled(false)
.description("Rule description")
.sourceFile(String.format("%s/rule.js", path.module()))
.sourceHash("<sha256 hash for the source_file content>")
.blockingEffect("block")
.build());
// Create a new rule script with content
var exampleContent = new RuleScript("exampleContent", RuleScriptArgs.builder()
.name("example")
.disabled(false)
.description("Rule description")
.content(Files.readString(Paths.get(String.format("%s/rule.js", path.module()))))
.blockingEffect("block")
.build());
}
}
resources:
# Create a new rule script
example:
type: impart:RuleScript
properties:
name: example
disabled: false
description: Rule description
sourceFile: ${path.module}/rule.js
sourceHash: <sha256 hash for the source_file content>
blockingEffect: block
# Create a new rule script with content
exampleContent:
type: impart:RuleScript
properties:
name: example
disabled: false
description: Rule description
content:
fn::readFile: ${path.module}/rule.js
blockingEffect: block
Create RuleScript Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new RuleScript(name: string, args: RuleScriptArgs, opts?: CustomResourceOptions);
@overload
def RuleScript(resource_name: str,
args: RuleScriptArgs,
opts: Optional[ResourceOptions] = None)
@overload
def RuleScript(resource_name: str,
opts: Optional[ResourceOptions] = None,
disabled: Optional[bool] = None,
name: Optional[str] = None,
blocking_effect: Optional[str] = None,
content: Optional[str] = None,
description: Optional[str] = None,
source_file: Optional[str] = None,
source_hash: Optional[str] = None)
func NewRuleScript(ctx *Context, name string, args RuleScriptArgs, opts ...ResourceOption) (*RuleScript, error)
public RuleScript(string name, RuleScriptArgs args, CustomResourceOptions? opts = null)
public RuleScript(String name, RuleScriptArgs args)
public RuleScript(String name, RuleScriptArgs args, CustomResourceOptions options)
type: impart:RuleScript
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
Parameters
- name string
- The unique name of the resource.
- args RuleScriptArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- args RuleScriptArgs
- The arguments to resource properties.
- opts ResourceOptions
- Bag of options to control resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args RuleScriptArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args RuleScriptArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args RuleScriptArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
Constructor example
The following reference example uses placeholder values for all input properties.
var ruleScriptResource = new Impart.RuleScript("ruleScriptResource", new()
{
Disabled = false,
Name = "string",
BlockingEffect = "string",
Content = "string",
Description = "string",
SourceFile = "string",
SourceHash = "string",
});
example, err := impart.NewRuleScript(ctx, "ruleScriptResource", &impart.RuleScriptArgs{
Disabled: pulumi.Bool(false),
Name: pulumi.String("string"),
BlockingEffect: pulumi.String("string"),
Content: pulumi.String("string"),
Description: pulumi.String("string"),
SourceFile: pulumi.String("string"),
SourceHash: pulumi.String("string"),
})
var ruleScriptResource = new RuleScript("ruleScriptResource", RuleScriptArgs.builder()
.disabled(false)
.name("string")
.blockingEffect("string")
.content("string")
.description("string")
.sourceFile("string")
.sourceHash("string")
.build());
rule_script_resource = impart.RuleScript("ruleScriptResource",
disabled=False,
name="string",
blocking_effect="string",
content="string",
description="string",
source_file="string",
source_hash="string")
const ruleScriptResource = new impart.RuleScript("ruleScriptResource", {
disabled: false,
name: "string",
blockingEffect: "string",
content: "string",
description: "string",
sourceFile: "string",
sourceHash: "string",
});
type: impart:RuleScript
properties:
blockingEffect: string
content: string
description: string
disabled: false
name: string
sourceFile: string
sourceHash: string
RuleScript Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.
Inputs
The RuleScript resource accepts the following input properties:
- Disabled bool
- Set true to disable the rule script.
- Name string
- The name for this rule script.
- Blocking
Effect string - The rule blocking effect. Allowed values: block, simulate. If not set effect will be block.
- Content string
- The rule body content.
- Description string
- The description for this rule script.
- Source
File string - The rule source file.
- Source
Hash string - The rule source hash.
- Disabled bool
- Set true to disable the rule script.
- Name string
- The name for this rule script.
- Blocking
Effect string - The rule blocking effect. Allowed values: block, simulate. If not set effect will be block.
- Content string
- The rule body content.
- Description string
- The description for this rule script.
- Source
File string - The rule source file.
- Source
Hash string - The rule source hash.
- disabled Boolean
- Set true to disable the rule script.
- name String
- The name for this rule script.
- blocking
Effect String - The rule blocking effect. Allowed values: block, simulate. If not set effect will be block.
- content String
- The rule body content.
- description String
- The description for this rule script.
- source
File String - The rule source file.
- source
Hash String - The rule source hash.
- disabled boolean
- Set true to disable the rule script.
- name string
- The name for this rule script.
- blocking
Effect string - The rule blocking effect. Allowed values: block, simulate. If not set effect will be block.
- content string
- The rule body content.
- description string
- The description for this rule script.
- source
File string - The rule source file.
- source
Hash string - The rule source hash.
- disabled bool
- Set true to disable the rule script.
- name str
- The name for this rule script.
- blocking_
effect str - The rule blocking effect. Allowed values: block, simulate. If not set effect will be block.
- content str
- The rule body content.
- description str
- The description for this rule script.
- source_
file str - The rule source file.
- source_
hash str - The rule source hash.
- disabled Boolean
- Set true to disable the rule script.
- name String
- The name for this rule script.
- blocking
Effect String - The rule blocking effect. Allowed values: block, simulate. If not set effect will be block.
- content String
- The rule body content.
- description String
- The description for this rule script.
- source
File String - The rule source file.
- source
Hash String - The rule source hash.
Outputs
All input properties are implicitly available as output properties. Additionally, the RuleScript resource produces the following output properties:
- Id string
- The provider-assigned unique ID for this managed resource.
- Id string
- The provider-assigned unique ID for this managed resource.
- id String
- The provider-assigned unique ID for this managed resource.
- id string
- The provider-assigned unique ID for this managed resource.
- id str
- The provider-assigned unique ID for this managed resource.
- id String
- The provider-assigned unique ID for this managed resource.
Look up Existing RuleScript Resource
Get an existing RuleScript resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.
public static get(name: string, id: Input<ID>, state?: RuleScriptState, opts?: CustomResourceOptions): RuleScript
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
blocking_effect: Optional[str] = None,
content: Optional[str] = None,
description: Optional[str] = None,
disabled: Optional[bool] = None,
name: Optional[str] = None,
source_file: Optional[str] = None,
source_hash: Optional[str] = None) -> RuleScript
func GetRuleScript(ctx *Context, name string, id IDInput, state *RuleScriptState, opts ...ResourceOption) (*RuleScript, error)
public static RuleScript Get(string name, Input<string> id, RuleScriptState? state, CustomResourceOptions? opts = null)
public static RuleScript get(String name, Output<String> id, RuleScriptState state, CustomResourceOptions options)
Resource lookup is not supported in YAML
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- resource_name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- Blocking
Effect string - The rule blocking effect. Allowed values: block, simulate. If not set effect will be block.
- Content string
- The rule body content.
- Description string
- The description for this rule script.
- Disabled bool
- Set true to disable the rule script.
- Name string
- The name for this rule script.
- Source
File string - The rule source file.
- Source
Hash string - The rule source hash.
- Blocking
Effect string - The rule blocking effect. Allowed values: block, simulate. If not set effect will be block.
- Content string
- The rule body content.
- Description string
- The description for this rule script.
- Disabled bool
- Set true to disable the rule script.
- Name string
- The name for this rule script.
- Source
File string - The rule source file.
- Source
Hash string - The rule source hash.
- blocking
Effect String - The rule blocking effect. Allowed values: block, simulate. If not set effect will be block.
- content String
- The rule body content.
- description String
- The description for this rule script.
- disabled Boolean
- Set true to disable the rule script.
- name String
- The name for this rule script.
- source
File String - The rule source file.
- source
Hash String - The rule source hash.
- blocking
Effect string - The rule blocking effect. Allowed values: block, simulate. If not set effect will be block.
- content string
- The rule body content.
- description string
- The description for this rule script.
- disabled boolean
- Set true to disable the rule script.
- name string
- The name for this rule script.
- source
File string - The rule source file.
- source
Hash string - The rule source hash.
- blocking_
effect str - The rule blocking effect. Allowed values: block, simulate. If not set effect will be block.
- content str
- The rule body content.
- description str
- The description for this rule script.
- disabled bool
- Set true to disable the rule script.
- name str
- The name for this rule script.
- source_
file str - The rule source file.
- source_
hash str - The rule source hash.
- blocking
Effect String - The rule blocking effect. Allowed values: block, simulate. If not set effect will be block.
- content String
- The rule body content.
- description String
- The description for this rule script.
- disabled Boolean
- Set true to disable the rule script.
- name String
- The name for this rule script.
- source
File String - The rule source file.
- source
Hash String - The rule source hash.
Package Details
- Repository
- impart impart-security/pulumi-impart
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
impart
Terraform Provider.
Impart Security v0.7.0 published on Tuesday, Sep 24, 2024 by Impart Security