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

Modification in default network url #170

Open
herambgadgil opened this issue Dec 16, 2020 · 0 comments
Open

Modification in default network url #170

herambgadgil opened this issue Dec 16, 2020 · 0 comments
Assignees

Comments

@herambgadgil
Copy link

The current gce_vm() function fetches and appends the project and network parameters as follows

gce_get_network <- function(network,
                            project = gce_get_global_project()) {
  url <- sprintf("https://www.googleapis.com/compute/v1/projects/%s/global/networks/%s",
                 project, network)
  # compute.networks.get
  f <- gar_api_generator(url, "GET", data_parse_function = function(x) x)
  f()
 
}

But having global/networks/ is not necessarily true in all GCP setups. My organization has it setup as this - https://www.googleapis.com/compute/v1/projects/**project-name**/regions/us-central1/subnetworks/local-us-central1-net01

Because of this, I am never able to setup a VM instance through the function. Below is the error snippet that I get

2020-12-14 23:47:06> Creating template VM
i 2020-12-14 23:47:07 > Request Status Code:  404
Error: API returned: The resource 'projects/**project-name**/global/networks/regions/us-central1/subnetworks/local-us-central1-net01' was not found

Solution
Modification in the source code to remove /global/networks/ as default keywords. Users can put them as and when required.

gce_get_network <- function(network,
                            project = gce_get_global_project()) {
  url <- sprintf("https://www.googleapis.com/compute/v1/projects/%s/%s", project, network)
  # compute.networks.get
  f <- gar_api_generator(url, "GET", data_parse_function = function(x) x)
  f()
 
}

https://github.com/cloudyr/googleComputeEngineR/blob/master/R/networks.R

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants