Skip to content
This repository has been archived by the owner on Mar 25, 2022. It is now read-only.

Add machine images resource #109

Merged
merged 10 commits into from
Jan 11, 2018
Merged

Add machine images resource #109

merged 10 commits into from
Jan 11, 2018

Conversation

scross01
Copy link
Contributor

Adds a resource and data source for the Machine Images API
https://docs.oracle.com/en/cloud/iaas/compute-iaas-cloud/stcsa/api-MachineImages.html

Copy link
Contributor

@mbfrahry mbfrahry left a comment

Choose a reason for hiding this comment

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

LGTM with a couple minor comment nits

}

// Populate schema attributes
d.SetId(fmt.Sprintf("%s", result.Name)) // TODO
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a TODO here or is this a leftover comment?

Copy link
Contributor Author

@scross01 scross01 Jan 11, 2018

Choose a reason for hiding this comment

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

Ah yes, I wasn't entirely sure what should be set for SetId() - for the other data source I looked at for examples they are concatenating multiple attributes into the SetId() - for the machine image the name should be enough the be unique - but I did wonder if the Id should be set to the fully qualified name e.g. /Compute-mydomain/user@example.com/my-machine-image

Copy link
Contributor

Choose a reason for hiding this comment

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

The name should be fine as an ID here. We had talked about doing fqdn for resources and I think this would be a good starting resource if you wanted to add that here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've left it as just name, we should think though how we consistently handle the fully qualified resource names as apply across all resources in a single update, for another time...

Computed: true,
},

// TODO
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we put a little blurb about why this is TODO? Just so we know when to come back to it

Copy link
Contributor Author

Choose a reason for hiding this comment

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

None of the machine images I checked returned a sizes response, so couldn't validate the data structure. I'll double check again and either update or remove.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed (removed)

if account, ok := d.GetOk("account"); ok && account != nil {
input.Account = account.(string)
} else {
input.Account = fmt.Sprintf("/Compute-%s/cloud_storage", d.Get("identity_domain").(string)) // XXX TODO BROKEN
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This needs to be removed

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

@scross01
Copy link
Contributor Author

Fixed nits

Copy link
Contributor

@mbfrahry mbfrahry left a comment

Choose a reason for hiding this comment

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

LGTM!

@mbfrahry mbfrahry merged commit 7ee6181 into master Jan 11, 2018
@mbfrahry mbfrahry deleted the f-machine-images branch January 11, 2018 23:30
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants