gcp-resource-manager

command module
v0.0.0-...-8c3589e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 27, 2022 License: MIT Imports: 5 Imported by: 0

README

GCP Resource Manager with Fiber

API List

  • Healthcheck: /healthcheck
  • GCE Start: /api/v1/gcp/:ProjectId/gce/state?action=start
  • GCE Stop: /api/v1/gcp/:ProjectId/gce/state?action=stop
  • EC2 Start: /api/v1/aws/ec2/state?action=start
  • EC2 Stop: /api/v1/aws/ec2/state?action=stop

Create GCP IAM

Role

compute.instances.list compute.instances.start compute.instances.stop compute.zoneOperations.get

gcloud iam roles create GCP_RESOURCE_MANAGER --project=${PROJECT_ID} \
--title=GCP_RESOURCE_MANAGER \
--description="Role for GCP Resource Manager" \
--permissions=compute.instances.list,compute.instances.start,compute.instances.stop,compute.zoneOperations.get
Service Account
gcloud iam service-accounts create gcp-resource-manager \
--display-name="GCP Resource Manager" 
gcloud iam service-accounts add-iam-policy-binding gcp-resource-manager@${PROJECT_ID}.iam.gserviceaccount.com \
--role=projects/${PROJECT_ID}/roles/GCP_RESOURCE_MANAGER \
--member=allAuthenticatedUsers

How to deploy on GCP with Cloud Run

gcloud run deploy gcp-resource-manager \
--image=${IMAGE_NAME} \
--service-account=${SERVICE_ACCOUNT} \
--ingress=internal \
--no-allow-unauthenticated \
--region=asia-northeast3 \

How to call on GCP with Cloud Run

curl -H "Authorization: Bearer $(gcloud auth print-identity-token)" ${CLOUD_RUN_URL}/healthcheck

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
aws
gcp

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL