alfonsof/google-cloud-python-examples

The resource 'projects/gcloud-java-examples' was not found

Opened this issue · 1 comments

Hi GCP Support Team,

I am referring to https://github.com/alfonsof/google-cloud-python-examples and I am encountering the below issue

#python3 computeengineinstances.py

MENU
0 = Quit
1 = List all VM instances
2 = Create VM instance
3 = List VM instance
4 = Start instance
5 = Stop instance
6 = Reset instance
7 = Delete instance

Enter an option? 1
Listing VM instances ...
Traceback (most recent call last):
  File "/root/google-cloud-python-examples/gcloudcomputeengine/computeengineinstances.py", line 56, in <module>
    main()
  File "/root/google-cloud-python-examples/gcloudcomputeengine/computeengineinstances.py", line 33, in main
    computeenginehelper.list_instances()
  File "/root/google-cloud-python-examples/gcloudcomputeengine/computeenginehelper.py", line 27, in list_instances
    response = compute.instances().list(project=PROJECT_NAME, zone=ZONE_NAME).execute()
  File "/usr/local/lib/python3.9/site-packages/googleapiclient/_helpers.py", line 131, in positional_wrapper
    return wrapped(*args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/googleapiclient/http.py", line 937, in execute
    raise HttpError(resp, content, uri=self.uri)
googleapiclient.errors.HttpError: <HttpError 404 when requesting https://compute.googleapis.com/compute/v1/projects/gcloud-java-examples/zones/us-east1-b/instances?alt=json returned "The resource 'projects/gcloud-java-examples' was not found". Details: "[{'message': "The resource 'projects/gcloud-java-examples' was not found", 'domain': 'global', 'reason': 'notFound'}]">

When i run gcloud command it works.

gcloud compute instances list
NAME                                                 ZONE            MACHINE_TYPE   PREEMPTIBLE  INTERNAL_IP  EXTERNAL_IP     STATUS
docker-drupal-krishnamohan                           europe-west2-a  e2-medium                   10.0.0.30    34.142.12.199   RUNNING
gke-dac-drupal-gke-clust-default-pool-92350ba9-390b  europe-west2-a  n2-standard-2               10.0.0.27    35.189.124.212  RUNNING
gke-dac-drupal-gke-clust-default-pool-b42e3504-sss9  europe-west2-b  n2-standard-2               10.0.0.25    35.197.228.58   RUNNING
apache-cassandra-servicetest-jineesh                 europe-west2-c  e2-medium                   10.0.0.18                    TERMINATED
apache-servicetest-jineesh                           europe-west2-c  e2-medium                   10.0.0.13    35.197.224.90   TERMINATED
apigee-1node-test-instance                           europe-west2-c  n2-standard-2               10.0.0.20                    TERMINATED
apigee-servicetest-jineesh                           europe-west2-c  e2-standard-2               10.0.0.22                    TERMINATED
gke-dac-drupal-gke-clust-default-pool-ee4376e8-lx9g  europe-west2-c  n2-standard-2               10.0.0.26    35.246.48.65    RUNNING
hsbctest-instance-1                                  europe-west2-c  e2-medium                   10.0.0.9     35.234.154.248  TERMINATED
jenkins-sreejith                                     europe-west2-c  e2-medium                   10.0.0.23                    TERMINATED
nginx-servicetest-jineesh                            europe-west2-c  e2-medium                   10.0.0.10                    TERMINATED
pgql-servicetest-jineesh                             europe-west2-c  e2-medium                   10.0.0.19                    TERMINATED

Any clue regarding the below issue?

googleapiclient.errors.HttpError: <HttpError 404 when requesting https://compute.googleapis.com/compute/v1/projects/gcloud-java-examples/zones/us-east1-b/instances?alt=json returned "The resource 'projects/gcloud-java-examples' was not found". Details: "[{'message': "The resource 'projects/gcloud-java-examples' was not found", 'domain': 'global', 'reason': 'notFound'}]">

What is the purpose of computeenginehelper.py file as per the below details?

[root@gcloudcomputeengine]# ll
total 20
-rw-r--r-- 1 root root 2582 Mar 10 00:13 README.md
drwxr-xr-x 2 root root   48 Mar 10 00:14 __pycache__
-rw-r--r-- 1 root root 5740 Mar 10 00:13 computeenginehelper.py
-rw-r--r-- 1 root root 1641 Mar 10 00:13 computeengineinstances.py
[root@gcloudcomputeengine]#

Please help me understand with examples.