fbpx
POSThttps://api.spotinst.io/gcp/setup/credentials?accountId={ACCOUNT_ID}

Link a Spotinst account to an GCP Cloud account.

 

prerequisites:

  • Create a service account for Spotinst actions:
    • Login to the google cloud project you would like Spotinst to connect to
    • Navigate to Service Account and select your project
    • Create a service account for Spotinst actions. name it as wizard instructs:
    • Grant your service account editor permissions

    • Create a JSON key

 

Note: Optionally run credentials validation prior to set credentials request. 
ParameterTypeDescription
ACCOUNT_ID * String

The Account id you want to set

Default: act-12345
Request

Headers
Content-Type: application/json
Authorization: Bearer ${token}
Body
Copied!
Downloaded!
{
 "serviceAccount": {
	 "type": "service_account",
	 "project_id": "test-labs",
	 "private_key_id": "XXXXXXXXXXXXXXXXX",
	 "private_key": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
	 "client_email": "test123@test-labs.iam.gserviceaccount.com",
	 "client_id": "XXXXXXXXXXXXXXXXXXXXX",
	 "auth_uri": "https://accounts.google.com/o/oauth2/auth",
	 "token_uri": "https://oauth2.googleapis.com/token",
	 "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
	 "client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/test123%40test-labs.iam.gserviceaccount.com"
	}
}
AttributeTypeDescription
serviceAccount * Object

Set service account for credentials

serviceAccount.type * String

Valid values: service_account

Example: service_account
serviceAccount.project_id * String

Name of project in GCP

serviceAccount.private_key_id * String

Private key id of JSON key created during prerequisites stage

serviceAccount.private_key * String

Private key of JSON key created during prerequisites stage

serviceAccount.client_email * String

Email associated with service account

serviceAccount.client_id * String

Client ID of service account

serviceAccount.auth_uri * String

Default: https://accounts.google.com/o/oauth2/auth
serviceAccount.token_uri * String

Default: https://oauth2.googleapis.com/token
serviceAccount.auth_provider_x509_cert_url * String

Default: https://www.googleapis.com/oauth2/v1/certs
serviceAccount.client_x509_cert_url * String

Should be in following format: "https://www.googleapis.com/robot/v1/metadata/x509/"

Response

Headers
Content-Type: application/json
Body
Copied!
Downloaded!
{
  "request": {
    "id": "8a8a3f88-7620-4783-bf00-953e0b8892fe",
    "url": "/gcp/setup/credentials?accountId=act-123456",
    "method": "POST",
    "timestamp": "2019-10-17T10:43:54.421Z"
  },
  "response": {
    "status": {
      "code": 200,
      "message": "OK"
    }
  }
}