Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Custom Forms Commands #190

Closed
kclinden opened this issue Nov 30, 2018 · 7 comments
Closed

Feature: Custom Forms Commands #190

kclinden opened this issue Nov 30, 2018 · 7 comments
Milestone

Comments

@kclinden
Copy link
Contributor

kclinden commented Nov 30, 2018

I would like to look into adding cmdlets for workings with the form service.

Use Case:
Script exporting forms and importing forms for source control versioning with Git. Forms currently don't have any versioning built-in, and being able to manipulate them programmatically through PowerShell would be awesome.

Examples:
**Get All Forms**
$forms = Get-vRAForm 

**Get A Form by Id or Name**
 Get-vRAForm -Id "0038190d-a213-48c8-97f4-3f2c8dc50cc9"
 Get-vRAForm -Name "Ubuntu-1604"

**Delete A Form by Id or Name**
 Remove-vRAForm -Id "0038190d-a213-48c8-97f4-3f2c8dc50cc9"
 Remove-vRAForm -Name "Ubuntu-1604"

**Create a Form**
 New-vRAForm -Name "New Form" -Parent $parent -tenant "vsphere.local" -Form $json

**Update a Form by Name or Id**
 New-vRAForm -Name "New Form" -Form $json
@kclinden kclinden changed the title Fe Feature: Custom Forms Commands Nov 30, 2018
@jonathanmedd jonathanmedd added this to the Future milestone Dec 21, 2018
@jonathanmedd
Copy link
Contributor

@kclinden Excellent, sounds great. We look forward to seeing what you contribute :-)

@kclinden
Copy link
Contributor Author

kclinden commented Jan 3, 2019

Looks like the API is limited to XaaS forms. I will let you know if I figure any other way to export the custom forms :(

@kclinden
Copy link
Contributor Author

kclinden commented Jan 4, 2019

Found the API to get the forms -
/composition-service/api/blueprints/{blueprintId}/forms/requestform

@kclinden
Copy link
Contributor Author

kclinden commented Jan 7, 2019

First time contributing to another project. I have a file called Get-vRA-CustomForm.ps1 under my clone of your repo. Should I do a branch and commit?

function Get-vRACustomForm {
<#
    .SYNOPSIS
    Retrieve vRA Custom Form for a Blueprint

    .DESCRIPTION
    Retrieve vRA Custom Form for a Blueprint

    .PARAMETER BlueprintId
    Specify the ID of a Blueprint

    .INPUTS
    System.String

    .OUTPUTS
    System.String

    .EXAMPLE
    Get-vRACustomForm -Id "309100fd-b8ce-4e8c-ac8c-a667b8ace54f"

#>
[CmdletBinding(DefaultParameterSetName="Standard")][OutputType('System.Management.Automation.PSObject')]

    Param (

    [parameter(Mandatory=$true,ValueFromPipeline=$true,ParameterSetName="Standard")]
    [ValidateNotNullOrEmpty()]
    [String[]]$Id

    )
        try {

                $URI = "/composition-service/api/blueprints/$($id)/forms/requestform"

                # --- Run vRA REST Request
                $Response = Invoke-vRARestMethod -Method GET -URI $URI
                $CustomForm = $Response.TrimStart('"').TrimEnd('"').Replace('\"','"');
                $CustomForm
                            
        }
        catch [Exception]{

            throw
        }
}

@kclinden
Copy link
Contributor Author

kclinden commented Jan 8, 2019

Need to modify the above code to accept a piped cmdlet of get-vrablueprint.

For example
Get-vRABlueprint -Name RHEL7 | Get-vRACustomForm

@jonathanmedd
Copy link
Contributor

@kclinden Hi. Yes, make a branch in your own repository, then make a pull request against our master branch and we'll review it.

@jonathanmedd jonathanmedd modified the milestones: Future, 3.5.0 Jan 11, 2019
@jonathanmedd
Copy link
Contributor

This feature has been added by @kclinden here: #193

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants