Skip to content

Conversation

@Didainius
Copy link
Contributor

@Didainius Didainius commented Feb 3, 2025

This code contains many search/replace things, but core change is in provider.go

The root thing is that the meta interface{} attribute will be type ClientContainer instead of *VCDClient.
Instead it is:

type ClientContainer struct {
	tmClient *VCDClient
        futureClient *OtherClient <------ not existing now
}

Such approach allows us to expand the meta argument that is used in all SDK method with additional structures that might be required.

The difference for consumption is that it becomes:

vcfaClient := meta.(ClientContainer).tmClient

instead of:

vcdClient := meta.(*VCDClient)

in each SDK consuming

Tests passed without any panics which should confirm that there are no missing replacements.

@Didainius Didainius marked this pull request as ready for review February 3, 2025 15:15
Signed-off-by: Dainius <[email protected]>
@Didainius Didainius changed the title Use a container MetaContainer for meta interface{} to extend Use a container ClientContainer for meta interface{} to extend Feb 4, 2025
Signed-off-by: Dainius <[email protected]>
Signed-off-by: Dainius <[email protected]>
Copy link
Contributor

@adambarreiro adambarreiro left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link

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

Looks great, just PR still mentions "meta" :)

@Didainius
Copy link
Contributor Author

Looks great, just PR still mentions "meta" :)

The parts of meta interface{} will stay, because this is the form which Terraform SDK uses to pass ClientContainer around all the CRUD functions

@Didainius Didainius merged commit 9c62946 into vmware:main Feb 4, 2025
2 checks passed
@Didainius Didainius deleted the client-container branch February 4, 2025 13:25
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.

3 participants