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 Behavior support to RDE Interfaces and RDE Types #1074

Merged
merged 40 commits into from
Jul 14, 2023

Conversation

adambarreiro
Copy link
Collaborator

@adambarreiro adambarreiro commented Jun 28, 2023

Overview

This PR complements #965, #973 and #977 as it adds support to create, read, update and delete Behaviors, both in RDE Interfaces and Types.

This PR requires vmware/go-vcloud-director#584.

Context

Behaviors are explained here, but in simplified words, they're "procedures" that belong to RDE Interfaces, are inherited by the RDE Types that use those Interfaces and are invoked on the RDEs that instantiate those types.

Also, Behaviors can be overridden at the RDE Type level. For example, if you use a RDE Interface with behavior "A", you can override what it does in a Type that uses it.

Last but not least, RDE Type Behaviors have "Access Levels", which can define what operations can be done in that behavior.

Description

This PR adds 3 new resources and 3 new data sources:

  • vcd_rde_interface_behavior resource to manage RDE Interface Behaviors, which can be invoked by RDEs and overridden by RDE Types.
  • vcd_rde_interface_behavior data source to read RDE Interface Behaviors, so they can be used
    in RDE Type Behavior overrides.
  • vcd_rde_type_behavior resource to manage Behaviors in RDE Types, which can override those defined
    in RDE Interfaces.
  • vcd_rde_type_behavior data source to read RDE Type Behaviors.
  • vcd_rde_type_behavior_acl resource to manage the access to Behaviors in RDE Types and RDE Interfaces
  • vcd_rde_type_behavior_acl data source to read Access Levels from Behaviors of RDE Types and RDE Interfaces

Caveats

  • Behaviors of a RDE Interface must be created before any RDE Type that uses that Interface is created. For that reason, if one uses vcd_rde_interface_behavior, she must be sure that the vcd_rde_type resources wait for the behaviors to be created with a depends_on. This is explained in vcd_rde_type resource and vcd_rde_interface_behavior resource documentation.

  • vcd_rde_type_behavior_acl could have been a Set inside vcd_rde_type_behavior but it has some peculiar features that made it not possible:

    • An Access Level can be defined for a RDE Type that didn't override a Interface Behavior
    • For this reason one can use RDE Type Behavior IDs but also RDE Interface Behavior IDs.
  • This PR does not implement RDE Type Hooks. As one Hook is a map of keys PostCreate, PostUpdate, PreDelete and PostDelete and values , I believe the best option is yet another resource, otherwise we'd have a circular dependency RDE Type (needs behavior IDs) <-> RDE Type Behavior (needs RDE Type IDs). Probably I'll do in a separate PR

abarreiro added 19 commits June 26, 2023 13:24
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>
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 changed the title WIP: Improve RDEs Add Behavior support to RDE Interfaces and RDE Types Jul 3, 2023
abarreiro added 2 commits July 3, 2023 16:52
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>
abarreiro added 9 commits July 5, 2023 12:39
#
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 July 5, 2023 11:50
abarreiro added 3 commits July 6, 2023 13:43
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.

😵‍💫
At first sight I don't have much to complain, but this is so meta that I will make another review attempt later

vcd/provider.go Outdated Show resolved Hide resolved
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.

Awesome PR! Only few suggestions for docs.

website/docs/d/rde_type_behavior.html.markdown Outdated Show resolved Hide resolved
website/docs/d/rde_type_behavior.html.markdown Outdated Show resolved Hide resolved
abarreiro added 2 commits July 12, 2023 09:59
Signed-off-by: abarreiro <abarreiro@vmware.com>
Signed-off-by: abarreiro <abarreiro@vmware.com>
Copy link

@adezxc adezxc left a comment

Choose a reason for hiding this comment

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

Approved, as Dainius said this is very meta, we might need a refresher on RDEs once again :D

abarreiro added 2 commits July 14, 2023 12:15
Signed-off-by: abarreiro <abarreiro@vmware.com>
Signed-off-by: abarreiro <abarreiro@vmware.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants