1. Packages
  2. Volcengine
  3. API Docs
  4. vmp
  5. RuleFile
Volcengine v0.0.34 published on Wednesday, Jul 2, 2025 by Volcengine

volcengine.vmp.RuleFile

Explore with Pulumi AI

volcengine logo
Volcengine v0.0.34 published on Wednesday, Jul 2, 2025 by Volcengine

    Provides a resource to manage vmp rule file

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as volcengine from "@volcengine/pulumi";
    
    const fooWorkspace = new volcengine.vmp.Workspace("fooWorkspace", {
        instanceTypeId: "vmp.standard.15d",
        deleteProtectionEnabled: false,
        description: "acc-test-1",
        username: "admin123",
        password: "**********",
    });
    const fooRuleFile = new volcengine.vmp.RuleFile("fooRuleFile", {
        workspaceId: fooWorkspace.id,
        description: "acc-test-1",
        content: `groups:
        - interval: 10s
          name: recording_rules
          rules:
            - expr: sum(irate(container_cpu_usage_seconds_total{image!=""}[5m])) by (pod) *100
              labels:
                team: operations
              record: pod:cpu:useage
    `,
    });
    
    import pulumi
    import pulumi_volcengine as volcengine
    
    foo_workspace = volcengine.vmp.Workspace("fooWorkspace",
        instance_type_id="vmp.standard.15d",
        delete_protection_enabled=False,
        description="acc-test-1",
        username="admin123",
        password="**********")
    foo_rule_file = volcengine.vmp.RuleFile("fooRuleFile",
        workspace_id=foo_workspace.id,
        description="acc-test-1",
        content="""groups:
        - interval: 10s
          name: recording_rules
          rules:
            - expr: sum(irate(container_cpu_usage_seconds_total{image!=""}[5m])) by (pod) *100
              labels:
                team: operations
              record: pod:cpu:useage
    """)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    	"github.com/volcengine/pulumi-volcengine/sdk/go/volcengine/vmp"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		fooWorkspace, err := vmp.NewWorkspace(ctx, "fooWorkspace", &vmp.WorkspaceArgs{
    			InstanceTypeId:          pulumi.String("vmp.standard.15d"),
    			DeleteProtectionEnabled: pulumi.Bool(false),
    			Description:             pulumi.String("acc-test-1"),
    			Username:                pulumi.String("admin123"),
    			Password:                pulumi.String("**********"),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = vmp.NewRuleFile(ctx, "fooRuleFile", &vmp.RuleFileArgs{
    			WorkspaceId: fooWorkspace.ID(),
    			Description: pulumi.String("acc-test-1"),
    			Content: pulumi.String(`groups:
        - interval: 10s
          name: recording_rules
          rules:
            - expr: sum(irate(container_cpu_usage_seconds_total{image!=""}[5m])) by (pod) *100
              labels:
                team: operations
              record: pod:cpu:useage
    `),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Volcengine = Pulumi.Volcengine;
    
    return await Deployment.RunAsync(() => 
    {
        var fooWorkspace = new Volcengine.Vmp.Workspace("fooWorkspace", new()
        {
            InstanceTypeId = "vmp.standard.15d",
            DeleteProtectionEnabled = false,
            Description = "acc-test-1",
            Username = "admin123",
            Password = "**********",
        });
    
        var fooRuleFile = new Volcengine.Vmp.RuleFile("fooRuleFile", new()
        {
            WorkspaceId = fooWorkspace.Id,
            Description = "acc-test-1",
            Content = @"groups:
        - interval: 10s
          name: recording_rules
          rules:
            - expr: sum(irate(container_cpu_usage_seconds_total{image!=""""}[5m])) by (pod) *100
              labels:
                team: operations
              record: pod:cpu:useage
    ",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.volcengine.vmp.Workspace;
    import com.pulumi.volcengine.vmp.WorkspaceArgs;
    import com.pulumi.volcengine.vmp.RuleFile;
    import com.pulumi.volcengine.vmp.RuleFileArgs;
    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) {
            var fooWorkspace = new Workspace("fooWorkspace", WorkspaceArgs.builder()        
                .instanceTypeId("vmp.standard.15d")
                .deleteProtectionEnabled(false)
                .description("acc-test-1")
                .username("admin123")
                .password("**********")
                .build());
    
            var fooRuleFile = new RuleFile("fooRuleFile", RuleFileArgs.builder()        
                .workspaceId(fooWorkspace.id())
                .description("acc-test-1")
                .content("""
    groups:
        - interval: 10s
          name: recording_rules
          rules:
            - expr: sum(irate(container_cpu_usage_seconds_total{image!=""}[5m])) by (pod) *100
              labels:
                team: operations
              record: pod:cpu:useage
                """)
                .build());
    
        }
    }
    
    resources:
      fooWorkspace:
        type: volcengine:vmp:Workspace
        properties:
          instanceTypeId: vmp.standard.15d
          deleteProtectionEnabled: false
          description: acc-test-1
          username: admin123
          password: '**********'
      fooRuleFile:
        type: volcengine:vmp:RuleFile
        properties:
          workspaceId: ${fooWorkspace.id}
          description: acc-test-1
          content: |
            groups:
                - interval: 10s
                  name: recording_rules
                  rules:
                    - expr: sum(irate(container_cpu_usage_seconds_total{image!=""}[5m])) by (pod) *100
                      labels:
                        team: operations
                      record: pod:cpu:useage        
    

    Create RuleFile Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new RuleFile(name: string, args: RuleFileArgs, opts?: CustomResourceOptions);
    @overload
    def RuleFile(resource_name: str,
                 args: RuleFileArgs,
                 opts: Optional[ResourceOptions] = None)
    
    @overload
    def RuleFile(resource_name: str,
                 opts: Optional[ResourceOptions] = None,
                 content: Optional[str] = None,
                 workspace_id: Optional[str] = None,
                 description: Optional[str] = None,
                 name: Optional[str] = None)
    func NewRuleFile(ctx *Context, name string, args RuleFileArgs, opts ...ResourceOption) (*RuleFile, error)
    public RuleFile(string name, RuleFileArgs args, CustomResourceOptions? opts = null)
    public RuleFile(String name, RuleFileArgs args)
    public RuleFile(String name, RuleFileArgs args, CustomResourceOptions options)
    
    type: volcengine:vmp:RuleFile
    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 RuleFileArgs
    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 RuleFileArgs
    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 RuleFileArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args RuleFileArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args RuleFileArgs
    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 ruleFileResource = new Volcengine.Vmp.RuleFile("ruleFileResource", new()
    {
        Content = "string",
        WorkspaceId = "string",
        Description = "string",
        Name = "string",
    });
    
    example, err := vmp.NewRuleFile(ctx, "ruleFileResource", &vmp.RuleFileArgs{
    	Content:     pulumi.String("string"),
    	WorkspaceId: pulumi.String("string"),
    	Description: pulumi.String("string"),
    	Name:        pulumi.String("string"),
    })
    
    var ruleFileResource = new RuleFile("ruleFileResource", RuleFileArgs.builder()
        .content("string")
        .workspaceId("string")
        .description("string")
        .name("string")
        .build());
    
    rule_file_resource = volcengine.vmp.RuleFile("ruleFileResource",
        content="string",
        workspace_id="string",
        description="string",
        name="string")
    
    const ruleFileResource = new volcengine.vmp.RuleFile("ruleFileResource", {
        content: "string",
        workspaceId: "string",
        description: "string",
        name: "string",
    });
    
    type: volcengine:vmp:RuleFile
    properties:
        content: string
        description: string
        name: string
        workspaceId: string
    

    RuleFile Resource Properties

    To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

    Inputs

    In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

    The RuleFile resource accepts the following input properties:

    Content string
    The content of the rule file.
    WorkspaceId string
    The id of the workspace.
    Description string
    The description of the rule file.
    Name string
    The name of the rule file.
    Content string
    The content of the rule file.
    WorkspaceId string
    The id of the workspace.
    Description string
    The description of the rule file.
    Name string
    The name of the rule file.
    content String
    The content of the rule file.
    workspaceId String
    The id of the workspace.
    description String
    The description of the rule file.
    name String
    The name of the rule file.
    content string
    The content of the rule file.
    workspaceId string
    The id of the workspace.
    description string
    The description of the rule file.
    name string
    The name of the rule file.
    content str
    The content of the rule file.
    workspace_id str
    The id of the workspace.
    description str
    The description of the rule file.
    name str
    The name of the rule file.
    content String
    The content of the rule file.
    workspaceId String
    The id of the workspace.
    description String
    The description of the rule file.
    name String
    The name of the rule file.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the RuleFile resource produces the following output properties:

    CreateTime string
    The create time of workspace.
    Id string
    The provider-assigned unique ID for this managed resource.
    LastUpdateTime string
    The last update time of rule file.
    RuleCount int
    The rule count number of rule file.
    RuleFileId string
    The id of rule file.
    Status string
    The status of workspace.
    CreateTime string
    The create time of workspace.
    Id string
    The provider-assigned unique ID for this managed resource.
    LastUpdateTime string
    The last update time of rule file.
    RuleCount int
    The rule count number of rule file.
    RuleFileId string
    The id of rule file.
    Status string
    The status of workspace.
    createTime String
    The create time of workspace.
    id String
    The provider-assigned unique ID for this managed resource.
    lastUpdateTime String
    The last update time of rule file.
    ruleCount Integer
    The rule count number of rule file.
    ruleFileId String
    The id of rule file.
    status String
    The status of workspace.
    createTime string
    The create time of workspace.
    id string
    The provider-assigned unique ID for this managed resource.
    lastUpdateTime string
    The last update time of rule file.
    ruleCount number
    The rule count number of rule file.
    ruleFileId string
    The id of rule file.
    status string
    The status of workspace.
    create_time str
    The create time of workspace.
    id str
    The provider-assigned unique ID for this managed resource.
    last_update_time str
    The last update time of rule file.
    rule_count int
    The rule count number of rule file.
    rule_file_id str
    The id of rule file.
    status str
    The status of workspace.
    createTime String
    The create time of workspace.
    id String
    The provider-assigned unique ID for this managed resource.
    lastUpdateTime String
    The last update time of rule file.
    ruleCount Number
    The rule count number of rule file.
    ruleFileId String
    The id of rule file.
    status String
    The status of workspace.

    Look up Existing RuleFile Resource

    Get an existing RuleFile 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?: RuleFileState, opts?: CustomResourceOptions): RuleFile
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            content: Optional[str] = None,
            create_time: Optional[str] = None,
            description: Optional[str] = None,
            last_update_time: Optional[str] = None,
            name: Optional[str] = None,
            rule_count: Optional[int] = None,
            rule_file_id: Optional[str] = None,
            status: Optional[str] = None,
            workspace_id: Optional[str] = None) -> RuleFile
    func GetRuleFile(ctx *Context, name string, id IDInput, state *RuleFileState, opts ...ResourceOption) (*RuleFile, error)
    public static RuleFile Get(string name, Input<string> id, RuleFileState? state, CustomResourceOptions? opts = null)
    public static RuleFile get(String name, Output<String> id, RuleFileState state, CustomResourceOptions options)
    resources:  _:    type: volcengine:vmp:RuleFile    get:      id: ${id}
    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.
    The following state arguments are supported:
    Content string
    The content of the rule file.
    CreateTime string
    The create time of workspace.
    Description string
    The description of the rule file.
    LastUpdateTime string
    The last update time of rule file.
    Name string
    The name of the rule file.
    RuleCount int
    The rule count number of rule file.
    RuleFileId string
    The id of rule file.
    Status string
    The status of workspace.
    WorkspaceId string
    The id of the workspace.
    Content string
    The content of the rule file.
    CreateTime string
    The create time of workspace.
    Description string
    The description of the rule file.
    LastUpdateTime string
    The last update time of rule file.
    Name string
    The name of the rule file.
    RuleCount int
    The rule count number of rule file.
    RuleFileId string
    The id of rule file.
    Status string
    The status of workspace.
    WorkspaceId string
    The id of the workspace.
    content String
    The content of the rule file.
    createTime String
    The create time of workspace.
    description String
    The description of the rule file.
    lastUpdateTime String
    The last update time of rule file.
    name String
    The name of the rule file.
    ruleCount Integer
    The rule count number of rule file.
    ruleFileId String
    The id of rule file.
    status String
    The status of workspace.
    workspaceId String
    The id of the workspace.
    content string
    The content of the rule file.
    createTime string
    The create time of workspace.
    description string
    The description of the rule file.
    lastUpdateTime string
    The last update time of rule file.
    name string
    The name of the rule file.
    ruleCount number
    The rule count number of rule file.
    ruleFileId string
    The id of rule file.
    status string
    The status of workspace.
    workspaceId string
    The id of the workspace.
    content str
    The content of the rule file.
    create_time str
    The create time of workspace.
    description str
    The description of the rule file.
    last_update_time str
    The last update time of rule file.
    name str
    The name of the rule file.
    rule_count int
    The rule count number of rule file.
    rule_file_id str
    The id of rule file.
    status str
    The status of workspace.
    workspace_id str
    The id of the workspace.
    content String
    The content of the rule file.
    createTime String
    The create time of workspace.
    description String
    The description of the rule file.
    lastUpdateTime String
    The last update time of rule file.
    name String
    The name of the rule file.
    ruleCount Number
    The rule count number of rule file.
    ruleFileId String
    The id of rule file.
    status String
    The status of workspace.
    workspaceId String
    The id of the workspace.

    Import

    VMP Rule File can be imported using the workspace_id:rule_file_id, e.g. (We can only get rule file by WorkspaceId and RuleFileId)

    $ pulumi import volcengine:vmp/ruleFile:RuleFile default 60dde3ca-951c-4c05-8777-e5a7caa07ad6:d6f72bd9-674e-4651-b98c-3797657d9614
    

    To learn more about importing existing cloud resources, see Importing resources.

    Package Details

    Repository
    volcengine volcengine/pulumi-volcengine
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the volcengine Terraform Provider.
    volcengine logo
    Volcengine v0.0.34 published on Wednesday, Jul 2, 2025 by Volcengine