Python samples and guidelines for using Chronicle Service Management APIs.
To access the Chronicle Service Management API programmatically, use Cloud Shell to authenticate a service account under your GCP organization.
- Go to the Google Cloud Console.
- Activate Cloud Chell.
- Set environment variables by running:
a. Set your organization name:
b. Set the project ID:
export ORG_ID=[YOUR_ORGANIZATION_ID]c. Set the service account name:export PROJECT_ID=[SERVICE_MANAGEMENT_ENABLED_PROJECT_ID]d. Set the path in which the service account key should be stored:export SERVICE_ACCOUNT=[SERVICE_ACCOUNT_NAME]export KEY_LOCATION=[FULL_PATH] # This is used by client libraries to find the key. export GOOGLE_APPLICATION_CREDENTIALS=$KEY_LOCATION
- Create a service account that's associated with your project ID.
gcloud iam service-accounts create $SERVICE_ACCOUNT --display-name \
"Service Account for Chronicle Service Management APIs" --project $PROJECT_ID
- Create a key to associate with the service account.
gcloud iam service-accounts keys create $KEY_LOCATION --iam-account \
$SERVICE_ACCOUNT@$PROJECT_ID.iam.gserviceaccount.com
- Grant the service account the
chroniclesm.adminrole for the organization.
gcloud organizations add-iam-policy-binding $ORG_ID \
--member="serviceAccount:$SERVICE_ACCOUNT@$PROJECT_ID.iam.gserviceaccount.com" \
--role='roles/chroniclesm.admin'