diff --git a/_posts/2024-03-07-vro-how-to-ssh.md b/_posts/2024-03-07-vro-how-to-ssh.md index caa1d24..62a6427 100644 --- a/_posts/2024-03-07-vro-how-to-ssh.md +++ b/_posts/2024-03-07-vro-how-to-ssh.md @@ -176,4 +176,4 @@ const example = new SSH() ## Source code -The source code can be found [here](https://github.com/unbreakabl3/vmware_aria_orchestrator_examples/tree/main/general_examples) +The source code with the unit tests can be found [here](https://github.com/unbreakabl3/vmware_aria_orchestrator_examples/tree/main/general_examples) diff --git a/_posts/2024-03-14-vro-configuration-element-how-to.md b/_posts/2024-03-14-vro-configuration-element-how-to.md index 8c6987c..441a0b6 100644 --- a/_posts/2024-03-14-vro-configuration-element-how-to.md +++ b/_posts/2024-03-14-vro-configuration-element-how-to.md @@ -205,4 +205,4 @@ I think the results of the tests should be enough. The tests themself can be fou ## Source Code -The source code can be found [here](https://github.com/unbreakabl3/vmware_aria_orchestrator_examples/tree/main/general_examples) +The source code with the unit tests can be found [here](https://github.com/unbreakabl3/vmware_aria_orchestrator_examples/tree/main/general_examples) diff --git a/_posts/2024-03-30-vro-how-to-use-external-validations.md b/_posts/2024-03-30-vro-how-to-use-external-validations.md index 5218eb5..c3afd43 100644 --- a/_posts/2024-03-30-vro-how-to-use-external-validations.md +++ b/_posts/2024-03-30-vro-how-to-use-external-validations.md @@ -108,4 +108,4 @@ The external validation can significantly reduce the risk of errors, improve the ## Source Code -The source code can be found [here](https://github.com/unbreakabl3/vmware_aria_orchestrator_examples/blob/main/general_examples/src/actions/external_validation/validateVM.ts). +The source code with the unit tests can be found [here](https://github.com/unbreakabl3/vmware_aria_orchestrator_examples/blob/main/general_examples/src/actions/external_validation/validateVM.ts). diff --git a/_posts/2024-04-12-vro-how-to-delete-deployed-resource-automatically-part1.md b/_posts/2024-04-12-vro-how-to-delete-deployed-resource-automatically-part1.md index f0f581f..4936180 100644 --- a/_posts/2024-04-12-vro-how-to-delete-deployed-resource-automatically-part1.md +++ b/_posts/2024-04-12-vro-how-to-delete-deployed-resource-automatically-part1.md @@ -205,4 +205,4 @@ In part two, we will talk about the Custom Form - how to make it more beautiful ## Source Code -The source code can be found [here](https://github.com/unbreakabl3/vmware_aria_orchestrator_examples/tree/main/poc_example) +The source code with the unit tests can be found [here](https://github.com/unbreakabl3/vmware_aria_orchestrator_examples/tree/main/poc_example) diff --git a/_posts/2024-04-19-vro-how-to-delete-deployed-resource-automatically-part2.md b/_posts/2024-04-19-vro-how-to-delete-deployed-resource-automatically-part2.md new file mode 100644 index 0000000..d08cd70 --- /dev/null +++ b/_posts/2024-04-19-vro-how-to-delete-deployed-resource-automatically-part2.md @@ -0,0 +1,124 @@ +--- +layout: post +title: How to delete deployed resource automatically with VMware Aria Orchestrator - part 2 +date: "2024-04-19" +img_path: /assets/img/vro-how-to-delete-deployed-resource-automatically-part2/ +categories: [VMware, Build Tools, Aria Orchestrator, How To, vRO] +tags: [vmware, building_tools] +--- + +## Custom Form + +Aria Build Tools allows us to create a custom form using the JSON file. +>Ensure the JSON file's name is the same as the workflow. We can create multiple workflows with their custom forms inside the same projects using this pattern. For example: *workflow1.wf.ts will always come with workflows1.wf.form.json and workflow2.fw.ts will come with workflow2.wf.form.json* +{: .prompt-info} + +The custom form must have the following structure: + +![Image](20aad31d-b730-4936-95f1-e3a89c636e5f.png){: .shadow }{: .normal }{: width="300" height="200" } + +It may be complicated to create a custom form from scratch without knowing which keys, values, and structure it's expected to be. Fortunately, there is an excellent way, at least for the beginning - to create and customize a custom form in vRO's GUI as we want, export it, and paste it into our JSON. Since then, this JSON can be tracked in GIT and quickly restored in case some changes were made by mistake via the vRO's GUI. + +### Design custom form in vRO + +Open our POC Example workflow in vRO. The expected outcome should be as follows. + +![Image](a90e4261-7ed9-45bb-9cb5-70f894351823.png){: .shadow }{: .normal } + +Now, lets customize each one of the inputs. + +![Image](7f3bd863-5ead-41c3-b0e9-9e1c05647105.png){: .shadow }{: .normal } + +We want to show some inputs only if the "Is POC?" checkbox is checked. + +![Image](22789b8d-fd1a-4bbf-af0f-1f89adc5de17.png){: .shadow }{: .normal } + +We set the decommission delay to Read-Only because this is our minimum graceful period, and users should not change it. + +![Image](a4a470bf-3780-4107-99f3-197ae47dd770.png){: .shadow }{: .normal } + +![Image](742fef22-fbb1-49c5-ac58-604deb0d9bc9.png){: .shadow }{: .normal } + +>As we can see, the input fields we set as required in the workflow file was indeed marked as required. +> ![Image](0a301f04-5582-432e-a4f3-6a2caa74af22.png){: .shadow }{: .normal } +{: .prompt-info} + +Save the changes and test the behavior. + +![Image](F2B71A48-1B0F-41D3-9E32-3E2A4FD47F59.gif){: .shadow }{: .normal } + +### Export custom form configuration + +After making changes, we can export them as YAML by going to Workflow > Version History and collapse the fields. The result is nearly identical to what we expect. + +![Image](e7472a56-91f9-4b1d-af45-480d0432c96b.png){: .shadow }{: .normal } + +Copy everything between *inputForms*  and *workflowSchema*. Convert YAML to JSON using any available tool and save it into *poc.wf.form.json*. + +### External Validation + +I always strive to create solutions that are as error-free as possible, anticipating any possible user mistakes in advance. For instance, in our current scenario, one of the errors a user could make is to input an invalid decommission date that has already passed. To prevent this, we can create an external validation action that verifies the provided date against the current date. If the date is in the past, we can issue a clear and easy-to-understand warning message to the user. + +To the VSCode! + +#### Write a function + +We need to create a simple function that takes a date from the user and compares it to the current date. + +```typescript +/** + * Checks if the provided date is not in the past + * + * @param {Date} providedDate - The name of the virtual machine to check. + * @returns {string} - An error message if the provided date is in the past + */ +(function validateDecommissionDate(providedDate: Date) { + const dateTime = new Date(); + if (providedDate <= dateTime) { + return `Provided decommission date cannot be in the past`; + } +}); +``` + +Push the package with a new function to vRO and confirm the result. + +```shell +mvn -T 10C clean install vrealize:push -Pvro01 +``` + +![Image](a8f295ca-96a3-479e-b88c-422f138e6ba5.png){: .shadow }{: .normal } + +#### Configure External Validation + +Open the workflow and create new validation using our new function *validateDecommissionDate*. +>We can highlight specific files if the error occurs. This can be a handy UI tip, which can help users identify where exactly the problem is, especially if there are many inputs. +{: .prompt-tip} + +![Image](9876c44a-5df4-4131-9834-0c01e3e299c7.png){: .shadow }{: .normal } + +#### Run the test + +Pick up any date in the past. Vivia, we got an error with an exact error description we wrote, and the proper field is highlighted with a bold red line. +![Image](84dbdd09-db58-4bd2-8b03-2ae320bfb2a8.png){: .shadow }{: .normal } + +#### Update the custom form JSON + +After implementing the validation, we had to modify our custom form JSON to avoid overwriting the changes made through the GUI during the next package push. To accomplish this, we should check the workflow Version History to identify what has changed since our last modification. Luckily, the vRO GUI allows us to perform this task quickly. We can see the configuration on the left side before we added the validation and on the right side after. + +![Image](18a12fb8-75a0-4f7f-9cf4-0954897c4fdd.png){: .shadow }{: .normal } + +As we can see, we have an updated section on the right called *options*, which now has values (is empty by default). 'Options' - is the name of the External Validation in the vRBT. + + The rest of the process is the same - copy, convert from YAML to JSON, and paste into the *poc.wf.form.json*. + +### Summary + +In today's session, we focused on enhancing the quality and reliability of our workflow. Specifically, we delved into External Validation, which helped us achieve a more aesthetically pleasing and error-free outcome. + +### Next step + +In part three, we will try to see how to achieve similar functionality in Aria Automation. + +## Source Code + +The source code with the unit tests can be found [here](https://github.com/unbreakabl3/vmware_aria_orchestrator_examples/tree/main/poc_example) diff --git a/assets/img/vro-how-to-delete-deployed-resource-automatically-part2/0a301f04-5582-432e-a4f3-6a2caa74af22.png b/assets/img/vro-how-to-delete-deployed-resource-automatically-part2/0a301f04-5582-432e-a4f3-6a2caa74af22.png new file mode 100644 index 0000000..89ca495 Binary files /dev/null and b/assets/img/vro-how-to-delete-deployed-resource-automatically-part2/0a301f04-5582-432e-a4f3-6a2caa74af22.png differ diff --git a/assets/img/vro-how-to-delete-deployed-resource-automatically-part2/18a12fb8-75a0-4f7f-9cf4-0954897c4fdd.png b/assets/img/vro-how-to-delete-deployed-resource-automatically-part2/18a12fb8-75a0-4f7f-9cf4-0954897c4fdd.png new file mode 100644 index 0000000..5754917 Binary files /dev/null and b/assets/img/vro-how-to-delete-deployed-resource-automatically-part2/18a12fb8-75a0-4f7f-9cf4-0954897c4fdd.png differ diff --git a/assets/img/vro-how-to-delete-deployed-resource-automatically-part2/20aad31d-b730-4936-95f1-e3a89c636e5f.png b/assets/img/vro-how-to-delete-deployed-resource-automatically-part2/20aad31d-b730-4936-95f1-e3a89c636e5f.png new file mode 100644 index 0000000..a936e63 Binary files /dev/null and b/assets/img/vro-how-to-delete-deployed-resource-automatically-part2/20aad31d-b730-4936-95f1-e3a89c636e5f.png differ diff --git a/assets/img/vro-how-to-delete-deployed-resource-automatically-part2/22789b8d-fd1a-4bbf-af0f-1f89adc5de17.png b/assets/img/vro-how-to-delete-deployed-resource-automatically-part2/22789b8d-fd1a-4bbf-af0f-1f89adc5de17.png new file mode 100644 index 0000000..bc04dc3 Binary files /dev/null and b/assets/img/vro-how-to-delete-deployed-resource-automatically-part2/22789b8d-fd1a-4bbf-af0f-1f89adc5de17.png differ diff --git a/assets/img/vro-how-to-delete-deployed-resource-automatically-part2/742fef22-fbb1-49c5-ac58-604deb0d9bc9.png b/assets/img/vro-how-to-delete-deployed-resource-automatically-part2/742fef22-fbb1-49c5-ac58-604deb0d9bc9.png new file mode 100644 index 0000000..974461b Binary files /dev/null and b/assets/img/vro-how-to-delete-deployed-resource-automatically-part2/742fef22-fbb1-49c5-ac58-604deb0d9bc9.png differ diff --git a/assets/img/vro-how-to-delete-deployed-resource-automatically-part2/7e75209b-ba37-4345-ace0-92772f96e3c6.png b/assets/img/vro-how-to-delete-deployed-resource-automatically-part2/7e75209b-ba37-4345-ace0-92772f96e3c6.png new file mode 100644 index 0000000..ea2b8a8 Binary files /dev/null and b/assets/img/vro-how-to-delete-deployed-resource-automatically-part2/7e75209b-ba37-4345-ace0-92772f96e3c6.png differ diff --git a/assets/img/vro-how-to-delete-deployed-resource-automatically-part2/7f3bd863-5ead-41c3-b0e9-9e1c05647105.png b/assets/img/vro-how-to-delete-deployed-resource-automatically-part2/7f3bd863-5ead-41c3-b0e9-9e1c05647105.png new file mode 100644 index 0000000..df69883 Binary files /dev/null and b/assets/img/vro-how-to-delete-deployed-resource-automatically-part2/7f3bd863-5ead-41c3-b0e9-9e1c05647105.png differ diff --git a/assets/img/vro-how-to-delete-deployed-resource-automatically-part2/84dbdd09-db58-4bd2-8b03-2ae320bfb2a8.png b/assets/img/vro-how-to-delete-deployed-resource-automatically-part2/84dbdd09-db58-4bd2-8b03-2ae320bfb2a8.png new file mode 100644 index 0000000..e05113f Binary files /dev/null and b/assets/img/vro-how-to-delete-deployed-resource-automatically-part2/84dbdd09-db58-4bd2-8b03-2ae320bfb2a8.png differ diff --git a/assets/img/vro-how-to-delete-deployed-resource-automatically-part2/9876c44a-5df4-4131-9834-0c01e3e299c7.png b/assets/img/vro-how-to-delete-deployed-resource-automatically-part2/9876c44a-5df4-4131-9834-0c01e3e299c7.png new file mode 100644 index 0000000..0b27c9f Binary files /dev/null and b/assets/img/vro-how-to-delete-deployed-resource-automatically-part2/9876c44a-5df4-4131-9834-0c01e3e299c7.png differ diff --git a/assets/img/vro-how-to-delete-deployed-resource-automatically-part2/F2B71A48-1B0F-41D3-9E32-3E2A4FD47F58.mov b/assets/img/vro-how-to-delete-deployed-resource-automatically-part2/F2B71A48-1B0F-41D3-9E32-3E2A4FD47F58.mov new file mode 100644 index 0000000..47de029 Binary files /dev/null and b/assets/img/vro-how-to-delete-deployed-resource-automatically-part2/F2B71A48-1B0F-41D3-9E32-3E2A4FD47F58.mov differ diff --git a/assets/img/vro-how-to-delete-deployed-resource-automatically-part2/F2B71A48-1B0F-41D3-9E32-3E2A4FD47F59.gif b/assets/img/vro-how-to-delete-deployed-resource-automatically-part2/F2B71A48-1B0F-41D3-9E32-3E2A4FD47F59.gif new file mode 100644 index 0000000..1503d47 Binary files /dev/null and b/assets/img/vro-how-to-delete-deployed-resource-automatically-part2/F2B71A48-1B0F-41D3-9E32-3E2A4FD47F59.gif differ diff --git a/assets/img/vro-how-to-delete-deployed-resource-automatically-part2/a4a470bf-3780-4107-99f3-197ae47dd770.png b/assets/img/vro-how-to-delete-deployed-resource-automatically-part2/a4a470bf-3780-4107-99f3-197ae47dd770.png new file mode 100644 index 0000000..8ef1a23 Binary files /dev/null and b/assets/img/vro-how-to-delete-deployed-resource-automatically-part2/a4a470bf-3780-4107-99f3-197ae47dd770.png differ diff --git a/assets/img/vro-how-to-delete-deployed-resource-automatically-part2/a8f295ca-96a3-479e-b88c-422f138e6ba5.png b/assets/img/vro-how-to-delete-deployed-resource-automatically-part2/a8f295ca-96a3-479e-b88c-422f138e6ba5.png new file mode 100644 index 0000000..9ecbb88 Binary files /dev/null and b/assets/img/vro-how-to-delete-deployed-resource-automatically-part2/a8f295ca-96a3-479e-b88c-422f138e6ba5.png differ diff --git a/assets/img/vro-how-to-delete-deployed-resource-automatically-part2/a90e4261-7ed9-45bb-9cb5-70f894351823.png b/assets/img/vro-how-to-delete-deployed-resource-automatically-part2/a90e4261-7ed9-45bb-9cb5-70f894351823.png new file mode 100644 index 0000000..2f31806 Binary files /dev/null and b/assets/img/vro-how-to-delete-deployed-resource-automatically-part2/a90e4261-7ed9-45bb-9cb5-70f894351823.png differ diff --git a/assets/img/vro-how-to-delete-deployed-resource-automatically-part2/e7472a56-91f9-4b1d-af45-480d0432c96b.png b/assets/img/vro-how-to-delete-deployed-resource-automatically-part2/e7472a56-91f9-4b1d-af45-480d0432c96b.png new file mode 100644 index 0000000..d9e322d Binary files /dev/null and b/assets/img/vro-how-to-delete-deployed-resource-automatically-part2/e7472a56-91f9-4b1d-af45-480d0432c96b.png differ