gophercloud
gophercloud copied to clipboard
[db/v1/instances] add access field - trove database dbaas
Issue
Fixes #2878
Description
- code: add
AccessOpts
struct - code: reuse
AccessOpts
forAccess
field inCreateOpts
- like a value, not pointer - OK? - code: add non-empty checking for that field - OK?
- tests: add field to testing/fixtures_test.go
- tests: add field to testing/requests_test.go
- tests: add link to api-ref samples
Links
- Service/ InstanceController.create: https://github.com/openstack/trove/blob/40fdb7b44fb33e022b77ba8df63fde2565c70dea/trove/instance/service.py#L366
- Service/models.Instance.create: https://github.com/openstack/trove/blob/40fdb7b44fb33e022b77ba8df63fde2565c70dea/trove/instance/service.py#L494
- Service/ InstanceController.update: https://github.com/openstack/trove/blob/40fdb7b44fb33e022b77ba8df63fde2565c70dea/trove/instance/service.py#L581
Related:
- https://github.com/gophercloud/gophercloud/issues/2830
- https://github.com/gophercloud/gophercloud/pull/2831
- https://github.com/openstack/trove/blob/4de40cb5144cfd8cdc4b270f23acfdbd3eafa5be/api-ref/source/instances.inc#create-database-instance
- https://github.com/openstack/trove/blob/4de40cb5144cfd8cdc4b270f23acfdbd3eafa5be/api-ref/source/instances.inc#show-database-instance-details
coverage: 77.835%. remained the same when pulling 97d56c7822eaf0bb8ed93c8660020c75e25eaeb9 on zhekazuev:feature/add-db-instance-access-field into 85872532ef6f9ca35d31f83a21038d2090428c7b on gophercloud:master.
@EmilienM Hi,
What better to use for Access field, a pointer(*AccessOpts
) or a value(AccessOpts
)?
Commit with changes: https://github.com/gophercloud/gophercloud/pull/2876/commits/0b8b1e12aa3a4dc8cc8689da90226285582574b3
From the risks and style side. I prefer to not use pointers where possible, to avoid null pointer issues, but maybe for current scenario there is no option with a value.
@EmilienM Hi,
What better to use for Access field, a pointer(
*AccessOpts
) or a value(AccessOpts
)? Commit with changes: 0b8b1e1From the risks and style side. I prefer to not use pointers where possible, to avoid null pointer issues, but maybe for current scenario there is no option with a value.
@EmilienM Hi,
Could you review these changes?
I just added new field - Access. Without methods specific for that field, e.g.:
- UpdateInstanceAccessbility - update access options like here.
And decided to use the value for Access struct instead of pointers as described below. If it is important to use pointers, I can restore the changes to the pointer version.