Instance Definition
Introduction
RPS Instance Definition are an abstraction layer on top of existing RPS Types. Types currently allow us to define a specific Type of Resource or Target Item, its expected or possible Properties and their associated value types (string/int/etc.). Instance Definition will allow us to take these generic Types and combine them together to create complex, nested, entities composed of many different Types through Parent/Child�and assignment relationships, and the known default values for each individual Types' properties.
Examples: SNEs, TCNs, TSI-Large, laptop, could be a VM (because it could be a collection of components)
Why RPS Instance Definition?
We have defined many existing Types such as Vehicle, Computer, VirtualMachine, NetworkConfiguration, and so on. The entities we are now interacting with though are complex and composed of many of these Types in Parent/Child hierarchies. Instance Definitions are collections of Type Definitions, that have the ability to create an object. Type Definitions are parts with detailed properties. They do not create objects, but they are able to define something you can create which is what an object will consist of.
Example: Virtual Machine, NIC, drive, etc.
Note
The word Instance Definition is formerly known as 'Templates'.
Creating an Instance Definition
Creates a new Instance Definition.
New-RpsInstanceDefinition -Name testName
Creates a new Instance Definition with Properties.
$hs = @{
Prop1 = "value1"
Prop2 = "value2"
}
New-RpsInstanceDefinition -Name testName -Properties $hs
Creates a new Instance Definition with Properties and a parent Node
$nodeId = "81B8272D-B49C-4350-A8F4-ABBB9CE29C68"
$hs = @{
Prop1 = "value1"
Prop2 = "value2"
}
New-RpsInstanceDefinition -Name testName -Properties $hs -ParentNodeId $nodeId
Creates a new Instance Definition with Virtual Machine and Network Configuration.
$vmTypeDef = Get-RpsResourceItem -Name VirtualMachine -Type RpsTargetType
$nicTypeDef = Get-RpsResourceItem -Name NetworkConfiguration -Type RpsTargetType
$credentialTypeDef = Get-RpsResourceItem -Name Credential -Type RpsResourceType
$vmAdServer = New-RpsInstanceDefinitionItem -EntityName "Ad.[^DomainName]" -Name AdServer -TypeDefinition $vmTypeDef -Properties @{
� � JoinDomain = $false
� � ComputerName = 'AD'
� � DnsZone = '[^DomainName]'
� � OSType = 'Windows'
� � OSVersion = '8.1'
� � MemoryMB = 1024
� � IsDC = $true
}
$vmAppServer = New-RpsInstanceDefinitionItem -EntityName "App.[^DomainName]" -Name AppServer -TypeDefinition $vmTypeDef -Properties @{
� � JoinDomain = $true
� � ComputerName = 'APP'
� � DnsZone = '[^DomainName]'
� � OSType = 'Windows'
� � OSVersion = '8.1'
� � MemoryMB = 2048
� � IsCDN = $true
� � IsDB = $true
� � IsSMA = $true
}
$nicVlan996 = New-RpsInstanceDefinitionItem -EntityName "[^ParentName]-Vlan996" -Name Nic-Vlan996 -TypeDefinition $nicTypeDef -Properties @{
� � Primary = $true
� � VlanId = 996
� � NetworkCategory = 'DomainAuthenticated'
}
$credentialRpsAdmin = New-RpsInstanceDefinitionItem -EntityName "[^DomainPrefix]_RpsAdmin" -Name Credential_RpsAdmin -TypeDefinition $credentialTypeDef -Properties @{
� � UserName = '[^DomainPrefix]\RpsAdmin'
� � Role = 'ServerAdmin'
� � IsLocal = $false
� � CreateAccount = $true
� � PasswordNeverExpires = $false
}
$instanceDefinition = New-RpsInstanceDefinition -Name Vehicle -Properties @{DomainName = 'RequiredValue'; DomainPrefix = 'RequiredValue'}
New-RpsInstanceDefinitionReference -Name Vehicle_AppServer -InstanceDefinition $instanceDefinition -InstanceDefinitionItem $vmAppServer
New-RpsInstanceDefinitionReference -Name Vehicle_AppServer -InstanceDefinition $instanceDefinition -InstanceDefinitionItem $vmAdServer
New-RpsInstanceDefinitionReference -Name Vehicle_AppServer -InstanceDefinition $instanceDefinition -InstanceDefinitionItem $nicVlan996 -ParentItem $vmAppServer
New-RpsInstanceDefinitionReference -Name Vehicle_AppServer -InstanceDefinition $instanceDefinition -InstanceDefinitionItem $nicVlan996 -ParentItem $vmAdServer
New-RpsInstanceDefinitionReference -Name Vehicle_AppServer -InstanceDefinition $instanceDefinition -InstanceDefinitionItem $credentialRpsAdmin
New-RpsInstanceDefinitionReference -Name Vehicle_AppServer -InstanceDefinition $instanceDefinition -InstanceDefinitionItem $credentialRpsAdmin -ParentItem $vmAppServer
New-RpsInstanceDefinitionReference -Name Vehicle_AppServer -InstanceDefinition $instanceDefinition -InstanceDefinitionItem $credentialRpsAdmin -ParentItem $vmAdServer
$settingsResourceItem = New-RpsResourceItem -Type Settings -Name UnitASettings -Properties @{
� � DomainName = 'Master.Rps'
� � DomainPrefix = 'Master'
}
Invoke-RpsInstanceDefinition -InstanceDefinition $instanceDefinition -settings $settingsResourceItem
Getting an Instance Definition
Gets an instance definition by Id.
Get-RpsInstanceDefinition -Id $lookupId
Setting an Instance Definition
Creates or Updates instance definition.
$instanceDef = Set-RpsInstanceDefinition -Name "MyInstanceDef" -Properties @{Prop1 = "Value1"} -ParentNodeId $nodeId
Invoking an Instance Definition
Creates instances based on the Instance Definition using a resource item to hold its settings.
$settings = Get-RpsResourceItem -Id $guid
Invoke-RpsInstanceDefinition -settings $settings
Glossary
| Term | Definition |
|---|---|
| Instance Definition | The abstraction layer on top of existing RPS Types. |
| Instance Definition Reference | The assignment of the instance definition to a root Resource Item, which results in a set of one or more Resource Items to be run. |
| Instance Definition Item | The an item on the abstraction layer on top of existing RPS Types. |
| Instance Definition Node | A node item that will result in association of a node with target items that are created when an Instance Definition is invoked |