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

splight.AssetMetadata

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 myAssetMetadata = new splight.AssetMetadata("myAssetMetadata", {
    type: "Number",
    unit: "meters",
    value: JSON.stringify(10),
    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_asset_metadata = splight.AssetMetadata("myAssetMetadata",
    type="Number",
    unit="meters",
    value=json.dumps(10),
    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
		}
		tmpJSON1, err := json.Marshal(10)
		if err != nil {
			return err
		}
		json1 := string(tmpJSON1)
		_, err = splight.NewAssetMetadata(ctx, "myAssetMetadata", &splight.AssetMetadataArgs{
			Type:  pulumi.String("Number"),
			Unit:  pulumi.String("meters"),
			Value: pulumi.String(json1),
			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 myAssetMetadata = new Splight.AssetMetadata("myAssetMetadata", new()
    {
        Type = "Number",
        Unit = "meters",
        Value = JsonSerializer.Serialize(10),
        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.AssetMetadata;
import com.pulumi.splight.AssetMetadataArgs;
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 myAssetMetadata = new AssetMetadata("myAssetMetadata", AssetMetadataArgs.builder()
            .type("Number")
            .unit("meters")
            .value(serializeJson(
                10))
            .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
  myAssetMetadata:
    type: splight:AssetMetadata
    properties:
      type: Number
      unit: meters
      value:
        fn::toJSON: 10
      asset: ${myAsset.id}
Copy

Create AssetMetadata Resource

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

Constructor syntax

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

@overload
def AssetMetadata(resource_name: str,
                  opts: Optional[ResourceOptions] = None,
                  asset: Optional[str] = None,
                  type: Optional[str] = None,
                  value: Optional[str] = None,
                  name: Optional[str] = None,
                  unit: Optional[str] = None)
func NewAssetMetadata(ctx *Context, name string, args AssetMetadataArgs, opts ...ResourceOption) (*AssetMetadata, error)
public AssetMetadata(string name, AssetMetadataArgs args, CustomResourceOptions? opts = null)
public AssetMetadata(String name, AssetMetadataArgs args)
public AssetMetadata(String name, AssetMetadataArgs args, CustomResourceOptions options)
type: splight:AssetMetadata
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. AssetMetadataArgs
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. AssetMetadataArgs
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. AssetMetadataArgs
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. AssetMetadataArgs
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. AssetMetadataArgs
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 assetMetadataResource = new Splight.AssetMetadata("assetMetadataResource", new()
{
    Asset = "string",
    Type = "string",
    Value = "string",
    Name = "string",
    Unit = "string",
});
Copy
example, err := splight.NewAssetMetadata(ctx, "assetMetadataResource", &splight.AssetMetadataArgs{
	Asset: pulumi.String("string"),
	Type:  pulumi.String("string"),
	Value: pulumi.String("string"),
	Name:  pulumi.String("string"),
	Unit:  pulumi.String("string"),
})
Copy
var assetMetadataResource = new AssetMetadata("assetMetadataResource", AssetMetadataArgs.builder()
    .asset("string")
    .type("string")
    .value("string")
    .name("string")
    .unit("string")
    .build());
Copy
asset_metadata_resource = splight.AssetMetadata("assetMetadataResource",
    asset="string",
    type="string",
    value="string",
    name="string",
    unit="string")
Copy
const assetMetadataResource = new splight.AssetMetadata("assetMetadataResource", {
    asset: "string",
    type: "string",
    value: "string",
    name: "string",
    unit: "string",
});
Copy
type: splight:AssetMetadata
properties:
    asset: string
    name: string
    type: string
    unit: string
    value: string
Copy

AssetMetadata 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 AssetMetadata 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
Value This property is required. string
metadata value
Name string
name of the resource
Unit 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
Value This property is required. string
metadata value
Name string
name of the resource
Unit 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
value This property is required. String
metadata value
name String
name of the resource
unit 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
value This property is required. string
metadata value
name string
name of the resource
unit 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
value This property is required. str
metadata value
name str
name of the resource
unit 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
value This property is required. String
metadata value
name String
name of the resource
unit String
optional reference to the unit of the measure

Outputs

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

Get an existing AssetMetadata 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?: AssetMetadataState, opts?: CustomResourceOptions): AssetMetadata
@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,
        value: Optional[str] = None) -> AssetMetadata
func GetAssetMetadata(ctx *Context, name string, id IDInput, state *AssetMetadataState, opts ...ResourceOption) (*AssetMetadata, error)
public static AssetMetadata Get(string name, Input<string> id, AssetMetadataState? state, CustomResourceOptions? opts = null)
public static AssetMetadata get(String name, Output<String> id, AssetMetadataState state, CustomResourceOptions options)
resources:  _:    type: splight:AssetMetadata    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 string
optional reference to the unit of the measure
Value string
metadata value
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 string
optional reference to the unit of the measure
Value string
metadata value
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 String
optional reference to the unit of the measure
value String
metadata value
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 string
optional reference to the unit of the measure
value string
metadata value
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 str
optional reference to the unit of the measure
value str
metadata value
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 String
optional reference to the unit of the measure
value String
metadata value

Import

$ pulumi import splight:index/assetMetadata:AssetMetadata [options] splight_asset_metadata.<name> <asset_metadata_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.