1. Packages
  2. Splight
  3. API Docs
  4. Command
splight v1.2.2 published on Friday, Nov 8, 2024 by splightplatform

splight.Command

Explore with Pulumi AI

splight logo
splight v1.2.2 published on Friday, Nov 8, 2024 by splightplatform

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as splight from "@splightplatform/pulumi-splight";
    
    const myAsset = new splight.Asset("myAsset", {
        description: "My Asset Description",
        timezone: "America/Los_Angeles",
        geometry: JSON.stringify({
            type: "GeometryCollection",
            geometries: [{
                type: "Point",
                coordinates: [
                    0,
                    0,
                ],
            }],
        }),
    });
    const myAttribute = new splight.AssetAttribute("myAttribute", {
        type: "Number",
        unit: "meters",
        asset: myAsset.id,
    });
    const myAction = new splight.Action("myAction", {
        asset: {
            id: myAsset.id,
            name: myAsset.name,
        },
        setpoints: [{
            value: JSON.stringify(1),
            attribute: {
                id: myAttribute.id,
                name: myAttribute.name,
            },
        }],
    });
    const myCommand = new splight.Command("myCommand", {actions: [{
        id: myAction.id,
        name: myAction.name,
        asset: {
            id: myAsset.id,
            name: myAsset.name,
        },
    }]});
    
    import pulumi
    import json
    import pulumi_splight as splight
    
    my_asset = splight.Asset("myAsset",
        description="My Asset Description",
        timezone="America/Los_Angeles",
        geometry=json.dumps({
            "type": "GeometryCollection",
            "geometries": [{
                "type": "Point",
                "coordinates": [
                    0,
                    0,
                ],
            }],
        }))
    my_attribute = splight.AssetAttribute("myAttribute",
        type="Number",
        unit="meters",
        asset=my_asset.id)
    my_action = splight.Action("myAction",
        asset={
            "id": my_asset.id,
            "name": my_asset.name,
        },
        setpoints=[{
            "value": json.dumps(1),
            "attribute": {
                "id": my_attribute.id,
                "name": my_attribute.name,
            },
        }])
    my_command = splight.Command("myCommand", actions=[{
        "id": my_action.id,
        "name": my_action.name,
        "asset": {
            "id": my_asset.id,
            "name": my_asset.name,
        },
    }])
    
    package main
    
    import (
    	"encoding/json"
    
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    	"github.com/splightplatform/pulumi-splight/sdk/go/splight"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		tmpJSON0, err := json.Marshal(map[string]interface{}{
    			"type": "GeometryCollection",
    			"geometries": []map[string]interface{}{
    				map[string]interface{}{
    					"type": "Point",
    					"coordinates": []float64{
    						0,
    						0,
    					},
    				},
    			},
    		})
    		if err != nil {
    			return err
    		}
    		json0 := string(tmpJSON0)
    		myAsset, err := splight.NewAsset(ctx, "myAsset", &splight.AssetArgs{
    			Description: pulumi.String("My Asset Description"),
    			Timezone:    pulumi.String("America/Los_Angeles"),
    			Geometry:    pulumi.String(json0),
    		})
    		if err != nil {
    			return err
    		}
    		myAttribute, err := splight.NewAssetAttribute(ctx, "myAttribute", &splight.AssetAttributeArgs{
    			Type:  pulumi.String("Number"),
    			Unit:  pulumi.String("meters"),
    			Asset: myAsset.ID(),
    		})
    		if err != nil {
    			return err
    		}
    		tmpJSON1, err := json.Marshal(1)
    		if err != nil {
    			return err
    		}
    		json1 := string(tmpJSON1)
    		myAction, err := splight.NewAction(ctx, "myAction", &splight.ActionArgs{
    			Asset: &splight.ActionAssetArgs{
    				Id:   myAsset.ID(),
    				Name: myAsset.Name,
    			},
    			Setpoints: splight.ActionSetpointArray{
    				&splight.ActionSetpointArgs{
    					Value: pulumi.String(json1),
    					Attribute: &splight.ActionSetpointAttributeArgs{
    						Id:   myAttribute.ID(),
    						Name: myAttribute.Name,
    					},
    				},
    			},
    		})
    		if err != nil {
    			return err
    		}
    		_, err = splight.NewCommand(ctx, "myCommand", &splight.CommandArgs{
    			Actions: splight.CommandActionArray{
    				&splight.CommandActionArgs{
    					Id:   myAction.ID(),
    					Name: myAction.Name,
    					Asset: &splight.CommandActionAssetArgs{
    						Id:   myAsset.ID(),
    						Name: myAsset.Name,
    					},
    				},
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using System.Text.Json;
    using Pulumi;
    using Splight = Splight.Splight;
    
    return await Deployment.RunAsync(() => 
    {
        var myAsset = new Splight.Asset("myAsset", new()
        {
            Description = "My Asset Description",
            Timezone = "America/Los_Angeles",
            Geometry = JsonSerializer.Serialize(new Dictionary<string, object?>
            {
                ["type"] = "GeometryCollection",
                ["geometries"] = new[]
                {
                    new Dictionary<string, object?>
                    {
                        ["type"] = "Point",
                        ["coordinates"] = new[]
                        {
                            0,
                            0,
                        },
                    },
                },
            }),
        });
    
        var myAttribute = new Splight.AssetAttribute("myAttribute", new()
        {
            Type = "Number",
            Unit = "meters",
            Asset = myAsset.Id,
        });
    
        var myAction = new Splight.Action("myAction", new()
        {
            Asset = new Splight.Inputs.ActionAssetArgs
            {
                Id = myAsset.Id,
                Name = myAsset.Name,
            },
            Setpoints = new[]
            {
                new Splight.Inputs.ActionSetpointArgs
                {
                    Value = JsonSerializer.Serialize(1),
                    Attribute = new Splight.Inputs.ActionSetpointAttributeArgs
                    {
                        Id = myAttribute.Id,
                        Name = myAttribute.Name,
                    },
                },
            },
        });
    
        var myCommand = new Splight.Command("myCommand", new()
        {
            Actions = new[]
            {
                new Splight.Inputs.CommandActionArgs
                {
                    Id = myAction.Id,
                    Name = myAction.Name,
                    Asset = new Splight.Inputs.CommandActionAssetArgs
                    {
                        Id = myAsset.Id,
                        Name = myAsset.Name,
                    },
                },
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.splight.Asset;
    import com.pulumi.splight.AssetArgs;
    import com.pulumi.splight.AssetAttribute;
    import com.pulumi.splight.AssetAttributeArgs;
    import com.pulumi.splight.Action;
    import com.pulumi.splight.ActionArgs;
    import com.pulumi.splight.inputs.ActionAssetArgs;
    import com.pulumi.splight.inputs.ActionSetpointArgs;
    import com.pulumi.splight.inputs.ActionSetpointAttributeArgs;
    import com.pulumi.splight.Command;
    import com.pulumi.splight.CommandArgs;
    import com.pulumi.splight.inputs.CommandActionArgs;
    import com.pulumi.splight.inputs.CommandActionAssetArgs;
    import static com.pulumi.codegen.internal.Serialization.*;
    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 myAsset = new Asset("myAsset", AssetArgs.builder()
                .description("My Asset Description")
                .timezone("America/Los_Angeles")
                .geometry(serializeJson(
                    jsonObject(
                        jsonProperty("type", "GeometryCollection"),
                        jsonProperty("geometries", jsonArray(jsonObject(
                            jsonProperty("type", "Point"),
                            jsonProperty("coordinates", jsonArray(
                                0, 
                                0
                            ))
                        )))
                    )))
                .build());
    
            var myAttribute = new AssetAttribute("myAttribute", AssetAttributeArgs.builder()
                .type("Number")
                .unit("meters")
                .asset(myAsset.id())
                .build());
    
            var myAction = new Action("myAction", ActionArgs.builder()
                .asset(ActionAssetArgs.builder()
                    .id(myAsset.id())
                    .name(myAsset.name())
                    .build())
                .setpoints(ActionSetpointArgs.builder()
                    .value(serializeJson(
                        1))
                    .attribute(ActionSetpointAttributeArgs.builder()
                        .id(myAttribute.id())
                        .name(myAttribute.name())
                        .build())
                    .build())
                .build());
    
            var myCommand = new Command("myCommand", CommandArgs.builder()
                .actions(CommandActionArgs.builder()
                    .id(myAction.id())
                    .name(myAction.name())
                    .asset(CommandActionAssetArgs.builder()
                        .id(myAsset.id())
                        .name(myAsset.name())
                        .build())
                    .build())
                .build());
    
        }
    }
    
    resources:
      myAsset:
        type: splight:Asset
        properties:
          description: My Asset Description
          timezone: America/Los_Angeles
          geometry:
            fn::toJSON:
              type: GeometryCollection
              geometries:
                - type: Point
                  coordinates:
                    - 0
                    - 0
      myAttribute:
        type: splight:AssetAttribute
        properties:
          type: Number
          unit: meters
          asset: ${myAsset.id}
      myAction:
        type: splight:Action
        properties:
          asset:
            id: ${myAsset.id}
            name: ${myAsset.name}
          setpoints:
            - value:
                fn::toJSON: 1
              attribute:
                id: ${myAttribute.id}
                name: ${myAttribute.name}
      myCommand:
        type: splight:Command
        properties:
          actions:
            - id: ${myAction.id}
              name: ${myAction.name}
              asset:
                id: ${myAsset.id}
                name: ${myAsset.name}
    

    Create Command Resource

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

    Constructor syntax

    new Command(name: string, args: CommandArgs, opts?: CustomResourceOptions);
    @overload
    def Command(resource_name: str,
                args: CommandArgs,
                opts: Optional[ResourceOptions] = None)
    
    @overload
    def Command(resource_name: str,
                opts: Optional[ResourceOptions] = None,
                actions: Optional[Sequence[CommandActionArgs]] = None,
                description: Optional[str] = None,
                name: Optional[str] = None)
    func NewCommand(ctx *Context, name string, args CommandArgs, opts ...ResourceOption) (*Command, error)
    public Command(string name, CommandArgs args, CustomResourceOptions? opts = null)
    public Command(String name, CommandArgs args)
    public Command(String name, CommandArgs args, CustomResourceOptions options)
    
    type: splight:Command
    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 CommandArgs
    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 CommandArgs
    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 CommandArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args CommandArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args CommandArgs
    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 commandResource = new Splight.Command("commandResource", new()
    {
        Actions = new[]
        {
            new Splight.Inputs.CommandActionArgs
            {
                Asset = new Splight.Inputs.CommandActionAssetArgs
                {
                    Id = "string",
                    Name = "string",
                },
                Id = "string",
                Name = "string",
            },
        },
        Description = "string",
        Name = "string",
    });
    
    example, err := splight.NewCommand(ctx, "commandResource", &splight.CommandArgs{
    	Actions: splight.CommandActionArray{
    		&splight.CommandActionArgs{
    			Asset: &splight.CommandActionAssetArgs{
    				Id:   pulumi.String("string"),
    				Name: pulumi.String("string"),
    			},
    			Id:   pulumi.String("string"),
    			Name: pulumi.String("string"),
    		},
    	},
    	Description: pulumi.String("string"),
    	Name:        pulumi.String("string"),
    })
    
    var commandResource = new Command("commandResource", CommandArgs.builder()
        .actions(CommandActionArgs.builder()
            .asset(CommandActionAssetArgs.builder()
                .id("string")
                .name("string")
                .build())
            .id("string")
            .name("string")
            .build())
        .description("string")
        .name("string")
        .build());
    
    command_resource = splight.Command("commandResource",
        actions=[{
            "asset": {
                "id": "string",
                "name": "string",
            },
            "id": "string",
            "name": "string",
        }],
        description="string",
        name="string")
    
    const commandResource = new splight.Command("commandResource", {
        actions: [{
            asset: {
                id: "string",
                name: "string",
            },
            id: "string",
            name: "string",
        }],
        description: "string",
        name: "string",
    });
    
    type: splight:Command
    properties:
        actions:
            - asset:
                id: string
                name: string
              id: string
              name: string
        description: string
        name: string
    

    Command 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 Command resource accepts the following input properties:

    Actions List<Splight.Splight.Inputs.CommandAction>
    command actions
    Description string
    the description of the command to be created
    Name string
    the name of the command to be created
    Actions []CommandActionArgs
    command actions
    Description string
    the description of the command to be created
    Name string
    the name of the command to be created
    actions List<CommandAction>
    command actions
    description String
    the description of the command to be created
    name String
    the name of the command to be created
    actions CommandAction[]
    command actions
    description string
    the description of the command to be created
    name string
    the name of the command to be created
    actions Sequence[CommandActionArgs]
    command actions
    description str
    the description of the command to be created
    name str
    the name of the command to be created
    actions List<Property Map>
    command actions
    description String
    the description of the command to be created
    name String
    the name of the command to be created

    Outputs

    All input properties are implicitly available as output properties. Additionally, the Command 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 Command Resource

    Get an existing Command 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?: CommandState, opts?: CustomResourceOptions): Command
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            actions: Optional[Sequence[CommandActionArgs]] = None,
            description: Optional[str] = None,
            name: Optional[str] = None) -> Command
    func GetCommand(ctx *Context, name string, id IDInput, state *CommandState, opts ...ResourceOption) (*Command, error)
    public static Command Get(string name, Input<string> id, CommandState? state, CustomResourceOptions? opts = null)
    public static Command get(String name, Output<String> id, CommandState 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.
    The following state arguments are supported:
    Actions List<Splight.Splight.Inputs.CommandAction>
    command actions
    Description string
    the description of the command to be created
    Name string
    the name of the command to be created
    Actions []CommandActionArgs
    command actions
    Description string
    the description of the command to be created
    Name string
    the name of the command to be created
    actions List<CommandAction>
    command actions
    description String
    the description of the command to be created
    name String
    the name of the command to be created
    actions CommandAction[]
    command actions
    description string
    the description of the command to be created
    name string
    the name of the command to be created
    actions Sequence[CommandActionArgs]
    command actions
    description str
    the description of the command to be created
    name str
    the name of the command to be created
    actions List<Property Map>
    command actions
    description String
    the description of the command to be created
    name String
    the name of the command to be created

    Supporting Types

    CommandAction, CommandActionArgs

    Asset Splight.Splight.Inputs.CommandActionAsset
    asset associated with the action (to be deprecated)
    Id string
    action Id
    Name string
    setpoint name
    Asset CommandActionAsset
    asset associated with the action (to be deprecated)
    Id string
    action Id
    Name string
    setpoint name
    asset CommandActionAsset
    asset associated with the action (to be deprecated)
    id String
    action Id
    name String
    setpoint name
    asset CommandActionAsset
    asset associated with the action (to be deprecated)
    id string
    action Id
    name string
    setpoint name
    asset CommandActionAsset
    asset associated with the action (to be deprecated)
    id str
    action Id
    name str
    setpoint name
    asset Property Map
    asset associated with the action (to be deprecated)
    id String
    action Id
    name String
    setpoint name

    CommandActionAsset, CommandActionAssetArgs

    Id string
    asset id
    Name string
    asset name
    Id string
    asset id
    Name string
    asset name
    id String
    asset id
    name String
    asset name
    id string
    asset id
    name string
    asset name
    id str
    asset id
    name str
    asset name
    id String
    asset id
    name String
    asset name

    Import

    $ pulumi import splight:index/command:Command [options] splight_command.<name> <command_id>
    

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

    Package Details

    Repository
    splight splightplatform/pulumi-splight
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the splight Terraform Provider.
    splight logo
    splight v1.2.2 published on Friday, Nov 8, 2024 by splightplatform