Method: Aws::IoTTwinMaker::Client#create_entity

Defined in:
lib/aws-sdk-iottwinmaker/client.rb

#create_entity(params = {}) ⇒ Types::CreateEntityResponse

Creates an entity.

Examples:

Request syntax with placeholder values


resp = client.create_entity({
  workspace_id: "Id", # required
  entity_id: "EntityId",
  entity_name: "EntityName", # required
  description: "Description",
  components: {
    "Name" => {
      description: "Description",
      component_type_id: "ComponentTypeId",
      properties: {
        "Name" => {
          definition: {
            data_type: {
              type: "RELATIONSHIP", # required, accepts RELATIONSHIP, STRING, LONG, BOOLEAN, INTEGER, DOUBLE, LIST, MAP
              nested_type: {
                # recursive DataType
              },
              allowed_values: [
                {
                  boolean_value: false,
                  double_value: 1.0,
                  integer_value: 1,
                  long_value: 1,
                  string_value: "String",
                  list_value: {
                    # recursive DataValueList
                  },
                  map_value: {
                    "String" => {
                      # recursive DataValue
                    },
                  },
                  relationship_value: {
                    target_entity_id: "EntityId",
                    target_component_name: "Name",
                  },
                  expression: "Expression",
                },
              ],
              unit_of_measure: "String",
              relationship: {
                target_component_type_id: "ComponentTypeId",
                relationship_type: "String",
              },
            },
            is_required_in_entity: false,
            is_external_id: false,
            is_stored_externally: false,
            is_time_series: false,
            default_value: {
              boolean_value: false,
              double_value: 1.0,
              integer_value: 1,
              long_value: 1,
              string_value: "String",
              list_value: [
                {
                  # recursive DataValue
                },
              ],
              map_value: {
                "String" => {
                  # recursive DataValue
                },
              },
              relationship_value: {
                target_entity_id: "EntityId",
                target_component_name: "Name",
              },
              expression: "Expression",
            },
            configuration: {
              "Name" => "Value",
            },
            display_name: "PropertyDisplayName",
          },
          value: {
            boolean_value: false,
            double_value: 1.0,
            integer_value: 1,
            long_value: 1,
            string_value: "String",
            list_value: [
              {
                # recursive DataValue
              },
            ],
            map_value: {
              "String" => {
                # recursive DataValue
              },
            },
            relationship_value: {
              target_entity_id: "EntityId",
              target_component_name: "Name",
            },
            expression: "Expression",
          },
          update_type: "UPDATE", # accepts UPDATE, DELETE, CREATE, RESET_VALUE
        },
      },
      property_groups: {
        "Name" => {
          group_type: "TABULAR", # accepts TABULAR
          property_names: ["Name"],
          update_type: "UPDATE", # accepts UPDATE, DELETE, CREATE
        },
      },
    },
  },
  composite_components: {
    "ComponentPath" => {
      description: "Description",
      properties: {
        "Name" => {
          definition: {
            data_type: {
              type: "RELATIONSHIP", # required, accepts RELATIONSHIP, STRING, LONG, BOOLEAN, INTEGER, DOUBLE, LIST, MAP
              nested_type: {
                # recursive DataType
              },
              allowed_values: [
                {
                  boolean_value: false,
                  double_value: 1.0,
                  integer_value: 1,
                  long_value: 1,
                  string_value: "String",
                  list_value: {
                    # recursive DataValueList
                  },
                  map_value: {
                    "String" => {
                      # recursive DataValue
                    },
                  },
                  relationship_value: {
                    target_entity_id: "EntityId",
                    target_component_name: "Name",
                  },
                  expression: "Expression",
                },
              ],
              unit_of_measure: "String",
              relationship: {
                target_component_type_id: "ComponentTypeId",
                relationship_type: "String",
              },
            },
            is_required_in_entity: false,
            is_external_id: false,
            is_stored_externally: false,
            is_time_series: false,
            default_value: {
              boolean_value: false,
              double_value: 1.0,
              integer_value: 1,
              long_value: 1,
              string_value: "String",
              list_value: [
                {
                  # recursive DataValue
                },
              ],
              map_value: {
                "String" => {
                  # recursive DataValue
                },
              },
              relationship_value: {
                target_entity_id: "EntityId",
                target_component_name: "Name",
              },
              expression: "Expression",
            },
            configuration: {
              "Name" => "Value",
            },
            display_name: "PropertyDisplayName",
          },
          value: {
            boolean_value: false,
            double_value: 1.0,
            integer_value: 1,
            long_value: 1,
            string_value: "String",
            list_value: [
              {
                # recursive DataValue
              },
            ],
            map_value: {
              "String" => {
                # recursive DataValue
              },
            },
            relationship_value: {
              target_entity_id: "EntityId",
              target_component_name: "Name",
            },
            expression: "Expression",
          },
          update_type: "UPDATE", # accepts UPDATE, DELETE, CREATE, RESET_VALUE
        },
      },
      property_groups: {
        "Name" => {
          group_type: "TABULAR", # accepts TABULAR
          property_names: ["Name"],
          update_type: "UPDATE", # accepts UPDATE, DELETE, CREATE
        },
      },
    },
  },
  parent_entity_id: "ParentEntityId",
  tags: {
    "TagKey" => "TagValue",
  },
})

Response structure


resp.entity_id #=> String
resp.arn #=> String
resp.creation_date_time #=> Time
resp.state #=> String, one of "CREATING", "UPDATING", "DELETING", "ACTIVE", "ERROR"

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :workspace_id (required, String)

    The ID of the workspace that contains the entity.

  • :entity_id (String)

    The ID of the entity.

  • :entity_name (required, String)

    The name of the entity.

  • :description (String)

    The description of the entity.

  • :components (Hash<String,Types::ComponentRequest>)

    An object that maps strings to the components in the entity. Each string in the mapping must be unique to this object.

  • :composite_components (Hash<String,Types::CompositeComponentRequest>)

    This is an object that maps strings to compositeComponent updates in the request. Each key of the map represents the componentPath of the compositeComponent.

  • :parent_entity_id (String)

    The ID of the entity’s parent entity.

  • :tags (Hash<String,String>)

    Metadata that you can use to manage the entity.

Returns:



1044
1045
1046
1047
# File 'lib/aws-sdk-iottwinmaker/client.rb', line 1044

def create_entity(params = {}, options = {})
  req = build_request(:create_entity, params)
  req.send_request(options)
end