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

Add VDC Template support #686

Merged
merged 39 commits into from
Jun 20, 2024
Merged

Conversation

adambarreiro
Copy link
Collaborator

@adambarreiro adambarreiro commented Jun 13, 2024

Overview

This PR adds support for VDC Templates with CRUD methods, Access level methods and an instantiation method.

Description

A VDC Template is a System administrator feature that can make VDC creation easier, by defining how the VDCs should look like in terms of configuration. The templates can then be published to tenants, or remain in the System administrator realm if not published. The published tenants can then be instantiated by either Organizations (inside of it, in Libraries) or in the System org.

Methods

The new file vcd_template.go contains several new methods:

  • CRUD methods: VCDClient.CreateVdcTemplate, VdcTemplate.Update, VCDClient.GetVdcTemplateById, VCDClient.GetVdcTemplateByName, VdcTemplate.Delete
  • Access level methods: VdcTemplate.SetAccessControl, VdcTemplate.GetAccessControl
  • Instantiation method: VdcTemplate.InstantiateVdc
  • Query methods: VDCClient.QueryAdminVdcTemplates, Org.QueryVdcTemplates

Binding IDs

There's this odd concept from VMWVdcTemplate.[]ProviderVdcReference.[]Binding that is worth mentioning, specially when the new methods are consumed from the Terraform Provider

A Binding looks like:

type VMWVdcTemplateBinding struct {
	Name  string
	Value *Reference
}

To understand it easily, a Binding.Name represents a "field" (or an "option") in the Provider VDC configuration of the VDC Template, for example "External network", "Gateway Edge cluster" or "Service Edge cluster". In UI, these options are visible drop-down menus for the users to select. Then, the Binding.Value represents the value of that field. In UI, this would be the selected value.

The Binding.Name must be generated on our own, and looks like urn:vcloud:binding:.....

With this information, we can understand that, given many Provider VDCs in the VDC Template, each one of them share the same Binding.Name (the same sections, eg: "External network"), but differ in values.

Summary:

Binding.Name is an self-generated UUID that replaces a human readable field (eg: "External network") with a generic URN (urn:vcloud:binding:....). Binding.Value is the value for that field/option.

Quirks

The XML flavor of the /admin/extension/vdcTemplate doesn't work, as it fails to marshal the VMWVdcTemplate structure, hence JSON is used. For that reason, all relevant types and fields now have a mapping to JSON.

Signed-off-by: abarreiro <abarreiro@vmware.com>
Signed-off-by: abarreiro <abarreiro@vmware.com>
Signed-off-by: abarreiro <abarreiro@vmware.com>
Signed-off-by: abarreiro <abarreiro@vmware.com>
Signed-off-by: abarreiro <abarreiro@vmware.com>
Signed-off-by: abarreiro <abarreiro@vmware.com>
Signed-off-by: abarreiro <abarreiro@vmware.com>
Signed-off-by: abarreiro <abarreiro@vmware.com>
Signed-off-by: abarreiro <abarreiro@vmware.com>
Signed-off-by: abarreiro <abarreiro@vmware.com>
Signed-off-by: abarreiro <abarreiro@vmware.com>
Signed-off-by: abarreiro <abarreiro@vmware.com>
Signed-off-by: abarreiro <abarreiro@vmware.com>
#
Signed-off-by: abarreiro <abarreiro@vmware.com>
Signed-off-by: abarreiro <abarreiro@vmware.com>
@adambarreiro adambarreiro marked this pull request as ready for review June 13, 2024 13:41
Signed-off-by: abarreiro <abarreiro@vmware.com>
Signed-off-by: abarreiro <abarreiro@vmware.com>
Signed-off-by: abarreiro <abarreiro@vmware.com>
Signed-off-by: abarreiro <abarreiro@vmware.com>
#
Signed-off-by: abarreiro <abarreiro@vmware.com>
#
Signed-off-by: abarreiro <abarreiro@vmware.com>
Signed-off-by: abarreiro <abarreiro@vmware.com>
#
Signed-off-by: abarreiro <abarreiro@vmware.com>
Signed-off-by: abarreiro <abarreiro@vmware.com>
Signed-off-by: abarreiro <abarreiro@vmware.com>
Signed-off-by: abarreiro <abarreiro@vmware.com>
govcd/vdc_template.go Outdated Show resolved Hide resolved
Signed-off-by: abarreiro <abarreiro@vmware.com>
Signed-off-by: abarreiro <abarreiro@vmware.com>
Signed-off-by: abarreiro <abarreiro@vmware.com>
Copy link
Collaborator

@lvirbalas lvirbalas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couple inline comments and looks good!

govcd/vdc_template.go Outdated Show resolved Hide resolved
types/v56/types.go Outdated Show resolved Hide resolved
Signed-off-by: abarreiro <abarreiro@vmware.com>
#
Signed-off-by: abarreiro <abarreiro@vmware.com>
#
Signed-off-by: abarreiro <abarreiro@vmware.com>
Signed-off-by: abarreiro <abarreiro@vmware.com>
Signed-off-by: abarreiro <abarreiro@vmware.com>
Signed-off-by: abarreiro <abarreiro@vmware.com>
Signed-off-by: abarreiro <abarreiro@vmware.com>
Signed-off-by: abarreiro <abarreiro@vmware.com>
Signed-off-by: abarreiro <abarreiro@vmware.com>
Copy link
Collaborator

@Didainius Didainius left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM tests passed.

govcd/vdc_template.go Outdated Show resolved Hide resolved
types/v56/types.go Outdated Show resolved Hide resolved
Signed-off-by: abarreiro <abarreiro@vmware.com>
@adambarreiro adambarreiro merged commit a3c4900 into vmware:main Jun 20, 2024
2 checks passed
@adambarreiro adambarreiro deleted the add-vdc-template branch June 20, 2024 09:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants