Search Results for

    Show / Hide Table of Contents

    Introduction to RPS Instance Definitions

    Last updated on May 12, 2021.

    Last Reviewed and Approved on PENDING REVIEW

    Introduction

    RPS Instance Definitions 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 Definitions 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)

    Instance Definition Fundamentals

    Instance Definition Reference

    RPS Instance Definition Reference is 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. This is also referred to as an "Instance Definition". The Instance Definition Reference classes are able to create assignments between all of the items in the hierarchy and are able to invoke everything that is not at the top Instance Definition level.

    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 individual parts that define the properties of an object; however, they do not create an object on their own.

    Example: Virtual Machine, NIC, drive, etc.

    Note

    The word Instance Definition is formerly known as 'Templates'.

    Instance Definition Terms and Definitions

    • 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 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.

    Instance Definition PowerShell Cmdlets

    Getting an Instance Definition

    Gets an Instance Definition by Id.

    Get-RpsInstanceDefinition -Id $lookupId
    

    Setting an Instance Definition

    Creates or Updates an 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
    

    Creating an Instance Definition

    Creates a new Instance Definition.

    New-RpsInstanceDefinition -Name testName 
    

    Creating a New Instance Definition With Properties

    $hs = @{
        Prop1 = "value1"
        Prop2 = "value2"
    }
    New-RpsInstanceDefinition -Name testName -Properties $hs 
    

    Creating 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
    

    Creating 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
        IsTms = $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
    

    More Resources

    • RPS Instance Definition Item
    • RPS Instance Definition Node
    In This Article
    Back to top Generated by DocFX