1. Packages
  2. Splight
  3. API Docs
  4. AssetAttribute
splight v1.2.13 published on Friday, Feb 14, 2025 by splightplatform

splight.AssetAttribute

Explore with Pulumi AI

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,
});
Copy
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)
Copy
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
		}
		_, err = splight.NewAssetAttribute(ctx, "myAttribute", &splight.AssetAttributeArgs{
			Type:  pulumi.String("Number"),
			Unit:  pulumi.String("meters"),
			Asset: myAsset.ID(),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
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,
    });

});
Copy
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 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());

    }
}
Copy
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}
Copy

Create AssetAttribute Resource

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

Constructor syntax

new AssetAttribute(name: string, args: AssetAttributeArgs, opts?: CustomResourceOptions);
@overload
def AssetAttribute(resource_name: str,
                   args: AssetAttributeArgs,
                   opts: Optional[ResourceOptions] = None)

@overload
def AssetAttribute(resource_name: str,
                   opts: Optional[ResourceOptions] = None,
                   asset: Optional[str] = None,
                   type: Optional[str] = None,
                   name: Optional[str] = None,
                   unit: Optional[str] = None)
func NewAssetAttribute(ctx *Context, name string, args AssetAttributeArgs, opts ...ResourceOption) (*AssetAttribute, error)
public AssetAttribute(string name, AssetAttributeArgs args, CustomResourceOptions? opts = null)
public AssetAttribute(String name, AssetAttributeArgs args)
public AssetAttribute(String name, AssetAttributeArgs args, CustomResourceOptions options)
type: splight:AssetAttribute
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args This property is required. AssetAttributeArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. AssetAttributeArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args This property is required. AssetAttributeArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. AssetAttributeArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. AssetAttributeArgs
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 assetAttributeResource = new Splight.AssetAttribute("assetAttributeResource", new()
{
    Asset = "string",
    Type = "string",
    Name = "string",
    Unit = "string",
});
Copy
example, err := splight.NewAssetAttribute(ctx, "assetAttributeResource", &splight.AssetAttributeArgs{
	Asset: pulumi.String("string"),
	Type:  pulumi.String("string"),
	Name:  pulumi.String("string"),
	Unit:  pulumi.String("string"),
})
Copy
var assetAttributeResource = new AssetAttribute("assetAttributeResource", AssetAttributeArgs.builder()
    .asset("string")
    .type("string")
    .name("string")
    .unit("string")
    .build());
Copy
asset_attribute_resource = splight.AssetAttribute("assetAttributeResource",
    asset="string",
    type="string",
    name="string",
    unit="string")
Copy
const assetAttributeResource = new splight.AssetAttribute("assetAttributeResource", {
    asset: "string",
    type: "string",
    name: "string",
    unit: "string",
});
Copy
type: splight:AssetAttribute
properties:
    asset: string
    name: string
    type: string
    unit: string
Copy

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

Asset
This property is required.
Changes to this property will trigger replacement.
string
reference to the asset to be linked to
Type This property is required. string
[String|Boolean|Number] type of the data to be ingested in this attribute
Name string
name of the resource
Unit Changes to this property will trigger replacement. string
optional reference to the unit of the measure
Asset
This property is required.
Changes to this property will trigger replacement.
string
reference to the asset to be linked to
Type This property is required. string
[String|Boolean|Number] type of the data to be ingested in this attribute
Name string
name of the resource
Unit Changes to this property will trigger replacement. string
optional reference to the unit of the measure
asset
This property is required.
Changes to this property will trigger replacement.
String
reference to the asset to be linked to
type This property is required. String
[String|Boolean|Number] type of the data to be ingested in this attribute
name String
name of the resource
unit Changes to this property will trigger replacement. String
optional reference to the unit of the measure
asset
This property is required.
Changes to this property will trigger replacement.
string
reference to the asset to be linked to
type This property is required. string
[String|Boolean|Number] type of the data to be ingested in this attribute
name string
name of the resource
unit Changes to this property will trigger replacement. string
optional reference to the unit of the measure
asset
This property is required.
Changes to this property will trigger replacement.
str
reference to the asset to be linked to
type This property is required. str
[String|Boolean|Number] type of the data to be ingested in this attribute
name str
name of the resource
unit Changes to this property will trigger replacement. str
optional reference to the unit of the measure
asset
This property is required.
Changes to this property will trigger replacement.
String
reference to the asset to be linked to
type This property is required. String
[String|Boolean|Number] type of the data to be ingested in this attribute
name String
name of the resource
unit Changes to this property will trigger replacement. String
optional reference to the unit of the measure

Outputs

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

Get an existing AssetAttribute 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?: AssetAttributeState, opts?: CustomResourceOptions): AssetAttribute
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        asset: Optional[str] = None,
        name: Optional[str] = None,
        type: Optional[str] = None,
        unit: Optional[str] = None) -> AssetAttribute
func GetAssetAttribute(ctx *Context, name string, id IDInput, state *AssetAttributeState, opts ...ResourceOption) (*AssetAttribute, error)
public static AssetAttribute Get(string name, Input<string> id, AssetAttributeState? state, CustomResourceOptions? opts = null)
public static AssetAttribute get(String name, Output<String> id, AssetAttributeState state, CustomResourceOptions options)
resources:  _:    type: splight:AssetAttribute    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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:
Asset Changes to this property will trigger replacement. string
reference to the asset to be linked to
Name string
name of the resource
Type string
[String|Boolean|Number] type of the data to be ingested in this attribute
Unit Changes to this property will trigger replacement. string
optional reference to the unit of the measure
Asset Changes to this property will trigger replacement. string
reference to the asset to be linked to
Name string
name of the resource
Type string
[String|Boolean|Number] type of the data to be ingested in this attribute
Unit Changes to this property will trigger replacement. string
optional reference to the unit of the measure
asset Changes to this property will trigger replacement. String
reference to the asset to be linked to
name String
name of the resource
type String
[String|Boolean|Number] type of the data to be ingested in this attribute
unit Changes to this property will trigger replacement. String
optional reference to the unit of the measure
asset Changes to this property will trigger replacement. string
reference to the asset to be linked to
name string
name of the resource
type string
[String|Boolean|Number] type of the data to be ingested in this attribute
unit Changes to this property will trigger replacement. string
optional reference to the unit of the measure
asset Changes to this property will trigger replacement. str
reference to the asset to be linked to
name str
name of the resource
type str
[String|Boolean|Number] type of the data to be ingested in this attribute
unit Changes to this property will trigger replacement. str
optional reference to the unit of the measure
asset Changes to this property will trigger replacement. String
reference to the asset to be linked to
name String
name of the resource
type String
[String|Boolean|Number] type of the data to be ingested in this attribute
unit Changes to this property will trigger replacement. String
optional reference to the unit of the measure

Import

$ pulumi import splight:index/assetAttribute:AssetAttribute [options] splight_asset_attribute.<name> <asset_attribute_id>
Copy

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.