-
Notifications
You must be signed in to change notification settings - Fork 59
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
feat(resource-link): Add Service Resource commands #800
Conversation
77e4aa9
to
ac4b804
Compare
https://developer.fastly.com/reference/api/services/resource/ This adds a `service-resource` sub-command which has associated create, delete, list, and update commands. Some of the names in the API may be confusing. I've done my best to add clarification whenever possible. Specifically: - A resource, as named by the API, is truly a _link_ between a service and a resource (e.g. an Object Store), not the resource itself. I've tried to use "resource **link**" wherever appropriate, as also used by the API docs: > A resource represents a link between a resource type and a service version. - In some places, the API mixes `id` and `resource_id` which both refer to the ID of the resource _link_, and not the resource itself. I've changed this so that `id` always refers the resource link, and `resource_id` to the linked to object. See this code comment: https://github.com/fastly/go-fastly/blob/ef4694a59779f202d8ea630b41333eb2b76969e8/fastly/resource.go#L125-L129 - It's possible to provide a resource link name. If set, this is an alias for the resource. Otherwise, whatever name was used when creating the resource itself will be the name to reference from the service for the resource. I've added to the description that this is an _alias_. See this code comment: https://github.com/fastly/go-fastly/blob/ef4694a59779f202d8ea630b41333eb2b76969e8/fastly/resource.go#L86-L88 I'd like to look into modifying `go-fastly` to remove the need for the `jsonResource` type, and also into updating the API to be more consistent with `id` vs `resource_id`.
ac4b804
to
58f932b
Compare
This comes with changes specific to the Resource API: - Renamed `resource_id` to `id` when referencing resource (link) ID - Added `json` tags to the Resource type
Bikeshedding on the command name, I wonder if |
globals -> g data -> m
@joeshaw to be honest for me either the current
I'm not sure which 'description' I'm more likely to say in my head when looking at the command. At a push my gut says |
The UI will eventually be updated with a top-level For this reason, I think that |
This better matches the language used in Fastly's web UI.
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.
LGTM 👍🏻
https://developer.fastly.com/reference/api/services/resource/
This adds a
resource-link
sub-command which has associated create, delete, list, and update commands.Upgraded github.com/fastly/go-fastly/v7 v7.1.0 => v7.2.0
Some of the names in the API may be confusing. I've done my best to add clarification whenever possible. Specifically:
A resource, as named by the API, is truly a link between a service and a resource (e.g. an Object Store), not the resource itself. I've tried to use "resource link" wherever appropriate, as also used by the API docs:
Update 1d2eb20: uses a different base command name
resource-link
.In some places, the API mixesFixed by resource: Improve parameter naming; support JSON encode go-fastly#394id
andresource_id
which both refer to the ID of the resource link, and not the resource itself. I've changed this so thatid
always refers the resource link, andresource_id
to the linked to object.It's possible to provide a resource link name. If set, this is an alias for the resource. Otherwise, whatever name was used when creating the resource itself will be the name to reference from the service for the resource. I've added to the description that this is an alias. See this code comment: https://github.com/fastly/go-fastly/blob/ef4694a59779f202d8ea630b41333eb2b76969e8/fastly/resource.go#L86-L88
Keeping this as a draft until a new
go-fastly
release is created that incorporates fastly/go-fastly#394.