Skip to content
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

Generate a function to get a resource ID without calling Azure #442

Closed
mcardosos opened this issue Nov 3, 2016 · 3 comments
Closed

Generate a function to get a resource ID without calling Azure #442

mcardosos opened this issue Nov 3, 2016 · 3 comments

Comments

@mcardosos
Copy link
Contributor

Right now, some methods will require a resource ID, and the way to get it is with Get methods that will return a struct containing the ID. Still, the resource ID can be built easily (and without sending a request to Azure) with fmt.Sprintf, similar to this.

It would be cool if AutoRest generated functions like this one for resources...

func (client VirtualMachinesClient) GetVirtualMachineID (resourceGroupName, vmName string) string {
   return fmt.Sprintf("/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Compute/virtualMachines/%s", client.SubscriptionID, resourceGroupName, vmName)
}

cc @colemickens

@colemickens
Copy link
Contributor

A fluent construction would be interesting as well.

azure.Subscription(subId).ResourceGroup(rgId).Network.PublicIP(pipName) might be interesting.

@marstr
Copy link
Member

marstr commented Feb 13, 2017

This is a great idea, but we'll need to figure out how this relates to the Swaggers to prevent adding too tight of a coupling between our generator and Azure Swaggers. Perhaps this is an example of a place where a Swagger extension could be helpful?

For now, this goes on the Backlog.

@joshgav
Copy link
Contributor

joshgav commented Jan 2, 2018

duplicate of #322, closing

@joshgav joshgav closed this as completed Jan 2, 2018
@github-actions github-actions bot locked and limited conversation to collaborators Apr 11, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants