# Applicationinstanceproperty

The ApplicationInstanceProperty is an element that adds meaning to the [ApplicationInstance](https://docs.i3d.net/game-hosting/elements/application/applicationinstance) element. These properties are inherited from the [ApplicationBuild](https://docs.i3d.net/game-hosting/elements/application/applicationbuild) element and their values will be populated according to the actual settings of the ApplicationInstance. One cannot add or edit ApplicationInstanceProperties manually.

## Inheritance example

Given that you have the following ApplicationProperty elements with default values for your Application:

| Property type (id)       | Property name | Property default value |
| ------------------------ | ------------- | ---------------------- |
| public network port (1)  | gamePort      | 11000                  |
| private network port (6) | adminPort     | 31000                  |
| password16 (3)           | adminPass     | \<empty>               |

Table 1: ApplicationProperty examples

For an ApplicationInstance these values would be substituted with the actual values used for the instance. These are just an illustration of possible values.

| Property type (id)       | Property name | Property actual value |
| ------------------------ | ------------- | --------------------- |
| public network port (1)  | gamePort      | 11005                 |
| private network port (6) | adminPort     | 30530                 |
| password16 (3)           | adminPass     | d092FuOIAdFGv329      |

Table 2: ApplicationInstanceProperty examples

## Element structure

| Property      | Value type | Required              | Read-only | Description                      |
| ------------- | ---------- | --------------------- | --------- | -------------------------------- |
| propertyId    | string     | N/A                   | Yes       | Unique identifier of the element |
| propertyType  | int        | Yes                   | No        | Type ID of the property          |
| propertyKey   | string     | Yes                   | No        | The name of the property         |
| propertyValue | mixed      | Only for network port | No        | The value of the property        |

Table 3: ApplicationInstanceProperty element structure

## propertyKey constraints

The characters allowed for a propertyKey are : `a-z, 0-9, -, _` A property key must start with a lowercase character.

The maximum length of a propertyKey is 50 characters.

## propertyValue constraints

Any UTF-8 character is allowed in a propertyValue.

The maximum length of a propertyValue is 150 characters.

## propertyType

ApplicationInstanceProperty elements consist of a `propertyType`, a `propertyKey` and a `propertyValue`. The `propertyType` indicates the functionality of the property. The `propertyKey` gives the property a name and the `value` a value. Not all property types require a value. E.g. if you have a property of `propertyType` `password16`, you can leave `propertyValue` empty. This means we will generate a password, in this case with a length of 16 characters. If however you do enter a `propertyValue`, then we take that as the password and the system will not generate a new random password. You can find all available property types and usages in the next chapter.

## Available property types

A propertyType is indicated by a numerical ID. The following types are available:

| ID | Type                       | Value type                      | Value required? | Description                                                                                                                                                                                                                                                                      |
| -- | -------------------------- | ------------------------------- | --------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| 0  | raw value                  | mixed                           | no              | A custom raw value. This property's key and value will be passed to ApplicationBuilds, ApplicationInstances and labels as-is.                                                                                                                                                    |
| 1  | public network port        | A number between: 10240 - 29999 | yes             | Indicates a default public network port for your application. When the system deploys a new ApplicationInstance, it will find a unique network port to use, per host. The default value is taken as the initial value and will be incremented by 50 until a free port is found.  |
| 2  | password8                  | string                          | no              | An 8 character password. If no value provided, we generate a unique password for every ApplicationInstance.                                                                                                                                                                      |
| 3  | password16                 | string                          | no              | A 16 character password. If no value provided, we generate a unique password for every ApplicationInstance.                                                                                                                                                                      |
| 4  | password24                 | string                          | no              | A 24 character password. If no value provided, we generate a unique password for every ApplicationInstance.                                                                                                                                                                      |
| 5  | public network port range  | A number between 2 and 200      | yes             | A number indicating the size of the desired port range.                                                                                                                                                                                                                          |
| 6  | private network port       | A number between: 30000 - 49151 | yes             | Indicates a default private network port for your application. When the system deploys a new ApplicationInstance, it will find a unique network port to use, per host. The default value is taken as the initial value and will be incremented by 50 until a free port is found. |
| 7  | private network port range | A number between 2 and 200      | yes             | A number indicating the size of the desired port range.                                                                                                                                                                                                                          |

Table 4: Property types

## Property inheritance

An ApplicationInstance's properties are inherited from the [ApplicationBuild](https://docs.i3d.net/game-hosting/elements/application/applicationbuild) element it was deployed for.

## Restrictions

ApplicationInstanceProperty elements cannot be added / edited manually. They are always inherited from the [ApplicationBuild](https://docs.i3d.net/game-hosting/elements/application/applicationbuild) element it was deployed for.
