-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Added new Apigee resource /v1/organizations/<apigee_org>/environments/<apigee_env>/addonsConfig #12616
base: main
Are you sure you want to change the base?
Conversation
sharmajai09
commented
Dec 19, 2024
•
edited
Loading
edited
Hello! I am a robot. Tests will require approval from a repository maintainer to run. @melinath, a repository maintainer, has been assigned to review your changes. If you have not received review feedback within 2 business days, please leave a comment on this PR asking them to take a look. You can help make sure that review is quick by doing a self-review and by running impacted tests locally. |
Taking this over as the original reviewer of #12417 |
Hi there, I'm the Modular magician. I've detected the following information about your changes: Diff reportYour PR generated some diffs in downstreams - here they are.
Missing test reportYour PR includes resource fields which are not covered by any test. Resource: resource "google_apigee_environment_addons_config" "primary" {
api_security_enabled = # value needed
}
|
Tests analyticsTotal tests: 52 Click here to see the affected service packages
🔴 Tests were added that are skipped in VCR:
View the build log |
create_url: '{{env_id}}/addonsConfig:setAddonEnablement' | ||
update_url: '{{env_id}}/addonsConfig:setAddonEnablement' | ||
update_verb: 'POST' | ||
exclude_delete: true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What would you think about sending a POST request to unset AddonEnablement on delete? This would match the behavior of AddonsConfig.
exclude_delete: true | |
delete_url: '{{env_id}}/addonsConfig:setAddonEnablement' | |
delete_verb: 'POST' |
insert_minutes: 5 | ||
update_minutes: 5 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just want to double-check that this is desired; we usually only lengthen the timeouts, not shorten them.
insert_minutes: 5 | ||
update_minutes: 5 | ||
async: | ||
actions: ['create', 'update'] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(if delete support is added)
actions: ['create', 'update'] | |
actions: ['create', 'update', 'delete'] |
base_url: '{{op_id}}' | ||
import_format: | ||
- '{{env_id}}/addonsConfig' | ||
custom_code: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(if delete support is added) you'll also need a test_check_destroy similar to AddonsConfig
test_check_destroy: 'templates/terraform/custom_check_destroy/apigee_addons_override.go.tmpl' |
test_env_vars: | ||
org_id: 'ORG_ID' | ||
billing_account: 'BILLING_ACCT' | ||
exclude_docs: true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There needs to be at least one docs example; you could add a doc-only example similar to AddonsConfig:
magic-modules/mmv1/products/apigee/AddonsConfig.yaml
Lines 45 to 46 in 55ec241
- name: 'apigee_addons_basic' | |
exclude_test: true |
org_id: 'ORG_ID' | ||
billing_account: 'BILLING_ACCT' | ||
exclude_docs: true | ||
skip_vcr: true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just want to double-check that this needs to skip VCR tests? More information on the reasons for doing this (or not): https://googlecloudplatform.github.io/magic-modules/test/test/#skip-tests-in-vcr-replaying-mode
AddonsConfig tests don't seem to need this.
'Enable ApiSecurity Add-On': 'https://cloud.google.com/apigee/docs/api-platform/reference/manage-security-add-on' | ||
api: 'https://cloud.google.com/apigee/docs/reference/apis/apigee/rest/v1/organizations.environments.addonsConfig/setAddonEnablement' | ||
docs: | ||
base_url: '{{env_id}}/addonsConfig' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The addonsConfig
part doesn't need to be in the base_url, since this isn't a "real" resource. Technically the base_url should probably be organizations/{{org_id}}/environments
but I think given the overrides in place this might actually not get used at all.
base_url: '{{env_id}}/addonsConfig' | |
base_url: '{{env_id}}' |
api: 'https://cloud.google.com/apigee/docs/reference/apis/apigee/rest/v1/organizations.environments.addonsConfig/setAddonEnablement' | ||
docs: | ||
base_url: '{{env_id}}/addonsConfig' | ||
self_link: '{{env_id}}/addonsConfig' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't need addonsConfig, since it's not a "real" resource - leaving it off better matches the AddonsConfig resource behavior.
self_link: '{{env_id}}/addonsConfig' | |
self_link: '{{env_id}}' |
config := meta.(*transport_tpg.Config) | ||
|
||
// current import_formats cannot import fields with forward slashes in their value | ||
if err := tpgresource.ParseImportId([]string{"(?P<env_id>.+)/addonsConfig"}, d, config); err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if err := tpgresource.ParseImportId([]string{"(?P<env_id>.+)/addonsConfig"}, d, config); err != nil { | |
if err := tpgresource.ParseImportId([]string{"(?P<env_id>.+)"}, d, config); err != nil { |
nameParts := strings.Split(d.Get("env_id").(string), "/") | ||
if len(nameParts) == 5 { | ||
id := fmt.Sprintf("organizations/%s/environments/%s", nameParts[1], nameParts[3]) | ||
d.SetId(id) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be something like this:
nameParts := strings.Split(d.Get("env_id").(string), "/") | |
if len(nameParts) == 5 { | |
id := fmt.Sprintf("organizations/%s/environments/%s", nameParts[1], nameParts[3]) | |
d.SetId(id) | |
} | |
id := d.Get("env_id").(string) | |
nameParts := strings.Split(id, "/") | |
if len(nameParts) != 4 { // you could be stricter about this check if you want. | |
return nil, fmt.Errorf("env is expected to have shape organizations/{{"{{"}}org_id{{"}}"}}/environments/{{"{{"}}env{{"}}"}}, got %s instead", id) | |
} | |
d.SetId(id) |
Any errors parsing the import id need to be returned - otherwise you might end up with an import that looks like it succeeds but fails to actually set an id (which means the resource won't actually be imported).